Add inspections for implicit and explicit 'this' #KT-4580 Fixed
This commit is contained in:
@@ -0,0 +1 @@
|
||||
org.jetbrains.kotlin.idea.inspections.ExplicitThisInspection
|
||||
@@ -0,0 +1,12 @@
|
||||
// WITH_RUNTIME
|
||||
// PROBLEM: none
|
||||
|
||||
class Foo {
|
||||
val s = ""
|
||||
|
||||
fun test() {
|
||||
Foo().apply {
|
||||
<caret>this@Foo.s
|
||||
}
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// WITH_RUNTIME
|
||||
// PROBLEM: none
|
||||
|
||||
class Foo {
|
||||
fun test() {
|
||||
Foo().apply {
|
||||
<caret>this@Foo.s()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Foo.s() {}
|
||||
@@ -0,0 +1,16 @@
|
||||
// WITH_RUNTIME
|
||||
// PROBLEM: none
|
||||
|
||||
class Foo {
|
||||
val s = ""
|
||||
|
||||
fun test() {
|
||||
Bar().apply {
|
||||
<caret>this@Foo.s
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Bar {
|
||||
val s = ""
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// WITH_RUNTIME
|
||||
// PROBLEM: none
|
||||
|
||||
class Foo {
|
||||
fun test() {
|
||||
Bar().apply {
|
||||
<caret>this@Foo.s()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Bar
|
||||
|
||||
|
||||
fun Foo.s() {}
|
||||
fun Bar.s() {}
|
||||
@@ -0,0 +1,7 @@
|
||||
class Foo {
|
||||
fun test() {
|
||||
<caret>this.s()
|
||||
}
|
||||
}
|
||||
|
||||
fun Foo.s() = ""
|
||||
@@ -0,0 +1,7 @@
|
||||
class Foo {
|
||||
fun test() {
|
||||
<caret>s()
|
||||
}
|
||||
}
|
||||
|
||||
fun Foo.s() = ""
|
||||
@@ -0,0 +1,7 @@
|
||||
class Foo {
|
||||
fun s() = ""
|
||||
|
||||
fun test() {
|
||||
<caret>this.s()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
class Foo {
|
||||
fun s() = ""
|
||||
|
||||
fun test() {
|
||||
<caret>s()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
class Foo {
|
||||
val s = ""
|
||||
|
||||
fun test() {
|
||||
"".apply {
|
||||
<caret>this@Foo.s
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
class Foo {
|
||||
val s = ""
|
||||
|
||||
fun test() {
|
||||
"".apply {
|
||||
<caret>s
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
class Foo {
|
||||
fun test() {
|
||||
"".apply {
|
||||
<caret>this@Foo.s()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Foo.s() = ""
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
class Foo {
|
||||
fun test() {
|
||||
"".apply {
|
||||
<caret>s()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Foo.s() = ""
|
||||
@@ -0,0 +1,18 @@
|
||||
// WITH_RUNTIME
|
||||
// PROBLEM: none
|
||||
|
||||
class Foo {
|
||||
val s = ""
|
||||
|
||||
fun test() {
|
||||
Bar().apply {
|
||||
"".run {
|
||||
<caret>this@apply.s
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Bar {
|
||||
val s = ""
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// WITH_RUNTIME
|
||||
// PROBLEM: none
|
||||
|
||||
class Foo {
|
||||
fun s(a: String) {}
|
||||
|
||||
fun test() {
|
||||
Bar().apply {
|
||||
<caret>this@Foo.s("")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Bar {
|
||||
fun s() {}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
// WITH_RUNTIME
|
||||
// PROBLEM: none
|
||||
|
||||
class Foo {
|
||||
fun test() {
|
||||
Bar().apply {
|
||||
"".run {
|
||||
<caret>this@apply.s()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Bar
|
||||
|
||||
fun Foo.s() {}
|
||||
fun Bar.s() {}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// WITH_RUNTIME
|
||||
// PROBLEM: none
|
||||
|
||||
class Foo {
|
||||
fun test() {
|
||||
Bar().apply {
|
||||
<caret>this@Foo.s("")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Bar
|
||||
|
||||
fun Foo.s(a: String) {}
|
||||
fun Bar.s() {}
|
||||
@@ -0,0 +1,7 @@
|
||||
class Foo {
|
||||
val s = ""
|
||||
|
||||
fun test() {
|
||||
<caret>this.s
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
class Foo {
|
||||
val s = ""
|
||||
|
||||
fun test() {
|
||||
<caret>s
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// WITH_RUNTIME
|
||||
// PROBLEM: none
|
||||
|
||||
class Foo {
|
||||
var s = ""
|
||||
|
||||
fun test() {
|
||||
val s = ""
|
||||
<caret>this.s = s
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user