Skip to content
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

Merged
merged 9 commits into from
Dec 18, 2024
Merged

AST: store arity in function type #7195

merged 9 commits into from
Dec 18, 2024

Conversation

cristianoc
Copy link
Collaborator

@cristianoc cristianoc commented Dec 6, 2024

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.

@cristianoc
Copy link
Collaborator Author

@cknitt in there a way to run CI on PRs like these, which are based on other PRs not yet merged?

@cknitt
Copy link
Member

cknitt commented Dec 6, 2024

This is defined here:

branches: [master, 11.0_release]

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).

Base automatically changed from cleanup-optional-exp-pat to master December 7, 2024 14:12
Copy link

@github-actions github-actions bot left a 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.

compiler/ml/ctype.ml Outdated Show resolved Hide resolved
@cristianoc cristianoc force-pushed the arity branch 2 times, most recently from a12fc3c to 0c439eb Compare December 16, 2024 17:49
@cristianoc cristianoc changed the base branch from master to remove_Function$ December 16, 2024 19:42
@cristianoc cristianoc changed the base branch from remove_Function$ to master December 16, 2024 19:46
@cristianoc cristianoc changed the base branch from master to remove_Function$ December 16, 2024 19:46
@cristianoc cristianoc changed the base branch from remove_Function$ to master December 16, 2024 19:46
@cristianoc cristianoc changed the base branch from master to remove_Function$ December 16, 2024 19:48
@cristianoc cristianoc changed the base branch from remove_Function$ to master December 16, 2024 19:52
@cristianoc cristianoc changed the title AST: test storing arity in function type AST: store arity in function type Dec 18, 2024
@cristianoc cristianoc requested review from cknitt and zth December 18, 2024 11:19
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.
Copy link
Member

@cknitt cknitt left a 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.

CHANGELOG.md Show resolved Hide resolved
@cristianoc cristianoc merged commit be15048 into master Dec 18, 2024
20 checks passed
@cristianoc cristianoc deleted the arity branch December 18, 2024 17:13
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.

2 participants