class
IsInstanceOfEvaluator
extends
MiniPhaseTransform
Implements partial evaluation of sc.isInstanceOf[Sel]
according to:
Sel\sc | trait | class | final class |
---|---|---|---|
trait | ? | ? | statically known |
class | ? | false if classes unrelated | statically known |
final class | false if classes unrelated | false if classes unrelated | statically 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:
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
withscrutinee <:< selector
handleFalseUnrelated
- leave as is (
happens
)
- Sel/sc is a value class or scrutinee is
- 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