Skip to content

Error with wildcard type from TASTY #3598

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 with wildcard type from TASTY #3598

nicolasstucki opened this issue Nov 29, 2017 · 0 comments

Comments

@nicolasstucki
Copy link
Contributor

Fail to compile from TASTY

class Foo[A] {
  def baz(foo: Foo[_]): Unit = bar(foo)
  def bar[A](foo: Foo[A]): A = ???
}

Can be reproduced with

dotc <source>
dotc -decompile -Ycheck:all Test
exception while typing this.bar[Foo[_]#<parameter A of class Foo>](foo) of class class dotty.tools.dotc.ast.Trees$Apply # 68
exception while typing {
  this.bar[Foo[_]#<parameter A of class Foo>](foo)
  ()
} of class class dotty.tools.dotc.ast.Trees$Block # 70
exception while typing  def baz( foo: Foo[_ >: Nothing <: Any]): Unit = 
  {
    this.bar[Foo[_]#<parameter A of class Foo>](foo)
    ()
  } of class class dotty.tools.dotc.ast.Trees$DefDef # 50
exception while typing @scala.annotation.internal.SourceFile("tests/pos/i2250.scala")  class T ()
   extends
 Object() { 
   def baz( foo: Foo[_ >: Nothing <: Any]): Unit = 
    {
      this.bar[Foo[_]#<parameter A of class Foo>](foo)
      ()
    }
   def bar[ A]( foo: Foo[A]): A = ???
} of class class dotty.tools.dotc.ast.Trees$TypeDef # 15
exception while typing package <empty> {
  @scala.annotation.internal.SourceFile("tests/pos/i2250.scala")  class T ()
     extends
   Object() { 
     def baz( foo: Foo[_ >: Nothing <: Any]): Unit = 
      {
        this.bar[Foo[_]#<parameter A of class Foo>](foo)
        ()
      }
     def bar[ A]( foo: Foo[A]): A = ???
  }
} of class class dotty.tools.dotc.ast.Trees$PackageDef # 22
*** error while checking ./T.class after phase frontend ***
Exception in thread "main" java.lang.AssertionError: assertion failed: found:    Foo[_](foo)
required: Foo[Foo[_]#<parameter A of class Foo>]


tree = foo
	at scala.Predef$.assert(Predef.scala:219)
	at dotty.tools.dotc.transform.TreeChecker$Checker.adapt(TreeChecker.scala:447)
	at dotty.tools.dotc.typer.ProtoTypes$FunProto.typedArg(ProtoTypes.scala:242)
	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)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
	at dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:667)
	at dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:767)
	at dotty.tools.dotc.typer.Applications.typedApply$(Applications.scala:665)
	at dotty.tools.dotc.typer.Typer.typedApply(Typer.scala:69)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1678)
	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.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:1777)
	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.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)
...
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