scala.tools.nsc.doc.model

ModelFactoryImplicitSupport

trait ModelFactoryImplicitSupport extends AnyRef

This trait finds implicit conversions for a class in the default scope and creates scaladoc entries for each of them.

Let's take this as an example:

object Test {
class A

class B {
  def foo = 1
}

class C extends B {
  def bar = 2
  class implicit
}

D def conv(a: A) = new C
}

Overview: - scaladoc-ing the above classes, A will get two more methods: foo and bar, over its default methods - the nested classes (specifically D above), abstract types, type aliases and constructor members are not added to A (see makeMember0 in ModelFactory, last 3 cases) - the members added by implicit conversion are always listed under the implicit conversion, not under the class they actually come from (foo will be listed as coming from the implicit conversion to C instead of B) - see definitionName in MemberImpl

Internals: TODO: Give an overview here

Self Type
ModelFactoryImplicitSupport with ModelFactory with ModelFactoryTypeSupport with CommentFactory with TreeFactory
Source
ModelFactoryImplicitSupport.scala
Linear Supertypes
AnyRef, Any
Type Hierarchy Learn more about scaladoc diagrams
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. ModelFactoryImplicitSupport
  2. AnyRef
  3. Any
Implicitly
  1. by any2stringadd
  2. by any2stringfmt
  3. by any2ArrowAssoc
  4. by any2Ensuring
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

  1. class ImplicitConversionImpl extends ImplicitConversion

  2. class ImplicitNotFound extends Exception

    This is a flag that indicates whether to eliminate implicits that cannot be satisfied within the current scope.

