Skip to content

Refine "can be handled by parent" condition when generting bridges #13092

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 1 commit into from
Jul 23, 2021

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Jul 16, 2021

Fixes #13087

Reverses the outcome in i1240.scala.

@odersky
Copy link
Contributor Author

odersky commented Jul 16, 2021

test performance please

@dottybot
Copy link
Member

performance test scheduled: 1 job(s) in queue, 1 running.

@odersky odersky marked this pull request as ready for review July 16, 2021 13:14
@dottybot
Copy link
Member

Performance test finished successfully:

Visit https://dotty-bench.epfl.ch/13092/ to see the changes.

Benchmarks is based on merging with master (20e2b95)

Copy link
Member

@smarter smarter left a comment

Choose a reason for hiding this comment

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

Otherwise LGTM

if sym1.owner.is(JavaDefined, butNot = Trait)
&& sym2.owner.is(JavaDefined, butNot = Trait)
then false // javac already handles these checks and inserts bridges
else if sym1.isType then true
Copy link
Member

Choose a reason for hiding this comment

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

I guess this isn't new code, but it's weird that this overload of isOverridingPair simply allows all types to match whereas the other overload will check that the kinds match, could this be harmonized?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not sure. Maybe. But not in this PR. Somebody would have to take the time to experiment and figure this out. It's best to be conservative here since I am sure there are lots of code bases out there that we have not seen yet and that test this logic in interesting ways.

sd1.matchesLoosely(sd2)
&& (sym1.hasTargetName(sym2.targetName)
|| compatibleTypes(sym1, sd1.info, sym2, sd2.info))

val opc = new OverridingPairs.Cursor(clazz):
Copy link
Member

Choose a reason for hiding this comment

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

PrepJSInterop also performs some overriding checks using Cursor, so I wonder if it should use a subclass of Cursor with the same logic we're now using here in RefChecks, or perhaps the checking logic in PrepJSInterop should be moved to RefChecks? /cc @sjrd

Copy link
Member

Choose a reason for hiding this comment

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

It should probably be the same logic as in RefChecks, yes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, I let you experiment with it. But I am going to merge this as is, since I do not think I have the time to look at all code that considers overriding pairs.

@odersky odersky merged commit 0037607 into scala:master Jul 23, 2021
@odersky odersky deleted the fix-13087 branch July 23, 2021 11:24
@Kordyjan Kordyjan added this to the 3.1.0 milestone Aug 2, 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.

Compiler accepts class as non-abstract, then runtime system fails saying the class is abstract
5 participants