-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Emit generic signature for static forwarders to nullary methods #12710
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -697,7 +697,7 @@ class TypeErasure(sourceLanguage: SourceLanguage, semiEraseVCs: Boolean, isConst | |
// See doc comment for ElimByName for speculation how we could improve this. | ||
else | ||
MethodType(Nil, Nil, | ||
eraseResult(sym.info.finalResultType.translateFromRepeated(toArray = sourceLanguage.isJava))) | ||
eraseResult(rt.translateFromRepeated(toArray = sourceLanguage.isJava))) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was needed for test The backend calls Erasure should, I assume, continue to work on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Apparently that was intentionally changed in 76af6c5 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tests passed... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, but at the very least we need to carefully check if this breaks binary compatibility. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Very true. How could I do that? Compile the community build twice and do a jardiff? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I ran I also added a check to see when the old and new erasure are different and it only happened when called from the backend: + val a = eraseResult(rt.translateFromRepeated(toArray = sourceLanguage.isJava))
+ val b = eraseResult(sym.info.finalResultType.translateFromRepeated(toArray = sourceLanguage.isJava))
+ if (!(a =:= b) && !(new Exception).getStackTrace.exists(_.toString.contains("getStaticForwarderGenericSignature"))) then
+ throw new Exception(s"[ERASURE]\n- $a\n- $b\n- $tp\n- ${sym.showFullName}")
MethodType(Nil, Nil,
- eraseResult(rt.translateFromRepeated(toArray = sourceLanguage.isJava)))
+ a) I ran the @smarter any other ideas? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, I've run a similar test on the whole CI and it also didn't show any situation where the two types differed, this makes sense since the tp passed to eraseInfo should always be the symbol info at that point (it's only called from transformInfo which is only called from Erasure#transform, which always uses the symbol info except for |
||
case tp1: PolyType => | ||
eraseResult(tp1.resultType) match | ||
case rt: MethodType => rt | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
trait L[+T] { def head: T } | ||
object A { | ||
def foo: L[String] = ??? | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
public class C_2 { | ||
String hi = A.foo().head(); | ||
} |
Uh oh!
There was an error while loading. Please reload this page.