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

Scala3RunTime$.assertFailed w/ -Ykind-projector:underscores #14952

Closed
armanbilge opened this issue Apr 16, 2022 · 1 comment · Fixed by #21718
Closed

Scala3RunTime$.assertFailed w/ -Ykind-projector:underscores #14952

armanbilge opened this issue Apr 16, 2022 · 1 comment · Fixed by #21718

Comments

@armanbilge
Copy link
Contributor

Compiler version

3.1.2, 3.2.0-RC1-bin-20220414-ba45d46-NIGHTLY

Minimized code

type LiftP[F[_], T] <: Tuple =
  T match {
    case _ *: _ => F[Head[T]] *: LiftP[F, Tail[T]]
    case _ => EmptyTuple
  }

Output (click arrow to expand)

$ scalac -Ykind-projector:underscores src/main/scala/bug.scala 
exception occurred while typechecking src/main/scala/bug.scala
exception occurred while compiling src/main/scala/bug.scala
java.lang.AssertionError: assertion failed while compiling src/main/scala/bug.scala
Exception in thread "main" java.lang.AssertionError: assertion failed
        at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:11)
        at dotty.tools.dotc.typer.Typer$$anon$3.transform(Typer.scala:1647)
        at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform$$anonfun$1(Trees.scala:1493)
        at scala.collection.immutable.List.mapConserve(List.scala:472)
        at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1493)
        at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1431)
        at dotty.tools.dotc.typer.Typer$$anon$3.transform(Typer.scala:1644)
        at dotty.tools.dotc.typer.Typer.caseRest$2(Typer.scala:1715)
        at dotty.tools.dotc.typer.Typer.typedTypeCase(Typer.scala:1722)
        at dotty.tools.dotc.typer.Typer.$anonfun$39(Typer.scala:2027)
        at dotty.tools.dotc.core.Decorators$ListDecorator$.loop$1(Decorators.scala:92)
        at dotty.tools.dotc.core.Decorators$ListDecorator$.mapconserve$extension(Decorators.scala:108)
        at dotty.tools.dotc.typer.Typer.typedMatchTypeTree(Typer.scala:2027)
        at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2838)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2872)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2937)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2941)
        at dotty.tools.dotc.typer.Typer.typedType(Typer.scala:3060)
        at dotty.tools.dotc.typer.Namer.typedAheadType$$anonfun$1(Namer.scala:1470)
        at dotty.tools.dotc.typer.Namer.typedAhead(Namer.scala:1463)
        at dotty.tools.dotc.typer.Namer.typedAheadType(Namer.scala:1470)
        at dotty.tools.dotc.typer.Namer$TypeDefCompleter.typeSig(Namer.scala:1013)
        at dotty.tools.dotc.typer.Namer$Completer.completeInCreationContext(Namer.scala:914)
        at dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:806)
        at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:168)
        at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:188)
        at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:190)
        at dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:370)
        at dotty.tools.dotc.typer.Typer.retrieveSym(Typer.scala:2751)
        at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2776)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2871)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2937)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2941)
        at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2963)
        at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3013)
        at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:2454)
        at dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$1(Typer.scala:2797)
        at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2801)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2871)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2937)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2941)
        at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2963)
        at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3013)
        at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:2581)
        at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2842)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2872)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2937)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2941)
        at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3057)
        at dotty.tools.dotc.typer.TyperPhase.typeCheck$$anonfun$1(TyperPhase.scala:47)
        at dotty.tools.dotc.core.Phases$Phase.monitor(Phases.scala:411)
        at dotty.tools.dotc.typer.TyperPhase.typeCheck(TyperPhase.scala:54)
        at dotty.tools.dotc.typer.TyperPhase.runOn$$anonfun$3(TyperPhase.scala:88)
        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:333)
        at dotty.tools.dotc.typer.TyperPhase.runOn(TyperPhase.scala:88)
        at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:259)
        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:1328)
        at dotty.tools.dotc.Run.runPhases$1(Run.scala:270)
        at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:278)
        at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
        at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:68)
        at dotty.tools.dotc.Run.compileUnits(Run.scala:287)
        at dotty.tools.dotc.Run.compileSources(Run.scala:220)
        at dotty.tools.dotc.Run.compile(Run.scala:204)
        at dotty.tools.dotc.Driver.doCompile(Driver.scala:39)
        at dotty.tools.dotc.Driver.process(Driver.scala:199)
        at dotty.tools.dotc.Driver.process(Driver.scala:167)
        at dotty.tools.dotc.Driver.process(Driver.scala:179)
        at dotty.tools.dotc.Driver.main(Driver.scala:209)
        at dotty.tools.dotc.Main.main(Main.scala)
@armanbilge armanbilge added itype:bug itype:crash stat:needs triage Every issue needs to have an "area" and "itype" label labels Apr 16, 2022
@armanbilge armanbilge changed the title Scala3RunTime$.assertFailed Scala3RunTime$.assertFailed w/ -Ykind-projector:underscores Apr 16, 2022
@romanowski
Copy link
Contributor

It works in 3.0.0 and stop working in 3.0.1 so I suspect may be related to #12699

@romanowski romanowski added area:typer and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Apr 19, 2022
@smarter smarter closed this as completed in 374cd4f Oct 7, 2024
smarter added a commit that referenced this issue Oct 7, 2024
Always interpret underscores inside patterns as type bounds, even when
`ctx.settings.XkindProjector.value == "underscores"`.

Fixes #14952 and fixes #21400.

Issue introduced in #12378.
@WojciechMazur WojciechMazur added this to the 3.6.0 milestone Oct 8, 2024
WojciechMazur added a commit to scala/scala3-lts that referenced this issue Dec 5, 2024
Always treat underscores as type bounds inside patterns, even when `ctx.settings.XkindProjector.value == "underscores"`.

Fixes scala#14952 and scala#21400.

[Cherry-picked 374cd4f][modified]
WojciechMazur added a commit that referenced this issue Dec 9, 2024
Always treat underscores as type bounds inside patterns, even when `ctx.settings.XkindProjector.value == "underscores"`.

Fixes #14952 and #21400.

[Cherry-picked 374cd4f][modified]
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.

3 participants