Skip to content

Conversation

@wiwa
Copy link
Contributor

@wiwa wiwa commented Oct 1, 2019

Also fixes #353

This will prevent unreadable existential types from being ascribed, as well as circumventing a bug where an existential type might be qualified: Box[MyScope._1] forSome { type _1 ... }.

@wiwa wiwa requested review from ShaneDelmore and olafurpg October 1, 2019 06:30

val box: Box[_] = null.asInstanceOf[Box[_]]

val boxes1: Seq[Box[_]] = Seq(new Box[A], new Box[B])
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we add a test case for wildcard bounds? For example “Box[_ <: Path]”

opt(utpe)(normal)
rep(" forSome { ", decls.infos, "; ", " }")(pprint)
if (config.better) {
val wildcardInfos = decls.infos.map(_.withDisplayName("_"))
Copy link
Collaborator

Choose a reason for hiding this comment

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

There are cases where it’s not safe to convert existentials into wildcards, for example “Map[T, T] forSome { type T }”. I think the rule is that existential types can only be converted into wildcards if they’re referenced once.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Win Wang seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Simplify simple forSome existential types into wildcard existentials

3 participants