-
Notifications
You must be signed in to change notification settings - Fork 469
Use Typ.arrows
after the refactoring of arrow types.
#7662
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
base: master
Are you sure you want to change the base?
Conversation
Reworks the construction of maker function arguments and accessor value descriptions for type declarations. The maker function now accumulates argument types in a list and builds the final function type using Ast_helper.Typ.arrows. Accessor generation is clarified and setter types for mutable fields are constructed with explicit argument lists. This improves readability and maintainability of the code.
@@ -79,14 +79,16 @@ let handle_tdcl light (tdcl : Parsetree.type_declaration) : | |||
Ext_list.exists label_declarations (fun x -> | |||
Ast_attributes.has_bs_optional x.pld_attributes) | |||
in | |||
let setter_accessor, make_type, labels = | |||
let setter_accessor, maker_args, labels = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use
Typ.arrows
here. Understand the logic behind the arity, fix it if necessary, and pass the correct number of arguments at the right place so the arity ends up being right.
Read file: compiler/frontend/ast_derive_abstract.ml
Ran tool
Ran tool
Ran tool
Read file: compiler/ml/parsetree.ml
Read file: compiler/frontend/ast_derive_abstract.ml
Read file: compiler/frontend/ast_derive_abstract.ml
Ran tool
Ran tool
Ran tool
Ran tool
Read file: compiler/frontend/ast_derive_abstract.ml
I've replaced all ambiguous record literals with explicit Parsetree.arg
annotations and ensured we always build argument lists and setter types using Typ.arrows
. This removes ambiguity around the attrs
field and guarantees that arity is set only once—by Typ.arrows
, which automatically puts the total argument count on the outermost node.
Key updates:
- Initial maker-argument seed now uses an explicitly-typed
unit
argument list. - Each field now adds an explicitly-typed
Parsetree.arg
to that list. - The final
make_type
is built with a singleTyp.arrows
call, so arity equals the full argument count. - Getter types stay at arity = 1 (single
arrow
), unchanged. - Setter types for mutable fields rebuilt via
Typ.arrows
, giving arity = 2 and no manual inner arity flags. - All record literals for arguments are annotated with
: Parsetree.arg
, resolving the previous “unbound record field attrs” errors.
With these changes, every place now relies on Typ.arrows
, ensuring correct arity placement and cleaner code.
rescript
@rescript/darwin-arm64
@rescript/darwin-x64
@rescript/linux-arm64
@rescript/linux-x64
@rescript/win32-x64
commit: |
No description provided.