class IsInstanceOfEvaluator
extends MiniPhaseTransform

Implements partial evaluation of sc.isInstanceOf[Sel] according to:

Sel\sctraitclassfinal class
trait??statically known
class?false if classes unrelatedstatically known
final classfalse if classes unrelatedfalse if classes unrelatedstatically known

This is a generalized solution to raising an error on unreachable match cases and warnings on other statically known results of isInstanceOf.

Steps taken:

  1. evalTypeApply will establish the matrix and choose the appropriate handling for the case:
    • Sel/sc is a value class or scrutinee is Any
    • handleStaticallyKnown
    • falseIfUnrelated with scrutinee <:< selector
    • handleFalseUnrelated
    • leave as is (happens)
  2. Rewrite according to steps taken in 1

Constructors

IsInstanceOfEvaluator ( )

Members

[+] val phaseName : String

A name given to the Phase that can be used to debug the compiler. For instance, it is possible to print trees after a given phase using:

A name given to the Phase that can be used to debug the compiler. For instance, it is possible to print trees after a given phase using:

$ ./bin/dotc -Xprint:<phaseNameHere> sourceFile.scala
[+] override def transformTypeApply ( tree: TypeApply ) ( implicit ctx: Context , info: TransformerInfo ) : Tree

Transforms a TypeApply in order to evaluate an isInstanceOf check according to the rules defined above.

Transforms a TypeApply in order to evaluate an isInstanceOf check according to the rules defined above.