Extracting contravariant type parameter in match breaks a quote #15779
Labels
area:metaprogramming:quotes
Issues related to quotes and splices
area:pickling
itype:bug
itype:crash
Milestone
Compiler version
3.2.0-RC3 and earlier
Minimized code
Encoder.scala
Main.scala
Output
Expectation
This should compile successfully, without breaking the pickler.
It looks like an attempt to extract a type parameter from the type of a quoted expression in a match somehow mutates the quote: The first occurrence of
prints
AAA
, the second one printsBBB
.On the other hand nothing breaks if at least one of the modifications below is performed:
Encoder
is declared as invariantPrimitiveEncoder
is declared as contravariantJustInt
gets moved toEncoder.scala
case '{ ${encoder}: Encoder[tpe] } => println("AAA")
branch gets removed from both matchesfromMirrorImpl
is something else thanencoder
The text was updated successfully, but these errors were encountered: