Skip to content

Fix comment in isAsSpecificValue type and add test #4329

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 2 commits into from
May 7, 2018

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Apr 17, 2018

Fix comment in isAsSpecificValue to match the code, drop a probably spurious case from
the code which referred to the old encoding of applied types in terms of refinements,
and add a test that exercises some of the behavior.

Fix comment in isAsSpecificValue to match the code, drop a probably spurious case from
the code which referred to the old encoding of applied types in terms of refinements,
and add a test that exercises some of the behavior.
@@ -1167,7 +1167,6 @@ trait Applications extends Compatibility { self: Typer with Dynamic =>
else {
val flip = new TypeMap {
def apply(t: Type) = t match {
case t: TypeBounds => t
Copy link
Member

Choose a reason for hiding this comment

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

Is this PR just about changing comments or also about changing behavior?

Copy link
Contributor

Choose a reason for hiding this comment

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

Is the dropping of "top-level" intentional? I'm not sure I see that change reflected in the code.

Copy link
Contributor Author

@odersky odersky Apr 27, 2018

Choose a reason for hiding this comment

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

@smarter @milessabin The PR essentially adapts the comment to what the code now does. Dropping the TypeBounds case should have no effect except for wildcard arguments. When we still used refinements for type parameters it did have the effect of restricting to top-level. But with the change to direct parameter encoding that effect was lost, so that change caused a change in behavior.

I am actually quite unsure what the right behavior would be. Toplevel or not? What does toplevel mean, precisely? I don't have a good testcase that would demonstrate why restricting to toplevel is important. So I opted for the solution that's simpler to specify.

Copy link
Member

@smarter smarter left a comment

Choose a reason for hiding this comment

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

Dropping the top-level restriction seems more intuitive to me, so LGTM, but @milessabin implementation will need to be updated to conform to this.

They should be sufficient to pin down the behavior.
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.

4 participants