dotty.tools.dotc.transform

FullParameterization

Related Docs: object FullParameterization | package transform

trait FullParameterization extends AnyRef

Provides methods to produce fully parameterized versions of instance methods, where the this of the enclosing class is abstracted out in an extra leading $this parameter and type parameters of the class become additional type parameters of the fully parameterized method.

Example usage scenarios are:

Note that the methods lift out type parameters of the class containing the instance method, but not type parameters of enclosing classes. The fully instantiated method therefore needs to be put in a scope "close" to the original method, i.e. they need to share the same outer pointer. Examples of legal positions are: in the companion object, or as a local method inside the original method.

Note: The scheme does not handle yet methods where type parameter bounds depend on value parameters of the enclosing class, as in:

class C(val a: String) extends AnyVal { def foo[U <: a.type]: Unit = ... }

The expansion of method foo would lead to

def foo$extension[U <: $this.a.type]($this: C): Unit = ...

which is not typable. Not clear yet what to do. Maybe allow PolyTypes to follow method parameters and translate to the following:

def foo$extension($this: C)[U <: $this.a.type]: Unit = ...

See also

class-dependent-extension-method.scala in pending/pos.

Linear Supertypes
AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. FullParameterization
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def rewiredTarget(referenced: Symbol, derived: Symbol)(implicit ctx: Context): Symbol

    If references to original symbol referenced from within fully parameterized method derived should be rewired to some fully parameterized method, the rewiring target symbol, otherwise NoSymbol.

    If references to original symbol referenced from within fully parameterized method derived should be rewired to some fully parameterized method, the rewiring target symbol, otherwise NoSymbol.

    Attributes
    protected

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  5. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. def forwarder(derived: TermSymbol, originalDef: ast.tpd.DefDef, abstractOverClass: Boolean = true, liftThisType: Boolean = false)(implicit ctx: Context): ast.tpd.Tree

    A forwarder expression which calls derived, passing along

    A forwarder expression which calls derived, passing along

    • if abstractOverClass the type parameters and enclosing class parameters of originalDef,
    • the this of the enclosing class,
    • the value parameters of the original method originalDef.
  10. def fullyParameterizedDef(derived: TermSymbol, originalDef: ast.tpd.DefDef, abstractOverClass: Boolean = true)(implicit ctx: Context): ast.tpd.Tree

    Given an instance method definition originalDef, return a fully parameterized method definition derived from originalDef, which has derived as symbol and fullyParameterizedType(originalDef.symbol.info) as info.

    Given an instance method definition originalDef, return a fully parameterized method definition derived from originalDef, which has derived as symbol and fullyParameterizedType(originalDef.symbol.info) as info. abstractOverClass defines weather the DefDef should abstract over type parameters of class that contained original defDef

  11. def fullyParameterizedType(info: Type, clazz: ClassSymbol, abstractOverClass: Boolean = true, liftThisType: Boolean = false)(implicit ctx: Context): Type

    Converts the type info of a member of class clazz to a method type that takes the this of the class and any type parameters of the class as additional parameters.

    Converts the type info of a member of class clazz to a method type that takes the this of the class and any type parameters of the class as additional parameters. Example:

    class Foo[+A <: AnyRef](val xs: List[A]) extends AnyVal { def baz[B >: A](x: B): List[B] = ... }

    leads to:

    object Foo { def extension$baz[B >: A <: Any, A >: Nothing <: AnyRef]($this: Foo[A])(x: B): List[B] }

    If a self type is present, $this has this self type as its type.

    abstractOverClass

    if true, include the type parameters of the class in the method's list of type parameters.

    liftThisType

    if true, require created $this to be $this: (Foo[A] & Foo,this). This is needed if created member stays inside scope of Foo(as in tailrec)

  12. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  13. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  14. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  15. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  16. final def notify(): Unit

    Definition Classes
    AnyRef
  17. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  18. def rewiredTarget(tree: ast.tpd.Tree, derived: Symbol)(implicit ctx: Context): Symbol

    If references to some original symbol from given tree node within fully parameterized method derived should be rewired to some fully parameterized method, the rewiring target symbol, otherwise NoSymbol.

    If references to some original symbol from given tree node within fully parameterized method derived should be rewired to some fully parameterized method, the rewiring target symbol, otherwise NoSymbol. By default implemented as

    rewiredTarget(tree.symbol, derived)

    but can be overridden.

    Attributes
    protected
  19. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  20. def toString(): String

    Definition Classes
    AnyRef → Any
  21. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  22. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  23. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped