Skip to content

Qualified constructor without braces in a pattern gets the braced-pattern hint - #1738

Closed
nicolas-abril wants to merge 1 commit into
mainfrom
ai/qualified-ctor-hint
Closed

nicolas-abril wants to merge 1 commit into
mainfrom
ai/qualified-ctor-hint

Conversation

@nicolas-abril

Copy link
Copy Markdown
Collaborator

A pattern naming an imported constructor through its alias without braces (case C.Red:) failed with the generic a pattern (a binder or a constructor). A local bare constructor (case Red:) already gets a hint, so the two now match:

- message  : a braced constructor pattern (C.Red is a constructor: write C.Red{})

parse_patt now handles Ref (what a dotted name parses to) next to Var: if it names a constructor, it gives the same message, spelled the way the file spells it (name_show). The local message keeps its ", or rename the binder" ending; the qualified one leaves it out, because C.Red can't be a binder. Any other Ref still gets the generic error.

Follow-up to #1716 / #1717 (both closed).

Test: tests/import/ctor_unbraced.bend (+ ctor_unbraced_lib.bend).

Gates (macolas): repo 54/54, ping 61/61, test 1665/1665, perf 124/124.

— written by an AI agent (Unii) for @nicolas-abril

…tern hint

case C.Red: on an imported constructor said only 'a pattern (a binder
or a constructor)'; it now says, as the local case Red: does, that
C.Red is a constructor and to write C.Red{}.
@nicolas-abril
nicolas-abril deleted the ai/qualified-ctor-hint branch October 28, 2026 15:51
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.

1 participant