diff options
author | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2014-12-01 15:40:33 +0100 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2014-12-16 13:15:01 +0100 |
commit | f78ef2ca72a1b70db98fa9f6a44bf81d33f3ff28 (patch) | |
tree | e3a734f405964f39d8cf8d38fd2f72264f868178 | |
parent | 3943aa8359b1e8f5109a616504b8677232ae78c5 (diff) | |
download | dotty-f78ef2ca72a1b70db98fa9f6a44bf81d33f3ff28.tar.gz dotty-f78ef2ca72a1b70db98fa9f6a44bf81d33f3ff28.tar.bz2 dotty-f78ef2ca72a1b70db98fa9f6a44bf81d33f3ff28.zip |
Label test with nested cycles and simple patterns.
-rw-r--r-- | test/dotc/tests.scala | 1 | ||||
-rw-r--r-- | tests/pos/Labels.scala | 21 |
2 files changed, 22 insertions, 0 deletions
diff --git a/test/dotc/tests.scala b/test/dotc/tests.scala index fc15d3a30..2fe6be757 100644 --- a/test/dotc/tests.scala +++ b/test/dotc/tests.scala @@ -130,6 +130,7 @@ class tests extends CompilerTest { @Test def tools_io = compileDir(dotcDir + "tools/io", twice) @Test def helloWorld = compileFile(posDir, "HelloWorld", doEmitBytecode) + @Test def labels = compileFile(posDir, "Labels", doEmitBytecode) //@Test def tools = compileDir(dotcDir + "tools", "-deep" :: Nil)(allowDeepSubtypes) @Test def testNonCyclic = compileArgs(Array( diff --git a/tests/pos/Labels.scala b/tests/pos/Labels.scala new file mode 100644 index 000000000..4a84175af --- /dev/null +++ b/tests/pos/Labels.scala @@ -0,0 +1,21 @@ +object Labels { + def main(args: Array[String]): Unit = { + var i = 10 + while(i>0) { + var j = 0 + while(j<i) { + println(j+" " + i) + j = j +1 + } + i = i - 1} + pattern(1) + pattern(2) + pattern(3) + } + + def pattern(a: Int) = a match { + case 1 if (a>0) => println("one") + case t@2 => println("two" + t) + case _ => println("default") + } +} |