Skip to content

Crash in summonExpr #7987

Closed
Closed
@biboudis

Description

@biboudis

minimized code

import scala.quoted._
import scala.deriving._
import scala.quoted.matching._

object Macros {
  inline def m(): Unit = ${ macroImpl() }

  def macroImpl[T]()(given qctx: QuoteContext): Expr[Unit] = {
    summonExpr[Mirror.Of[Some[Int]]]
    '{()}
  }
}
@main def Test() = {
  println(Macros.m())
}
Stack trace
3 |  println(Helper.f(Some(0)))
  |          ^^^^^^^^^^^^^^^^^
  |Exception occurred while executing macro expansion.
  |java.lang.ClassCastException: dotty.tools.dotc.core.Symbols$NoSymbol$ cannot be cast to dotty.tools.dotc.core.Symbols$ClassSymbol
  |     at dotty.tools.dotc.core.Symbols$Symbol.asClass(Symbols.scala:539)
  |     at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2134)
  |     at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2201)
  |     at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:123)
  |     at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2240)
  |     at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2252)
  |     at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2274)
  |     at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2318)
  |     at dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:796)
  |     at dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:800)
  |     at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2152)
  |     at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2202)
  |     at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:123)
  |     at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2240)
  |     at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2252)
  |     at dotty.tools.dotc.typer.Typer.typedNew(Typer.scala:626)
  |     at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2148)
  |     at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2202)
  |     at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:123)
  |     at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2240)
  |     at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2252)
  |     at dotty.tools.dotc.typer.Implicits.anonymousMirror(Implicits.scala:892)
  |     at dotty.tools.dotc.typer.Implicits.mirrorFor$2(Implicits.scala:980)
  |     at dotty.tools.dotc.typer.Implicits.synthesizedProductMirror$$anonfun$1$$anonfun$1(Implicits.scala:991)
  |     at dotty.tools.dotc.typer.Implicits.synthesizedMirror$$anonfun$1$$anonfun$1(Implicits.scala:1080)
  |     at dotty.tools.dotc.typer.Implicits.trySpecialCases$1(Implicits.scala:1123)
  |     at dotty.tools.dotc.typer.Implicits.trySpecialCases$2$$anonfun$1(Implicits.scala:1125)
  |     at dotty.tools.dotc.ast.Trees$Tree.orElse(Trees.scala:185)
  |     at dotty.tools.dotc.typer.Implicits.trySpecialCases$1(Implicits.scala:1125)
  |     at dotty.tools.dotc.typer.Implicits.trySpecialCases$2$$anonfun$1(Implicits.scala:1125)
  |     at dotty.tools.dotc.ast.Trees$Tree.orElse(Trees.scala:185)
  |     at dotty.tools.dotc.typer.Implicits.trySpecialCases$1(Implicits.scala:1125)
  |     at dotty.tools.dotc.typer.Implicits.trySpecialCases$2$$anonfun$1(Implicits.scala:1125)
  |     at dotty.tools.dotc.ast.Trees$Tree.orElse(Trees.scala:185)
  |     at dotty.tools.dotc.typer.Implicits.trySpecialCases$1(Implicits.scala:1125)
  |     at dotty.tools.dotc.typer.Implicits.trySpecialCases$2$$anonfun$1(Implicits.scala:1125)
  |     at dotty.tools.dotc.ast.Trees$Tree.orElse(Trees.scala:185)
  |     at dotty.tools.dotc.typer.Implicits.trySpecialCases$1(Implicits.scala:1125)
  |     at dotty.tools.dotc.typer.Implicits.trySpecialCases$2$$anonfun$1(Implicits.scala:1125)
  |     at dotty.tools.dotc.ast.Trees$Tree.orElse(Trees.scala:185)
  |     at dotty.tools.dotc.typer.Implicits.trySpecialCases$1(Implicits.scala:1125)
  |     at dotty.tools.dotc.typer.Implicits.trySpecialCases$2$$anonfun$1(Implicits.scala:1125)
  |     at dotty.tools.dotc.ast.Trees$Tree.orElse(Trees.scala:185)
  |     at dotty.tools.dotc.typer.Implicits.trySpecialCases$1(Implicits.scala:1125)
  |     at dotty.tools.dotc.typer.Implicits.trySpecialCases$2$$anonfun$1(Implicits.scala:1125)
  |     at dotty.tools.dotc.ast.Trees$Tree.orElse(Trees.scala:185)
  |     at dotty.tools.dotc.typer.Implicits.trySpecialCases$1(Implicits.scala:1125)
  |     at dotty.tools.dotc.typer.Implicits.inferImplicitArg(Implicits.scala:1130)
  |     at dotty.tools.dotc.typer.Typer.inferImplicitArg(Typer.scala:83)
  |     at dotty.tools.dotc.tastyreflect.ReflectionCompilerInterface.searchImplicit(ReflectionCompilerInterface.scala:1912)
  |     at dotty.tools.dotc.tastyreflect.ReflectionCompilerInterface.searchImplicit(ReflectionCompilerInterface.scala:1911)
  |     at scala.tasty.reflect.ImplicitsOps.searchImplicit(ImplicitsOps.scala:6)
  |     at scala.tasty.Reflection.searchImplicit(Reflection.scala:6)
  |     at scala.quoted.matching.package$.summonExpr(package.scala:15)
  |     at Helper$.macroImpl(Macro_1.scala:26)
  |
  | This location contains code that was inlined from Test_2.scala:3

inlined at Test_2.scala:3:

This resulted after further investigating this #7974

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions