KT-621 Remove .foo() pattern matching from when (Some tests were rewritten)
This commit is contained in:
@@ -2,8 +2,11 @@ class C(val p: Boolean) { }
|
||||
|
||||
fun box(): String {
|
||||
val c = C(true)
|
||||
return when(c) {
|
||||
.p => "OK"
|
||||
else => "fail"
|
||||
}
|
||||
|
||||
// Commented for KT-621
|
||||
// return when(c) {
|
||||
// .p => "OK"
|
||||
// else => "fail"
|
||||
// }
|
||||
return if (c.p) "OK" else "fail"
|
||||
}
|
||||
|
||||
@@ -25,14 +25,25 @@ class Luhny() {
|
||||
|
||||
fun charIn(it : Char) {
|
||||
buffer.addLast(it)
|
||||
when (it) {
|
||||
.isDigit() => digits.addLast(it.int - '0'.int)
|
||||
' ', '-' => {}
|
||||
else => {
|
||||
printAll()
|
||||
digits.clear()
|
||||
}
|
||||
|
||||
// Commented for KT-621
|
||||
// when (it) {
|
||||
// .isDigit() => digits.addLast(it.int - '0'.int)
|
||||
// ' ', '-' => {}
|
||||
// else => {
|
||||
// printAll()
|
||||
// digits.clear()
|
||||
// }
|
||||
// }
|
||||
|
||||
if (it.isDigit()) {
|
||||
digits.addLast(it.int - '0'.int)
|
||||
} else if (it == ' ' || it == '-') {
|
||||
} else {
|
||||
printAll()
|
||||
digits.clear()
|
||||
}
|
||||
|
||||
if (digits.size() > 16)
|
||||
printOneDigit()
|
||||
check()
|
||||
|
||||
@@ -23,11 +23,21 @@ class Luhny() {
|
||||
|
||||
fun process(it : Char) {
|
||||
buffer.addLast(it)
|
||||
when (it) {
|
||||
.isDigit() => digits.addLast(it.int - '0'.int)
|
||||
' ', '-' => {}
|
||||
else => printAll()
|
||||
|
||||
// Commented for KT-621
|
||||
// when (it) {
|
||||
// .isDigit() => digits.addLast(it.int - '0'.int)
|
||||
// ' ', '-' => {}
|
||||
// else => printAll()
|
||||
// }
|
||||
|
||||
if (it.isDigit()) {
|
||||
digits.addLast(it.int - '0'.int)
|
||||
} else if (it == ' ' || it == '-') {
|
||||
} else {
|
||||
printAll()
|
||||
}
|
||||
|
||||
if (digits.size() > 16)
|
||||
printOneDigit()
|
||||
check()
|
||||
|
||||
@@ -24,14 +24,25 @@ class Luhny() {
|
||||
|
||||
fun charIn(it : Char) {
|
||||
buffer.push(it)
|
||||
when (it) {
|
||||
.isDigit() => digits.push(it.int - '0'.int)
|
||||
' ', '-' => {}
|
||||
else => {
|
||||
printAll()
|
||||
digits.clear()
|
||||
}
|
||||
|
||||
// Commented for KT-621
|
||||
// when (it) {
|
||||
// .isDigit() => digits.push(it.int - '0'.int)
|
||||
// ' ', '-' => {}
|
||||
// else => {
|
||||
// printAll()
|
||||
// digits.clear()
|
||||
// }
|
||||
// }
|
||||
|
||||
if (it.isDigit()) {
|
||||
digits.push(it.int - '0'.int)
|
||||
} else if (it == ' ' || it == '-') {
|
||||
} else {
|
||||
printAll()
|
||||
digits.clear()
|
||||
}
|
||||
|
||||
if (digits.size() > 16)
|
||||
printOneDigit()
|
||||
check()
|
||||
|
||||
Reference in New Issue
Block a user