Skip to content

Alternative fix for #1857: Consider tvars in bounds of uninstantiated tvars #1861

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

Closed
wants to merge 1 commit into from

Conversation

smarter
Copy link
Member

@smarter smarter commented Dec 26, 2016

This is an alternative to #1859, review by @odersky


Given:

  val f: Foo = new Foo
  def wrap2a[A, W <: Wrapper[A]](host: A)(implicit w: W): W = ???
  wrap2a(f)

We need to instantiate A before doing the implicit search for w
because the type of w indirectly depends on A and A was constrained by the first parameter list. This was not
done before because we did not traverse the constraint bounds of an
uninstantiated type variable.

Given:
  val f: Foo = new Foo
  def wrap2a[A, W <: Wrapper[A]](host: A)(implicit w: W): W = ???
  wrap2a(f)

We need to instantiate `A` before doing the implicit search for `w`
because it was constrained by the first parameter list. This was not
done before because we did not traverse the constraint bounds of an
uninstantiated type variable.
@odersky
Copy link
Contributor

odersky commented Dec 27, 2016

I agree it's better to do it this way compared to #1859, because interpolateUndetVars is really more an optimization and we should not hang semantics on it. There's still an open question, though: IsFullyDefinedAccumulator is called in several situations and only one is instantiateSelected. Are we sure it's the right behavior in the other calling contexts as well? We'd need to see an argument why that would be the case.

Or else we should do this only when called from instantiateSelected.

Also, this new behavior has to be documented, in isFullyDefinedAccumulator and all callers.

@smarter
Copy link
Member Author

smarter commented Dec 27, 2016

IsFullyDefinedAccumulator is called in several situations and only one is instantiateSelected. Are we sure it's the right behavior in the other calling contexts as well? We'd need to see an argument why that would be the case.

I agree, we should try to come up with some examples where this makes a difference.

@allanrenucci
Copy link
Contributor

@smarter #1857 is fixed. Can we close this?

@odersky
Copy link
Contributor

odersky commented Jan 12, 2019

I am closing for now.

@odersky odersky closed this Jan 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants