Merge branch master into pr/269

This commit is contained in:
Evgeny Gerashchenko
2013-06-10 17:40:27 +04:00
1342 changed files with 39789 additions and 2594 deletions
@@ -1,11 +0,0 @@
public class MyClass {
public fun f(a: Int): String {
var res: String
if (a == 1) res = "one";
else if (a == 2) res = "two";
else res = "too many";
return res;
}
}
@@ -1,11 +0,0 @@
public class MyClass {
public fun f(a: Int): String {
var res: String
res = if (a == 1) "one";
else if (a == 2) "two";
else "too many";
return res;
}
}
@@ -1,6 +0,0 @@
<html>
<body>
This intention converts assignment with 'if' expression as right-hand side
into 'if' statement where each branch is terminated with assignment to the original variable
</body>
</html>
@@ -0,0 +1,11 @@
when {
n == 1 -> {
res = "one"
}
n == 2 -> {
res = "two"
}
else -> {
res = "???"
}
}
@@ -0,0 +1,11 @@
when (n) {
1 -> {
res = "one"
}
2 -> {
res = "two"
}
else -> {
res = "???"
}
}
@@ -0,0 +1,5 @@
<html>
<body>
This intention eliminates argument of 'when' expression transforming its pattern-matching conditions into boolean expressions
</body>
</html>
@@ -0,0 +1,17 @@
when (n) {
1 -> {
res = "one"
}
2 -> {
res = "two"
}
3 -> {
res = "three"
}
4 -> {
res = "four"
}
else -> {
res = "???"
}
}
@@ -0,0 +1,19 @@
when (n) {
1 -> {
res = "one"
}
2 -> {
res = "two"
}
else -> when (n) {
3 -> {
res = "thress"
}
4 -> {
res = "four"
}
else -> {
res = "???"
}
}
}
@@ -0,0 +1,5 @@
<html>
<body>
This intention merges branches of nested 'when' expression into enclosing one
</body>
</html>
@@ -0,0 +1,5 @@
res = if (ok) {
"ok"
} else {
"failed"
}
@@ -0,0 +1,5 @@
if (ok) {
res = "ok"
} else {
res = "failed"
}
@@ -0,0 +1,5 @@
<html>
<body>
This intention converts 'if' expression where each branch is terminated with assignment into a single assignment with 'if' expression as a right-hand side
</body>
</html>
@@ -0,0 +1,4 @@
if (ok) {
return "ok"
}
return "failed"
@@ -0,0 +1,5 @@
<html>
<body>
This intention converts single-branch 'if' expression immediately followed by 'return' into a single 'return' with 'if' expression as an argument
</body>
</html>
@@ -0,0 +1,5 @@
return if (ok) {
"ok"
} else {
"failed"
}
@@ -0,0 +1,5 @@
if (ok) {
return "ok"
} else {
return "failed"
}
@@ -0,0 +1,5 @@
<html>
<body>
This intention converts 'if' expression where each branch is terminated with 'return' into a single 'return' with 'if' expression as a right-hand side
</body>
</html>
@@ -0,0 +1,5 @@
res = when (n) {
1 -> "one"
2 -> "two"
else -> "many"
}
@@ -0,0 +1,5 @@
when (n) {
1 -> res = "one"
2 -> res = "two"
else -> res = "many"
}
@@ -0,0 +1,5 @@
<html>
<body>
This intention converts 'when' expression where each branch is terminated with assignment into a single assignment with 'when' expression as right-hand side
</body>
</html>
@@ -0,0 +1,5 @@
return when (n) {
1 -> "one"
2 -> "two"
else -> "many"
}
@@ -0,0 +1,5 @@
when (n) {
1 -> return "one"
2 -> return "two"
else -> return "many"
}
@@ -0,0 +1,5 @@
<html>
<body>
This intention converts 'when' expression where each branch is terminated with 'return' into a single 'return' with 'when' expression as a right-hand side
</body>
</html>
@@ -1,11 +0,0 @@
public class MyClass {
public fun f(a: Int): String {
var res: String
res = if (a == 1) "one";
else if (a == 2) "two";
else "too many";
return res;
}
}
@@ -1,11 +0,0 @@
public class MyClass {
public fun f(a: Int): String {
var res: String
if (a == 1) res = "one";
else if (a == 2) res = "two";
else res = "too many";
return res;
}
}
@@ -1,6 +0,0 @@
<html>
<body>
This intention converts 'if' statement where each branch is terminated with assignment to the same variable
into single assignment with 'if' expression
</body>
</html>
@@ -0,0 +1,11 @@
when (n) {
1 -> {
res = "one"
}
2 -> {
res = "two"
}
else -> {
res = "???"
}
}
@@ -0,0 +1,7 @@
if (n == 1) {
res = "one"
} else if (n == 2) {
res = "two"
} else {
res = "???"
}
@@ -0,0 +1,5 @@
<html>
<body>
This intention converts 'if' expression to equivalent 'when' expression
</body>
</html>
@@ -0,0 +1,11 @@
when (n) {
1 -> {
res = "one"
}
2 -> {
res = "two"
}
else -> {
res = "???"
}
}
@@ -0,0 +1,11 @@
when {
n == 1 -> {
res = "one"
}
n == 2 -> {
res = "two"
}
else -> {
res = "???"
}
}
@@ -0,0 +1,5 @@
<html>
<body>
This intention introduces argument into 'when' expression simplifying conditions of its branches
</body>
</html>
@@ -0,0 +1,5 @@
if (ok) {
res = "ok"
} else {
res = "failed"
}
@@ -0,0 +1,5 @@
res = if (ok) {
"ok"
} else {
"failed"
}
@@ -0,0 +1,5 @@
<html>
<body>
This intention converts assignment with 'if' right-hand side to 'if' expression where each branch is terminated with assignment
</body>
</html>
@@ -0,0 +1,5 @@
when (n) {
1 -> res = "one"
2 -> res = "two"
else -> res = "many"
}
@@ -0,0 +1,5 @@
res = when (n) {
1 -> "one"
2 -> "two"
else -> "many"
}
@@ -0,0 +1,5 @@
<html>
<body>
This intention converts assignment with 'when' right-hand side to 'when' expression where each branch is terminated with assignment
</body>
</html>
@@ -0,0 +1,6 @@
val res: String
if (ok) {
res = "ok"
} else {
res = "failed"
}
@@ -0,0 +1,5 @@
val res = if (ok) {
"ok"
} else {
"failed"
}
@@ -0,0 +1,5 @@
<html>
<body>
This intention converts property with 'if' initializer to uninitialized property followed by 'if' expression where each branch is terminated with assignment
</body>
</html>
@@ -0,0 +1,6 @@
val res: String
when (n) {
1 -> res = "one"
2 -> res = "two"
else -> res = "many"
}
@@ -0,0 +1,5 @@
val res = when (n) {
1 -> "one"
2 -> "two"
else -> "many"
}
@@ -0,0 +1,5 @@
<html>
<body>
This intention converts property with 'when' initializer to uninitialized property followed by 'when' expression where each branch is terminated with assignment
</body>
</html>
@@ -0,0 +1,5 @@
if (ok) {
return "ok"
} else {
return "failed"
}
@@ -0,0 +1,5 @@
return if (ok) {
"ok"
} else {
"failed"
}
@@ -0,0 +1,5 @@
<html>
<body>
This intention converts 'return' with 'if' expression as a result to 'if' expression where each branch is terminated with 'return'
</body>
</html>
@@ -0,0 +1,5 @@
when (n) {
1 -> return "one"
2 -> return "two"
else -> return "many"
}
@@ -0,0 +1,5 @@
return when (n) {
1 -> "one"
2 -> "two"
else -> "many"
}
@@ -0,0 +1,5 @@
<html>
<body>
This intention converts 'return' with 'when' expression as a result to 'when' expression where each branch is terminated with 'return'
</body>
</html>
@@ -0,0 +1,7 @@
if (n == 1) {
res = "one"
} else if (n == 2) {
res = "two"
} else {
res = "???"
}
@@ -0,0 +1,11 @@
when (n) {
1 -> {
res = "one"
}
2 -> {
res = "two"
}
else -> {
res = "???"
}
}
@@ -0,0 +1,5 @@
<html>
<body>
This intention converts 'when' expression to one or more 'if' expressions
</body>
</html>