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

Make the source compile with SIP-56 match types, for Scala 3.4. #286

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sjrd
Copy link

@sjrd sjrd commented Nov 27, 2023

Refine the definition of EnumerationUtil.Aux to make it comply with the legal match types of SIP-56. Although weird, it is the "standard" trick for extracting enumeration Value's uner SIP-56.

Refine the result type of EnumerationReader.findEnumValue to be path-dependent instead of using the match type. It is strictly more precise.

Ref scala/improvement-proposals#65, scala/scala3#18262

Refine the definition of `EnumerationUtil.Aux` to make it comply
with the legal match types of SIP-56. Although weird, it is the
"standard" trick for extracting enumeration Value's uner SIP-56.

Refine the result type of `EnumerationReader.findEnumValue` to
be path-dependent instead of using the match type. It is strictly
more precise.
@soronpo
Copy link

soronpo commented Nov 27, 2023

OMG, I didn't even know this syntax was possible

@sjrd
Copy link
Author

sjrd commented Nov 27, 2023

{ type Value } is implicitly AnyRef { type Value}. It's a valid type. Then we create another refinement of that type, so { type Value } { type Value = A } is (AnyRef { type Value }) { type Value = A }. There's nothing surprising if you follow the grammar.

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.

2 participants