Skip to content

Extension block, inline, overloading and call with mistyped arguments lead to crash #8050

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 21, 2020 · 0 comments

Comments

@anatoliykmetyuk
Copy link
Contributor

minimized code

object stuff
  def exec(dir: Int) = ???

extension on (a: Int) with
  inline def exec: Unit = stuff.exec("aaa")
Stack trace
java.util.NoSuchElementException: None.get while compiling /Users/kmetiuk/Projects/scala3/pg/sandbox/iss8.scala
Exception in thread "main" java.util.NoSuchElementException: None.get
	at scala.None$.get(Option.scala:627)
	at scala.None$.get(Option.scala:626)
	at dotty.tools.dotc.typer.Typer.localTyper(Typer.scala:2109)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2137)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2208)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2247)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2259)
	at dotty.tools.dotc.typer.Namer.typedAheadExpr$$anonfun$1(Namer.scala:1262)
	at dotty.tools.dotc.typer.Namer.typedAhead(Namer.scala:1252)
	at dotty.tools.dotc.typer.Namer.typedAheadExpr(Namer.scala:1262)
	at dotty.tools.dotc.typer.Namer$Completer.addInlineInfo$$anonfun$1(Namer.scala:871)
	at dotty.tools.dotc.typer.PrepareInlineable$.registerInlineInfo$$anonfun$1(PrepareInlineable.scala:226)
	at dotty.tools.dotc.core.Annotations$LazyBodyAnnotation.tree(Annotations.scala:87)
	at dotty.tools.dotc.typer.Inliner$.bodyToInline(Inliner.scala:47)
	at dotty.tools.dotc.typer.Inliner$.isInlineable(Inliner.scala:53)
	at dotty.tools.dotc.typer.ProtoTypes$Compatibility.constrainResult(ProtoTypes.scala:96)
	at dotty.tools.dotc.typer.Typer.constrainResult(Typer.scala:83)
	at dotty.tools.dotc.typer.Applications$Application.init(Applications.scala:345)
	at dotty.tools.dotc.typer.Applications$TestApplication.<init>(Applications.scala:646)
	at dotty.tools.dotc.typer.Applications$ApplicableToTypes.<init>(Applications.scala:671)
	at dotty.tools.dotc.typer.Applications.isApplicableMethodRef$$anonfun$2(Applications.scala:1233)
	at dotty.tools.dotc.core.Contexts$Context.test$$anonfun$1(Contexts.scala:322)
	at dotty.tools.dotc.core.TyperState.test(TyperState.scala:116)
	at dotty.tools.dotc.core.Contexts$Context.test(Contexts.scala:322)
	at dotty.tools.dotc.typer.Applications.isApplicableMethodRef(Applications.scala:1233)
	at dotty.tools.dotc.typer.Typer.isApplicableMethodRef(Typer.scala:83)
	at dotty.tools.dotc.typer.Applications.isApplicableType$$anonfun$2(Applications.scala:1249)
	at dotty.tools.dotc.typer.Applications.onMethod(Applications.scala:1254)
	at dotty.tools.dotc.typer.Applications.isApplicableType(Applications.scala:1250)
	at dotty.tools.dotc.typer.Typer.isApplicableType(Typer.scala:83)
	at dotty.tools.dotc.typer.Applications.qualifies$1(Applications.scala:1266)
	at dotty.tools.dotc.typer.Applications.hasExtensionMethod(Applications.scala:1268)
	at dotty.tools.dotc.typer.Typer.hasExtensionMethod(Typer.scala:83)
	at dotty.tools.dotc.typer.ProtoTypes$ViewProto.isMatchedBy(ProtoTypes.scala:416)
	at dotty.tools.dotc.core.TypeComparer.isMatchedByProto(TypeComparer.scala:1585)
	at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:283)
	at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:1104)
	at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:161)
	at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:171)
	at dotty.tools.dotc.core.TypeComparer.topLevelSubType(TypeComparer.scala:128)
	at dotty.tools.dotc.core.Types$Type.$less$colon$less(Types.scala:892)
	at dotty.tools.dotc.core.Types$Type.relaxed_$less$colon$less(Types.scala:926)
	at dotty.tools.dotc.typer.ProtoTypes$Compatibility.isCompatible(ProtoTypes.scala:37)
	at dotty.tools.dotc.typer.ProtoTypes$NoViewsAllowed$.isCompatible(ProtoTypes.scala:103)
	at dotty.tools.dotc.typer.Implicits$ImplicitRefs.candidateKind$1(Implicits.scala:215)
	at dotty.tools.dotc.typer.Implicits$ImplicitRefs.matchingCandidate$1$$anonfun$1(Implicits.scala:227)
	at dotty.tools.dotc.core.Contexts$Context.test$$anonfun$1(Contexts.scala:322)
	at dotty.tools.dotc.core.TyperState.test(TyperState.scala:101)
	at dotty.tools.dotc.core.Contexts$Context.test(Contexts.scala:322)
	at dotty.tools.dotc.typer.Implicits$ImplicitRefs.matchingCandidate$2(Implicits.scala:227)
	at dotty.tools.dotc.typer.Implicits$ImplicitRefs.filterMatching$$anonfun$1(Implicits.scala:232)
	at scala.collection.immutable.List.flatMap(List.scala:265)
	at dotty.tools.dotc.typer.Implicits$ImplicitRefs.filterMatching(Implicits.scala:232)
	at dotty.tools.dotc.typer.Implicits$ContextualImplicits.computeEligible(Implicits.scala:315)
	at dotty.tools.dotc.typer.Implicits$ContextualImplicits.eligible(Implicits.scala:293)
	at dotty.tools.dotc.typer.Implicits$ImplicitSearch.bestImplicit(Implicits.scala:1646)
	at dotty.tools.dotc.typer.Implicits.inferImplicit(Implicits.scala:1327)
	at dotty.tools.dotc.typer.Typer.inferImplicit(Typer.scala:83)
	at dotty.tools.dotc.typer.Implicits.inferView(Implicits.scala:679)
	at dotty.tools.dotc.typer.Typer.inferView(Typer.scala:83)
	at dotty.tools.dotc.typer.Typer.adaptToSubType$1(Typer.scala:3084)
	at dotty.tools.dotc.typer.Typer.adaptNoArgsOther$6(Typer.scala:2915)
	at dotty.tools.dotc.typer.Typer.adaptNoArgs$1(Typer.scala:2967)
	at dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:3173)
	at dotty.tools.dotc.typer.Typer.adapt(Typer.scala:2578)
	at dotty.tools.dotc.typer.Typer.tryInsertImplicitOnQualifier$$anonfun$1(Typer.scala:2531)
	at dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:2375)
	at dotty.tools.dotc.typer.Typer.tryInsertImplicitOnQualifier(Typer.scala:2535)
	at dotty.tools.dotc.typer.Applications.tryWithImplicitOnQualifier$4(Applications.scala:881)
	at dotty.tools.dotc.typer.Applications.realApply$10$$anonfun$9(Applications.scala:935)
	at dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:2378)
	at dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:938)
	at dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:973)
	at dotty.tools.dotc.typer.Typer.typedApply(Typer.scala:83)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2151)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2209)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2247)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2259)
	at dotty.tools.dotc.typer.Typer.ascription$1(Typer.scala:670)
	at dotty.tools.dotc.typer.Typer.typedTyped$$anonfun$4(Typer.scala:708)
	at dotty.tools.dotc.typer.Typer.cases$1(Typer.scala:659)
	at dotty.tools.dotc.typer.Typer.typedTyped(Typer.scala:709)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2156)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2209)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2247)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2259)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2367)
	at dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:1679)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2138)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2208)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2247)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2259)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2281)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2325)
	at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:1812)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2141)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2208)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2247)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2259)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2281)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2325)
	at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:1812)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2141)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2208)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2247)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2259)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2281)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2325)
	at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:1938)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2182)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2209)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2247)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2259)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2367)
	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: 3 s, completed Jan 21, 2020 2:31:26 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