zio / izumi-reflect

TypeTag without scala-reflect. Supports Scala 2 and Scala 3.
https://zio.dev/izumi-reflect
Other
141 stars 35 forks source link

Support non-trivial lambdas in Scala-style rendering format #384

Open neko-kai opened 1 year ago

neko-kai commented 1 year ago

In current implementation of LightTypeTag#scalaStyledName it's impossible to distinguish [A, B] =>> Either[A, B] and [A, B] =>> Either[B, A] lambdas since they both end up printed as Either[_, _].

To fix this, we should add a check for whether it's correct to use _-placeholders when printing a lambda - it's only correct when all lambda parameters are applied and in the same order as they were declared. If not, we should print a long lambda form such as [A, B] =>> Either[A, B].

/cc @Ivoyaa