Skip to content

Nested type quoted pattern crashes #7603

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
nicolasstucki opened this issue Nov 22, 2019 · 0 comments
Closed

Nested type quoted pattern crashes #7603

nicolasstucki opened this issue Nov 22, 2019 · 0 comments

Comments

@nicolasstucki
Copy link
Contributor

minimized code

import scala.quoted._
class Foo {
  def f[T2: Type](e: Expr[T2])(given QuoteContext) = e match {
    case '{ $x: ${'[List[$t]]} } =>
      '[ List[$t] ]
  }
}
Stack trace
-- Warning: tests/pos/i7264b.scala:4:16 ----------------------------------------
4 |    case '{ $x: ${'[List[$t]]} } =>
  |                ^^^^^^^^^^^^^^
  |Canceled quote directly inside a splice. ${ '[ XYZ ] } is equivalent to XYZ.
Exception in thread "main" java.lang.AssertionError: assertion failed
        at dotty.DottyPredef$.assertFail(DottyPredef.scala:16)
        at dotty.tools.dotc.typer.QuotesAndSplices$splitter$1$.transformTypeBindingTypeDef(QuotesAndSplices.scala:233)
        at dotty.tools.dotc.typer.QuotesAndSplices$splitter$1$.transform(QuotesAndSplices.scala:193)
        at dotty.tools.dotc.typer.QuotesAndSplices.$anonfun$10(QuotesAndSplices.scala:220)
        at dotty.tools.dotc.typer.QuotesAndSplices.dotty$tools$dotc$typer$QuotesAndSplices$splitter$1$$$_$_$$anonfun$adapted$1(QuotesAndSplices.scala:221)
        at dotty.tools.dotc.core.Decorators$ListDecorator$.zipWithConserve$extension(Decorators.scala:110)
        at dotty.tools.dotc.typer.QuotesAndSplices$splitter$1$.transform(QuotesAndSplices.scala:221)
        at dotty.tools.dotc.typer.QuotesAndSplices$splitter$1$.transform(QuotesAndSplices.scala:179)
        at dotty.tools.dotc.typer.QuotesAndSplices.splitQuotePattern(QuotesAndSplices.scala:240)
        at dotty.tools.dotc.typer.QuotesAndSplices.typedQuotePattern(QuotesAndSplices.scala:329)
        at dotty.tools.dotc.typer.QuotesAndSplices.typedQuote(QuotesAndSplices.scala:49)
        at dotty.tools.dotc.typer.Typer.typedQuote(Typer.scala:82)
        at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2133)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2151)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2187)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2199)
        at dotty.tools.dotc.typer.Typer.typedPattern(Typer.scala:2288)
        at dotty.tools.dotc.typer.Typer.typedCase(Typer.scala:1194)
        at dotty.tools.dotc.typer.Typer.typedCases$$anonfun$1(Typer.scala:1151)
        at dotty.tools.dotc.core.Decorators$ListDecorator$.loop$1(Decorators.scala:63)
        at dotty.tools.dotc.core.Decorators$ListDecorator$.mapconserve$extension(Decorators.scala:79)
        at dotty.tools.dotc.typer.Typer.typedCases(Typer.scala:1153)
        at dotty.tools.dotc.typer.Typer.$anonfun$17(Typer.scala:1143)
        at dotty.tools.dotc.typer.Applications.harmonic(Applications.scala:1882)
        at dotty.tools.dotc.typer.Typer.harmonic(Typer.scala:82)
        at dotty.tools.dotc.typer.Typer.typedMatchFinish(Typer.scala:1143)
        at dotty.tools.dotc.typer.Typer.typedMatch(Typer.scala:1125)
        at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2106)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2151)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2187)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2199)
        at dotty.tools.dotc.typer.Namer.typedAheadExpr$$anonfun$1(Namer.scala:1236)
        at dotty.tools.dotc.typer.Namer.typedAhead(Namer.scala:1226)
        at dotty.tools.dotc.typer.Namer.typedAheadExpr(Namer.scala:1236)
        at dotty.tools.dotc.typer.Namer.rhsType$2(Namer.scala:1370)
        at dotty.tools.dotc.typer.Namer.cookedRhsType$1(Namer.scala:1381)
        at dotty.tools.dotc.typer.Namer.lhsType$1(Namer.scala:1382)
        at dotty.tools.dotc.typer.Namer.inferredType$1(Namer.scala:1393)
        at dotty.tools.dotc.typer.Namer.valOrDefDefSig(Namer.scala:1401)
        at dotty.tools.dotc.typer.Namer.defDefSig(Namer.scala:1470)
        at dotty.tools.dotc.typer.Namer$Completer.typeSig(Namer.scala:788)
        at dotty.tools.dotc.typer.Namer$Completer.completeInCreationContext(Namer.scala:908)
        at dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:816)
        at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:257)
        at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:182)
        at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:184)
        at dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:397)
        at dotty.tools.dotc.typer.Typer.retrieveSym(Typer.scala:2045)
        at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2070)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2150)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2187)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2199)
        at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2226)
        at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2270)
        at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:1765)
        at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2083)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2150)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2187)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2199)
        at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2226)
        at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2270)
        at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:1885)
        at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2124)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2151)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2187)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2199)
        at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2284)
        at dotty.tools.dotc.typer.FrontEnd.liftedTree9$2(FrontEnd.scala:78)
        at dotty.tools.dotc.typer.FrontEnd.typeCheck$$anonfun$1(FrontEnd.scala:83)
        at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
        at dotty.tools.dotc.typer.FrontEnd.monitor(FrontEnd.scala:42)
        at dotty.tools.dotc.typer.FrontEnd.typeCheck(FrontEnd.scala:84)
        at dotty.tools.dotc.typer.FrontEnd.runOn$$anonfun$3(FrontEnd.scala:114)
        at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)
        at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10)
        at scala.collection.immutable.List.foreach(List.scala:305)
        at dotty.tools.dotc.typer.FrontEnd.runOn(FrontEnd.scala:114)
        at dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:162)
        at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)
        at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10)
        at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
        at dotty.tools.dotc.Run.runPhases$5(Run.scala:172)
        at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:180)
        at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
        at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:65)
        at dotty.tools.dotc.Run.compileUnits(Run.scala:187)
        at dotty.tools.dotc.Run.compileSources(Run.scala:124)
        at dotty.tools.dotc.Run.compile(Run.scala:107)
        at dotty.tools.dotc.Driver.doCompile(Driver.scala:36)
        at dotty.tools.dotc.Driver.process(Driver.scala:189)
        at dotty.tools.dotc.Driver.process(Driver.scala:158)
        at dotty.tools.dotc.Driver.process(Driver.scala:170)
        at dotty.tools.dotc.Driver.main(Driver.scala:197)
        at dotty.tools.dotc.Main.main(Main.scala)
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Dec 2, 2019
nicolasstucki added a commit that referenced this issue Dec 3, 2019
Fix #7603: Emit error when a splice type is not an identifier
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Dec 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants