Skip to content

[Patterns] remove irrelevant specification of pattern type schemas. #2639

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
Nov 17, 2022

Conversation

stereotype441
Copy link
Member

@stereotype441 stereotype441 commented Nov 16, 2022

The pattern type schemas for logical-or, null-check, constant, and relational patterns were not meaningful because pattern type schemas are only used in irrefutable contexts, and these patterns are not allowed to appear in irrefutable contexts.

In particular, the definition of pattern type schema for constant patterns was causing confusion because it appeared to cause a circularity: it defined the pattern type schema for a constant pattern to be the inferred type of the constant; however text elsewhere specifies that the type of the constant is inferred based on the type of the scrutinee, and the pattern type schema is used to infer the type of the scrutinee. However this wasn't a real problem, because constant patterns are illegal in precisely the circumstances in whch pattern type schemas are used.

The pattern type schemas for logical-or, null-check, constant, and
relational patterns were not meaningful because pattern type schemas
are only used in refutable contexts, and these patterns are not
allowed to appear in irrefutable contexts.

In particular, the definition of pattern type schema for constant
patterns was causing confusion because it appeared to cause a
circularity: it defined the pattern type schema for a constant pattern
to be the inferred type of the constant; however text elsewhere
specifies that the type of the constant is inferred based on the type
of the scrutinee, and the pattern type schema is used to infer the
type of the scrutinee.  However this wasn't a real problem, because
constant patterns are illegal in precisely the circumstances in whch
pattern type schemas are used.
@stereotype441 stereotype441 merged commit 3422f54 into dart-lang:master Nov 17, 2022
@stereotype441 stereotype441 deleted the short-9 branch November 17, 2022 13:21
Copy link
Member

@munificent munificent left a comment

Choose a reason for hiding this comment

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

Thanks!

@stereotype441 stereotype441 mentioned this pull request Dec 14, 2022
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