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 M must not be a Dotty macro def
1.10. If M is a 2.x macro def, O cannot be deferred unless there's a concrete method overriding O.
1.11. If M is not a macro def, O cannot be a macro def.
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 staright 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
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).