Skip to content

Commit 4a76161

Browse files
committed
Set default source version to 3.5
Fixes #20415
1 parent a7ac03e commit 4a76161

File tree

16 files changed

+45
-52
lines changed

16 files changed

+45
-52
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ enum SourceVersion:
2828
def isAtMost(v: SourceVersion) = stable.ordinal <= v.ordinal
2929

3030
object SourceVersion extends Property.Key[SourceVersion]:
31-
def defaultSourceVersion = `3.4`
31+
def defaultSourceVersion = `3.5`
3232

3333
/** language versions that may appear in a language import, are deprecated, but not removed from the standard library. */
3434
val illegalSourceVersionNames = List("3.1-migration").map(_.toTermName)

tests/neg/i20415.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
class Foo:
2+
given ord: Ordering[Int] = summon[Ordering[Int]] // error

tests/neg/i6716-source-3.4.scala

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//> using options -Xfatal-warnings -source 3.4
2+
3+
trait Monad[T]:
4+
def id: String
5+
class Foo
6+
object Foo {
7+
given Monad[Foo] with { def id = "Foo" }
8+
}
9+
10+
opaque type Bar = Foo
11+
object Bar {
12+
given Monad[Bar] = summon[Monad[Foo]] // warn
13+
}
14+
15+
object Test extends App {
16+
println(summon[Monad[Foo]].id)
17+
println(summon[Monad[Bar]].id)
18+
}
19+
// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings)

tests/neg/i6716.check

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
-- Warning: tests/neg/i6716.scala:12:39 --------------------------------------------------------------------------------
2-
12 | given Monad[Bar] = summon[Monad[Foo]] // warn
1+
-- Error: tests/neg/i6716.scala:10:39 ----------------------------------------------------------------------------------
2+
10 | given Monad[Bar] = summon[Monad[Foo]] // error
33
| ^
44
| Result of implicit search for Monad[Foo] will change.
55
| Current result Bar.given_Monad_Bar will be no longer eligible
@@ -12,5 +12,3 @@
1212
| - use a `given ... with` clause as the enclosing given,
1313
| - rearrange definitions so that Bar.given_Monad_Bar comes earlier,
1414
| - use an explicit argument.
15-
| This will be an error in Scala 3.5 and later.
16-
No warnings can be incurred under -Werror (or -Xfatal-warnings)

tests/neg/i6716.scala

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
//> using options -Xfatal-warnings
2-
31
trait Monad[T]:
42
def id: String
53
class Foo
@@ -9,11 +7,10 @@ object Foo {
97

108
opaque type Bar = Foo
119
object Bar {
12-
given Monad[Bar] = summon[Monad[Foo]] // warn
10+
given Monad[Bar] = summon[Monad[Foo]] // error
1311
}
1412

1513
object Test extends App {
1614
println(summon[Monad[Foo]].id)
1715
println(summon[Monad[Bar]].id)
1816
}
19-
// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings)

tests/neg/i7294-a.scala

Lines changed: 0 additions & 14 deletions
This file was deleted.

tests/neg/i7294-b.scala

Lines changed: 0 additions & 12 deletions
This file was deleted.

tests/neg/i7294.scala

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package foo
2+
3+
trait Foo { def g(x: Int): Any }
4+
5+
object Test:
6+
7+
inline given f[T <: Foo]: T = ??? match {
8+
case x: T => x.g(10) // error // error
9+
}
10+
11+
@main def Test = f

tests/pos-deep-subtype/CollectionStrawMan6.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -754,11 +754,11 @@ object CollectionStrawMan6 extends LowPriority {
754754

755755
def elemTag: ClassTag[A] = ClassTag(xs.getClass.getComponentType)
756756

757-
protected def fromIterableWithSameElemType(coll: Iterable[A]): Array[A] = coll.toArray[A](elemTag)
757+
protected def fromIterableWithSameElemType(coll: Iterable[A]): Array[A] = coll.toArray[A](using elemTag)
758758

759759
def fromIterable[B: ClassTag](coll: Iterable[B]): Array[B] = coll.toArray[B]
760760

761-
protected[this] def newBuilder = new ArrayBuffer[A].mapResult(_.toArray(elemTag))
761+
protected[this] def newBuilder = new ArrayBuffer[A].mapResult(_.toArray(using elemTag))
762762

763763
override def knownSize = xs.length
764764

tests/pos/given-loop-prevention.scala

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

33
class Foo
44

0 commit comments

Comments
 (0)