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

Improve the name generation for code extraction #88

Merged
merged 9 commits into from
Mar 11, 2024
Merged

Conversation

sonmarcho
Copy link
Member

This PR drastically improves the generated names in particular by making them simpler.

It also solves #87 by making a distinction between the name elements used for "regular" impl blocks and those used for trait impl blocks. This allows us to use the trait references as a name for those impl blocks.

For instance, consider the following Rust code:

impl<T> BoolTrait for Option<T> {
    fn get_bool(&self) -> bool {
        ... // Omitted
    }
}

While before we generated:

/- [traits::{core::option::Option<T>#1}::get_bool] -/
def Option.get_bool (T : Type) (self : Option T) : Result Bool := ... -- Omitted

def BoolTraitOption (T : Type) : BoolTrait (Option T) := {
  get_bool := BoolTraitOption.get_bool T
}

We now generate:

/- [traits::{(traits::BoolTrait for core::option::Option<T>)#1}::get_bool] -/
def BoolTraitOption.get_bool (T : Type) (self : Option T) : Result Bool := ... -- Omitted

def BoolTraitOption (T : Type) : BoolTrait (Option T) := {
  get_bool := BoolTraitOption.get_bool T
}

@sonmarcho sonmarcho merged commit c33a980 into main Mar 11, 2024
4 checks passed
@sonmarcho sonmarcho deleted the son/clashes branch March 11, 2024 10:10
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