Skip to content

Conversation

@biboudis
Copy link
Contributor

Based on #4081

The proposed fix handle the case when a type splice e.g., ~t appears in possibly nested positions as a type parameter, e.g., List[~t] and List[Array[~t]]. If the code included just List[T] and List[Array[T]] the types are extracted and added as tags using implicit search in the phase of tryHeal. This commit collects and handles spliced types as well, using the same mechanism as before.

@nicolasstucki
Copy link
Contributor

@biboudis you can rebase on master and remove commit 87d364c (which is in PR #4103).

@biboudis biboudis force-pushed the fix-#3847-2 branch 2 times, most recently from c8affb6 to f7b179c Compare March 16, 2018 15:58
@nicolasstucki
Copy link
Contributor

val splicedType = tree.tpe.asInstanceOf[TypeRef].prefix.termSymbol
splice(ref(splicedType).select(tpnme.UNARY_~))
case tree: TypeApply =>
super.transform(tree)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we do not need this branch

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True! Not anymore!

if (map.contains(tp))
map.apply(tp)
else
mapOver(tp)
Copy link
Contributor

Choose a reason for hiding this comment

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

Shorter and more efficient:

override def apply(tp: Type): Type = map.getOrElse(tp, mapOver(tp))

}
}

Block(typeDefs ++ tagsExplicitTypeDefsPairs.map(_._2),
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't this just Block(typeDefs ++ explicitTypeDefs,?

@biboudis
Copy link
Contributor Author

Updated! Thanks for the review!

@nicolasstucki nicolasstucki merged commit 7cb10a8 into scala:master Mar 20, 2018
@allanrenucci allanrenucci deleted the fix-#3847-2 branch March 20, 2018 17:00
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