Value Members

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

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. def +(other: String): String

    Implicit information
    This member is added by an implicit conversion from ModelFactoryImplicitSupport to StringAdd performed by method any2stringadd in scala.Predef.
    Definition Classes
    StringAdd
  5. def ->[B](y: B): (ModelFactoryImplicitSupport, B)

    Implicit information
    This member is added by an implicit conversion from ModelFactoryImplicitSupport to ArrowAssoc[ModelFactoryImplicitSupport] performed by method any2ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  6. final def ==(arg0: AnyRef): Boolean

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

    Definition Classes
    Any
  8. val DEBUG: Boolean

  9. val ERROR: Boolean

  10. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  11. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  12. final def debug(msg: ⇒ String): Unit

    Annotations
    @inline()
  13. def ensuring(cond: (ModelFactoryImplicitSupport) ⇒ Boolean, msg: ⇒ Any): ModelFactoryImplicitSupport

    Implicit information
    This member is added by an implicit conversion from ModelFactoryImplicitSupport to Ensuring[ModelFactoryImplicitSupport] performed by method any2Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  14. def ensuring(cond: (ModelFactoryImplicitSupport) ⇒ Boolean): ModelFactoryImplicitSupport

    Implicit information
    This member is added by an implicit conversion from ModelFactoryImplicitSupport to Ensuring[ModelFactoryImplicitSupport] performed by method any2Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  15. def ensuring(cond: Boolean, msg: ⇒ Any): ModelFactoryImplicitSupport

    Implicit information
    This member is added by an implicit conversion from ModelFactoryImplicitSupport to Ensuring[ModelFactoryImplicitSupport] performed by method any2Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  16. def ensuring(cond: Boolean): ModelFactoryImplicitSupport

    Implicit information
    This member is added by an implicit conversion from ModelFactoryImplicitSupport to Ensuring[ModelFactoryImplicitSupport] performed by method any2Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  17. final def eq(arg0: AnyRef): Boolean

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

    Definition Classes
    AnyRef → Any
  19. final def error(msg: ⇒ String): Unit

    Annotations
    @inline()
  20. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  21. def formatted(fmtstr: String): String

    Implicit information
    This member is added by an implicit conversion from ModelFactoryImplicitSupport to StringFormat performed by method any2stringfmt in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  22. final def getClass(): java.lang.Class[_]

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

    Definition Classes
    AnyRef → Any
  24. def implicitShouldDocument(aSym: Global.Symbol): Boolean

    implicitShouldDocument decides whether a member inherited by implicit conversion should be documented

  25. object implicitToExplicit extends Global.TypeMap

    Make implicits explicit - Not used curently

  26. def isDistinguishableFrom(t1: Global.Type, t2: Global.Type): Boolean

  27. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  28. def makeBoundedConstraints(tparams: List[Global.Symbol], constrs: List[Global.TypeConstraint], inTpl: (ModelFactoryImplicitSupport.this)#DocTemplateImpl): List[Constraint]

  29. def makeImplicitConstraints(types: List[Global.Type], sym: Global.Symbol, context: (analyzer)#Context, inTpl: (ModelFactoryImplicitSupport.this)#DocTemplateImpl): List[Constraint]

  30. def makeImplicitConversion(sym: Global.Symbol, result: (analyzer)#SearchResult, constrs: List[Global.TypeConstraint], context: (analyzer)#Context, inTpl: (ModelFactoryImplicitSupport.this)#DocTemplateImpl): List[(ModelFactoryImplicitSupport.this)#ImplicitConversionImpl]

    makeImplicitConversion performs the heavier lifting to get the implicit listing: - for each possible conversion function (also called view) * figures out the final result of the view (to what is our class transformed?) * figures out the necessary constraints on the type parameters (such as T <: Int) and the context (such as Numeric[T]) * lists all inherited members

    makeImplicitConversion performs the heavier lifting to get the implicit listing: - for each possible conversion function (also called view) * figures out the final result of the view (to what is our class transformed?) * figures out the necessary constraints on the type parameters (such as T <: Int) and the context (such as Numeric[T]) * lists all inherited members

    What? in details:

    • say we start from a class A[T1, T2, T3, T4]
    • we have an implicit function (view) in scope: def pimpA[T3 <: Long, T4](a: A[Int, Foo[Bar[X]], T3, T4])(implicit ev1: TypeTag[T4], ev2: Numeric[T4]): PimpedA
    • A is converted to PimpedA ONLY if a couple of constraints are satisfied: * T1 must be equal to Int * T2 must be equal to Foo[Bar[X]] * T3 must be upper bounded by Long * there must be evidence of Numeric[T4] and a TypeTag[T4] within scope
    • the final type is PimpedA and A therefore inherits a couple of members from pimpedA

    How? some notes:

    • Scala's type inference will want to solve all type parameters down to actual types, but we only want constraints to maintain generality
    • therefore, allViewsFrom wraps type parameters into "untouchable" type variables that only gather constraints, but are never solved down to a type
    • these must be reverted back to the type parameters and the constraints must be extracted and simplified (this is done by the uniteConstraints and boundedTParamsConstraints. Be sure to check them out
    • we also need to transform implicit parameters in the view's signature into constraints, such that Numeric[T4] appears as a constraint
  31. def makeImplicitConversions(sym: Global.Symbol, inTpl: (ModelFactoryImplicitSupport.this)#DocTemplateImpl): List[(ModelFactoryImplicitSupport.this)#ImplicitConversionImpl]

    Make the implicit conversion objects

    Make the implicit conversion objects

    A word about the scope of the implicit conversions: currently we look at a very basic context composed of the default Scala imports (Predef._ for example) and the companion object of the current class, if one exists. In the future we might want to extend this to more complex scopes.

  32. def makeShadowingTable(mbrs: List[(ModelFactoryImplicitSupport.this)#MemberImpl], convs: List[(ModelFactoryImplicitSupport.this)#ImplicitConversionImpl], inTpl: (ModelFactoryImplicitSupport.this)#DocTemplateImpl): Map[MemberEntity, ImplicitMemberShadowing]

    Computes the shadowing table for all the members in the implicit conversions

    Computes the shadowing table for all the members in the implicit conversions

    mbrs

    All template's members, including usecases and full signature members

    convs

    All the conversions the template takes part in

    inTpl

    the ususal :)

  33. def makeSubstitutionConstraints(subst: Global.TreeTypeSubstituter, inTpl: (ModelFactoryImplicitSupport.this)#DocTemplateImpl): List[Constraint]

  34. final def ne(arg0: AnyRef): Boolean

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

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

    Definition Classes
    AnyRef
  37. def removeImplicitParameters(viewType: Global.Type): (Global.Type, List[Global.Type])

    removeImplicitParameters transforms implicit parameters from the view result type into constraints and returns the simplified type of the view

    removeImplicitParameters transforms implicit parameters from the view result type into constraints and returns the simplified type of the view

    for the example view: implicit def pimpMyClass[T](a: MyClass[T])(implicit ev: Numeric[T]): PimpedMyClass[T] the implicit view result type is: (a: MyClass[T])(implicit ev: Numeric[T]): PimpedMyClass[T] and the simplified type will be: MyClass[T] => PimpedMyClass[T]

  38. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  39. def toString(): String

    Definition Classes
    AnyRef → Any
  40. object typeVarToOriginOrWildcard extends Global.TypeMap

    typeVarsToOriginOrWildcard transforms the "untouchable" type variables into either their origins (the original type parameters) or into wildcard types if nothing matches

  41. def uniteConstraints(constr: Global.TypeConstraint): (List[Global.Type], List[Global.Type])

    uniteConstraints takes a TypeConstraint instance and simplifies the constraints inside

    uniteConstraints takes a TypeConstraint instance and simplifies the constraints inside

    Normally TypeConstraint contains multiple lower and upper bounds, and we want to reduce this to a lower and an upper bound. Here are a couple of catches we need to be aware of:

    • before finding a view (implicit method in scope that maps class A[T1,T2,.. Tn] to something else) the type parameters are transformed into "untouchable" type variables so that type inference does not attempt to fully solve them down to a type but rather constrains them on both sides just enough for the view to be applicable -- now, we want to transform those type variables back to the original type parameters
    • some of the bounds fail type inference and therefore refer to Nothing => when performing unification (lub, glb) they start looking ugly => we (unsoundly) transform Nothing to WildcardType so we fool the unification algorithms into thinking there's nothing there
    • we don't want the wildcard types surviving the unification so we replace them back to Nothings
  42. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws()
  45. object wildcardToNothing extends Global.TypeMap

    wildcardToNothing transforms wildcard types back to Nothing

  46. def [B](y: B): (ModelFactoryImplicitSupport, B)

    Implicit information
    This member is added by an implicit conversion from ModelFactoryImplicitSupport to ArrowAssoc[ModelFactoryImplicitSupport] performed by method any2ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Shadowed Implict Value Members

  1. val self: Any

    Implicit information
    This member is added by an implicit conversion from ModelFactoryImplicitSupport to StringAdd performed by method any2stringadd in scala.Predef.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (modelFactoryImplicitSupport: StringAdd).self
    Definition Classes
    StringAdd
  2. val self: Any

    Implicit information
    This member is added by an implicit conversion from ModelFactoryImplicitSupport to StringFormat performed by method any2stringfmt in scala.Predef.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (modelFactoryImplicitSupport: StringFormat).self
    Definition Classes
    StringFormat

Deprecated Value Members

  1. def x: ModelFactoryImplicitSupport

    Implicit information
    This member is added by an implicit conversion from ModelFactoryImplicitSupport to ArrowAssoc[ModelFactoryImplicitSupport] performed by method any2ArrowAssoc in scala.Predef.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (modelFactoryImplicitSupport: ArrowAssoc[ModelFactoryImplicitSupport]).x
    Definition Classes
    ArrowAssoc
    Annotations
    @deprecated
    Deprecated

    (Since version 2.10.0) Use leftOfArrow instead

  2. def x: ModelFactoryImplicitSupport

    Implicit information
    This member is added by an implicit conversion from ModelFactoryImplicitSupport to Ensuring[ModelFactoryImplicitSupport] performed by method any2Ensuring in scala.Predef.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (modelFactoryImplicitSupport: Ensuring[ModelFactoryImplicitSupport]).x
    Definition Classes
    Ensuring
    Annotations
    @deprecated
    Deprecated

    (Since version 2.10.0) Use resultOfEnsuring instead

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from ModelFactoryImplicitSupport to StringAdd

Inherited by implicit conversion any2stringfmt from ModelFactoryImplicitSupport to StringFormat

Inherited by implicit conversion any2ArrowAssoc from ModelFactoryImplicitSupport to ArrowAssoc[ModelFactoryImplicitSupport]

Inherited by implicit conversion any2Ensuring from ModelFactoryImplicitSupport to Ensuring[ModelFactoryImplicitSupport]

Ungrouped