Skip to content

Erasure doesn't insert all box\unbox corsions for ifs #355

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

Closed
DarkDimius opened this issue Feb 10, 2015 · 0 comments
Closed

Erasure doesn't insert all box\unbox corsions for ifs #355

DarkDimius opened this issue Feb 10, 2015 · 0 comments

Comments

@DarkDimius
Copy link
Contributor

    def id[T](t: T) = t
    { if (x) id(one) else 0} + 1
    { if (x) new scala.util.Random()}.asInstanceOf[Runnable]

After erasure both those if's have different types of branches:

    { if (x) id(box(one)) else 0} + 1
    { if (x) new scala.util.Random() else ()}.asInstanceOf[Runnable]

In first example id should get unboxed,
In the second example () should get boxed.

tgodzik added a commit to tgodzik/scala3 that referenced this issue Apr 29, 2025
Backport "chore: remove all the warnings in the compiler codebase" to 3.3 LTS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants