Skip to content

AssertionError: no TypeBounds allowed on SAM expansion with wildcard #8012

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
panacekcz opened this issue Jan 16, 2020 · 0 comments
Closed

Comments

@panacekcz
Copy link
Contributor

minimized code

@FunctionalInterface
abstract class Q[A]{
  def apply(a: A): Int
}
object O{
 def m(i: Int): Int = i
 val x: Q[_] = m
}
Stack trace
exception occurred while compiling sam-wildcard.scala
java.lang.AssertionError: no TypeBounds allowed while compiling sam-wildcard.scala
Exception in thread "main" java.lang.AssertionError: no TypeBounds allowed
	at dotty.tools.dotc.core.TypeApplications$.noBounds(TypeApplications.scala:21)
	at dotty.tools.dotc.core.TypeApplications$.argTypes$extension$$anonfun$1(TypeApplications.scala:487)
	at scala.collection.immutable.List.mapConserve(List.scala:444)
	at dotty.tools.dotc.core.TypeApplications$.argTypes$extension(TypeApplications.scala:487)
	at dotty.tools.dotc.ast.tpd$.isApplicable$1$$anonfun$1(tpd.scala:275)
	at dotty.tools.dotc.core.Types$LambdaType.instantiate(Types.scala:3093)
	at dotty.tools.dotc.core.Types$MethodOrPoly.instantiate(Types.scala:3147)
	at dotty.tools.dotc.ast.tpd$.isApplicable$3(tpd.scala:275)
	at dotty.tools.dotc.ast.tpd$.$anonfun$5(tpd.scala:281)
	at dotty.tools.dotc.core.Denotations$SingleDenotation.suchThat(Denotations.scala:761)
	at dotty.tools.dotc.ast.tpd$.ClassDef(tpd.scala:281)
	at dotty.tools.dotc.ast.tpd$.AnonClass(tpd.scala:332)
	at dotty.tools.dotc.transform.ExpandSAMs.transformBlock(ExpandSAMs.scala:51)
	at dotty.tools.dotc.transform.MegaPhase.goBlock(MegaPhase.scala:701)
	at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:288)
	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:396)
	at dotty.tools.dotc.transform.MegaPhase.mapValDef$1(MegaPhase.scala:234)
	at dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:238)
	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:394)
	at dotty.tools.dotc.transform.MegaPhase.transformStat$2(MegaPhase.scala:404)
	at dotty.tools.dotc.transform.MegaPhase.$anonfun$1(MegaPhase.scala:409)
	at scala.collection.immutable.List.mapConserve(List.scala:444)
	at dotty.tools.dotc.transform.MegaPhase.transformStats(MegaPhase.scala:409)
	at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:339)
	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:396)
	at dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:251)
	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:394)
	at dotty.tools.dotc.transform.MegaPhase.transformStat$2(MegaPhase.scala:404)
	at dotty.tools.dotc.transform.MegaPhase.$anonfun$1(MegaPhase.scala:409)
	at scala.collection.immutable.List.mapConserve(List.scala:444)
	at dotty.tools.dotc.transform.MegaPhase.transformStats(MegaPhase.scala:409)
	at dotty.tools.dotc.transform.MegaPhase.mapPackage$1(MegaPhase.scala:356)
	at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:359)
	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:396)
	at dotty.tools.dotc.transform.MegaPhase.transformUnit(MegaPhase.scala:415)
	at dotty.tools.dotc.transform.MegaPhase.run(MegaPhase.scala:427)
	at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:315)
	at scala.collection.immutable.List.map(List.scala:219)
	at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:316)
	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)
abgruszecki added a commit that referenced this issue Jan 17, 2020
Fix #8012: Disallow conversion to underspecified SAM type
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

2 participants