This is a flag that indicates whether to eliminate implicits that cannot be satisfied within the current scope.
implicitShouldDocument decides whether a member inherited by implicit conversion should be documented
Make implicits explicit - Not used curently
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:
How? some notes:
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.
Computes the shadowing table for all the members in the implicit conversions
Computes the shadowing table for all the members in the implicit conversions
All template's members, including usecases and full signature members
All the conversions the template takes part in
the ususal :)
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]
typeVarsToOriginOrWildcard transforms the "untouchable" type variables into either their origins (the original type parameters) or into wildcard types if nothing matches
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:
wildcardToNothing transforms wildcard types back to Nothing
(modelFactoryImplicitSupport: StringAdd).self
(modelFactoryImplicitSupport: StringFormat).self
(modelFactoryImplicitSupport: ArrowAssoc[ModelFactoryImplicitSupport]).x
(Since version 2.10.0) Use leftOfArrow
instead
(modelFactoryImplicitSupport: Ensuring[ModelFactoryImplicitSupport]).x
(Since version 2.10.0) Use resultOfEnsuring
instead
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:
Overview: - scaladoc-ing the above classes,
A
will get two more methods: foo and bar, over its default methods - the nested classes (specificallyD
above), abstract types, type aliases and constructor members are not added toA
(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 toC
instead ofB
) - seedefinitionName
in MemberImplInternals: TODO: Give an overview here