aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-06-28 19:26:21 +0200
committerMartin Odersky <odersky@gmail.com>2015-07-06 16:55:51 +0200
commit1061743aaaf2b18419c8fdb1cc89cb1498c9673f (patch)
treef2a2c4ab7afc7fa7a534ab84543e22e8e465098d /tests
parentc277b9865b8a9a0f72279e0a33184ec3a4efcc33 (diff)
downloaddotty-1061743aaaf2b18419c8fdb1cc89cb1498c9673f.tar.gz
dotty-1061743aaaf2b18419c8fdb1cc89cb1498c9673f.tar.bz2
dotty-1061743aaaf2b18419c8fdb1cc89cb1498c9673f.zip
Error instead of crash when sigName comes up with a missing reference.
A TypeRef can have be unresolved, either because it refers to something that's missing from the classpath or because of transitive self type references. Instead of crashing in sigName, we now report the error. Achieved by defining a new exception type, MissingType, which derives from TypeError. This catches t7933.scala, now integrated in the neg/selfreq.scala. The problem there was a reference to AbsSettings, which was not a member of StandardScalaSettings.this, but was a member of the required type of AbsSettings, which itself appeared in the required type of StandardScalaSettings. We will outlaw in the next commit such transitive required references. Also collapsed TypeError and FatalTypeError. It was a misnomer anyway. Fatal were those type errors that were caught and reported! Open: Where else we should check for unresolved NamedTypes.
Diffstat (limited to 'tests')
-rw-r--r--tests/neg/selfreq.scala37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/neg/selfreq.scala b/tests/neg/selfreq.scala
new file mode 100644
index 000000000..e75e03c16
--- /dev/null
+++ b/tests/neg/selfreq.scala
@@ -0,0 +1,37 @@
+trait X { self: Y =>
+
+ type T <: self.U
+
+ def foo(x: T): T
+ def foo(x: String): String
+
+}
+
+trait Y { self: Z =>
+
+ type U <: self.V
+
+}
+
+trait Z {
+
+ class V
+
+}
+
+object O {
+ val x: X = ???
+ x.foo("a")
+}
+
+import scala.tools.nsc.interpreter.IMain
+
+object Test extends dotty.runtime.LegacyApp {
+ val engine = new IMain.Factory getScriptEngine()
+ engine.asInstanceOf[IMain].settings.usejavacp.value = true
+ val res2 = engine.asInstanceOf[javax.script.Compilable]
+ res2 compile "8" eval()
+ val res5 = res2 compile """println("hello") ; 8"""
+ res5 eval()
+ res5 eval()
+}