Skip to content

Crash while misusing match types #7043

Closed
@anatoliykmetyuk

Description

@anatoliykmetyuk

minimized code

type StrHead[X <: Tuple] = X match {
  case (x <: String) *: _ => x
}
Stack trace
-- [E040] Syntax Error: ../pg/Main.scala:16:10 ---------------------------------
16 |  case (x <: String) *: _ => x
   |          ^^
   |          ')' expected, but '<:' found
exception occurred while typechecking ../pg/Main.scala
exception occurred while compiling ../pg/Main.scala
scala.MatchError: Parens(Ident(x)) (of class dotty.tools.dotc.ast.untpd$Parens) while compiling ../pg/Main.scala
Exception in thread "main" scala.MatchError: Parens(Ident(x)) (of class dotty.tools.dotc.ast.untpd$Parens)
	at dotty.tools.dotc.ast.desugar$.patternVar(Desugar.scala:1118)
	at dotty.tools.dotc.typer.Typer.typedArg$1(Typer.scala:1310)
	at dotty.tools.dotc.typer.Typer.$anonfun$23(Typer.scala:1338)
	at dotty.tools.dotc.core.Decorators$ListDecorator$.zipWithConserve$extension(Decorators.scala:109)
	at dotty.tools.dotc.typer.Typer.typedAppliedTypeTree(Typer.scala:1338)
	at dotty.tools.dotc.typer.Typer.typedInfixOp(Typer.scala:1901)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2042)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2061)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2099)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2111)
	at dotty.tools.dotc.typer.Typer.typedType(Typer.scala:2189)
	at dotty.tools.dotc.typer.Typer.caseRest$2(Typer.scala:1125)
	at dotty.tools.dotc.typer.Typer.typedTypeCase(Typer.scala:1130)
	at dotty.tools.dotc.typer.Typer.$anonfun$26(Typer.scala:1374)
	at dotty.tools.dotc.core.Decorators$ListDecorator$.loop$1(Decorators.scala:63)
	at dotty.tools.dotc.core.Decorators$ListDecorator$.mapconserve$extension(Decorators.scala:79)
	at dotty.tools.dotc.typer.Typer.typedMatchTypeTree(Typer.scala:1374)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2032)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2061)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2099)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2111)
	at dotty.tools.dotc.typer.Namer.typedAheadType$$anonfun$1(Namer.scala:1197)
	at dotty.tools.dotc.typer.Namer.typedAhead(Namer.scala:1190)
	at dotty.tools.dotc.typer.Namer.typedAheadType(Namer.scala:1197)
	at dotty.tools.dotc.typer.Namer.typeDefSig(Namer.scala:1470)
	at dotty.tools.dotc.typer.Namer$TypeDefCompleter.typeSig(Namer.scala:914)
	at dotty.tools.dotc.typer.Namer$Completer.completeInCreationContext(Namer.scala:878)
	at dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:785)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:255)
	at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:180)
	at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:182)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:395)
	at dotty.tools.dotc.typer.Typer.retrieveSym(Typer.scala:1958)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1983)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2060)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2099)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2111)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2130)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2174)
	at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:1673)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1996)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2060)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2099)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2111)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2130)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2174)
	at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:1797)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2036)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2061)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2099)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2111)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2187)
	at dotty.tools.dotc.typer.FrontEnd.typeCheck$$anonfun$1(FrontEnd.scala:75)
	at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
	at dotty.tools.dotc.typer.FrontEnd.monitor(FrontEnd.scala:41)
	at dotty.tools.dotc.typer.FrontEnd.typeCheck(FrontEnd.scala:79)
	at dotty.tools.dotc.typer.FrontEnd.runOn$$anonfun$3(FrontEnd.scala:109)
	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:392)
	at dotty.tools.dotc.typer.FrontEnd.runOn(FrontEnd.scala:109)
	at dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:158)
	at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.IndexedSeqOptimized.foreach(IndexedSeqOptimized.scala:36)
	at scala.collection.IndexedSeqOptimized.foreach$(IndexedSeqOptimized.scala:33)
	at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:198)
	at dotty.tools.dotc.Run.runPhases$5(Run.scala:170)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:178)
	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:185)
	at dotty.tools.dotc.Run.compileSources(Run.scala:120)
	at dotty.tools.dotc.Run.compile(Run.scala:104)
	at dotty.tools.dotc.Driver.doCompile(Driver.scala:35)
	at dotty.tools.dotc.Driver.process(Driver.scala:180)
	at dotty.tools.dotc.Driver.process(Driver.scala:149)
	at dotty.tools.dotc.Driver.process(Driver.scala:161)
	at dotty.tools.dotc.Driver.main(Driver.scala:188)
	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: 7 s, completed Aug 14, 2019 5:51:28 PM

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions