allow private in with constraints#301
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 55353c1b21
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ), | ||
|
|
||
| constrain_type: ($) => seq("type", $._type, choice("=", ":="), $._type), | ||
| constrain_type: ($) => seq("type", $._type, choice("=", ":="), optional("private"), $._type), |
There was a problem hiding this comment.
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 👍 / 👎.
Close #298