Skip to content
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

AssertionError: no TypeBounds allowed, on wildcard (?) in extends clause #22518

Open
TomasMikula opened this issue Feb 4, 2025 · 5 comments
Open
Labels
area:pattern-matching itype:bug itype:crash regression This worked in a previous version but doesn't anymore

Comments

@TomasMikula
Copy link
Contributor

Compiler version

3.6.3

Worked in 3.5.2, so this is a regression.

Minimized code

sealed trait Foo[T]
class Bar extends Foo[?]

def mkFoo[T]: Foo[T] =
  ???

def test: Unit =
  mkFoo match
    case _ => ()

Output (click arrow to expand)

% ~/Downloads/scala3-3.6.3-aarch64-apple-darwin/bin/scalac test.scala               

  unhandled exception while running MegaPhase{protectedAccessors, extmethods, uncacheGivenAliases, checkStatic, elimByName, hoistSuperArgs, forwardDepChecks, specializeApplyMethods, tryCatchPatterns, patternMatcher} on test.scala

  An unhandled exception was thrown in the compiler.
  Please file a crash report here:
  https://github.com/scala/scala3/issues/new/choose
  For non-enriched exceptions, compile with -Xno-enrich-error-messages.


     while compiling: test.scala
        during phase: MegaPhase{protectedAccessors, extmethods, uncacheGivenAliases, checkStatic, elimByName, hoistSuperArgs, forwardDepChecks, specializeApplyMethods, tryCatchPatterns, patternMatcher}
                mode: Mode(ImplicitsEnabled)
     library version: version 2.13.15
    compiler version: version 3.6.3
            settings: 

Exception in thread "main" java.lang.AssertionError: no TypeBounds allowed
	at dotty.tools.dotc.core.TypeApplications$.noBounds(TypeApplications.scala:22)
	at dotty.tools.dotc.core.TypeApplications$.argTypes$extension$$anonfun$1(TypeApplications.scala:557)
	at scala.collection.immutable.List.mapConserve(List.scala:473)
	at dotty.tools.dotc.core.TypeApplications$.argTypes$extension(TypeApplications.scala:557)
	at dotty.tools.dotc.transform.patmat.SpaceEngine$.getTypeArgs$1(Space.scala:677)
	at dotty.tools.dotc.transform.patmat.SpaceEngine$.getChildren$1$$anonfun$1(Space.scala:689)
	at scala.collection.immutable.List.flatMap(List.scala:294)
	at dotty.tools.dotc.transform.patmat.SpaceEngine$.getChildren$1(Space.scala:682)
	at dotty.tools.dotc.transform.patmat.SpaceEngine$.rec$1(Space.scala:695)
	at dotty.tools.dotc.transform.patmat.SpaceEngine$.decompose(Space.scala:715)
	at dotty.tools.dotc.transform.patmat.SpaceEngine$Parts$.unapply(Space.scala:733)
	at dotty.tools.dotc.transform.patmat.Typ.decompose(Space.scala:101)
	at dotty.tools.dotc.transform.patmat.SpaceEngine$.decompose(Space.scala:118)
	at dotty.tools.dotc.transform.patmat.SpaceEngine$.computeSimplify(Space.scala:134)
	at dotty.tools.dotc.transform.patmat.Space.simplify(Space.scala:70)
	at dotty.tools.dotc.transform.patmat.Space.simplify$(Space.scala:52)
	at dotty.tools.dotc.transform.patmat.Typ.simplify(Space.scala:92)
	at dotty.tools.dotc.transform.patmat.SpaceEngine$.simplify(Space.scala:115)
	at dotty.tools.dotc.transform.patmat.SpaceEngine$.$anonfun$3(Space.scala:129)
	at scala.collection.immutable.List.map(List.scala:247)
	at scala.collection.immutable.List.map(List.scala:79)
	at dotty.tools.dotc.transform.patmat.SpaceEngine$.computeSimplify(Space.scala:129)
	at dotty.tools.dotc.transform.patmat.Space.simplify(Space.scala:70)
	at dotty.tools.dotc.transform.patmat.Space.simplify$(Space.scala:52)
	at dotty.tools.dotc.transform.patmat.Or.simplify(Space.scala:112)
	at dotty.tools.dotc.transform.patmat.SpaceEngine$.simplify(Space.scala:115)
	at dotty.tools.dotc.transform.patmat.SpaceEngine$.$anonfun$3(Space.scala:129)
	at scala.collection.immutable.List.map(List.scala:247)
	at scala.collection.immutable.List.map(List.scala:79)
	at dotty.tools.dotc.transform.patmat.SpaceEngine$.computeSimplify(Space.scala:129)
	at dotty.tools.dotc.transform.patmat.Space.simplify(Space.scala:70)
	at dotty.tools.dotc.transform.patmat.Space.simplify$(Space.scala:52)
	at dotty.tools.dotc.transform.patmat.Or.simplify(Space.scala:112)
	at dotty.tools.dotc.transform.patmat.SpaceEngine$.simplify(Space.scala:115)
	at dotty.tools.dotc.transform.patmat.SpaceEngine$.recur$1(Space.scala:943)
	at dotty.tools.dotc.transform.patmat.SpaceEngine$.checkReachability(Space.scala:971)
	at dotty.tools.dotc.transform.patmat.SpaceEngine$.checkMatch(Space.scala:976)
	at dotty.tools.dotc.transform.PatternMatcher.transformMatch(PatternMatcher.scala:52)
	at dotty.tools.dotc.transform.MegaPhase.goMatch(MegaPhase.scala:816)
	at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:383)
	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:454)
	at dotty.tools.dotc.transform.MegaPhase.mapDefDef$1(MegaPhase.scala:265)
	at dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:268)
	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:452)
	at dotty.tools.dotc.transform.MegaPhase.loop$1(MegaPhase.scala:465)
	at dotty.tools.dotc.transform.MegaPhase.transformStats(MegaPhase.scala:465)
	at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:376)
	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:454)
	at dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:272)
	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:452)
	at dotty.tools.dotc.transform.MegaPhase.loop$1(MegaPhase.scala:465)
	at dotty.tools.dotc.transform.MegaPhase.transformStats(MegaPhase.scala:465)
	at dotty.tools.dotc.transform.MegaPhase.mapPackage$1(MegaPhase.scala:396)
	at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:399)
	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:454)
	at dotty.tools.dotc.transform.MegaPhase.transformUnit(MegaPhase.scala:481)
	at dotty.tools.dotc.transform.MegaPhase.run(MegaPhase.scala:493)
	at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:380)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.immutable.List.foreach(List.scala:334)
	at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:373)
	at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:343)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
	at dotty.tools.dotc.Run.runPhases$1(Run.scala:336)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:383)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:395)
	at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:69)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:395)
	at dotty.tools.dotc.Run.compileSources(Run.scala:282)
	at dotty.tools.dotc.Run.compile(Run.scala:267)
	at dotty.tools.dotc.Driver.doCompile(Driver.scala:37)
	at dotty.tools.dotc.Driver.process(Driver.scala:201)
	at dotty.tools.dotc.Driver.process(Driver.scala:169)
	at dotty.tools.dotc.Driver.process(Driver.scala:181)
	at dotty.tools.dotc.Driver.main(Driver.scala:211)
	at dotty.tools.MainGenericCompiler$.run$1(MainGenericCompiler.scala:162)
	at dotty.tools.MainGenericCompiler$.main(MainGenericCompiler.scala:186)
	at dotty.tools.MainGenericCompiler.main(MainGenericCompiler.scala)
