Closed
Description
Fail to compile from TASTY
object Test {
def bar(inline n: Int) = n
}
Can be reproduced with
dotc <source>
dotc -decompile -Ycheck:all Test
checking ./Test.class after phase frontend
exception while typing inline n: Int of class class dotty.tools.dotc.ast.Trees$ValDef # 33
exception while typing def bar(inline n: Int): Int = n of class class dotty.tools.dotc.ast.Trees$DefDef # 39
exception while typing @scala.annotation.internal.SourceFile("tests/pos/i1570.scala") final module
class
Test () extends Object() { this: Test.type =>
def bar(inline n: Int): Int = n
} of class class dotty.tools.dotc.ast.Trees$TypeDef # 20
exception while typing package <empty> {
final lazy module val Test: Test = new Test()
@scala.annotation.internal.SourceFile("tests/pos/i1570.scala") final module
class
Test () extends Object() { this: Test.type =>
def bar(inline n: Int): Int = n
}
} of class class dotty.tools.dotc.ast.Trees$PackageDef # 27
*** error while checking ./Test.class after phase frontend ***
Exception in thread "main" class dotty.tools.dotc.reporting.diagnostic.messages$Error at ?: right-hand side of inline value n must be a constant expression or a function
at dotty.tools.dotc.reporting.Reporting.error(Reporter.scala:88)
at dotty.tools.dotc.reporting.Reporting.error$(Reporter.scala:87)
at dotty.tools.dotc.core.Contexts$Context.error(Contexts.scala:67)
at dotty.tools.dotc.typer.Checking.checkInlineConformant(Checking.scala:602)
at dotty.tools.dotc.typer.Checking.checkInlineConformant$(Checking.scala:595)
at dotty.tools.dotc.typer.Typer.checkInlineConformant(Typer.scala:69)
at dotty.tools.dotc.typer.Typer.$anonfun$typedValDef$1(Typer.scala:1304)
at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
at dotty.tools.dotc.typer.Typer.typedValDef(Typer.scala:1294)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1663)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1726)
at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:94)
at dotty.tools.dotc.transform.TreeChecker$Checker.typedUnadapted(TreeChecker.scala:272)
at dotty.tools.dotc.typer.Typer.$anonfun$typed$2(Typer.scala:1744)
at dotty.tools.dotc.reporting.trace$.apply(trace.scala:23)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1740)
at dotty.tools.dotc.transform.TreeChecker$Checker.typed(TreeChecker.scala:257)
at dotty.tools.dotc.typer.Typer.$anonfun$typedDefDef$3(Typer.scala:1344)
at dotty.tools.dotc.core.Decorators$ListDecorator$.loop$1(Decorators.scala:62)
at dotty.tools.dotc.core.Decorators$ListDecorator$.mapconserve$extension(Decorators.scala:78)
at dotty.tools.dotc.core.Decorators$ListOfListDecorator$.$anonfun$nestedMapconserve$1(Decorators.scala:142)
at dotty.tools.dotc.core.Decorators$ListDecorator$.loop$1(Decorators.scala:62)
at dotty.tools.dotc.core.Decorators$ListDecorator$.mapconserve$extension(Decorators.scala:78)
at dotty.tools.dotc.core.Decorators$ListOfListDecorator$.nestedMapconserve$extension(Decorators.scala:142)
at dotty.tools.dotc.typer.Typer.$anonfun$typedDefDef$1(Typer.scala:1344)
at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
at dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:1340)
at dotty.tools.dotc.transform.TreeChecker$Checker.super$typedDefDef(TreeChecker.scala:403)
at dotty.tools.dotc.transform.TreeChecker$Checker.$anonfun$typedDefDef$2(TreeChecker.scala:403)
at dotty.tools.dotc.transform.TreeChecker$Checker.withDefinedSyms(TreeChecker.scala:180)
at dotty.tools.dotc.transform.TreeChecker$Checker.$anonfun$typedDefDef$1(TreeChecker.scala:392)
at dotty.tools.dotc.transform.TreeChecker$Checker.withDefinedSyms(TreeChecker.scala:180)
at dotty.tools.dotc.transform.TreeChecker$Checker.typedDefDef(TreeChecker.scala:391)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1666)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1726)
at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:94)
at dotty.tools.dotc.transform.TreeChecker$Checker.typedUnadapted(TreeChecker.scala:272)
at dotty.tools.dotc.typer.Typer.$anonfun$typed$2(Typer.scala:1744)
at dotty.tools.dotc.reporting.trace$.apply(trace.scala:23)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1740)
at dotty.tools.dotc.transform.TreeChecker$Checker.typed(TreeChecker.scala:257)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:1766)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:1789)
at dotty.tools.dotc.transform.TreeChecker$Checker.typedStats(TreeChecker.scala:434)
at dotty.tools.dotc.typer.Typer.$anonfun$typedClassDef$1(Typer.scala:1451)
at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:1381)
...