Skip to content

fix(patmat): Use childPrefix to resolve path-dependent sealed children #23771

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

nox213
Copy link
Contributor

@nox213 nox213 commented Aug 17, 2025

fix #23369

This PR fixes an issue where path-dependent types were not resolved correctly when calculating the space of a scrutinee's children for exhaustiveness checking. The type checking was performed from the perspective of the child's definition-site (Module), which failed to account for type members refined at the use-site.

val parentPre = parent.normalizedPrefix
val defaultRef = if (child.isTerm) child.termRef else child.typeRef

if (parentSym.isClass && parentPre.isInstanceOf[TermRef]) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

guard for match types and cases without prefix

@nox213
Copy link
Contributor Author

nox213 commented Aug 18, 2025

I will look into CI failure

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.

No warning about non-exhaustive pattern matching for constructor with type bound enclosing type member
1 participant