Dotty Documentation


object RefChecks

[-] Constructors

[-] Members

[+] class LevelInfo

A class to help in forward reference checking

[+] class OptLevelInfo
[+] type LevelAndIndex = Map [ Symbol, ( LevelInfo, Int ) ]
[+] val NoLevelInfo : OptLevelInfo
[+] private val defaultMethodFilter : NameFilter
[+] private def checkAllOverrides ( clazz: Symbol ) ( implicit ctx: Context ) : Unit
  1. Check all members of class clazz for 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 final. 1.3. O is deferred, or M has override modifier. 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 is a macro def, O cannot be deferred unless there's a concrete method overriding O. 1.10. 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 override modifier 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.

[+] private def checkCompanionNameClashes ( cls: Symbol ) ( implicit ctx: Context ) : Unit

Check that a class and its companion object to not both define a class or module with same name

[+] private def checkDeprecatedOvers ( tree: Tree ) ( implicit ctx: Context ) : Unit

Check that a deprecated val or def does not override a concrete, non-deprecated method. If it does, then deprecation is meaningless.

[+] private def checkOverloadedRestrictions ( clazz: Symbol ) ( implicit ctx: Context ) : Unit

Only one overloaded alternative is allowed to define default arguments

[+] private def checkParents ( cls: Symbol ) ( implicit ctx: Context ) : Unit

Check that self type of this class conforms to self types of parents. and required classes.

[+] private def checkUndesiredProperties ( sym: Symbol , pos: Position ) ( implicit ctx: Context ) : Unit
[+] private def upwardsThisType ( cls: Symbol ) ( implicit ctx: Context ) : Type

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).