Skip to content

Error while loading inline args from TASTY #3597

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 29, 2017 · 0 comments
Closed

Error while loading inline args from TASTY #3597

nicolasstucki opened this issue Nov 29, 2017 · 0 comments

Comments

@nicolasstucki
Copy link
Contributor

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)
...
odersky added a commit to dotty-staging/dotty that referenced this issue Dec 2, 2017
There was a discrepancy in that value parameters had a Deferred flag set
before pickling but not after unpickling. This triggered a check that the
(missing) rhs of an inline parameter was a constant. This commit changes
the condition of the test to also exclude parameters. It also aligns
frontend and unpickler in that the frontend will no longer mark term
parameters as Deferred.
odersky added a commit to dotty-staging/dotty that referenced this issue Dec 6, 2017
There was a discrepancy in that value parameters had a Deferred flag set
before pickling but not after unpickling. This triggered a check that the
(missing) rhs of an inline parameter was a constant. This commit changes
the condition of the test to also exclude parameters. It also aligns
frontend and unpickler in that the frontend will no longer mark term
parameters as Deferred.
odersky added a commit to dotty-staging/dotty that referenced this issue Dec 11, 2017
There was a discrepancy in that value parameters had a Deferred flag set
before pickling but not after unpickling. This triggered a check that the
(missing) rhs of an inline parameter was a constant. This commit changes
the condition of the test to also exclude parameters. It also aligns
frontend and unpickler in that the frontend will no longer mark term
parameters as Deferred.
odersky added a commit to dotty-staging/dotty that referenced this issue Dec 11, 2017
There was a discrepancy in that value parameters had a Deferred flag set
before pickling but not after unpickling. This triggered a check that the
(missing) rhs of an inline parameter was a constant. This commit changes
the condition of the test to also exclude parameters. It also aligns
frontend and unpickler in that the frontend will no longer mark term
parameters as Deferred.
odersky added a commit to dotty-staging/dotty that referenced this issue Dec 16, 2017
There was a discrepancy in that value parameters had a Deferred flag set
before pickling but not after unpickling. This triggered a check that the
(missing) rhs of an inline parameter was a constant. This commit changes
the condition of the test to also exclude parameters. It also aligns
frontend and unpickler in that the frontend will no longer mark term
parameters as Deferred.
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

1 participant