1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
|
enum Tree<T> {
Leaf(t:T);
Node(l:Tree<T>, r:Tree<T>);
}
class Main {
static function main() {
}
function testRedundance() {
switch(true) {
case false:
case true:
case false: // unused
}
switch(true) {
case false | true:
case true: // unused
case false: // unused
}
switch(true) {
case false
| false: // unused
case true:
}
switch(Leaf("foo")) {
case Leaf(_)
| Leaf("foo"): // unused
case Node(l,r):
}
switch({s:"foo"}) {
case { s : "foo" } :
case { s : a } :
}
switch( { s:"foo", t:"bar" } ) {
case { s : "foo" }:
case { t : "bar" }:
case { s : "foo", t:"bar" }: // unused
case _:
}
switch ("foo") {
case "foo":
case x = "foo": // unused
}
switch ("foo") {
case x = "foo":
case "foo": // unused
}
switch [true] {
case [true]:
case [true]: // unused
case [false]:
}
switch [true] {
case [true]
| [true]: // unused
case [false]:
}
}
}
|