@TomasMikula TomasMikula added itype:bug itype:crash stat:needs triage Every issue needs to have an "area" and "itype" label labels Feb 4, 2025
@TomasMikula TomasMikula changed the title AssertionError: no TypeBounds allowed on wildcard (?) in extends clause AssertionError: no TypeBounds allowed, on wildcard (?) in extends clause Feb 4, 2025
TomasMikula added a commit to TomasMikula/libretto that referenced this issue Feb 4, 2025
@KacperFKorban KacperFKorban added the regression This worked in a previous version but doesn't anymore label Feb 5, 2025
@Gedochao
Copy link
Contributor

Gedochao commented Feb 11, 2025

Last good stable version: 3.6.2
(no good nightlies in between)
First bad nightly: 3.6.3-RC1-bin-20241107-caac72a-NIGHTLY
First bad stable version: 3.6.3
Still broken at 3.7.0-RC1-bin-20250210-7ac31d0-NIGHTLY

Seems to point at caac72a
cc @jchyb

Edit: Updated bisect in a comment below: #22518 (comment)

@Gedochao Gedochao added area:pattern-matching and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Feb 11, 2025
@jchyb
Copy link
Contributor

jchyb commented Feb 11, 2025

I can try to look at this but caac72a is unrelated (it was a change to stdlib method only accessible in macros, no macros here though)

@Gedochao
Copy link
Contributor

I can try to look at this but caac72a is unrelated (it was a change to stdlib method only accessible in macros, no macros here though)

@jchyb Yeah... I'm looking at it right now, and I think my initial bisect may have been wrong.
Something seems off about this... the issue actually appears in earlier nightlies, as far as 3.6.1, but it's not present in stable 3.6.1 and 3.6.2 releases.
Let me investigate some more first, sorry for the confusion. 😕

@jchyb
Copy link
Contributor

jchyb commented Feb 11, 2025

No worries, I thought there might have been some mix up between the issues

@Gedochao
Copy link
Contributor

Okay... updated bisect:

Last good stable version: 3.6.2
Last good nightly version: 3.6.1-RC1-bin-20241018-9d78307-NIGHTLY
First bad nightly version: 3.6.2-RC1-bin-20241020-6e32627-NIGHTLY
First bad stable version: 3.6.3
Still broken at 3.7.0-RC1-bin-20250210-7ac31d0-NIGHTLY

The error seems to have been introduced somewhere in 9d78307..6e32627, so one of:

The bisect script points at 34f1c54, but that can't be right, either... 😕

6e32627 seems to me to be the most likely culprit. cc @dwijnand
It's also tagged for 3.6.3-RC1, which would explain stable 3.6.2 being unaffected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:pattern-matching itype:bug itype:crash regression This worked in a previous version but doesn't anymore
Projects
None yet
Development

No branches or pull requests

4 participants