diff options
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/neg/t6815.check | 5 | ||||
-rw-r--r-- | test/files/neg/t6815.scala | 17 | ||||
-rw-r--r-- | test/files/neg/volatile_no_override.check | 5 | ||||
-rw-r--r-- | test/files/neg/volatile_no_override.scala | 14 | ||||
-rw-r--r-- | test/files/pos/t6815.scala | 17 | ||||
-rw-r--r-- | test/files/pos/t6815_import.scala | 16 | ||||
-rwxr-xr-x | test/files/presentation/doc/doc.scala | 2 |
7 files changed, 75 insertions, 1 deletions
diff --git a/test/files/neg/t6815.check b/test/files/neg/t6815.check new file mode 100644 index 0000000000..fae3819be1 --- /dev/null +++ b/test/files/neg/t6815.check @@ -0,0 +1,5 @@ +t6815.scala:15: error: stable identifier required, but Test.this.u.emptyValDef found. + Note that value emptyValDef is not stable because its type, Test.u.ValDef, is volatile. + case _: u.emptyValDef.T => // and, unlike in pos/t6185.scala, we shouldn't allow this. + ^ +one error found diff --git a/test/files/neg/t6815.scala b/test/files/neg/t6815.scala new file mode 100644 index 0000000000..ff973a7437 --- /dev/null +++ b/test/files/neg/t6815.scala @@ -0,0 +1,17 @@ +trait U { + trait ValOrDefDefApi { + def name: Any + } + type ValOrDefDef <: ValOrDefDefApi + type ValDef <: ValOrDefDef with ValDefApi { type T } + trait ValDefApi extends ValOrDefDefApi { this: ValDef => } + val emptyValDef: ValDef // the result type is volatile +} + +object Test { + val u: U = ??? + + (null: Any) match { + case _: u.emptyValDef.T => // and, unlike in pos/t6185.scala, we shouldn't allow this. + } +} diff --git a/test/files/neg/volatile_no_override.check b/test/files/neg/volatile_no_override.check new file mode 100644 index 0000000000..a9a60ab697 --- /dev/null +++ b/test/files/neg/volatile_no_override.check @@ -0,0 +1,5 @@ +volatile_no_override.scala:13: error: overriding value x in class A of type Volatile.this.D; + value x has a volatile type; cannot override a member with non-volatile type + val x: A with D = null + ^ +one error found diff --git a/test/files/neg/volatile_no_override.scala b/test/files/neg/volatile_no_override.scala new file mode 100644 index 0000000000..9fad082a90 --- /dev/null +++ b/test/files/neg/volatile_no_override.scala @@ -0,0 +1,14 @@ +class B +class C(x: String) extends B + +abstract class A { + class D { type T >: C <: B } + val x: D + var y: x.T = new C("abc") +} + +class Volatile extends A { + type A >: Null + // test (1.4), pt 2 in RefChecks + val x: A with D = null +} diff --git a/test/files/pos/t6815.scala b/test/files/pos/t6815.scala new file mode 100644 index 0000000000..9244b3d353 --- /dev/null +++ b/test/files/pos/t6815.scala @@ -0,0 +1,17 @@ +trait U { + trait ValOrDefDefApi { + def name: Any + } + type ValOrDefDef <: ValOrDefDefApi + type ValDef <: ValOrDefDef with ValDefApi + trait ValDefApi extends ValOrDefDefApi { this: ValDef => } + val emptyValDef: ValDef // the result type is volatile +} + +object Test { + val u: U = ??? + + u.emptyValDef match { + case u.emptyValDef => // but we shouldn't let that stop us from treating it as a stable identifier pattern. + } +} diff --git a/test/files/pos/t6815_import.scala b/test/files/pos/t6815_import.scala new file mode 100644 index 0000000000..56f4358d59 --- /dev/null +++ b/test/files/pos/t6815_import.scala @@ -0,0 +1,16 @@ +trait U { + trait ValOrDefDefApi { + def name: Any + } + type ValOrDefDef <: ValOrDefDefApi + type ValDef <: ValOrDefDef with ValDefApi + trait ValDefApi extends ValOrDefDefApi { this: ValDef => } + val emptyValDef: ValDef // the result type is volatile +} + +object Test { + val u: U = ??? + + // but we shouldn't let that stop us from treating it as a stable identifier for import + import u.emptyValDef.name +} diff --git a/test/files/presentation/doc/doc.scala b/test/files/presentation/doc/doc.scala index 916b7832f4..a64a423cc5 100755 --- a/test/files/presentation/doc/doc.scala +++ b/test/files/presentation/doc/doc.scala @@ -71,7 +71,7 @@ object Test extends InteractiveTest { if (expanded.isEmpty) None else - Some(ask { () => parseAtSymbol(expanded, raw, pos, Some(sym.owner)) }) + Some(ask { () => parseAtSymbol(expanded, raw, pos, sym.owner) }) } } } |