RefChecks

dotty.tools.dotc.typer.RefChecks$
See theRefChecks companion class
object RefChecks

Attributes

Companion:
class
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Concise view

Type members

Classlikes

class OverridingPairsChecker(clazz: ClassSymbol, self: Type)(using x$3: Context) extends Cursor

A class for checking all overriding pairs of class with a given check function

A class for checking all overriding pairs of class with a given check function

Attributes

Graph
Supertypes
class Cursor
class Object
trait Matchable
class Any

Value members

Concrete methods

1.1. M must have the same or stronger access privileges as O. 1.2. O must not be effectively final. 1.3. If M or O are extension methods, they must both be extension methods. (Should be before the check for the need of override modifier.) 1.4. O is deferred, or M has override modifier. 1.5. If O is stable, then so is M. 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 erased, O is erased. If O is erased, M is erased or inline. 1.10. If O is inline (and deferred, otherwise O would be final), M must be inline 1.11. If O is a Scala-2 macro, M must be a Scala-2 macro. 1.12. If O is non-experimental, M must be non-experimental. 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 straight port of what was there before, but it looks too complicated and method bodies are far too large.

  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 effectively final. 1.3. If M or O are extension methods, they must both be extension methods. (Should be before the check for the need of override modifier.) 1.4. O is deferred, or M has override modifier. 1.5. If O is stable, then so is M. 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 erased, O is erased. If O is erased, M is erased or inline. 1.10. If O is inline (and deferred, otherwise O would be final), M must be inline 1.11. If O is a Scala-2 macro, M must be a Scala-2 macro. 1.12. If O is non-experimental, M must be non-experimental. 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 straight port of what was there before, but it looks too complicated and method bodies are far too large.

Attributes

Check that we do not "override" anything with a private method or something that becomes a private method. According to the Scala modeling this is non-sensical since private members don't override. But Java and the JVM disagree, if the private member is a method. A test case is neg/i7926b.scala. Note: The compiler could possibly silently rename the offending private instead of flagging it as an error. But that might mean we see some surprising names at runtime. E.g. in neg/i4564a.scala, a private case class apply method would have to be renamed to something else.

Check that we do not "override" anything with a private method or something that becomes a private method. According to the Scala modeling this is non-sensical since private members don't override. But Java and the JVM disagree, if the private member is a method. A test case is neg/i7926b.scala. Note: The compiler could possibly silently rename the offending private instead of flagging it as an error. But that might mean we see some surprising names at runtime. E.g. in neg/i4564a.scala, a private case class apply method would have to be renamed to something else.

Attributes

def checkParents(cls: Symbol, parentTrees: List[Tree])(using Context): Unit

Check that self type of this class conforms to self types of parents and required classes. Also check that only enum constructs extend java.lang.Enum and no user-written class extends ContextFunctionN.

Check that self type of this class conforms to self types of parents and required classes. Also check that only enum constructs extend java.lang.Enum and no user-written class extends ContextFunctionN.

Attributes

Check that unary method definition do not receive parameters. They can only receive inferred parameters such as type parameters and implicit parameters.

Check that unary method definition do not receive parameters. They can only receive inferred parameters such as type parameters and implicit parameters.

Attributes

Concrete fields