[IDE-NI-MIGRATE] Migrate few tests for new inference
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
|
||||||
|
|
||||||
open class A<T>
|
open class A<T>
|
||||||
class B<X : A<X>>()
|
class B<X : A<X>>()
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
|
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
|
||||||
// RUNTIME
|
// RUNTIME
|
||||||
|
|
||||||
fun none() {}
|
fun none() {}
|
||||||
|
|
||||||
fun unitEmptyInfer() {}
|
fun unitEmptyInfer() {}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
|
||||||
|
|
||||||
package qualified_expressions
|
package qualified_expressions
|
||||||
|
|
||||||
fun test(s: IntRange?) {
|
fun test(s: IntRange?) {
|
||||||
|
|||||||
Vendored
+2
@@ -1,3 +1,5 @@
|
|||||||
|
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
|
||||||
|
|
||||||
class Rule(val apply: () -> Unit)
|
class Rule(val apply: () -> Unit)
|
||||||
|
|
||||||
fun foo() {
|
fun foo() {
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
|
||||||
|
|
||||||
val f = listOf("").<error descr="[TYPE_INFERENCE_PARAMETER_CONSTRAINT_ERROR] Type inference failed: fun <T> Iterable<T>.firstOrNull(predicate: (T) -> Boolean): T?
|
val f = listOf("").<error descr="[TYPE_INFERENCE_PARAMETER_CONSTRAINT_ERROR] Type inference failed: fun <T> Iterable<T>.firstOrNull(predicate: (T) -> Boolean): T?
|
||||||
cannot be applied to
|
cannot be applied to
|
||||||
receiver: List<String> arguments: (Int)
|
receiver: List<String> arguments: (Int)
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
|
||||||
|
|
||||||
fun baz(s: String?): Int {
|
fun baz(s: String?): Int {
|
||||||
if (s == null) return 0
|
if (s == null) return 0
|
||||||
return when(<info descr="Smart cast to kotlin.String">s</info>) {
|
return when(<info descr="Smart cast to kotlin.String">s</info>) {
|
||||||
|
|||||||
+2
@@ -1,3 +1,5 @@
|
|||||||
|
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
|
||||||
|
|
||||||
<info descr="null">open</info> class A() {
|
<info descr="null">open</info> class A() {
|
||||||
fun foo() {
|
fun foo() {
|
||||||
if (this is B) {
|
if (this is B) {
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
|
||||||
|
|
||||||
fun foo(s: String) = s.length
|
fun foo(s: String) = s.length
|
||||||
|
|
||||||
fun baz(s: String?, r: String?): Int {
|
fun baz(s: String?, r: String?): Int {
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
|
||||||
|
|
||||||
fun <K, V> testMutableMapEntry(<warning>map</warning>: MutableMap<K, V>, <warning>k1</warning>: K, <warning>v</warning>: V) {
|
fun <K, V> testMutableMapEntry(<warning>map</warning>: MutableMap<K, V>, <warning>k1</warning>: K, <warning>v</warning>: V) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
class Example(val dummy: Any?) {
|
class Example(val dummy: Any?) {
|
||||||
companion object {
|
companion object {
|
||||||
operator fun invoke() = <lineMarker>Example</lineMarker>()
|
operator fun invoke(): Example = <lineMarker>Example</lineMarker>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
// RUNTIME_WITH_FULL_JDK
|
// RUNTIME_WITH_FULL_JDK
|
||||||
|
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
|
||||||
val s = Sam<caret> { d, t ->
|
val s = Sam<caret> { d, t ->
|
||||||
val s = "$d$t"
|
val s = "$d$t"
|
||||||
listOf(s)
|
listOf(s)
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import java.time.LocalDate
|
|||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
|
|
||||||
// RUNTIME_WITH_FULL_JDK
|
// RUNTIME_WITH_FULL_JDK
|
||||||
|
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
|
||||||
val s = object : Sam {
|
val s = object : Sam {
|
||||||
override fun test(d: LocalDate, t: LocalDateTime): List<String> {
|
override fun test(d: LocalDate, t: LocalDateTime): List<String> {
|
||||||
val s = "$d$t"
|
val s = "$d$t"
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
|
||||||
|
|
||||||
class A {
|
class A {
|
||||||
operator fun get(x: Int) {}
|
operator fun get(x: Int) {}
|
||||||
operator fun set(x: String, value: Int) {}
|
operator fun set(x: String, value: Int) {}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
|
||||||
|
|
||||||
fun <T> T.foo(): (item: T) -> Unit{}
|
fun <T> T.foo(): (item: T) -> Unit{}
|
||||||
|
|
||||||
fun f() {
|
fun f() {
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
|
||||||
|
|
||||||
package test
|
package test
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+2
@@ -1,3 +1,5 @@
|
|||||||
|
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
|
||||||
|
|
||||||
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)
|
||||||
|
|||||||
Vendored
+2
@@ -1,3 +1,5 @@
|
|||||||
|
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
|
||||||
|
|
||||||
fun bar(p1: String, p2: String?, p3: () -> Boolean)
|
fun bar(p1: String, p2: String?, p3: () -> Boolean)
|
||||||
|
|
||||||
fun foo(i: I) {
|
fun foo(i: I) {
|
||||||
|
|||||||
Vendored
+2
@@ -1,3 +1,5 @@
|
|||||||
|
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
|
||||||
|
|
||||||
import java.util.ArrayList
|
import java.util.ArrayList
|
||||||
|
|
||||||
fun f() {
|
fun f() {
|
||||||
|
|||||||
+2
@@ -1,3 +1,5 @@
|
|||||||
|
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
|
||||||
|
|
||||||
import java.util.ArrayList
|
import java.util.ArrayList
|
||||||
|
|
||||||
fun f() {
|
fun f() {
|
||||||
|
|||||||
idea/testData/refactoring/inline/inlineVariableOrProperty/explicateTypeArgument/DeeperNestedCall2.kt
Vendored
+2
@@ -1,3 +1,5 @@
|
|||||||
|
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
|
||||||
|
|
||||||
fun foo(f: List<Int>) {}
|
fun foo(f: List<Int>) {}
|
||||||
|
|
||||||
fun f() {
|
fun f() {
|
||||||
|
|||||||
+2
@@ -1,3 +1,5 @@
|
|||||||
|
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
|
||||||
|
|
||||||
fun foo(f: List<Int>) {}
|
fun foo(f: List<Int>) {}
|
||||||
|
|
||||||
fun f() {
|
fun f() {
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import org.jetbrains.kotlin.idea.KotlinLanguage
|
|||||||
import org.jetbrains.kotlin.idea.test.SdkAndMockLibraryProjectDescriptor
|
import org.jetbrains.kotlin.idea.test.SdkAndMockLibraryProjectDescriptor
|
||||||
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase
|
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase
|
||||||
import org.jetbrains.kotlin.idea.test.ProjectDescriptorWithStdlibSources
|
import org.jetbrains.kotlin.idea.test.ProjectDescriptorWithStdlibSources
|
||||||
|
import org.jetbrains.kotlin.idea.test.configureCompilerOptions
|
||||||
import org.jetbrains.kotlin.lexer.KtTokens
|
import org.jetbrains.kotlin.lexer.KtTokens
|
||||||
import org.jetbrains.kotlin.psi.KtFile
|
import org.jetbrains.kotlin.psi.KtFile
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.allChildren
|
import org.jetbrains.kotlin.psi.psiUtil.allChildren
|
||||||
@@ -51,6 +52,9 @@ abstract class AbstractParameterInfoTest : LightCodeInsightFixtureTestCase() {
|
|||||||
myFixture.configureByFile(fileName)
|
myFixture.configureByFile(fileName)
|
||||||
|
|
||||||
val file = myFixture.file as KtFile
|
val file = myFixture.file as KtFile
|
||||||
|
|
||||||
|
configureCompilerOptions(file.text, project, myFixture.module)
|
||||||
|
|
||||||
val lastChild = file.allChildren.filter { it !is PsiWhiteSpace }.last()
|
val lastChild = file.allChildren.filter { it !is PsiWhiteSpace }.last()
|
||||||
val expectedResultText = when (lastChild.node.elementType) {
|
val expectedResultText = when (lastChild.node.elementType) {
|
||||||
KtTokens.BLOCK_COMMENT -> lastChild.text.substring(2, lastChild.text.length - 2).trim()
|
KtTokens.BLOCK_COMMENT -> lastChild.text.substring(2, lastChild.text.length - 2).trim()
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture
|
|||||||
import junit.framework.TestCase
|
import junit.framework.TestCase
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase
|
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor
|
import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor
|
||||||
|
import org.jetbrains.kotlin.idea.test.configureCompilerOptions
|
||||||
import org.jetbrains.kotlin.idea.util.application.runWriteAction
|
import org.jetbrains.kotlin.idea.util.application.runWriteAction
|
||||||
import org.jetbrains.kotlin.test.InTextDirectivesUtils
|
import org.jetbrains.kotlin.test.InTextDirectivesUtils
|
||||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||||
@@ -39,6 +40,8 @@ abstract class AbstractInlineTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
val extraFilesToPsi = extraFiles.associateBy { fixture.configureByFile(path.replace(mainFileName, it.name)) }
|
val extraFilesToPsi = extraFiles.associateBy { fixture.configureByFile(path.replace(mainFileName, it.name)) }
|
||||||
val file = myFixture.configureByFile(path)
|
val file = myFixture.configureByFile(path)
|
||||||
|
|
||||||
|
configureCompilerOptions(file.text, project, module)
|
||||||
|
|
||||||
val afterFileExists = afterFile.exists()
|
val afterFileExists = afterFile.exists()
|
||||||
|
|
||||||
val targetElement = TargetElementUtil.findTargetElement(myFixture.editor, ELEMENT_NAME_ACCEPTED or REFERENCED_ELEMENT_ACCEPTED)!!
|
val targetElement = TargetElementUtil.findTargetElement(myFixture.editor, ELEMENT_NAME_ACCEPTED or REFERENCED_ELEMENT_ACCEPTED)!!
|
||||||
|
|||||||
Reference in New Issue
Block a user