Skip to content

MatchError in tree.show on scala.tasty.Reflection #8364

Closed
@pavelfatin

Description

@pavelfatin

Code (0.22.0-RC1)

val inspector = new TastyInspector {
  def processCompilationUnit(reflect: Reflection)(tree: reflect.Tree): Unit = {
    import reflect.{_, given}
    println(tree.show)
  }
}
inspector.inspect("", List("scala.tasty.Reflection"))

Output

scala.MatchError: AppliedType(TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class collection)),module immutable),Seq),List(TypeRef(ThisType(TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class scala)),module tasty),class Reflection)),type Term))) (of class dotty.tools.dotc.core.Types$CachedAppliedType) while compiling scala.tasty.Reflection
Exception in thread "main" scala.MatchError: AppliedType(TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class collection)),module immutable),Seq),List(TypeRef(ThisType(TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class scala)),module tasty),class Reflection)),type Term))) (of class dotty.tools.dotc.core.Types$CachedAppliedType)
	at scala.tasty.reflect.SourceCodePrinter$Buffer.printTypeTree(SourceCodePrinter.scala:1018)
	at scala.tasty.reflect.SourceCodePrinter$Buffer.printParamDef(SourceCodePrinter.scala:848)
	at scala.tasty.reflect.SourceCodePrinter$Buffer.printSeparated$14(SourceCodePrinter.scala:803)
	at scala.tasty.reflect.SourceCodePrinter$Buffer.printArgsDefs$$anonfun$1(SourceCodePrinter.scala:810)
...

SourceCodePrinter.scala

ref.tpe match {
  case tpe: TypeRef if tpe.typeSymbol == ctx.requiredClass("scala.annotation.internal.Repeated") =>
    val Types.Sequence(tp) = tpt.tpe // HERE

(and there are more errors besides the above line)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions