Skip to content

Fix #2675: Properly handle undetermined type variables in unapply #3889

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

Merged
merged 13 commits into from
Feb 1, 2018

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Jan 23, 2018

In non-variant contexts, we used to always maximize undetermined type variables, but this is unsound. See neg/patternUnsoundness.scala. We now create fresh abstract types in
these situations. This forced us to also fix the pickling and unpickling of Bind nodes.

In non-variant contexts, we used to always maximize them, but this is unsound.
See neg/patternUnsoundness.scala. We now create fresh abstract types in
these situations.
Make bind-defined symbols forward-referencable. This is necessary
to support more interesting patterns of Binds. E.g. in

   case (bla: List[t])

the bound symbol `bla` refers to the bound type `t` in its info. Previously
we used BindDefinedType for that, but that cannot work in general, because
it does not distinguish between a reference and a binding.
Have to modify the way templates are scanned, so far,
all non-member definitions inside a template were forgotten.

Strangely enough this caused a completely unrelated
fromTastyTest to fail.
A clause was accidentally disabled fir debugging purposes.

x match {
case x: C[u] =>
def x: u = x
Copy link
Member

Choose a reason for hiding this comment

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

Is the self-recursive call intended here?

Copy link
Contributor Author

@odersky odersky Jan 23, 2018

Choose a reason for hiding this comment

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

I assume so, it was an old test in pos. The new test in pickling adds more variations that exercise forward binds in pickling.

With the changes in the last commit, the symbol of a Bind
always exists.
@smarter smarter merged commit 8ab3ce6 into scala:master Feb 1, 2018
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