Skip to content

Fix parameterized typedefs with lambdas as rhs #1409

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 3 commits into from
Jul 25, 2016

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Jul 21, 2016

Previously the compiler crashed when faced with a parameterized typedef
that has a lambda as rhs. We fix this by refining the condition when
not to abstract in typeDefsig.

Review by @smarter

Previously the compiler crashed when faced with a parameterized typedef
that has a lambda as rhs. We fix this by refining the condition when
not to abstract in typeDefsig.
val rhsType = abstracted(typedAheadType(tdef.rhs).tpe)

val isDerived = tdef.rhs.isInstanceOf[untpd.DerivedTypeTree]
val rhsType = abstracted(typedAheadType(tdef.rhs).tpe, canAbstract = !isDerived)
Copy link
Member

Choose a reason for hiding this comment

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

Having a boolean parameter that changes the behavior of a method to become the identity seems weird to me, I would just write:

val rhsType0 = typedAheadType(tdef.rhs).tpe
val rhsType = if (!isDerived) abstracted(rhsType0) else rhsType0

@smarter
Copy link
Member

smarter commented Jul 22, 2016

If we're going to support that, we should also support multiple application, T[Int][String] currently fails with error: Test.this.T[Int] does not take type parameters

odersky added 2 commits July 22, 2016 15:22
Adapt operations TypeApplications and TypeComparer to account
for the possibilities of curried type lambdas.
As @smarter noted, makes no sense to use a boolean parameter here.
We got there by refactoring blindness.
@odersky
Copy link
Contributor Author

odersky commented Jul 22, 2016

@smarter Last two commits should address your comments.

@smarter
Copy link
Member

smarter commented Jul 25, 2016

LGTM

@smarter smarter merged commit 0ba8d7d into scala:master Jul 25, 2016
@allanrenucci allanrenucci deleted the fix-hk-typdefs-of-lambdas branch December 14, 2017 19:20
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.

3 participants