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

Implement a tabling strategy for handling cycles #42

Closed
scalexm opened this issue Jun 8, 2017 · 1 comment
Closed

Implement a tabling strategy for handling cycles #42

scalexm opened this issue Jun 8, 2017 · 1 comment

Comments

@scalexm
Copy link
Member

scalexm commented Jun 8, 2017

Currently we treat cycles (i.e. seeing the same clause twice) as Ambiguous. However, this is not desirable as in the presence of tautologies like (u8: Foo) :- (u8: Foo) (which may appear while elaborating clauses à la #12), Chalk will answer Ambiguous to the query u8: Foo when u8 does not implement Foo, whereas we would prefer an error.

We can't treat cycles as errors or else the following query:

trait Foo { }
struct S<T> { }
struct i32 { }
impl<T> Foo for S<T> where T: Foo { }
impl Foo for i32 { }

exists<T> { T: Foo }

would return Unique; substitution [?0 := i32] whereas it should be ambiguous because there is an infinite family of solutions.

A possible strategy for handling cycles would be to use tabling in order to feed back the cycles and possibly produce new answers until we reach a fixed point, in which case we know that we have all the answers.

@nikomatsakis
Copy link
Contributor

This is done now, in #47 and #48.

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

No branches or pull requests

2 participants