Skip to content

New bridge implementation #2342

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 7 commits into from
May 4, 2017
Merged

New bridge implementation #2342

merged 7 commits into from
May 4, 2017

Conversation

DarkDimius
Copy link
Contributor

No description provided.

@DarkDimius
Copy link
Contributor Author

@odersky, the first patch apparently doesn't break anything in our test-suite.

@odersky
Copy link
Contributor

odersky commented May 1, 2017

It turns out that bridges are severely undertested. In fact, we have an extensive test for bridges but it never made it out of pending. If I run the current implementation on this one I get:

Mix___eFoo__fwBar_I_ raised exception java.lang.AbstractMethodError: Method Mix___eFoo__fwBar_I_.f()LBar_I_$I; is abstract
Mix___eFoo__fwBarYI_ raised exception java.lang.AbstractMethodError: Method Mix___eFoo__fwBarYI_.f()LBarYI_$I; is abstract
Mix___eFoo_IfwBar___ raised exception java.lang.AbstractMethodError: Method Mix___eFoo_IfwBar___.f()Ljava/lang/Object; is abstract
Mix___eFoo_IfwBarY__ raised exception java.lang.AbstractMethodError: Method Mix___eFoo_IfwBarY__.f()Ljava/lang/Object; is abstract
Mix___eFooX_fwBar_I_ raised exception java.lang.AbstractMethodError: Method Mix___eFooX_fwBar_I_.f()LBar_I_$I; is abstract
Mix___eFooX_fwBarYI_ raised exception java.lang.AbstractMethodError: Method Mix___eFooX_fwBarYI_.f()LBarYI_$I; is abstract
Mix___eFooXIfwBar___ raised exception java.lang.AbstractMethodError: Method Mix___eFooXIfwBar___.f()Ljava/lang/Object; is abstract
Mix___eFooXIfwBarY__ raised exception java.lang.AbstractMethodError: Method Mix___eFooXIfwBarY__.f()Ljava/lang/Object; is abstract
MixZ__eFoo__fwBar_I_ raised exception java.lang.AbstractMethodError: Method MixZ__eFoo__fwBar_I_.f()LBar_I_$I; is abstract
MixZ__eFoo__fwBarYI_ raised exception java.lang.AbstractMethodError: Method MixZ__eFoo__fwBarYI_.f()LBarYI_$I; is abstract
MixZ__eFoo_IfwBar___ raised exception java.lang.AbstractMethodError: Method MixZ__eFoo_IfwBar___.f()Ljava/lang/Object; is abstract
MixZ__eFoo_IfwBarY__ raised exception java.lang.AbstractMethodError: Method MixZ__eFoo_IfwBarY__.f()Ljava/lang/Object; is abstract
MixZ__eFooX_fwBar_I_ raised exception java.lang.AbstractMethodError: Method MixZ__eFooX_fwBar_I_.f()LBar_I_$I; is abstract
MixZ__eFooX_fwBarYI_ raised exception java.lang.AbstractMethodError: Method MixZ__eFooX_fwBarYI_.f()LBarYI_$I; is abstract
MixZ__eFooXIfwBar___ raised exception java.lang.AbstractMethodError: Method MixZ__eFooXIfwBar___.f()Ljava/lang/Object; is abstract
MixZ__eFooXIfwBarY__ raised exception java.lang.AbstractMethodError: Method MixZ__eFooXIfwBarY__.f()Ljava/lang/Object; is abstract
Mix___wFoo__fwBar_I_ raised exception java.lang.AbstractMethodError: Method Mix___wFoo__fwBar_I_.f()LBar_I_$I; is abstract
Mix___wFoo__fwBarYI_ raised exception java.lang.AbstractMethodError: Method Mix___wFoo__fwBarYI_.f()LBarYI_$I; is abstract
Mix___wFoo_IfwBar___ raised exception java.lang.AbstractMethodError: Method Mix___wFoo_IfwBar___.f()Ljava/lang/Object; is abstract
Mix___wFoo_IfwBarY__ raised exception java.lang.AbstractMethodError: Method Mix___wFoo_IfwBarY__.f()Ljava/lang/Object; is abstract
Mix___wFooX_fwBar_I_ raised exception java.lang.AbstractMethodError: Method Mix___wFooX_fwBar_I_.f()LBar_I_$I; is abstract
Mix___wFooX_fwBarYI_ raised exception java.lang.AbstractMethodError: Method Mix___wFooX_fwBarYI_.f()LBarYI_$I; is abstract
Mix___wFooXIfwBar___ raised exception java.lang.AbstractMethodError: Method Mix___wFooXIfwBar___.f()Ljava/lang/Object; is abstract
Mix___wFooXIfwBarY__ raised exception java.lang.AbstractMethodError: Method Mix___wFooXIfwBarY__.f()Ljava/lang/Object; is abstract
MixZ__wFoo__fwBar_I_ raised exception java.lang.AbstractMethodError: Method MixZ__wFoo__fwBar_I_.f()LBar_I_$I; is abstract
MixZ__wFoo__fwBarYI_ raised exception java.lang.AbstractMethodError: Method MixZ__wFoo__fwBarYI_.f()LBarYI_$I; is abstract
MixZ__wFoo_IfwBar___ raised exception java.lang.AbstractMethodError: Method MixZ__wFoo_IfwBar___.f()Ljava/lang/Object; is abstract
MixZ__wFoo_IfwBarY__ raised exception java.lang.AbstractMethodError: Method MixZ__wFoo_IfwBarY__.f()Ljava/lang/Object; is abstract
MixZ__wFooX_fwBar_I_ raised exception java.lang.AbstractMethodError: Method MixZ__wFooX_fwBar_I_.f()LBar_I_$I; is abstract
MixZ__wFooX_fwBarYI_ raised exception java.lang.AbstractMethodError: Method MixZ__wFooX_fwBarYI_.f()LBarYI_$I; is abstract
MixZ__wFooXIfwBar___ raised exception java.lang.AbstractMethodError: Method MixZ__wFooXIfwBar___.f()Ljava/lang/Object; is abstract
MixZ__wFooXIfwBarY__ raised exception java.lang.AbstractMethodError: Method MixZ__wFooXIfwBarY__.f()Ljava/lang/Object; is abstract
S_____eFoo__fwBar_I_ raised exception java.lang.AbstractMethodError: Method S_____eFoo__fwBar_I_.f()LBar_I_$I; is abstract
S_____eFoo__fwBarYI_ raised exception java.lang.AbstractMethodError: Method S_____eFoo__fwBarYI_.f()LBarYI_$I; is abstract
S_____eFoo_IfwBar___ raised exception java.lang.AbstractMethodError: Method S_____eFoo_IfwBar___.f()Ljava/lang/Object; is abstract
S_____eFoo_IfwBarY__ raised exception java.lang.AbstractMethodError: Method S_____eFoo_IfwBarY__.f()Ljava/lang/Object; is abstract
S_____eFooX_fwBar_I_ raised exception java.lang.AbstractMethodError: Method S_____eFooX_fwBar_I_.f()LBar_I_$I; is abstract
S_____eFooX_fwBarYI_ raised exception java.lang.AbstractMethodError: Method S_____eFooX_fwBarYI_.f()LBarYI_$I; is abstract
S_____eFooXIfwBar___ raised exception java.lang.AbstractMethodError: Method S_____eFooXIfwBar___.f()Ljava/lang/Object; is abstract
S_____eFooXIfwBarY__ raised exception java.lang.AbstractMethodError: Method S_____eFooXIfwBarY__.f()Ljava/lang/Object; is abstract
S__Z__eFoo__fwBar_I_ raised exception java.lang.AbstractMethodError: Method S__Z__eFoo__fwBar_I_.f()LBar_I_$I; is abstract
S__Z__eFoo__fwBarYI_ raised exception java.lang.AbstractMethodError: Method S__Z__eFoo__fwBarYI_.f()LBarYI_$I; is abstract
S__Z__eFoo_IfwBar___ raised exception java.lang.AbstractMethodError: Method S__Z__eFoo_IfwBar___.f()Ljava/lang/Object; is abstract
S__Z__eFoo_IfwBarY__ raised exception java.lang.AbstractMethodError: Method S__Z__eFoo_IfwBarY__.f()Ljava/lang/Object; is abstract
S__Z__eFooX_fwBar_I_ raised exception java.lang.AbstractMethodError: Method S__Z__eFooX_fwBar_I_.f()LBar_I_$I; is abstract
S__Z__eFooX_fwBarYI_ raised exception java.lang.AbstractMethodError: Method S__Z__eFooX_fwBarYI_.f()LBarYI_$I; is abstract
S__Z__eFooXIfwBar___ raised exception java.lang.AbstractMethodError: Method S__Z__eFooXIfwBar___.f()Ljava/lang/Object; is abstract
S__Z__eFooXIfwBarY__ raised exception java.lang.AbstractMethodError: Method S__Z__eFooXIfwBarY__.f()Ljava/lang/Object; is abstract
S_____wFoo__fwBar_I_ raised exception java.lang.AbstractMethodError: Method S_____wFoo__fwBar_I_.f()LBar_I_$I; is abstract
S_____wFoo__fwBarYI_ raised exception java.lang.AbstractMethodError: Method S_____wFoo__fwBarYI_.f()LBarYI_$I; is abstract
S_____wFoo_IfwBar___ raised exception java.lang.AbstractMethodError: Method S_____wFoo_IfwBar___.f()Ljava/lang/Object; is abstract
S_____wFoo_IfwBarY__ raised exception java.lang.AbstractMethodError: Method S_____wFoo_IfwBarY__.f()Ljava/lang/Object; is abstract
S_____wFooX_fwBar_I_ raised exception java.lang.AbstractMethodError: Method S_____wFooX_fwBar_I_.f()LBar_I_$I; is abstract
S_____wFooX_fwBarYI_ raised exception java.lang.AbstractMethodError: Method S_____wFooX_fwBarYI_.f()LBarYI_$I; is abstract
S_____wFooXIfwBar___ raised exception java.lang.AbstractMethodError: Method S_____wFooXIfwBar___.f()Ljava/lang/Object; is abstract
S_____wFooXIfwBarY__ raised exception java.lang.AbstractMethodError: Method S_____wFooXIfwBarY__.f()Ljava/lang/Object; is abstract
S__Z__wFoo__fwBar_I_ raised exception java.lang.AbstractMethodError: Method S__Z__wFoo__fwBar_I_.f()LBar_I_$I; is abstract
S__Z__wFoo__fwBarYI_ raised exception java.lang.AbstractMethodError: Method S__Z__wFoo__fwBarYI_.f()LBarYI_$I; is abstract
S__Z__wFoo_IfwBar___ raised exception java.lang.AbstractMethodError: Method S__Z__wFoo_IfwBar___.f()Ljava/lang/Object; is abstract
S__Z__wFoo_IfwBarY__ raised exception java.lang.AbstractMethodError: Method S__Z__wFoo_IfwBarY__.f()Ljava/lang/Object; is abstract
S__Z__wFooX_fwBar_I_ raised exception java.lang.AbstractMethodError: Method S__Z__wFooX_fwBar_I_.f()LBar_I_$I; is abstract
S__Z__wFooX_fwBarYI_ raised exception java.lang.AbstractMethodError: Method S__Z__wFooX_fwBarYI_.f()LBarYI_$I; is abstract
S__Z__wFooXIfwBar___ raised exception java.lang.AbstractMethodError: Method S__Z__wFooXIfwBar___.f()Ljava/lang/Object; is abstract
S__Z__wFooXIfwBarY__ raised exception java.lang.AbstractMethodError: Method S__Z__wFooXIfwBarY__.f()Ljava/lang/Object; is abstract
S_T___eFoo__fwBar_I_ raised exception java.lang.AbstractMethodError: Method S_T___eFoo__fwBar_I_.f()LBar_I_$I; is abstract
S_T___eFoo__fwBarYI_ raised exception java.lang.AbstractMethodError: Method S_T___eFoo__fwBarYI_.f()LBarYI_$I; is abstract
S_T___eFoo_IfwBar___ raised exception java.lang.AbstractMethodError: Method S_T___eFoo_IfwBar___.f()Ljava/lang/Object; is abstract
S_T___eFoo_IfwBarY__ raised exception java.lang.AbstractMethodError: Method S_T___eFoo_IfwBarY__.f()Ljava/lang/Object; is abstract
S_T___eFooX_fwBar_I_ raised exception java.lang.AbstractMethodError: Method S_T___eFooX_fwBar_I_.f()LBar_I_$I; is abstract
S_T___eFooX_fwBarYI_ raised exception java.lang.AbstractMethodError: Method S_T___eFooX_fwBarYI_.f()LBarYI_$I; is abstract
S_T___eFooXIfwBar___ raised exception java.lang.AbstractMethodError: Method S_T___eFooXIfwBar___.f()Ljava/lang/Object; is abstract
S_T___eFooXIfwBarY__ raised exception java.lang.AbstractMethodError: Method S_T___eFooXIfwBarY__.f()Ljava/lang/Object; is abstract
S_TZ__eFoo__fwBar_I_ raised exception java.lang.AbstractMethodError: Method S_TZ__eFoo__fwBar_I_.f()LBar_I_$I; is abstract
S_TZ__eFoo__fwBarYI_ raised exception java.lang.AbstractMethodError: Method S_TZ__eFoo__fwBarYI_.f()LBarYI_$I; is abstract
S_TZ__eFoo_IfwBar___ raised exception java.lang.AbstractMethodError: Method S_TZ__eFoo_IfwBar___.f()Ljava/lang/Object; is abstract
S_TZ__eFoo_IfwBarY__ raised exception java.lang.AbstractMethodError: Method S_TZ__eFoo_IfwBarY__.f()Ljava/lang/Object; is abstract
S_TZ__eFooX_fwBar_I_ raised exception java.lang.AbstractMethodError: Method S_TZ__eFooX_fwBar_I_.f()LBar_I_$I; is abstract
S_TZ__eFooX_fwBarYI_ raised exception java.lang.AbstractMethodError: Method S_TZ__eFooX_fwBarYI_.f()LBarYI_$I; is abstract
S_TZ__eFooXIfwBar___ raised exception java.lang.AbstractMethodError: Method S_TZ__eFooXIfwBar___.f()Ljava/lang/Object; is abstract
S_TZ__eFooXIfwBarY__ raised exception java.lang.AbstractMethodError: Method S_TZ__eFooXIfwBarY__.f()Ljava/lang/Object; is abstract
S_T___wFoo__fwBar_I_ raised exception java.lang.AbstractMethodError: Method S_T___wFoo__fwBar_I_.f()LBar_I_$I; is abstract
S_T___wFoo__fwBarYI_ raised exception java.lang.AbstractMethodError: Method S_T___wFoo__fwBarYI_.f()LBarYI_$I; is abstract
S_T___wFoo_IfwBar___ raised exception java.lang.AbstractMethodError: Method S_T___wFoo_IfwBar___.f()Ljava/lang/Object; is abstract
S_T___wFoo_IfwBarY__ raised exception java.lang.AbstractMethodError: Method S_T___wFoo_IfwBarY__.f()Ljava/lang/Object; is abstract
S_T___wFooX_fwBar_I_ raised exception java.lang.AbstractMethodError: Method S_T___wFooX_fwBar_I_.f()LBar_I_$I; is abstract
S_T___wFooX_fwBarYI_ raised exception java.lang.AbstractMethodError: Method S_T___wFooX_fwBarYI_.f()LBarYI_$I; is abstract
S_T___wFooXIfwBar___ raised exception java.lang.AbstractMethodError: Method S_T___wFooXIfwBar___.f()Ljava/lang/Object; is abstract
S_T___wFooXIfwBarY__ raised exception java.lang.AbstractMethodError: Method S_T___wFooXIfwBarY__.f()Ljava/lang/Object; is abstract
S_TZ__wFoo__fwBar_I_ raised exception java.lang.AbstractMethodError: Method S_TZ__wFoo__fwBar_I_.f()LBar_I_$I; is abstract
S_TZ__wFoo__fwBarYI_ raised exception java.lang.AbstractMethodError: Method S_TZ__wFoo__fwBarYI_.f()LBarYI_$I; is abstract
S_TZ__wFoo_IfwBar___ raised exception java.lang.AbstractMethodError: Method S_TZ__wFoo_IfwBar___.f()Ljava/lang/Object; is abstract
S_TZ__wFoo_IfwBarY__ raised exception java.lang.AbstractMethodError: Method S_TZ__wFoo_IfwBarY__.f()Ljava/lang/Object; is abstract
S_TZ__wFooX_fwBar_I_ raised exception java.lang.AbstractMethodError: Method S_TZ__wFooX_fwBar_I_.f()LBar_I_$I; is abstract
S_TZ__wFooX_fwBarYI_ raised exception java.lang.AbstractMethodError: Method S_TZ__wFooX_fwBarYI_.f()LBarYI_$I; is abstract
S_TZ__wFooXIfwBar___ raised exception java.lang.AbstractMethodError: Method S_TZ__wFooXIfwBar___.f()Ljava/lang/Object; is abstract
S_TZ__wFooXIfwBarY__ raised exception java.lang.AbstractMethodError: Method S_TZ__wFooXIfwBarY__.f()Ljava/lang/Object; is abstract

96 errors

@odersky odersky changed the title Give to martin.y [WIP] New bridge implementation May 1, 2017
@odersky
Copy link
Contributor

odersky commented May 1, 2017

Rebased over #2331. I verified that with these changes (and the custom Either) the collection strawman now compiles and tests OK.

DarkDimius and others added 6 commits May 1, 2017 23:44
Those forwarders may disrupt method resolution.
This one is based on the way things are done in scalac.

As yet missing: Systematic treatment of errors.

Test i1240a was moved to pending. It caused a merge error before
but this was likely accidental. We have to check whether systematic
bridge error checking will discover a problem. For the moment
the test behaves exactly as for scalac: it compiles and the result
is the same.
Was info before, but signatures already contain all the information
we need and are cheaper to test for equality.
@odersky
Copy link
Contributor

odersky commented May 1, 2017

Note: error diagnostic is still missing.

We were missing "has same signature after erasure" errors
if the two methods in questions came from different parents.
@@ -11,6 +11,9 @@ import TypeErasure.ErasedValueType, ValueClasses._
/** This phase erases ErasedValueType to their underlying type.
* It also removes the synthetic cast methods u2evt$ and evt2u$ which are
* no longer needed afterwards.
* Finally, it checks that we don't introduce "double definitions" of pairs
Copy link
Member

Choose a reason for hiding this comment

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

Why put this in ElimErasedValueType ? Shouldn't it be a separate mini-phase?

@odersky
Copy link
Contributor

odersky commented May 2, 2017

I knew you would say this 😀. There's some logic to put it here because at the end of ElimErasedValueTypes all denotations have the types that we need to check the condition. Creating lots of new phases has a cognitive cost as well.

@smarter
Copy link
Member

smarter commented May 2, 2017

I'll leave my vote for making a CheckDoubleDef phase just after ElimErasedValueType instead, and using Check as a prefix for all phases that do not change trees to make it easier to mentally filter them out. But I'll let you decide ;).

@odersky odersky requested a review from smarter May 2, 2017 13:08
@odersky odersky changed the title [WIP] New bridge implementation New bridge implementation May 2, 2017
@smarter smarter removed their request for review May 2, 2017 13:24
@odersky odersky merged commit 92fe2a5 into scala:master May 4, 2017
nicolasstucki added a commit to dotty-staging/dotty that referenced this pull request May 5, 2017
nicolasstucki added a commit to dotty-staging/dotty that referenced this pull request May 5, 2017
@allanrenucci allanrenucci deleted the bridge branch December 14, 2017 16:58
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.

3 participants