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

Big cleanup #50

Merged
merged 47 commits into from
Nov 22, 2023
Merged

Big cleanup #50

merged 47 commits into from
Nov 22, 2023

Conversation

sonmarcho
Copy link
Member

@sonmarcho sonmarcho commented Nov 22, 2023

This PR performs the following modifications:

  • we removed the region type parameter from the Ty type, which was used to make a distinction between types with regions and types with erased regions. This proved extremely cumbersome in the end: we sometimes had to realize conversions between the various kinds of types, and this prevented us from correctly using visitors in OCaml because of type-checking issues. In particular, this allowed us to derive more visitors (and more powerful) for the types defined in Charon-ML.
  • we do not compute the regions hierachy (file regions_hierarchy.rs) in Charon anymore, and moved this analysis to Aeneas
  • we updated the Name type so that the Impl blocks contain generic parameters and a type, closely following what happens in Rust. This allows a more general (and better) generation of names in Aeneas.
  • we updated the printing functions in OCaml to make them a lot simpler
  • we implemented a simple syntax for name patterns in Charon-ML, which allows to easily catch definitions that are to be mapped to definitions in the standard library. Those names look like: core::slice::{[@T]}::len (the len function defined in the impl block for type [T], where T is a type variable, in module core::slice), or core::ops::index::IndexMut<alloc::vec::Vec<@T, @A>, @T> (the instance of the trait core::ops::index::IndexMut for Vec<T, A> and T). We implemented a lot of utilities, which include: parsing, matching, conversion from names to patterns (which match those names), printing, functions to check if two patterns are convertible and to compute common prefixes, pattern maps (which map patterns to values and allow efficient lookups)
  • in Charon-ML, we also added prefixes to the names of the enumeration variants so that they are less ambiguous and we don't need to use module names anymore to help OCaml typecheck (for instance, in type ty: Ref -> TRef)

@sonmarcho sonmarcho merged commit aa0d522 into main Nov 22, 2023
2 checks passed
@sonmarcho sonmarcho deleted the son_merge_types branch November 22, 2023 10:53
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