diff options
author | Martin Odersky <odersky@gmail.com> | 2008-10-15 14:22:32 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2008-10-15 14:22:32 +0000 |
commit | 8b63b6aacbb2efbabe91fe8e9bebcbbcfc242b8e (patch) | |
tree | b657c27ac86edce27d8a8335397ce00de9d969a7 /test/files | |
parent | 7e3aecae9e738c9f4129e1c9b841837722b38dd6 (diff) | |
download | scala-8b63b6aacbb2efbabe91fe8e9bebcbbcfc242b8e.tar.gz scala-8b63b6aacbb2efbabe91fe8e9bebcbbcfc242b8e.tar.bz2 scala-8b63b6aacbb2efbabe91fe8e9bebcbbcfc242b8e.zip |
Tightened volatile checking.
Diffstat (limited to 'test/files')
-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 +} |