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

MatchError in PatternMatcher$Translator.matchArgsPatternPlan #10958

Closed
letalvoj opened this issue Dec 31, 2020 · 1 comment
Closed

MatchError in PatternMatcher$Translator.matchArgsPatternPlan #10958

letalvoj opened this issue Dec 31, 2020 · 1 comment

Comments

@letalvoj
Copy link

letalvoj commented Dec 31, 2020

Minimized code

Affects 3.0.0-M3

object U:
  def unapply(s:String) = Tuple(s) // specifying the type :Tuple1[String] fixes the issue

object Tst extends App:
  "" match
    case s"${U(u)})" =>

Output (click arrow to expand)

sbt:dotty-simple> compile
[info] compiling 1 Scala source to /Users/vletal/Workspace/Personal/adventofcode/Scadvent Of Code/target/scala-3.0.0-M3/classes ...
[success] Total time: 0 s, completed Dec 31, 2020 11:42:38 AM
sbt:dotty-simple> compile
[info] compiling 1 Scala source to /Users/vletal/Workspace/Personal/adventofcode/Scadvent Of Code/target/scala-3.0.0-M3/classes ...
[info] exception occurred while compiling /Users/vletal/Workspace/Personal/adventofcode/Scadvent Of Code/src/main/scala/AC21.scala
scala.MatchError: List() (of class scala.collection.immutable.Nil$) while compiling /Users/vletal/Workspace/Personal/adventofcode/Scadvent Of Code/src/main/scala/AC21.scala
[error] ## Exception when compiling 2 sources to /Users/vletal/Workspace/Personal/adventofcode/Scadvent Of Code/target/scala-3.0.0-M3/classes
[error] scala.MatchError: List() (of class scala.collection.immutable.Nil$)
[error] dotty.tools.dotc.transform.PatternMatcher$Translator.matchArgsPatternPlan$1(PatternMatcher.scala:260)
[error] dotty.tools.dotc.transform.PatternMatcher$Translator.matchArgsSelectorsPlan$2(PatternMatcher.scala:255)
[error] dotty.tools.dotc.transform.PatternMatcher$Translator.matchArgsPlan$1(PatternMatcher.scala:266)
[error] dotty.tools.dotc.transform.PatternMatcher$Translator.unapplyPlan$3$$anonfun$2(PatternMatcher.scala:338)
[error] dotty.tools.dotc.transform.PatternMatcher$Translator.letAbstract(PatternMatcher.scala:107)
[error] dotty.tools.dotc.transform.PatternMatcher$Translator.unapplyPlan$1(PatternMatcher.scala:366)
[error] dotty.tools.dotc.transform.PatternMatcher$Translator.patternPlan(PatternMatcher.scala:401)
[error] dotty.tools.dotc.transform.PatternMatcher$Translator.matchArgsPatternPlan$1(PatternMatcher.scala:261)
[error] dotty.tools.dotc.transform.PatternMatcher$Translator.matchArgsSelectorsPlan$2(PatternMatcher.scala:255)
[error] dotty.tools.dotc.transform.PatternMatcher$Translator.matchArgsSelectorsPlan$1$$anonfun$1(PatternMatcher.scala:254)
[error] dotty.tools.dotc.transform.PatternMatcher$Translator.letAbstract(PatternMatcher.scala:107)
[error] dotty.tools.dotc.transform.PatternMatcher$Translator.matchArgsSelectorsPlan$2(PatternMatcher.scala:254)
[error] dotty.tools.dotc.transform.PatternMatcher$Translator.matchArgsPlan$1(PatternMatcher.scala:266)
[error] dotty.tools.dotc.transform.PatternMatcher$Translator.matchElemsPlan$1(PatternMatcher.scala:276)
[error] dotty.tools.dotc.transform.PatternMatcher$Translator.unapplySeqPlan$1(PatternMatcher.scala:302)
[error] dotty.tools.dotc.transform.PatternMatcher$Translator.$anonfun$9(PatternMatcher.scala:355)
[error] dotty.tools.dotc.transform.PatternMatcher$Translator.letAbstract(PatternMatcher.scala:107)
[error] dotty.tools.dotc.transform.PatternMatcher$Translator.unapplyPlan$3$$anonfun$2(PatternMatcher.scala:355)
[error] dotty.tools.dotc.transform.PatternMatcher$Translator.letAbstract(PatternMatcher.scala:107)
[error] dotty.tools.dotc.transform.PatternMatcher$Translator.unapplyPlan$1(PatternMatcher.scala:366)
[error] dotty.tools.dotc.transform.PatternMatcher$Translator.patternPlan(PatternMatcher.scala:401)
[error] dotty.tools.dotc.transform.PatternMatcher$Translator.caseDefPlan(PatternMatcher.scala:437)
[error] dotty.tools.dotc.transform.PatternMatcher$Translator.matchPlan$$anonfun$2$$anonfun$1(PatternMatcher.scala:444)
[error] scala.collection.immutable.List.foldRight(List.scala:352)
[error] dotty.tools.dotc.transform.PatternMatcher$Translator.matchPlan$$anonfun$1(PatternMatcher.scala:444)
[error] dotty.tools.dotc.transform.PatternMatcher$Translator.letAbstract(PatternMatcher.scala:107)
[error] dotty.tools.dotc.transform.PatternMatcher$Translator.matchPlan(PatternMatcher.scala:445)
[error] dotty.tools.dotc.transform.PatternMatcher$Translator.translateMatch(PatternMatcher.scala:1011)
[error] dotty.tools.dotc.transform.PatternMatcher.transformMatch(PatternMatcher.scala:41)
[error] dotty.tools.dotc.transform.MegaPhase.goMatch(MegaPhase.scala:779)
[error] dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:369)
[error] dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:429)
[error] dotty.tools.dotc.transform.MegaPhase.transformStat$2(MegaPhase.scala:439)
[error] dotty.tools.dotc.transform.MegaPhase.recur$1(MegaPhase.scala:442)
[error] dotty.tools.dotc.transform.MegaPhase.recur$1(MegaPhase.scala:442)
[error] dotty.tools.dotc.transform.MegaPhase.transformStats(MegaPhase.scala:442)
[error] dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:362)
[error] dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:429)
[error] dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:256)
[error] dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:427)
[error] dotty.tools.dotc.transform.MegaPhase.transformStat$2(MegaPhase.scala:437)
[error] dotty.tools.dotc.transform.MegaPhase.recur$1(MegaPhase.scala:442)
[error] dotty.tools.dotc.transform.MegaPhase.recur$1(MegaPhase.scala:442)
[error] dotty.tools.dotc.transform.MegaPhase.recur$1(MegaPhase.scala:442)
[error] dotty.tools.dotc.transform.MegaPhase.recur$1(MegaPhase.scala:442)
[error] dotty.tools.dotc.transform.MegaPhase.transformStats(MegaPhase.scala:442)
[error] dotty.tools.dotc.transform.MegaPhase.mapPackage$1(MegaPhase.scala:382)
[error] dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:385)
[error] dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:429)
[error] dotty.tools.dotc.transform.MegaPhase.transformUnit(MegaPhase.scala:448)
[error] dotty.tools.dotc.transform.MegaPhase.run(MegaPhase.scala:460)
[error] dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:296)
[error] scala.collection.immutable.List.map(List.scala:246)
[error] dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:297)
[error] dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:185)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
[error] scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
[error] dotty.tools.dotc.Run.runPhases$5(Run.scala:195)
[error] dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:203)
[error] scala.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
[error] dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:67)
[error] dotty.tools.dotc.Run.compileUnits(Run.scala:210)
[error] dotty.tools.dotc.Run.compileSources(Run.scala:146)
[error] dotty.tools.dotc.Run.compile(Run.scala:130)
[error] dotty.tools.dotc.Driver.doCompile(Driver.scala:39)
[error] dotty.tools.xsbt.CompilerBridgeDriver.run(CompilerBridgeDriver.java:88)
[error] dotty.tools.xsbt.CompilerBridge.run(CompilerBridge.java:22)
[error] sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:92)
[error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$7(MixedAnalyzingCompiler.scala:186)
[error] scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
[error] sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:241)
[error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4(MixedAnalyzingCompiler.scala:176)
[error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4$adapted(MixedAnalyzingCompiler.scala:157)
[error] sbt.internal.inc.JarUtils$.withPreviousJar(JarUtils.scala:239)
[error] sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:157)
[error] sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:204)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:573)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:573)
[error] sbt.internal.inc.Incremental$.$anonfun$apply$5(Incremental.scala:173)
[error] sbt.internal.inc.Incremental$.$anonfun$apply$5$adapted(Incremental.scala:171)
[error] sbt.internal.inc.Incremental$$anon$2.run(Incremental.scala:458)
[error] sbt.internal.inc.IncrementalCommon$CycleState.next(IncrementalCommon.scala:116)
[error] sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:56)
[error] sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:52)
[error] sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:261)
[error] sbt.internal.inc.Incremental$.$anonfun$incrementalCompile$8(Incremental.scala:413
[error] sbt.internal.inc.Incremental$.withClassfileManager(Incremental.scala:498)
[error] sbt.internal.inc.Incremental$.incrementalCompile(Incremental.scala:400)
[error] sbt.internal.inc.Incremental$.apply(Incremental.scala:165)
[error] sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:573)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:491)
[error] sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:332)
[error] sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:420)
[error] sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:137)
[error] sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:2176)
[error] sbt.Defaults$.$anonfun$compileIncrementalTask$2(Defaults.scala:2133)
[error] sbt.internal.io.Retry$.apply(Retry.scala:40)
[error] sbt.internal.io.Retry$.apply(Retry.scala:23)
[error] sbt.internal.server.BspCompileTask$.compute(BspCompileTask.scala:31)
[error] sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:2129)
[error] scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error] sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
[error] sbt.std.Transform$$anon$4.work(Transform.scala:68)
[error] sbt.Execute.$anonfun$submit$2(Execute.scala:282)
[error] sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23)
[error] sbt.Execute.work(Execute.scala:291)
[error] sbt.Execute.$anonfun$submit$1(Execute.scala:282)
[error] sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error] sbt.CompletionService$$anon$2.call(CompletionService.scala:64)
[error] java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error] java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
[error] java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
[error] java.lang.Thread.run(Thread.java:748)
[error]            
[error] stack trace is suppressed; run last Compile / compileIncremental for the full output
[error] (Compile / compileIncremental) scala.MatchError: List() (of class scala.collection.immutable.Nil$)
[error] Total time: 0 s, completed Dec 31, 2020 11:42:42 AM
sbt:dotty-simple> 
@liufengyun liufengyun self-assigned this Jan 1, 2021
liufengyun added a commit to dotty-staging/dotty that referenced this issue Jan 4, 2021
liufengyun added a commit to dotty-staging/dotty that referenced this issue Jan 4, 2021
…patmat

This commit refactor the PR scala#5259 so that it will not impact pattern
matching code. Pattern matching code requires members `_N` for
patternMatcher phase to generate correct code.

scala#5259
liufengyun added a commit to dotty-staging/dotty that referenced this issue Jan 4, 2021
…patmat

This commit refactor the PR scala#5259 so that it will not impact pattern
matching code. The phase patternMatcher requires members `_N` for to
generate correct code.

scala#5259
liufengyun added a commit to dotty-staging/dotty that referenced this issue Jan 6, 2021
…patmat

This commit refactor the PR scala#5259 so that it will not impact pattern
matching code. The phase patternMatcher requires members `_N` for to
generate correct code.

scala#5259
liufengyun added a commit to dotty-staging/dotty that referenced this issue Jan 6, 2021
…patmat

This commit refactor the PR scala#5259 so that it will not impact pattern
matching code. The phase patternMatcher requires members `_N` for to
generate correct code.

scala#5259
@dwijnand
Copy link
Member

Fixed in #10987, likely, but definitely fixed in main.

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

3 participants