tests: apply official code style
#KT-38632 Fixed
This commit is contained in:
+4
-2
@@ -115,8 +115,10 @@ class SmartEnterCompletionTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
fun foo(p:Int) {}
|
fun foo(p:Int) {}
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
foo(1 +
|
foo(
|
||||||
2)<caret>
|
1 +
|
||||||
|
2
|
||||||
|
)<caret>
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
|||||||
+13
-2
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2000-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2000-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -40,6 +40,7 @@ import org.jetbrains.kotlin.idea.KotlinFileType
|
|||||||
import org.jetbrains.kotlin.idea.compiler.configuration.KotlinCommonCompilerArgumentsHolder
|
import org.jetbrains.kotlin.idea.compiler.configuration.KotlinCommonCompilerArgumentsHolder
|
||||||
import org.jetbrains.kotlin.idea.compiler.configuration.KotlinCompilerSettings
|
import org.jetbrains.kotlin.idea.compiler.configuration.KotlinCompilerSettings
|
||||||
import org.jetbrains.kotlin.idea.facet.*
|
import org.jetbrains.kotlin.idea.facet.*
|
||||||
|
import org.jetbrains.kotlin.idea.formatter.KotlinStyleGuideCodeStyle
|
||||||
import org.jetbrains.kotlin.idea.inspections.UnusedSymbolInspection
|
import org.jetbrains.kotlin.idea.inspections.UnusedSymbolInspection
|
||||||
import org.jetbrains.kotlin.idea.test.CompilerTestDirectives.COMPILER_ARGUMENTS_DIRECTIVE
|
import org.jetbrains.kotlin.idea.test.CompilerTestDirectives.COMPILER_ARGUMENTS_DIRECTIVE
|
||||||
import org.jetbrains.kotlin.idea.test.CompilerTestDirectives.JVM_TARGET_DIRECTIVE
|
import org.jetbrains.kotlin.idea.test.CompilerTestDirectives.JVM_TARGET_DIRECTIVE
|
||||||
@@ -76,6 +77,8 @@ abstract class KotlinLightCodeInsightFixtureTestCase : KotlinLightCodeInsightFix
|
|||||||
|
|
||||||
override fun setUp() {
|
override fun setUp() {
|
||||||
super.setUp()
|
super.setUp()
|
||||||
|
|
||||||
|
enableKotlinOfficialCodeStyle(project)
|
||||||
// We do it here to avoid possible initialization problems
|
// We do it here to avoid possible initialization problems
|
||||||
// UnusedSymbolInspection() calls IDEA UnusedDeclarationInspection() in static initializer,
|
// UnusedSymbolInspection() calls IDEA UnusedDeclarationInspection() in static initializer,
|
||||||
// which in turn registers some extensions provoking "modifications aren't allowed during highlighting"
|
// which in turn registers some extensions provoking "modifications aren't allowed during highlighting"
|
||||||
@@ -101,7 +104,7 @@ abstract class KotlinLightCodeInsightFixtureTestCase : KotlinLightCodeInsightFix
|
|||||||
|
|
||||||
override fun tearDown() {
|
override fun tearDown() {
|
||||||
LoggedErrorProcessor.restoreDefaultProcessor()
|
LoggedErrorProcessor.restoreDefaultProcessor()
|
||||||
|
disableKotlinOfficialCodeStyle(project)
|
||||||
super.tearDown()
|
super.tearDown()
|
||||||
|
|
||||||
if (exceptions.isNotEmpty()) {
|
if (exceptions.isNotEmpty()) {
|
||||||
@@ -312,6 +315,14 @@ fun configureCodeStyleAndRun(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun enableKotlinOfficialCodeStyle(project: Project) {
|
||||||
|
KotlinStyleGuideCodeStyle.apply(CodeStyle.getSettings(project))
|
||||||
|
}
|
||||||
|
|
||||||
|
fun disableKotlinOfficialCodeStyle(project: Project) {
|
||||||
|
CodeStyle.getSettings(project)
|
||||||
|
}
|
||||||
|
|
||||||
private fun rollbackCompilerOptions(project: Project, module: Module, removeFacet: Boolean) {
|
private fun rollbackCompilerOptions(project: Project, module: Module, removeFacet: Boolean) {
|
||||||
KotlinCompilerSettings.getInstance(project).update { this.additionalArguments = DEFAULT_ADDITIONAL_ARGUMENTS }
|
KotlinCompilerSettings.getInstance(project).update { this.additionalArguments = DEFAULT_ADDITIONAL_ARGUMENTS }
|
||||||
KotlinCommonCompilerArgumentsHolder.getInstance(project).update { this.languageVersion = LanguageVersion.LATEST_STABLE.versionString }
|
KotlinCommonCompilerArgumentsHolder.getInstance(project).update { this.languageVersion = LanguageVersion.LATEST_STABLE.versionString }
|
||||||
|
|||||||
+3
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -17,12 +17,14 @@ import kotlin.reflect.full.findAnnotation
|
|||||||
abstract class KotlinLightPlatformCodeInsightFixtureTestCase : LightPlatformCodeInsightFixtureTestCase() {
|
abstract class KotlinLightPlatformCodeInsightFixtureTestCase : LightPlatformCodeInsightFixtureTestCase() {
|
||||||
override fun setUp() {
|
override fun setUp() {
|
||||||
super.setUp()
|
super.setUp()
|
||||||
|
enableKotlinOfficialCodeStyle(project)
|
||||||
(StartupManager.getInstance(project) as StartupManagerImpl).runPostStartupActivities()
|
(StartupManager.getInstance(project) as StartupManagerImpl).runPostStartupActivities()
|
||||||
VfsRootAccess.allowRootAccess(KotlinTestUtils.getHomeDirectory())
|
VfsRootAccess.allowRootAccess(KotlinTestUtils.getHomeDirectory())
|
||||||
invalidateLibraryCache(project)
|
invalidateLibraryCache(project)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun tearDown() {
|
override fun tearDown() {
|
||||||
|
disableKotlinOfficialCodeStyle(project)
|
||||||
VfsRootAccess.disallowRootAccess(KotlinTestUtils.getHomeDirectory())
|
VfsRootAccess.disallowRootAccess(KotlinTestUtils.getHomeDirectory())
|
||||||
|
|
||||||
super.tearDown()
|
super.tearDown()
|
||||||
|
|||||||
+10
@@ -13,4 +13,14 @@ import com.intellij.testFramework.LightPlatformCodeInsightTestCase
|
|||||||
abstract class KotlinLightPlatformCodeInsightTestCase : LightPlatformCodeInsightTestCase() {
|
abstract class KotlinLightPlatformCodeInsightTestCase : LightPlatformCodeInsightTestCase() {
|
||||||
protected inline val project_: Project get() = project
|
protected inline val project_: Project get() = project
|
||||||
protected inline val editor_: Editor get() = editor
|
protected inline val editor_: Editor get() = editor
|
||||||
|
|
||||||
|
override fun setUp() {
|
||||||
|
super.setUp()
|
||||||
|
enableKotlinOfficialCodeStyle(project_)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun tearDown() {
|
||||||
|
disableKotlinOfficialCodeStyle(project_)
|
||||||
|
super.tearDown()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+9
@@ -15,4 +15,13 @@ abstract class KotlinLightPlatformCodeInsightTestCase : LightPlatformCodeInsight
|
|||||||
protected inline val project_: Project get() = LightPlatformTestCase.getProject()
|
protected inline val project_: Project get() = LightPlatformTestCase.getProject()
|
||||||
protected inline val editor_: Editor get() = LightPlatformCodeInsightTestCase.getEditor()
|
protected inline val editor_: Editor get() = LightPlatformCodeInsightTestCase.getEditor()
|
||||||
|
|
||||||
|
override fun setUp() {
|
||||||
|
super.setUp()
|
||||||
|
enableKotlinOfficialCodeStyle(project_)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun tearDown() {
|
||||||
|
disableKotlinOfficialCodeStyle(project_)
|
||||||
|
super.tearDown()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
fun foo(p: Dependency): Double {
|
fun foo(p: Dependency): Double {
|
||||||
return p.getInt().toDouble() // explicit conversion to Double must be added on conversion (if type Dependency) is correctly resolved
|
return p.getInt()
|
||||||
|
.toDouble() // explicit conversion to Double must be added on conversion (if type Dependency) is correctly resolved
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ class A {
|
|||||||
var element = element
|
var element = element
|
||||||
element = JetPsiUtil.ascendIfPropertyAccessor(element)
|
element = JetPsiUtil.ascendIfPropertyAccessor(element)
|
||||||
if (element is JetNamedFunction || element is JetProperty) {
|
if (element is JetNamedFunction || element is JetProperty) {
|
||||||
val bindingContext = AnalyzerFacadeWithCache.analyzeFileWithCache(element.getContainingJetFile()).getBindingContext()
|
val bindingContext =
|
||||||
|
AnalyzerFacadeWithCache.analyzeFileWithCache(element.getContainingJetFile()).getBindingContext()
|
||||||
|
|
||||||
val declarationDescriptor = bindingContext.get(BindingContext.DECLARATION_TO_DESCRIPTOR, element)
|
val declarationDescriptor = bindingContext.get(BindingContext.DECLARATION_TO_DESCRIPTOR, element)
|
||||||
if (declarationDescriptor is CallableMemberDescriptor) {
|
if (declarationDescriptor is CallableMemberDescriptor) {
|
||||||
|
|||||||
@@ -20,8 +20,10 @@ class Target {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var ambiguousKotlin: IAmbiguousKotlin = AmbiguousKotlin() // Should not add import in case of 2 declarations in Kotlin
|
var ambiguousKotlin: IAmbiguousKotlin =
|
||||||
var ambiguous: IAmbiguous = Ambiguous() // Should not add import in case of ambiguous declarations in Kotlin and in Java
|
AmbiguousKotlin() // Should not add import in case of 2 declarations in Kotlin
|
||||||
|
var ambiguous: IAmbiguous =
|
||||||
|
Ambiguous() // Should not add import in case of ambiguous declarations in Kotlin and in Java
|
||||||
var ambiguousJava: IAmbiguousJava = AmbiguousJava() // Should not add import in case of 2 declarations in Java
|
var ambiguousJava: IAmbiguousJava = AmbiguousJava() // Should not add import in case of 2 declarations in Java
|
||||||
|
|
||||||
fun workWithStatics() {
|
fun workWithStatics() {
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
fun foo(arg: Any): Int {
|
fun foo(arg: Any): Int {
|
||||||
// 1
|
// 1
|
||||||
return arg as? Int
|
return arg as? Int
|
||||||
// 2
|
// 2
|
||||||
?: 10
|
?: 10
|
||||||
}
|
}
|
||||||
+2
-1
@@ -3,5 +3,6 @@
|
|||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
|
|
||||||
fun test(): List<Int> {
|
fun test(): List<Int> {
|
||||||
return listOf(1, 2, 3).asSequence().filter { it > 1 }.map { it * 2 }.map { it * 3 }.map { it * 4 }.map { it * 5 }.toList()
|
return listOf(1, 2, 3).asSequence().filter { it > 1 }.map { it * 2 }.map { it * 3 }.map { it * 4 }.map { it * 5 }
|
||||||
|
.toList()
|
||||||
}
|
}
|
||||||
+2
-1
@@ -1,5 +1,6 @@
|
|||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
|
|
||||||
fun test(list: List<Int>) {
|
fun test(list: List<Int>) {
|
||||||
val filterIndexedTo: MutableList<Int> = list.asSequence().filter { it > 1 }.filterIndexedTo(mutableListOf()) { index, it -> true }
|
val filterIndexedTo: MutableList<Int> = list.asSequence().filter { it > 1 }
|
||||||
|
.filterIndexedTo(mutableListOf()) { index, it -> true }
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -1,5 +1,6 @@
|
|||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
|
|
||||||
fun test(list: List<Int>) {
|
fun test(list: List<Int>) {
|
||||||
val mapIndexedNotNullTo: MutableList<Int> = list.asSequence().filter { it > 1 }.mapIndexedNotNullTo(mutableListOf()) { index, i -> i }
|
val mapIndexedNotNullTo: MutableList<Int> = list.asSequence().filter { it > 1 }
|
||||||
|
.mapIndexedNotNullTo(mutableListOf()) { index, i -> i }
|
||||||
}
|
}
|
||||||
Vendored
+6
-3
@@ -1,9 +1,12 @@
|
|||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
val doSomething = doSomething("one" + 1,
|
val doSomething = doSomething(
|
||||||
|
"one" + 1,
|
||||||
"two",
|
"two",
|
||||||
3 * 4)
|
3 * 4
|
||||||
val t = if (doSomething != null) doSomething else throw NullPointerException("Expression 'doSomething(\"one\" + 1, ...' must not be null")
|
)
|
||||||
|
val t = if (doSomething != null
|
||||||
|
) doSomething else throw NullPointerException("Expression 'doSomething(\"one\" + 1, ...' must not be null")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun doSomething(vararg a: Any): Any? = null
|
fun doSomething(vararg a: Any): Any? = null
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@ fun foo(arg: Int): Int {
|
|||||||
// 1
|
// 1
|
||||||
when (arg) {
|
when (arg) {
|
||||||
0 -> return 0
|
0 -> return 0
|
||||||
// 2
|
// 2
|
||||||
else -> return -1
|
else -> return -1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+4
-4
@@ -4,17 +4,17 @@ fun foo(arg: Any?): Int {
|
|||||||
is Int -> {
|
is Int -> {
|
||||||
return arg // 2
|
return arg // 2
|
||||||
}
|
}
|
||||||
// 3
|
// 3
|
||||||
is String -> {
|
is String -> {
|
||||||
return 42 // 4
|
return 42 // 4
|
||||||
}
|
}
|
||||||
// 5
|
// 5
|
||||||
null -> {
|
null -> {
|
||||||
// 6
|
// 6
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
// 7
|
// 7
|
||||||
// 8
|
// 8
|
||||||
else -> return -1
|
else -> return -1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
fun foo(a: Int) {
|
fun foo(a: Int) {
|
||||||
if (a
|
if (a
|
||||||
// some comment
|
// some comment
|
||||||
== 0) bar(a)
|
== 0
|
||||||
|
) bar(a)
|
||||||
|
|
||||||
// another comment
|
// another comment
|
||||||
else if (a == 1) bar(a)
|
else if (a == 1) bar(a)
|
||||||
|
|||||||
+2
-1
@@ -5,6 +5,7 @@ class WithComments/* Some parameter */
|
|||||||
/**
|
/**
|
||||||
* A very important property
|
* A very important property
|
||||||
*/
|
*/
|
||||||
val veryImportant: Any) {
|
val veryImportant: Any
|
||||||
|
) {
|
||||||
|
|
||||||
}
|
}
|
||||||
Vendored
+4
-2
@@ -2,7 +2,9 @@ annotation class AnnParam
|
|||||||
|
|
||||||
annotation class AnnProperty
|
annotation class AnnProperty
|
||||||
|
|
||||||
abstract class WithComposedModifiers(@AnnParam vararg @AnnProperty
|
abstract class WithComposedModifiers(
|
||||||
open val x: String) {
|
@AnnParam vararg @AnnProperty
|
||||||
|
open val x: String
|
||||||
|
) {
|
||||||
|
|
||||||
}
|
}
|
||||||
+6
-1
@@ -12,5 +12,10 @@ annotation class Ann4(val i: Int, val j: Int)
|
|||||||
@Target(AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.FIELD)
|
@Target(AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.FIELD)
|
||||||
annotation class Ann5(val i: Int, val j: Int)
|
annotation class Ann5(val i: Int, val j: Int)
|
||||||
|
|
||||||
class Test(@get:Ann1(0, 0) @property:Ann1(1, 11) @Ann2(2, 22) @Ann3(3, 33) @property:Ann4(4, 44) @field:Ann5(5, 55) val foo: String = "") {
|
class Test(
|
||||||
|
@get:Ann1(0, 0) @property:Ann1(1, 11) @Ann2(2, 22) @Ann3(3, 33) @property:Ann4(4, 44) @field:Ann5(
|
||||||
|
5,
|
||||||
|
55
|
||||||
|
) val foo: String = ""
|
||||||
|
) {
|
||||||
}
|
}
|
||||||
+5
-1
@@ -6,5 +6,9 @@ fun foo(a: Int, b: String, d: Baz) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class TestClass(val prop1: KFunction3<@ParameterName(name = "a") Int, @ParameterName(name = "b") String, @ParameterName(name = "d") Baz, Unit> = ::foo) {
|
class TestClass(
|
||||||
|
val prop1: KFunction3<@ParameterName(name = "a") Int, @ParameterName(name = "b") String, @ParameterName(
|
||||||
|
name = "d"
|
||||||
|
) Baz, Unit> = ::foo
|
||||||
|
) {
|
||||||
}
|
}
|
||||||
+3
-1
@@ -3,5 +3,7 @@ annotation class Annotation2(val a: Int = 0)
|
|||||||
annotation class Annotation3(val a: Int = 0)
|
annotation class Annotation3(val a: Int = 0)
|
||||||
|
|
||||||
|
|
||||||
class TestClass(@Annotation1(42) @Annotation3(42) initialText: String = "LoremIpsum", private @property:Annotation1(42) @field:Annotation2(42) val text: String = "dolor sit amet") {
|
class TestClass(@Annotation1(42) @Annotation3(42) initialText: String = "LoremIpsum",
|
||||||
|
private @property:Annotation1(42) @field:Annotation2(42) val text: String = "dolor sit amet"
|
||||||
|
) {
|
||||||
}
|
}
|
||||||
@@ -4,7 +4,9 @@ interface C {
|
|||||||
|
|
||||||
class D(val c: C) {
|
class D(val c: C) {
|
||||||
fun foo() {
|
fun foo() {
|
||||||
this.c/* and this is c */.set("a", // it's "a"
|
this.c/* and this is c */.set(
|
||||||
"b" /* and this is "b" */, /* we use 10 */10)
|
"a", // it's "a"
|
||||||
|
"b" /* and this is "b" */, /* we use 10 */10
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -1 +1,3 @@
|
|||||||
expect fun <T : @SimpleA List<@SimpleA List<@SimpleA String>>> @receiver:SimpleA String.myExtension(@SimpleA a: @SimpleA List<@SimpleA List<@SimpleA String>>)
|
expect fun <T : @SimpleA List<@SimpleA List<@SimpleA String>>> @receiver:SimpleA String.<caret>myExtension(
|
||||||
|
@SimpleA a: @SimpleA List<@SimpleA List<@SimpleA String>>
|
||||||
|
)
|
||||||
@@ -3,7 +3,14 @@
|
|||||||
|
|
||||||
package test
|
package test
|
||||||
|
|
||||||
@Target(AnnotationTarget.CLASS, AnnotationTarget.LOCAL_VARIABLE, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FUNCTION, AnnotationTarget.EXPRESSION)
|
@Target(
|
||||||
|
AnnotationTarget.CLASS,
|
||||||
|
AnnotationTarget.LOCAL_VARIABLE,
|
||||||
|
AnnotationTarget.VALUE_PARAMETER,
|
||||||
|
AnnotationTarget.CONSTRUCTOR,
|
||||||
|
AnnotationTarget.FUNCTION,
|
||||||
|
AnnotationTarget.EXPRESSION
|
||||||
|
)
|
||||||
@Retention(AnnotationRetention.SOURCE)
|
@Retention(AnnotationRetention.SOURCE)
|
||||||
annotation class AnnTarget
|
annotation class AnnTarget
|
||||||
|
|
||||||
@@ -11,6 +18,6 @@ fun println(v: Int) {}
|
|||||||
|
|
||||||
fun apply() {
|
fun apply() {
|
||||||
var v = 0
|
var v = 0
|
||||||
@AnnTarget v++
|
<caret>@AnnTarget v++
|
||||||
println(v)
|
println(v)
|
||||||
}
|
}
|
||||||
+1
-1
@@ -2,6 +2,6 @@
|
|||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
foo@ while (true) {
|
foo@ while (true) {
|
||||||
<caret>break@foo
|
break@<caret>foo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
fun test() {
|
fun test() {
|
||||||
foo@ while (true) {
|
foo@ while (true) {
|
||||||
while (true) {
|
while (true) {
|
||||||
<caret> break@foo
|
break@<caret>foo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,6 @@
|
|||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
foo@ while (true) {
|
foo@ while (true) {
|
||||||
<caret>continue@foo
|
continue@<caret>foo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+4
-2
@@ -7,7 +7,9 @@ fun newFun(p1: Int, a: Int, p2: Int, p3: Int, b: Int){}
|
|||||||
|
|
||||||
|
|
||||||
fun foo() {
|
fun foo() {
|
||||||
newFun(0, // 0
|
newFun(
|
||||||
|
0, // 0
|
||||||
-1, 1, // 1
|
-1, 1, // 1
|
||||||
2, // 2
|
2, // 2
|
||||||
-2)
|
-2
|
||||||
|
)
|
||||||
|
|||||||
+2
-1
@@ -9,5 +9,6 @@ fun newFun(p4: Int, p3: Int, p2: Int, p1: Int, p0: Int){}
|
|||||||
fun foo() {
|
fun foo() {
|
||||||
newFun(/* 4 */ 4, 3, 2, // 2
|
newFun(/* 4 */ 4, 3, 2, // 2
|
||||||
/* 1 */ 1,
|
/* 1 */ 1,
|
||||||
/* 0 */ 0)
|
/* 0 */ 0
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -8,7 +8,8 @@ interface X {
|
|||||||
fun newFun(x: X, a: Int, b: Int){}
|
fun newFun(x: X, a: Int, b: Int){}
|
||||||
|
|
||||||
fun foo(x: X) {
|
fun foo(x: X) {
|
||||||
newFun(x/*receiver*/, 1, // pass 1
|
newFun(
|
||||||
|
x/*receiver*/, 1, // pass 1
|
||||||
2 // pass 2
|
2 // pass 2
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -11,5 +11,6 @@ fun foo(x: X) {
|
|||||||
x.newFun(
|
x.newFun(
|
||||||
1,
|
1,
|
||||||
2,
|
2,
|
||||||
0)
|
0
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-2
@@ -8,7 +8,9 @@ interface X {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun foo(x: X) {
|
fun foo(x: X) {
|
||||||
x.<caret>newFun(1,
|
x.<caret>newFun(
|
||||||
|
1,
|
||||||
2,
|
2,
|
||||||
3)
|
3
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-2
@@ -9,8 +9,7 @@ fun foo(arg: Boolean) {
|
|||||||
if (arg) {
|
if (arg) {
|
||||||
x = 1
|
x = 1
|
||||||
}
|
}
|
||||||
}
|
} catch (e: Exception) {
|
||||||
catch (e: Exception) {
|
|
||||||
<caret>x = 2
|
<caret>x = 2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-4
@@ -5,9 +5,7 @@ fun foo() {
|
|||||||
val x: Int
|
val x: Int
|
||||||
try {
|
try {
|
||||||
x = 1
|
x = 1
|
||||||
}
|
} catch (e: Exception) {
|
||||||
catch (e: Exception) {
|
|
||||||
<caret>x = 2
|
<caret>x = 2
|
||||||
}
|
} finally {}
|
||||||
finally {}
|
|
||||||
}
|
}
|
||||||
@@ -5,14 +5,11 @@ fun foo() {
|
|||||||
val x: Int
|
val x: Int
|
||||||
try {
|
try {
|
||||||
x = 1
|
x = 1
|
||||||
}
|
} catch (e: RuntimeException) {
|
||||||
catch (e: RuntimeException) {
|
|
||||||
<caret>x = 2
|
<caret>x = 2
|
||||||
}
|
} catch (e: Exception) {
|
||||||
catch (e: Exception) {
|
|
||||||
x = 3
|
x = 3
|
||||||
}
|
} catch (e: Throwable) {
|
||||||
catch (e: Throwable) {
|
|
||||||
x = 4
|
x = 4
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-2
@@ -10,8 +10,7 @@ fun foo() {
|
|||||||
try {
|
try {
|
||||||
val x = 2
|
val x = 2
|
||||||
x = 3
|
x = 3
|
||||||
}
|
} catch(e: Exception) {
|
||||||
catch(e: Exception) {
|
|
||||||
<caret>x = 4
|
<caret>x = 4
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-2
@@ -5,8 +5,7 @@ fun foo() {
|
|||||||
val x: Int
|
val x: Int
|
||||||
try {
|
try {
|
||||||
x = 1
|
x = 1
|
||||||
}
|
} catch (e: Exception) {
|
||||||
catch (e: Exception) {
|
|
||||||
<caret>x = 2
|
<caret>x = 2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-1
@@ -5,4 +5,5 @@
|
|||||||
// ERROR: Conflicting declarations: value-parameter p4: Any, value-parameter p4: String
|
// ERROR: Conflicting declarations: value-parameter p4: Any, value-parameter p4: String
|
||||||
open class Base<T>(p1: Int, private val p2: Int, p3: Any, p4: String, p5: T, p6: Int)
|
open class Base<T>(p1: Int, private val p2: Int, p3: Any, p4: String, p5: T, p6: Int)
|
||||||
|
|
||||||
class C(p: Int, p2: Int, p3: String, p4: Any, p5: String, val p6: Int, p1: Int, p4: String) : Base<String>(p1, p2, p3, p4, p5, p6)
|
class C(p: Int, p2: Int, p3: String, p4: Any, p5: String, val p6: Int, p1: Int, p4: String) :
|
||||||
|
Base<String>(p1, p2, p3, p4, p5, p6)
|
||||||
|
|||||||
+7
-1
@@ -26,7 +26,13 @@ fun foo(a: Int): Int {
|
|||||||
return b + c + d + e
|
return b + c + d + e
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun list(b: Int, a: Int, c: Int, d: Int, e: Int): List<Int> {
|
private fun list(
|
||||||
|
b: Int,
|
||||||
|
a: Int,
|
||||||
|
c: Int,
|
||||||
|
d: Int,
|
||||||
|
e: Int
|
||||||
|
): List<Int> {
|
||||||
var b1 = b
|
var b1 = b
|
||||||
var c1 = c
|
var c1 = c
|
||||||
var d1 = d
|
var d1 = d
|
||||||
|
|||||||
+6
-1
@@ -21,7 +21,12 @@ fun foo(a: Int): Int {
|
|||||||
return b + c + d
|
return b + c + d
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun triple(b: Int, a: Int, c: Int, d: Int): Triple<Int, Int, Int> {
|
private fun triple(
|
||||||
|
b: Int,
|
||||||
|
a: Int,
|
||||||
|
c: Int,
|
||||||
|
d: Int
|
||||||
|
): Triple<Int, Int, Int> {
|
||||||
var b1 = b
|
var b1 = b
|
||||||
var c1 = c
|
var c1 = c
|
||||||
var d1 = d
|
var d1 = d
|
||||||
|
|||||||
+5
-2
@@ -13,5 +13,8 @@ fun foo(n: Int): Int {
|
|||||||
return i(n, Int::bar1, Int::bar2)
|
return i(n, Int::bar1, Int::bar2)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun i(n: Int, bar1: Int.(m: Int) -> Int, bar2: Int.(m: Int) -> Int) =
|
private fun i(
|
||||||
n.bar1(n + 1).bar2(n + 2)
|
n: Int,
|
||||||
|
bar1: Int.(m: Int) -> Int,
|
||||||
|
bar2: Int.(m: Int) -> Int
|
||||||
|
) = n.bar1(n + 1).bar2(n + 2)
|
||||||
+5
-2
@@ -17,5 +17,8 @@ class A<T: Data>(val t: T) where T: DataEx {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun <T : Data, U : Data, V : Data> i(a: A<T>, b: A<T>.B<U>, v: V) where T : DataEx, U : DataExEx, V : DataEx =
|
private fun <T : Data, U : Data, V : Data> i(
|
||||||
a.t.x + b.u.x + v.x
|
a: A<T>,
|
||||||
|
b: A<T>.B<U>,
|
||||||
|
v: V
|
||||||
|
) where T : DataEx, U : DataExEx, V : DataEx = a.t.x + b.u.x + v.x
|
||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
fun <caret>foo(p1: String, p2: () -> Boolean) = bar(p1, null, p2)
|
fun <caret>foo(p1: String, p2: () -> Boolean) = bar(p1, null, p2)
|
||||||
|
|
||||||
fun bar(p1: String, p2: String?, p3: () -> Boolean)
|
fun bar(p1: String, p2: String?, p3: () -> Boolean) = Unit
|
||||||
|
|
||||||
fun foo(i: I) {
|
fun foo(i: I) {
|
||||||
foo("foo") {
|
foo("foo") {
|
||||||
|
|||||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
|
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
|
||||||
|
|
||||||
fun bar(p1: String, p2: String?, p3: () -> Boolean)
|
fun bar(p1: String, p2: String?, p3: () -> Boolean) = Unit
|
||||||
|
|
||||||
fun foo(i: I) {
|
fun foo(i: I) {
|
||||||
bar("foo", null) {
|
bar("foo", null) {
|
||||||
|
|||||||
+2
-1
@@ -3,5 +3,6 @@ fun callInDefault(simple: List<String> = provideSimple(), complex: List<String>
|
|||||||
val result = mutableListOf("statement 1")
|
val result = mutableListOf("statement 1")
|
||||||
result.add("statement 2")
|
result.add("statement 2")
|
||||||
result
|
result
|
||||||
}) {
|
}
|
||||||
|
) {
|
||||||
}
|
}
|
||||||
Vendored
+4
-2
@@ -1,8 +1,10 @@
|
|||||||
fun foo(i: Int) { }
|
fun foo(i: Int) { }
|
||||||
|
|
||||||
fun test(i: () -> Int = {
|
fun test(
|
||||||
|
i: () -> Int = {
|
||||||
(1
|
(1
|
||||||
+ 2)
|
+ 2)
|
||||||
}) {
|
}
|
||||||
|
) {
|
||||||
foo(i())
|
foo(i())
|
||||||
}
|
}
|
||||||
+4
-2
@@ -1,8 +1,10 @@
|
|||||||
fun foo(i: Int) { }
|
fun foo(i: Int) { }
|
||||||
|
|
||||||
fun test(i: () -> Int = {
|
fun test(
|
||||||
|
i: () -> Int = {
|
||||||
(1 // abc
|
(1 // abc
|
||||||
/*def*/ + 2)
|
/*def*/ + 2)
|
||||||
}) {
|
}
|
||||||
|
) {
|
||||||
foo(i())
|
foo(i())
|
||||||
}
|
}
|
||||||
+4
-2
@@ -1,8 +1,10 @@
|
|||||||
fun foo(i: Int) { }
|
fun foo(i: Int) { }
|
||||||
|
|
||||||
fun test(i: () -> Int = {
|
fun test(
|
||||||
|
i: () -> Int = {
|
||||||
(1
|
(1
|
||||||
+ 2 - 3)
|
+ 2 - 3)
|
||||||
}) {
|
}
|
||||||
|
) {
|
||||||
foo(i())
|
foo(i())
|
||||||
}
|
}
|
||||||
+4
-2
@@ -1,8 +1,10 @@
|
|||||||
fun foo(i: Int) { }
|
fun foo(i: Int) { }
|
||||||
|
|
||||||
fun test(i: () -> Int = {
|
fun test(
|
||||||
|
i: () -> Int = {
|
||||||
(1 + 2
|
(1 + 2
|
||||||
- 3)
|
- 3)
|
||||||
}) {
|
}
|
||||||
|
) {
|
||||||
foo(i())
|
foo(i())
|
||||||
}
|
}
|
||||||
idea/testData/refactoring/introduceLambdaParameter/stringTemplates/rawTemplateWithSubstring.kt.after
Vendored
+4
-2
@@ -1,7 +1,9 @@
|
|||||||
fun foo(a: Int, s: (Int) -> String = { a ->
|
fun foo(
|
||||||
|
a: Int, s: (Int) -> String = { a ->
|
||||||
"""c$a
|
"""c$a
|
||||||
:${a + 1}d"""
|
:${a + 1}d"""
|
||||||
}): String {
|
}
|
||||||
|
): String {
|
||||||
val x = """_${s(a)}_"""
|
val x = """_${s(a)}_"""
|
||||||
val y = "_$a:${a + 1}d_"
|
val y = "_$a:${a + 1}d_"
|
||||||
val z = """_c$a:${a + 1}d_"""
|
val z = """_c$a:${a + 1}d_"""
|
||||||
|
|||||||
+4
-2
@@ -1,6 +1,8 @@
|
|||||||
fun foo(i: Int) { }
|
fun foo(i: Int) { }
|
||||||
|
|
||||||
fun test(i: Int = (1
|
fun test(
|
||||||
+ 2)) {
|
i: Int = (1
|
||||||
|
+ 2)
|
||||||
|
) {
|
||||||
foo(i)
|
foo(i)
|
||||||
}
|
}
|
||||||
+4
-2
@@ -1,6 +1,8 @@
|
|||||||
fun foo(i: Int) { }
|
fun foo(i: Int) { }
|
||||||
|
|
||||||
fun test(i: Int = (1 // abc
|
fun test(
|
||||||
/*def*/ + 2)) {
|
i: Int = (1 // abc
|
||||||
|
/*def*/ + 2)
|
||||||
|
) {
|
||||||
foo(i)
|
foo(i)
|
||||||
}
|
}
|
||||||
Vendored
+4
-2
@@ -1,6 +1,8 @@
|
|||||||
fun foo(i: Int) { }
|
fun foo(i: Int) { }
|
||||||
|
|
||||||
fun test(i: Int = (1
|
fun test(
|
||||||
+ 2 - 3)) {
|
i: Int = (1
|
||||||
|
+ 2 - 3)
|
||||||
|
) {
|
||||||
foo(i)
|
foo(i)
|
||||||
}
|
}
|
||||||
Vendored
+4
-2
@@ -1,6 +1,8 @@
|
|||||||
fun foo(i: Int) { }
|
fun foo(i: Int) { }
|
||||||
|
|
||||||
fun test(i: Int = (1 + 2
|
fun test(
|
||||||
- 3)) {
|
i: Int = (1 + 2
|
||||||
|
- 3)
|
||||||
|
) {
|
||||||
foo(i)
|
foo(i)
|
||||||
}
|
}
|
||||||
Vendored
+4
-2
@@ -1,5 +1,7 @@
|
|||||||
fun foo(a: Int, s: String = """c$a
|
fun foo(
|
||||||
:${a + 1}d"""): String {
|
a: Int, s: String = """c$a
|
||||||
|
:${a + 1}d"""
|
||||||
|
): String {
|
||||||
val x = """_${s}_"""
|
val x = """_${s}_"""
|
||||||
val y = "_$a:${a + 1}d_"
|
val y = "_$a:${a + 1}d_"
|
||||||
val z = """_c$a:${a + 1}d_"""
|
val z = """_c$a:${a + 1}d_"""
|
||||||
|
|||||||
@@ -34,7 +34,8 @@ abstract class A<T: I, U: I, V>(x: T, y: Any?) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// INFO: {"checked": "true"}
|
// INFO: {"checked": "true"}
|
||||||
inner class Foo<S>(x1: T, x2: Z<T>, y1: Any?, y2: Z<Any?>, w1: I, w2: Z<I>, s1: S, s2: Z<S>): A<T, I, Z<Any?>>(), Z<I> {
|
inner class Foo<S>(x1: T, x2: Z<T>, y1: Any?, y2: Z<Any?>, w1: I, w2: Z<I>, s1: S, s2: Z<S>): A<T, I, Z<Any?>>(),
|
||||||
|
Z<I> {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,8 +18,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
fun testIfCondition() = doFunTest(
|
fun testIfCondition() = doFunTest(
|
||||||
"""
|
"""
|
||||||
if <caret>
|
if <caret>
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
if (<caret>) {
|
if (<caret>) {
|
||||||
}
|
}
|
||||||
@@ -29,8 +28,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
fun testIfCondition2() = doFunTest(
|
fun testIfCondition2() = doFunTest(
|
||||||
"""
|
"""
|
||||||
if<caret>
|
if<caret>
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
if (<caret>) {
|
if (<caret>) {
|
||||||
}
|
}
|
||||||
@@ -42,8 +40,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
if<caret>
|
if<caret>
|
||||||
|
|
||||||
return true
|
return true
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
if (<caret>) {
|
if (<caret>) {
|
||||||
}
|
}
|
||||||
@@ -55,8 +52,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
fun testIfCondition3() = doFunTest(
|
fun testIfCondition3() = doFunTest(
|
||||||
"""
|
"""
|
||||||
if (<caret>
|
if (<caret>
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
if (<caret>) {
|
if (<caret>) {
|
||||||
}
|
}
|
||||||
@@ -67,8 +63,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
"""
|
"""
|
||||||
if (true<caret>) {
|
if (true<caret>) {
|
||||||
}
|
}
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
if (true) {
|
if (true) {
|
||||||
<caret>
|
<caret>
|
||||||
@@ -79,8 +74,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
fun testIfCondition5() = doFunTest(
|
fun testIfCondition5() = doFunTest(
|
||||||
"""
|
"""
|
||||||
if (true) {<caret>
|
if (true) {<caret>
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
if (true) {
|
if (true) {
|
||||||
<caret>
|
<caret>
|
||||||
@@ -93,8 +87,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
if (true<caret>) {
|
if (true<caret>) {
|
||||||
println()
|
println()
|
||||||
}
|
}
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
if (true) {
|
if (true) {
|
||||||
<caret>
|
<caret>
|
||||||
@@ -106,8 +99,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
fun testIfThenOneLine1() = doFunTest(
|
fun testIfThenOneLine1() = doFunTest(
|
||||||
"""
|
"""
|
||||||
if (true) println()<caret>
|
if (true) println()<caret>
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
if (true) println()
|
if (true) println()
|
||||||
<caret>
|
<caret>
|
||||||
@@ -117,8 +109,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
fun testIfThenOneLine2() = doFunTest(
|
fun testIfThenOneLine2() = doFunTest(
|
||||||
"""
|
"""
|
||||||
if (true) <caret>println()
|
if (true) <caret>println()
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
if (true) println()
|
if (true) println()
|
||||||
<caret>
|
<caret>
|
||||||
@@ -129,8 +120,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
"""
|
"""
|
||||||
if (true)
|
if (true)
|
||||||
println()<caret>
|
println()<caret>
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
if (true)
|
if (true)
|
||||||
println()
|
println()
|
||||||
@@ -142,8 +132,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
"""
|
"""
|
||||||
if (true)
|
if (true)
|
||||||
println()<caret>
|
println()<caret>
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
if (true)
|
if (true)
|
||||||
println()
|
println()
|
||||||
@@ -156,8 +145,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
"""
|
"""
|
||||||
if (true<caret>)
|
if (true<caret>)
|
||||||
println()
|
println()
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
if (true) {
|
if (true) {
|
||||||
<caret>
|
<caret>
|
||||||
@@ -261,8 +249,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
fun testWhile() = doFunTest(
|
fun testWhile() = doFunTest(
|
||||||
"""
|
"""
|
||||||
while <caret>
|
while <caret>
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
while (<caret>) {
|
while (<caret>) {
|
||||||
}
|
}
|
||||||
@@ -272,8 +259,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
fun testWhile2() = doFunTest(
|
fun testWhile2() = doFunTest(
|
||||||
"""
|
"""
|
||||||
while<caret>
|
while<caret>
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
while (<caret>) {
|
while (<caret>) {
|
||||||
}
|
}
|
||||||
@@ -283,8 +269,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
fun testWhile3() = doFunTest(
|
fun testWhile3() = doFunTest(
|
||||||
"""
|
"""
|
||||||
while (<caret>
|
while (<caret>
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
while (<caret>) {
|
while (<caret>) {
|
||||||
}
|
}
|
||||||
@@ -295,8 +280,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
"""
|
"""
|
||||||
while (true<caret>) {
|
while (true<caret>) {
|
||||||
}
|
}
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
while (true) {
|
while (true) {
|
||||||
<caret>
|
<caret>
|
||||||
@@ -307,8 +291,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
fun testWhile5() = doFunTest(
|
fun testWhile5() = doFunTest(
|
||||||
"""
|
"""
|
||||||
while (true) {<caret>
|
while (true) {<caret>
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
while (true) {
|
while (true) {
|
||||||
<caret>
|
<caret>
|
||||||
@@ -321,8 +304,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
while (true<caret>) {
|
while (true<caret>) {
|
||||||
println()
|
println()
|
||||||
}
|
}
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
while (true) {
|
while (true) {
|
||||||
<caret>
|
<caret>
|
||||||
@@ -379,8 +361,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
fun testForStatement() = doFunTest(
|
fun testForStatement() = doFunTest(
|
||||||
"""
|
"""
|
||||||
for <caret>
|
for <caret>
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
for (<caret>) {
|
for (<caret>) {
|
||||||
}
|
}
|
||||||
@@ -390,8 +371,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
fun testForStatement2() = doFunTest(
|
fun testForStatement2() = doFunTest(
|
||||||
"""
|
"""
|
||||||
for<caret>
|
for<caret>
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
for (<caret>) {
|
for (<caret>) {
|
||||||
}
|
}
|
||||||
@@ -402,8 +382,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
"""
|
"""
|
||||||
for (i in 1..10<caret>) {
|
for (i in 1..10<caret>) {
|
||||||
}
|
}
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
for (i in 1..10) {
|
for (i in 1..10) {
|
||||||
<caret>
|
<caret>
|
||||||
@@ -414,8 +393,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
fun testForStatement5() = doFunTest(
|
fun testForStatement5() = doFunTest(
|
||||||
"""
|
"""
|
||||||
for (i in 1..10) {<caret>
|
for (i in 1..10) {<caret>
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
for (i in 1..10) {
|
for (i in 1..10) {
|
||||||
<caret>
|
<caret>
|
||||||
@@ -428,8 +406,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
for (i in 1..10<caret>) {
|
for (i in 1..10<caret>) {
|
||||||
println()
|
println()
|
||||||
}
|
}
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
for (i in 1..10) {
|
for (i in 1..10) {
|
||||||
<caret>
|
<caret>
|
||||||
@@ -441,8 +418,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
fun testForStatementSingle() = doFunTest(
|
fun testForStatementSingle() = doFunTest(
|
||||||
"""
|
"""
|
||||||
for (i in 1..10<caret>) println()
|
for (i in 1..10<caret>) println()
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
for (i in 1..10) println()
|
for (i in 1..10) println()
|
||||||
<caret>
|
<caret>
|
||||||
@@ -452,8 +428,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
fun testForStatementSingleEmpty() = doFunTest(
|
fun testForStatementSingleEmpty() = doFunTest(
|
||||||
"""
|
"""
|
||||||
for (<caret>) println()
|
for (<caret>) println()
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
for (<caret>) println()
|
for (<caret>) println()
|
||||||
"""
|
"""
|
||||||
@@ -463,8 +438,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
"""
|
"""
|
||||||
for (som<caret>e)
|
for (som<caret>e)
|
||||||
println()
|
println()
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
for (some) {
|
for (some) {
|
||||||
<caret>
|
<caret>
|
||||||
@@ -501,8 +475,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
fun testWhen() = doFunTest(
|
fun testWhen() = doFunTest(
|
||||||
"""
|
"""
|
||||||
when <caret>
|
when <caret>
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
when {
|
when {
|
||||||
<caret>
|
<caret>
|
||||||
@@ -513,8 +486,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
fun testWhen1() = doFunTest(
|
fun testWhen1() = doFunTest(
|
||||||
"""
|
"""
|
||||||
when<caret>
|
when<caret>
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
when {
|
when {
|
||||||
<caret>
|
<caret>
|
||||||
@@ -526,8 +498,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
"""
|
"""
|
||||||
when (true<caret>) {
|
when (true<caret>) {
|
||||||
}
|
}
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
when (true) {
|
when (true) {
|
||||||
<caret>
|
<caret>
|
||||||
@@ -538,8 +509,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
fun testWhen3() = doFunTest(
|
fun testWhen3() = doFunTest(
|
||||||
"""
|
"""
|
||||||
when (true) {<caret>
|
when (true) {<caret>
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
when (true) {
|
when (true) {
|
||||||
<caret>
|
<caret>
|
||||||
@@ -552,8 +522,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
when (true<caret>) {
|
when (true<caret>) {
|
||||||
false -> println("false")
|
false -> println("false")
|
||||||
}
|
}
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
when (true) {
|
when (true) {
|
||||||
<caret>
|
<caret>
|
||||||
@@ -565,8 +534,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
fun testWhen5() = doFunTest(
|
fun testWhen5() = doFunTest(
|
||||||
"""
|
"""
|
||||||
when (<caret>)
|
when (<caret>)
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
when (<caret>) {
|
when (<caret>) {
|
||||||
}
|
}
|
||||||
@@ -576,8 +544,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
fun testWhen6() = doFunTest(
|
fun testWhen6() = doFunTest(
|
||||||
"""
|
"""
|
||||||
when (true<caret>)
|
when (true<caret>)
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
when (true) {
|
when (true) {
|
||||||
<caret>
|
<caret>
|
||||||
@@ -590,8 +557,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
"""
|
"""
|
||||||
when ({<caret>
|
when ({<caret>
|
||||||
}
|
}
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
when ({
|
when ({
|
||||||
<caret>
|
<caret>
|
||||||
@@ -602,8 +568,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
fun testDoWhile() = doFunTest(
|
fun testDoWhile() = doFunTest(
|
||||||
"""
|
"""
|
||||||
do <caret>
|
do <caret>
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
do {
|
do {
|
||||||
} while (<caret>)${' '}
|
} while (<caret>)${' '}
|
||||||
@@ -613,8 +578,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
fun testDoWhile2() = doFunTest(
|
fun testDoWhile2() = doFunTest(
|
||||||
"""
|
"""
|
||||||
do<caret>
|
do<caret>
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
do {
|
do {
|
||||||
} while (<caret>)
|
} while (<caret>)
|
||||||
@@ -626,8 +590,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
do<caret> {
|
do<caret> {
|
||||||
println(hi)
|
println(hi)
|
||||||
}
|
}
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
do {
|
do {
|
||||||
println(hi)
|
println(hi)
|
||||||
@@ -639,8 +602,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
"""
|
"""
|
||||||
do<caret> {
|
do<caret> {
|
||||||
} while ()
|
} while ()
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
do {
|
do {
|
||||||
} while (<caret>)
|
} while (<caret>)
|
||||||
@@ -651,8 +613,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
"""
|
"""
|
||||||
do<caret> {
|
do<caret> {
|
||||||
} while (true)
|
} while (true)
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
do {
|
do {
|
||||||
<caret>
|
<caret>
|
||||||
@@ -664,8 +625,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
"""
|
"""
|
||||||
do {
|
do {
|
||||||
} <caret>while (true)
|
} <caret>while (true)
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
do {
|
do {
|
||||||
<caret>
|
<caret>
|
||||||
@@ -677,8 +637,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
"""
|
"""
|
||||||
do {
|
do {
|
||||||
} while (<caret>true)
|
} while (<caret>true)
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
do {
|
do {
|
||||||
<caret>
|
<caret>
|
||||||
@@ -689,8 +648,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
fun testDoWhile9() = doFunTest(
|
fun testDoWhile9() = doFunTest(
|
||||||
"""
|
"""
|
||||||
do while<caret>
|
do while<caret>
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
do {
|
do {
|
||||||
} while (<caret>)
|
} while (<caret>)
|
||||||
@@ -700,8 +658,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
fun testDoWhile10() = doFunTest(
|
fun testDoWhile10() = doFunTest(
|
||||||
"""
|
"""
|
||||||
do while (true<caret>)
|
do while (true<caret>)
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
do {
|
do {
|
||||||
<caret>
|
<caret>
|
||||||
@@ -714,8 +671,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
do {
|
do {
|
||||||
println("some")
|
println("some")
|
||||||
} while<caret>
|
} while<caret>
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
do {
|
do {
|
||||||
println("some")
|
println("some")
|
||||||
@@ -728,8 +684,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
do {
|
do {
|
||||||
println("some")
|
println("some")
|
||||||
} while (true<caret>
|
} while (true<caret>
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
do {
|
do {
|
||||||
<caret>
|
<caret>
|
||||||
@@ -742,8 +697,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
"""
|
"""
|
||||||
do<caret>
|
do<caret>
|
||||||
println("some")
|
println("some")
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
do {
|
do {
|
||||||
println("some")
|
println("some")
|
||||||
@@ -755,8 +709,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
"""
|
"""
|
||||||
do <caret>
|
do <caret>
|
||||||
println("some")
|
println("some")
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
do {
|
do {
|
||||||
println("some")
|
println("some")
|
||||||
@@ -768,8 +721,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
"""
|
"""
|
||||||
do println("some") while (true<caret>)
|
do println("some") while (true<caret>)
|
||||||
println("hi")
|
println("hi")
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
do println("some") while (true)
|
do println("some") while (true)
|
||||||
<caret>
|
<caret>
|
||||||
@@ -781,8 +733,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
"""
|
"""
|
||||||
do <caret>println("some") while (true)
|
do <caret>println("some") while (true)
|
||||||
println("hi")
|
println("hi")
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
do println("some") while (true)
|
do println("some") while (true)
|
||||||
<caret>
|
<caret>
|
||||||
@@ -835,8 +786,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
fun testFunBody() = doFileTest(
|
fun testFunBody() = doFileTest(
|
||||||
"""
|
"""
|
||||||
fun test<caret>()
|
fun test<caret>()
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
fun test() {
|
fun test() {
|
||||||
<caret>
|
<caret>
|
||||||
@@ -847,8 +797,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
fun testFunBody1() = doFileTest(
|
fun testFunBody1() = doFileTest(
|
||||||
"""
|
"""
|
||||||
fun test<caret>
|
fun test<caret>
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
fun test() {
|
fun test() {
|
||||||
<caret>
|
<caret>
|
||||||
@@ -859,8 +808,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
fun testFunBody2() = doFileTest(
|
fun testFunBody2() = doFileTest(
|
||||||
"""
|
"""
|
||||||
fun (p: Int, s: String<caret>
|
fun (p: Int, s: String<caret>
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
fun(p: Int, s: String) {
|
fun(p: Int, s: String) {
|
||||||
<caret>
|
<caret>
|
||||||
@@ -873,8 +821,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
interface Some {
|
interface Some {
|
||||||
fun (<caret>p: Int)
|
fun (<caret>p: Int)
|
||||||
}
|
}
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
interface Some {
|
interface Some {
|
||||||
fun(p: Int)
|
fun(p: Int)
|
||||||
@@ -888,8 +835,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
class Some {
|
class Some {
|
||||||
abstract fun (<caret>p: Int)
|
abstract fun (<caret>p: Int)
|
||||||
}
|
}
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
class Some {
|
class Some {
|
||||||
abstract fun(p: Int)
|
abstract fun(p: Int)
|
||||||
@@ -903,8 +849,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
class Some {
|
class Some {
|
||||||
fun test(<caret>p: Int) = 1
|
fun test(<caret>p: Int) = 1
|
||||||
}
|
}
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
class Some {
|
class Some {
|
||||||
fun test(p: Int) = 1
|
fun test(p: Int) = 1
|
||||||
@@ -917,8 +862,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
"""
|
"""
|
||||||
fun test(<caret>p: Int) {
|
fun test(<caret>p: Int) {
|
||||||
}
|
}
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
fun test(p: Int) {
|
fun test(p: Int) {
|
||||||
<caret>
|
<caret>
|
||||||
@@ -1017,8 +961,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
"""
|
"""
|
||||||
var a : Int = 0
|
var a : Int = 0
|
||||||
set<caret>
|
set<caret>
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
var a : Int = 0
|
var a : Int = 0
|
||||||
set
|
set
|
||||||
@@ -1030,8 +973,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
"""
|
"""
|
||||||
var a : Int = 0
|
var a : Int = 0
|
||||||
set(<caret>
|
set(<caret>
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
var a : Int = 0
|
var a : Int = 0
|
||||||
set(value) {
|
set(value) {
|
||||||
@@ -1044,8 +986,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
"""
|
"""
|
||||||
var a : Int = 0
|
var a : Int = 0
|
||||||
set(<caret>)
|
set(<caret>)
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
var a : Int = 0
|
var a : Int = 0
|
||||||
set(value) {
|
set(value) {
|
||||||
@@ -1058,8 +999,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
"""
|
"""
|
||||||
var a : Int = 0
|
var a : Int = 0
|
||||||
set(v<caret>)
|
set(v<caret>)
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
var a : Int = 0
|
var a : Int = 0
|
||||||
set(v) {
|
set(v) {
|
||||||
@@ -1073,8 +1013,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
var a : Int = 0
|
var a : Int = 0
|
||||||
set(<caret>) {
|
set(<caret>) {
|
||||||
}
|
}
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
var a : Int = 0
|
var a : Int = 0
|
||||||
set(value) {
|
set(value) {
|
||||||
@@ -1088,8 +1027,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
var a : Int = 0
|
var a : Int = 0
|
||||||
set(v<caret>) {
|
set(v<caret>) {
|
||||||
}
|
}
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
var a : Int = 0
|
var a : Int = 0
|
||||||
set(v) {
|
set(v) {
|
||||||
@@ -1102,8 +1040,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
"""
|
"""
|
||||||
var a : Int = 0
|
var a : Int = 0
|
||||||
set(value){<caret>}
|
set(value){<caret>}
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
var a : Int = 0
|
var a : Int = 0
|
||||||
set(value) {}
|
set(value) {}
|
||||||
@@ -1115,8 +1052,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
"""
|
"""
|
||||||
var a : Int = 0
|
var a : Int = 0
|
||||||
private set<caret>
|
private set<caret>
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
var a : Int = 0
|
var a : Int = 0
|
||||||
private set
|
private set
|
||||||
@@ -1128,8 +1064,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
"""
|
"""
|
||||||
var a : Int = 0
|
var a : Int = 0
|
||||||
private set(<caret>
|
private set(<caret>
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
var a : Int = 0
|
var a : Int = 0
|
||||||
private set(value) {
|
private set(value) {
|
||||||
@@ -1142,8 +1077,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
"""
|
"""
|
||||||
var a : Int = 0
|
var a : Int = 0
|
||||||
private set(<caret>)
|
private set(<caret>)
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
var a : Int = 0
|
var a : Int = 0
|
||||||
private set(value) {
|
private set(value) {
|
||||||
@@ -1156,8 +1090,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
"""
|
"""
|
||||||
var a : Int = 0
|
var a : Int = 0
|
||||||
private set(v<caret>)
|
private set(v<caret>)
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
var a : Int = 0
|
var a : Int = 0
|
||||||
private set(v) {
|
private set(v) {
|
||||||
@@ -1171,8 +1104,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
var a : Int = 0
|
var a : Int = 0
|
||||||
private set(<caret>) {
|
private set(<caret>) {
|
||||||
}
|
}
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
var a : Int = 0
|
var a : Int = 0
|
||||||
private set(value) {
|
private set(value) {
|
||||||
@@ -1186,8 +1118,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
var a : Int = 0
|
var a : Int = 0
|
||||||
private set(v<caret>) {
|
private set(v<caret>) {
|
||||||
}
|
}
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
var a : Int = 0
|
var a : Int = 0
|
||||||
private set(v) {
|
private set(v) {
|
||||||
@@ -1199,8 +1130,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
fun testTryBody() = doFunTest(
|
fun testTryBody() = doFunTest(
|
||||||
"""
|
"""
|
||||||
try<caret>
|
try<caret>
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
try {
|
try {
|
||||||
<caret>
|
<caret>
|
||||||
@@ -1212,8 +1142,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
"""
|
"""
|
||||||
try {
|
try {
|
||||||
} catch(e: Exception) <caret>
|
} catch(e: Exception) <caret>
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
try {
|
try {
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
@@ -1226,8 +1155,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
"""
|
"""
|
||||||
try {
|
try {
|
||||||
} catch<caret>
|
} catch<caret>
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
try {
|
try {
|
||||||
} catch (<caret>) {
|
} catch (<caret>) {
|
||||||
@@ -1239,8 +1167,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
"""
|
"""
|
||||||
try {
|
try {
|
||||||
} catch(<caret>
|
} catch(<caret>
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
try {
|
try {
|
||||||
} catch (<caret>) {
|
} catch (<caret>) {
|
||||||
@@ -1252,8 +1179,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
"""
|
"""
|
||||||
try {
|
try {
|
||||||
} catch(<caret> {}
|
} catch(<caret> {}
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
try {
|
try {
|
||||||
} catch (<caret>) {
|
} catch (<caret>) {
|
||||||
@@ -1265,8 +1191,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
"""
|
"""
|
||||||
try {
|
try {
|
||||||
} catch(e: Exception<caret>
|
} catch(e: Exception<caret>
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
try {
|
try {
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
@@ -1280,8 +1205,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
try {
|
try {
|
||||||
} catch(e: Exception) {
|
} catch(e: Exception) {
|
||||||
} finally<caret>
|
} finally<caret>
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
try {
|
try {
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
@@ -1298,8 +1222,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
fun test() {
|
fun test() {
|
||||||
foo(Any()<caret>)
|
foo(Any()<caret>)
|
||||||
}
|
}
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
fun foo(a: Any, block: () -> Unit) {
|
fun foo(a: Any, block: () -> Unit) {
|
||||||
}
|
}
|
||||||
@@ -1316,8 +1239,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
fun test() {
|
fun test() {
|
||||||
foo(Any()<caret>)
|
foo(Any()<caret>)
|
||||||
}
|
}
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
fun foo(a: Any, block: Any.() -> Unit) {
|
fun foo(a: Any, block: Any.() -> Unit) {
|
||||||
}
|
}
|
||||||
@@ -1332,8 +1254,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
class Foo {
|
class Foo {
|
||||||
init<caret>
|
init<caret>
|
||||||
}
|
}
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
class Foo {
|
class Foo {
|
||||||
init {
|
init {
|
||||||
@@ -1346,8 +1267,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
fun testClassBody1() = doFileTest(
|
fun testClassBody1() = doFileTest(
|
||||||
"""
|
"""
|
||||||
class Foo<caret>
|
class Foo<caret>
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
class Foo {
|
class Foo {
|
||||||
<caret>
|
<caret>
|
||||||
@@ -1358,8 +1278,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
fun testClassBody2() = doFileTest(
|
fun testClassBody2() = doFileTest(
|
||||||
"""
|
"""
|
||||||
class <caret>Foo
|
class <caret>Foo
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
class Foo {
|
class Foo {
|
||||||
<caret>
|
<caret>
|
||||||
@@ -1371,8 +1290,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
"""
|
"""
|
||||||
interface I
|
interface I
|
||||||
val a = object : I<caret>
|
val a = object : I<caret>
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
interface I
|
interface I
|
||||||
val a = object : I {
|
val a = object : I {
|
||||||
@@ -1387,8 +1305,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
val a = object : I<caret>
|
val a = object : I<caret>
|
||||||
|
|
||||||
val b = ""
|
val b = ""
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
interface I
|
interface I
|
||||||
val a = object : I {
|
val a = object : I {
|
||||||
@@ -1403,8 +1320,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
"""
|
"""
|
||||||
open class A
|
open class A
|
||||||
class B : A()<caret>
|
class B : A()<caret>
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
open class A
|
open class A
|
||||||
class B : A() {
|
class B : A() {
|
||||||
@@ -1417,8 +1333,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
"""
|
"""
|
||||||
open class A
|
open class A
|
||||||
class B : A<caret>
|
class B : A<caret>
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
open class A
|
open class A
|
||||||
class B : A() {
|
class B : A() {
|
||||||
@@ -1431,8 +1346,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
"""
|
"""
|
||||||
sealed class A(val s: String)
|
sealed class A(val s: String)
|
||||||
class B : A<caret>
|
class B : A<caret>
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
sealed class A(val s: String)
|
sealed class A(val s: String)
|
||||||
class B : A() {
|
class B : A() {
|
||||||
@@ -1447,8 +1361,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
interface J
|
interface J
|
||||||
abstract class A
|
abstract class A
|
||||||
class B : I, A, J<caret>
|
class B : I, A, J<caret>
|
||||||
"""
|
""",
|
||||||
,
|
|
||||||
"""
|
"""
|
||||||
interface I
|
interface I
|
||||||
interface J
|
interface J
|
||||||
@@ -1522,7 +1435,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
"""
|
"""
|
||||||
fun foo(i: Int) = 1
|
fun foo(i: Int) = 1
|
||||||
fun test4() {
|
fun test4() {
|
||||||
foo(1, <caret>)
|
foo(1,<caret>)
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -12,7 +12,6 @@ import com.intellij.codeInsight.intention.IntentionAction
|
|||||||
import com.intellij.codeInspection.InspectionEP
|
import com.intellij.codeInspection.InspectionEP
|
||||||
import com.intellij.codeInspection.LocalInspectionEP
|
import com.intellij.codeInspection.LocalInspectionEP
|
||||||
import com.intellij.ide.highlighter.JavaFileType
|
import com.intellij.ide.highlighter.JavaFileType
|
||||||
import com.intellij.openapi.command.CommandProcessor
|
|
||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import com.intellij.openapi.fileTypes.FileType
|
import com.intellij.openapi.fileTypes.FileType
|
||||||
import com.intellij.openapi.fileTypes.PlainTextFileType
|
import com.intellij.openapi.fileTypes.PlainTextFileType
|
||||||
@@ -31,6 +30,7 @@ import org.jetbrains.kotlin.idea.quickfix.utils.findInspectionFile
|
|||||||
import org.jetbrains.kotlin.idea.test.DirectiveBasedActionUtils
|
import org.jetbrains.kotlin.idea.test.DirectiveBasedActionUtils
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase
|
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase
|
||||||
import org.jetbrains.kotlin.idea.test.withCustomCompilerOptions
|
import org.jetbrains.kotlin.idea.test.withCustomCompilerOptions
|
||||||
|
import org.jetbrains.kotlin.idea.util.application.executeCommand
|
||||||
import org.jetbrains.kotlin.psi.KtFile
|
import org.jetbrains.kotlin.psi.KtFile
|
||||||
import org.jetbrains.kotlin.test.Directives
|
import org.jetbrains.kotlin.test.Directives
|
||||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||||
@@ -133,9 +133,7 @@ abstract class AbstractQuickFixMultiFileTest : KotlinLightCodeInsightFixtureTest
|
|||||||
|
|
||||||
configureMultiFileTest(subFiles, beforeFile)
|
configureMultiFileTest(subFiles, beforeFile)
|
||||||
withCustomCompilerOptions(multiFileText, project, module) {
|
withCustomCompilerOptions(multiFileText, project, module) {
|
||||||
CommandProcessor.getInstance().executeCommand(
|
project.executeCommand("") {
|
||||||
project,
|
|
||||||
{
|
|
||||||
try {
|
try {
|
||||||
val psiFile = file
|
val psiFile = file
|
||||||
|
|
||||||
@@ -188,9 +186,7 @@ abstract class AbstractQuickFixMultiFileTest : KotlinLightCodeInsightFixtureTest
|
|||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
TestCase.fail(getTestName(true))
|
TestCase.fail(getTestName(true))
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
"", "",
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -214,9 +210,7 @@ abstract class AbstractQuickFixMultiFileTest : KotlinLightCodeInsightFixtureTest
|
|||||||
myFixture.configureByFiles(*testFiles.toTypedArray())
|
myFixture.configureByFiles(*testFiles.toTypedArray())
|
||||||
|
|
||||||
withCustomCompilerOptions(originalFileText, project, module) {
|
withCustomCompilerOptions(originalFileText, project, module) {
|
||||||
CommandProcessor.getInstance().executeCommand(
|
project.executeCommand("") {
|
||||||
project,
|
|
||||||
{
|
|
||||||
try {
|
try {
|
||||||
val psiFile = file
|
val psiFile = file
|
||||||
|
|
||||||
@@ -274,9 +268,7 @@ abstract class AbstractQuickFixMultiFileTest : KotlinLightCodeInsightFixtureTest
|
|||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
TestCase.fail(getTestName(true))
|
TestCase.fail(getTestName(true))
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
"", "",
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -8,7 +8,6 @@ package org.jetbrains.kotlin.idea.quickfix
|
|||||||
import com.intellij.codeInsight.daemon.quickFix.ActionHint
|
import com.intellij.codeInsight.daemon.quickFix.ActionHint
|
||||||
import com.intellij.codeInsight.daemon.quickFix.LightQuickFixTestCase
|
import com.intellij.codeInsight.daemon.quickFix.LightQuickFixTestCase
|
||||||
import com.intellij.codeInsight.intention.IntentionAction
|
import com.intellij.codeInsight.intention.IntentionAction
|
||||||
import com.intellij.openapi.command.CommandProcessor
|
|
||||||
import com.intellij.testFramework.UsefulTestCase
|
import com.intellij.testFramework.UsefulTestCase
|
||||||
import junit.framework.ComparisonFailure
|
import junit.framework.ComparisonFailure
|
||||||
import junit.framework.TestCase
|
import junit.framework.TestCase
|
||||||
@@ -19,6 +18,7 @@ import org.jetbrains.kotlin.idea.test.DirectiveBasedActionUtils
|
|||||||
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase
|
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase
|
||||||
import org.jetbrains.kotlin.idea.test.allKotlinFiles
|
import org.jetbrains.kotlin.idea.test.allKotlinFiles
|
||||||
import org.jetbrains.kotlin.idea.test.findFileWithCaret
|
import org.jetbrains.kotlin.idea.test.findFileWithCaret
|
||||||
|
import org.jetbrains.kotlin.idea.util.application.executeCommand
|
||||||
import org.jetbrains.kotlin.psi.KtFile
|
import org.jetbrains.kotlin.psi.KtFile
|
||||||
import org.jetbrains.kotlin.test.InTextDirectivesUtils
|
import org.jetbrains.kotlin.test.InTextDirectivesUtils
|
||||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||||
@@ -43,7 +43,7 @@ abstract class AbstractQuickFixMultiModuleTest : AbstractMultiModuleTest(), Quic
|
|||||||
val inspections = parseInspectionsToEnable(virtualFile.path, actionFileText).toTypedArray()
|
val inspections = parseInspectionsToEnable(virtualFile.path, actionFileText).toTypedArray()
|
||||||
enableInspectionTools(*inspections)
|
enableInspectionTools(*inspections)
|
||||||
|
|
||||||
CommandProcessor.getInstance().executeCommand(project, {
|
project.executeCommand("") {
|
||||||
var expectedErrorMessage = ""
|
var expectedErrorMessage = ""
|
||||||
try {
|
try {
|
||||||
val actionHint = ActionHint.parse(actionFile, actionFileText)
|
val actionHint = ActionHint.parse(actionFile, actionFileText)
|
||||||
@@ -51,15 +51,24 @@ abstract class AbstractQuickFixMultiModuleTest : AbstractMultiModuleTest(), Quic
|
|||||||
|
|
||||||
val actionShouldBeAvailable = actionHint.shouldPresent()
|
val actionShouldBeAvailable = actionHint.shouldPresent()
|
||||||
|
|
||||||
expectedErrorMessage = InTextDirectivesUtils.findListWithPrefixes(actionFileText, "// SHOULD_FAIL_WITH: ")
|
expectedErrorMessage = InTextDirectivesUtils.findListWithPrefixes(
|
||||||
.joinToString(separator = "\n")
|
actionFileText,
|
||||||
|
"// SHOULD_FAIL_WITH: "
|
||||||
|
).joinToString(separator = "\n")
|
||||||
|
|
||||||
TypeAccessibilityChecker.testLog = StringBuilder()
|
TypeAccessibilityChecker.testLog = StringBuilder()
|
||||||
val log = try {
|
val log = try {
|
||||||
AbstractQuickFixMultiFileTest.doAction(
|
AbstractQuickFixMultiFileTest.doAction(
|
||||||
text, file, editor, actionShouldBeAvailable, actionFileName, this::availableActions, this::doHighlighting,
|
text,
|
||||||
|
file,
|
||||||
|
editor,
|
||||||
|
actionShouldBeAvailable,
|
||||||
|
actionFileName,
|
||||||
|
this::availableActions,
|
||||||
|
this::doHighlighting,
|
||||||
InTextDirectivesUtils.isDirectiveDefined(actionFile.text, "// SHOULD_BE_AVAILABLE_AFTER_EXECUTION")
|
InTextDirectivesUtils.isDirectiveDefined(actionFile.text, "// SHOULD_BE_AVAILABLE_AFTER_EXECUTION")
|
||||||
)
|
)
|
||||||
|
|
||||||
TypeAccessibilityChecker.testLog.toString()
|
TypeAccessibilityChecker.testLog.toString()
|
||||||
} finally {
|
} finally {
|
||||||
TypeAccessibilityChecker.testLog = null
|
TypeAccessibilityChecker.testLog = null
|
||||||
@@ -94,7 +103,7 @@ abstract class AbstractQuickFixMultiModuleTest : AbstractMultiModuleTest(), Quic
|
|||||||
compareToExpected(dirPath)
|
compareToExpected(dirPath)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, "", "")
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun compareToExpected(directory: String) {
|
private fun compareToExpected(directory: String) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -41,15 +41,13 @@ abstract class AbstractQuickFixTest : KotlinLightCodeInsightFixtureTestCase(), Q
|
|||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
)
|
)
|
||||||
|
|
||||||
private fun unwrapIntention(action: Any): Any {
|
private fun unwrapIntention(action: Any): Any = when (action) {
|
||||||
return when (action) {
|
|
||||||
is IntentionActionDelegate -> unwrapIntention(action.delegate)
|
is IntentionActionDelegate -> unwrapIntention(action.delegate)
|
||||||
is IntentionActionWrapper -> unwrapIntention(action.delegate)
|
is IntentionActionWrapper -> unwrapIntention(action.delegate)
|
||||||
is QuickFixWrapper -> unwrapIntention(action.fix)
|
is QuickFixWrapper -> unwrapIntention(action.fix)
|
||||||
else -> action
|
else -> action
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Throws(Exception::class)
|
@Throws(Exception::class)
|
||||||
protected fun doTest(beforeFileName: String) {
|
protected fun doTest(beforeFileName: String) {
|
||||||
@@ -67,29 +65,30 @@ abstract class AbstractQuickFixTest : KotlinLightCodeInsightFixtureTestCase(), Q
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getProjectDescriptor(): LightProjectDescriptor {
|
override fun getProjectDescriptor(): LightProjectDescriptor =
|
||||||
if ("createfromusage" in testDataPath.toLowerCase()) {
|
if ("createfromusage" in testDataPath.toLowerCase()) {
|
||||||
return KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
|
KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
|
||||||
}
|
} else {
|
||||||
return super.getProjectDescriptor()
|
super.getProjectDescriptor()
|
||||||
}
|
}
|
||||||
|
|
||||||
override val captureExceptions: Boolean
|
override val captureExceptions: Boolean
|
||||||
get() = false
|
get() = false
|
||||||
|
|
||||||
fun shouldBeAvailableAfterExecution(): Boolean {
|
private fun shouldBeAvailableAfterExecution(): Boolean = InTextDirectivesUtils.isDirectiveDefined(
|
||||||
return InTextDirectivesUtils.isDirectiveDefined(myFixture.file.text, "// SHOULD_BE_AVAILABLE_AFTER_EXECUTION")
|
myFixture.file.text,
|
||||||
}
|
"// SHOULD_BE_AVAILABLE_AFTER_EXECUTION"
|
||||||
|
)
|
||||||
|
|
||||||
protected open fun configExtra(options: String) {
|
protected open fun configExtra(options: String) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getPathAccordingToPackage(name: String, text: String): String {
|
private fun getPathAccordingToPackage(name: String, text: String): String {
|
||||||
val packagePath = text.lines().let { it.find { it.trim().startsWith("package") } }
|
val packagePath = text.lines().let { list -> list.find { it.trim().startsWith("package") } }
|
||||||
?.removePrefix("package")
|
?.removePrefix("package")
|
||||||
?.trim()?.replace(".", "/") ?: ""
|
?.trim()?.replace(".", "/") ?: ""
|
||||||
return packagePath + "/" + name
|
return "$packagePath/$name"
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun doKotlinQuickFixTest(beforeFileName: String) {
|
private fun doKotlinQuickFixTest(beforeFileName: String) {
|
||||||
@@ -212,13 +211,13 @@ abstract class AbstractQuickFixTest : KotlinLightCodeInsightFixtureTestCase(), Q
|
|||||||
if (actionHint.expectedText.startsWith(prefix)) {
|
if (actionHint.expectedText.startsWith(prefix)) {
|
||||||
val className = actionHint.expectedText.substring(prefix.length)
|
val className = actionHint.expectedText.substring(prefix.length)
|
||||||
val aClass = Class.forName(className)
|
val aClass = Class.forName(className)
|
||||||
assert(IntentionAction::class.java.isAssignableFrom(aClass)) { className + " should be inheritor of IntentionAction" }
|
assert(IntentionAction::class.java.isAssignableFrom(aClass)) { "$className should be inheritor of IntentionAction" }
|
||||||
|
|
||||||
val validActions = HashSet(InTextDirectivesUtils.findLinesWithPrefixesRemoved(text, "// ACTION:"))
|
val validActions = HashSet(InTextDirectivesUtils.findLinesWithPrefixesRemoved(text, "// ACTION:"))
|
||||||
|
|
||||||
actions.removeAll { action -> !aClass.isAssignableFrom(action.javaClass) || validActions.contains(action.text) }
|
actions.removeAll { action -> !aClass.isAssignableFrom(action.javaClass) || validActions.contains(action.text) }
|
||||||
|
|
||||||
if (!actions.isEmpty()) {
|
if (actions.isNotEmpty()) {
|
||||||
Assert.fail("Unexpected intention actions present\n " + actions.map { action ->
|
Assert.fail("Unexpected intention actions present\n " + actions.map { action ->
|
||||||
action.javaClass.toString() + " " + action.toString() + "\n"
|
action.javaClass.toString() + " " + action.toString() + "\n"
|
||||||
}
|
}
|
||||||
@@ -237,7 +236,7 @@ abstract class AbstractQuickFixTest : KotlinLightCodeInsightFixtureTestCase(), Q
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun findActionWithText(text: String): IntentionAction? {
|
private fun findActionWithText(text: String): IntentionAction? {
|
||||||
val intentions = myFixture.availableIntentions.filter { it.text == text }
|
val intentions = myFixture.availableIntentions.filter { it.text == text }
|
||||||
if (intentions.isNotEmpty()) return intentions.first()
|
if (intentions.isNotEmpty()) return intentions.first()
|
||||||
|
|
||||||
@@ -260,18 +259,16 @@ abstract class AbstractQuickFixTest : KotlinLightCodeInsightFixtureTestCase(), Q
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
fun checkForUnexpectedErrors() {
|
private fun checkForUnexpectedErrors() = DirectiveBasedActionUtils.checkForUnexpectedErrors(myFixture.file as KtFile)
|
||||||
DirectiveBasedActionUtils.checkForUnexpectedErrors(myFixture.file as KtFile)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getTestDataPath(): String {
|
override fun getTestDataPath(): String {
|
||||||
// Ensure full path is returned. Otherwise FileComparisonFailureException does not provide link to file diff
|
// Ensure full path is returned. Otherwise FileComparisonFailureException does not provide link to file diff
|
||||||
val testDataPath = super.getTestDataPath()
|
val testDataPath = super.getTestDataPath()
|
||||||
try {
|
return try {
|
||||||
return File(testDataPath).getCanonicalPath()
|
File(testDataPath).canonicalPath
|
||||||
} catch (e: IOException) {
|
} catch (e: IOException) {
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
return testDataPath
|
testDataPath
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+23
-13
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.idea.refactoring.changeSignature
|
package org.jetbrains.kotlin.idea.refactoring.changeSignature
|
||||||
|
|
||||||
|
import com.intellij.application.options.CodeStyle
|
||||||
import com.intellij.codeInsight.TargetElementUtil
|
import com.intellij.codeInsight.TargetElementUtil
|
||||||
import com.intellij.codeInsight.TargetElementUtil.ELEMENT_NAME_ACCEPTED
|
import com.intellij.codeInsight.TargetElementUtil.ELEMENT_NAME_ACCEPTED
|
||||||
import com.intellij.codeInsight.TargetElementUtil.REFERENCED_ELEMENT_ACCEPTED
|
import com.intellij.codeInsight.TargetElementUtil.REFERENCED_ELEMENT_ACCEPTED
|
||||||
@@ -62,18 +63,23 @@ class KotlinChangeSignatureTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
|
|
||||||
override fun getProjectDescriptor(): LightProjectDescriptor = KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
|
override fun getProjectDescriptor(): LightProjectDescriptor = KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
|
||||||
|
|
||||||
|
override fun setUp() {
|
||||||
|
super.setUp()
|
||||||
|
CodeStyle.getSettings(project).clearCodeStyleSettings()
|
||||||
|
}
|
||||||
|
|
||||||
override fun tearDown() {
|
override fun tearDown() {
|
||||||
files = emptyList()
|
files = emptyList()
|
||||||
psiFiles = PsiFile.EMPTY_ARRAY
|
psiFiles = PsiFile.EMPTY_ARRAY
|
||||||
super.tearDown()
|
super.tearDown()
|
||||||
}
|
}
|
||||||
|
|
||||||
lateinit var files: List<String>
|
private lateinit var files: List<String>
|
||||||
lateinit var psiFiles: Array<PsiFile>
|
private lateinit var psiFiles: Array<PsiFile>
|
||||||
|
|
||||||
private fun findCallers(method: PsiMethod): LinkedHashSet<PsiMethod> {
|
private fun findCallers(method: PsiMethod): LinkedHashSet<PsiMethod> {
|
||||||
val root = KotlinMethodNode(method, HashSet(), project, Runnable { })
|
val root = KotlinMethodNode(method, HashSet(), project) { }
|
||||||
return (0..root.childCount - 1).flatMapTo(LinkedHashSet<PsiMethod>()) {
|
return (0 until root.childCount).flatMapTo(LinkedHashSet<PsiMethod>()) {
|
||||||
(root.getChildAt(it) as KotlinMethodNode).member.toLightMethods()
|
(root.getChildAt(it) as KotlinMethodNode).member.toLightMethods()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -83,7 +89,7 @@ class KotlinChangeSignatureTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
var i = 0
|
var i = 0
|
||||||
indexLoop@ while (true) {
|
indexLoop@ while (true) {
|
||||||
for (extension in EXTENSIONS) {
|
for (extension in EXTENSIONS) {
|
||||||
val extraFileName = getTestName(false) + "Before" + (if (i > 0) "." + i else "") + extension
|
val extraFileName = getTestName(false) + "Before" + (if (i > 0) ".$i" else "") + extension
|
||||||
val extraFile = File(testDataPath + extraFileName)
|
val extraFile = File(testDataPath + extraFileName)
|
||||||
if (extraFile.exists()) {
|
if (extraFile.exists()) {
|
||||||
fileList.add(extraFileName)
|
fileList.add(extraFileName)
|
||||||
@@ -159,7 +165,7 @@ class KotlinChangeSignatureTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
val project = method.project
|
val project = method.project
|
||||||
|
|
||||||
var newName = method.name
|
var newName = method.name
|
||||||
var newReturnType = method.returnType ?: PsiType.VOID
|
var newReturnType: PsiType = method.returnType ?: PsiType.VOID
|
||||||
val newParameters = ArrayList<ParameterInfoImpl>()
|
val newParameters = ArrayList<ParameterInfoImpl>()
|
||||||
val parameterPropagationTargets = LinkedHashSet<PsiMethod>()
|
val parameterPropagationTargets = LinkedHashSet<PsiMethod>()
|
||||||
|
|
||||||
@@ -343,7 +349,7 @@ class KotlinChangeSignatureTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun testGenericFunctions() {
|
fun testGenericFunctions() {
|
||||||
doTest() {
|
doTest {
|
||||||
newVisibility = Visibilities.PUBLIC
|
newVisibility = Visibilities.PUBLIC
|
||||||
|
|
||||||
newParameters[0].name = "_x1"
|
newParameters[0].name = "_x1"
|
||||||
@@ -618,7 +624,8 @@ class KotlinChangeSignatureTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
|
|
||||||
fun testFqNameShortening() {
|
fun testFqNameShortening() {
|
||||||
doTest {
|
doTest {
|
||||||
val newParameter = KotlinParameterInfo(originalBaseFunctionDescriptor, -1, "s", KotlinTypeInfo(false, BUILT_INS.anyType)).apply {
|
val newParameter =
|
||||||
|
KotlinParameterInfo(originalBaseFunctionDescriptor, -1, "s", KotlinTypeInfo(false, BUILT_INS.anyType)).apply {
|
||||||
currentTypeInfo = KotlinTypeInfo(false, null, "kotlin.String")
|
currentTypeInfo = KotlinTypeInfo(false, null, "kotlin.String")
|
||||||
}
|
}
|
||||||
addParameter(newParameter)
|
addParameter(newParameter)
|
||||||
@@ -936,7 +943,7 @@ class KotlinChangeSignatureTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
doTest { newParameters[1].name = "b" }
|
doTest { newParameters[1].name = "b" }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun testConvertParameterToReceiverAddParens() {
|
fun testConvertParameterToReceiverAddParents() {
|
||||||
doTest { receiverParameterInfo = newParameters[0] }
|
doTest { receiverParameterInfo = newParameters[0] }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1126,7 +1133,8 @@ class KotlinChangeSignatureTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
primaryPropagationTargets = listOf(KotlinTopLevelFunctionFqnNameIndex.getInstance().get("bar", project, project.allScope()).first())
|
primaryPropagationTargets =
|
||||||
|
listOf(KotlinTopLevelFunctionFqnNameIndex.getInstance().get("bar", project, project.allScope()).first())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1144,7 +1152,8 @@ class KotlinChangeSignatureTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
primaryPropagationTargets = listOf(KotlinTopLevelFunctionFqnNameIndex.getInstance().get("bar", project, project.allScope()).first())
|
primaryPropagationTargets =
|
||||||
|
listOf(KotlinTopLevelFunctionFqnNameIndex.getInstance().get("bar", project, project.allScope()).first())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1182,7 +1191,8 @@ class KotlinChangeSignatureTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
primaryPropagationTargets = listOf(KotlinTopLevelFunctionFqnNameIndex.getInstance().get("bar", project, project.allScope()).first())
|
primaryPropagationTargets =
|
||||||
|
listOf(KotlinTopLevelFunctionFqnNameIndex.getInstance().get("bar", project, project.allScope()).first())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1491,7 +1501,7 @@ class KotlinChangeSignatureTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
fun testReturnTypeViaCodeFragment() {
|
fun testReturnTypeViaCodeFragment() {
|
||||||
doTest {
|
doTest {
|
||||||
newName = "bar"
|
newName = "bar"
|
||||||
newReturnTypeInfo = resolveType("A<T, U>", true, true)
|
newReturnTypeInfo = resolveType("A<T, U>", isCovariant = true, forPreview = true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -23,12 +23,13 @@ import com.intellij.openapi.vfs.VfsUtil
|
|||||||
import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess
|
import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess
|
||||||
import com.intellij.psi.PsiFile
|
import com.intellij.psi.PsiFile
|
||||||
import com.intellij.testFramework.PsiTestUtil
|
import com.intellij.testFramework.PsiTestUtil
|
||||||
import org.jetbrains.kotlin.config.*
|
import org.jetbrains.kotlin.config.CompilerSettings
|
||||||
|
import org.jetbrains.kotlin.config.KotlinFacetSettings
|
||||||
|
import org.jetbrains.kotlin.config.KotlinFacetSettingsProvider
|
||||||
|
import org.jetbrains.kotlin.config.LanguageFeature
|
||||||
import org.jetbrains.kotlin.idea.facet.getOrCreateFacet
|
import org.jetbrains.kotlin.idea.facet.getOrCreateFacet
|
||||||
import org.jetbrains.kotlin.idea.facet.initializeIfNeeded
|
import org.jetbrains.kotlin.idea.facet.initializeIfNeeded
|
||||||
import org.jetbrains.kotlin.idea.test.ConfigLibraryUtil
|
import org.jetbrains.kotlin.idea.test.*
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinJdkAndLibraryProjectDescriptor
|
|
||||||
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase
|
|
||||||
import org.jetbrains.kotlin.platform.TargetPlatform
|
import org.jetbrains.kotlin.platform.TargetPlatform
|
||||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||||
import org.jetbrains.kotlin.test.TestJdkKind
|
import org.jetbrains.kotlin.test.TestJdkKind
|
||||||
@@ -41,6 +42,7 @@ abstract class AbstractMultiModuleTest : DaemonAnalyzerTestCase() {
|
|||||||
|
|
||||||
override fun setUp() {
|
override fun setUp() {
|
||||||
super.setUp()
|
super.setUp()
|
||||||
|
enableKotlinOfficialCodeStyle(project)
|
||||||
VfsRootAccess.allowRootAccess(KotlinTestUtils.getHomeDirectory())
|
VfsRootAccess.allowRootAccess(KotlinTestUtils.getHomeDirectory())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,6 +64,7 @@ abstract class AbstractMultiModuleTest : DaemonAnalyzerTestCase() {
|
|||||||
|
|
||||||
override fun tearDown() {
|
override fun tearDown() {
|
||||||
VfsRootAccess.disallowRootAccess(KotlinTestUtils.getHomeDirectory())
|
VfsRootAccess.disallowRootAccess(KotlinTestUtils.getHomeDirectory())
|
||||||
|
disableKotlinOfficialCodeStyle(project)
|
||||||
super.tearDown()
|
super.tearDown()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+11
-1
@@ -1,6 +1,16 @@
|
|||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
|
|
||||||
annotation class Ann(val i: Int = 1, val i2: IntArray = [1], val i3: IntArray = [1], val klass: KClass<*> = A::class, val klass2: Array<KClass<*>> = [A::class], val klass3: Array<KClass<*>> = [A::class], val ann: Inner = Inner(), val ann2: Array<Inner> = [Inner()], val ann3: Array<Inner> = [Inner(), Inner()])
|
annotation class Ann(
|
||||||
|
val i: Int = 1,
|
||||||
|
val i2: IntArray = [1],
|
||||||
|
val i3: IntArray = [1],
|
||||||
|
val klass: KClass<*> = A::class,
|
||||||
|
val klass2: Array<KClass<*>> = [A::class],
|
||||||
|
val klass3: Array<KClass<*>> = [A::class],
|
||||||
|
val ann: Inner = Inner(),
|
||||||
|
val ann2: Array<Inner> = [Inner()],
|
||||||
|
val ann3: Array<Inner> = [Inner(), Inner()]
|
||||||
|
)
|
||||||
|
|
||||||
class A
|
class A
|
||||||
annotation class Inner
|
annotation class Inner
|
||||||
|
|||||||
+4
-2
@@ -2,5 +2,7 @@ internal annotation class A
|
|||||||
|
|
||||||
internal annotation class B
|
internal annotation class B
|
||||||
|
|
||||||
class U(@param:A @field:B
|
class U(
|
||||||
var i: Int)
|
@param:A @field:B
|
||||||
|
var i: Int
|
||||||
|
)
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
internal annotation class Anon(val stringArray: Array<String>, val intArray: IntArray, // string
|
internal annotation class Anon(
|
||||||
val string: String)
|
val stringArray: Array<String>, val intArray: IntArray, // string
|
||||||
|
val string: String
|
||||||
|
)
|
||||||
|
|
||||||
@Anon(string = "a", stringArray = ["a", "b"], intArray = [1, 2])
|
@Anon(string = "a", stringArray = ["a", "b"], intArray = [1, 2])
|
||||||
@Target(AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FIELD)
|
@Target(AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FIELD)
|
||||||
|
|||||||
+2
-1
@@ -1 +1,2 @@
|
|||||||
/*pre*/ 5 /*operand '5'*/ shl /*left shift*/ 16 /*operand '16'*/ or /*or*/ (1 /*operand '1'*/ shr /*right shift*/ 8 /*operand '8'*/) or /*or*/ 0 /*operand '0'*/ /*post comment*/
|
/*pre*/
|
||||||
|
5 /*operand '5'*/ shl /*left shift*/ 16 /*operand '16'*/ or /*or*/ (1 /*operand '1'*/ shr /*right shift*/ 8 /*operand '8'*/) or /*or*/ 0 /*operand '0'*/ /*post comment*/
|
||||||
@@ -1 +1,2 @@
|
|||||||
val constrArgTypes = arrayOf<Class<*>>(Array<String>::class.java, String::class.java, Int::class.java, Double::class.java)
|
val constrArgTypes =
|
||||||
|
arrayOf<Class<*>>(Array<String>::class.java, String::class.java, Int::class.java, Double::class.java)
|
||||||
@@ -12,7 +12,7 @@ internal class A// this is a primary constructor
|
|||||||
// end of secondary constructor 1 body
|
// end of secondary constructor 1 body
|
||||||
|
|
||||||
internal class B// this constructor will disappear
|
internal class B// this constructor will disappear
|
||||||
(private val x: Int) // end of constructor body
|
(private val x: Int) // end of constructor body
|
||||||
{
|
{
|
||||||
|
|
||||||
fun foo() {}
|
fun foo() {}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
internal class C(private val p1: Int /* parameter p1 */ // field p1
|
internal class C(
|
||||||
|
private val p1: Int /* parameter p1 */ // field p1
|
||||||
,
|
,
|
||||||
/**
|
/**
|
||||||
* Field myP2
|
* Field myP2
|
||||||
*/
|
*/
|
||||||
private val myP2: Int, /* Field p3 */ var p3: Int)
|
private val myP2: Int, /* Field p3 */ var p3: Int
|
||||||
|
)
|
||||||
|
|||||||
+5
-1
@@ -1 +1,5 @@
|
|||||||
internal class C(@Deprecated("") private val p1: Int, @Deprecated("") private val myP2: Int, @Deprecated("") var p3: Int)
|
internal class C(
|
||||||
|
@Deprecated("") private val p1: Int,
|
||||||
|
@Deprecated("") private val myP2: Int,
|
||||||
|
@Deprecated("") var p3: Int
|
||||||
|
)
|
||||||
|
|||||||
@@ -1,12 +1,18 @@
|
|||||||
internal class C1(arg1: Int,
|
internal class C1(
|
||||||
|
arg1: Int,
|
||||||
arg2: Int,
|
arg2: Int,
|
||||||
arg3: Int) {
|
arg3: Int
|
||||||
|
) {
|
||||||
|
|
||||||
constructor(x: Int,
|
constructor(
|
||||||
y: Int) : this(x, x + y, 0) {
|
x: Int,
|
||||||
|
y: Int
|
||||||
|
) : this(x, x + y, 0) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class C2(private val arg1: Int,
|
internal class C2(
|
||||||
|
private val arg1: Int,
|
||||||
private val arg2: Int,
|
private val arg2: Int,
|
||||||
arg3: Int)
|
arg3: Int
|
||||||
|
)
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
internal annotation class TestAnnotation
|
internal annotation class TestAnnotation
|
||||||
|
|
||||||
class Test(@param:TestAnnotation @field:TestAnnotation
|
class Test(
|
||||||
|
@param:TestAnnotation @field:TestAnnotation
|
||||||
@get:TestAnnotation
|
@get:TestAnnotation
|
||||||
@set:TestAnnotation
|
@set:TestAnnotation
|
||||||
var arg: String?)
|
var arg: String?
|
||||||
|
)
|
||||||
|
|||||||
+4
-2
@@ -1,7 +1,9 @@
|
|||||||
@Deprecated("Ph'nglui mglw'nafh\n" +
|
@Deprecated(
|
||||||
|
"Ph'nglui mglw'nafh\n" +
|
||||||
" Cthulhu R'lyeh wgah'nagl fhtagn.\n" +
|
" Cthulhu R'lyeh wgah'nagl fhtagn.\n" +
|
||||||
" 'In His House at R'lyeh\n" +
|
" 'In His House at R'lyeh\n" +
|
||||||
" Dead Cthulhu waits dreaming,\n" +
|
" Dead Cthulhu waits dreaming,\n" +
|
||||||
" yet He shall rise and His kingdom\n" +
|
" yet He shall rise and His kingdom\n" +
|
||||||
" shall cover the Earth.'")
|
" shall cover the Earth.'"
|
||||||
|
)
|
||||||
class TestDeprecatedInJavadocWithMultilineMessage
|
class TestDeprecatedInJavadocWithMultilineMessage
|
||||||
@@ -2,7 +2,9 @@ internal enum class Color : Runnable {
|
|||||||
WHITE, BLACK, RED, YELLOW, BLUE;
|
WHITE, BLACK, RED, YELLOW, BLUE;
|
||||||
|
|
||||||
override fun run() {
|
override fun run() {
|
||||||
println("name()=" + name +
|
println(
|
||||||
", toString()=" + toString())
|
"name()=" + name +
|
||||||
|
", toString()=" + toString()
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+19
-1
@@ -23,7 +23,25 @@ internal enum class EE {
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal class X {
|
internal class X {
|
||||||
fun foo(i1: I?, i2: I?, s1: String, s2: String, c1: C, c2: C, i: Int, o1: O, o2: O, e1: E, e2: E, bb1: BB, bb2: BB, arr1: IntArray, arr2: IntArray, ee1: EE?, ee2: EE) {
|
fun foo(
|
||||||
|
i1: I?,
|
||||||
|
i2: I?,
|
||||||
|
s1: String,
|
||||||
|
s2: String,
|
||||||
|
c1: C,
|
||||||
|
c2: C,
|
||||||
|
i: Int,
|
||||||
|
o1: O,
|
||||||
|
o2: O,
|
||||||
|
e1: E,
|
||||||
|
e2: E,
|
||||||
|
bb1: BB,
|
||||||
|
bb2: BB,
|
||||||
|
arr1: IntArray,
|
||||||
|
arr2: IntArray,
|
||||||
|
ee1: EE?,
|
||||||
|
ee2: EE
|
||||||
|
) {
|
||||||
if (i1 === i2) return
|
if (i1 === i2) return
|
||||||
if (s1 === s2) return
|
if (s1 === s2) return
|
||||||
if (c1 == c2) return
|
if (c1 == c2) return
|
||||||
|
|||||||
@@ -2,7 +2,8 @@ internal class F {
|
|||||||
fun f1(p1: Int, p2: Int, p3: Int, p4: Int, vararg p5: Int) {}
|
fun f1(p1: Int, p2: Int, p3: Int, p4: Int, vararg p5: Int) {}
|
||||||
|
|
||||||
fun f2(array: IntArray) {
|
fun f2(array: IntArray) {
|
||||||
f1(1, 2,
|
f1(
|
||||||
|
1, 2,
|
||||||
3, 4,
|
3, 4,
|
||||||
*array
|
*array
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -3,11 +3,14 @@ internal class C {
|
|||||||
|
|
||||||
fun foo2(
|
fun foo2(
|
||||||
p1: Int,
|
p1: Int,
|
||||||
p2: Int) {
|
p2: Int
|
||||||
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun foo3(p1: Int,
|
fun foo3(
|
||||||
p2: Int) {
|
p1: Int,
|
||||||
|
p2: Int
|
||||||
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun foo4(
|
fun foo4(
|
||||||
|
|||||||
@@ -1,3 +1,34 @@
|
|||||||
class Exponent {
|
class Exponent {
|
||||||
private val doubles = doubleArrayOf(5e5, +5e5, -5e5, 5e+5, 5e-5, 5E5, +5E5, -5E5, 5E+5, 5E-5, 2.5e5, +2.5e5, -2.5e5, 2.5e+5, 2.5e-5, 2.5E5, +2.5E5, -2.5E5, 2.5E+5, 2.5E-5, 5e5, 5e5, 5e5, 5e5, 5e-6, 7e+8, 9e-1, 2e+3, 4e5, 6e7)
|
private val doubles = doubleArrayOf(
|
||||||
|
5e5,
|
||||||
|
+5e5,
|
||||||
|
-5e5,
|
||||||
|
5e+5,
|
||||||
|
5e-5,
|
||||||
|
5E5,
|
||||||
|
+5E5,
|
||||||
|
-5E5,
|
||||||
|
5E+5,
|
||||||
|
5E-5,
|
||||||
|
2.5e5,
|
||||||
|
+2.5e5,
|
||||||
|
-2.5e5,
|
||||||
|
2.5e+5,
|
||||||
|
2.5e-5,
|
||||||
|
2.5E5,
|
||||||
|
+2.5E5,
|
||||||
|
-2.5E5,
|
||||||
|
2.5E+5,
|
||||||
|
2.5E-5,
|
||||||
|
5e5,
|
||||||
|
5e5,
|
||||||
|
5e5,
|
||||||
|
5e5,
|
||||||
|
5e-6,
|
||||||
|
7e+8,
|
||||||
|
9e-1,
|
||||||
|
2e+3,
|
||||||
|
4e5,
|
||||||
|
6e7
|
||||||
|
)
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,32 @@
|
|||||||
class Exponent {
|
class Exponent {
|
||||||
private val floats = floatArrayOf(5e5f, +5e5f, -5e5f, 5e+5f, 5e-5f, 5E5f, +5E5f, -5E5f, 5E+5f, 5E-5f, 2.5e5f, +2.5e5f, -2.5e5f, 2.5e+5f, 2.5e-5f, 2.5E5f, +2.5E5f, -2.5E5f, 2.5E+5f, 2.5E-5f, 5e5f, 5e5f, 5e-6f, 7e+8f, 9e-1f, 2e+3f, 4e5f, 6e7f)
|
private val floats = floatArrayOf(
|
||||||
|
5e5f,
|
||||||
|
+5e5f,
|
||||||
|
-5e5f,
|
||||||
|
5e+5f,
|
||||||
|
5e-5f,
|
||||||
|
5E5f,
|
||||||
|
+5E5f,
|
||||||
|
-5E5f,
|
||||||
|
5E+5f,
|
||||||
|
5E-5f,
|
||||||
|
2.5e5f,
|
||||||
|
+2.5e5f,
|
||||||
|
-2.5e5f,
|
||||||
|
2.5e+5f,
|
||||||
|
2.5e-5f,
|
||||||
|
2.5E5f,
|
||||||
|
+2.5E5f,
|
||||||
|
-2.5E5f,
|
||||||
|
2.5E+5f,
|
||||||
|
2.5E-5f,
|
||||||
|
5e5f,
|
||||||
|
5e5f,
|
||||||
|
5e-6f,
|
||||||
|
7e+8f,
|
||||||
|
9e-1f,
|
||||||
|
2e+3f,
|
||||||
|
4e5f,
|
||||||
|
6e7f
|
||||||
|
)
|
||||||
}
|
}
|
||||||
@@ -2,10 +2,12 @@
|
|||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
internal class A<T> {
|
internal class A<T> {
|
||||||
fun foo(nonMutableCollection: Collection<String>,
|
fun foo(
|
||||||
|
nonMutableCollection: Collection<String>,
|
||||||
mutableCollection: MutableCollection<String>,
|
mutableCollection: MutableCollection<String>,
|
||||||
mutableSet: MutableSet<T>,
|
mutableSet: MutableSet<T>,
|
||||||
mutableMap: MutableMap<String, T>) {
|
mutableMap: MutableMap<String, T>
|
||||||
|
) {
|
||||||
mutableCollection.addAll(nonMutableCollection)
|
mutableCollection.addAll(nonMutableCollection)
|
||||||
mutableSet.add(mutableMap.remove("a"))
|
mutableSet.add(mutableMap.remove("a"))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,10 @@ import kotlinApi.KotlinClass
|
|||||||
|
|
||||||
abstract class C(field: Int) : KotlinClass(field) {
|
abstract class C(field: Int) : KotlinClass(field) {
|
||||||
|
|
||||||
override fun foo(mutableCollection: MutableCollection<String>, nullableCollection: Collection<Int>?): MutableList<Any> {
|
override fun foo(
|
||||||
|
mutableCollection: MutableCollection<String>,
|
||||||
|
nullableCollection: Collection<Int>?
|
||||||
|
): MutableList<Any> {
|
||||||
return super.foo(mutableCollection, nullableCollection)
|
return super.foo(mutableCollection, nullableCollection)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,10 @@ internal class C(p1: Int, p2: Int, p3: Int)
|
|||||||
|
|
||||||
internal class User {
|
internal class User {
|
||||||
fun foo() {
|
fun foo() {
|
||||||
C(1,
|
C(
|
||||||
|
1,
|
||||||
2,
|
2,
|
||||||
3)
|
3
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
fun foo(p: Dependency): Double {
|
fun foo(p: Dependency): Double {
|
||||||
return p.getInt().toDouble() // explicit conversion to Double must be added on conversion (if type Dependency) is correctly resolved
|
return p.getInt()
|
||||||
|
.toDouble() // explicit conversion to Double must be added on conversion (if type Dependency) is correctly resolved
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,8 +5,10 @@ class A {
|
|||||||
var element: PsiElement = element
|
var element: PsiElement = element
|
||||||
element = JetPsiUtil.ascendIfPropertyAccessor(element)
|
element = JetPsiUtil.ascendIfPropertyAccessor(element)
|
||||||
if (element is JetNamedFunction || element is JetProperty) {
|
if (element is JetNamedFunction || element is JetProperty) {
|
||||||
val bindingContext: BindingContext = AnalyzerFacadeWithCache.analyzeFileWithCache(element.getContainingJetFile()).getBindingContext()
|
val bindingContext: BindingContext =
|
||||||
val declarationDescriptor: DeclarationDescriptor = bindingContext.get(BindingContext.DECLARATION_TO_DESCRIPTOR, element)
|
AnalyzerFacadeWithCache.analyzeFileWithCache(element.getContainingJetFile()).getBindingContext()
|
||||||
|
val declarationDescriptor: DeclarationDescriptor =
|
||||||
|
bindingContext.get(BindingContext.DECLARATION_TO_DESCRIPTOR, element)
|
||||||
if (declarationDescriptor is CallableMemberDescriptor) {
|
if (declarationDescriptor is CallableMemberDescriptor) {
|
||||||
val containingDescriptor: DeclarationDescriptor = declarationDescriptor.getContainingDeclaration()
|
val containingDescriptor: DeclarationDescriptor = declarationDescriptor.getContainingDeclaration()
|
||||||
if (containingDescriptor is ClassDescriptor) {
|
if (containingDescriptor is ClassDescriptor) {
|
||||||
@@ -18,7 +20,10 @@ class A {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert(element is PsiMethod) { "Method accepts only kotlin functions/properties and java methods, but '" + element.getText().toString() + "' was found" }
|
assert(element is PsiMethod) {
|
||||||
|
"Method accepts only kotlin functions/properties and java methods, but '" + element.getText()
|
||||||
|
.toString() + "' was found"
|
||||||
|
}
|
||||||
return JetRefactoringUtil.formatPsiMethod(element as PsiMethod, true, false)
|
return JetRefactoringUtil.formatPsiMethod(element as PsiMethod, true, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,9 +18,11 @@ class Target {
|
|||||||
|
|
||||||
fun acceptJavaClass(tbi: ToBeImportedJava?) {}
|
fun acceptJavaClass(tbi: ToBeImportedJava?) {}
|
||||||
|
|
||||||
var ambiguousKotlin: IAmbiguousKotlin = AmbiguousKotlin() // Should not add import in case of 2 declarations in Kotlin
|
var ambiguousKotlin: IAmbiguousKotlin =
|
||||||
|
AmbiguousKotlin() // Should not add import in case of 2 declarations in Kotlin
|
||||||
|
|
||||||
var ambiguous: IAmbiguous = Ambiguous() // Should not add import in case of ambiguous declarations in Kotlin and in Java
|
var ambiguous: IAmbiguous =
|
||||||
|
Ambiguous() // Should not add import in case of ambiguous declarations in Kotlin and in Java
|
||||||
|
|
||||||
var ambiguousJava: IAmbiguousJava = AmbiguousJava() // Should not add import in case of 2 declarations in Java
|
var ambiguousJava: IAmbiguousJava = AmbiguousJava() // Should not add import in case of 2 declarations in Java
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,11 @@ annotation class Ann(vararg val value: Inner, val test1: Array<InnerParam> = [In
|
|||||||
annotation class Inner
|
annotation class Inner
|
||||||
annotation class InnerParam(val value: KClass<*>)
|
annotation class InnerParam(val value: KClass<*>)
|
||||||
|
|
||||||
@Ann(value = [Inner(), Inner()], test1 = [InnerParam(C::class)])
|
@Ann(
|
||||||
|
value = [Inner(), Inner()], test1 = [InnerParam(
|
||||||
|
C::class
|
||||||
|
)]
|
||||||
|
)
|
||||||
class C
|
class C
|
||||||
|
|
||||||
@Ann(Inner(), Inner())
|
@Ann(Inner(), Inner())
|
||||||
|
|||||||
+12
-1
@@ -1,5 +1,16 @@
|
|||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
|
|
||||||
annotation class Ann(val i: Int = 1, val i2: IntArray = [1], val i3: IntArray = [1], val klass: KClass<*> = A::class, val klass2: Array<KClass<*>> = [A::class], val klass3: Array<KClass<*>> = [A::class], val ann: Inner = Inner(), val ann2: Array<Inner> = [Inner()], val ann3: Array<Inner> = [Inner(), Inner()])
|
annotation class Ann(
|
||||||
|
val i: Int = 1,
|
||||||
|
val i2: IntArray = [1],
|
||||||
|
val i3: IntArray = [1],
|
||||||
|
val klass: KClass<*> = A::class,
|
||||||
|
val klass2: Array<KClass<*>> = [A::class],
|
||||||
|
val klass3: Array<KClass<*>> = [A::class],
|
||||||
|
val ann: Inner = Inner(),
|
||||||
|
val ann2: Array<Inner> = [Inner()],
|
||||||
|
val ann3: Array<Inner> = [Inner(), Inner()]
|
||||||
|
)
|
||||||
|
|
||||||
class A
|
class A
|
||||||
annotation class Inner
|
annotation class Inner
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
internal annotation class Anon(val stringArray: Array<String>, val intArray: IntArray, // string
|
internal annotation class Anon(
|
||||||
val string: String)
|
val stringArray: Array<String>, val intArray: IntArray, // string
|
||||||
|
val string: String
|
||||||
|
)
|
||||||
|
|
||||||
@Anon(string = "a", stringArray = ["a", "b"], intArray = [1, 2])
|
@Anon(string = "a", stringArray = ["a", "b"], intArray = [1, 2])
|
||||||
@Target(AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FIELD)
|
@Target(AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FIELD)
|
||||||
|
|||||||
+3
-1
@@ -17,7 +17,9 @@ import javaApi.E
|
|||||||
@Anon4("x", "y")
|
@Anon4("x", "y")
|
||||||
@Anon5(1)
|
@Anon5(1)
|
||||||
@Anon6("x", "y")
|
@Anon6("x", "y")
|
||||||
@Anon7(String::class, StringBuilder::class)
|
@Anon7(
|
||||||
|
String::class, StringBuilder::class
|
||||||
|
)
|
||||||
@Anon8(classes = [String::class, StringBuilder::class])
|
@Anon8(classes = [String::class, StringBuilder::class])
|
||||||
internal class C {
|
internal class C {
|
||||||
@Anon5(1)
|
@Anon5(1)
|
||||||
|
|||||||
+2
-1
@@ -1,7 +1,8 @@
|
|||||||
import javaApi.SpecialExternal
|
import javaApi.SpecialExternal
|
||||||
|
|
||||||
//Annotation class:
|
//Annotation class:
|
||||||
annotation class Special(val names: Array<String> //array is used
|
annotation class Special(
|
||||||
|
val names: Array<String> //array is used
|
||||||
) //Class with annotation:
|
) //Class with annotation:
|
||||||
|
|
||||||
@Special(names = ["name1"])
|
@Special(names = ["name1"])
|
||||||
|
|||||||
@@ -1 +1,2 @@
|
|||||||
/*pre*/5 /*operand '5'*/ shl /*left shift*/16 /*operand '16'*/ or ( /*or*/1 /*operand '1'*/ shr /*right shift*/8 /*operand '8'*/) or /*or*/0 /*operand '0'*/ /*post comment*/
|
/*pre*/
|
||||||
|
5 /*operand '5'*/ shl /*left shift*/16 /*operand '16'*/ or ( /*or*/1 /*operand '1'*/ shr /*right shift*/8 /*operand '8'*/) or /*or*/0 /*operand '0'*/ /*post comment*/
|
||||||
+2
-1
@@ -1 +1,2 @@
|
|||||||
val constrArgTypes = arrayOf<Class<*>>(Array<String>::class.java, String::class.java, Int::class.java, Double::class.java)
|
val constrArgTypes =
|
||||||
|
arrayOf<Class<*>>(Array<String>::class.java, String::class.java, Int::class.java, Double::class.java)
|
||||||
@@ -11,7 +11,7 @@ internal class A // this is a primary constructor
|
|||||||
|
|
||||||
internal class B // this constructor will disappear
|
internal class B // this constructor will disappear
|
||||||
// end of constructor body
|
// end of constructor body
|
||||||
(private val x: Int) {
|
(private val x: Int) {
|
||||||
fun foo() {}
|
fun foo() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,4 +4,5 @@ internal class C(// field p1
|
|||||||
* Field myP2
|
* Field myP2
|
||||||
*/
|
*/
|
||||||
private val myP2: Int, /* Field p3 */
|
private val myP2: Int, /* Field p3 */
|
||||||
var p3: Int)
|
var p3: Int
|
||||||
|
)
|
||||||
@@ -1,2 +1,4 @@
|
|||||||
internal open class Base(o: Any?, l: Int)
|
internal open class Base(o: Any?, l: Int)
|
||||||
internal class C(private val string: String) : Base(string, string.length)
|
internal class C(private val string: String) : Base(
|
||||||
|
string, string.length
|
||||||
|
)
|
||||||
+5
-1
@@ -1,4 +1,8 @@
|
|||||||
// ERROR: This annotation is not applicable to target 'value parameter' and use site target '@field'
|
// ERROR: This annotation is not applicable to target 'value parameter' and use site target '@field'
|
||||||
// ERROR: This annotation is not applicable to target 'value parameter' and use site target '@param'
|
// ERROR: This annotation is not applicable to target 'value parameter' and use site target '@param'
|
||||||
// ERROR: This annotation is not applicable to target 'value parameter' and use site target '@param'
|
// ERROR: This annotation is not applicable to target 'value parameter' and use site target '@param'
|
||||||
internal class C(@field:Deprecated("") private val p1: Int, @param:Deprecated("") private val myP2: Int, @param:Deprecated("") var p3: Int)
|
internal class C(
|
||||||
|
@field:Deprecated("") private val p1: Int,
|
||||||
|
@param:Deprecated("") private val myP2: Int,
|
||||||
|
@param:Deprecated("") var p3: Int
|
||||||
|
)
|
||||||
@@ -1,11 +1,17 @@
|
|||||||
internal class C1(arg1: Int,
|
internal class C1(
|
||||||
|
arg1: Int,
|
||||||
arg2: Int,
|
arg2: Int,
|
||||||
arg3: Int) {
|
arg3: Int
|
||||||
constructor(x: Int,
|
) {
|
||||||
y: Int) : this(x, x + y, 0) {
|
constructor(
|
||||||
|
x: Int,
|
||||||
|
y: Int
|
||||||
|
) : this(x, x + y, 0) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class C2(private val arg1: Int,
|
internal class C2(
|
||||||
|
private val arg1: Int,
|
||||||
private val arg2: Int,
|
private val arg2: Int,
|
||||||
arg3: Int)
|
arg3: Int
|
||||||
|
)
|
||||||
+2
-1
@@ -1,7 +1,8 @@
|
|||||||
internal class A( // comment for field2 setter
|
internal class A( // comment for field2 setter
|
||||||
// comment for field2 getter
|
// comment for field2 getter
|
||||||
var field2 // comment for field2
|
var field2 // comment for field2
|
||||||
: Int) {
|
: Int
|
||||||
|
) {
|
||||||
/**
|
/**
|
||||||
* Comment for field1 setter
|
* Comment for field1 setter
|
||||||
*/
|
*/
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user