diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/Errors.java b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/Errors.java index b3ee8b7f91d..716357da6b8 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/Errors.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/Errors.java @@ -424,7 +424,7 @@ public interface Errors { // Control flow / Data flow - DiagnosticFactory0 UNREACHABLE_CODE = DiagnosticFactory0.create(ERROR); + DiagnosticFactory0 UNREACHABLE_CODE = DiagnosticFactory0.create(WARNING); DiagnosticFactory0 VARIABLE_WITH_NO_TYPE_NO_INITIALIZER = DiagnosticFactory0.create(ERROR, NAME_IDENTIFIER); diff --git a/idea/testData/checker/FunctionReturnTypes.kt b/idea/testData/checker/FunctionReturnTypes.kt index 49e458a892a..f10d48a1d5d 100644 --- a/idea/testData/checker/FunctionReturnTypes.kt +++ b/idea/testData/checker/FunctionReturnTypes.kt @@ -48,7 +48,7 @@ fun blockAndAndMismatch1() : Int { return true && false } fun blockAndAndMismatch2() : Int { - (return true) && (return false) + (return true) && (return false) } fun blockAndAndMismatch3() : Int { @@ -58,7 +58,7 @@ fun blockAndAndMismatch4() : Int { return true || false } fun blockAndAndMismatch5() : Int { - (return true) || (return false) + (return true) || (return false) } fun blockReturnValueTypeMatch1() : Int { return if (1 > 2) 1.0 else 2.0 diff --git a/idea/testData/checker/UnreachableCode.kt b/idea/testData/checker/UnreachableCode.kt index 08028200ed5..c8d87582541 100644 --- a/idea/testData/checker/UnreachableCode.kt +++ b/idea/testData/checker/UnreachableCode.kt @@ -1,79 +1,79 @@ fun t1() : Int{ return 0 - 1 + 1 } fun t1a() : Int { return - return 1 - 1 + return 1 + 1 } fun t1b() : Int { return 1 - return 1 - 1 + return 1 + 1 } fun t1c() : Int { return 1 return - 1 + 1 } fun t2() : Int { if (1 > 2) return 1 else return 1 - 1 + 1 } fun t2a() : Int { if (1 > 2) { return 1 - 1 + 1 } else { return 1 - 2 + 2 } - 1 + 1 } fun t3() : Any { if (1 > 2) return 2 else return "" - 1 + 1 } fun t4(a : Boolean) : Int { do { return 1 } - while (a) - 1 + while (a) + 1 } fun t4break(a : Boolean) : Int { do { break } - while (a) + while (a) return 1 } fun t5() : Int { do { return 1 - 2 + 2 } - while (1 > 2) - return 1 + while (1 > 2) + return 1 } fun t6() : Int { while (1 > 2) { return 1 - 2 + 2 } return 1 } @@ -81,7 +81,7 @@ fun t6() : Int { fun t6break() : Int { while (1 > 2) { break - 2 + 2 } return 1 } @@ -89,7 +89,7 @@ fun t6break() : Int { fun t7(b : Int) : Int { for (i in 1..b) { return 1 - 2 + 2 } return 1 } @@ -97,7 +97,7 @@ fun t7(b : Int) : Int { fun t7break(b : Int) : Int { for (i in 1..b) { return 1 - 2 + 2 } return 1 } @@ -105,7 +105,7 @@ fun t7break(b : Int) : Int { fun t7() : Int { try { return 1 - 2 + 2 } catch (e : Any) { 2 @@ -116,36 +116,36 @@ fun t7() : Int { fun t8() : Int { try { return 1 - 2 + 2 } catch (e : Any) { return 1 - 2 + 2 } - return 1 + return 1 } fun blockAndAndMismatch() : Boolean { - (return true) || (return false) - return true + (return true) || (return false) + return true } fun tf() : Int { - try {return 1} finally{return 1} - return 1 + try {return 1} finally{return 1} + return 1 } fun failtest(a : Int) : Int { - if (fail() || true) { + if (fail() || true) { } - return 1 + return 1 } fun foo(a : Nothing) : Unit { 1 a - 2 + 2 } fun fail() : Nothing { diff --git a/idea/testData/checker/When.kt b/idea/testData/checker/When.kt index 33bf192ed99..7b7afdebfc3 100644 --- a/idea/testData/checker/When.kt +++ b/idea/testData/checker/When.kt @@ -36,7 +36,7 @@ fun test() { when (z) { else -> 1 - 1 -> 2 + 1 -> 2 } when (z) { diff --git a/idea/testData/quickfix/when/beforeTwoElseBranchesInWhen.kt b/idea/testData/quickfix/when/beforeTwoElseBranchesInWhen.kt index 4525fbfd3f1..6ff3c7d7e1e 100644 --- a/idea/testData/quickfix/when/beforeTwoElseBranchesInWhen.kt +++ b/idea/testData/quickfix/when/beforeTwoElseBranchesInWhen.kt @@ -1,8 +1,8 @@ // "Move else branch to the end" "false" // ERROR: 'else' entry must be the last one in a when-expression // ERROR: 'else' entry must be the last one in a when-expression -// ERROR: Unreachable code -// ERROR: Unreachable code +// WARNING: Unreachable code +// WARNING: Unreachable code // ACTION: Disable 'Eliminate Argument of 'when'' // ACTION: Disable 'Replace 'when' with 'if'' // ACTION: Edit intention settings