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
"NoSuchElementException: key not found: LabelName<matchAlts1>" with dotty 0.27.0-RC1 #4171
Comments
xuwei-k
referenced
this issue
in scalaz/scalaz
Aug 31, 2020
xuwei-k
changed the title
Could not build scalaz with dotty 0.27.0-RC1
"NoSuchElementException: key not found: LabelName<matchAlts1>" with dotty 0.27.0-RC1
Aug 31, 2020
Thanks for the report. What happens if you enable the IR checker ( Also, what's the output of |
def main;[Ljava.lang.String;V(args: java.lang.String[]) {
matchResult1: {
val x1: any = null;
matchAlts1: {
matchAlts2: {
if (x1.isInstanceOf[java.lang.Integer]) {
return@matchAlts2 (void 0)
};
if (x1.isInstanceOf[java.lang.String]) {
return@matchAlts2 (void 0)
};
return@matchAlts1 (void 0)
};
return@matchResult1 (void 0)
};
throw new scala.MatchError().<init>;Ljava.lang.Object;V(x1)
}
} which seems correct. The IR checker lets it through. Deactivating the optimizer with |
The following test for @Test
def optimizerDoesNotEliminateRequiredLabeledBlockEmittedByDotty_issue4171(): AsyncResult = await {
/*
matchResult1: {
val x1: any = null;
matchAlts1: {
matchAlts2: {
if (x1.isInstanceOf[java.lang.Integer]) {
return@matchAlts2 (void 0)
};
if (x1.isInstanceOf[java.lang.String]) {
return@matchAlts2 (void 0)
};
return@matchAlts1 (void 0)
};
return@matchResult1 (void 0)
};
throw new scala.MatchError().<init>;Ljava.lang.Object;V(x1)
}*/
val matchResult1 = LabelIdent(LabelName("matchResult1"))
val x1 = LocalIdent("x1")
val matchAlts1 = LabelIdent(LabelName("matchAlts1"))
val matchAlts2 = LabelIdent(LabelName("matchAlts2"))
val classDefs = Seq(
mainTestClassDef(Block(
Labeled(matchResult1, NoType, Block(
VarDef(x1, NON, AnyType, mutable = false, Null()),
Labeled(matchAlts1, NoType, Block(
Labeled(matchAlts2, NoType, Block(
If(IsInstanceOf(VarRef(x1)(AnyType), ClassType(BoxedIntegerClass)), {
Return(Undefined(), matchAlts2)
}, Skip())(NoType),
If(IsInstanceOf(VarRef(x1)(AnyType), ClassType(BoxedStringClass)), {
Return(Undefined(), matchAlts2)
}, Skip())(NoType),
Return(Undefined(), matchAlts1)
)),
Return(Undefined(), matchResult1)
)),
Throw(New("java.lang.Exception", NoArgConstructorName, Nil))
))
))
)
testLink(classDefs, MainTestModuleInitializers)
} |
sjrd
added a commit
to sjrd/scala-js
that referenced
this issue
Sep 5, 2020
`tryOptimizePatternMatch` tries to identify `Return`s to a given `Labeled` block, and rearrange the code to get rid of both. It was too liberal in how it did so, as it recognized *any* `Return` in the expected positions. We now specifically verify that the `Return`s are for the particular `Labeled` block that we are optimizing.
sjrd
added a commit
that referenced
this issue
Sep 6, 2020
Fix #4171: Fix a missing condition in tryOptimizePatternMatch.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
step
build.sbt
project/plugins.sbt
project/build.properties
A.scala
execute
sbt fastOptJS
log
original report↓
step with scalaz
log
https://travis-ci.com/github/scalaz/scalaz/jobs/379348358#L11125
The text was updated successfully, but these errors were encountered: