Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set default source version to 3.5 #20435

Merged
merged 2 commits into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/typer/Implicits.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1718,7 +1718,7 @@ trait Implicits:
SearchSuccess(tpd.ref(ref).withSpan(span.startPos), ref, 0)(ctx.typerState, ctx.gadt)
case _ =>
searchImplicit(ctx.implicits,
if sourceVersion.isAtLeast(SourceVersion.future) then SearchMode.New
if sourceVersion.isAtLeast(SourceVersion.`3.6`) then SearchMode.New
else if sourceVersion.isAtLeast(SourceVersion.`3.5`) then SearchMode.CompareErr
else if sourceVersion.isAtLeast(SourceVersion.`3.4`) then SearchMode.CompareWarn
else SearchMode.Old)
Expand Down
2 changes: 2 additions & 0 deletions tests/neg/i20415.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class Foo:
given ord: Ordering[Int] = summon[Ordering[Int]] // error
19 changes: 19 additions & 0 deletions tests/neg/i6716-source-3.4.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//> using options -Xfatal-warnings -source 3.4

trait Monad[T]:
def id: String
class Foo
object Foo {
given Monad[Foo] with { def id = "Foo" }
}

opaque type Bar = Foo
object Bar {
given Monad[Bar] = summon[Monad[Foo]] // warn
}

object Test extends App {
println(summon[Monad[Foo]].id)
println(summon[Monad[Bar]].id)
}
// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings)
14 changes: 14 additions & 0 deletions tests/pos/given-loop-prevention.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//> using options -Xfatal-warnings -source 3.4

class Foo

object Bar {
given Foo with {}
given List[Foo] = List(summon[Foo]) // ok
}

object Baz {
@annotation.nowarn
given List[Foo] = List(summon[Foo]) // gives a warning, which is suppressed
given Foo with {}
}
Loading