Skip to content

Owner mismatch in TASTY for anonymous functions #3596

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

Owner mismatch in TASTY for anonymous functions #3596

nicolasstucki opened this issue Nov 29, 2017 · 0 comments

Comments

@nicolasstucki
Copy link
Contributor

Fail to compile

class Bar(ctor : Int => Int)
class Foo extends Bar(x => x)

Can be reproduced with

dotc <source>
dotc -decompile -Ycheck:all Foo
Exception in thread "main" java.lang.AssertionError: assertion failed: bad owner; method $anonfun has owner value <local Foo>, expected was constructor Foo
owner chain = method $anonfun, value <local Foo>, class Foo, package <empty>, package <root>, ctxOwners = constructor Foo, constructor Foo, constructor Foo, package <empty>, package <root>, package <root>, package <root>, package <root>, package <root>, package <root>, package <root>, package <root>, <none>, <none>, <none>, <none>, <none>
	at scala.Predef$.assert(Predef.scala:219)
	at dotty.tools.dotc.transform.TreeChecker$Checker.checkOwner(TreeChecker.scala:362)
	at dotty.tools.dotc.transform.TreeChecker$Checker.$anonfun$typedStats$1(TreeChecker.scala:430)
	at dotty.tools.dotc.transform.TreeChecker$Checker.$anonfun$typedStats$1$adapted(TreeChecker.scala:429)
	at scala.collection.immutable.List.foreach(List.scala:389)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typedStats(TreeChecker.scala:429)
	at dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:623)
	at dotty.tools.dotc.typer.Typer.$anonfun$typedBlock$1(Typer.scala:626)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
	at dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:625)
	at dotty.tools.dotc.transform.TreeChecker$Checker.super$typedBlock(TreeChecker.scala:416)
	at dotty.tools.dotc.transform.TreeChecker$Checker.$anonfun$typedBlock$1(TreeChecker.scala:416)
	at dotty.tools.dotc.transform.TreeChecker$Checker.withDefinedSyms(TreeChecker.scala:180)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typedBlock(TreeChecker.scala:416)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1685)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1727)
	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.ProtoTypes$FunProto.$anonfun$typedArg$1(ProtoTypes.scala:241)
	at dotty.tools.dotc.typer.ProtoTypes$FunProto.cacheTypedArg(ProtoTypes.scala:219)
	at dotty.tools.dotc.typer.ProtoTypes$FunProto.typedArg(ProtoTypes.scala:241)
	at dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:642)
	at dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:640)
	at dotty.tools.dotc.typer.Applications$Application.addTyped$1(Applications.scala:412)
	at dotty.tools.dotc.typer.Applications$Application.matchArgs(Applications.scala:451)
	at dotty.tools.dotc.typer.Applications$Application.init(Applications.scala:233)
	at dotty.tools.dotc.typer.Applications$TypedApply.<init>(Applications.scala:543)
	at dotty.tools.dotc.typer.Applications$ApplyToUntyped.<init>(Applications.scala:641)
	at dotty.tools.dotc.typer.Applications.simpleApply$1(Applications.scala:697)
	at dotty.tools.dotc.typer.Applications.$anonfun$typedApply$7(Applications.scala:722)
	at dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:1809)
	at dotty.tools.dotc.typer.Applications.$anonfun$typedApply$1(Applications.scala:723)

@nicolasstucki nicolasstucki changed the title Owner mismatch in tasty for anonymous functions Owner mismatch in TASTY for anonymous functions Nov 29, 2017
odersky added a commit to dotty-staging/dotty that referenced this issue Dec 3, 2017
odersky added a commit to dotty-staging/dotty that referenced this issue Dec 6, 2017
odersky added a commit to dotty-staging/dotty that referenced this issue Dec 11, 2017
odersky added a commit to dotty-staging/dotty that referenced this issue Dec 11, 2017
odersky added a commit to dotty-staging/dotty that referenced this issue Dec 16, 2017
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