aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2017-02-01 17:18:13 +1100
committerMartin Odersky <odersky@gmail.com>2017-02-01 17:48:32 +1100
commite34555f69e7cdd6d19d0d1ed969127f4ee65c36e (patch)
tree9b3011bf3074f1d1d8e7d815814b8ed370d98639 /compiler/src/dotty
parentb11e6d678a92187e5e9f821ba1116cec2cce0f8c (diff)
downloaddotty-e34555f69e7cdd6d19d0d1ed969127f4ee65c36e.tar.gz
dotty-e34555f69e7cdd6d19d0d1ed969127f4ee65c36e.tar.bz2
dotty-e34555f69e7cdd6d19d0d1ed969127f4ee65c36e.zip
Disallow taking a class tag of Nothing or Null.
It seems in most cases this leads to weird behavior and cause confusing error messages later. It also means we cannot create an Array[Nothing], except by passing the classtag explicitly.
Diffstat (limited to 'compiler/src/dotty')
-rw-r--r--compiler/src/dotty/tools/dotc/typer/Implicits.scala2
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/src/dotty/tools/dotc/typer/Implicits.scala b/compiler/src/dotty/tools/dotc/typer/Implicits.scala
index 2112b1221..f7d8556a7 100644
--- a/compiler/src/dotty/tools/dotc/typer/Implicits.scala
+++ b/compiler/src/dotty/tools/dotc/typer/Implicits.scala
@@ -521,6 +521,8 @@ trait Implicits { self: Typer =>
val etag = inferImplicitArg(defn.ClassTagType.appliedTo(elemTp), error, pos)
if (etag.isEmpty) etag else etag.select(nme.wrap)
case tp if hasStableErasure(tp) =>
+ if (defn.isBottomClass(tp.typeSymbol))
+ error(where => i"attempt to take ClassTag of undetermined type for $where")
ref(defn.ClassTagModule)
.select(nme.apply)
.appliedToType(tp)