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

Fix type directed disambiguation of optional arg defaults #12673

Conversation

ncik-roberts
Copy link
Contributor

Fix the specific issue in #12668.

The approach: In type-checking, I duplicate the type annotation on an optional argument's Ppat_constraint on the optional argument default expression. This is a bit of a hack but it is non-invasive.

I'm not confident that this approach fixes all potential backward-incompatibilities from #12236 (as optional argument defaults used to be type-checked more like let than like match) but I can't find another case where it matters.

Copy link
Member

@Octachron Octachron left a comment

Choose a reason for hiding this comment

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

This change was discussed at the type system meetings today, and it seems consistent with the let-binding behavior and a good step forward.

@Octachron
Copy link
Member

@ncik-roberts , the Changes entry needs to be updated before merging. Do you want me to take care of it?

@ncik-roberts
Copy link
Contributor Author

Looking now.

@ncik-roberts ncik-roberts force-pushed the fix-type-directed-disambiguation-of-optional-arg-defaults branch from 02b4f1e to 18f0eee Compare October 23, 2023 09:30
@ncik-roberts
Copy link
Contributor Author

Should be fixed now.

@Octachron Octachron merged commit 9cb230c into ocaml:trunk Oct 23, 2023
10 checks passed
@Octachron
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants