summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Typers.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2007-01-05 18:26:37 +0000
committerMartin Odersky <odersky@gmail.com>2007-01-05 18:26:37 +0000
commit96248ae593f34301de81970d6b7ba67d7bf31e04 (patch)
tree286aa940fddcc4c35d6daecbcc8374aff9bb2bf0 /src/compiler/scala/tools/nsc/typechecker/Typers.scala
parent114bfa60ec5c24a270de9b9fea4171f3c9afc5e6 (diff)
downloadscala-96248ae593f34301de81970d6b7ba67d7bf31e04.tar.gz
scala-96248ae593f34301de81970d6b7ba67d7bf31e04.tar.bz2
scala-96248ae593f34301de81970d6b7ba67d7bf31e04.zip
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Typers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index a55ba1045e..17723218d9 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -1955,8 +1955,12 @@ trait Typers requires Analyzer {
.setType(appliedType(tpt1.tpe, context.undetparams map (.tpe)))
}
if (tpt1.tpe.symbol hasFlag ABSTRACT)
- error(tree.pos, "" + tpt1.tpe.symbol +
+ error(tree.pos, tpt1.tpe.symbol +
" is abstract; cannot be instantiated")
+ else if (!(tpt1.tpe <:< tpt1.tpe.typeOfThis) && !phase.erasedTypes)
+ error(tree.pos, tpt1.tpe.symbol +
+ " cannot be instantiated because it does not conform to its self-type "+
+ tpt1.tpe.typeOfThis)
copy.New(tree, tpt1).setType(tpt1.tpe)
case Typed(expr, Function(List(), EmptyTree)) =>