You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As you can see, the magical val _$this is typed as Helpers with Parser before erasure, but is then typed as Parser after erasure. Note that the tree itself is well-typed. However, _$this is a magical val that is used to encode reassignments to this in the bytecode. Now, since this is a method of Helpers, in the bytecode, thismust be of type Helpers. The type of _$this should therefore be Helpers as well, not Parser.
Note that this leaves a trace up until the bytecode:
Note the checkcast #24 // class Parser, which is totally useless, and exists only because erasure had to adapt this to Parser to give it as an argument to the _$this parameter of the LabelDef.
The text was updated successfully, but these errors were encountered:
Not sure this is worth reporting, but it caused some headaches in Scala.js: scala-js/scala-js#3058 (with a wrong fix in scala-js/scala-js#3059) then scala-js/scala-js#3267 (with the "proper" fix in scala-js/scala-js#3272). We'll need the workaround of scala-js/scala-js#3272 forever anyway to keep support for 2.12.{0-4}, but maybe it's worth fixing internally for the future.
Compiling the following code snippet with
-Xprint:tailcalls,erasure
, Scala 2.12.4:prints:
As you can see, the magical
val _$this
is typed asHelpers with Parser
beforeerasure
, but is then typed asParser
after erasure. Note that the tree itself is well-typed. However,_$this
is a magical val that is used to encode reassignments tothis
in the bytecode. Now, since this is a method ofHelpers
, in the bytecode,this
must be of typeHelpers
. The type of_$this
should therefore beHelpers
as well, notParser
.Note that this leaves a trace up until the bytecode:
Note the
checkcast #24 // class Parser
, which is totally useless, and exists only because erasure had to adaptthis
toParser
to give it as an argument to the_$this
parameter of theLabelDef
.The text was updated successfully, but these errors were encountered: