diff options
author | Paul Phillips <paulp@improving.org> | 2012-05-01 18:27:05 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-05-01 19:52:09 -0700 |
commit | e69ee3676dec6023a0d552a6dbabf9ffd29a7111 (patch) | |
tree | a80d8cc54630b3ed78c12b87c85db96359dbe6ab /src/compiler | |
parent | ae5ff6628bb74c16d871a2ada0664cdd5d2399a5 (diff) | |
download | scala-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')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 4 |
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 |