Skip to content

Tighten rules for implicit conversions - #26668

Open
odersky wants to merge 2 commits into
scala:mainfrom
dotty-staging:advance-into
Open

Tighten rules for implicit conversions#26668
odersky wants to merge 2 commits into
scala:mainfrom
dotty-staging:advance-into

Conversation

@odersky

@odersky odersky commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Make use of a given (Scala-3 style) implicit Conversion instance without a language.implicitConversions language import a warning in 3.10 and an error in 3.11.

Make use of a given (Scala-3 style) implicit Conversion instance
without a `language.implicitConversions` language import a warning
in 3.10 and an error in 3.11.
@Gedochao

Copy link
Copy Markdown
Contributor

Let's put it on next Scala Core's agenda.
I think we should do this in 3.10, but let's not rush the merge.

@Gedochao Gedochao added stat:needs decision Some aspects of this issue need a decision from the maintainance team. needs-minor-release This PR cannot be merged until the next minor release labels Jul 31, 2026
* given [T] => Conversion[T, Option[T]] = Some(_)
* ```
* As of Scala 3.9, the language still supports Scala-2 style conversions, but these
* are slated to be phased out.

@bishabosha bishabosha Jul 31, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a reason why Conversion is so restricted, e.g. poor support for path-dependent types, inline/macro, by-name param - I thought the main point of the new style was only to require the import at use-site (or into) - but as it stands many conversions can't migrate to the new style.

I would say Polymorphic/evidence-requiring conversions are also poorly supported due to requiring allocations/megamorphic dispatch - but i havent done the benchmark,

So to summarise: Why not keep supporting indefinitely the semantics of the old style conversions but under a new definition syntax that requires the same "use-site" rules?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-minor-release This PR cannot be merged until the next minor release stat:needs decision Some aspects of this issue need a decision from the maintainance team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants