diff options
author | Martin Odersky <odersky@gmail.com> | 2014-03-19 10:33:55 +0100 |
---|---|---|
committer | Tobias Schlatter <tobias@meisch.ch> | 2014-03-21 11:28:30 +0100 |
commit | 7e51434b89659c49a1cd755c224cc5ca270b82b3 (patch) | |
tree | 5cc0aa0c4d7005c720fda5238cffc2bcd760e3d6 /tests | |
parent | c854cc7fcc9d0f889c6235c1534133cff7360e7f (diff) | |
download | dotty-7e51434b89659c49a1cd755c224cc5ca270b82b3.tar.gz dotty-7e51434b89659c49a1cd755c224cc5ca270b82b3.tar.bz2 dotty-7e51434b89659c49a1cd755c224cc5ca270b82b3.zip |
Fix for t1292 - legal prefixes
The original test is now in error because the type Meta in the prefix Meta#Event
is not stable and contains an abstract member Slog.
Even after removing Slog, the test in pos was still in error because the bound type parameters
were incorrectly recognized as abstract members. This has been fixed by the changes to Types.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/neg/t1292.scala | 35 | ||||
-rw-r--r-- | tests/pos/t1292.scala (renamed from tests/pending/pos/t1292.scala) | 5 |
2 files changed, 37 insertions, 3 deletions
diff --git a/tests/neg/t1292.scala b/tests/neg/t1292.scala new file mode 100644 index 000000000..69e680320 --- /dev/null +++ b/tests/neg/t1292.scala @@ -0,0 +1,35 @@ +trait Foo[T <: Foo[T, Enum], Enum <: Enumeration] { + type StV = Enum#Value + type Meta = MegaFoo[T, Enum] + + type Slog <: Enumeration + + def getSingleton: Meta +} + +trait MegaFoo[T <: Foo[T, Enum], Enum <: Enumeration] extends Foo[T, Enum] { + def doSomething(what: T, misc: StV, dog: Meta#Event) = None + // error: Meta is not a valid prefix for '#'. + // The error is correct. Meta is not stable, and it has an abstract type member Slog + abstract class Event + object Event + + def stateEnumeration: Slog + def se2: Enum +} + +object E extends Enumeration { + val A = Value + val B = Value +} + +class RFoo extends Foo[RFoo, E.type] { + def getSingleton = MegaRFoo + + type Slog = E.type +} + +object MegaRFoo extends RFoo with MegaFoo[RFoo, E.type] { + def stateEnumeration = E + def se2 = E +} diff --git a/tests/pending/pos/t1292.scala b/tests/pos/t1292.scala index 83a996d53..8e69734e9 100644 --- a/tests/pending/pos/t1292.scala +++ b/tests/pos/t1292.scala @@ -2,13 +2,14 @@ trait Foo[T <: Foo[T, Enum], Enum <: Enumeration] { type StV = Enum#Value type Meta = MegaFoo[T, Enum] - type Slog <: Enumeration + type Slog = Enumeration def getSingleton: Meta } trait MegaFoo[T <: Foo[T, Enum], Enum <: Enumeration] extends Foo[T, Enum] { def doSomething(what: T, misc: StV, dog: Meta#Event) = None + abstract class Event object Event @@ -23,8 +24,6 @@ object E extends Enumeration { class RFoo extends Foo[RFoo, E.type] { def getSingleton = MegaRFoo - - type Slog = E.type } object MegaRFoo extends RFoo with MegaFoo[RFoo, E.type] { |