Skip to content

Fix #2202: Check bridge clash in super classes. #2285

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

Closed
wants to merge 1 commit into from

Conversation

nicolasstucki
Copy link
Contributor

No description provided.

@@ -0,0 +1,12 @@
// nopos-error
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 be possible to get a position for this error using Symbol#pos, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it is possible. I will add that to this PR.

@smarter
Copy link
Member

smarter commented Apr 21, 2017

@nicolasstucki requested a review from smarter an hour ago

I think @DarkDimius should review this since he understands this code more than I do.

@nicolasstucki nicolasstucki requested review from DarkDimius and removed request for smarter April 21, 2017 14:36
emittedBridges.find(stat => (stat.name == bridge.name) && stat.tpe.widen =:= bridge.info.widen)
val clash: Option[Symbol] = oldSymbol.owner.info.memberExcluding(bridge.name, Flags.Bridge).alternatives.find {
denot => {
!denot.symbol.owner.is(Flags.Trait) && (denot.symbol.owner ne defn.ObjectClass) &&
Copy link
Contributor

Choose a reason for hiding this comment

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

!denot.symbol.owner.is(Flags.Trait)

why is clashing with trait methods fine?

denot.symbol.owner ne defn.ObjectClass

Why?

!denot.symbol.owner.derivesFrom(bridge.owner)

Is denot.symbol.owner ever a non-trivial subclass of bridge.owner ?
If yes, would be nice to add a test.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All these conditions where added to make the compilation of the standard library work properly. I will have to explore in detail why I had to exclude traits and object. The non trivial subclass of bridge.owner are present in scala.collection. Nevertheless I will add a small test that has non-trivial subclass.

!denot.symbol.owner.derivesFrom(bridge.owner) && denot.symbol.info.widen =:= bridge.info.widen
}
}.map(_.symbol).orElse(
emittedBridges.find(stat => (stat.name eq bridge.name) && stat.tpe.widen =:= bridge.info.widen)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd prefer to change eq back to == to keep the diff minimal. This method has a complex history and it's important to keep it clean.

Copy link
Contributor

@DarkDimius DarkDimius left a comment

Choose a reason for hiding this comment

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

see above

@nicolasstucki nicolasstucki force-pushed the fix-#2202 branch 2 times, most recently from 71faea7 to 8f04d16 Compare May 1, 2017 09:44
@felixmulder
Copy link
Contributor

Out of date, needs a second look.

@nicolasstucki
Copy link
Contributor Author

@DarkDimius this issue was fixed with the new bridge implementation.

@DarkDimius DarkDimius closed this May 5, 2017
@nicolasstucki
Copy link
Contributor Author

@DarkDimius why close it? Now I'm only adding the regression test for #2202.

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.

4 participants