diff options
Diffstat (limited to 'test/files/neg')
-rw-r--r-- | test/files/neg/volatile.check | 7 | ||||
-rw-r--r-- | test/files/neg/volatile.scala | 24 |
2 files changed, 31 insertions, 0 deletions
diff --git a/test/files/neg/volatile.check b/test/files/neg/volatile.check new file mode 100644 index 0000000000..b904284125 --- /dev/null +++ b/test/files/neg/volatile.check @@ -0,0 +1,7 @@ +volatile.scala:11: error: Inferred type C.this.D with C.this.E#T contains type selection from volatile type C.this.D with C.this.E + var sneak = { () => y.x } + ^ +volatile.scala:11: error: Inferred type () => C.this.D with C.this.E#T contains type selection from volatile type C.this.D with C.this.E + var sneak = { () => y.x } + ^ +two errors found diff --git a/test/files/neg/volatile.scala b/test/files/neg/volatile.scala new file mode 100644 index 0000000000..11f6eb539f --- /dev/null +++ b/test/files/neg/volatile.scala @@ -0,0 +1,24 @@ +object Test extends Application { + trait A + trait B extends A + + class C { + type D + trait E { type T >: B <: A; val x : T } + // This is currently correctly disallowed + // val y : (D with E)#T = y + val y : D with E = y + var sneak = { () => y.x } + sneak = { () => new B { } } + } + + class F extends C { + trait G + trait H { type T = G } + type D = H + def frob(arg : G) : G = arg + frob(sneak()) + } + + new F +} |