From e69ee3676dec6023a0d552a6dbabf9ffd29a7111 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Tue, 1 May 2012 18:27:05 -0700 Subject: 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.) --- src/compiler/scala/tools/nsc/typechecker/Typers.scala | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/compiler') 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 -- cgit v1.2.3