Skip to content

[WIP] Enforce stable id patterns conform under Xsource:3 #10290

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

Conversation

som-snytt
Copy link
Contributor

@som-snytt som-snytt commented Feb 4, 2023

Stable identifier pattern has always required, per spec, that the type of the pattern conform to the scrutinee. Although matching is determined by universal equals, it is intended that the pattern case narrow the broader expected type. Extraction of values of arbitrary type is provided by extractor patterns.

Relatedly, literal pattern must also conform,
and literal pattern must be typed with the expected type.

Fixes scala/bug#7211
Fixes scala/bug#7655
Fixes scala/bug#12722

uses #2742

Stable identifier pattern has always required, per spec,
that the type of the pattern conform to the scrutinee.
Although matching is determined by universal equals,
it is intended that the pattern case narrow the broader
expected type. Extraction of values of arbitrary type
is provided by extractor patterns.

Relatedly, literal pattern must also conform,
and literal pattern must be typed with the expected type.

Co-authored-by: Jason Zaugg <[email protected]>
@scala-jenkins scala-jenkins added this to the 2.13.11 milestone Feb 6, 2023
@dwijnand
Copy link
Member

Ready for review?

@som-snytt
Copy link
Contributor Author

@dwijnand Not quite, I'll click it when I get back to it.

You know what's ready for review is scala/scala3#16137

@SethTisue SethTisue modified the milestones: 2.13.11, 2.13.12 Feb 28, 2023
@som-snytt som-snytt closed this Jun 5, 2023
@SethTisue SethTisue removed this from the 2.13.12 milestone Jun 10, 2023
@som-snytt som-snytt changed the title Enforce stable id patterns conform under Xsource:3 [WIP] Enforce stable id patterns conform under Xsource:3 Jan 27, 2024
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