Skip to content

Improve ClassTag handling to avoid invalid ClassTag generation and inference failure #16492

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 2 commits into from
Dec 12, 2022

Conversation

smarter
Copy link
Member

@smarter smarter commented Dec 9, 2022

The first commit generalizes the fix for #1730, the second commit improves inference in a common situation to generate a valid ClassTag rather than emitting an error, fixing the example from #16328 (comment).

`typeSymbol` returns NoSymbol on an intersection type, so our previous check
wasn't good enough. See scala#1730 for background.
The previous commit ensures that `ClassTag[Int & Nothing]` doesn't compile
anymore so this isn't a soundness issue anymore, but since intersections can
arise out of type inference, it's worth adding a special-case here for
convenience. In particular, this fixes
scala#16328 (comment)
Copy link
Contributor

@odersky odersky left a comment

Choose a reason for hiding this comment

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

LGTM

@odersky odersky merged commit 281fd99 into scala:main Dec 12, 2022
@odersky odersky deleted the fix-ctag-2 branch December 12, 2022 11:16
@Kordyjan Kordyjan added this to the 3.3.0 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