summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Typers.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-05-01 18:27:05 -0700
committerPaul Phillips <paulp@improving.org>2012-05-01 19:52:09 -0700
commite69ee3676dec6023a0d552a6dbabf9ffd29a7111 (patch)
treea80d8cc54630b3ed78c12b87c85db96359dbe6ab /src/compiler/scala/tools/nsc/typechecker/Typers.scala
parentae5ff6628bb74c16d871a2ada0664cdd5d2399a5 (diff)
downloadscala-e69ee3676dec6023a0d552a6dbabf9ffd29a7111.tar.gz
scala-e69ee3676dec6023a0d552a6dbabf9ffd29a7111.tar.bz2
scala-e69ee3676dec6023a0d552a6dbabf9ffd29a7111.zip
Hackaround for people who like to instantiate the uninstantiable.
Closes SI-5666 again. (I don't have the least clue how I'm supposed to issue the error.)
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Typers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 89c30590c9..9c13c630b1 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -3925,6 +3925,10 @@ trait Typers extends Modes with Adaptations with Taggings with PatMatVirtualiser
val sym = tp.typeSymbol.initialize
if (sym.isAbstractType || sym.hasAbstractFlag)
IsAbstractError(tree, sym)
+ else if (isPrimitiveValueClass(sym)) {
+ NotAMemberError(tpt, TypeTree(tp), nme.CONSTRUCTOR)
+ setError(tpt)
+ }
else if (!( tp == sym.thisSym.tpe // when there's no explicit self type -- with (#3612) or without self variable
// sym.thisSym.tpe == tp.typeOfThis (except for objects)
|| narrowRhs(tp) <:< tp.typeOfThis