Add "Remove argument" quick fix for TOO_MANY_ARGUMENTS

#KT-34026 Fixed
#KT-34332 Fixed
This commit is contained in:
Toshiaki Kameyama
2019-12-13 08:48:04 +01:00
committed by Vladimir Dolzhenko
parent 13afb2e45e
commit d54a35ef56
16 changed files with 187 additions and 0 deletions
@@ -4,6 +4,7 @@
// ACTION: Create secondary constructor
// ERROR: Too many arguments for public constructor Foo(a: Int) defined in Foo
// ACTION: Put arguments on separate lines
// ACTION: Remove argument
// ACTION: To raw string literal
class Foo(a: Int)
@@ -1,6 +1,7 @@
// "Create secondary constructor" "false"
// ACTION: Add parameter to constructor 'A'
// ACTION: Create function 'A'
// ACTION: Remove argument
// ERROR: No type arguments expected for constructor A()
// ERROR: Too many arguments for public constructor A() defined in A
@@ -1,6 +1,7 @@
// "Create secondary constructor" "false"
// ERROR: Too many arguments for public constructor Any() defined in kotlin.Any
// WITH_RUNTIME
// ACTION: Remove argument
interface T {
@@ -2,6 +2,7 @@
// ACTION: Add parameter to constructor 'A'
// ACTION: Change type of 'b' to 'A'
// ACTION: Create function 'A'
// ACTION: Remove argument
// ERROR: Type mismatch: inferred type is A but B was expected
// ERROR: Too many arguments for public constructor A() defined in A
+10
View File
@@ -0,0 +1,10 @@
// "Remove argument" "true"
class Bar(s: String, i: Int) {
fun foo(s: String) {
}
}
fun main() {
val b = Bar("2", 1, "2"<caret>)
}
@@ -0,0 +1,10 @@
// "Remove argument" "true"
class Bar(s: String, i: Int) {
fun foo(s: String) {
}
}
fun main() {
val b = Bar("2", 1)
}
+10
View File
@@ -0,0 +1,10 @@
// "Remove argument" "true"
class Bar(s: String, i: Int) {
fun foo(s: String) {
}
}
fun main() {
val b = Bar("2", 1)
b.foo("a", 1<caret>)
}
+10
View File
@@ -0,0 +1,10 @@
// "Remove argument" "true"
class Bar(s: String, i: Int) {
fun foo(s: String) {
}
}
fun main() {
val b = Bar("2", 1)
b.foo("a")
}
+10
View File
@@ -0,0 +1,10 @@
// "Remove argument" "true"
class Bar(s: String, i: Int) {
fun foo(s: String) {
}
}
fun main() {
val b = Bar("2", 1)
b.foo("a") {}<caret>
}
@@ -0,0 +1,10 @@
// "Remove argument" "true"
class Bar(s: String, i: Int) {
fun foo(s: String) {
}
}
fun main() {
val b = Bar("2", 1)
b.foo("a")
}
@@ -0,0 +1,16 @@
// "Remove argument" "false"
// ACTION: Add 'i =' to argument
// ACTION: Convert to also
// ACTION: Convert to apply
// ACTION: Convert to run
// ACTION: Convert to with
// ACTION: Put arguments on separate lines
class Bar() {
fun foo(s: String, i: Int) {
}
}
fun main() {
val b = Bar()
b.foo("a", 1<caret>)
}
+18
View File
@@ -0,0 +1,18 @@
// "Remove argument" "false"
// ACTION: Add 'toString()' call
// ACTION: Change parameter 't' type of function 'foo' to 'Int'
// ACTION: Convert to also
// ACTION: Convert to apply
// ACTION: Convert to run
// ACTION: Convert to with
// ACTION: Put arguments on separate lines
// ERROR: The integer literal does not conform to the expected type String
class Bar() {
fun foo(s: String, vararg t: String) {
}
}
fun main() {
val b = Bar()
b.foo("a", "b", 1<caret>)
}