-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Handle HKT bounds in Java generic signatures #25744
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
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 @@ | ||||||||||
| scala.collection.Iterable<scala.Tuple2<K, A>> | ||||||||||
|
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. maybe we wanna move these tests into
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. what's the purpose of this generic-java-signatures folder exactly? we could move a lot of tests in there indeed
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. files under scala3/compiler/test/dotty/tools/dotc/CompilationTests.scala Lines 181 to 184 in d23d5ef
On the other hand, files under So, if the test is specific for checking java generic signatures, they would be nice to go to
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. Not testing multiple times is nice... also I just realized it means we don't need to explicitly add I'll grep |
||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| // scalajs: --skip | ||
| // (JVM-only, generic signatures) | ||
|
|
||
| trait Working: | ||
| type M[X,Y] = Iterable[(X, Y)] | ||
| def example[K, A, T[X,Y] <: M[X,Y]](ab: String): T[K,A] = ??? | ||
|
|
||
| object Test: | ||
| def main(args: Array[String]): Unit = | ||
| classOf[Working].getMethods.filter(_.getName == "example").map(_.getGenericReturnType).foreach(println) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| scala.collection.Iterable<scala.Tuple2<K, A>> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| // scalajs: --skip | ||
| // (JVM-only, generic signatures) | ||
|
|
||
| trait NotWorking: | ||
| def example[K, A, T[X,Y] <: Iterable[(X, Y)]](ab: String): T[K,A] = ??? | ||
|
|
||
| object Test: | ||
| def main(args: Array[String]): Unit = | ||
| classOf[NotWorking].getMethods.filter(_.getName == "example").map(_.getGenericReturnType).foreach(println) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| scala.collection.Iterable<scala.Tuple2<A, K>> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| // scalajs: --skip | ||
| // (JVM-only, generic signatures) | ||
|
|
||
| trait NotWorking: | ||
| // return type args reversed compared to test case (b) | ||
| def example[K, A, T[X,Y] <: Iterable[(X, Y)]](ab: String): T[A,K] = ??? | ||
|
|
||
| object Test: | ||
| def main(args: Array[String]): Unit = | ||
| classOf[NotWorking].getMethods.filter(_.getName == "example").map(_.getGenericReturnType).foreach(println) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| interface scala.collection.Iterable |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| // scalajs: --skip | ||
| // (JVM-only, generic signatures) | ||
|
|
||
| trait NotWorking: | ||
| def example[A, X[T] <: Iterable[X[List[T]]]](s: String): X[A] = ??? | ||
|
|
||
| object Test: | ||
| def main(args: Array[String]): Unit = | ||
| classOf[NotWorking].getMethods.filter(_.getName == "example").map(_.getGenericReturnType).foreach(println) |
Uh oh!
There was an error while loading. Please reload this page.
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.
[note]
.dealiasis required, otherwisetype M[X,Y]appears in generic signature in the test below. 👍