Skip to content

Default params crash the compiler when calling the function without some arguments #8002

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
anatoliykmetyuk opened this issue Jan 15, 2020 · 0 comments

Comments

@anatoliykmetyuk
Copy link
Contributor

minimized code

class Foo
  def f(x: Int, y: Int = 1) = ???

object bar extends Foo
  f()
Stack trace
exception occurred while typechecking /Users/kmetiuk/Projects/scala3/pg/sandbox/iss7.scala
exception occurred while compiling /Users/kmetiuk/Projects/scala3/pg/sandbox/iss7.scala
java.lang.AssertionError: assertion failed: non-existent getter denotation (val <none>) for getter(f$default$1) while compiling /Users/kmetiuk/Projects/scala3/pg/sandbox/iss7.scala
Exception in thread "main" java.lang.AssertionError: assertion failed: non-existent getter denotation (val <none>) for getter(f$default$1)
	at dotty.DottyPredef$.assertFail(DottyPredef.scala:17)
	at dotty.tools.dotc.typer.Applications.dotty$tools$dotc$typer$Applications$Application$$_$findGetter$1(Applications.scala:488)
	at dotty.tools.dotc.typer.Applications$Application.findDefaultGetter(Applications.scala:494)
	at dotty.tools.dotc.typer.Applications$Application.tryDefault$1(Applications.scala:567)
	at dotty.tools.dotc.typer.Applications$Application.matchArgs(Applications.scala:605)
	at dotty.tools.dotc.typer.Applications$Application.init(Applications.scala:354)
	at dotty.tools.dotc.typer.Applications$TypedApply.<init>(Applications.scala:694)
	at dotty.tools.dotc.typer.Applications$ApplyToTyped.<init>(Applications.scala:804)
	at dotty.tools.dotc.typer.Applications.simpleApply$1(Applications.scala:867)
	at dotty.tools.dotc.typer.Applications.realApply$7$$anonfun$6(Applications.scala:931)
	at dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:2368)
	at dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:942)
	at dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:977)
	at dotty.tools.dotc.typer.Typer.typedApply(Typer.scala:83)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2144)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2202)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2240)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2252)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2296)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2318)
	at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:1805)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2134)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2201)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2240)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2252)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2274)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2318)
	at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:1931)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2175)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2202)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2240)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2252)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2360)
	at dotty.tools.dotc.typer.FrontEnd.liftedTree1$2(FrontEnd.scala:78)
	at dotty.tools.dotc.typer.FrontEnd.typeCheck$$anonfun$1(FrontEnd.scala:83)
	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:84)
	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:305)
	at dotty.tools.dotc.typer.FrontEnd.runOn(FrontEnd.scala:114)
	at dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:167)
	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:177)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:185)
	at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
	at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:65)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:192)
	at dotty.tools.dotc.Run.compileSources(Run.scala:129)
	at dotty.tools.dotc.Run.compile(Run.scala:112)
	at dotty.tools.dotc.Driver.doCompile(Driver.scala:36)
	at dotty.tools.dotc.Driver.process(Driver.scala:189)
	at dotty.tools.dotc.Driver.process(Driver.scala:158)
	at dotty.tools.dotc.Driver.process(Driver.scala:170)
	at dotty.tools.dotc.Driver.main(Driver.scala:197)
	at dotty.tools.dotc.Main.main(Main.scala)
[error] Nonzero exit code returned from runner: 1
[error] (dotty-compiler / Compile / runMain) Nonzero exit code returned from runner: 1
[error] Total time: 4 s, completed Jan 15, 2020 4:31:35 PM
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