-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Correct Java signature for value classes appearing in type arguments
As suggested in #10846 the fix to this issue should be to port scala/scala#8127 to scala3
- Loading branch information
1 parent
c1b25d6
commit 2217634
Showing
4 changed files
with
45 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
public class C_2 { | ||
String hi = A.foo().head(); | ||
String hy = A.bar().head(); | ||
String hy = A.bar().head().s(); | ||
String hj = A.baz("").head(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
i10846.V: scala.Option<i10846.V> | ||
i10846.U: scala.Option<i10846.U> | ||
i10846.W: scala.Option<i10846.W<scala.Function1<java.lang.Object, java.lang.String>>> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// scalajs: --skip | ||
|
||
package i10846 { | ||
final class V(val x: Int) extends AnyVal | ||
object V { def get: Option[V] = null } | ||
|
||
final class U(val y: String) extends AnyVal | ||
object U { def get: Option[U] = null } | ||
|
||
final class W[T](val z: T) extends AnyVal | ||
object W { def get: Option[W[Int => String]] = null } | ||
} | ||
|
||
|
||
object Test extends scala.App { | ||
def check[T](implicit tt: reflect.ClassTag[T]): Unit = { | ||
val companion = tt.runtimeClass.getClassLoader.loadClass(tt.runtimeClass.getName + '$') | ||
val get = companion.getMethod("get") | ||
assert(get.getReturnType == classOf[Option[_]]) | ||
println(s"${tt.runtimeClass.getName}: ${get.getGenericReturnType}") | ||
} | ||
|
||
import i10846._ | ||
|
||
check[V] | ||
check[U] | ||
check[W[_]] | ||
} |