Skip to content

Drop toNoExplanation implicit conversion #16211

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

Merged
merged 1 commit into from
Oct 20, 2022

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Oct 19, 2022

toNoExplanation was an old-style implicit conversion. It could not be made a Conversion since it was defined over a call-by-name argument. It also hid important implementation details since it delayed constructing the argument. So knowing whether a string would be evaluated strictly or lazily depended on knowing how type inference would work.

We replace the conversion by a combination of

  • an extension method .toMessage converting a lazy string explicitly, and
  • some overloading of core methods that take either a message or a lazy string.

We should over time get rid of overloads and convert most strings passed as messages to proper messages. But that will take time. At least by now we see better where the work is needed.

`toNoExplanation` was an old-style implicit conversion. It could not be made a
`Conversion` since it was defined over a call-by-name argument. It also hid
important implementation details since it delayed constructing the argument.
So knowing whether a string would be evaluated strictly or lazily depended on
knowing how type inference would work.

We replace the conversion by a combination of

 - an extension method `.toMessage` converting a lazy string explicitly, and
 - some overloading of core methods that take either a message or a lazy string.

We should over time get rid of overloads and convert most strings passed as messges
to proper messages. But that will take time. At least by now we see better where
the work is needed.
@dwijnand dwijnand closed this Oct 20, 2022
@dwijnand dwijnand reopened this Oct 20, 2022
@dwijnand dwijnand merged commit 5ada87f into scala:main Oct 20, 2022
@dwijnand dwijnand deleted the drop-no-explanation branch October 20, 2022 06:27
def error(ex: TypeError, pos: SrcPos)(using Context): Unit =
error(ex.toMessage, pos, sticky = true)
if ctx.settings.YdebugTypeError.value then ex.printStackTrace()
Copy link
Member

Choose a reason for hiding this comment

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

I missed this removal. Was it intentional? It's the only use of the setting (AFAICT).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think that was by accident.

@Kordyjan Kordyjan added this to the 3.2.2 milestone Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants