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

Make --MLish --lax safer #3123

Merged
merged 3 commits into from
Dec 1, 2023
Merged

Make --MLish --lax safer #3123

merged 3 commits into from
Dec 1, 2023

Conversation

mtzguido
Copy link
Member

@mtzguido mtzguido commented Dec 1, 2023

We've usually been bitten in compiler code by running in lax mode, since the unifier could "accept" an equality such as 'a = int (where 'a is some fresh polymorphic variable), since it would generate an SMT guard for it that would immediately be dropped. This leads to hard to find crashes when it does happen.

This PR prevents the unifier from generating these equalities in --MLish mode, and failing early instead. We had all the mechanism already implemented: the smt_ok flag, which we just force to false if we're using --MLish.

This uncovers two typing errors in compiler code!

cc @nikswamy who had the idea

This gives us more type safety in the compiler, since otherwise
_any_ type equalities that could potentially be proven by SMT are
accepted (since we are --lax too). This means for instance that
every polymorphic variable can unify with a concrete type, and the
typechecker would have accepted it.

By running with smt_ok=false, the unifier will simply reject it earlier.
@mtzguido mtzguido merged commit 748f8c2 into FStarLang:master Dec 1, 2023
2 checks passed
@mtzguido mtzguido deleted the safer_mlish branch December 1, 2023 05:54
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.

1 participant