Skip to content

TASTy Type#simplified doesn't always simplifies match types #10078

Closed
@IndiscriminateCoding

Description

@IndiscriminateCoding

Minimized code

File T.scala:

import scala.quoted._

object T {
  inline def show[A <: AnyKind]: Unit = ${ showImpl[A] }

  def showImpl[A <: AnyKind](using t: Type[A])(using ctx: QuoteContext): Expr[Unit] = {
    val before = t.unseal.tpe
    val after = before.simplified
    println(s"Before: ${before.show}")
    println(s"After : ${after.show}")
    '{}
  }
}

File Main.scala:

trait K[F[_]]
trait K2[F[_[_]]]

type Param1[m] = [f[_]] =>> m match { case K2[g] => g[f] }
type Param2[m] = m match { case K2[g] => g }

type Local = K2[K]

val _ = T.show[Param1[Local]]
val _ = T.show[Param2[Local]]

Output

Before: Main$package.Param1[Main$package.Local]
After : Main$package.Param1[Main$package.Local]
Before: [F >: scala.Nothing <: [_$1 >: scala.Nothing <: scala.Any] => scala.Any] => K[F]
After : [F >: scala.Nothing <: [_$1 >: scala.Nothing <: scala.Any] => scala.Any] => K[F]

Expectation

I expect that Param1 would be simplified in the same way as Param2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions