diff options
author | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2015-05-12 18:30:53 +0200 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2015-05-12 18:30:53 +0200 |
commit | 89bacb9c25a58454ff1878e67f7ea07ffc8c269f (patch) | |
tree | 51f1ff6c66aebe1b6109b1cffcc2bb8e4cf760a3 /tests/pending/run/t4415.scala | |
parent | a0fa33deafbea1bf53edc068c5ed9db5592822f9 (diff) | |
download | dotty-89bacb9c25a58454ff1878e67f7ea07ffc8c269f.tar.gz dotty-89bacb9c25a58454ff1878e67f7ea07ffc8c269f.tar.bz2 dotty-89bacb9c25a58454ff1878e67f7ea07ffc8c269f.zip |
Run tests as they were in scala.
Diffstat (limited to 'tests/pending/run/t4415.scala')
-rw-r--r-- | tests/pending/run/t4415.scala | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/tests/pending/run/t4415.scala b/tests/pending/run/t4415.scala new file mode 100644 index 000000000..caf1609b9 --- /dev/null +++ b/tests/pending/run/t4415.scala @@ -0,0 +1,86 @@ +/** + * 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. + */ +object Test { + + def main(args: Array[String]) { + convert(new SubclassProperty) + } + + def convert(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 + /////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + case SubclassMatch(p) => p + case StandardMatch(p) => p + } + } +} + +class TopProperty + +class StandardProperty extends TopProperty +class SubclassProperty extends StandardProperty + +class SecondProperty extends TopProperty +class SubclassSecondProperty extends StandardProperty + +trait MyProp[T] +case class MyPropImpl[T]() extends MyProp[T] + +object SubclassMatch { + + def unapply(prop: SubclassProperty) : Option[MyProp[String]] = { + Some(new MyPropImpl) + } + + def apply(prop: MyProp[String]) : SubclassProperty = { + new SubclassProperty() + } +} + +object StandardMatch { + + def unapply(prop: StandardProperty) : Option[MyProp[String]] = { + Some(new MyPropImpl) + } + + def apply(prop: MyProp[String]) : StandardProperty = { + new StandardProperty() + } +} + +object SubclassSecondMatch { + + def unapply(prop: SubclassSecondProperty) : Option[MyProp[BigInt]] = { + Some(new MyPropImpl) + } + + def apply(prop: MyProp[String]) : SubclassSecondProperty = { + new SubclassSecondProperty() + } +} + +object SecondMatch { + + def unapply(prop: SecondProperty) : Option[MyProp[BigInt]] = { + Some(new MyPropImpl) + } + + def apply(prop: MyProp[String]) : SecondProperty = { + new SecondProperty() + } +}
\ No newline at end of file |