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

Fut<A> should have covariant subtyping (right now it is invariant) #10

Open
bezirg opened this issue Mar 13, 2017 · 0 comments
Open

Fut<A> should have covariant subtyping (right now it is invariant) #10

bezirg opened this issue Mar 13, 2017 · 0 comments

Comments

@bezirg
Copy link
Member

bezirg commented Mar 13, 2017

Example code that does not typecheck with habs:

module Test4;

data List_<A> = Nil_
              | Cons_(A,List_<A>);

interface I {
  I m();
}

interface I_ extends I {
  I_ m_();
}

class C implements I {
  I m() {
    return this;
  }
}

class C_ implements I_ {
 I m() {
   return this;
 }
 I_ m_() {
   return this;
 }
}

{
 I o = new local C();
 I_ o_ = new local C_();

 Fut<I_> f_ = o_!m_();

 Fut<I> f = f_; // covariant Future breaks

 // or Fut<I_> f_ = o_!m_();
 
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant