This trait provides logic for assessing the validity of argument adaptations, such as tupling, unit-insertion, widening, etc.
This trait provides logic for assessing the validity of argument adaptations, such as tupling, unit-insertion, widening, etc. Such logic is spread around the compiler, without much ability on the part of the user to tighten the potentially dangerous bits.
TODO: unifying/consolidating said logic under consistent management.
The main attribution phase.
1.0
On pattern matcher checkability:
On pattern matcher checkability:
Consider a pattern match of this form: (x: X) match { case _: P => }
There are four possibilities to consider: [P1] X will always conform to P [P2] x will never conform to P [P3] X <: P if some runtime test is true [P4] X cannot be checked against P
The first two cases correspond to those when there is enough static information to say X <: P or that (x ∈ X) ⇒ (x ∉ P). The fourth case includes unknown abstract types or structural refinements appearing within a pattern.
The third case is the interesting one. We designate another type, XR, which is essentially the intersection of X and |P|, where |P| is the erasure of P. If XR <: P, then no warning is emitted.
Examples of how this info is put to use: sealed trait A[T] ; class B[T] extends A[T] def f(x: B[Int]) = x match { case _: A[Int] if true => } def g(x: A[Int]) = x match { case _: B[Int] => }
f
requires no warning because X=B[Int], P=A[Int], and B[Int] <:< A[Int].
g
requires no warning because X=A[Int], P=B[Int], XR=B[Int], and B[Int] <:< B[Int].
XR=B[Int] because a value of type A[Int] which is tested to be a B can
only be a B[Int], due to the definition of B (B[T] extends A[T].)
This is something like asSeenFrom, only rather than asking what a type looks like from the point of view of one of its base classes, we ask what it looks like from the point of view of one of its subclasses.
This class .
This class ...
1.0
A value class to carry the boolean flags of a context, such as whether errors should be buffered or reported.
1.0
A generic means of breaking down types into their subcomponents.
A generic means of breaking down types into their subcomponents. Types are decomposed top down, and recognizable substructure is dispatched via self-apparently named methods. Those methods can be overridden for custom behavior, but only the abstract methods require implementations, each of which must create some unknown "Node" type from its inputs.
This is a work in progress.
Duplicate trees and re-type check them, taking care to replace and create fresh symbols for new local definitions.
Duplicate trees and re-type check them, taking care to replace and create fresh symbols for new local definitions.
1.0
This trait .
This trait ...
1.0
This trait provides methods to find various kinds of implicits.
This trait provides methods to find various kinds of implicits.
1.0
This trait contains methods related to type parameter inference.
This trait contains methods related to type parameter inference.
1.0
Code to deal with macros, namely with: * Compilation of macro definitions * Expansion of macro applications
Code to deal with macros, namely with: * Compilation of macro definitions * Expansion of macro applications
Say we have in a class C:
def foo[T](xs: List[T]): T = macro fooBar
Then fooBar needs to point to a static method of the following form:
def fooBar[T: c.WeakTypeTag] // type tag annotation is optional (c: scala.reflect.macros.blackbox.Context) (xs: c.Expr[List[T]]) : c.Expr[T] = { ... }
Then, if foo is called in qual.foo[Int](elems), where qual: D, the macro application is expanded to a reflective invocation of fooBar with parameters:
(simpleMacroContext{ type PrefixType = D; val prefix = qual }) (Expr(elems)) (TypeTag(Int))
Logic related to method synthesis which involves cooperation between Namer and Typer.
This trait declares methods to create symbols and to enter them into scopes.
This trait declares methods to create symbols and to enter them into scopes.
1.0
1.0
A pattern match such as
A pattern match such as
x match { case Foo(a, b) => ...}
Might match an instance of any of the following definitions of Foo. Note the analogous treatment between case classes and unapplies.
case class Foo(xs: Int*) case class Foo(a: Int, xs: Int*) case class Foo(a: Int, b: Int) case class Foo(a: Int, b: Int, xs: Int*)
object Foo { def unapplySeq(x: Any): Option[Seq[Int]] } object Foo { def unapplySeq(x: Any): Option[(Int, Seq[Int])] } object Foo { def unapply(x: Any): Option[(Int, Int)] } object Foo { def unapplySeq(x: Any): Option[(Int, Int, Seq[Int])] }
Post-attribution checking and transformation.
Post-attribution checking and transformation.
This phase performs the following checks.
It performs the following transformations.
1.0
Check whether we always check type parameter bounds.
A more principled system for turning types into strings.
This phase adds super accessors for all super calls that either appear in a trait or have as a target a member of some outer class.
This phase adds super accessors for all super calls that either appear in a trait or have as a target a member of some outer class. It also replaces references to parameter accessors with aliases by super references to these aliases. The phase also checks that symbols accessed from super are not abstract, or are overridden by an abstract override. Finally, the phase also mangles the names of class-members which are private up to an enclosing non-package class, in order to avoid overriding conflicts.
This phase also sets SPECIALIZED flag on type parameters with
@specialized
annotation. We put this logic here because the
flag must be set before pickling.
1.0
Synthetic method implementations for case classes and case objects.
Synthetic method implementations for case classes and case objects.
Added to all case classes/objects: def productArity: Int def productElement(n: Int): Any def productPrefix: String def productIterator: Iterator[Any]
Selectively added to case classes/objects, unless a non-default implementation already exists: def equals(other: Any): Boolean def hashCode(): Int def canEqual(other: Any): Boolean def toString(): String
Special handling: protected def readResolve(): AnyRef
An interface to enable higher configurability of diagnostic messages regarding type errors.
An interface to enable higher configurability of diagnostic messages regarding type errors. This is barely a beginning as error messages are distributed far and wide across the codebase. The plan is to partition error messages into some broad groups and provide some mechanism for being more or less verbose on a selective basis. Possible groups include such examples as
arity errors kind errors variance errors ambiguity errors volatility/stability errors implementation restrictions
And more, and there is plenty of overlap, so it'll be a process.
1.0
Logic for turning a type into a String.
Logic for turning a type into a String. The goal is to be able to take some arbitrary object 'x' and obtain the most precise String for which an injection of x.asInstanceOf[String] will be valid from both the JVM's and scala's perspectives.
"definition" is when you want strings like
This trait provides methods to assign types to trees.
This trait provides methods to assign types to trees.
1.0