Skip to content
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

Avoid embedding SelectionProtos in Conversions #17755

Merged
merged 3 commits into from
Jun 6, 2023

Conversation

dwijnand
Copy link
Member

@dwijnand dwijnand commented Jun 2, 2023

No description provided.

@dwijnand dwijnand linked an issue Jun 2, 2023 that may be closed by this pull request
Using the minimisation of the specs2 failure that occurred in CI, the
conversion desired is `Conversion[String, Bar.this.Data]`.  But if we
use the given's symbol info, we end up with the type `Conversion[String,
Foo.this.Data]` which the generated tree will fail to adapt to.

Using the widening of the implicit candidate's TermRef will yield a
method type, as seen from the right prefix - `Bar.this.Data`.
@dwijnand dwijnand marked this pull request as ready for review June 2, 2023 18:49
@dwijnand dwijnand requested a review from odersky June 2, 2023 18:49
// see tests/pos/i15867.scala.
restpe
case _ => pt
case _ => pt
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here.

// so instead replace it with the targeted conversion type, if it matches
// see tests/pos/i15867.scala.
restpe
case _ => pt
Copy link
Contributor

Choose a reason for hiding this comment

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

But in this case and also on the next line we still get a SelectionProto in the result type of the conversion, which looks fishy. Can we replace with NoType instead?

@odersky odersky assigned dwijnand and unassigned odersky Jun 4, 2023
@dwijnand dwijnand assigned odersky and unassigned dwijnand Jun 6, 2023
@dwijnand dwijnand requested a review from odersky June 6, 2023 08:47
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.

LGTM

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.

LGTM

@odersky odersky merged commit 233c8ec into scala:main Jun 6, 2023
17 checks passed
@dwijnand dwijnand deleted the gadt-cast-conversion-selection-proto branch June 6, 2023 12:21
dwijnand added a commit to dwijnand/scala3 that referenced this pull request Jun 28, 2023
odersky added a commit that referenced this pull request Jun 28, 2023
@Kordyjan Kordyjan added this to the 3.4.0 milestone Aug 1, 2023
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.

Leaking SelectionProto in GADT casts for implicit conversions
3 participants