From 8b63b6aacbb2efbabe91fe8e9bebcbbcfc242b8e Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Wed, 15 Oct 2008 14:22:32 +0000 Subject: Tightened volatile checking. --- test/files/neg/volatile.check | 7 +++++++ test/files/neg/volatile.scala | 24 ++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 test/files/neg/volatile.check create mode 100644 test/files/neg/volatile.scala (limited to 'test/files/neg') 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 +} -- cgit v1.2.3