Skip to content

assertion failed: position not set #8892

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
flomebul opened this issue May 6, 2020 · 0 comments
Closed

assertion failed: position not set #8892

flomebul opened this issue May 6, 2020 · 0 comments

Comments

@flomebul
Copy link
Contributor

flomebul commented May 6, 2020

Minimized code

object ABug {
  sealed trait Nat {
    inline def ++ : Succ[this.type] = Succ(this)

    transparent inline def +(inline that: Nat): Nat =
      inline this match {
        case Zero    => that
        case Succ(p) => p + that.++
    }
  }

  case object Zero extends Nat
  case class Succ[N <: Nat](p: N) extends Nat

  transparent inline def toIntg(inline n: Nat): Int =
    inline n match {
      case Zero    => 0
      case Succ(p) => toIntg(p) + 1
    }

  val j31 = toIntg(Zero.++.++.++ + Zero.++)
}

Output (click arrow to expand)

Command line to compile ``` /cygdrive/c/scala/dotty-0.24/bin/dotc -classpath ../../bin -extdirs ../../lib -indent -new-syntax -migration -d C:/cygwin64/tmp/tmp.LkNnaL4AKp -deprecation -feature -unchecked -Xfatal-warnings -Yexplicit-nulls -explain -explain-types ../../tst/metb/ABug.scala ```

Output of the compilation

exception occurred while typechecking ..\..\tst\metb\ABug.scala
exception occurred while compiling ..\..\tst\metb\ABug.scala
java.lang.AssertionError: assertion failed: position not set for ABug.Succ.apply[(Nat_this : ABug.Zero.type)](Nat_this):ABug.Succ[Nat_this.type] # 2239 of class dotty.tools.dotc.ast.Trees$Typed in ..\..\tst\metb\ABug.scala while compiling ../../tst/metb/ABug.scala
Exception in thread "main" java.lang.AssertionError: assertion failed: position not set for ABug.Succ.apply[(Nat_this : ABug.Zero.type)](Nat_this):ABug.Succ[Nat_this.type] # 2239 of class dotty.tools.dotc.ast.Trees$Typed in ..\..\tst\metb\ABug.scala
	at dotty.DottyPredef$.assertFail(DottyPredef.scala:17)
	at dotty.tools.dotc.typer.Typer$.assertPositioned(Typer.scala:62)
	at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2437)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2452)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2455)
	at dotty.tools.dotc.typer.Typer.typedInlined(Typer.scala:1524)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2366)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2404)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:124)
	at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2443)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2452)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2455)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2566)
	at dotty.tools.dotc.typer.Typer.typedValDef(Typer.scala:1802)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2319)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2403)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:124)
	at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2443)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2452)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2455)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2477)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2522)
	at dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:849)
	at dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:853)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2353)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2404)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:124)
	at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2443)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2452)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2455)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2566)
	at dotty.tools.dotc.typer.Typer.typedValDef(Typer.scala:1802)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2319)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2403)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:124)
	at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2443)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2452)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2455)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2477)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2522)
	at dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:849)
	at dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:853)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2353)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2404)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:124)
	at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2443)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2452)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2455)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2566)
	at dotty.tools.dotc.typer.Inliner$InlineTyper.typedMatchFinish(Inliner.scala:1289)
	at dotty.tools.dotc.typer.Typer.typedMatch(Typer.scala:1284)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2358)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2404)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:124)
	at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2443)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2452)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2455)
	at dotty.tools.dotc.typer.Inliner.op$1(Inliner.scala:753)
	at dotty.tools.dotc.typer.Inliner.inlined(Inliner.scala:772)
	at dotty.tools.dotc.typer.Inliner$.inlineCall(Inliner.scala:115)
	at dotty.tools.dotc.typer.Typer.adaptNoArgsOther$4(Typer.scala:3084)
	at dotty.tools.dotc.typer.Typer.adaptNoArgs$1(Typer.scala:3181)
	at dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:3389)
	at dotty.tools.dotc.typer.Typer.op$3(Typer.scala:2777)
	at dotty.tools.dotc.typer.Typer.adapt(Typer.scala:2778)
	at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2443)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2452)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2455)
	at dotty.tools.dotc.typer.Namer.typedAheadExpr$$anonfun$1(Namer.scala:1329)
	at dotty.tools.dotc.typer.Namer.typedAhead(Namer.scala:1319)
	at dotty.tools.dotc.typer.Namer.typedAheadExpr(Namer.scala:1329)
	at dotty.tools.dotc.typer.Namer.rhsType$2(Namer.scala:1463)
	at dotty.tools.dotc.typer.Namer.cookedRhsType$1(Namer.scala:1474)
	at dotty.tools.dotc.typer.Namer.lhsType$1(Namer.scala:1475)
	at dotty.tools.dotc.typer.Namer.inferredType$1(Namer.scala:1486)
	at dotty.tools.dotc.typer.Namer.valOrDefDefSig(Namer.scala:1494)
	at dotty.tools.dotc.typer.Namer$Completer.typeSig(Namer.scala:809)
	at dotty.tools.dotc.typer.Namer$Completer.completeInCreationContext(Namer.scala:930)
	at dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:841)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:259)
	at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:186)
	at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:188)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:446)
	at dotty.tools.dotc.typer.Typer.retrieveSym(Typer.scala:2287)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2312)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2403)
	at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2443)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2452)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2455)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2477)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2522)
	at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:2003)
	at dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$2(Typer.scala:2333)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2337)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2403)
	at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2443)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2452)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2455)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2477)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2522)
	at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:2129)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2376)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2404)
	at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2443)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2452)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2455)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2566)
	at dotty.tools.dotc.typer.FrontEnd.liftedTree1$1(FrontEnd.scala:79)
	at dotty.tools.dotc.typer.FrontEnd.typeCheck$$anonfun$1(FrontEnd.scala:84)
	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:85)
	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:333)
	at dotty.tools.dotc.typer.FrontEnd.runOn(FrontEnd.scala:114)
	at dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:165)
	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:175)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:183)
	at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
	at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:64)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:190)
	at dotty.tools.dotc.Run.compileSources(Run.scala:127)
	at dotty.tools.dotc.Run.compile(Run.scala:110)
	at dotty.tools.dotc.Driver.doCompile(Driver.scala:38)
	at dotty.tools.dotc.Driver.process(Driver.scala:194)
	at dotty.tools.dotc.Driver.process(Driver.scala:163)
	at dotty.tools.dotc.Driver.process(Driver.scala:175)
	at dotty.tools.dotc.Driver.main(Driver.scala:202)
	at dotty.tools.dotc.Main.main(Main.scala)
odersky added a commit to dotty-staging/dotty that referenced this issue May 8, 2020
nicolasstucki added a commit that referenced this issue May 9, 2020
Fix #8892: Fix position adjustments in Inliner
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