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

Fix #9413: Fix test for user-defined equality #9414

Merged
merged 2 commits into from
Jul 23, 2020

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Jul 22, 2020

Fix test to determine whether value class has a user-defined equality

@odersky odersky changed the title Fix #9413: Fix test for user-defieed equality Fix #9413: Fix test for user-defined equality Jul 22, 2020
@@ -23,13 +23,16 @@ class VCElideAllocations extends MiniPhase with IdentityDenotTransformer {
override def runsAfter: Set[String] = Set(ElimErasedValueType.name)

override def transformApply(tree: Apply)(using Context): Tree =
def hasUserDefinedEquals(tp: Type): Boolean =
val eql = defn.Any_equals.overridingSymbol(tp.typeSymbol.asClass)
eql.exists && !eql.is(Synthetic)
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, looks like vc-equals.scala is failing because we get a mixin forwarder equals in D, adding butNot = Bridge should fix that. Additionally, I think overridingSymbol only looks for symbols in the class itself since it calls matchingDecl, whereas we want matchingMember here.

@odersky odersky added the fasttrack Simple fix. Reviewer should merge or apply additional changes directly. label Jul 23, 2020
@odersky
Copy link
Contributor Author

odersky commented Jul 23, 2020

Looks like it works now. Let's get it in!

@smarter smarter assigned smarter and unassigned smarter Jul 23, 2020
odersky added 2 commits July 23, 2020 14:04
I noted another useless boxing (in Positioned.scala), where we have
```
  (new Span(x): Span).coord
```
The allocation should be eliminated but was not.
@smarter smarter merged commit ceccb9e into scala:master Jul 23, 2020
@smarter smarter deleted the fix-#9413 branch July 23, 2020 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fasttrack Simple fix. Reviewer should merge or apply additional changes directly.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants