Skip to content

Commit b649129

Browse files
committed
Label test with nested cycles and simple patterns.
1 parent 2c8cf8b commit b649129

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

test/dotc/tests.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ class tests extends CompilerTest {
127127
@Test def tools_io = compileDir(dotcDir + "tools/io", twice)
128128

129129
@Test def helloWorld = compileFile(posDir, "HelloWorld", doEmitBytecode)
130+
@Test def labels = compileFile(posDir, "Labels", doEmitBytecode)
130131
//@Test def tools = compileDir(dotcDir + "tools", "-deep" :: Nil)(allowDeepSubtypes)
131132

132133
@Test def testNonCyclic = compileArgs(Array(

tests/pos/Labels.scala

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
object Labels {
2+
def main(args: Array[String]): Unit = {
3+
var i = 10
4+
while(i>0) {
5+
var j = 0
6+
while(j<i) {
7+
println(j+" " + i)
8+
j = j +1
9+
}
10+
i = i - 1}
11+
pattern(1)
12+
pattern(2)
13+
pattern(3)
14+
}
15+
16+
def pattern(a: Int) = a match {
17+
case 1 if (a>0) => println("one")
18+
case t@2 => println("two" + t)
19+
case _ => println("default")
20+
}
21+
}

0 commit comments

Comments
 (0)