From cdebd91712b36b048233d7cf9501cc7a5bb50b31 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Mon, 11 Jul 2016 18:05:36 +0200 Subject: Allow definition of new types in refinements Allow definition of types in refinements that do not appear in parent type. --- tests/neg/i39.scala | 2 +- tests/neg/i50-volatile.scala | 4 ++-- tests/neg/subtyping.scala | 2 +- tests/neg/zoo.scala | 12 ++++++------ 4 files changed, 10 insertions(+), 10 deletions(-) (limited to 'tests/neg') diff --git a/tests/neg/i39.scala b/tests/neg/i39.scala index df53d9816..8a13a7d06 100644 --- a/tests/neg/i39.scala +++ b/tests/neg/i39.scala @@ -1,7 +1,7 @@ object i39neg { trait B { - type D <: { type T } // error + type D <: { type T } def d: D } diff --git a/tests/neg/i50-volatile.scala b/tests/neg/i50-volatile.scala index f6fa3466d..fcfc9592b 100644 --- a/tests/neg/i50-volatile.scala +++ b/tests/neg/i50-volatile.scala @@ -3,10 +3,10 @@ class Test { class Inner } type A <: Base { - type X = String // error + type X = String // old-error } type B <: { - type X = Int // error + type X = Int // old-error } lazy val o: A & B = ??? diff --git a/tests/neg/subtyping.scala b/tests/neg/subtyping.scala index 27cc0568e..351fa0ecd 100644 --- a/tests/neg/subtyping.scala +++ b/tests/neg/subtyping.scala @@ -8,7 +8,7 @@ object Test { implicitly[B#X <:< A#X] // error: no implicit argument } def test2(): Unit = { - val a : { type T; type U } = ??? // error // error + val a : { type T; type U } = ??? implicitly[a.T <:< a.U] // error: no implicit argument } } diff --git a/tests/neg/zoo.scala b/tests/neg/zoo.scala index 3d9b77b72..19efcc1d7 100644 --- a/tests/neg/zoo.scala +++ b/tests/neg/zoo.scala @@ -1,23 +1,23 @@ object Test { type Meat = { - type IsMeat = Any // error + type IsMeat = Any } type Grass = { - type IsGrass = Any // error + type IsGrass = Any } type Animal = { - type Food // error + type Food def eats(food: Food): Unit // error def gets: Food // error } type Cow = { - type IsMeat = Any // error - type Food <: Grass // error + type IsMeat = Any + type Food <: Grass def eats(food: Grass): Unit // error def gets: Grass // error } type Lion = { - type Food = Meat // error + type Food = Meat def eats(food: Meat): Unit // error def gets: Meat // error } -- cgit v1.2.3