Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -1240,7 +1240,7 @@ export default grammar({
$.module_primary_expression,
),

constrain_type: ($) => seq("type", $._type, choice("=", ":="), $._type),
constrain_type: ($) => seq("type", $._type, choice("=", ":="), optional("private"), $._type),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Restrict private to = constraints

Because optional("private") is placed after choice("=", ":="), this also accepts destructive substitutions like S with type t := private int. The := form takes a plain replacement type and should not carry the privacy marker that belongs to equality constraints such as with type t = private ..., so tree-sitter consumers now treat compiler-invalid signatures as valid. Split the alternatives so private is only allowed on the = branch.

Useful? React with 👍 / 👎.


functor_use: ($) =>
seq($.module_primary_expression, alias($.functor_arguments, $.arguments)),
Expand Down
12 changes: 12 additions & 0 deletions src/grammar.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading