You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running some pattern matchers causes either a compiler crash or at runtime a java.lang.!VerifyError.[[BR]]
Which happens depends on exact structure of pattern match (see below code, or self-contained test file attached).
[[BR]]
/** * Demonstration of issue with Extractors. If lines 15/16 are not present, get at runtime: * * Exception in thread "main" java.lang.VerifyError: (class: ExtractorIssue$$, method: convert signature: (LTopProperty;)LMyProp;) Accessing value from uninitialized register 5 * at ExtractorIssue.main(ExtractorIssue.scala) * at com.intellij.rt.execution.application.AppMain.main(AppMain.java:115)] * * If lines 15/16 are present, the compiler crashes: * * fatal error (server aborted): not enough arguments for method body%3: (val p: MyProp[java.lang.String])MyProp[_33]. * Unspecified value parameter p.*/objectExtractorIssue {
defmain(args: Array[String]) {
convert(newSubclassProperty)
}
defconvert(prop: TopProperty):MyProp[_] = {
prop match {
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////case SubclassSecondMatch(p) => p // if these lines are present, the compiler crashes. If commented, unsafe byte//case SecondMatch(p) => p // byte code is generated, which causes a java.lang.VerifyError at runtime///////////////////////////////////////////////////////////////////////////////////////////////////////////////caseSubclassMatch(p) => p
caseStandardMatch(p) => p
}
}
}
classTopPropertyclassStandardPropertyextendsTopPropertyclassSubclassPropertyextendsStandardPropertyclassSecondPropertyextendsTopPropertyclassSubclassSecondPropertyextendsStandardPropertytraitMyProp[T]
caseclassMyPropImpl[T] extendsMyProp[T]
objectSubclassMatch {
defunapply(prop: SubclassProperty) :Option[MyProp[String]] = {
Some(newMyPropImpl)
}
defapply(prop: MyProp[String]) :SubclassProperty= {
newSubclassProperty()
}
}
objectStandardMatch {
defunapply(prop: StandardProperty) :Option[MyProp[String]] = {
Some(newMyPropImpl)
}
defapply(prop: MyProp[String]) :StandardProperty= {
newStandardProperty()
}
}
objectSubclassSecondMatch {
defunapply(prop: SubclassSecondProperty) :Option[MyProp[BigInt]] = {
Some(newMyPropImpl)
}
defapply(prop: MyProp[String]) :SubclassSecondProperty= {
newSubclassSecondProperty()
}
}
objectSecondMatch {
defunapply(prop: SecondProperty) :Option[MyProp[BigInt]] = {
Some(newMyPropImpl)
}
defapply(prop: MyProp[String]) :SecondProperty= {
newSecondProperty()
}
}
=== What is the expected behavior? ===
Should pattern match.
=== What do you see instead? ===
Crash, of compiler or runtime.
=== Additional information ===
This seems similar to, but also possibly distinct from the following two issues:
@szeiger said:
With -Yvirtpatmat in master (scala-2.10.0.rdev-4208-2012-01-19-g58cb15c) the VerifyError is gone. The compiler crash still occurs with both, the old pattern matcher and the virtualized pattern matcher.
@paulp said:
I find no crash with 2.10.0.rdev-4232-2012-01-22-g9a20086 under -Yvirtpatmat. I doubt it was fixed in that short span. Can you reconfirm it, and post details if it's reproducible? (I did uncomment the lines which are supposed to lead to a crash, and do crash without -Yvirtpatmat.)
@szeiger said:
Sorry, I can't reproduce this anymore. It's compiling just fine under 4208 and 4234 with -Yvirtpatmat. Leaving this ticket open for now because it's not fixed in the old patmat which is still the default.
Running some pattern matchers causes either a compiler crash or at runtime a java.lang.!VerifyError.[[BR]]
Which happens depends on exact structure of pattern match (see below code, or self-contained test file attached).
[[BR]]
=== What is the expected behavior? ===
Should pattern match.
=== What do you see instead? ===
Crash, of compiler or runtime.
=== Additional information ===
This seems similar to, but also possibly distinct from the following two issues:
https://lampsvn.epfl.ch/trac/scala/ticket/3702 [[BR]]
https://lampsvn.epfl.ch/trac/scala/ticket/3972 [[BR]]
=== What versions of the following are you using? ===
The text was updated successfully, but these errors were encountered: