-
Notifications
You must be signed in to change notification settings - Fork 455
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
AST: store arity in function type #7195
Conversation
@cknitt in there a way to run CI on PRs like these, which are based on other PRs not yet merged? |
This is defined here: rescript/.github/workflows/ci.yml Line 12 in 606719f
So I think it should work if you extend that by the name of the branch you want to make a PR against (in that branch). |
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.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark 'Syntax Benchmarks'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.05
.
Benchmark suite | Current: 655045e | Previous: e1b7fb7 | Ratio |
---|---|---|---|
Print RedBlackTreeNoComments.res - time/run |
2.2179153266666667 ms |
2.10057036 ms |
1.06 |
This comment was automatically generated by workflow using github-action-benchmark.
a12fc3c
to
0c439eb
Compare
This needs some info from function definition that is not readily available. Better to postpone this until arity is explicit in function definitions.
Fix uncurried function type handling in FFI and type system This commit improves handling of uncurried function types, particularly in FFI and the type system: - Add arity information to @obj externals by returning arity from process_obj - Fix filter_arrow to properly handle arity in type unification - Remove invalid assert false in ast_uncurried.ml - Update type_function and type_application to properly handle arity information - Pass arity through to is_ignore function for consistent type checking These changes help ensure proper type checking and arity handling for uncurried functions, especially in FFI bindings using @obj.
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.
Very nice! Tested against a real world project, no issues and no changes in the compiler output.
Instead of storing arity in a second type parameter to builtin type
function$<_, _>
, add an arity field to:1
Ptyp_arrow
: to represent types with arity from the source program in the untyped AST (e.g.(t1, t2) => t3
has arity 2.2
Ttyp_arrow
: to represent types with arity from the source program in the typed AST.3
Tarrow
: to represent the inferred/computed types. This required adapting the type inference and unification mechanisms.