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
Generated Java generic signature for refinement type incongruous with erasure #9200
Comments
Imported From: https://issues.scala-lang.org/browse/SI-9200?orig=1 |
@retronym said: |
@retronym said: ⚡ cat sandbox/test.scala && scalac -Xprint:typer sandbox/test.scala && javap -s C
trait T[A]
object C {
def foo: T[Any] = new T[Any] {}
def baz = new T[Any] {}
}
[[syntax trees at end of typer]] // test.scala
package <empty> {
abstract trait T[A] extends scala.AnyRef;
object C extends scala.AnyRef {
def <init>(): C.type = {
C.super.<init>();
()
};
def foo: T[Any] = {
final class $anon extends AnyRef with T[Any] {
def <init>(): <$anon: T[Any]> = {
$anon.super.<init>();
()
};
<empty>
};
new $anon()
};
def baz: T[Any] = {
final class $anon extends AnyRef with T[Any] {
def <init>(): <$anon: T[Any]> = {
$anon.super.<init>();
()
};
<empty>
};
new $anon()
}
}
}
Compiled from "test.scala"
public final class C {
public static java.lang.Object baz();
descriptor: ()LT;
public static T<java.lang.Object> foo();
descriptor: ()LT;
}
/code/scala2 on review/4971*
⚡ cat sandbox/test.scala && scalac -Ydebug -Xprint:typer sandbox/test.scala && javap -s C
trait T[A]
object C {
def foo: T[Any] = new T[Any] {}
def baz = new T[Any] {}
}
[running phase parser on test.scala]
[running phase namer on test.scala]
[running phase packageobjects on test.scala]
[running phase typer on test.scala]
[[syntax trees at end of typer]] // test.scala
package <empty> {
<interface> abstract <defaultparam/trait> trait T[A] extends scala.AnyRef;
<module> object C extends scala.AnyRef {
<method> def <init>(): <empty>.this.C.type = {
C.super.<init>();
()
};
<method> def foo: <empty>.this.T[scala.this.Any] = {
final class $anon extends scala.this.AnyRef with <empty>.this.T[scala.this.Any] {
<method> <triedcooking> def <init>(): <$anon: <empty>.this.T[scala.this.Any]> = {
$anon.super.<init>();
()
};
<empty>
};
new $anon.<init>()
};
<method> def baz: <empty>.this.T[scala.this.Any]{} = {
final class $anon extends scala.this.AnyRef with <empty>.this.T[scala.this.Any] {
<method> <triedcooking> def <init>(): <$anon: <empty>.this.T[scala.this.Any]> = {
$anon.super.<init>();
()
};
<empty>
};
new $anon.<init>()
}
}
}
[running phase patmat on test.scala]
[running phase superaccessors on test.scala]
[running phase extmethods on test.scala]
[running phase pickler on test.scala]
[running phase refchecks on test.scala]
[running phase uncurry on test.scala]
[running phase tailcalls on test.scala]
[running phase specialize on test.scala]
[running phase explicitouter on test.scala]
[running phase erasure on test.scala]
[running phase posterasure on test.scala]
[running phase lazyvals on test.scala]
[running phase lambdalift on test.scala]
[running phase constructors on test.scala]
[running phase flatten on test.scala]
[running phase mixin on test.scala]
[running phase cleanup on test.scala]
[running phase delambdafy on test.scala]
[running phase icode on test.scala]
[running phase jvm on icode]
Compiled from "test.scala"
public final class C {
public static java.lang.Object baz();
descriptor: ()LT;
public static T<java.lang.Object> foo();
descriptor: ()LT;
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Reported by Matthieu Leclercq in https://groups.google.com/d/msg/scala-internals/YvWhX3hDavk/BU0cuWHrPG0J
The text was updated successfully, but these errors were encountered: