Skip to content

New implicit resolution warning mentions "This will be an error in Scala 3.5 and later." but is not an error in 3.5.0-RC1 #20415

Closed
@smarter

Description

@smarter

Compiler version

3.5.0-RC1

Minimized code

class Foo:
  given ord: Ordering[Int] = summon[Ordering[Int]]

Output

  |                                                            ^
  |Result of implicit search for Ordering[Int] will change.
  |Current result Foo.this.ord will be no longer eligible
  |  because it is not defined before the search position.
  |Result with new rules: scala.math.Ordering.Int.
  |To opt into the new rules, compile with `-source future` or use
  |the `scala.language.future` language import.
  |
  |To fix the problem without the language import, you could try one of the following:
  |  - use a `given ... with` clause as the enclosing given,
  |  - rearrange definitions so that Foo.this.ord comes earlier,
  |  - use an explicit argument.
  |This will be an error in Scala 3.5 and later.

Expectation

This should actually be an error. Also, ideally I'd really like to enable the new behavior in my codebase, but -source future breaks too many things, can we add it to -source 3.6 instead?

Metadata

Metadata

Labels

area:implicitsrelated to implicitsarea:reportingError reporting including formatting, implicit suggestions, etcitype:bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions