Skip to content

Crash involving type bounds in pattern matching #7247

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 Sep 18, 2019 · 0 comments
Closed

Crash involving type bounds in pattern matching #7247

anatoliykmetyuk opened this issue Sep 18, 2019 · 0 comments

Comments

@anatoliykmetyuk
Copy link
Contributor

minimized code

val x = "foo" match
  case _: (a *: (b: Any)) => ???
Stack trace
-- [E040] Syntax Error: ../pg/Macros.scala:31:18 -------------------------------
31 |  case _: (a *: (b: Any)) => ???
   |                  ^
   |                  ')' expected, but ':' found
exception occurred while typechecking ../pg/Macros.scala
exception occurred while compiling ../pg/Macros.scala
scala.MatchError: Parens(Ident(b)) (of class dotty.tools.dotc.ast.untpd$Parens) while compiling ../pg/Macros.scala
Exception in thread "main" scala.MatchError: Parens(Ident(b)) (of class dotty.tools.dotc.ast.untpd$Parens)
	at dotty.tools.dotc.ast.desugar$.patternVar(Desugar.scala:1111)
	at dotty.tools.dotc.typer.Typer.typedArg$1(Typer.scala:1365)
	at dotty.tools.dotc.typer.Typer.$anonfun$23(Typer.scala:1392)
	at dotty.tools.dotc.core.Decorators$ListDecorator$.zipWithConserve$extension(Decorators.scala:110)
	at dotty.tools.dotc.core.Decorators$ListDecorator$.zipWithConserve$extension(Decorators.scala:111)
	at dotty.tools.dotc.typer.Typer.typedAppliedTypeTree(Typer.scala:1392)
	at dotty.tools.dotc.typer.Typer.typedInfixOp(Typer.scala:1956)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2098)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2117)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2104)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2117)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2153)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2165)
	at dotty.tools.dotc.typer.Typer.typedType(Typer.scala:2243)
	at dotty.tools.dotc.typer.Typer.typedTpt$1(Typer.scala:662)
	at dotty.tools.dotc.typer.Typer.handlePattern$1(Typer.scala:664)
	at dotty.tools.dotc.typer.Typer.typedTyped$$anonfun$3(Typer.scala:671)
	at dotty.tools.dotc.typer.Typer.cases$1(Typer.scala:619)
	at dotty.tools.dotc.typer.Typer.typedTyped(Typer.scala:673)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2066)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2117)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2153)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2165)
	at dotty.tools.dotc.typer.Typer.typedPattern(Typer.scala:2245)
	at dotty.tools.dotc.typer.Typer.typedCase(Typer.scala:1169)
	at dotty.tools.dotc.typer.Typer.typedCases$$anonfun$1(Typer.scala:1129)
	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.typedCases(Typer.scala:1129)
	at dotty.tools.dotc.typer.Typer.$anonfun$17(Typer.scala:1123)
	at dotty.tools.dotc.typer.Applications.harmonic(Applications.scala:1880)
	at dotty.tools.dotc.typer.Typer.harmonic(Typer.scala:83)
	at dotty.tools.dotc.typer.Typer.typedMatchFinish(Typer.scala:1123)
	at dotty.tools.dotc.typer.Typer.typedMatch(Typer.scala:1105)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2074)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2117)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2153)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2165)
	at dotty.tools.dotc.typer.Namer.typedAheadExpr$$anonfun$1(Namer.scala:1211)
	at dotty.tools.dotc.typer.Namer.typedAhead(Namer.scala:1201)
	at dotty.tools.dotc.typer.Namer.typedAheadExpr(Namer.scala:1211)
	at dotty.tools.dotc.typer.Namer.rhsType$2(Namer.scala:1346)
	at dotty.tools.dotc.typer.Namer.cookedRhsType$1(Namer.scala:1357)
	at dotty.tools.dotc.typer.Namer.lhsType$1(Namer.scala:1358)
	at dotty.tools.dotc.typer.Namer.inferredType$1(Namer.scala:1369)
	at dotty.tools.dotc.typer.Namer.valOrDefDefSig(Namer.scala:1377)
	at dotty.tools.dotc.typer.Namer$Completer.typeSig(Namer.scala:765)
	at dotty.tools.dotc.typer.Namer$Completer.completeInCreationContext(Namer.scala:886)
	at dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:796)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:257)
	at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:182)
	at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:184)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:397)
	at dotty.tools.dotc.typer.Typer.retrieveSym(Typer.scala:2013)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2038)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2116)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2153)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2165)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2184)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2228)
	at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:1727)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2051)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2116)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2153)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2165)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2184)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2228)
	at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:1852)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2092)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2117)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2153)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2165)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2241)
	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:312)
	at dotty.tools.dotc.typer.FrontEnd.runOn(FrontEnd.scala:109)
	at dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:159)
	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:1350)
	at dotty.tools.dotc.Run.runPhases$5(Run.scala:169)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:177)
	at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
	at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:67)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:184)
	at dotty.tools.dotc.Run.compileSources(Run.scala:121)
	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:178)
	at dotty.tools.dotc.Driver.process(Driver.scala:147)
	at dotty.tools.dotc.Driver.process(Driver.scala:159)
	at dotty.tools.dotc.Driver.main(Driver.scala:186)
	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: 8 s, completed Sep 18, 2019 2:40:44 PM
odersky added a commit that referenced this issue Sep 25, 2019
Fix #7247: Align isVarPattern and patternVar
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