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
[error] --Error: bugreport.scala:26:11
[error] 26| showTuple[(Int, Int)]
[error] |^^^^^^^^^^^^^^^^^^^^^
[error] |objectcreation impossible, since defshow(a: A):String in traitShow in packagederivationisnotdefined
[error] |(Note that
[error] | parameter A in defshow(a: A):String in traitShow in packagederivationdoesnotmatch
[error] | parameter (Int, Int) in defshow(tuple: (Int, Int)):String in anonymous classObjectwith derivation.Show[head *: tail] {...}
[error] | )
[error] |This location contains code that was inlined from bugreport.scala:12
Expectation
It compiles.
Note that if I introduce a type alias within the branch and then I always refer to that type alias it works:
packagederivationimportscala.compiletime.erasedValuetraitShow[A]:defshow(a: A):StringinlinedefshowTuple[Types]:Show[Types] =inline erasedValue[Types] matchcase_: (head *: tail) =>typeX= head *: tail // Introduce a type aliasvalinstance=newShow[X]:defshow(tuple: X):String="dummy"
instance.asInstanceOf[Show[Types]]
@main defrun() =
showTuple[(Int, Int)] // OK
The text was updated successfully, but these errors were encountered:
It seems that in some cases I can reuse the type expression head *: tail. The bug appears when I use it within the definition of an anonymous class (like in new Show[head *: tail]:).
Compiler version
3.0.0
Minimized code
Output
Expectation
It compiles.
Note that if I introduce a type alias within the branch and then I always refer to that type alias it works:
The text was updated successfully, but these errors were encountered: