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

Allow refining Self #589

Merged
merged 28 commits into from
Jan 6, 2024
Merged

Allow refining Self #589

merged 28 commits into from
Jan 6, 2024

Conversation

ranjitjhala
Copy link
Contributor

Updates the Generics type to include Self as base for trait, so the following now works:

#[flux::generics(Self as base)]
pub trait MyTrait {
    #[flux::sig(fn<refine p: Self -> bool>(&Self{v: p(v)}) -> Self{v: p(v)})]
    fn foo(&self) -> Self;
}

#[flux::sig(fn<T as base, refine q: T -> bool> (&T{v:q(v)}) -> T{v: q(v)})]
pub fn bar<T: MyTrait>(x: &T) -> T {
    x.foo()
}

crates/flux-desugar/src/sort_resolver.rs Outdated Show resolved Hide resolved
crates/flux-desugar/src/sort_resolver.rs Outdated Show resolved Hide resolved
crates/flux-fhir-analysis/src/conv.rs Outdated Show resolved Hide resolved
crates/flux-fhir-analysis/src/conv.rs Outdated Show resolved Hide resolved
crates/flux-desugar/src/sort_resolver.rs Outdated Show resolved Hide resolved
crates/flux-middle/src/rty/mod.rs Outdated Show resolved Hide resolved
crates/flux-middle/src/fhir.rs Outdated Show resolved Hide resolved
@ranjitjhala
Copy link
Contributor Author

@nilehmann I think I've addressed the issues would be good to take a look

Copy link
Member

@nilehmann nilehmann left a comment

Choose a reason for hiding this comment

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

A couple of comments

crates/flux-desugar/src/sort_resolver.rs Outdated Show resolved Hide resolved
crates/flux-desugar/src/desugar.rs Outdated Show resolved Hide resolved
Copy link
Member

@nilehmann nilehmann left a comment

Choose a reason for hiding this comment

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

LGTM

crates/flux-desugar/src/sort_resolver.rs Outdated Show resolved Hide resolved
crates/flux-middle/src/global_env.rs Outdated Show resolved Hide resolved
crates/flux-middle/src/global_env.rs Outdated Show resolved Hide resolved
crates/flux-refineck/src/checker.rs Outdated Show resolved Hide resolved
crates/flux-refineck/src/checker.rs Outdated Show resolved Hide resolved
@nilehmann
Copy link
Member

I'm going to merge this myself because I have some big changes that are going to conflict.

@nilehmann nilehmann merged commit 5351431 into main Jan 6, 2024
4 checks passed
@nilehmann nilehmann deleted the assoc-pred branch January 6, 2024 00:54
@ranjitjhala
Copy link
Contributor Author

thanks!

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