aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer/RefChecks.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/dotty/tools/dotc/typer/RefChecks.scala')
-rw-r--r--src/dotty/tools/dotc/typer/RefChecks.scala16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/typer/RefChecks.scala b/src/dotty/tools/dotc/typer/RefChecks.scala
index 2b81af5cb..f45966741 100644
--- a/src/dotty/tools/dotc/typer/RefChecks.scala
+++ b/src/dotty/tools/dotc/typer/RefChecks.scala
@@ -814,6 +814,22 @@ class RefChecks extends MiniPhase with SymTransformer { thisTransformer =>
currentLevel.enterReference(tree.tpe.typeSymbol, tree.pos)
tree
}
+
+ override def transformTypeApply(tree: tpd.TypeApply)(implicit ctx: Context, info: TransformerInfo): tpd.Tree = {
+ tree.fun match {
+ case fun@Select(qual, selector) =>
+ val sym = tree.symbol
+
+ if (sym == defn.Any_isInstanceOf) {
+ val argType = tree.args.head.tpe
+ val qualCls = qual.tpe.widen.classSymbol
+ val argCls = argType.classSymbol
+ if (qualCls.isPrimitiveValueClass && !argCls.isPrimitiveValueClass) ctx.error("isInstanceOf cannot test if value types are references", tree.pos)
+ }
+ case _ =>
+ }
+ tree
+ }
}
}