diff options
author | Martin Odersky <odersky@gmail.com> | 2007-11-05 19:33:44 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2007-11-05 19:33:44 +0000 |
commit | db75a1c922d0806ed067c7fa139f806f4424efc7 (patch) | |
tree | 2b70e466a48e453e37afef6a96eecaa5c0d84ac9 | |
parent | ff082b58c65467ffa90651aaae87a2f552cb48ec (diff) | |
download | scala-db75a1c922d0806ed067c7fa139f806f4424efc7.tar.gz scala-db75a1c922d0806ed067c7fa139f806f4424efc7.tar.bz2 scala-db75a1c922d0806ed067c7fa139f806f4424efc7.zip |
fix^2 t0117
-rw-r--r-- | src/compiler/scala/tools/nsc/Global.scala | 2 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 11 | ||||
-rw-r--r-- | test/files/neg/t0117.check | 4 | ||||
-rwxr-xr-x | test/files/neg/t0117.scala | 6 |
4 files changed, 17 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala index 2d1aa28a67..f98c1d50ec 100644 --- a/src/compiler/scala/tools/nsc/Global.scala +++ b/src/compiler/scala/tools/nsc/Global.scala @@ -379,7 +379,7 @@ class Global(var settings: Settings, var reporter: Reporter) extends Trees */ protected def builtInPhaseDescriptors: List[SubComponent] = List( analyzer.namerFactory: SubComponent, // note: types are there because otherwise - analyzer.typerFactory: SubComponent, // consistency check after refchecks would fail. + analyzer.typerFactory: SubComponent // consistency check after refchecks would fail. ) ::: (if (inIDE) List(generateIdeMaps) else List()) ::: // optionally generate .ide files from symbol info that can be used in the IDE List( diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index e7493a999e..8cd65792cc 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -2418,15 +2418,16 @@ trait Typers { self: Analyzer => if (ps.isEmpty) { if (settings.debug.value) Console.println(site.parents map (_.typeSymbol.name))//debug - error(tree.pos, mix+" does not name a parent class of "+clazz) + if (phase.erasedTypes && context.enclClass.owner.isImplClass) { + // the reference to super class got lost during erasure + unit.error(tree.pos, "implementation restriction: traits may not select fields or methods from to super[C] where C is a class") + } else { + error(tree.pos, mix+" does not name a parent class of "+clazz) + } ErrorType } else if (!ps.tail.isEmpty) { error(tree.pos, "ambiguous parent class qualifier") ErrorType - } else if (ps.head.typeSymbol.isClass && !ps.head.typeSymbol.isTrait && - context.enclClass.owner.isTrait) { - error(tree.pos, "traits may not refer to super[C] where C is a class") - ErrorType } else { ps.head } diff --git a/test/files/neg/t0117.check b/test/files/neg/t0117.check new file mode 100644 index 0000000000..f6bb6eaa80 --- /dev/null +++ b/test/files/neg/t0117.check @@ -0,0 +1,4 @@ +t0117.scala:2: error: implementation restriction: traits may not select fields or methods from to super[C] where C is a class +trait B extends A { println(super[A].a) }
+ ^ +one error found diff --git a/test/files/neg/t0117.scala b/test/files/neg/t0117.scala new file mode 100755 index 0000000000..dd200b1cf9 --- /dev/null +++ b/test/files/neg/t0117.scala @@ -0,0 +1,6 @@ +class A { def a = 0 } +trait B extends A { println(super[A].a) } +object Test extends Application { + new B {} +} + |