Add inspections for implicit and explicit 'this' #KT-4580 Fixed

This commit is contained in:
Kirill
2017-10-20 20:54:01 +03:00
committed by Mikhail Glukhikh
parent 817f79520a
commit 89c4196c06
41 changed files with 694 additions and 1 deletions
@@ -0,0 +1 @@
org.jetbrains.kotlin.idea.inspections.ImplicitThisInspection
@@ -0,0 +1,7 @@
class Foo {
fun s() = ""
fun test() {
<caret>s()
}
}
@@ -0,0 +1,7 @@
class Foo {
fun s() = ""
fun test() {
<caret>this.s()
}
}
@@ -0,0 +1,9 @@
// PROBLEM: none
class Foo {
fun s() = ""
fun test() {
<caret>this.s()
}
}
@@ -0,0 +1,15 @@
// WITH_RUNTIME
class Foo {
fun Bar.s() = ""
}
class Bar
fun test() {
Bar().apply {
Foo().apply apply2@ {
<caret>s()
}
}
}
@@ -0,0 +1,15 @@
// WITH_RUNTIME
class Foo {
fun Bar.s() = ""
}
class Bar
fun test() {
Bar().apply {
Foo().apply apply2@ {
<caret>this@apply.s()
}
}
}
+11
View File
@@ -0,0 +1,11 @@
// WITH_RUNTIME
class Foo {
fun s() = ""
fun test() {
"".apply {
<caret>s()
}
}
}
@@ -0,0 +1,11 @@
// WITH_RUNTIME
class Foo {
fun s() = ""
fun test() {
"".apply {
<caret>this@Foo.s()
}
}
}
@@ -0,0 +1,8 @@
class Foo {
val f = Foo()
val s = ""
fun test() {
<caret>f.s
}
}
@@ -0,0 +1,8 @@
class Foo {
val f = Foo()
val s = ""
fun test() {
<caret>this.f.s
}
}
@@ -0,0 +1,7 @@
class Foo {
val s = ""
fun test() {
<caret>s
}
}
@@ -0,0 +1,7 @@
class Foo {
val s = ""
fun test() {
<caret>this.s
}
}
@@ -0,0 +1,9 @@
// PROBLEM: none
class Foo {
val s = ""
fun test() {
<caret>this.s
}
}
@@ -0,0 +1,9 @@
// PROBLEM: none
class Foo {
fun test() {
<caret>s()
}
}
fun s() = ""