Skip to content

Commit 32bfd5f

Browse files
authored
push distributivity rule to source future (#24376)
2 parents 42bd780 + d36767f commit 32bfd5f

File tree

13 files changed

+130
-21
lines changed

13 files changed

+130
-21
lines changed

compiler/src/dotty/tools/dotc/config/SourceVersion.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ enum SourceVersion:
4646
def enablesNamedTuples = isAtLeast(`3.7`)
4747
def enablesBetterFors(using Context) = isAtLeast(`3.8`) || (isAtLeast(`3.7`) && isPreviewEnabled)
4848
/** See PR #23441 and tests/neg/i23435-min */
49-
def enablesDistributeAnd = !isAtLeast(`3.8`)
49+
def enablesDistributeAnd = !isAtLeast(`future`)
5050

5151
def requiresNewSyntax = isAtLeast(future)
5252

tests/neg/i23435-min.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//> using options -source:3.8
1+
//> using options -source:future
22

33
type Or[+A, +B] = A | B
44

tests/neg/i23435.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//> using options -source:3.8
1+
//> using options -source:future
22

33
trait L[+A]{val a:A}
44
trait R[+B]{val b: B}

tests/neg/i24096.check

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
-- [E007] Type Mismatch Error: tests/neg/i24096.scala:8:31 -------------------------------------------------------------
2-
8 | case r: Terminal[?] => r // error
3-
| ^
4-
| Found: (r : Pull.Terminal[_] & Pull[F, O, Unit])
5-
| Required: Pull[F2, O2, Unit]
6-
|
7-
| where: F is a type in class StreamPullOps with bounds <: [_²] =>> Any
8-
| F2 is a type in method flatMapOutput with bounds >: [x] =>> F[x] and <: [x] =>> Any
9-
|
10-
| longer explanation available when compiling with `-explain`
1+
-- [E007] Type Mismatch Error: tests/neg/i24096.scala:10:31 ------------------------------------------------------------
2+
10 | case r: Terminal[?] => r // error
3+
| ^
4+
| Found: (r : Pull.Terminal[_] & Pull[F, O, Unit])
5+
| Required: Pull[F2, O2, Unit]
6+
|
7+
| where: F is a type in class StreamPullOps with bounds <: [_²] =>> Any
8+
| F2 is a type in method flatMapOutput with bounds >: [x] =>> F[x] and <: [x] =>> Any
9+
|
10+
| longer explanation available when compiling with `-explain`

tests/neg/i24096.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//> using options -source:future
2+
13
abstract class Pull[+F[_], +O, +R]
24
object Pull:
35
abstract class Terminal[+R] extends Pull[Nothing, Nothing, R]

tests/neg/i3989e.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//> using options -source:3.8
1+
//> using options -source:future
22

33
object Test extends App {
44
trait A[+X](val x: X)

tests/neg/singletonInterval.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//> using options -source:3.8
1+
//> using options -source:future
22

33
/** Why the singletonInterval logic cannot be applied for lubArgs and glbArgs in TypeComparer. */
44

tests/pos/cb-companion-joins.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//> using options -source:3.8
1+
//> using options -source:future
22
import language.experimental.modularity
33

44
trait M[Self]:

tests/pos/i10256.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//> using options -source:3.8
1+
//> using options -source:future
22

33
trait Foo[T <: Foo[T]] {
44
type I <: Foo[I]

tests/pos/i11064.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
//> using options -source:3.8
1+
//> using options -source:future
22

33
trait TypedArray[T, Repr]
44

5-
trait Ops[T <: TypedArray[_, T]] {
5+
trait Ops[T <: TypedArray[?, T]] {
66
def typedArray(): T
77
}
88

99
object Test {
10-
def test1(ops: Ops[_ <: TypedArray[_, _]]) = ops.typedArray()
11-
def test2(ops: Ops[_ <: TypedArray[_ <: AnyRef, _]]) = ops.typedArray() // ok, was error: Recursion limit exceeded.
10+
def test1(ops: Ops[? <: TypedArray[?, ?]]) = ops.typedArray()
11+
def test2(ops: Ops[? <: TypedArray[? <: AnyRef, ?]]) = ops.typedArray() // ok, was error: Recursion limit exceeded.
1212
}

0 commit comments

Comments
 (0)