Skip to content

Literal types don't work with quotes #7046

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
anatoliykmetyuk opened this issue Aug 15, 2019 · 4 comments
Closed

Literal types don't work with quotes #7046

anatoliykmetyuk opened this issue Aug 15, 2019 · 4 comments

Comments

@anatoliykmetyuk
Copy link
Contributor

To reproduce this one, you'll need to compile with -Ycheck:all flag.

import scala.quoted._

inline def mcr: Any = ${mcrImpl}
def mcrImpl given (ctx: QuoteContext): Expr[Any] = {
  val tpl: Expr[1] = '{1}
  '{()}
}
Stack trace
[warn] Multiple main classes detected.  Run 'show discoveredMainClasses' to see the list
[info] Running (fork) dotty.tools.dotc.Main -classpath /Users/anatolii/.ivy2/cache/org.scala-lang/scala-library/jars/scala-library-2.12.8.jar:/Users/anatolii/Projects/dotty/dotty/library/../out/bootstrap/dotty-library-bootstrapped/scala-0.18/dotty-library_0.18-0.18.0-bin-SNAPSHOT.jar -Ycheck:all ../pg/Lib.scala
checking ../pg/Lib.scala after phase frontend
checking ../pg/Lib.scala after phase inlinedPositions
checking ../pg/Lib.scala after phase staging
checking ../pg/Lib.scala after phase posttyper
checking ../pg/Lib.scala after phase pickler
checking ../pg/Lib.scala after phase reifyQuotes
exception while typing val tpl: quoted.Expr[1.type] =
  scala.quoted.Liftable.Liftable_Int_delegate.toExpr(1).apply(ctx) of class class dotty.tools.dotc.ast.Trees$ValDef # 1549
exception while typing {
  val tpl: quoted.Expr[1.type] =
    scala.quoted.Liftable.Liftable_Int_delegate.toExpr(1).apply(ctx)
  scala.quoted.Expr.unitExpr.apply(ctx)
} of class class dotty.tools.dotc.ast.Trees$Block # 1556
exception while typing def mcrImpl given (ctx: quoted.QuoteContext): quoted.Expr[Any] =
  {
    val tpl: quoted.Expr[1.type] =
      scala.quoted.Liftable.Liftable_Int_delegate.toExpr(1).apply(ctx)
    scala.quoted.Expr.unitExpr.apply(ctx)
  } of class class dotty.tools.dotc.ast.Trees$DefDef # 1557
exception while typing @scala.annotation.internal.SourceFile("../pg/Lib.scala") final module class
  Lib$package$
() extends Object(), _root_.scala.Serializable { this: Lib$package.type =>
  private def writeReplace(): AnyRef =
    new scala.runtime.ModuleSerializationProxy(classOf[Lib$package.type])
  inline def mcr: Any = null.asInstanceOf[Any]
  def mcrImpl given (ctx: quoted.QuoteContext): quoted.Expr[Any] =
    {
      val tpl: quoted.Expr[1.type] =
        scala.quoted.Liftable.Liftable_Int_delegate.toExpr(1).apply(ctx)
      scala.quoted.Expr.unitExpr.apply(ctx)
    }
} of class class dotty.tools.dotc.ast.Trees$TypeDef # 1559
exception while typing package <empty> {
  import scala.quoted._
  final lazy module val Lib$package: Lib$package$ = new Lib$package$()
  @scala.annotation.internal.SourceFile("../pg/Lib.scala") final module class
    Lib$package$
  () extends Object(), _root_.scala.Serializable { this: Lib$package.type =>
    private def writeReplace(): AnyRef =
      new scala.runtime.ModuleSerializationProxy(classOf[Lib$package.type])
    inline def mcr: Any = null.asInstanceOf[Any]
    def mcrImpl given (ctx: quoted.QuoteContext): quoted.Expr[Any] =
      {
        val tpl: quoted.Expr[1.type] =
          scala.quoted.Liftable.Liftable_Int_delegate.toExpr(1).apply(ctx)
        scala.quoted.Expr.unitExpr.apply(ctx)
      }
  }
} of class class dotty.tools.dotc.ast.Trees$PackageDef # 1560
*** error while checking ../pg/Lib.scala after phase reifyQuotes ***
exception occurred while compiling ../pg/Lib.scala
java.lang.AssertionError: assertion failed: Found:    quoted.Expr[Int]
Required: quoted.Expr[Int(1)]
tree = scala.quoted.Liftable.Liftable_Int_delegate.toExpr(1).apply(ctx) while compiling ../pg/Lib.scala
Exception in thread "main" java.lang.AssertionError: assertion failed: Found:    quoted.Expr[Int]
Required: quoted.Expr[Int(1)]
tree = scala.quoted.Liftable.Liftable_Int_delegate.toExpr(1).apply(ctx)
	at dotty.DottyPredef$.assertFail(DottyPredef.scala:16)
	at dotty.tools.dotc.transform.TreeChecker$Checker.adapt(TreeChecker.scala:488)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2099)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2111)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typed(TreeChecker.scala:265)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2187)
	at dotty.tools.dotc.typer.Typer.typedValDef(Typer.scala:1478)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1990)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2060)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:124)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typedUnadapted(TreeChecker.scala:280)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2099)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2111)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typed(TreeChecker.scala:265)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2130)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2174)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typedStats(TreeChecker.scala:456)
	at dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:705)
	at dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:708)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typedBlock$$anonfun$2$$anonfun$1(TreeChecker.scala:438)
	at dotty.tools.dotc.transform.TreeChecker$Checker.withDefinedSyms(TreeChecker.scala:169)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typedBlock$$anonfun$1(TreeChecker.scala:438)
	at dotty.tools.dotc.transform.TreeChecker$Checker.withBlock(TreeChecker.scala:186)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typedBlock(TreeChecker.scala:438)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2013)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2061)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:124)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typedUnadapted(TreeChecker.scala:280)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2099)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2111)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typed(TreeChecker.scala:265)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2187)
	at dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:1544)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typedDefDef$$anonfun$2$$anonfun$1(TreeChecker.scala:411)
	at dotty.tools.dotc.transform.TreeChecker$Checker.withDefinedSyms(TreeChecker.scala:169)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typedDefDef$$anonfun$1(TreeChecker.scala:414)
	at dotty.tools.dotc.transform.TreeChecker$Checker.withDefinedSyms(TreeChecker.scala:169)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typedDefDef(TreeChecker.scala:415)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1993)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2060)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:124)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typedUnadapted(TreeChecker.scala:280)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2099)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2111)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typed(TreeChecker.scala:265)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2130)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2174)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typedStats(TreeChecker.scala:456)
	at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:1673)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typedClassDef(TreeChecker.scala:395)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1996)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2060)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:124)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typedUnadapted(TreeChecker.scala:280)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2099)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2111)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typed(TreeChecker.scala:265)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2130)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2174)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typedStats(TreeChecker.scala:456)
	at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:1797)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2036)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2061)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:124)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typedUnadapted(TreeChecker.scala:280)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2099)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2111)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typed(TreeChecker.scala:265)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2187)
	at dotty.tools.dotc.transform.TreeChecker.check(TreeChecker.scala:122)
	at dotty.tools.dotc.transform.TreeChecker.run(TreeChecker.scala:94)
	at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:316)
	at scala.collection.immutable.List.map(List.scala:286)
	at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:318)
	at dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:158)
	at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.IndexedSeqOptimized.foreach(IndexedSeqOptimized.scala:36)
	at scala.collection.IndexedSeqOptimized.foreach$(IndexedSeqOptimized.scala:33)
	at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:198)
	at dotty.tools.dotc.Run.runPhases$5(Run.scala:170)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:178)
	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:185)
	at dotty.tools.dotc.Run.compileSources(Run.scala:120)
	at dotty.tools.dotc.Run.compile(Run.scala:104)
	at dotty.tools.dotc.Driver.doCompile(Driver.scala:35)
	at dotty.tools.dotc.Driver.process(Driver.scala:180)
	at dotty.tools.dotc.Driver.process(Driver.scala:149)
	at dotty.tools.dotc.Driver.process(Driver.scala:161)
	at dotty.tools.dotc.Driver.main(Driver.scala:188)
	at dotty.tools.dotc.Main.main(Main.scala)
[error] Nonzero exit code returned from runner: 1
[error] (dotty-compiler / Compile / runMain) Nonzero exit code returned from runner: 1
[error] Total time: 11 s, completed Aug 15, 2019 3:48:48 PM
@nicolasstucki
Copy link
Contributor

It is probably the transformation to applied liftables that does not do what it should.

@nicolasstucki
Copy link
Contributor

@anatoliykmetyuk
Copy link
Contributor Author

Nope, same output:

Trace
[info] Compiling 1 Scala source to /Users/anatolii/Projects/dotty/dotty/compiler/target/scala-0.17/classes ...
[info] Done compiling.
[warn] Multiple main classes detected.  Run 'show discoveredMainClasses' to see the list
[info] Packaging /Users/anatolii/Projects/dotty/dotty/compiler/target/scala-0.17/dotty-compiler_0.17-0.18.0-bin-SNAPSHOT-nonbootstrapped.jar ...
[info] Done packaging.
[info] Compiling 1 Scala source to /Users/anatolii/Projects/dotty/dotty/library/../out/bootstrap/dotty-library-bootstrapped/scala-0.18/classes ...
[info] Done compiling.
[info] Packaging /Users/anatolii/Projects/dotty/dotty/library/../out/bootstrap/dotty-library-bootstrapped/scala-0.18/dotty-library_0.18-0.18.0-bin-SNAPSHOT.jar ...
[info] Done packaging.
[info] Running (fork) dotty.tools.dotc.Main -classpath /Users/anatolii/.ivy2/cache/org.scala-lang/scala-library/jars/scala-library-2.12.8.jar:/Users/anatolii/Projects/dotty/dotty/library/../out/bootstrap/dotty-library-bootstrapped/scala-0.18/dotty-library_0.18-0.18.0-bin-SNAPSHOT.jar -Ycheck:all ../pg/Lib.scala
checking ../pg/Lib.scala after phase frontend
checking ../pg/Lib.scala after phase inlinedPositions
checking ../pg/Lib.scala after phase staging
checking ../pg/Lib.scala after phase posttyper
checking ../pg/Lib.scala after phase pickler
checking ../pg/Lib.scala after phase reifyQuotes
exception while typing val tpl: quoted.Expr[1.type] =
  scala.runtime.quoted.Unpickler.unpickleExpr[Int](
    scala.collection.immutable.Nil.::[String](

        "XKGrH5CAACN1HO8G0wAABCOBcQL8AOABhEFTVHMBi0xpYiRwYWNrYWdlF4GBAYc8ZW1wdHk+AYlQb3NpdGlvbnMBtC9Vc2Vycy9hbmF0b2xpaS9Qcm9qZWN0cy9kb3R0eS9kb3R0eS8uLi9wZy9MaWIuc2NhbGGAi5OJPIFvgnWCUDeDhI6HAYIBhoCEhaGA94L/gA=="

    )
  , scala.collection.immutable.Nil).apply(ctx) of class class dotty.tools.dotc.ast.Trees$ValDef # 1759
exception while typing {
  val tpl: quoted.Expr[1.type] =
    scala.runtime.quoted.Unpickler.unpickleExpr[Int](
      scala.collection.immutable.Nil.::[String](

          "XKGrH5CAACN1HO8G0wAABCOBcQL8AOABhEFTVHMBi0xpYiRwYWNrYWdlF4GBAYc8ZW1wdHk+AYlQb3NpdGlvbnMBtC9Vc2Vycy9hbmF0b2xpaS9Qcm9qZWN0cy9kb3R0eS9kb3R0eS8uLi9wZy9MaWIuc2NhbGGAi5OJPIFvgnWCUDeDhI6HAYIBhoCEhaGA94L/gA=="

      )
    , scala.collection.immutable.Nil).apply(ctx)
  scala.runtime.quoted.Unpickler.unpickleExpr[Unit](
    scala.collection.immutable.Nil.::[String](

        "XKGrH5CAAHMsRtGWkAAABBCBcQL8AOABhEFTVHMBi0xpYiRwYWNrYWdlF4GBAYc8ZW1wdHk+AYlQb3NpdGlvbnMBtC9Vc2Vycy9hbmF0b2xpaS9Qcm9qZWN0cy9kb3R0eS9kb3R0eS8uLi9wZy9MaWIuc2NhbGGAipOIAm+CdYJQN4OEjocBiQGOgISFmYD/gv+A"

    )
  , scala.collection.immutable.Nil).apply(ctx)
} of class class dotty.tools.dotc.ast.Trees$Block # 1775
exception while typing def mcrImpl given (ctx: quoted.QuoteContext): quoted.Expr[Any] =
  {
    val tpl: quoted.Expr[1.type] =
      scala.runtime.quoted.Unpickler.unpickleExpr[Int](
        scala.collection.immutable.Nil.::[String](

            "XKGrH5CAACN1HO8G0wAABCOBcQL8AOABhEFTVHMBi0xpYiRwYWNrYWdlF4GBAYc8ZW1wdHk+AYlQb3NpdGlvbnMBtC9Vc2Vycy9hbmF0b2xpaS9Qcm9qZWN0cy9kb3R0eS9kb3R0eS8uLi9wZy9MaWIuc2NhbGGAi5OJPIFvgnWCUDeDhI6HAYIBhoCEhaGA94L/gA=="

        )
      , scala.collection.immutable.Nil).apply(ctx)
    scala.runtime.quoted.Unpickler.unpickleExpr[Unit](
      scala.collection.immutable.Nil.::[String](

          "XKGrH5CAAHMsRtGWkAAABBCBcQL8AOABhEFTVHMBi0xpYiRwYWNrYWdlF4GBAYc8ZW1wdHk+AYlQb3NpdGlvbnMBtC9Vc2Vycy9hbmF0b2xpaS9Qcm9qZWN0cy9kb3R0eS9kb3R0eS8uLi9wZy9MaWIuc2NhbGGAipOIAm+CdYJQN4OEjocBiQGOgISFmYD/gv+A"

      )
    , scala.collection.immutable.Nil).apply(ctx)
  } of class class dotty.tools.dotc.ast.Trees$DefDef # 1776
exception while typing @scala.annotation.internal.SourceFile("../pg/Lib.scala") final module class
  Lib$package$
() extends Object(), _root_.scala.Serializable { this: Lib$package.type =>
  private def writeReplace(): AnyRef =
    new scala.runtime.ModuleSerializationProxy(classOf[Lib$package.type])
  inline def mcr: Any = null.asInstanceOf[Any]
  def mcrImpl given (ctx: quoted.QuoteContext): quoted.Expr[Any] =
    {
      val tpl: quoted.Expr[1.type] =
        scala.runtime.quoted.Unpickler.unpickleExpr[Int](
          scala.collection.immutable.Nil.::[String](

              "XKGrH5CAACN1HO8G0wAABCOBcQL8AOABhEFTVHMBi0xpYiRwYWNrYWdlF4GBAYc8ZW1wdHk+AYlQb3NpdGlvbnMBtC9Vc2Vycy9hbmF0b2xpaS9Qcm9qZWN0cy9kb3R0eS9kb3R0eS8uLi9wZy9MaWIuc2NhbGGAi5OJPIFvgnWCUDeDhI6HAYIBhoCEhaGA94L/gA=="

          )
        , scala.collection.immutable.Nil).apply(ctx)
      scala.runtime.quoted.Unpickler.unpickleExpr[Unit](
        scala.collection.immutable.Nil.::[String](

            "XKGrH5CAAHMsRtGWkAAABBCBcQL8AOABhEFTVHMBi0xpYiRwYWNrYWdlF4GBAYc8ZW1wdHk+AYlQb3NpdGlvbnMBtC9Vc2Vycy9hbmF0b2xpaS9Qcm9qZWN0cy9kb3R0eS9kb3R0eS8uLi9wZy9MaWIuc2NhbGGAipOIAm+CdYJQN4OEjocBiQGOgISFmYD/gv+A"

        )
      , scala.collection.immutable.Nil).apply(ctx)
    }
} of class class dotty.tools.dotc.ast.Trees$TypeDef # 1778
exception while typing package <empty> {
  import scala.quoted._
  final lazy module val Lib$package: Lib$package$ = new Lib$package$()
  @scala.annotation.internal.SourceFile("../pg/Lib.scala") final module class
    Lib$package$
  () extends Object(), _root_.scala.Serializable { this: Lib$package.type =>
    private def writeReplace(): AnyRef =
      new scala.runtime.ModuleSerializationProxy(classOf[Lib$package.type])
    inline def mcr: Any = null.asInstanceOf[Any]
    def mcrImpl given (ctx: quoted.QuoteContext): quoted.Expr[Any] =
      {
        val tpl: quoted.Expr[1.type] =
          scala.runtime.quoted.Unpickler.unpickleExpr[Int](
            scala.collection.immutable.Nil.::[String](

                "XKGrH5CAACN1HO8G0wAABCOBcQL8AOABhEFTVHMBi0xpYiRwYWNrYWdlF4GBAYc8ZW1wdHk+AYlQb3NpdGlvbnMBtC9Vc2Vycy9hbmF0b2xpaS9Qcm9qZWN0cy9kb3R0eS9kb3R0eS8uLi9wZy9MaWIuc2NhbGGAi5OJPIFvgnWCUDeDhI6HAYIBhoCEhaGA94L/gA=="

            )
          , scala.collection.immutable.Nil).apply(ctx)
        scala.runtime.quoted.Unpickler.unpickleExpr[Unit](
          scala.collection.immutable.Nil.::[String](

              "XKGrH5CAAHMsRtGWkAAABBCBcQL8AOABhEFTVHMBi0xpYiRwYWNrYWdlF4GBAYc8ZW1wdHk+AYlQb3NpdGlvbnMBtC9Vc2Vycy9hbmF0b2xpaS9Qcm9qZWN0cy9kb3R0eS9kb3R0eS8uLi9wZy9MaWIuc2NhbGGAipOIAm+CdYJQN4OEjocBiQGOgISFmYD/gv+A"

          )
        , scala.collection.immutable.Nil).apply(ctx)
      }
  }
} of class class dotty.tools.dotc.ast.Trees$PackageDef # 1779
*** error while checking ../pg/Lib.scala after phase reifyQuoexception occurred while compiling ../pg/Lib.scala
Exception in thread "main" tes ***
java.lang.AssertionError: assertion failed: Found:    quoted.Expr[Int]
Required: quoted.Expr[Int(1)]
tree = scala.runtime.quoted.Unpickler.unpickleExpr[Int](
  scala.collection.immutable.Nil.::[String](

      "XKGrH5CAACN1HO8G0wAABCOBcQL8AOABhEFTVHMBi0xpYiRwYWNrYWdlF4GBAYc8ZW1wdHk+AYlQb3NpdGlvbnMBtC9Vc2Vycy9hbmF0b2xpaS9Qcm9qZWN0cy9kb3R0eS9kb3R0eS8uLi9wZy9MaWIuc2NhbGGAi5OJPIFvgnWCUDeDhI6HAYIBhoCEhaGA94L/gA=="

  )
, scala.collection.immutable.Nil).apply(ctx) while compiling ../pg/Lib.scala
java.lang.AssertionError: assertion failed: Found:    quoted.Expr[Int]
Required: quoted.Expr[Int(1)]
tree = scala.runtime.quoted.Unpickler.unpickleExpr[Int](
  scala.collection.immutable.Nil.::[String](

      "XKGrH5CAACN1HO8G0wAABCOBcQL8AOABhEFTVHMBi0xpYiRwYWNrYWdlF4GBAYc8ZW1wdHk+AYlQb3NpdGlvbnMBtC9Vc2Vycy9hbmF0b2xpaS9Qcm9qZWN0cy9kb3R0eS9kb3R0eS8uLi9wZy9MaWIuc2NhbGGAi5OJPIFvgnWCUDeDhI6HAYIBhoCEhaGA94L/gA=="

  )
, scala.collection.immutable.Nil).apply(ctx)
	at dotty.DottyPredef$.assertFail(DottyPredef.scala:16)
	at dotty.tools.dotc.transform.TreeChecker$Checker.adapt(TreeChecker.scala:488)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2099)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2111)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typed(TreeChecker.scala:265)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2187)
	at dotty.tools.dotc.typer.Typer.typedValDef(Typer.scala:1478)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1990)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2060)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:124)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typedUnadapted(TreeChecker.scala:280)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2099)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2111)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typed(TreeChecker.scala:265)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2130)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2174)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typedStats(TreeChecker.scala:456)
	at dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:705)
	at dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:708)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typedBlock$$anonfun$2$$anonfun$1(TreeChecker.scala:438)
	at dotty.tools.dotc.transform.TreeChecker$Checker.withDefinedSyms(TreeChecker.scala:169)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typedBlock$$anonfun$1(TreeChecker.scala:438)
	at dotty.tools.dotc.transform.TreeChecker$Checker.withBlock(TreeChecker.scala:186)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typedBlock(TreeChecker.scala:438)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2013)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2061)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:124)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typedUnadapted(TreeChecker.scala:280)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2099)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2111)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typed(TreeChecker.scala:265)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2187)
	at dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:1544)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typedDefDef$$anonfun$2$$anonfun$1(TreeChecker.scala:411)
	at dotty.tools.dotc.transform.TreeChecker$Checker.withDefinedSyms(TreeChecker.scala:169)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typedDefDef$$anonfun$1(TreeChecker.scala:414)
	at dotty.tools.dotc.transform.TreeChecker$Checker.withDefinedSyms(TreeChecker.scala:169)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typedDefDef(TreeChecker.scala:415)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1993)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2060)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:124)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typedUnadapted(TreeChecker.scala:280)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2099)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2111)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typed(TreeChecker.scala:265)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2130)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2174)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typedStats(TreeChecker.scala:456)
	at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:1673)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typedClassDef(TreeChecker.scala:395)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1996)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2060)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:124)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typedUnadapted(TreeChecker.scala:280)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2099)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2111)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typed(TreeChecker.scala:265)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2130)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2174)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typedStats(TreeChecker.scala:456)
	at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:1797)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2036)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2061)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:124)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typedUnadapted(TreeChecker.scala:280)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2099)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2111)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typed(TreeChecker.scala:265)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2187)
	at dotty.tools.dotc.transform.TreeChecker.check(TreeChecker.scala:122)
	at dotty.tools.dotc.transform.TreeChecker.run(TreeChecker.scala:94)
	at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:316)
	at scala.collection.immutable.List.map(List.scala:286)
	at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:318)
	at dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:158)
	at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.IndexedSeqOptimized.foreach(IndexedSeqOptimized.scala:36)
	at scala.collection.IndexedSeqOptimized.foreach$(IndexedSeqOptimized.scala:33)
	at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:198)
	at dotty.tools.dotc.Run.runPhases$5(Run.scala:170)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:178)
	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:185)
	at dotty.tools.dotc.Run.compileSources(Run.scala:120)
	at dotty.tools.dotc.Run.compile(Run.scala:104)
	at dotty.tools.dotc.Driver.doCompile(Driver.scala:35)
	at dotty.tools.dotc.Driver.process(Driver.scala:180)
	at dotty.tools.dotc.Driver.process(Driver.scala:149)
	at dotty.tools.dotc.Driver.process(Driver.scala:161)
	at dotty.tools.dotc.Driver.main(Driver.scala:188)
	at dotty.tools.dotc.Main.main(Main.scala)
[error] Nonzero exit code returned from runner: 1
[error] (dotty-compiler / Compile / runMain) Nonzero exit code returned from runner: 1
[error] Total time: 30 s, completed Aug 15, 2019 3:57:32 PM
sbt:dotty>

@nicolasstucki
Copy link
Contributor

Right. We widen the type in that case as well.

https://github.com/lampepfl/dotty/blob/0f4d3b28c16377e08564b05fdaf5248674ae67c3/compiler/src/dotty/tools/dotc/transform/ReifyQuotes.scala#L233

anatoliykmetyuk added a commit to dotty-staging/dotty that referenced this issue Aug 16, 2019
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Aug 19, 2019
liufengyun added a commit that referenced this issue Aug 19, 2019
Fix #7046: Support lifting for literal constant types
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