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

UnnecessaryConversionTest failing in latest Scala community build #754

Closed
saeltz opened this issue Jul 3, 2023 · 2 comments · Fixed by #789
Closed

UnnecessaryConversionTest failing in latest Scala community build #754

saeltz opened this issue Jul 3, 2023 · 2 comments · Fixed by #789

Comments

@saeltz
Copy link
Collaborator

saeltz commented Jul 3, 2023

See scala/community-build#1677.

The Scala compiler is now constant-folding integer literals and our tests like 3.toInt don't warn anymore because the expression is already constant folded in the typer phase of the compiler after which scapegoat is invoked.

It's good that the compiler is now constant folding. We should adjust somehow.

@som-snytt
Copy link

This is in typer, and the change for .toInt is a backport from Scala 3. // background

I've forgotten the details, but Scaladoc has a flag to reduce constant inlining for documentation purposes. Maybe something similar would be useful for 3rd party tooling?

For some reason, I've also forgotten the outcome of not changing trees for constant folding but only types. I've forgotten the context, maybe Scaladoc or maybe some other tool wanted to witness "the original tree".

@SethTisue
Copy link

Note that a compiler plugin may introduce multiple phases — perhaps you could insert an additional phase pre-typer.

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 a pull request may close this issue.

3 participants