Identical expressions yield inconsistent values across selectDynamic #6327
Comments
|
Imported From: https://issues.scala-lang.org/browse/SI-6327?orig=1
|
|
@retronym said: You don't need to guess: scalac -Xprint:typer /Users/jason/Downloads/inconsistent.scala
...
private[this] val b: DynTest.B = new DynTest.this.B();
<stable> <accessor> def b: DynTest.B = DynTest.this.b;
DynTest.this.b.selectDynamic[String]("baz")(DynTest.this.R.StringR);
DynTest.this.b.selectDynamic[String]("baz")(DynTest.this.R.StringR);
private[this] val c: Unit = DynTest.this.b.selectDynamic[String]("baz")(DynTest.this.R.StringR);
<stable> <accessor> def c: Unit = DynTest.this.c;
private[this] val d: Unit = DynTest.this.b.selectDynamic[Any]("baz")(DynTest.this.Default);
<stable> <accessor> def d: Unit = DynTest.this.d |
|
@adriaanm said: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Compiling and running the attached source produces the output:
A
A
A
B
whilst all four expressions should be identical.
It appears that different types are being inferred for T in selectDynamic[T] depending on whether it is called explicitly, and whether the expression is then assigned.
There probably exist simpler test cases which don't involve implicits, though this one clearly demonstrates the issue.
The text was updated successfully, but these errors were encountered: