-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Emit generic signatures for all trait fields #25780
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 all commits
3b897d9
66c27e1
d8190e1
6bda2f2
00f74ea
cf3e416
7423013
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 |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| public void Bar.Foo$_setter_$foo_$eq(scala.Option) | ||
| public void Bar.Foo$_setter_$foo_$eq(scala.Option<java.lang.String>) | ||
| public scala.Option Bar.foo() | ||
| public scala.Option<java.lang.String> Bar.foo() | ||
|
Member
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. ❤️ |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| trait Foo { | ||
| val foo: Option[String] = ??? | ||
| } | ||
| class Bar extends Foo | ||
|
|
||
| object Test: | ||
| def main(args: Array[String]): Unit = | ||
| classOf[Bar].getMethods.sortBy(_.getName).filter(_.getName.contains("foo")).foreach(m => { | ||
| println(m) | ||
| println(m.toGenericString) | ||
| }) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| Foo: | ||
| public abstract void Foo.Foo$_setter_$foo_$eq(scala.Option) | ||
| public abstract void Foo.Foo$_setter_$foo_$eq(scala.Option<java.lang.String>) | ||
| public abstract scala.Option Foo.foo() | ||
| public abstract scala.Option<java.lang.String> Foo.foo() | ||
| bar: | ||
| public void bar$.Foo$_setter_$foo_$eq(scala.Option) | ||
| public void bar$.Foo$_setter_$foo_$eq(scala.Option<java.lang.String>) | ||
| public scala.Option bar$.foo() | ||
| public scala.Option<java.lang.String> bar$.foo() |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| trait Foo { | ||
| val foo: Option[String] = ??? | ||
| } | ||
| object bar extends Foo | ||
|
|
||
| object Test: | ||
| def main(args: Array[String]): Unit = | ||
| println("Foo:") | ||
| classOf[Foo].getMethods.sortBy(_.getName).filter(_.getName.contains("foo")).foreach(m => { | ||
| println(m) | ||
| println(m.toGenericString) | ||
| }) | ||
| println("bar:") | ||
| classOf[bar.type].getMethods.sortBy(_.getName).filter(_.getName.contains("foo")).foreach(m => { | ||
| println(m) | ||
| println(m.toGenericString) | ||
| }) | ||
|
Comment on lines
+14
to
+17
Member
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. How about
Contributor
Author
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. Indeed... There's a whole separate way to create generic signatures for mirror classes. I've spent ~10h trying to fix this and gone nowhere because the interaction of erasure and mixins means we fundamentally have incorrect information once we reach the backend, so we end up in cases where descriptors and generic signatures diverge in ways that aren't correct, e.g., the gensig has I suggest we open an issue and accept this for now.
Member
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. Hmm, for Java interop, the relevant entry point is
Contributor
Author
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. OK!
Contributor
Author
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've changed the description to say "part of #24275" instead of "fixes") |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| trait T { | ||
| private val classValue = new PrivateClass | ||
| private val objectValue = PrivateObject | ||
|
|
||
| private val classOption: Option[PrivateClass] = Some(new PrivateClass) | ||
| private val objectOption: Option[PrivateObject.type] = Some(PrivateObject) | ||
|
|
||
| private class PrivateClass | ||
| private object PrivateObject | ||
| } | ||
|
|
||
| object Test extends T | ||
|
Contributor
Author
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. regression test for some crashes while developing this |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding
MixedInto everything that's mixed in causes so many tests to fail... and is not necessary here anyway