Skip to content

NoSuchElementException #9298

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
sir-wabbit opened this issue Jul 6, 2020 · 0 comments · Fixed by #9301
Closed

NoSuchElementException #9298

sir-wabbit opened this issue Jul 6, 2020 · 0 comments · Fixed by #9301

Comments

@sir-wabbit
Copy link

Minimized code

// NSEE-005e121ff509833f3097402a6dfdcdb931a5e087
object Foo {
  val foo = Nil
  object foo
  foo(foo: _*)
}

Output (click arrow to expand)

exception occurred while typechecking test.scala
exception occurred while compiling test.scala
java.util.NoSuchElementException: head of empty list while compiling test.scala
Exception in thread "main" java.util.NoSuchElementException: head of empty list
	at scala.collection.immutable.Nil$.head(List.scala:629)
	at scala.collection.immutable.Nil$.head(List.scala:628)
	at dotty.tools.dotc.core.TypeApplications$.elemType$1(TypeApplications.scala:388)
	at dotty.tools.dotc.core.TypeApplications$.elemType$1(TypeApplications.scala:387)
	at dotty.tools.dotc.core.TypeApplications$.translateParameterized$extension(TypeApplications.scala:389)
	at dotty.tools.dotc.core.TypeApplications$.translateToRepeated$extension(TypeApplications.scala:414)
	at dotty.tools.dotc.typer.Typer.typedWildcardStarArgExpr$1(Typer.scala:746)
	at dotty.tools.dotc.typer.Typer.typedTyped$$anonfun$2(Typer.scala:751)
	at dotty.tools.dotc.typer.Typer.cases$1(Typer.scala:717)
	at dotty.tools.dotc.typer.Typer.typedTyped(Typer.scala:752)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2381)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2436)
	at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2502)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2511)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2514)
	at dotty.tools.dotc.typer.ProtoTypes$FunProto.$anonfun$3$$anonfun$1(ProtoTypes.scala:318)
	at dotty.tools.dotc.typer.ProtoTypes$FunProto.cacheTypedArg(ProtoTypes.scala:293)
	at dotty.tools.dotc.typer.ProtoTypes$FunProto.$anonfun$4(ProtoTypes.scala:318)
	at dotty.tools.dotc.typer.ProtoTypes$FunProto.$anonfun$adapted$1(ProtoTypes.scala:318)
	at dotty.tools.dotc.core.Decorators$ListDecorator$.recur$1(Decorators.scala:125)
	at dotty.tools.dotc.core.Decorators$ListDecorator$.mapWithIndexConserve$extension(Decorators.scala:131)
	at dotty.tools.dotc.typer.ProtoTypes$FunProto.typedArgs(ProtoTypes.scala:318)
	at dotty.tools.dotc.typer.ProtoTypes$FunProto.isMatchedBy(ProtoTypes.scala:256)
	at dotty.tools.dotc.core.TypeComparer.isMatchedByProto(TypeComparer.scala:1657)
	at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:281)
	at dotty.tools.dotc.core.TypeComparer.op$1(TypeComparer.scala:1134)
	at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:1153)
	at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:167)
	at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:177)
	at dotty.tools.dotc.core.TypeComparer.topLevelSubType(TypeComparer.scala:133)
	at dotty.tools.dotc.core.Types$Type.$less$colon$less(Types.scala:909)
	at dotty.tools.dotc.core.Types$Type.relaxed_$less$colon$less(Types.scala:943)
	at dotty.tools.dotc.typer.ProtoTypes$Compatibility.isCompatible(ProtoTypes.scala:38)
	at dotty.tools.dotc.typer.ProtoTypes$NoViewsAllowed$.isCompatible(ProtoTypes.scala:103)
	at dotty.tools.dotc.typer.ProtoTypes$Compatibility.testCompat$1(ProtoTypes.scala:46)
	at dotty.tools.dotc.typer.ProtoTypes$Compatibility.normalizedCompatible(ProtoTypes.scala:58)
	at dotty.tools.dotc.typer.ProtoTypes$NoViewsAllowed$.normalizedCompatible(ProtoTypes.scala:103)
	at dotty.tools.dotc.typer.ProtoTypes$SelectionProto.qualifies$1(ProtoTypes.scala:161)
	at dotty.tools.dotc.typer.ProtoTypes$SelectionProto.isMatchedBy(ProtoTypes.scala:165)
	at dotty.tools.dotc.core.TypeComparer.isMatchedByProto(TypeComparer.scala:1657)
	at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:281)
	at dotty.tools.dotc.core.TypeComparer.op$1(TypeComparer.scala:1134)
	at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:1153)
	at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:167)
	at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:177)
	at dotty.tools.dotc.core.TypeComparer.topLevelSubType(TypeComparer.scala:133)
	at dotty.tools.dotc.core.Types$Type.$less$colon$less(Types.scala:909)
	at dotty.tools.dotc.typer.Typer.adaptNoArgsOther$4(Typer.scala:3202)
	at dotty.tools.dotc.typer.Typer.adaptNoArgs$1(Typer.scala:3269)
	at dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:3500)
	at dotty.tools.dotc.typer.Typer.op$3(Typer.scala:2836)
	at dotty.tools.dotc.typer.Typer.adapt(Typer.scala:2837)
	at dotty.tools.dotc.typer.Typer.op$4$$anonfun$1(Typer.scala:2789)
	at dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:2633)
	at dotty.tools.dotc.typer.Typer.op$2(Typer.scala:2793)
	at dotty.tools.dotc.typer.Typer.tryInsertImplicitOnQualifier(Typer.scala:2796)
	at dotty.tools.dotc.typer.Applications.tryWithImplicitOnQualifier$4(Applications.scala:903)
	at dotty.tools.dotc.typer.Applications.realApply$8$$anonfun$7(Applications.scala:957)
	at dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:2636)
	at dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:960)
	at dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:998)
	at dotty.tools.dotc.typer.Typer.typedApply(Typer.scala:89)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2376)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2436)
	at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2502)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2511)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2514)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2559)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2581)
	at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:2034)
	at dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$2(Typer.scala:2364)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2368)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2435)
	at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2502)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2511)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2514)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2536)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2581)
	at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:2160)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2408)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2436)
	at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2502)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2511)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2514)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2625)
	at dotty.tools.dotc.typer.FrontEnd.liftedTree1$1(FrontEnd.scala:79)
	at dotty.tools.dotc.typer.FrontEnd.typeCheck$$anonfun$1(FrontEnd.scala:84)
	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:85)
	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:333)
	at dotty.tools.dotc.typer.FrontEnd.runOn(FrontEnd.scala:114)
	at dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:180)
	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:190)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:198)
	at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
	at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:64)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:205)
	at dotty.tools.dotc.Run.compileSources(Run.scala:142)
	at dotty.tools.dotc.Run.compile(Run.scala:124)
	at dotty.tools.dotc.Driver.doCompile(Driver.scala:38)
	at dotty.tools.dotc.Driver.process(Driver.scala:194)
	at dotty.tools.dotc.Driver.process(Driver.scala:163)
	at dotty.tools.dotc.Driver.process(Driver.scala:175)
	at dotty.tools.dotc.Driver.main(Driver.scala:202)
	at dotty.tools.dotc.Main.main(Main.scala)
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jul 6, 2020
@nicolasstucki nicolasstucki linked a pull request Jul 6, 2020 that will close this issue
odersky added a commit that referenced this issue Jul 8, 2020
Fix #9298: Be resilient to missing args
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants