Skip to content

Settle pattern types against ana, so pattern errors are marked once - #2866

Open
Negabinary wants to merge 1 commit into
settle-elab-syn-tyfrom
settle-pat-ty
Open

Negabinary wants to merge 1 commit into
settle-elab-syn-tyfrom
settle-pat-ty

Conversation

@Negabinary

@Negabinary Negabinary commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #2849. Followed by #2867.

A pattern's error is now marked once, as an expression's is in #2849.

The types

Each pattern has three types:

  • ana: what its parent expects.
  • syn_ty: what the pattern demands on its own, built from its parts' syn_ty: a literal's type, an annotation, ? for a variable. Only the inspector reads it.
  • ty: the type of the value it matches. This is its rule's type, built from its children's ty, met with ana, or ana where the two are inconsistent (marked there). Parents build from it, and the elaboration records it as, for example, a function's parameter type.

Unlike an expression's elab_syn_ty, ty takes in what ana says even where the two agree, because a variable's type comes from ana alone. The pattern elab_syn_ty held the same type as syn_ty, so it is gone. No ascription is inserted, since the elaboration already records ty.

Examples (#2849 on top)

Not done

A tuple pattern with an unexpected label still marks the label, its entry and the tuple. #2849's treatment for expressions would apply here the same way.

Testing

make test-quick: 4577 tests, including new pattern cases in Statics.Settling.

🤖 Generated with Claude Code

A pattern's ty is the type of the value it matches: its rule's type, built
from its children's ty, refined by ana, or ana where they disagree. That is
what parents build from now, so a mismatch is marked where it arises and goes
no further up: parentheses, projectors, tuples and lists of patterns no
longer repeat it. A pattern's elab syn type was what it demands on its own,
the same as its syn type, so it is dropped. No ascription is inserted: the
elaboration already records ty (a function's parameter type). A mismatch is
kept beside other marks, as for expressions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 71.05263% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 48.53%. Comparing base (e08a5ee) to head (ea4a81c).

Files with missing lines Patch % Lines
src/language/statics/Statics.re 77.14% 8 Missing ⚠️
src/language/statics/Info.re 0.00% 2 Missing ⚠️
src/web/app/sidebar/DebugSidebar.re 0.00% 1 Missing ⚠️
Additional details and impacted files
@@                  Coverage Diff                   @@
##           settle-elab-syn-ty    #2866      +/-   ##
======================================================
+ Coverage               48.51%   48.53%   +0.01%     
======================================================
  Files                     499      499              
  Lines                   57723    57730       +7     
======================================================
+ Hits                    28005    28017      +12     
+ Misses                  29718    29713       -5     
Files with missing lines Coverage Δ
src/language/statics/FunctionSugar.re 97.14% <ø> (ø)
src/web/app/sidebar/DebugSidebar.re 0.00% <0.00%> (ø)
src/language/statics/Info.re 26.74% <0.00%> (+0.10%) ⬆️
src/language/statics/Statics.re 88.98% <77.14%> (+0.06%) ⬆️

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Negabinary
Negabinary added this pull request to stack #2868 November 25, 2026 20:02
@Negabinary
Negabinary requested a balanced review from Copilot November 25, 2026 20:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

This branch has not been deployed

No deployments
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