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

Refine GADT casts on singletons #12159

Merged
merged 3 commits into from
Apr 22, 2021
Merged

Conversation

abgruszecki
Copy link
Contributor

See #11987.

  • keep the singleton type in the cast target
  • assert cast target stability if original was stable
  • fix isStable test for TypeParamRefs
  • double check if GADT logic is really needed before inserting a cast

Fixes #11220
Fixes #11955

odersky and others added 3 commits April 4, 2021 22:29
 - keep the singleton type in the cast target
 - assert cast target stability if original was stable
 - fix isStable test for TypeParamRefs
 - double check if GADT logic is really needed before inserting a cast

Fixes scala#11220
Fixes scala#11955
@abgruszecki
Copy link
Contributor Author

It seems that the warning about unnecessary GADTused was printed always when performing the check, not only when the flag was actually unnecessary. I fixed that and it seems we don't get that many warnings in the test suite.

I tried to write a test for the Stable annot. It seems that it's added in a lot of GADT tests, but none of those are necessary. I'd need to inspect what exactly -Ycheck is doing that requires the Stable annot and I'm not sure if that's the wisest use of my time, I think I'm just going to trust you Martin that this code is necessary.

@abgruszecki
Copy link
Contributor Author

@odersky can you approve this PR so it can be merged?

@abgruszecki abgruszecki merged commit df7968c into scala:master Apr 22, 2021
@abgruszecki abgruszecki deleted the fix-11220 branch April 22, 2021 17:39
@japgolly
Copy link
Contributor

Noice! Thanks @abgruszecki !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants