Skip to content

crash when trying to splice constructed quotes.reflect.Lambda into inline environment #13557

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
rssh opened this issue Sep 18, 2021 · 1 comment · Fixed by #13733
Closed

crash when trying to splice constructed quotes.reflect.Lambda into inline environment #13557

rssh opened this issue Sep 18, 2021 · 1 comment · Fixed by #13733

Comments

@rssh
Copy link
Contributor

rssh commented Sep 18, 2021

Compiler version

3.1.0-RC2

Minimized code

file: M.scala

package x

import scala.quoted.*

def fun(x:Int): Int = ???

transparent inline def in1[T](inline expr: Int => Int): Int => Int =
     ${
        M.transformLambdaImpl('expr)
     }

object M:

  def transformLambdaImpl(cexpr: Expr[Int => Int])(using Quotes): Expr[Int => Int] =
      import quotes.reflect.*

      def extractLambda(f:Term): (ValDef, Term, Term => Term ) =
         f match
            case Inlined(call, bindings, body) =>
               val inner = extractLambda(body)
               (inner._1, inner._2, t => Inlined(call, bindings, t) )
            case Lambda(params,body) =>
               params match
                  case List(vd) => (vd, body, identity)
                  case _ => report.throwError(s"lambda with one argument expected, we have ${params}",cexpr)
            case Block(Nil,nested@Lambda(params,body)) => extractLambda(nested)
            case _ =>
               report.throwError(s"lambda expected, have: ${f}", cexpr)

      val (oldValDef, body, inlineBack) = extractLambda(cexpr.asTerm)
      val mt = MethodType(List(oldValDef.name))( _ => List(oldValDef.tpt.tpe), _ => TypeRepr.of[Int])
      val nLambda = Lambda(Symbol.spliceOwner, mt, (owner, params) => {
            val argTransformer = new TreeMap() {
                 override def transformTerm(tree: Term)(owner: Symbol): Term =
                    tree match
                       case Ident(name) if (tree.symbol == oldValDef.symbol) =>  Ref(params.head.symbol)
                       case _ => super.transformTerm(tree)(owner)
            }
            argTransformer.transformTerm('{ fun(${body.asExprOf[Int]}) }.asTerm )(owner)
      })
      inlineBack(nLambda).asExprOf[Int => Int]

file: X.scala

package x

object Main:

   def testSimpleContext(): Unit =
     var x = 0
     val c = in1{ scope =>
       1
     }

Output (click arrow to expand)

[info] welcome to sbt 1.5.5 (Homebrew Java 16.0.2)
[info] loading global plugins from /Users/rssh/.sbt/1.0/plugins
[info] loading project definition from /Users/rssh/tests/dotty/crash-context/project
[info] loading settings for project root from build.sbt ...
[info] set current project to test (in build file:/Users/rssh/tests/dotty/crash-context/)
[info] Executing in batch mode. For better performance use sbt's shell
[success] Total time: 0 s, completed 18 Sept 2021, 13:12:27
[info] compiling 2 Scala sources to /Users/rssh/tests/dotty/crash-context/target/scala-3.1.0-RC2/classes ...
[info] exception occurred while typechecking /Users/rssh/tests/dotty/crash-context/src/main/scala/x/X.scala
java.lang.AssertionError: assertion failed: position not set for <
  {
    def $anonfun(scope: Int): Int = 
      <
        <<x.fun:((x: Int): Int)>(
          <
            <
              {
                <1:(1 : Int)>
              }
            :(1 : Int)>
          :(1 : Int)>
        ):Int>
      :Int>
    <closure(<$anonfun:(scope: Int): Int>):Int => Int>
  }
:Int => Int> # -1 of class dotty.tools.dotc.ast.Trees$Block in /Users/rssh/tests/dotty/crash-context/src/main/scala/x/X.scala while compiling /Users/rssh/tests/dotty/crash-context/src/main/scala/x/M.scala, /Users/rssh/tests/dotty/crash-context/src/main/scala/x/X.scala
[error] ## Exception when compiling 2 sources to /Users/rssh/tests/dotty/crash-context/target/scala-3.1.0-RC2/classes
[error] java.lang.AssertionError: assertion failed: position not set for <
[error]   {
[error]     def $anonfun(scope: Int): Int = 
[error]       <
[error]         <<x.fun:((x: Int): Int)>(
[error]           <
[error]             <
[error]               {
[error]                 <1:(1 : Int)>
[error]               }
[error]             :(1 : Int)>
[error]           :(1 : Int)>
[error]         ):Int>
[error]       :Int>
[error]     <closure(<$anonfun:(scope: Int): Int>):Int => Int>
[error]   }
[error] :Int => Int> # -1 of class dotty.tools.dotc.ast.Trees$Block in /Users/rssh/tests/dotty/crash-context/src/main/scala/x/X.scala
[error] scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
[error] dotty.tools.dotc.typer.Typer$.assertPositioned(Typer.scala:68)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2878)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2887)
[error] dotty.tools.dotc.typer.Typer.typedInlined(Typer.scala:1793)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2777)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2818)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:121)
[error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1634)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2883)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2880)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2887)
[error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3003)
[error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedApply(Inliner.scala:1552)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2755)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2818)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:121)
[error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1634)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2883)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2880)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2887)
[error] dotty.tools.dotc.typer.Inliner.inlined(Inliner.scala:1019)
[error] dotty.tools.dotc.typer.Inliner$.inlineCall(Inliner.scala:155)
[error] dotty.tools.dotc.typer.Typer.adaptNoArgsOther$4(Typer.scala:3565)
[error] dotty.tools.dotc.typer.Typer.adaptNoArgs$1(Typer.scala:3682)
[error] dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:3873)
[error] dotty.tools.dotc.typer.Typer.adapt(Typer.scala:3224)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2883)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2887)
[error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3003)
[error] dotty.tools.dotc.typer.Namer.typedAheadExpr$$anonfun$1(Namer.scala:1429)
[error] dotty.tools.dotc.typer.Namer.typedAhead(Namer.scala:1419)
[error] dotty.tools.dotc.typer.Namer.typedAheadExpr(Namer.scala:1429)
[error] dotty.tools.dotc.typer.Namer.typedAheadRhs$1$$anonfun$1(Namer.scala:1681)
[error] dotty.tools.dotc.typer.PrepareInlineable$.dropInlineIfError(PrepareInlineable.scala:225)
[error] dotty.tools.dotc.typer.Namer.typedAheadRhs$2(Namer.scala:1681)
[error] dotty.tools.dotc.typer.Namer.rhsType$1(Namer.scala:1689)
[error] dotty.tools.dotc.typer.Namer.cookedRhsType$1(Namer.scala:1716)
[error] dotty.tools.dotc.typer.Namer.lhsType$1(Namer.scala:1717)
[error] dotty.tools.dotc.typer.Namer.inferredResultType(Namer.scala:1728)
[error] dotty.tools.dotc.typer.Namer.inferredType$1(Namer.scala:1468)
[error] dotty.tools.dotc.typer.Namer.valOrDefDefSig(Namer.scala:1475)
[error] dotty.tools.dotc.typer.Namer$Completer.typeSig(Namer.scala:751)
[error] dotty.tools.dotc.typer.Namer$Completer.completeInCreationContext(Namer.scala:887)
[error] dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:779)
[error] dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:167)
[error] dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:188)
[error] dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:190)
[error] dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:369)
[error] dotty.tools.dotc.typer.Typer.retrieveSym(Typer.scala:2697)
[error] dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2722)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2817)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2883)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2887)
[error] dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2909)
[error] dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2959)
[error] dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:1027)
[error] dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:1031)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2763)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2818)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2883)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2887)
[error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3003)
[error] dotty.tools.dotc.typer.Typer.$anonfun$39(Typer.scala:2211)
[error] dotty.tools.dotc.typer.PrepareInlineable$.dropInlineIfError(PrepareInlineable.scala:225)
[error] dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:2211)
[error] dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2732)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2817)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2883)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2887)
[error] dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2909)
[error] dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2959)
[error] dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:2409)
[error] dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$2(Typer.scala:2743)
[error] dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2747)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2817)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2883)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2887)
[error] dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2909)
[error] dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2959)
[error] dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:2532)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2788)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2818)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2883)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2887)
[error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3003)
[error] dotty.tools.dotc.typer.TyperPhase.liftedTree1$1(TyperPhase.scala:56)
[error] dotty.tools.dotc.typer.TyperPhase.typeCheck$$anonfun$1(TyperPhase.scala:62)
[error] dotty.tools.dotc.core.Phases$Phase.monitor(Phases.scala:411)
[error] dotty.tools.dotc.typer.TyperPhase.typeCheck(TyperPhase.scala:63)
[error] dotty.tools.dotc.typer.TyperPhase.runOn$$anonfun$1(TyperPhase.scala:105)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
[error] scala.collection.immutable.List.foreach(List.scala:333)
[error] dotty.tools.dotc.typer.TyperPhase.runOn(TyperPhase.scala:105)
[error] dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:261)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
[error] scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
[error] dotty.tools.dotc.Run.runPhases$5(Run.scala:272)
[error] dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:280)
[error] scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
[error] dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:68)
[error] dotty.tools.dotc.Run.compileUnits(Run.scala:289)
[error] dotty.tools.dotc.Run.compileUnits(Run.scala:228)
[error] dotty.tools.dotc.Driver.finish(Driver.scala:60)
[error] dotty.tools.dotc.Driver.doCompile(Driver.scala:40)
[error] dotty.tools.xsbt.CompilerBridgeDriver.run(CompilerBridgeDriver.java:88)
[error] dotty.tools.xsbt.CompilerBridge.run(CompilerBridge.java:22)
[error] sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:91)
[error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$7(MixedAnalyzingCompiler.scala:192)
[error] scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
[error] sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:247)
[error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4(MixedAnalyzingCompiler.scala:182)
[error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4$adapted(MixedAnalyzingCompiler.scala:163)
[error] sbt.internal.inc.JarUtils$.withPreviousJar(JarUtils.scala:239)
[error] sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:163)
[error] sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:210)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:528)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:528)
[error] sbt.internal.inc.Incremental$.$anonfun$apply$5(Incremental.scala:175)
[error] sbt.internal.inc.Incremental$.$anonfun$apply$5$adapted(Incremental.scala:173)
[error] sbt.internal.inc.Incremental$$anon$2.run(Incremental.scala:459)
[error] sbt.internal.inc.IncrementalCommon$CycleState.next(IncrementalCommon.scala:116)
[error] sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:56)
[error] sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:52)
[error] sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:263)
[error] sbt.internal.inc.Incremental$.$anonfun$incrementalCompile$8(Incremental.scala:414)
[error] sbt.internal.inc.Incremental$.withClassfileManager(Incremental.scala:501)
[error] sbt.internal.inc.Incremental$.incrementalCompile(Incremental.scala:401)
[error] sbt.internal.inc.Incremental$.apply(Incremental.scala:167)
[error] sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:528)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:482)
[error] sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:332)
[error] sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:420)
[error] sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:137)
[error] sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:2357)
[error] sbt.Defaults$.$anonfun$compileIncrementalTask$2(Defaults.scala:2314)
[error] sbt.internal.io.Retry$.apply(Retry.scala:46)
[error] sbt.internal.io.Retry$.apply(Retry.scala:28)
[error] sbt.internal.io.Retry$.apply(Retry.scala:23)
[error] sbt.internal.server.BspCompileTask$.compute(BspCompileTask.scala:31)
[error] sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:2310)
[error] scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error] sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
[error] sbt.std.Transform$$anon$4.work(Transform.scala:68)
[error] sbt.Execute.$anonfun$submit$2(Execute.scala:282)
[error] sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23)
[error] sbt.Execute.work(Execute.scala:291)
[error] sbt.Execute.$anonfun$submit$1(Execute.scala:282)
[error] sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error] sbt.CompletionService$$anon$2.call(CompletionService.scala:64)
[error] java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error] java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
[error] java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error] java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
[error] java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
[error] java.base/java.lang.Thread.run(Thread.java:831)
[error]            
[error] java.lang.AssertionError: assertion failed: position not set for <
[error]   {
[error]     def $anonfun(scope: Int): Int = 
[error]       <
[error]         <<x.fun:((x: Int): Int)>(
[error]           <
[error]             <
[error]               {
[error]                 <1:(1 : Int)>
[error]               }
[error]             :(1 : Int)>
[error]           :(1 : Int)>
[error]         ):Int>
[error]       :Int>
[error]     <closure(<$anonfun:(scope: Int): Int>):Int => Int>
[error]   }
[error] :Int => Int> # -1 of class dotty.tools.dotc.ast.Trees$Block in /Users/rssh/tests/dotty/crash-context/src/main/scala/x/X.scala
[error] 	at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
[error] 	at dotty.tools.dotc.typer.Typer$.assertPositioned(Typer.scala:68)
[error] 	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2878)
[error] 	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2887)
[error] 	at dotty.tools.dotc.typer.Typer.typedInlined(Typer.scala:1793)
[error] 	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2777)
[error] 	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2818)
[error] 	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:121)
[error] 	at dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1634)
[error] 	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2883)
[error] 	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2880)
[error] 	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2887)
[error] 	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3003)
[error] 	at dotty.tools.dotc.typer.Inliner$InlineTyper.typedApply(Inliner.scala:1552)
[error] 	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2755)
[error] 	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2818)
[error] 	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:121)
[error] 	at dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1634)
[error] 	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2883)
[error] 	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2880)
[error] 	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2887)
[error] 	at dotty.tools.dotc.typer.Inliner.inlined(Inliner.scala:1019)
[error] 	at dotty.tools.dotc.typer.Inliner$.inlineCall(Inliner.scala:155)
[error] 	at dotty.tools.dotc.typer.Typer.adaptNoArgsOther$4(Typer.scala:3565)
[error] 	at dotty.tools.dotc.typer.Typer.adaptNoArgs$1(Typer.scala:3682)
[error] 	at dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:3873)
[error] 	at dotty.tools.dotc.typer.Typer.adapt(Typer.scala:3224)
[error] 	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2883)
[error] 	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2887)
[error] 	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3003)
[error] 	at dotty.tools.dotc.typer.Namer.typedAheadExpr$$anonfun$1(Namer.scala:1429)
[error] 	at dotty.tools.dotc.typer.Namer.typedAhead(Namer.scala:1419)
[error] 	at dotty.tools.dotc.typer.Namer.typedAheadExpr(Namer.scala:1429)
[error] 	at dotty.tools.dotc.typer.Namer.typedAheadRhs$1$$anonfun$1(Namer.scala:1681)
[error] 	at dotty.tools.dotc.typer.PrepareInlineable$.dropInlineIfError(PrepareInlineable.scala:225)
[error] 	at dotty.tools.dotc.typer.Namer.typedAheadRhs$2(Namer.scala:1681)
[error] 	at dotty.tools.dotc.typer.Namer.rhsType$1(Namer.scala:1689)
[error] 	at dotty.tools.dotc.typer.Namer.cookedRhsType$1(Namer.scala:1716)
[error] 	at dotty.tools.dotc.typer.Namer.lhsType$1(Namer.scala:1717)
[error] 	at dotty.tools.dotc.typer.Namer.inferredResultType(Namer.scala:1728)
[error] 	at dotty.tools.dotc.typer.Namer.inferredType$1(Namer.scala:1468)
[error] 	at dotty.tools.dotc.typer.Namer.valOrDefDefSig(Namer.scala:1475)
[error] 	at dotty.tools.dotc.typer.Namer$Completer.typeSig(Namer.scala:751)
[error] 	at dotty.tools.dotc.typer.Namer$Completer.completeInCreationContext(Namer.scala:887)
[error] 	at dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:779)
[error] 	at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:167)
[error] 	at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:188)
[error] 	at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:190)
[error] 	at dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:369)
[error] 	at dotty.tools.dotc.typer.Typer.retrieveSym(Typer.scala:2697)
[error] 	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2722)
[error] 	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2817)
[error] 	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2883)
[error] 	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2887)
[error] 	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2909)
[error] 	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2959)
[error] 	at dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:1027)
[error] 	at dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:1031)
[error] 	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2763)
[error] 	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2818)
[error] 	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2883)
[error] 	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2887)
[error] 	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3003)
[error] 	at dotty.tools.dotc.typer.Typer.$anonfun$39(Typer.scala:2211)
[error] 	at dotty.tools.dotc.typer.PrepareInlineable$.dropInlineIfError(PrepareInlineable.scala:225)
[error] 	at dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:2211)
[error] 	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2732)
[error] 	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2817)
[error] 	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2883)
[error] 	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2887)
[error] 	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2909)
[error] 	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2959)
[error] 	at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:2409)
[error] 	at dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$2(Typer.scala:2743)
[error] 	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2747)
[error] 	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2817)
[error] 	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2883)
[error] 	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2887)
[error] 	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2909)
[error] 	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2959)
[error] 	at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:2532)
[error] 	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2788)
[error] 	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2818)
[error] 	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2883)
[error] 	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2887)
[error] 	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3003)
[error] 	at dotty.tools.dotc.typer.TyperPhase.liftedTree1$1(TyperPhase.scala:56)
[error] 	at dotty.tools.dotc.typer.TyperPhase.typeCheck$$anonfun$1(TyperPhase.scala:62)
[error] 	at dotty.tools.dotc.core.Phases$Phase.monitor(Phases.scala:411)
[error] 	at dotty.tools.dotc.typer.TyperPhase.typeCheck(TyperPhase.scala:63)
[error] 	at dotty.tools.dotc.typer.TyperPhase.runOn$$anonfun$1(TyperPhase.scala:105)
[error] 	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
[error] 	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
[error] 	at scala.collection.immutable.List.foreach(List.scala:333)
[error] 	at dotty.tools.dotc.typer.TyperPhase.runOn(TyperPhase.scala:105)
[error] 	at dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:261)
[error] 	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
[error] 	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
[error] 	at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
[error] 	at dotty.tools.dotc.Run.runPhases$5(Run.scala:272)
[error] 	at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:280)
[error] 	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
[error] 	at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:68)
[error] 	at dotty.tools.dotc.Run.compileUnits(Run.scala:289)
[error] 	at dotty.tools.dotc.Run.compileUnits(Run.scala:228)
[error] 	at dotty.tools.dotc.Driver.finish(Driver.scala:60)
[error] 	at dotty.tools.dotc.Driver.doCompile(Driver.scala:40)
[error] 	at dotty.tools.xsbt.CompilerBridgeDriver.run(CompilerBridgeDriver.java:88)
[error] 	at dotty.tools.xsbt.CompilerBridge.run(CompilerBridge.java:22)
[error] 	at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:91)
[error] 	at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$7(MixedAnalyzingCompiler.scala:192)
[error] 	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
[error] 	at sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:247)
[error] 	at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4(MixedAnalyzingCompiler.scala:182)
[error] 	at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4$adapted(MixedAnalyzingCompiler.scala:163)
[error] 	at sbt.internal.inc.JarUtils$.withPreviousJar(JarUtils.scala:239)
[error] 	at sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:163)
[error] 	at sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:210)
[error] 	at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:528)
[error] 	at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:528)
[error] 	at sbt.internal.inc.Incremental$.$anonfun$apply$5(Incremental.scala:175)
[error] 	at sbt.internal.inc.Incremental$.$anonfun$apply$5$adapted(Incremental.scala:173)
[error] 	at sbt.internal.inc.Incremental$$anon$2.run(Incremental.scala:459)
[error] 	at sbt.internal.inc.IncrementalCommon$CycleState.next(IncrementalCommon.scala:116)
[error] 	at sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:56)
[error] 	at sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:52)
[error] 	at sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:263)
[error] 	at sbt.internal.inc.Incremental$.$anonfun$incrementalCompile$8(Incremental.scala:414)
[error] 	at sbt.internal.inc.Incremental$.withClassfileManager(Incremental.scala:501)
[error] 	at sbt.internal.inc.Incremental$.incrementalCompile(Incremental.scala:401)
[error] 	at sbt.internal.inc.Incremental$.apply(Incremental.scala:167)
[error] 	at sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:528)
[error] 	at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:482)
[error] 	at sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:332)
[error] 	at sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:420)
[error] 	at sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:137)
[error] 	at sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:2357)
[error] 	at sbt.Defaults$.$anonfun$compileIncrementalTask$2(Defaults.scala:2314)
[error] 	at sbt.internal.io.Retry$.apply(Retry.scala:46)
[error] 	at sbt.internal.io.Retry$.apply(Retry.scala:28)
[error] 	at sbt.internal.io.Retry$.apply(Retry.scala:23)
[error] 	at sbt.internal.server.BspCompileTask$.compute(BspCompileTask.scala:31)
[error] 	at sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:2310)
[error] 	at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error] 	at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
[error] 	at sbt.std.Transform$$anon$4.work(Transform.scala:68)
[error] 	at sbt.Execute.$anonfun$submit$2(Execute.scala:282)
[error] 	at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23)
[error] 	at sbt.Execute.work(Execute.scala:291)
[error] 	at sbt.Execute.$anonfun$submit$1(Execute.scala:282)
[error] 	at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error] 	at sbt.CompletionService$$anon$2.call(CompletionService.scala:64)
[error] 	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error] 	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
[error] 	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error] 	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
[error] 	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
[error] 	at java.base/java.lang.Thread.run(Thread.java:831)
[error] (Compile / compileIncremental) java.lang.AssertionError: assertion failed: position not set for <
[error]   {
[error]     def $anonfun(scope: Int): Int = 
[error]       <
[error]         <<x.fun:((x: Int): Int)>(
[error]           <
[error]             <
[error]               {
[error]                 <1:(1 : Int)>
[error]               }
[error]             :(1 : Int)>
[error]           :(1 : Int)>
[error]         ):Int>
[error]       :Int>
[error]     <closure(<$anonfun:(scope: Int): Int>):Int => Int>
[error]   }
[error] :Int => Int> # -1 of class dotty.tools.dotc.ast.Trees$Block in /Users/rssh/tests/dotty/crash-context/src/main/scala/x/X.scala
@rssh
Copy link
Contributor Author

rssh commented Sep 18, 2021

crash-context.tar.gz

ready to run sbt project.

@bishabosha bishabosha changed the title crash when trying to put tasty constructed lambda call into inline environment crash when trying to splice constructed quotes.Lambda into inline environment Sep 19, 2021
@bishabosha bishabosha changed the title crash when trying to splice constructed quotes.Lambda into inline environment crash when trying to splice constructed quotes.reflect.Lambda into inline environment Sep 19, 2021
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Oct 12, 2021
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Oct 12, 2021
danicheg pushed a commit to danicheg/dotty that referenced this issue Oct 21, 2021
olsdavis pushed a commit to olsdavis/dotty that referenced this issue Apr 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants