Skip to content

Fix #2219: Fix type applications on WildcardType #2222

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 1 commit into from
Apr 11, 2017

Conversation

smarter
Copy link
Member

@smarter smarter commented Apr 11, 2017

Previously we just returned the unapplied WildcardType which is
incorrect if the WildcardType is bounded. The proper thing to do is to
do the type application on the bounds of the WildcardType and wrap the
result in a WildcardType.

@smarter smarter requested a review from odersky April 11, 2017 12:14
@@ -429,7 +429,7 @@ class TypeApplications(val self: Type) extends AnyVal {
case dealiased: LazyRef =>
LazyRef(() => dealiased.ref.appliedTo(args))
case dealiased: WildcardType =>
dealiased
WildcardType(dealiased.optBounds.appliedTo(args).asInstanceOf[TypeBounds])
Copy link
Contributor

Choose a reason for hiding this comment

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

You can just write .bounds instead of .asInstanceOf[TypeBounds]).

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks! Updated.

Copy link
Contributor

@odersky odersky left a comment

Choose a reason for hiding this comment

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

Otherwise LGTM

Previously we just returned the unapplied WildcardType which is
incorrect if the WildcardType is bounded. The proper thing to do is to
do the type application on the bounds of the WildcardType and wrap the
result in a WildcardType.
@smarter smarter force-pushed the fix/wildcard-apply branch from 115cffe to ad6c683 Compare April 11, 2017 13:01
@smarter
Copy link
Member Author

smarter commented Apr 11, 2017

One of the stupid benchmark-as-test failed, merging anyway.

@smarter smarter merged commit 9917029 into scala:master Apr 11, 2017
@allanrenucci allanrenucci deleted the fix/wildcard-apply branch December 14, 2017 19:23
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