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,6 +1,12 @@
// "Add '<*, *>'" "false"
// "Add '<*>'" "false"
// ERROR: 2 type arguments expected
// ACTION: Disable 'Eliminate Argument of 'when''
// ACTION: Disable 'Replace 'when' with 'if''
// ACTION: Edit intention settings
// ACTION: Edit intention settings
// ACTION: Eliminate argument of 'when'
// ACTION: Replace 'when' with 'if'
public fun foo(a: Any) {
when (a) {
is <caret>Map<Int> -> {}
@@ -0,0 +1,6 @@
// "Add name to argument: 'b = "FOO"'" "true"
fun f(a: Int, b: String) {}
fun g() {
f(a = 10, b = "FOO")
}
@@ -0,0 +1,6 @@
// "Add name to argument: 'b = "FOO"'" "true"
class A(a: Int, b: String) {}
fun f() {
A(a = 1, b = "FOO")
}
@@ -0,0 +1,6 @@
// "Add name to argument..." "true"
fun f(a: Int, b: String = "b", c: String = "c") {}
fun g() {
f(a = 10, b = "FOO")
}
@@ -0,0 +1,8 @@
// "Add name to argument: 'b = B()'" "true"
open class A {}
open class B : A() {}
fun f(a: Int, b: A) {}
fun g() {
f(a=1, b = B())
}
@@ -0,0 +1,6 @@
// "Add name to argument: 'b = "FOO"'" "true"
fun f(a: String, b: String) {}
fun g() {
f(a = "BAR", b = "FOO")
}
@@ -0,0 +1,6 @@
// "Add name to argument: 'b = "FOO"'" "true"
fun f(a: String, x: Int, b: String) {}
fun g() {
f("BAR", x = 10, b = "FOO")
}
@@ -0,0 +1,6 @@
// "Add name to argument: 'b = "FOO"'" "true"
fun f(a: Int, b: String) {}
fun g() {
f(a = 10, <caret>"FOO")
}
@@ -0,0 +1,6 @@
// "Add name to argument: 'b = "FOO"'" "true"
class A(a: Int, b: String) {}
fun f() {
A(a = 1, <caret>"FOO")
}
@@ -0,0 +1,6 @@
// "Add name to argument..." "true"
fun f(a: Int, b: String = "b", c: String = "c") {}
fun g() {
f(a = 10, <caret>"FOO")
}
@@ -0,0 +1,8 @@
// "Add name to argument: 'b = B()'" "true"
open class A {}
open class B : A() {}
fun f(a: Int, b: A) {}
fun g() {
f(a=1, <caret>B())
}
@@ -0,0 +1,6 @@
// "Add name to argument: 'b = "FOO"'" "true"
fun f(a: String, b: String) {}
fun g() {
f(a = "BAR", <caret>"FOO")
}
@@ -0,0 +1,6 @@
// "Add name to argument: 'b = "FOO"'" "true"
fun f(a: String, x: Int, b: String) {}
fun g() {
f("BAR", x = 10, <caret>"FOO")
}
@@ -0,0 +1,8 @@
// "Add 'open fun f()' to 'A'" "true"
open class A {
open fun f() {
}
}
class B : A() {
<caret>override fun f() {}
}
@@ -0,0 +1,7 @@
// "Add 'abstract fun f()' to 'A'" "true"
abstract class A {
abstract fun f()
}
class B : A() {
<caret>override fun f() {}
}
@@ -0,0 +1,8 @@
// "Add 'open fun f()' to 'A'" "true"
trait A
{
open fun f()
}
class B : A {
<caret>override fun f() {}
}
@@ -0,0 +1,9 @@
// "Add 'open fun f(): Int' to 'A'" "true"
open class A {
open fun f(): Int {
throw UnsupportedOperationException()
}
}
class B : A() {
<caret>override fun f(): Int = 5
}
@@ -0,0 +1,7 @@
// "Add 'open fun f()' to 'A'" "true"
trait A {
open fun f()
}
class B : A {
<caret>override fun f() {}
}
@@ -0,0 +1,10 @@
// "Add function to supertype..." "true"
open class A {
}
open class B : A() {
open fun f() {
}
}
class C : B() {
<caret>override fun f() {}
}
@@ -0,0 +1,8 @@
// "Add function to supertype..." "true"
trait A {
open fun foo()
}
trait B {}
class C: A, B {
<caret>override fun foo() {}
}
@@ -0,0 +1,8 @@
// "Change function signature to 'override fun f(a: Int, x: T)'" "true"
trait A<R> {
fun f(a: Int, b: R)
}
class B<T> : A<T> {
<caret>override fun f(a: Int, x: T) {}
}
@@ -0,0 +1,11 @@
// "Change function signature to 'override fun f(a: Int)'" "true"
trait A {
fun f(a: Int)
}
trait B : A {
}
class C : B {
override fun f(a: Int) {}
}
@@ -0,0 +1,11 @@
// "Change function signature to 'override fun f(a: Int)'" "true"
open class A {
open fun f(a: Int) {}
}
open class B : A() {
}
class C : B() {
<caret>override fun f(a: Int) {}
}
@@ -1,11 +0,0 @@
// "Change function signature to 'override fun f(a: Int)'" "false"
// ERROR: 'f' overrides nothing
// ACTION: Remove 'override' modifier
open class A {
open fun foo() {}
fun f(a: Int) {}
}
class B : A(){
<caret>override fun f(a: String) {}
}
@@ -0,0 +1,8 @@
// "Change function signature to 'override fun f(y: S, x: List<Set<R>>)'" "true"
trait A<P,Q> {
fun f(a: Q, b: List<Set<P>>)
}
class B<R,S> : A<R,S> {
<caret>override fun f(y: S, x: List<Set<R>>) {}
}
@@ -0,0 +1,6 @@
// "Add 'open fun f()' to 'A'" "true"
open class A {
}
class B : A() {
<caret>override fun f() {}
}
@@ -0,0 +1,6 @@
// "Add 'abstract fun f()' to 'A'" "true"
abstract class A {
}
class B : A() {
<caret>override fun f() {}
}
@@ -0,0 +1,5 @@
// "Add 'open fun f()' to 'A'" "true"
trait A
class B : A {
<caret>override fun f() {}
}
@@ -0,0 +1,6 @@
// "Add 'open fun f(): Int' to 'A'" "true"
open class A {
}
class B : A() {
<caret>override fun f(): Int = 5
}
@@ -0,0 +1,6 @@
// "Add 'open fun f()' to 'A'" "true"
trait A {
}
class B : A {
<caret>override fun f() {}
}
@@ -0,0 +1,8 @@
// "Add function to supertype..." "true"
open class A {
}
open class B : A() {
}
class C : B() {
<caret>override fun f() {}
}
@@ -0,0 +1,6 @@
// "Add function to supertype..." "true"
trait A {}
trait B {}
class C: A, B {
<caret>override fun foo() {}
}
@@ -0,0 +1,8 @@
// "Change function signature to 'override fun f(a: Int, x: T)'" "true"
trait A<R> {
fun f(a: Int, b: R)
}
class B<T> : A<T> {
<caret>override fun f(x: T) {}
}
@@ -0,0 +1,11 @@
// "Change function signature to 'override fun f(a: Int)'" "true"
trait A {
fun f(a: Int)
}
trait B : A {
}
class C : B {
<caret>override fun f() {}
}
@@ -0,0 +1,11 @@
// "Change function signature to 'override fun f(a: Int)'" "true"
open class A {
open fun f(a: Int) {}
}
open class B : A() {
}
class C : B() {
<caret>override fun f() {}
}
@@ -1,5 +1,6 @@
// "Change function signature to 'override fun f(a: Int)'" "false"
// ERROR: 'f' overrides nothing
// ACTION: Add 'open fun f(a: String)' to 'A'
// ACTION: Remove 'override' modifier
open class A {
open fun foo() {}
@@ -0,0 +1,8 @@
// "Change function signature to 'override fun f(y: S, x: List<Set<R>>)'" "true"
trait A<P,Q> {
fun f(a: Q, b: List<Set<P>>)
}
class B<R,S> : A<R,S> {
<caret>override fun f(x: List<Set<R>>, y: S) {}
}
@@ -0,0 +1,12 @@
// "Change 'B.x' type to '(Int) -> Int'" "true"
trait A {
val x: (Int) -> Int
}
trait B {
val x: (Int) -> Int
}
trait C : A, B {
override val x: (Int) -> Int<caret>
}
@@ -0,0 +1,12 @@
// "Change 'A.x' type to 'String'" "true"
trait A {
var x: String
}
trait B {
var x: String
}
trait C : A, B {
override var x: String<caret>
}
@@ -0,0 +1,7 @@
// "Change 'B.x' type to '(String) -> Int'" "true"
trait A {
var x: (String) -> Int
}
trait B : A {
override var x: (String) -> Int
}
@@ -0,0 +1,12 @@
// "Change 'A.foo' function return type to 'Long'" "true"
trait A {
fun foo(): Long
}
trait B {
fun foo(): Number
}
trait C : A, B {
override fun foo(): Long<caret>
}
@@ -1,4 +1,4 @@
// "Change 'x' type to 'Int'" "true"
// "Change 'A.x' type to 'Int'" "true"
trait X {
val x: Int
}
@@ -1,4 +1,4 @@
// "Change 'x' type to 'Int'" "true"
// "Change 'B.x' type to 'Int'" "true"
abstract class A {
abstract var x : Int
}
@@ -1,4 +1,4 @@
// "Change 'x' type to 'Int'" "true"
// "Change 'B.x' type to 'Int'" "true"
abstract class A {
abstract var x : Int
}
@@ -0,0 +1,14 @@
// "Change 'A.x' type to '(Int) -> Int'" "false"
// ACTION: Change 'C.x' type to '(String) -> Int'
// ERROR: <html>Return type is '(jet.Int) &rarr; jet.Int', which is not a subtype of overridden<br/><b>internal</b> <b>abstract</b> <b>val</b> x: (jet.String) &rarr; jet.Int <i>defined in</i> A</html>
trait A {
val x: (String) -> Int
}
trait B {
val x: (String) -> Any
}
trait C : A, B {
override val x: (Int) -> Int<caret>
}
@@ -0,0 +1,13 @@
// "Change 'A.x' type to 'String'" "false"
// ERROR: <html>Var-property type is 'jet.String', which is not a type of overridden<br/><b>internal</b> <b>abstract</b> <b>var</b> x: jet.Int <i>defined in</i> A</html>
trait A {
var x: Int
}
trait B {
var x: Any
}
trait C : A, B {
override var x: String<caret>
}
@@ -0,0 +1,13 @@
// "Change 'C.x' type to 'String'" "false"
// ERROR: <html>Var-property type is 'jet.Int', which is not a type of overridden<br/><b>internal</b> <b>abstract</b> <b>var</b> x: jet.String <i>defined in</i> A</html>
trait A {
var x: String
}
trait B {
var x: Any
}
trait C : A, B {
override var x: Int<caret>
}
@@ -0,0 +1,13 @@
// "Change 'A.foo' function return type to 'Long'" "false"
// ERROR: <html>Return type is 'jet.Long', which is not a subtype of overridden<br/><b>internal</b> <b>abstract</b> <b>fun</b> foo(): jet.Int <i>defined in</i> A</html>
trait A {
fun foo(): Int
}
trait B {
fun foo(): String
}
trait C : A, B {
override fun foo(): Long
}
@@ -0,0 +1,12 @@
// "Change 'B.x' type to '(Int) -> Int'" "true"
trait A {
val x: (Int) -> Int
}
trait B {
val x: (String) -> Any
}
trait C : A, B {
override val x: (Int) -> Int<caret>
}
@@ -0,0 +1,12 @@
// "Change 'A.x' type to 'String'" "true"
trait A {
var x: Int
}
trait B {
var x: String
}
trait C : A, B {
override var x: String<caret>
}
@@ -0,0 +1,7 @@
// "Change 'B.x' type to '(String) -> Int'" "true"
trait A {
var x: (String) -> Int
}
trait B : A {
override var x: (Int) -> String<caret>
}
@@ -0,0 +1,12 @@
// "Change 'A.foo' function return type to 'Long'" "true"
trait A {
fun foo(): Int
}
trait B {
fun foo(): Number
}
trait C : A, B {
override fun foo(): Long<caret>
}
@@ -1,4 +1,4 @@
// "Change 'x' type to 'Int'" "true"
// "Change 'A.x' type to 'Int'" "true"
trait X {
val x: Int
}
@@ -1,4 +1,4 @@
// "Change 'x' type to 'Int'" "true"
// "Change 'B.x' type to 'Int'" "true"
abstract class A {
abstract var x : Int
}
@@ -1,4 +1,4 @@
// "Change 'x' type to 'Int'" "true"
// "Change 'B.x' type to 'Int'" "true"
abstract class A {
abstract var x : Int
}
@@ -0,0 +1,5 @@
// "Change getter type to (String) -> Int" "true"
class A {
val x: (String) -> Int
get(): (String) -> Int<caret> = {42}
}
@@ -0,0 +1,5 @@
// "Change getter type to (String) -> Int" "true"
class A {
val x: (String) -> Int
get(): Int<caret> = {42}
}
@@ -0,0 +1,6 @@
// "Change type from 'String' to '(Int) -> String'" "true"
fun foo(f: ((Int) -> String) -> String) {
foo {
(f: (Int) -> String<caret>) -> f(42)
}
}
@@ -0,0 +1,3 @@
// "Change 'bar' function return type to 'String'" "true"
fun bar(): String = ""
fun foo(): String = bar(<caret>)
@@ -0,0 +1,4 @@
// "Change 'f' type to '(Long) -> Unit'" "true"
fun foo() {
var f: (Long) -> Unit = if (true) { (x: Long) -> }<caret> else { (x: Long) -> }
}
@@ -0,0 +1,6 @@
// "Change type from 'String' to '(Int) -> String'" "true"
fun foo(f: ((Int) -> String) -> String) {
foo {
(f: String<caret>) -> f(42)
}
}
@@ -0,0 +1,3 @@
// "Change 'bar' function return type to 'String'" "true"
fun bar(): Any = ""
fun foo(): String = bar(<caret>)
@@ -0,0 +1,10 @@
// "Change 'B.x' type to '(String) -> [ERROR : Ay]'" "false"
// ACTION: Change 'A.x' type to '(Int) -> Int'
// ERROR: <html>Return type is '(jet.Int) &rarr; jet.Int', which is not a subtype of overridden<br/><b>internal</b> <b>abstract</b> <b>val</b> x: (jet.String) &rarr; [ERROR : Ay] <i>defined in</i> A</html>
// ERROR: Unresolved reference: Ay
trait A {
val x: (String) -> Ay
}
trait B : A {
override val x: (Int) -> Int<caret>
}
@@ -0,0 +1,4 @@
// "Change 'f' type to '(Long) -> Unit'" "true"
fun foo() {
var f: Int = if (true) { (x: Long) -> }<caret> else { (x: Long) -> }
}
@@ -0,0 +1,4 @@
// "Cast expression 'x' to '() -> Int'" "true"
fun foo(x: Any): () -> Int {
return x as () -> Int<caret>
}
@@ -0,0 +1,4 @@
// "Cast expression 'x' to '() -> Int'" "true"
fun foo(x: Any): () -> Int {
return x<caret>
}
@@ -0,0 +1,7 @@
// "Change 'A.not' function return type to 'A'" "true"
trait A {
fun not(): A
fun times(a: A): A
}
fun foo(a: A): A = a * <caret>!(if (true) a else a)
@@ -0,0 +1,8 @@
// "Change 'A.plus' function return type to '() -> Int'" "true"
trait A {
fun plus(a: A): () -> Int
}
fun foo(a: A): () -> Int {
return a + a<caret>
}
@@ -0,0 +1,6 @@
// "Change parameter 'a' type of function 'A.times' to 'String'" "true"
trait A {
fun times(a: String): A
}
fun foo(a: A): A = a * <caret>""
@@ -0,0 +1,7 @@
// "Change 'A.not' function return type to 'A'" "true"
trait A {
fun not(): String
fun times(a: A): A
}
fun foo(a: A): A = a * <caret>!(if (true) a else a)
@@ -0,0 +1,8 @@
// "Change 'A.plus' function return type to '() -> Int'" "true"
trait A {
fun plus(a: A): String
}
fun foo(a: A): () -> Int {
return a + a<caret>
}
@@ -0,0 +1,6 @@
// "Change parameter 'a' type of function 'A.times' to 'String'" "true"
trait A {
fun times(a: A): A
}
fun foo(a: A): A = a * <caret>""
@@ -0,0 +1,5 @@
// "Change parameter 'x' type of function 'bar.foo' to '(String) -> Int'" "true"
package bar
fun foo(w: Int = 0, x: (String) -> Int, y: Int = 0, z: (Int) -> Int = {42}) {
foo(1, {(a: String) -> 42}<caret>, 1)
}
@@ -0,0 +1,4 @@
// "Change parameter 'y' type of function 'foo' to 'String'" "true"
fun foo(v: Int, w: Int = 0, x: Int = 0, y: String, z: (Int) -> Int = {42}) {
foo(0, 1, y = ""<caret>)
}
@@ -0,0 +1,4 @@
// "Change parameter 'z' type of function 'foo' to '(Int) -> Unit'" "true"
fun foo(w: Int = 0, x: Int, y: Int = 0, z: (Int) -> Unit) {
foo(0, 1) {<caret>}
}
@@ -0,0 +1,5 @@
// "Change parameter 'a' type of primary constructor of class 'B' to 'String'" "true"
class B(val a: String)
fun foo() {
B(if (true) ""<caret> else "")
}
@@ -0,0 +1,5 @@
// "Change parameter 'x' type of function 'bar.foo' to '(String) -> Int'" "true"
package bar
fun foo(w: Int = 0, x: Int, y: Int = 0, z: (Int) -> Int = {42}) {
foo(1, {(a: String) -> 42}<caret>, 1)
}
@@ -0,0 +1,4 @@
// "Change parameter 'y' type of function 'foo' to 'String'" "true"
fun foo(v: Int, w: Int = 0, x: Int = 0, y: Int, z: (Int) -> Int = {42}) {
foo(0, 1, y = ""<caret>)
}
@@ -0,0 +1,4 @@
// "Change parameter 'z' type of function 'foo' to '(Int) -> Unit'" "true"
fun foo(w: Int = 0, x: Int, y: Int = 0, z: (Int) -> String) {
foo(0, 1) {<caret>}
}
@@ -0,0 +1,8 @@
// "Change parameter 'z' type of function 'foo' to '(Int) -> String'" "false"
// ERROR: <html>Type mismatch.<table><tr><td>Required:</td><td>jet.Int</td></tr><tr><td>Found:</td><td>jet.String</td></tr></table></html>
fun foo(y: Int = 0, z: (Int) -> String = {""}) {
foo {
""<caret>: Int
""
}
}
@@ -0,0 +1,5 @@
// "Change parameter 'y' type of function 'foo' to 'Int'" "false"
// ERROR: <html>Type mismatch.<table><tr><td>Required:</td><td>jet.Int</td></tr><tr><td>Found:</td><td>jet.String</td></tr></table></html>
fun foo(y: Int = 0, z: (Int) -> String = {""}) {
foo(""<caret>: Int)
}
@@ -0,0 +1,5 @@
// "Change parameter 'a' type of primary constructor of class 'B' to 'String'" "true"
class B(val a: Int)
fun foo() {
B(if (true) ""<caret> else "")
}
@@ -0,0 +1,7 @@
// "Change 'f' type to '() -> Unit'" "true"
fun foo() {
val f: () -> Unit = {
var x = 1
x += 21<caret>
}
}
@@ -0,0 +1,7 @@
// "Change function literal return type to 'String'" "true"
fun foo(f: (String) -> Any) {
foo {
(s: String): String ->
s<caret>
}
}
@@ -0,0 +1,7 @@
// "Change function literal return type to 'String'" "true"
fun foo() {
val f: (String) -> String = {
(s: Any): String ->
""<caret>
}
}
@@ -0,0 +1,4 @@
// "Change 'foo' function return type to '(Long) -> Int'" "true"
fun foo(x: Any): (Long) -> Int {
return {(x: Long) -> 42}<caret>
}
@@ -0,0 +1,4 @@
// "Change 'foo' function return type to '() -> Any'" "true"
fun foo(x: Any): () -> Any {
return {x<caret>}
}
@@ -0,0 +1,7 @@
// "Change 'bar' type to '(() -> Long) -> Unit'" "true"
fun foo() {
val bar: (() -> Long) -> Unit = {
(f: () -> Long): Unit ->
var x = 5<caret>
}
}
@@ -0,0 +1,6 @@
// "Change 'A.x' type to '() -> Int'" "true"
class A {
var x: () -> Int
get(): () -> Int = if (true) { {42}<caret> } else { {24} }
set(i: () -> Int) {}
}
@@ -0,0 +1,6 @@
// "Change parameter 'f' type of function 'foo' to '() -> String'" "true"
fun foo(f: () -> String) {
foo {
""<caret>
}
}

Some files were not shown because too many files have changed in this diff Show More