A class to help in forward reference checking
- Check all members of class
clazzfor overriding conditions. That is for overriding member M and overridden member O:
1.1. M must have the same or stronger access privileges as O.
1.2. O must not be effectively final.
1.3. O is deferred, or M has
1.4. If O is stable, then so is M.
// @M: LIFTED 1.5. Neither M nor O are a parameterized type alias
1.6. If O is a type alias, then M is an alias of O.
1.7. If O is an abstract type then
1.7.1 either M is an abstract type, and M's bounds are sharper than O's bounds.
or M is a type alias or class which conforms to O's bounds.
1.7.2 higher-order type arguments must respect bounds on higher-order type parameters -- @M
(explicit bounds and those implied by variance annotations) -- @see checkKindBounds
1.8. If O and M are values, then
1.8.1 M's type is a subtype of O's type, or
1.8.2 M is of type S, O is of type ()T and S <: T, or
1.8.3 M is of type ()S, O is of type T and S <: T, or
1.9 If M or O are erased, they must be both erased
1.10 If M is an inline or Scala-2 macro method, O cannot be deferred unless
there's also a concrete method that M overrides.
1.11. If O is a Scala-2 macro, M must be a Scala-2 macro.
2. Check that only abstract classes have deferred members
3. Check that concrete classes do not have deferred definitions
that are not implemented in a subclass.
4. Check that every member with an
overrides some other member.
TODO check that classes are not overridden
TODO This still needs to be cleaned up; the current version is a straight port of what was there
before, but it looks too complicated and method bodies are far too large.
Check that a class and its companion object to not both define a class or module with same name
Check that a deprecated val or def does not override a concrete, non-deprecated method. If it does, then deprecation is meaningless.
Only one overloaded alternative is allowed to define default arguments
Disallow using trait parameters as prefix for its parents.
The rationale is to ensure outer-related NPE never happen in Scala. Otherwise, outer NPE may happen, see tests/neg/i5083.scala
Check that self type of this class conforms to self types of parents. and required classes.
The this-type of
cls which should be used when looking at the types of
inherited members. If
cls has a non-trivial self type, this returns a skolem
with the class type instead of the
this-type of the class as usual.
This is done because otherwise we want to understand inherited infos
as they are written, whereas with the this-type they could be
more special. A test where this makes a difference is pos/i1401.scala.
This one used to succeed only if forwarding parameters is on.
(Forwarding tends to hide problems by binding parameter names).