OverridingPairs

dotty.tools.dotc.transform.OverridingPairs

A module that can produce a kind of iterator (Cursor), which yields all pairs of overriding/overridden symbols that are visible in some baseclass, unless there's a parent class that already contains the same pairs.

Adapted from the 2.9 version of OverridingPairs. The 2.10 version is IMO way too unwieldy to be maintained.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Type members

Classlikes

class Cursor(base: Symbol)(using x$2: Context)

The cursor class

The cursor class

Value parameters

base

the base class that contains the overriding pairs

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes

Value members

Concrete methods

def isOverridingPair(sym1: Symbol, sym2: Symbol, self: Type)(using Context): Boolean

Is this sym1 considered an override of sym2 (or vice versa) if both are seen as members of site? We declare a match if either we have a full match including matching names or we have a loose match with different target name but the types are the same. We leave out pairs of methods in Java classes under the assumption since these have already been checked and handled by javac. This leaves two possible sorts of discrepancies to be reported as errors in RefChecks:

Is this sym1 considered an override of sym2 (or vice versa) if both are seen as members of site? We declare a match if either we have a full match including matching names or we have a loose match with different target name but the types are the same. We leave out pairs of methods in Java classes under the assumption since these have already been checked and handled by javac. This leaves two possible sorts of discrepancies to be reported as errors in RefChecks:

  • matching names, target names, and signatures but different types
  • matching names and types, but different target names

This method is used as a replacement of matches in some subclasses of OverridingPairs.

Attributes

def isOverridingPair(member: Symbol, memberTp: Type, other: Symbol, otherTp: Type, fallBack: => Boolean, isSubType: (Type, Type) => Context ?=> Boolean)(using Context): Boolean

Let member and other be members of some common class C with types memberTp and otherTp in C. Are the two symbols considered an overriding pair in C? We assume that names already match so we test only the types here.

Let member and other be members of some common class C with types memberTp and otherTp in C. Are the two symbols considered an overriding pair in C? We assume that names already match so we test only the types here.

Value parameters

fallBack

A function called if the initial test is false and member and other are term symbols.

isSubType

A function to be used for checking subtype relationships between term fields.

Attributes