diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/frontend/classic/handlers/FirTestDataConsistencyHandler.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/frontend/classic/handlers/FirTestDataConsistencyHandler.kt index 7a160719dec..74e3caef6d8 100644 --- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/frontend/classic/handlers/FirTestDataConsistencyHandler.kt +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/frontend/classic/handlers/FirTestDataConsistencyHandler.kt @@ -16,6 +16,8 @@ import org.jetbrains.kotlin.test.runners.AbstractFirPsiDiagnosticTest import org.jetbrains.kotlin.test.runners.AbstractKotlinCompilerTest import org.jetbrains.kotlin.test.services.* import org.jetbrains.kotlin.test.utils.firTestDataFile +import org.jetbrains.kotlin.test.utils.isFirTestData +import org.jetbrains.kotlin.test.utils.originalTestDataFile import java.io.File open class FirTestDataConsistencyHandler(testServices: TestServices) : AfterAnalysisChecker(testServices) { @@ -27,16 +29,19 @@ open class FirTestDataConsistencyHandler(testServices: TestServices) : AfterAnal val testData = moduleStructure.originalTestDataFiles.first() if (testData.extension == "kts") return if (FirDiagnosticsDirectives.FIR_IDENTICAL in moduleStructure.allDirectives) return - val firTestData = testData.firTestDataFile + val (firTestData, originalTestData) = when { + testData.isFirTestData -> testData to testData.originalTestDataFile + else -> testData.firTestDataFile to testData + } if (!firTestData.exists()) { runFirTestAndGeneratedTestData(testData, firTestData) return } val firPreprocessedTextData = firTestData.preprocessSource() - val originalPreprocessedTextData = testData.preprocessSource() + val originalPreprocessedTextData = originalTestData.preprocessSource() testServices.assertions.assertEquals(firPreprocessedTextData, originalPreprocessedTextData) { "Original and FIR test data aren't identical. " + - "Please, add changes from ${testData.name} to ${firTestData.name}" + "Please, add changes from ${originalTestData.name} to ${firTestData.name}" } } diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/AbstractFirDiagnosticTestSpec.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/AbstractFirDiagnosticTestSpec.kt index 96fa14993a0..356290c53dc 100644 --- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/AbstractFirDiagnosticTestSpec.kt +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/AbstractFirDiagnosticTestSpec.kt @@ -10,6 +10,7 @@ import org.jetbrains.kotlin.test.bind import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder import org.jetbrains.kotlin.test.directives.AdditionalFilesDirectives.SPEC_HELPERS import org.jetbrains.kotlin.test.directives.ConfigurationDirectives.WITH_STDLIB +import org.jetbrains.kotlin.test.frontend.classic.handlers.FirTestDataConsistencyHandler import org.jetbrains.kotlin.test.frontend.fir.FirFailingTestSuppressor import org.jetbrains.kotlin.test.frontend.fir.handlers.FirIdenticalChecker import org.jetbrains.kotlin.test.services.fir.FirOldFrontendMetaConfigurator @@ -36,6 +37,7 @@ fun TestConfigurationBuilder.baseFirSpecDiagnosticTestConfiguration(baseDir: Str useAfterAnalysisCheckers( ::FirIdenticalChecker, + ::FirTestDataConsistencyHandler, ::FirFailingTestSuppressor, ) diff --git a/compiler/tests-spec/testData/diagnostics/linked/control--and-data-flow-analysis/control-flow-graph/expressions-1/conditional-expressions/p-1/neg/1.4.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/control--and-data-flow-analysis/control-flow-graph/expressions-1/conditional-expressions/p-1/neg/1.4.fir.kt index 2233e33d031..37e7fa6d089 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/control--and-data-flow-analysis/control-flow-graph/expressions-1/conditional-expressions/p-1/neg/1.4.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/control--and-data-flow-analysis/control-flow-graph/expressions-1/conditional-expressions/p-1/neg/1.4.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNREACHABLE_CODE -IMPLICIT_CAST_TO_ANY -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-296 + * MAIN LINK: control--and-data-flow-analysis, control-flow-graph, expressions-1, conditional-expressions -> paragraph 1 -> sentence 1 + * NUMBER: 4 + * DESCRIPTION: check if-expressions must have both branches. (attempt to pass Nothing to if-condition with 'else' key word) + */ + // TESTCASE NUMBER: 1 fun case1() { diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-1/neg/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-1/neg/1.1.fir.kt deleted file mode 100644 index 7a8d1a9bf5b..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-1/neg/1.1.fir.kt +++ /dev/null @@ -1,26 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -// SKIP_TXT - -// TESTCASE NUMBER: 1 - -abstract class Base() { - abstract fun foo() = {} - fun boo() : Unit - abstract val a = "" - val b - var d -} - -class Impl : Base() { - override fun foo(): () -> Unit { - TODO("not implemented") - } - - override val a: String - get() = TODO("not implemented") - -} - -fun case1() { - val impl = Impl() -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-1/neg/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-1/neg/1.1.kt index f41f808b392..79fd969c02c 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-1/neg/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-1/neg/1.1.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.1.fir.kt deleted file mode 100644 index 6ea009b730a..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.1.fir.kt +++ /dev/null @@ -1,118 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -// SKIP_TXT - -// TESTCASE NUMBER: 1 - -open abstract class Base { - - abstract val a: Any - abstract var b: Any - internal abstract val c: Any - internal abstract var d: Any - - - abstract fun foo() - internal abstract fun boo(): Any -} - -fun case1() { - val impl = BaseImplCase2(1, "1", 1.0) -} - -class BaseImplCase2( - override var a: Any, override - val b: Any, override var c: Any, override - - val d: Any = "5") : Base() -{ - override fun foo() {} - override internal fun boo() {} -} - -// TESTCASE NUMBER: 2 - -fun case2() { - val impl = ImplBaseCase2() -} - -class ImplBaseCase2() : Base() { - override var a: Any - get() = TODO() - set(value) {} - override - - val b: Any - get() = TODO() - override var c: Any - get() = TODO() - set(value) {} - override - - val d: Any - get() = TODO() - - override fun foo() {} - - override fun boo(): Any { - return "" - } -} - -/* -* TESTCASE NUMBER: 3 -* NOTE: property is not implemented -*/ -fun case3() { - ImplBaseCase3() -} - -class ImplBaseCase3() : Base() { - override var b: Any - get() = TODO() - set(value) {} - override val c: Any - get() = TODO() - override var d: Any - get() = TODO() - set(value) {} - - override fun foo() { - TODO() - } - - override fun boo(): Any { - TODO() - } -} - -/* -* TESTCASE NUMBER: 4 -* NOTE: function is not implemented -*/ - -fun case4() { - ImplBaseCase4() -} - -class ImplBaseCase4() : Base() { - override var b: Any - get() = TODO() - set(value) {} - override val c: Any - get() = TODO() - override var d: Any - get() = TODO() - set(value) {} - - override fun foo() {} - - override fun boo(): Any { - return 1 - } -} - -/* -* TESTCASE NUMBER: 5 -* NOTE: incompatible modifiers final and abstract -*/ -final abstract class Case5() {} diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.1.kt index a40a78fbea1..9226999fe2f 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.1.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT @@ -11,7 +12,7 @@ */ // FILE: TestCase1.kt -// TESTCASE NUMBER:1 +// TESTCASE NUMBER: 1 package testPackCase1 open abstract class Base { @@ -24,6 +25,7 @@ package testPackCase1 abstract fun foo() internal abstract fun boo(): Any } + fun case1() { val impl = BaseImplCase1(1, "1", 1.0) } @@ -134,7 +136,6 @@ package testPackCase4 internal abstract fun boo(): Any } - fun case4() { ImplBaseCase4() } @@ -160,4 +161,4 @@ fun case4() { * TESTCASE NUMBER: 5 * NOTE: incompatible modifiers final and abstract */ -final abstract class Case5() {} \ No newline at end of file +final abstract class Case5() {} diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.2.fir.kt deleted file mode 100644 index 3789edd06c0..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.2.fir.kt +++ /dev/null @@ -1,89 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -// SKIP_TXT - -// TESTCASE NUMBER: 1 -private abstract class Base { - - abstract val a: Any - abstract var b: Any - internal abstract val c: Any - internal abstract var d: Any - - - abstract fun foo() - internal abstract fun boo(): Any -} - - -fun case1() { - val impl = object : Base() { - override var a: Any - get() = TODO() - set(value) {} - override val b: Any - get() = TODO() - override var c: Any - get() = TODO() - set(value) {} - override val d: Any - get() = TODO() - - override fun foo() {} - - override fun boo(): Any { - return "" - } - } -} - - - -/* -* TESTCASE NUMBER: 2 -* NOTE: property is not implemented -*/ -fun case2() { - val impl = object : Base() { - override var b: Any - get() = TODO() - set(value) {} - override val c: Any - get() = TODO() - override var d: Any - get() = TODO() - set(value) {} - - override fun foo() { - TODO() - } - - override fun boo(): Any { - TODO() - } - } -} - - -/* -* TESTCASE NUMBER: 3 -* NOTE: function is not implemented -*/ - -fun case3() { - val impl = object : Base() { - override var b: Any - get() = TODO() - set(value) {} - override val c: Any - get() = TODO() - override var d: Any - get() = TODO() - set(value) {} - - override fun foo() {} - - override fun boo(): Any { - return 1 - } - } -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.2.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.2.kt index 363efd8d8dd..f9da98c6ba7 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.2.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT @@ -46,7 +47,6 @@ fun case1() { } } - // FILE: TestCase2.kt /* * TESTCASE NUMBER: 2 @@ -65,8 +65,6 @@ private abstract class Base { internal abstract fun boo(): Any } - - fun case2() { val impl = object : Base() { override var b: Any diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.3.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.3.fir.kt deleted file mode 100644 index 34b0dcb2934..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.3.fir.kt +++ /dev/null @@ -1,54 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -// SKIP_TXT - -// TESTCASE NUMBER: 1 -abstract class Base { - abstract val a: CharSequence - abstract var b: CharSequence - - abstract fun foo(): CharSequence -} - -class Case1 : Base() { - override fun foo(): Any - { - return "" - } - - override val a: Any? - get() = TODO() - override var b: String - get() = TODO() - set(value) - {} -} - - -/* -* TESTCASE NUMBER: 2 -*/ - -class Case2(override val a: String, override var b: String) : Base() { - override fun foo(): CharSequence? { - return "" - } -} - -/* -* TESTCASE NUMBER: 3 -* NOTE: abstract nested class members are not implemented -*/ - -class Case3 { - class ImplBase1 : MainClass.Base1() {} -} - -class MainClass { - abstract class Base1() { - abstract val a: CharSequence - abstract var b: CharSequence - - abstract fun foo(): CharSequence - } - -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.3.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.3.kt index 2731929e9e6..34a81496282 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.3.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.3.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT @@ -34,8 +35,6 @@ class Case1 : Base() { {} } - - // FILE: TestCase2.kt // TESTCASE NUMBER: 2 package testPackCase2 @@ -76,5 +75,3 @@ class MainClass { } } - - diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.4.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.4.fir.kt index 8fe41307dae..33a08f5d43c 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.4.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.4.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT // FULL_JDK +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-213 + * MAIN LINK: declarations, classifier-declaration, class-declaration, abstract-classes -> paragraph 2 -> sentence 1 + * NUMBER: 4 + * DESCRIPTION: Abstract classes may contain abstract members, which should be implemented in an inner class that inherits from that abstract type + */ + class MainClass { abstract class Base1() { abstract val a: CharSequence diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.5.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.5.fir.kt deleted file mode 100644 index f0f539eb7ea..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.5.fir.kt +++ /dev/null @@ -1,46 +0,0 @@ -// !LANGUAGE: +ProhibitInvisibleAbstractMethodsInSuperclasses -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -// SKIP_TXT -// FULL_JDK - -// FILE: base/BaseJava.java -package base; - -public abstract class BaseJava { - - public BaseJavaCase1() - {} - - public BaseJavaCase1(Boolean b) - { foo(b); } - - public void boo(Boolean b) - { foo(b); } - - abstract void foo(Boolean b); -} - -// FILE: Impl.kt -package implBase -import base.* - -// TESTCASE NUMBER: 1 - -class Case1 : BaseJava() {} - -fun case1() { - val v = Case1() - v.boo(true) -} - -/* -* TESTCASE NUMBER: 2 -*/ -abstract class AbstractClassCase2 : BaseJava() {} - -class Case2 : AbstractClassCase2() {} - -fun case2() { - val v = Case2() - v.boo(true) -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.5.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.5.kt index 53607182d9a..5d58ca069a6 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.5.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.5.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !LANGUAGE: +ProhibitInvisibleAbstractMethodsInSuperclasses // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.6.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.6.fir.kt deleted file mode 100644 index 02b32cf6360..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.6.fir.kt +++ /dev/null @@ -1,71 +0,0 @@ -// !LANGUAGE: +ProhibitInvisibleAbstractMethodsInSuperclasses -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -// SKIP_TXT -// FULL_JDK - -// FILE: base/BaseJava.java -package base; - -public abstract class BaseJava { - - public BaseJavaCase1() - {} - - public BaseJavaCase1(Boolean b) - { foo(b); } - - public void boo(Boolean b) - { foo(b); } - - abstract void foo(Boolean b); -} - -// FILE: Impl.kt -package implBase -import base.* - -// TESTCASE NUMBER: 1 - -class Case1 : BaseJava() { - override fun foo(b: Boolean?) {} -} - -fun case1() { - val v = Case1() - v.boo(true) -} - -/* -* TESTCASE NUMBER: 2 -*/ -abstract class AbstractClassCase2 : BaseJava() {} - -class Case2: AbstractClassCase2() { - override fun foo(b: Boolean?) {} -} - -fun case2() { - val v = Case2() - v.boo(true) -} - -// TESTCASE NUMBER: 3 - -class Case3 : BaseJava() {} - -fun case3() { - val v = Case3() - v.boo(true) -} - -/* -* TESTCASE NUMBER: 4 -*/ -abstract class AbstractClassCase4 : BaseJava() {} - -class Case4 : AbstractClassCase4() {} - -fun case4() { - val v = Case4() - v.boo(true) -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.6.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.6.kt index 49c2240bacd..547d3998909 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.6.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.6.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !LANGUAGE: +ProhibitInvisibleAbstractMethodsInSuperclasses // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.7.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.7.fir.kt deleted file mode 100644 index 6f6c29de10c..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.7.fir.kt +++ /dev/null @@ -1,83 +0,0 @@ -// !LANGUAGE: +ProhibitInvisibleAbstractMethodsInSuperclasses -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -// SKIP_TXT -// FULL_JDK - -// MODULE: base -// FILE: BaseKotlin.kt -package base -abstract class BaseKotlin() { - - fun boo(b: Boolean?) { - foo(b) - } - - internal abstract fun foo(b: Boolean?) -} - - -//MODULE: implBase(base) -//FILE: Impl.kt - - -package implBase -import base.* - - -// TESTCASE NUMBER: 1 - -class Case1 : BaseKotlin() { - override fun foo(b: Boolean?) {} -} - -fun case1() { - val v = Case1() - v.boo(true) - - val o = object : BaseKotlin() { - override fun foo(b: Boolean?) {} - } -} - -/* -* TESTCASE NUMBER: 2 -*/ -abstract class AbstractClassCase2 : BaseKotlin() {} - -class Case2: AbstractClassCase2() { - override fun foo(b: Boolean?) {} -} - -fun case2() { - val v = Case2() - v.boo(true) - - val o = object : AbstractClassCase2() { - override fun foo(b: Boolean?) {} - } -} - -// TESTCASE NUMBER: 3 - -class Case3 : BaseKotlin() {} - -fun case3() { - val v = Case3() - v.boo(true) - - val o = object : BaseKotlin() {} -} - -/* -* TESTCASE NUMBER: 4 -*/ -abstract class AbstractClassCase4 : BaseKotlin() {} - -class Case4 : AbstractClassCase4() {} - -fun case4() { - val v = Case4() - v.boo(true) - val o = object : AbstractClassCase4() {} - -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.7.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.7.kt index 132cb6dde82..165a7dc5ddf 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.7.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.7.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !LANGUAGE: +ProhibitInvisibleAbstractMethodsInSuperclasses // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.8.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.8.fir.kt index 88f4cc89ab8..9feb92aa492 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.8.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.8.fir.kt @@ -3,6 +3,19 @@ // SKIP_TXT // FULL_JDK +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-213 + * MAIN LINK: declarations, classifier-declaration, class-declaration, abstract-classes -> paragraph 2 -> sentence 1 + * PRIMARY LINKS: inheritance, overriding -> paragraph 7 -> sentence 1 + * NUMBER: 8 + * DESCRIPTION: Abstract classes may contain one or more abstract members, which should be implemented in a subtype of this abstract class + * ISSUES: KT-27825 + */ + + + // MODULE: base // FILE: AbstractClassCase1.kt package base diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.9.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.9.fir.kt deleted file mode 100644 index 2f819cb7a03..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.9.fir.kt +++ /dev/null @@ -1,65 +0,0 @@ -// !LANGUAGE: +ProhibitInvisibleAbstractMethodsInSuperclasses -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -// SKIP_TXT -// FULL_JDK - -// MODULE: libModule -// FILE: libModule/BaseJava1.java -package libModule; - -public abstract class BaseJava1 { - /*package-private*/ abstract void boojava(); -} - - -// FILE: BaseKotlin1.kt -package libModule - -public abstract class BaseKotlin1 { - internal abstract fun bookotlin() -} - -// MODULE: mainModule(libModule) -// FILE: mainModule/JavaClassWithAbstractKotlinClass.java -package mainModule -import libModule.* - -/* - * TESTCASE NUMBER: 1 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-35325 - */ -public class JavaClassWithAbstractKotlinClass { - - public void zoo() - { - //todo: INVISIBLE_ABSTRACT_MEMBER_FROM_SUPER should be expected - BaseKotlin1 baseKotlin = new BaseKotlin1() {}; - - BaseKotlin1 baseKotlin = new BaseKotlinImpl(); - baseKotlin.bookotlin$libModule(); //highlight Error: usage of Kotlin internal declaration from different module - - BaseKotlinImpl baseKotlinImpl = new BaseKotlinImpl(); - baseKotlinImpl.bookotlin$libModule(); //there is no any Error, but should be - } - - class BaseKotlinImpl extends BaseKotlin1 { - @Override - public void bookotlin$libModule() { - System.out.println("wefrgth"); - } - } - -} - -// FILE: KotlinClassWithAbstractJavaClass.kt -package mainModule -import libModule.* - -// TESTCASE NUMBER: 2 -class KotlinClassWithAbstractJavaClass() { - fun foo() { - val baseJava1 = object : BaseJava1() {} - val baseKotlin = object : BaseKotlin1() {} - } -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.9.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.9.kt index dda98f78e0d..172c20f9491 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.9.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/neg/1.9.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !LANGUAGE: +ProhibitInvisibleAbstractMethodsInSuperclasses // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/pos/1.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/pos/1.2.fir.kt index d537e1e6941..a90f8e7286c 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/pos/1.2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/pos/1.2.fir.kt @@ -1,6 +1,17 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-213 + * MAIN LINK: declarations, classifier-declaration, class-declaration, abstract-classes -> paragraph 2 -> sentence 1 + * NUMBER: 2 + * DESCRIPTION: Abstract classes may contain one or more abstract members, which should be implemented in a subtype of this abstract class + * HELPERS: checkType, functions + * ISSUES: KT-27825 + */ + // TESTCASE NUMBER: 1 fun case1(){ diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/pos/1.3.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/pos/1.3.fir.kt index 57061e8f587..d97e93dc062 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/pos/1.3.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/pos/1.3.fir.kt @@ -1,6 +1,17 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-213 + * MAIN LINK: declarations, classifier-declaration, class-declaration, abstract-classes -> paragraph 2 -> sentence 1 + * NUMBER: 3 + * DESCRIPTION: Abstract classes may contain one or more abstract members, which should be implemented in a subtype of this abstract class + * HELPERS: checkType, functions + */ + + // TESTCASE NUMBER: 1 // NOTE: attempt to implement inner abstract class as anonymous class open class MainCase1() { diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-4/pos/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-4/pos/1.1.fir.kt deleted file mode 100644 index 3cfa6295286..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-4/pos/1.1.fir.kt +++ /dev/null @@ -1,12 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER -// SKIP_TXT - - -// TESTCASE NUMBER: 1 -class C1(x1: Boolean, val x2: Boolean, var x3: Boolean) - -// TESTCASE NUMBER: 2 -class C2(x1: Boolean, var x2: Boolean, vararg var x3: Boolean) - -// TESTCASE NUMBER: 3 -class C3(x1: Boolean, vararg val x2: Boolean, var x3: Boolean) diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-4/pos/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-4/pos/1.1.kt index e59d2912f6d..522756252aa 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-4/pos/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-4/pos/1.1.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/neg/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/neg/1.1.fir.kt deleted file mode 100644 index 98e3d23ce5b..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/neg/1.1.fir.kt +++ /dev/null @@ -1,27 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER -// SKIP_TXT - - -// TESTCASE NUMBER: 1 -class Case1() { - class A(t: T) - class B(x: List<T>) - class C(c: () -> T) - class E(n: Nothing, t: T) -} - -// TESTCASE NUMBER: 2 -class Case2() { - data class A(t: T) - data class B(x: List<T>) - data class C(c: () -> T) - data class E(n: Nothing, t: T) -} - -// TESTCASE NUMBER: 3 -class Case3() { - enum class A(t: T) - enum class B(x: List<T>) - enum class C(c: () -> T) - enum class E(n: Nothing, t: T) -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/neg/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/neg/1.1.kt index fe7e1daec38..6f87610cca5 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/neg/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/neg/1.1.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/neg/1.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/neg/1.2.fir.kt deleted file mode 100644 index 48ae7a72616..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/neg/1.2.fir.kt +++ /dev/null @@ -1,20 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER -// SKIP_TXT - - -// TESTCASE NUMBER: 1 -data class A(x: Any?) -data class B(x: Any) -data class C(c: () -> Any) -data class D(e: Enum<*>) -data class E(n: Nothing) -data class F(t: T) - - -// TESTCASE NUMBER: 2 -class Case2() { - data class A(t: T) - data class B(x: List<T>) - data class C(c: () -> T) - data class E(n: Nothing, t: T) -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/neg/1.2.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/neg/1.2.kt index 26de64c2fd1..79a03424430 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/neg/1.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/neg/1.2.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/neg/2.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/neg/2.1.fir.kt deleted file mode 100644 index 6eac58f8ce3..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/neg/2.1.fir.kt +++ /dev/null @@ -1,11 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER -// SKIP_TXT - - -// TESTCASE NUMBER: 1 -class Case1() { - class A(val t: T) - class B(val x: List<T>) - class C(val c: () -> T) - class E(val n: Nothing, val t: T) -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/neg/2.1.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/neg/2.1.kt index 175ed8ead5d..704d6d57081 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/neg/2.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/neg/2.1.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/neg/3.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/neg/3.1.fir.kt deleted file mode 100644 index 6ace6b97ad9..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/neg/3.1.fir.kt +++ /dev/null @@ -1,11 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER -// SKIP_TXT - - -// TESTCASE NUMBER: 1 -class Case1() { - class A(var t: T) - class B(var x: List<T>) - class C(var c: () -> T) - class E(var n: Nothing, var t: T) -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/neg/3.1.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/neg/3.1.kt index 36edc8f0972..314548425ab 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/neg/3.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/neg/3.1.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/1.1.fir.kt index 801763b10f9..9afc04a7960 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/1.1.fir.kt @@ -1,6 +1,21 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-544 + * MAIN LINK: declarations, classifier-declaration, class-declaration, constructor-declaration -> paragraph 5 -> sentence 1 + * PRIMARY LINKS: declarations, classifier-declaration, class-declaration, constructor-declaration -> paragraph 4 -> sentence 1 + * declarations, classifier-declaration, class-declaration -> paragraph 1 -> sentence 1 + * declarations, classifier-declaration, class-declaration, constructor-declaration -> paragraph 2 -> sentence 1 + * declarations, classifier-declaration, class-declaration, constructor-declaration -> paragraph 6 -> sentence 1 + * SECONDARY LINKS: declarations, classifier-declaration, class-declaration -> paragraph 2 -> sentence 2 + * declarations, classifier-declaration, class-declaration -> paragraph 2 -> sentence 6 + * NUMBER: 1 + * DESCRIPTION: top level declaration primary constructor with regular constructor parameter + * HELPERS: checkType + */ // TESTCASE NUMBER: 1 class A(x: Any?){ diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/1.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/1.2.fir.kt index f413295e4b8..4fa5731a400 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/1.2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/1.2.fir.kt @@ -1,6 +1,21 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-544 + * MAIN LINK: declarations, classifier-declaration, class-declaration, constructor-declaration -> paragraph 5 -> sentence 1 + * PRIMARY LINKS: declarations, classifier-declaration, class-declaration, constructor-declaration -> paragraph 4 -> sentence 1 + * declarations, classifier-declaration, class-declaration -> paragraph 1 -> sentence 1 + * declarations, classifier-declaration, class-declaration, constructor-declaration -> paragraph 2 -> sentence 1 + * declarations, classifier-declaration, class-declaration, constructor-declaration -> paragraph 6 -> sentence 1 + * SECONDARY LINKS: declarations, classifier-declaration, class-declaration -> paragraph 2 -> sentence 2 + * declarations, classifier-declaration, class-declaration -> paragraph 2 -> sentence 6 + * NUMBER: 2 + * DESCRIPTION: Primary constructor for nested class with regular constructor parameter + * HELPERS: checkType + */ // TESTCASE NUMBER: 1 class Case1 { diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/1.3.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/1.3.fir.kt index e07181ba0ee..b1747ba7585 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/1.3.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/1.3.fir.kt @@ -1,6 +1,21 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-544 + * MAIN LINK: declarations, classifier-declaration, class-declaration, constructor-declaration -> paragraph 5 -> sentence 1 + * PRIMARY LINKS: declarations, classifier-declaration, class-declaration, constructor-declaration -> paragraph 4 -> sentence 1 + * declarations, classifier-declaration, class-declaration -> paragraph 1 -> sentence 1 + * declarations, classifier-declaration, class-declaration, constructor-declaration -> paragraph 2 -> sentence 1 + * declarations, classifier-declaration, class-declaration, constructor-declaration -> paragraph 6 -> sentence 1 + * SECONDARY LINKS: declarations, classifier-declaration, class-declaration -> paragraph 2 -> sentence 2 + * declarations, classifier-declaration, class-declaration -> paragraph 2 -> sentence 6 + * NUMBER: 3 + * DESCRIPTION: Primary constructor for inner class with regular constructor parameter + * HELPERS: checkType + */ // TESTCASE NUMBER: 1 class Case1 { diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/1.4.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/1.4.fir.kt deleted file mode 100644 index f864fd03e30..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/1.4.fir.kt +++ /dev/null @@ -1,38 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION -// SKIP_TXT - - -// TESTCASE NUMBER: 1 -fun List.case1() { - class Case1(t: T) - class A(t: T) - class B(x: List) - class C(c: () -> T) - class E(n: Nothing, t: T) -} - -// TESTCASE NUMBER: 2 -val List.case2: Int - get() = { - class A(t: T) - class B(x: List) - class C(c: () -> T) - class E(n: Nothing, t: T) - 1 - }() - -// TESTCASE NUMBER: 3 -var List.case3: Unit - get() { - class A(t: T) - class B(x: List) - class C(c: () -> T) - class E(n: Nothing, t: T) - 1 - } - set(i: Unit) { - class A(t: T) - class B(x: List) - class C(c: () -> T) - class E(n: Nothing, t: T) - } diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/1.4.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/1.4.kt index 2f4a80457bb..a4d05c3659c 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/1.4.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/1.4.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/1.5.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/1.5.fir.kt deleted file mode 100644 index f864fd03e30..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/1.5.fir.kt +++ /dev/null @@ -1,38 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION -// SKIP_TXT - - -// TESTCASE NUMBER: 1 -fun List.case1() { - class Case1(t: T) - class A(t: T) - class B(x: List) - class C(c: () -> T) - class E(n: Nothing, t: T) -} - -// TESTCASE NUMBER: 2 -val List.case2: Int - get() = { - class A(t: T) - class B(x: List) - class C(c: () -> T) - class E(n: Nothing, t: T) - 1 - }() - -// TESTCASE NUMBER: 3 -var List.case3: Unit - get() { - class A(t: T) - class B(x: List) - class C(c: () -> T) - class E(n: Nothing, t: T) - 1 - } - set(i: Unit) { - class A(t: T) - class B(x: List) - class C(c: () -> T) - class E(n: Nothing, t: T) - } diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/1.5.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/1.5.kt index 93583924297..c63c5e7b8a4 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/1.5.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/1.5.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/2.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/2.1.fir.kt index 7b8a86ddaef..98abe984fbf 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/2.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/2.1.fir.kt @@ -1,6 +1,21 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER -UNRESOLVED_REFERENCE -UNREACHABLE_CODE // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-544 + * MAIN LINK: declarations, classifier-declaration, class-declaration, constructor-declaration -> paragraph 5 -> sentence 2 + * PRIMARY LINKS: declarations, classifier-declaration, class-declaration, constructor-declaration -> paragraph 4 -> sentence 1 + * declarations, classifier-declaration, class-declaration -> paragraph 1 -> sentence 1 + * declarations, classifier-declaration, class-declaration, constructor-declaration -> paragraph 2 -> sentence 1 + * declarations, classifier-declaration, class-declaration, constructor-declaration -> paragraph 6 -> sentence 1 + * SECONDARY LINKS: declarations, classifier-declaration, class-declaration -> paragraph 2 -> sentence 2 + * declarations, classifier-declaration, class-declaration -> paragraph 2 -> sentence 6 + * NUMBER: 1 + * DESCRIPTION: top level declaration primary constructor with read-only property constructor parameter + * HELPERS: checkType + */ // TESTCASE NUMBER: 1 class A(val x: Any?) { diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/2.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/2.2.fir.kt index 989bdad624d..8ed0b1e1c6a 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/2.2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/2.2.fir.kt @@ -1,6 +1,21 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER -UNRESOLVED_REFERENCE -UNREACHABLE_CODE // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-544 + * MAIN LINK: declarations, classifier-declaration, class-declaration, constructor-declaration -> paragraph 5 -> sentence 2 + * PRIMARY LINKS: declarations, classifier-declaration, class-declaration, constructor-declaration -> paragraph 4 -> sentence 1 + * declarations, classifier-declaration, class-declaration -> paragraph 1 -> sentence 1 + * declarations, classifier-declaration, class-declaration, constructor-declaration -> paragraph 2 -> sentence 1 + * declarations, classifier-declaration, class-declaration, constructor-declaration -> paragraph 6 -> sentence 1 + * SECONDARY LINKS: declarations, classifier-declaration, class-declaration -> paragraph 2 -> sentence 2 + * declarations, classifier-declaration, class-declaration -> paragraph 2 -> sentence 6 + * NUMBER: 2 + * DESCRIPTION: Primary constructor for nested class with read-only property constructor parameter + * HELPERS: checkType + */ // TESTCASE NUMBER: 1 class Case1 { diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/2.3.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/2.3.fir.kt index a0de45e0881..70967f65f48 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/2.3.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/2.3.fir.kt @@ -1,6 +1,21 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER -UNRESOLVED_REFERENCE -UNREACHABLE_CODE // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-544 + * MAIN LINK: declarations, classifier-declaration, class-declaration, constructor-declaration -> paragraph 5 -> sentence 2 + * PRIMARY LINKS: declarations, classifier-declaration, class-declaration, constructor-declaration -> paragraph 4 -> sentence 1 + * declarations, classifier-declaration, class-declaration -> paragraph 1 -> sentence 1 + * declarations, classifier-declaration, class-declaration, constructor-declaration -> paragraph 2 -> sentence 1 + * declarations, classifier-declaration, class-declaration, constructor-declaration -> paragraph 6 -> sentence 1 + * SECONDARY LINKS: declarations, classifier-declaration, class-declaration -> paragraph 2 -> sentence 2 + * declarations, classifier-declaration, class-declaration -> paragraph 2 -> sentence 6 + * NUMBER: 3 + * DESCRIPTION: Primary constructor for inner class with mutable property constructor parameter + * HELPERS: checkType + */ // TESTCASE NUMBER: 1 class Case1 { diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/2.4.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/2.4.fir.kt deleted file mode 100644 index 62f5fb4ac32..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/2.4.fir.kt +++ /dev/null @@ -1,59 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION -UNREACHABLE_CODE -// SKIP_TXT - - -// TESTCASE NUMBER: 1 -fun List.case1() { - class Case1(val t: T) - class A(val t: T) - class B(val x: List) - class C(val c: () -> T) - class E(val n: Nothing, val t: T) -} - -// TESTCASE NUMBER: 2 -val List.case2: Int - get() = { - class A(val t: T) - class B(val x: List) - class C(val c: () -> T) - class E(val n: Nothing=TODO(), val t: T) - - fun test() { - A(this.first()) - B(this) - C { this.last() } - E(t = this[2]) - } - - 1 - }() - -// TESTCASE NUMBER: 3 -var List.case3: Unit - get() { - class A(val t: T) - class B(val x: List) - class C(val c: () -> T) - class E(val n: Nothing = TODO(), t: T) - - fun test() { - A(this.first()) - B(this) - C { this.last() } - E(t = this[2]) - } - } - set(i: Unit) { - class A(val t: T) - class B(val x: List) - class C(val c: () -> T) - class E( t: T, val n: Nothing) - - fun test() { - A(this.first()) - B(this) - C { this.last() } - E(t = this[2], TODO()) - } - } diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/2.4.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/2.4.kt index 72db51b24a4..f81c8ac64ad 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/2.4.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/2.4.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION -UNREACHABLE_CODE // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/3.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/3.1.fir.kt index 8ea60cc0f24..0334c684184 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/3.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/3.1.fir.kt @@ -1,6 +1,21 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER -UNREACHABLE_CODE // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-544 + * MAIN LINK: declarations, classifier-declaration, class-declaration, constructor-declaration -> paragraph 5 -> sentence 3 + * PRIMARY LINKS: declarations, classifier-declaration, class-declaration, constructor-declaration -> paragraph 4 -> sentence 1 + * declarations, classifier-declaration, class-declaration -> paragraph 1 -> sentence 1 + * declarations, classifier-declaration, class-declaration, constructor-declaration -> paragraph 2 -> sentence 1 + * declarations, classifier-declaration, class-declaration, constructor-declaration -> paragraph 6 -> sentence 1 + * SECONDARY LINKS: declarations, classifier-declaration, class-declaration -> paragraph 2 -> sentence 2 + * declarations, classifier-declaration, class-declaration -> paragraph 2 -> sentence 6 + * NUMBER: 1 + * DESCRIPTION: top level declaration primary constructor with mutable property constructor parameter + * HELPERS: checkType + */ // TESTCASE NUMBER: 1 class A(var x: Any?) { diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/3.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/3.2.fir.kt deleted file mode 100644 index c3db2e22ed8..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/3.2.fir.kt +++ /dev/null @@ -1,22 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER -// SKIP_TXT - - -// TESTCASE NUMBER: 1 -class Case1 { - class A(var x: Any?) - class B(var x: Any) - class C(var c: () -> Any) - class D(var e: Enum<*>) - class E(var n: Nothing) - class F(var t: T) -} - -// TESTCASE NUMBER: 2 -class Case2() { - class A(var e: T) - class B>(var e: T) - class C(var e: T) - class D>(var e: T) - class F(var t: T) -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/3.2.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/3.2.kt index 398d2f2fc0b..f1e1222b508 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/3.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/3.2.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/3.3.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/3.3.fir.kt deleted file mode 100644 index a65e01cc1d9..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/3.3.fir.kt +++ /dev/null @@ -1,23 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER -// SKIP_TXT - - -// TESTCASE NUMBER: 1 -class Case1 { - inner class A(var x: Any?) - inner class B(var x: Any) - inner class C(var c: () -> Any) - inner class D(var e: Enum<*>) - inner class E(var n: Nothing) - inner class F(var t: T) -} - -// TESTCASE NUMBER: 2 -class Case2() { - inner class A(var x: Any?, t: T) - inner class B(var x: T) - inner class C(var c: () -> T) - inner class D>(var e: T) - inner class E(var n: Nothing, var t: T) - inner class F(var t: T) -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/3.3.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/3.3.kt index 78aaa459f25..35b5a43e5d8 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/3.3.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/3.3.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/3.4.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/3.4.fir.kt deleted file mode 100644 index a82987c406e..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/3.4.fir.kt +++ /dev/null @@ -1,59 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION -// SKIP_TXT - - -// TESTCASE NUMBER: 1 -fun List.case1() { - class Case1(var t: T) - class A(var t: T) - class B(var x: List) - class C(var c: () -> T) - class E(var n: Nothing, var t: T) -} - -// TESTCASE NUMBER: 2 -val List.case2: Int - get() = { - class A(var t: T) - class B(var x: List) - class C(var c: () -> T) - class E(var n: Nothing=TODO(), var t: T) - - fun test() { - A(this.first()) - B(this) - C { this.last() } - E(t = this[2]) - } - - 1 - }() - -// TESTCASE NUMBER: 3 -var List.case3: Unit - get() { - class A(var t: T) - class B(var x: List) - class C(var c: () -> T) - class E(var n: Nothing = TODO(), t: T) - - fun test() { - A(this.first()) - B(this) - C { this.last() } - E(t = this[2]) - } - } - set(i: Unit) { - class A(var t: T) - class B(var x: List) - class C(var c: () -> T) - class E( t: T, var n: Nothing =TODO()) - - fun test() { - A(this.first()) - B(this) - C { this.last() } - E(t = this[2]) - } - } diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/3.4.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/3.4.kt index bf4ffbbae37..a192e92e888 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/3.4.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/3.4.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/property-declaration/local-property-declaration/p-1/neg/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/property-declaration/local-property-declaration/p-1/neg/1.1.fir.kt index c5c213aedcb..5ffab7936f3 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/property-declaration/local-property-declaration/p-1/neg/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/declarations/property-declaration/local-property-declaration/p-1/neg/1.1.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNREACHABLE_CODE -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-218 + * MAIN LINK: declarations, property-declaration, local-property-declaration -> paragraph 1 -> sentence 1 + * PRIMARY LINKS: declarations, property-declaration, property-initialization -> paragraph 1 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: All non-abstract properties must be definitely initialized before their first use. + */ /* * TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/additive-expression/p-4/pos/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/additive-expression/p-4/pos/1.1.fir.kt index c981b892208..9086ed039b7 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/additive-expression/p-4/pos/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/additive-expression/p-4/pos/1.1.fir.kt @@ -1,6 +1,18 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-218 + * MAIN LINK: expressions, additive-expression -> paragraph 4 -> sentence 1 + * PRIMARY LINKS: expressions, additive-expression -> paragraph 4 -> sentence 2 + * overloadable-operators -> paragraph 4 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: The return type of these functions is not restricted. + * HELPERS: checkType + */ + // TESTCASE NUMBER: 1 class Case1(var a: Int) { operator fun minus(o: Int): Case1 { TODO() } diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/pos/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/pos/1.1.fir.kt index 55a1163200e..3be5106a65c 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/pos/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/pos/1.1.fir.kt @@ -1,11 +1,20 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-213 + * MAIN LINK: expressions, built-in-types-and-their-semantics, kotlin.nothing-1 -> paragraph 1 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: check the type of jump expressions is Nothing and code placed on the left side of expression will never be executed + */ + // TESTCASE NUMBER: 1 fun case1() { var name: Any? = null - val men = arrayListOf(Person("Phill"), Person(), Person("Bob")) + val men = arrayListOf(Person1("Phill"), Person1(), Person1("Bob")) for (k in men) { k.name loop@ for (i in men) { @@ -20,13 +29,13 @@ fun case1() { val a = 1 } -class Person(var name: String? = null) {} +class Person1(var name: String? = null) {} // TESTCASE NUMBER: 2 fun case2() { var name: Any? = null - val men = arrayListOf(Person("Phill"), Person(), Person("Bob")) + val men = arrayListOf(Person2("Phill"), Person2(), Person2("Bob")) for (k in men) { loop@ for (i in men) { i.name @@ -40,6 +49,8 @@ fun case2() { val a = 1 } +class Person2(var name: String? = null) {} + // TESTCASE NUMBER: 3 fun case3() { diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/pos/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/pos/1.1.kt index 146d05dcf11..74d20d493d5 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/pos/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/pos/1.1.kt @@ -66,4 +66,4 @@ fun case3() { if (x == 3) return } val a = 1 -} \ No newline at end of file +} diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/comparison-expressions/p-1/neg/2.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/comparison-expressions/p-1/neg/2.1.fir.kt deleted file mode 100644 index 873102785fa..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/comparison-expressions/p-1/neg/2.1.fir.kt +++ /dev/null @@ -1,16 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -// SKIP_TXT - -// TESTCASE NUMBER: 1 -class A(val a: Int) { - fun compareTo(other: A): Int = run { - this.a - other.a - } -} - -fun case1() { - val a3 = A(-1) - val a4 = A(-3) - - val x = (a3 > a4) -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/comparison-expressions/p-1/neg/2.1.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/comparison-expressions/p-1/neg/2.1.kt index 918fe49c42a..7db3de8d8be 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/comparison-expressions/p-1/neg/2.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/comparison-expressions/p-1/neg/2.1.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/comparison-expressions/p-4/neg/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/comparison-expressions/p-4/neg/1.1.fir.kt index 2222d1ed97a..d189cbb3d76 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/comparison-expressions/p-4/neg/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/comparison-expressions/p-4/neg/1.1.fir.kt @@ -1,6 +1,16 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-218 + * MAIN LINK: expressions, comparison-expressions -> paragraph 4 -> sentence 1 + * PRIMARY LINKS: overloadable-operators -> paragraph 4 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: The compareTo operator function must have return type kotlin.Int + */ + // TESTCASE NUMBER: 1 class Case1(val a: Int) { var isCompared = false diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/conditional-expression/p-6/neg/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/conditional-expression/p-6/neg/1.1.fir.kt index ab6e5a36f97..ad794c5449a 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/conditional-expression/p-6/neg/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/conditional-expression/p-6/neg/1.1.fir.kt @@ -2,6 +2,16 @@ // SKIP_TXT // FULL_JDK +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-313 + * MAIN LINK: expressions, conditional-expression -> paragraph 6 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: The type of the condition expression must be a subtype of kotlin.Boolean + * HELPERS: checkType + */ + // MODULE: libModule // FILE: libModule/JavaContainer.java package libModule; diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/boolean-literals/p-1/neg/3.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/boolean-literals/p-1/neg/3.1.fir.kt deleted file mode 100644 index d6afa98cfa2..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/boolean-literals/p-1/neg/3.1.fir.kt +++ /dev/null @@ -1,11 +0,0 @@ -// TESTCASE NUMBER: 1 -fun case_1() { - true checkType { check() } - false checkType { check() } - - true checkType { check() } - false checkType { check() } - - true checkType { check() } - false checkType { check() } -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/boolean-literals/p-1/neg/3.1.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/boolean-literals/p-1/neg/3.1.kt index 216c1d5da3b..668bd3d6395 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/boolean-literals/p-1/neg/3.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/boolean-literals/p-1/neg/3.1.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL /* * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) * diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/character-literals/p-1/neg/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/character-literals/p-1/neg/1.1.fir.kt index 4193f328df1..0df512f54cd 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/character-literals/p-1/neg/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/character-literals/p-1/neg/1.1.fir.kt @@ -1,6 +1,20 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-435 + * MAIN LINK: expressions, constant-literals, character-literals -> paragraph 1 -> sentence 1 + * PRIMARY LINKS: expressions, constant-literals, character-literals -> paragraph 1 -> sentence 2 + * expressions, constant-literals, character-literals -> paragraph 2 -> sentence 1 + * expressions, constant-literals, character-literals -> paragraph 2 -> sentence 2 + * expressions, constant-literals, character-literals -> paragraph 4 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: A character literal defines a constant holding a unicode character value + * HELPERS: checkType + */ + // TESTCASE NUMBER: 1 fun case1() { val c = '' diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/character-literals/p-4/neg/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/character-literals/p-4/neg/1.1.fir.kt index ea0c2c23a56..5b472203377 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/character-literals/p-4/neg/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/character-literals/p-4/neg/1.1.fir.kt @@ -1,6 +1,18 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-218 + * MAIN LINK: expressions, constant-literals, character-literals -> paragraph 4 -> sentence 1 + * PRIMARY LINKS: expressions, constant-literals, character-literals -> paragraph 5 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: to define a character the unicode codepoint escaped symbol \u could be used with followed by exactly four hexadecimal digits. + * HELPERS: checkType + */ + + // TESTCASE NUMBER: 1 fun case1() { diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/integer-literals/binary-integer-literals/p-1/neg/2.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/integer-literals/binary-integer-literals/p-1/neg/2.1.fir.kt index 4efcae35a14..662f4381bb4 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/integer-literals/binary-integer-literals/p-1/neg/2.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/integer-literals/binary-integer-literals/p-1/neg/2.1.fir.kt @@ -1,3 +1,12 @@ +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-100 + * MAIN LINK: expressions, constant-literals, integer-literals, binary-integer-literals -> paragraph 1 -> sentence 2 + * NUMBER: 1 + * DESCRIPTION: Binary integer literals with an underscore after the prefix. + */ + // TESTCASE NUMBER: 1 val value_1 = 0b_1110100000 diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/integer-literals/binary-integer-literals/p-1/neg/2.3.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/integer-literals/binary-integer-literals/p-1/neg/2.3.fir.kt index beaf7f16e65..8198858a753 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/integer-literals/binary-integer-literals/p-1/neg/2.3.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/integer-literals/binary-integer-literals/p-1/neg/2.3.fir.kt @@ -1,3 +1,12 @@ +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-100 + * MAIN LINK: expressions, constant-literals, integer-literals, binary-integer-literals -> paragraph 1 -> sentence 2 + * NUMBER: 3 + * DESCRIPTION: Binary integer literals with an underscore in the last position. + */ + // TESTCASE NUMBER: 1 val value_1 = 0b0_1_1_0_1_1_____ diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/integer-literals/decimal-integer-literals/p-1/neg/2.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/integer-literals/decimal-integer-literals/p-1/neg/2.1.fir.kt index d4377d7b4ef..d2cd61e54e7 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/integer-literals/decimal-integer-literals/p-1/neg/2.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/integer-literals/decimal-integer-literals/p-1/neg/2.1.fir.kt @@ -1,4 +1,3 @@ -// FIR_IDENTICAL /* * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) * diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/integer-literals/decimal-integer-literals/p-1/neg/2.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/integer-literals/decimal-integer-literals/p-1/neg/2.2.fir.kt index ddd79b13b1c..80de52dc2c8 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/integer-literals/decimal-integer-literals/p-1/neg/2.2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/integer-literals/decimal-integer-literals/p-1/neg/2.2.fir.kt @@ -1,4 +1,3 @@ -// FIR_IDENTICAL /* * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) * diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/integer-literals/decimal-integer-literals/p-1/neg/2.3.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/integer-literals/decimal-integer-literals/p-1/neg/2.3.fir.kt index 7edf14d2851..455b178d319 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/integer-literals/decimal-integer-literals/p-1/neg/2.3.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/integer-literals/decimal-integer-literals/p-1/neg/2.3.fir.kt @@ -1,4 +1,3 @@ -// FIR_IDENTICAL /* * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) * diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/integer-literals/hexadecimal-integer-literals/p-1/neg/2.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/integer-literals/hexadecimal-integer-literals/p-1/neg/2.1.fir.kt index 43238c53d5c..32699b44dc7 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/integer-literals/hexadecimal-integer-literals/p-1/neg/2.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/integer-literals/hexadecimal-integer-literals/p-1/neg/2.1.fir.kt @@ -1,3 +1,12 @@ +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-100 + * MAIN LINK: expressions, constant-literals, integer-literals, hexadecimal-integer-literals -> paragraph 1 -> sentence 2 + * NUMBER: 1 + * DESCRIPTION: Hexadecimal integer literals with an underscore after the prefix. + */ + // TESTCASE NUMBER: 1 val value_1 = 0x_1234567890 diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/integer-literals/hexadecimal-integer-literals/p-1/neg/2.4.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/integer-literals/hexadecimal-integer-literals/p-1/neg/2.4.fir.kt index 89f9d1af5a1..38cc8c68eb2 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/integer-literals/hexadecimal-integer-literals/p-1/neg/2.4.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/integer-literals/hexadecimal-integer-literals/p-1/neg/2.4.fir.kt @@ -1,3 +1,12 @@ +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-100 + * MAIN LINK: expressions, constant-literals, integer-literals, hexadecimal-integer-literals -> paragraph 1 -> sentence 2 + * NUMBER: 4 + * DESCRIPTION: Hexadecimal integer literals with an underscore in the last position. + */ + // TESTCASE NUMBER: 1 val value_1 = 0x3_4_5_6_7_8_____ diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-1/pos/1.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-1/pos/1.2.fir.kt index 2f4066c0e61..973c011052b 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-1/pos/1.2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-1/pos/1.2.fir.kt @@ -1,3 +1,12 @@ +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-100 + * MAIN LINK: expressions, constant-literals, real-literals -> paragraph 1 -> sentence 1 + * NUMBER: 2 + * DESCRIPTION: Real literals with a many digits in a whole-number part and a fraction part (including conforms). + */ + // TESTCASE NUMBER: 1 val value_1 = 0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001 diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-1/pos/3.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-1/pos/3.2.fir.kt index b446d6bd16e..53c1cf252ed 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-1/pos/3.2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-1/pos/3.2.fir.kt @@ -1,3 +1,12 @@ +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-100 + * MAIN LINK: expressions, constant-literals, real-literals -> paragraph 1 -> sentence 3 + * NUMBER: 2 + * DESCRIPTION: Real literals suffixed by f/F (the float suffix) with a many digits in a whole-number part and a fraction part (including conforms). + */ + // TESTCASE NUMBER: 1 val value_1 = 0.000000000000000000000000000000000000000000001f diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-2/neg/1.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-2/neg/1.2.fir.kt index 5250e017dc5..f3986461838 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-2/neg/1.2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-2/neg/1.2.fir.kt @@ -1,3 +1,12 @@ +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-435 + * MAIN LINK: expressions, constant-literals, real-literals -> paragraph 2 -> sentence 1 + * NUMBER: 2 + * DESCRIPTION: Real literals with a not allowed exponent mark at the beginning. + */ + // TESTCASE NUMBER: 1 val value_1 = E0 diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-2/neg/1.3.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-2/neg/1.3.fir.kt index 62e75aa385f..1ca6c4db980 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-2/neg/1.3.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-2/neg/1.3.fir.kt @@ -1,3 +1,12 @@ +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-435 + * MAIN LINK: expressions, constant-literals, real-literals -> paragraph 2 -> sentence 1 + * NUMBER: 3 + * DESCRIPTION: Real literals suffixed by f/F (float suffix) with a not allowed exponent mark at the beginning. + */ + // TESTCASE NUMBER: 1 val value_1 = E0f diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-2/pos/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-2/pos/1.1.fir.kt index 9abd9df3635..8911a3b4805 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-2/pos/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-2/pos/1.1.fir.kt @@ -1,3 +1,12 @@ +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-435 + * MAIN LINK: expressions, constant-literals, real-literals -> paragraph 2 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: Simple real literals with an exponent mark. + */ + // TESTCASE NUMBER: 1 val value_1 = 0.0e0 diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-2/pos/1.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-2/pos/1.2.fir.kt index a6ae9d078f1..23048208e01 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-2/pos/1.2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-2/pos/1.2.fir.kt @@ -1,3 +1,12 @@ +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-435 + * MAIN LINK: expressions, constant-literals, real-literals -> paragraph 2 -> sentence 1 + * NUMBER: 2 + * DESCRIPTION: Real literals suffixed by f/F (float suffix) with an exponent mark. + */ + // TESTCASE NUMBER: 1 val value_1 = 0.0e0f diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-3/pos/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-3/pos/1.1.fir.kt index 0d250978e98..0f43c558751 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-3/pos/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-3/pos/1.1.fir.kt @@ -1,3 +1,12 @@ +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-100 + * MAIN LINK: expressions, constant-literals, real-literals -> paragraph 3 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: Simple real literals with omitted a whole-number part. + */ + // TESTCASE NUMBER: 1 val value_1 = .0 diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-3/pos/1.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-3/pos/1.2.fir.kt index 822b2bafa3a..0439f5979c8 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-3/pos/1.2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-3/pos/1.2.fir.kt @@ -1,3 +1,12 @@ +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-100 + * MAIN LINK: expressions, constant-literals, real-literals -> paragraph 3 -> sentence 1 + * NUMBER: 2 + * DESCRIPTION: Real literals with omitted a whole-number part and an exponent mark. + */ + // TESTCASE NUMBER: 1 val value_1 = .0e0 diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-3/pos/1.5.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-3/pos/1.5.fir.kt index 2f52191c563..c2197933e9d 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-3/pos/1.5.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-3/pos/1.5.fir.kt @@ -1,3 +1,12 @@ +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-100 + * MAIN LINK: expressions, constant-literals, real-literals -> paragraph 3 -> sentence 1 + * NUMBER: 5 + * DESCRIPTION: Real literals suffixed by f/F (float suffix) with omitted a whole-number part and an exponent mark. + */ + // TESTCASE NUMBER: 1 val value_1 = .0e0f diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-3/pos/2.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-3/pos/2.1.fir.kt index a95cde73a1e..87f69fd3969 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-3/pos/2.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-3/pos/2.1.fir.kt @@ -1,3 +1,12 @@ +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-100 + * MAIN LINK: expressions, constant-literals, real-literals -> paragraph 3 -> sentence 2 + * NUMBER: 1 + * DESCRIPTION: Simple real literals with omitted a fraction part, suffixed by f/F (float suffix). + */ + // TESTCASE NUMBER: 1 val value_1 = 0F diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-3/pos/2.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-3/pos/2.2.fir.kt index 5417a9b1a04..d30930a18f8 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-3/pos/2.2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-3/pos/2.2.fir.kt @@ -1,3 +1,12 @@ +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-100 + * MAIN LINK: expressions, constant-literals, real-literals -> paragraph 3 -> sentence 2 + * NUMBER: 2 + * DESCRIPTION: Real literals with omitted a fraction part and an exponent mark. + */ + // TESTCASE NUMBER: 1 val value_1 = 0e0 diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-3/pos/2.3.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-3/pos/2.3.fir.kt index 60f2c4e45ff..c0399ca5c48 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-3/pos/2.3.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-3/pos/2.3.fir.kt @@ -1,3 +1,12 @@ +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-100 + * MAIN LINK: expressions, constant-literals, real-literals -> paragraph 3 -> sentence 2 + * NUMBER: 3 + * DESCRIPTION: Real literals with omitted a fraction part and an exponent mark, suffixed by f/F (float suffix). + */ + // TESTCASE NUMBER: 1 val value_1 = 0e0f diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-4/neg/1.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-4/neg/1.2.fir.kt index 578ba08ce08..b448f1564f2 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-4/neg/1.2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-4/neg/1.2.fir.kt @@ -1,3 +1,12 @@ +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-100 + * MAIN LINK: expressions, constant-literals, real-literals -> paragraph 4 -> sentence 1 + * NUMBER: 2 + * DESCRIPTION: Real literals with underscores at the end. + */ + // TESTCASE NUMBER: 1 val value_1= .0_0e-0___ diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-4/neg/2.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-4/neg/2.1.fir.kt index 3f817a3a7b8..1b4350663d2 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-4/neg/2.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-4/neg/2.1.fir.kt @@ -1,3 +1,12 @@ +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-100 + * MAIN LINK: expressions, constant-literals, real-literals -> paragraph 4 -> sentence 2 + * NUMBER: 1 + * DESCRIPTION: Real literals with underscores before an exponent mark. + */ + // TESTCASE NUMBER: 1 val value_1 = 0_E0 diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-4/neg/2.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-4/neg/2.2.fir.kt index 1bfe2c446b2..c424745149f 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-4/neg/2.2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-4/neg/2.2.fir.kt @@ -1,3 +1,12 @@ +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-100 + * MAIN LINK: expressions, constant-literals, real-literals -> paragraph 4 -> sentence 2 + * NUMBER: 2 + * DESCRIPTION: Real literals with underscores after an exponent mark. + */ + // TESTCASE NUMBER: 1 val value_1 = 0e___0 diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-4/neg/2.3.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-4/neg/2.3.fir.kt index 9f73b0da05e..3374c30daaa 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-4/neg/2.3.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-4/neg/2.3.fir.kt @@ -1,3 +1,12 @@ +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-100 + * MAIN LINK: expressions, constant-literals, real-literals -> paragraph 4 -> sentence 2 + * NUMBER: 3 + * DESCRIPTION: Real literals with underscores around an exponent mark. + */ + // TESTCASE NUMBER: 1 val value_1 = .0__e_0 diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-4/pos/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-4/pos/1.1.fir.kt index aeef3b7b48f..f02f1059bdf 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-4/pos/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-4/pos/1.1.fir.kt @@ -1,3 +1,12 @@ +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-100 + * MAIN LINK: expressions, constant-literals, real-literals -> paragraph 4 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: Real literals with underscores in a whole-number part and a fraction part. + */ + // TESTCASE NUMBER: 1 val value_1 = 0.0_0 diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-4/pos/1.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-4/pos/1.2.fir.kt index b2bd4ad96fc..6b1b5383865 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-4/pos/1.2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-4/pos/1.2.fir.kt @@ -1,3 +1,12 @@ +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-100 + * MAIN LINK: expressions, constant-literals, real-literals -> paragraph 4 -> sentence 1 + * NUMBER: 2 + * DESCRIPTION: Real literals suffixed by f/F (float suffix) with underscores in a whole-number part and a fraction part. + */ + // TESTCASE NUMBER: 1 val value_1 = 0.0_0f diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-4/pos/1.3.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-4/pos/1.3.fir.kt index e9069df73ad..68f2aa68abc 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-4/pos/1.3.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-4/pos/1.3.fir.kt @@ -1,3 +1,12 @@ +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-100 + * MAIN LINK: expressions, constant-literals, real-literals -> paragraph 4 -> sentence 1 + * NUMBER: 3 + * DESCRIPTION: Real literals suffixed by f/F (float suffix) with an exponent mark and underscores in a whole-number part, a fraction part and an exponent part. + */ + // TESTCASE NUMBER: 1 val value_1 = 0.0_0e1_0f diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-4/pos/1.4.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-4/pos/1.4.fir.kt index 0f48b0be6ca..3ada161f99f 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-4/pos/1.4.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-4/pos/1.4.fir.kt @@ -1,3 +1,12 @@ +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-100 + * MAIN LINK: expressions, constant-literals, real-literals -> paragraph 4 -> sentence 1 + * NUMBER: 4 + * DESCRIPTION: Real literals with an omitted whole-number part and underscores in a whole-number part, a fraction part and an exponent part. + */ + // TESTCASE NUMBER: 1 val value_1 = .0_0 diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-4/pos/1.5.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-4/pos/1.5.fir.kt index 4cbe41b5306..c57daea199a 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-4/pos/1.5.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-4/pos/1.5.fir.kt @@ -1,3 +1,12 @@ +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-100 + * MAIN LINK: expressions, constant-literals, real-literals -> paragraph 4 -> sentence 1 + * NUMBER: 5 + * DESCRIPTION: Real literals with an omitted fraction part and underscores in a whole-number part, a fraction part and an exponent part. + */ + // TESTCASE NUMBER: 1 val value_1 = 0_0F diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-5/pos/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-5/pos/1.1.fir.kt index 1ee2f9a2dbc..bbfac967046 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-5/pos/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-5/pos/1.1.fir.kt @@ -1,3 +1,13 @@ +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-100 + * MAIN LINK: expressions, constant-literals, real-literals -> paragraph 5 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: A type checking of a simple real literal (with/without underscores). + * HELPERS: checkType + */ + // TESTCASE NUMBER: 1 val value_1 = 0.1 checkType { check() } diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-5/pos/1.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-5/pos/1.2.fir.kt index 8e6cf3c22fe..a7e6295faf0 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-5/pos/1.2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-5/pos/1.2.fir.kt @@ -1,3 +1,13 @@ +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-100 + * MAIN LINK: expressions, constant-literals, real-literals -> paragraph 5 -> sentence 1 + * NUMBER: 2 + * DESCRIPTION: A type checking of a real literal with an exponent mark. + * HELPERS: checkType + */ + // TESTCASE NUMBER: 1 val value_1 = 0.0e0 checkType { check() } diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-5/pos/1.3.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-5/pos/1.3.fir.kt index 661b77b969e..84298aa5c8d 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-5/pos/1.3.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-5/pos/1.3.fir.kt @@ -1,3 +1,13 @@ +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-100 + * MAIN LINK: expressions, constant-literals, real-literals -> paragraph 5 -> sentence 1 + * NUMBER: 3 + * DESCRIPTION: A type checking of a real literal with omitted a whole-number part. + * HELPERS: checkType + */ + // TESTCASE NUMBER: 1 val value_1 = .0 checkType { check() } diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-5/pos/1.4.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-5/pos/1.4.fir.kt index 9a1f6baa6b5..6d85f0f5722 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-5/pos/1.4.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-5/pos/1.4.fir.kt @@ -1,3 +1,13 @@ +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-100 + * MAIN LINK: expressions, constant-literals, real-literals -> paragraph 5 -> sentence 1 + * NUMBER: 4 + * DESCRIPTION: A type checking of a real literal with omitted a whole-number part and an exponent mark. + * HELPERS: checkType + */ + // TESTCASE NUMBER: 1 val value_1 = .0e0 checkType { check() } diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-5/pos/1.5.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-5/pos/1.5.fir.kt index 53e0a6e19ac..3810348b81f 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-5/pos/1.5.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-5/pos/1.5.fir.kt @@ -1,3 +1,13 @@ +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-100 + * MAIN LINK: expressions, constant-literals, real-literals -> paragraph 5 -> sentence 1 + * NUMBER: 5 + * DESCRIPTION: A type checking of a real literal with omitted a fraction part and an exponent mark. + * HELPERS: checkType + */ + // TESTCASE NUMBER: 1 val value_1 = 0e0 checkType { check() } diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/1.1.fir.kt index a88253e6d32..8d5d3035541 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/1.1.fir.kt @@ -1,3 +1,12 @@ +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-100 + * MAIN LINK: expressions, constant-literals, the-types-for-integer-literals -> paragraph 1 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: Binary and hexadecimal integer literals with a long literal mark only. + */ + // TESTCASE NUMBER: 1 val value_1 = 0bl diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/1.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/1.2.fir.kt index 1355982b3bc..9864554af8d 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/1.2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/1.2.fir.kt @@ -1,3 +1,12 @@ +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-100 + * MAIN LINK: expressions, constant-literals, the-types-for-integer-literals -> paragraph 1 -> sentence 1 + * NUMBER: 2 + * DESCRIPTION: Various integer literals with a not allowed underscore before the long literal mark. + */ + // TESTCASE NUMBER: 1 val value_1 = 0b0_l diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.1.fir.kt index c4233047393..94dd1a02dc7 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.1.fir.kt @@ -1,5 +1,15 @@ // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-100 + * MAIN LINK: expressions, constant-literals, the-types-for-integer-literals -> paragraph 1 -> sentence 2 + * NUMBER: 1 + * DESCRIPTION: Various integer literals with not allowed long literal mark in lower case (type checking). + * HELPERS: checkType + */ + // TESTCASE NUMBER: 1 fun case_1() { 0l checkType { check() } diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.2.fir.kt index d80b765e275..ba38499b616 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.2.fir.kt @@ -1,5 +1,15 @@ // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-100 + * MAIN LINK: expressions, constant-literals, the-types-for-integer-literals -> paragraph 1 -> sentence 2 + * NUMBER: 2 + * DESCRIPTION: Type checking (comparison with invalid types) of various integer literals with long literal mark. + * HELPERS: checkType + */ + // TESTCASE NUMBER: 1 fun case_1() { 0L checkType { check() } diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.3.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.3.fir.kt index 190e7ef89ce..6e5a0e0f987 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.3.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.3.fir.kt @@ -1,5 +1,15 @@ // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-100 + * MAIN LINK: expressions, constant-literals, the-types-for-integer-literals -> paragraph 1 -> sentence 2 + * NUMBER: 3 + * DESCRIPTION: Type checking (comparison with invalid types) of various integer literals. + * HELPERS: checkType + */ + // TESTCASE NUMBER: 1 fun case_1() { 0 checkType { check() } diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.4.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.4.fir.kt index 6360a28099a..50d2b10e5a3 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.4.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.4.fir.kt @@ -1,5 +1,15 @@ // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-100 + * MAIN LINK: expressions, constant-literals, the-types-for-integer-literals -> paragraph 1 -> sentence 2 + * NUMBER: 4 + * DESCRIPTION: Type checking (comparison with invalid types) of too a big integers. + * HELPERS: checkType + */ + // TESTCASE NUMBER: 1 fun case_1() { checkSubtype(-9223372036854775808L) diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.5.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.5.fir.kt index c3ff0e7f7d0..d30df3f4f67 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.5.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.5.fir.kt @@ -1,5 +1,15 @@ // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-100 + * MAIN LINK: expressions, constant-literals, the-types-for-integer-literals -> paragraph 1 -> sentence 2 + * NUMBER: 5 + * DESCRIPTION: Check of integer type selection depends on the context (incopatible types). + * HELPERS: checkType + */ + // FILE: testFunctions.kt package functions diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/pos/2.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/pos/2.2.fir.kt deleted file mode 100644 index b5c2939db44..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/pos/2.2.fir.kt +++ /dev/null @@ -1,82 +0,0 @@ -// SKIP_TXT - -// TESTCASE NUMBER: 1 -fun case_1() { - 0 checkType { check() } - checkSubtype(0) - checkSubtype(0) - checkSubtype(0) - checkSubtype(0) -} - -// TESTCASE NUMBER: 2 -fun case_2() { - 127 checkType { check() } - checkSubtype(127) - checkSubtype(127) - checkSubtype(127) - checkSubtype(127) - - 128 checkType { check() } - checkSubtype(128) - checkSubtype(128) - checkSubtype(128) - - -128 checkType { check() } - checkSubtype(-128) - checkSubtype(-128) - checkSubtype(-128) - checkSubtype(-128) - - -129 checkType { check() } - checkSubtype(-129) - checkSubtype(-129) - checkSubtype(-129) -} - -// TESTCASE NUMBER: 3 -fun case_3() { - 32767 checkType { check() } - checkSubtype(32767) - checkSubtype(32767) - checkSubtype(32767) - - 32768 checkType { check() } - checkSubtype(32768) - checkSubtype(32768) - - -32768 checkType { check() } - checkSubtype(-32768) - checkSubtype(-32768) - checkSubtype(-32768) - - -32769 checkType { check() } - checkSubtype(-32769) - checkSubtype(-32769) -} - -// TESTCASE NUMBER: 4 -fun case_4() { - 2147483647 checkType { check() } - checkSubtype(2147483647) - checkSubtype(2147483647) - - 2147483648 checkType { check() } - checkSubtype(2147483648) - - -2147483648 checkType { check() } - checkSubtype(-2147483648) - checkSubtype(-2147483648) - - -2147483649 checkType { check() } - checkSubtype(-2147483649) -} - -// TESTCASE NUMBER: 5 -fun case_5() { - 9223372036854775807 checkType { check() } - checkSubtype(9223372036854775807) - - -9223372036854775807 checkType { check() } - checkSubtype(-9223372036854775807) -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/pos/2.2.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/pos/2.2.kt index bf250e01cd8..ed7f1740d77 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/pos/2.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/pos/2.2.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // SKIP_TXT /* diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/pos/2.3.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/pos/2.3.fir.kt deleted file mode 100644 index 45b6da813ab..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/pos/2.3.fir.kt +++ /dev/null @@ -1,82 +0,0 @@ -// SKIP_TXT - -// TESTCASE NUMBER: 1 -fun case_1() { - 0x0 checkType { check() } - checkSubtype(0x0) - checkSubtype(0x0) - checkSubtype(0x0) - checkSubtype(0x0) -} - -// TESTCASE NUMBER: 2 -fun case_2() { - 0x7F checkType { check() } - checkSubtype(0x7F) - checkSubtype(0x7F) - checkSubtype(0x7F) - checkSubtype(0x7F) - - 0X80 checkType { check() } - checkSubtype(0X80) - checkSubtype(0X80) - checkSubtype(0X80) - - -0X80 checkType { check() } - checkSubtype(-0X80) - checkSubtype(-0X80) - checkSubtype(-0X80) - checkSubtype(-0X80) - - -0x81 checkType { check() } - checkSubtype(-0x81) - checkSubtype(-0x81) - checkSubtype(-0x81) -} - -// TESTCASE NUMBER: 3 -fun case_3() { - 0x7FFF checkType { check() } - checkSubtype(0x7FFF) - checkSubtype(0x7FFF) - checkSubtype(0x7FFF) - - 0x8000 checkType { check() } - checkSubtype(0x8000) - checkSubtype(0x8000) - - -0x8000 checkType { check() } - checkSubtype(-0x8000) - checkSubtype(-0x8000) - checkSubtype(-0x8000) - - -0X8001 checkType { check() } - checkSubtype(-0X8001) - checkSubtype(-0X8001) -} - -// TESTCASE NUMBER: 4 -fun case_4() { - 0x7FFFFFFF checkType { check() } - checkSubtype(0x7FFFFFFF) - checkSubtype(0x7FFFFFFF) - - 0x80000000 checkType { check() } - checkSubtype(0x80000000) - - -0x80000000 checkType { check() } - checkSubtype(-0x80000000) - checkSubtype(-0x80000000) - - -0x80000001 checkType { check() } - checkSubtype(-0x80000001) -} - -// TESTCASE NUMBER: 5 -fun case_5() { - 0X7FFFFFFFFFFFFFFF checkType { check() } - checkSubtype(0X7FFFFFFFFFFFFFFF) - - -0X7FFFFFFFFFFFFFFF checkType { check() } - checkSubtype(-0X7FFFFFFFFFFFFFFF) -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/pos/2.3.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/pos/2.3.kt index 998fa47e375..0f9ff524c20 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/pos/2.3.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/pos/2.3.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // SKIP_TXT /* diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/pos/2.4.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/pos/2.4.fir.kt deleted file mode 100644 index 9a7cc0bd82b..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/pos/2.4.fir.kt +++ /dev/null @@ -1,82 +0,0 @@ -// SKIP_TXT - -// TESTCASE NUMBER: 1 -fun case_1() { - 0b0 checkType { check() } - checkSubtype(0b0) - checkSubtype(0b0) - checkSubtype(0b0) - checkSubtype(0b0) -} - -// TESTCASE NUMBER: 2 -fun case_2() { - 0B1111111 checkType { check() } - checkSubtype(0B1111111) - checkSubtype(0B1111111) - checkSubtype(0B1111111) - checkSubtype(0B1111111) - - 0b10000000 checkType { check() } - checkSubtype(0b10000000) - checkSubtype(0b10000000) - checkSubtype(0b10000000) - - -0B10000000 checkType { check() } - checkSubtype(-0B10000000) - checkSubtype(-0B10000000) - checkSubtype(-0B10000000) - checkSubtype(-0B10000000) - - -0b10000001 checkType { check() } - checkSubtype(-0b10000001) - checkSubtype(-0b10000001) - checkSubtype(-0b10000001) -} - -// TESTCASE NUMBER: 3 -fun case_3() { - 0B111111111111111 checkType { check() } - checkSubtype(0B111111111111111) - checkSubtype(0B111111111111111) - checkSubtype(0B111111111111111) - - 0b1000000000000000 checkType { check() } - checkSubtype(0b1000000000000000) - checkSubtype(0b1000000000000000) - - -0b1000000000000000 checkType { check() } - checkSubtype(-0b1000000000000000) - checkSubtype(-0b1000000000000000) - checkSubtype(-0b1000000000000000) - - -0B1000000000000001 checkType { check() } - checkSubtype(-0B1000000000000001) - checkSubtype(-0B1000000000000001) -} - -// TESTCASE NUMBER: 4 -fun case_4() { - 0b1111111111111111111111111111111 checkType { check() } - checkSubtype(0b1111111111111111111111111111111) - checkSubtype(0b1111111111111111111111111111111) - - 0B10000000000000000000000000000000 checkType { check() } - checkSubtype(0B10000000000000000000000000000000) - - -0B10000000000000000000000000000000 checkType { check() } - checkSubtype(-0B10000000000000000000000000000000) - checkSubtype(-0B10000000000000000000000000000000) - - -0b10000000000000000000000000000001 checkType { check() } - checkSubtype(-0b10000000000000000000000000000001) -} - -// TESTCASE NUMBER: 5 -fun case_5() { - 0b111111111111111111111111111111111111111111111111111111111111111 checkType { check() } - checkSubtype(0b111111111111111111111111111111111111111111111111111111111111111) - - -0B111111111111111111111111111111111111111111111111111111111111111 checkType { check() } - checkSubtype(-0B111111111111111111111111111111111111111111111111111111111111111) -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/pos/2.4.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/pos/2.4.kt index 97d2b7168ca..bbaee05674a 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/pos/2.4.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/pos/2.4.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // SKIP_TXT /* diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/elvis-operator-expression/p-3/pos/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/elvis-operator-expression/p-3/pos/1.1.fir.kt index c7663089037..0fa9d2ebe61 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/elvis-operator-expression/p-3/pos/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/elvis-operator-expression/p-3/pos/1.1.fir.kt @@ -1,6 +1,17 @@ // !DIAGNOSTICS: -UNREACHABLE_CODE -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-218 + * MAIN LINK: expressions, elvis-operator-expression -> paragraph 3 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: The type of elvis operator expression is the least upper bound of the non-nullable variant of the type of the left-hand side expression and the type of the right-hand side expression. + * HELPERS: checkType + */ + + // TESTCASE NUMBER: 1 fun case1() { val x = null ?: getNull() diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/break-expression/p-1/neg/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/break-expression/p-1/neg/1.1.fir.kt index 1948c55a685..26c9d212915 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/break-expression/p-1/neg/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/break-expression/p-1/neg/1.1.fir.kt @@ -1,6 +1,16 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-222 + * MAIN LINK: expressions, jump-expressions, break-expression -> paragraph 1 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: A break expression is a jump expression allowed only within loop bodies. + */ + + // TESTCASE NUMBER: 1 fun case1() { val inputList = listOf(1, 2, 3) diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/continue-expression/p-1/neg/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/continue-expression/p-1/neg/1.1.fir.kt index 526f7561514..4cd393323bc 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/continue-expression/p-1/neg/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/continue-expression/p-1/neg/1.1.fir.kt @@ -1,6 +1,16 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-222 + * MAIN LINK: expressions, jump-expressions, continue-expression -> paragraph 1 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: A continue expression is a jump expression allowed only within loop bodies. + */ + + // TESTCASE NUMBER: 1 fun case1() { val inputList = listOf(1, 2, 3) diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/return-expressions/p-1/pos/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/return-expressions/p-1/pos/1.1.fir.kt index 439257d7420..54deb22c3d9 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/return-expressions/p-1/pos/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/return-expressions/p-1/pos/1.1.fir.kt @@ -1,6 +1,16 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-222 + * MAIN LINK: expressions, jump-expressions, return-expressions -> paragraph 1 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: + * HELPERS: checkType + */ + // TESTCASE NUMBER: 1 fun case1() { val x = fooCase1() diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/return-expressions/p-4/neg/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/return-expressions/p-4/neg/1.1.fir.kt index beddc179020..e955f885d31 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/return-expressions/p-4/neg/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/return-expressions/p-4/neg/1.1.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-313 + * MAIN LINK: expressions, jump-expressions, return-expressions -> paragraph 4 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: check returning is not allowed from run{...} + */ + // TESTCASE NUMBER: 1 // UNEXPECTED BEHAVIOUR // ISSUES : KT-35545 diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/logical-conjunction-expression/p-2/neg/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/logical-conjunction-expression/p-2/neg/1.1.fir.kt index 815121358e0..d41b1790e4d 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/logical-conjunction-expression/p-2/neg/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/logical-conjunction-expression/p-2/neg/1.1.fir.kt @@ -1,6 +1,17 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-313 + * MAIN LINK: expressions, logical-conjunction-expression -> paragraph 2 -> sentence 1 + * PRIMARY LINKS: expressions, logical-conjunction-expression -> paragraph 2 -> sentence 2 + * NUMBER: 1 + * DESCRIPTION: Both operands of a logical conjunction expression must have a type which is a subtype of kotlin.Boolean + * HELPERS: checkType + */ + // MODULE: libModule // FILE: libModule/JavaClass.java package libModule; diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/logical-conjunction-expression/p-2/pos/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/logical-conjunction-expression/p-2/pos/1.1.fir.kt index 1f4eb04e27c..e2b7cff04de 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/logical-conjunction-expression/p-2/pos/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/logical-conjunction-expression/p-2/pos/1.1.fir.kt @@ -1,6 +1,17 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-313 + * MAIN LINK: expressions, logical-conjunction-expression -> paragraph 2 -> sentence 1 + * PRIMARY LINKS: expressions, logical-conjunction-expression -> paragraph 2 -> sentence 2 + * NUMBER: 1 + * DESCRIPTION: Both operands of a logical conjunction expression must have a type which is a subtype of kotlin.Boolean + * HELPERS: checkType + */ + // MODULE: libModule // FILE: libModule/JavaClass.java package libModule; diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/logical-disjunction-expression/p-2/neg/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/logical-disjunction-expression/p-2/neg/1.1.fir.kt index a0c31733d9f..a3c5d7cd2c4 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/logical-disjunction-expression/p-2/neg/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/logical-disjunction-expression/p-2/neg/1.1.fir.kt @@ -1,6 +1,17 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-313 + * MAIN LINK: expressions, logical-disjunction-expression -> paragraph 2 -> sentence 1 + * PRIMARY LINKS: expressions, logical-disjunction-expression -> paragraph 2 -> sentence 2 + * NUMBER: 1 + * DESCRIPTION: Both operands of a logical disjunction expression must have a type which is a subtype of kotlin.Boolean, otherwise it is a type error. + * HELPERS: checkType + */ + // MODULE: libModule // FILE: libModule/JavaClass.java package libModule; diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/logical-disjunction-expression/p-2/pos/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/logical-disjunction-expression/p-2/pos/1.1.fir.kt index 730fdc3fac1..bda9d0b59f4 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/logical-disjunction-expression/p-2/pos/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/logical-disjunction-expression/p-2/pos/1.1.fir.kt @@ -1,6 +1,17 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-313 + * MAIN LINK: expressions, logical-disjunction-expression -> paragraph 2 -> sentence 1 + * PRIMARY LINKS: expressions, logical-disjunction-expression -> paragraph 2 -> sentence 2 + * NUMBER: 1 + * DESCRIPTION:Both operands of a logical disjunction expression must have a type which is a subtype of kotlin.Boolean + * HELPERS: checkType + */ + // MODULE: libModule // FILE: libModule/JavaClass.java package libModule; diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/multiplicative-expression/p-5/pos/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/multiplicative-expression/p-5/pos/1.1.fir.kt index 56506a7ca0b..4fb39f11bb1 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/multiplicative-expression/p-5/pos/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/multiplicative-expression/p-5/pos/1.1.fir.kt @@ -1,6 +1,16 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-218 + * MAIN LINK: expressions, multiplicative-expression -> paragraph 5 -> sentence 1 + * PRIMARY LINKS: expressions, multiplicative-expression -> paragraph 5 -> sentence 2 + * NUMBER: 1 + * DESCRIPTION: The return type of these functions is not restricted. + * HELPERS: checkType + */ // TESTCASE NUMBER: 1 class Case1(var a: Int) { operator fun times(o: Int): Any? { TODO() } diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/not-null-assertion-expression/p-2/pos/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/not-null-assertion-expression/p-2/pos/1.1.fir.kt deleted file mode 100644 index b74a07af4a5..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/not-null-assertion-expression/p-2/pos/1.1.fir.kt +++ /dev/null @@ -1,44 +0,0 @@ -// !DIAGNOSTICS: -UNREACHABLE_CODE -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -// SKIP_TXT - -// MODULE: libModule -// FILE: libModule/JavaClass.java -package libModule; - -public class JavaClass { - public static final boolean FALSE = false; - public static int obj = 5; -} - - -// MODULE: mainModule(libModule) -// FILE: KotlinClass.kt -package mainModule -import libModule.* - - -// TESTCASE NUMBER: 1 -fun case1() { - val res = JavaClass.FALSE!! -} - -// TESTCASE NUMBER: 2 -fun case2() { - val x = JavaClass.obj!! -} - -// TESTCASE NUMBER: 3 -fun case3() { - val a = false - val x = a!! -} - -// TESTCASE NUMBER: 4 -fun case4() { - val x = "weds"!! -} - -// TESTCASE NUMBER: 5 -fun case5(nothing: Nothing) { - val y = nothing!! -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/not-null-assertion-expression/p-2/pos/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/not-null-assertion-expression/p-2/pos/1.1.kt index 2451e931eb9..db8a75959a9 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/not-null-assertion-expression/p-2/pos/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/not-null-assertion-expression/p-2/pos/1.1.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNREACHABLE_CODE -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/not-null-assertion-expression/p-3/pos/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/not-null-assertion-expression/p-3/pos/1.1.fir.kt index a44ddf9c01e..647b2b5b65f 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/not-null-assertion-expression/p-3/pos/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/not-null-assertion-expression/p-3/pos/1.1.fir.kt @@ -1,6 +1,17 @@ // !DIAGNOSTICS: -UNREACHABLE_CODE -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-296 + * MAIN LINK: expressions, not-null-assertion-expression -> paragraph 3 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: The type of non-null assertion e!! expression is the non-nullable variant of the type of e. + * HELPERS: checkType + */ + + // MODULE: libModule // FILE: libModule/JavaClass.java package libModule; diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/prefix-expressions/prefix-decrement-expression/p-4/neg/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/prefix-expressions/prefix-decrement-expression/p-4/neg/1.1.fir.kt index 5d8c5b742c0..46d6a2600ec 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/prefix-expressions/prefix-decrement-expression/p-4/neg/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/prefix-expressions/prefix-decrement-expression/p-4/neg/1.1.fir.kt @@ -1,14 +1,15 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT -class A() { - var i = 0 - - operator fun dec(): A { - this.i-- - return this - } -} +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-213 + * MAIN LINK: expressions, prefix-expressions, prefix-decrement-expression -> paragraph 4 -> sentence 1 + * PRIMARY LINKS: statements, assignments -> paragraph 3 -> sentence 2 + * NUMBER: 1 + * DESCRIPTION: check unsafe prefix decrement expression call for an assignable expression + */ // TESTCASE NUMBER: 1 @@ -22,6 +23,15 @@ class Case1() { var a: A = A() } +class A() { + var i = 0 + + operator fun dec(): A { + this.i-- + return this + } +} + // TESTCASE NUMBER: 2 fun case2() { @@ -30,5 +40,14 @@ fun case2() { } class Case2() { - val a = A() + val a = A2() } + +class A2() { + var i = 0 + + operator fun dec(): A2 { + this.i-- + return this + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/prefix-expressions/prefix-decrement-expression/p-4/neg/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/prefix-expressions/prefix-decrement-expression/p-4/neg/1.1.kt index 62a55cbaa08..fac43cd1b83 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/prefix-expressions/prefix-decrement-expression/p-4/neg/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/prefix-expressions/prefix-decrement-expression/p-4/neg/1.1.kt @@ -11,7 +11,6 @@ * DESCRIPTION: check unsafe prefix decrement expression call for an assignable expression */ - // TESTCASE NUMBER: 1 fun case1() { diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/prefix-expressions/prefix-decrement-expression/p-5/neg/2.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/prefix-expressions/prefix-decrement-expression/p-5/neg/2.1.fir.kt deleted file mode 100644 index e2e7cfb2846..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/prefix-expressions/prefix-decrement-expression/p-5/neg/2.1.fir.kt +++ /dev/null @@ -1,37 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -// SKIP_TXT - -// TESTCASE NUMBER: 1 - -fun case1() { - var a = Case1() - val res: Any? = ++a -} - - -class Case1() { - - operator fun inc(): B { - TODO() - } -} - -class B() {} - -// TESTCASE NUMBER: 2 - -fun case2() { - var a = Case2() - val res: Any? = ++a -} - -class Case2() : C() { - var i = 0 - - operator fun inc(): C { - TODO() - } - -} - -open class C() {} diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/prefix-expressions/prefix-decrement-expression/p-5/neg/2.1.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/prefix-expressions/prefix-decrement-expression/p-5/neg/2.1.kt index 6671f4e471e..1908763e2e3 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/prefix-expressions/prefix-decrement-expression/p-5/neg/2.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/prefix-expressions/prefix-decrement-expression/p-5/neg/2.1.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/prefix-expressions/prefix-increment-expression/p-4/neg/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/prefix-expressions/prefix-increment-expression/p-4/neg/1.1.fir.kt index 20dc17cd36a..5b00fe1a66f 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/prefix-expressions/prefix-increment-expression/p-4/neg/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/prefix-expressions/prefix-increment-expression/p-4/neg/1.1.fir.kt @@ -1,6 +1,20 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-213 + * MAIN LINK: expressions, prefix-expressions, prefix-increment-expression -> paragraph 4 -> sentence 1 + * PRIMARY LINKS: statements, assignments -> paragraph 3 -> sentence 2 + * NUMBER: 1 + * DESCRIPTION: check unsafe prefix increment expression call for an assignable expression + */ + +// FILE: TestCase1.kt +// TESTCASE NUMBER: 1 +package testPackCase1 + class A() { var i = 0 @@ -10,8 +24,6 @@ class A() { } } -// TESTCASE NUMBER: 1 - fun case1() { var b: Case1? = Case1() ++b?.a @@ -22,7 +34,18 @@ class Case1() { var a: A = A() } +// FILE: TestCase2.kt // TESTCASE NUMBER: 2 +package testPackCase2 + +class A() { + var i = 0 + + operator fun inc(): A { + this.i++ + return this + } +} fun case2() { var b= Case2() diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/prefix-expressions/prefix-increment-expression/p-4/neg/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/prefix-expressions/prefix-increment-expression/p-4/neg/1.1.kt index 5982e4dd3fa..81078068f75 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/prefix-expressions/prefix-increment-expression/p-4/neg/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/prefix-expressions/prefix-increment-expression/p-4/neg/1.1.kt @@ -11,7 +11,6 @@ * DESCRIPTION: check unsafe prefix increment expression call for an assignable expression */ - // FILE: TestCase1.kt // TESTCASE NUMBER: 1 package testPackCase1 @@ -55,4 +54,4 @@ fun case2() { class Case2() { val a = A() -} \ No newline at end of file +} diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/range-expression/p-4/pos/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/range-expression/p-4/pos/1.1.fir.kt index 60b96479622..2b38563962e 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/range-expression/p-4/pos/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/range-expression/p-4/pos/1.1.fir.kt @@ -1,6 +1,18 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-218 + * MAIN LINK: expressions, range-expression -> paragraph 4 -> sentence 1 + * PRIMARY LINKS: expressions, range-expression -> paragraph 4 -> sentence 2 + * NUMBER: 1 + * DESCRIPTION: The return type of range operator is not restricted. + * HELPERS: checkType + */ + + // TESTCASE NUMBER: 1 class Case1() { operator fun rangeTo(o: Case1): Nothing?{ diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/neg/3.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/neg/3.1.fir.kt index 991f106d4f4..a07a50d6db3 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/neg/3.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/neg/3.1.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-218 + * MAIN LINK: expressions, try-expression -> paragraph 1 -> sentence 3 + * PRIMARY LINKS: expressions, try-expression -> paragraph 1 -> sentence 2 + * NUMBER: 1 + * DESCRIPTION: try-expression has to start with a try body and continue with zero ore more catch blocks + */ fun throwException(): Nothing = throw Exception() class ExcA() : Exception() diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/neg/4.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/neg/4.1.fir.kt index a44b4637590..5163a394135 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/neg/4.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/neg/4.1.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-218 + * MAIN LINK: expressions, try-expression -> paragraph 1 -> sentence 4 + * PRIMARY LINKS: expressions, try-expression -> paragraph 1 -> sentence 2 + * NUMBER: 1 + * DESCRIPTION: try-expression has to start with a try body, catch blocks and finally block + */ fun throwException(): Nothing = throw Exception() class ExcA() : Exception() diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/pos/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/pos/1.1.fir.kt index 478b5ca20a0..f4143af00e7 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/pos/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/pos/1.1.fir.kt @@ -1,6 +1,16 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-218 + * MAIN LINK:expressions, try-expression -> paragraph 1 -> sentence 1 + * PRIMARY LINKS: expressions, try-expression -> paragraph 1 -> sentence 2 + * expressions, try-expression -> paragraph 1 -> sentence 5 + * NUMBER: 1 + * DESCRIPTION: try-expression has to start with a try body + */ fun throwException(): Nothing = throw Exception() diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-2/pos/2.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-2/pos/2.1.fir.kt index 2092f4e0b11..9364814720e 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-2/pos/2.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-2/pos/2.1.fir.kt @@ -1,5 +1,16 @@ // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-218 + * MAIN LINK: expressions, try-expression -> paragraph 2 -> sentence 2 + * PRIMARY LINKS: expressions, try-expression -> paragraph 2 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: catch block is evaluated immediately after the exception is thrown and the exception itself is passed inside the catch block as the corresponding parameter. + */ + + // TESTCASE NUMBER: 1 fun case1() { diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-5/pos/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-5/pos/1.1.fir.kt index 689fb0d7e20..a43db946a47 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-5/pos/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-5/pos/1.1.fir.kt @@ -1,6 +1,16 @@ // !DIAGNOSTICS: -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-218 + * MAIN LINK: expressions, try-expression -> paragraph 5 -> sentence 1 + * PRIMARY LINKS: expressions, try-expression -> paragraph 4 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: If no exception is thrown during the evaluation of the try body, no catch blocks are executed, the finally block is evaluated after the try body, and the program execution continues as normal. + */ + // TESTCASE NUMBER: 1 fun case1(): String { diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-5/pos/2.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-5/pos/2.1.fir.kt index f74196daafc..c449d8e1f47 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-5/pos/2.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-5/pos/2.1.fir.kt @@ -1,6 +1,16 @@ // !DIAGNOSTICS: -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-218 + * MAIN LINK: expressions, try-expression -> paragraph 5 -> sentence 2 + * PRIMARY LINKS: expressions, try-expression -> paragraph 4 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: If an exception was thrown, but no catch block matched its type, the finally block is evaluated before propagating the exception up the call stack. + */ + /* * TESTCASE NUMBER: 1 * UNEXPECTED BEHAVIOUR diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-8/neg/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-8/neg/1.1.fir.kt index 2d2fde14181..e7649d225b5 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-8/neg/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-8/neg/1.1.fir.kt @@ -1,16 +1,31 @@ // !DIAGNOSTICS: -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_VARIABLE -UNUSED_PARAMETER -FINAL_UPPER_BOUND // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-296 + * MAIN LINK: expressions, try-expression -> paragraph 8 -> sentence 1 + * PRIMARY LINKS: expressions, try-expression -> paragraph 9 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: The type of the try-expression is the least upper bound of the types of the last expressions of the try body and the last expressions of all the catch blocks + */ + +// FILE: TestCase1.kt +// TESTCASE NUMBER: 1 +package testPackCase1 + fun throwExceptionA(b: Boolean) = run { if (b) throw ExcA() } +class ExcA() : Exception() +class ExcB() : Exception() + open class A(var data: T) { fun foo(d: A) {} } class B(data: T) : A(data) -// TESTCASE NUMBER: 1 - fun case1() { val tryVal: B = try { @@ -19,11 +34,24 @@ fun case1() { } catch (e: Exception) { B("") } - - } +// FILE: TestCase2.kt // TESTCASE NUMBER: 2 +package testPackCase2 + +fun throwExceptionA(b: Boolean) = run { if (b) throw ExcA() } + +class ExcA() : Exception() +class ExcB() : Exception() + +open class A(var data: T) { + fun foo(d: A) {} +} + +class B(data: T) : A(data) + + fun case2() { val tryVal: A = @@ -35,11 +63,20 @@ fun case2() { } } -/* - * TESTCASE NUMBER: 3 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-35494 - */ + +// FILE: TestCase3.kt +// TESTCASE NUMBER: 3 +// ISSUES: KT-35494 +package testPackCase3 + +fun throwExceptionA(b: Boolean) = run { if (b) throw ExcA() } + +open class A(var data: T) { + fun foo(d: A) {} +} + +class B(data: T) : A(data) + fun case3() { val tryVal: A = try { diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-8/neg/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-8/neg/1.1.kt index 0a9758e8301..c60a6fcfdf1 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-8/neg/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-8/neg/1.1.kt @@ -26,7 +26,6 @@ open class A(var data: T) { class B(data: T) : A(data) - fun case1() { val tryVal: B = try { diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/exhaustive-when-expressions/p-2/pos/1.3.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/exhaustive-when-expressions/p-2/pos/1.3.fir.kt index 18bc60d3021..d32834fa2a8 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/exhaustive-when-expressions/p-2/pos/1.3.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/exhaustive-when-expressions/p-2/pos/1.3.fir.kt @@ -1,5 +1,15 @@ // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-100 + * MAIN LINK: expressions, when-expression, exhaustive-when-expressions -> paragraph 2 -> sentence 1 + * NUMBER: 3 + * DESCRIPTION: Exhaustive when, with bound value (sealed, enum, boolean), with redundant else branch. + * HELPERS: enumClasses, sealedClasses + */ + // TESTCASE NUMBER: 1 fun case_1(value_1: EnumClass): String = when (value_1) { EnumClass.EAST -> "" diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/exhaustive-when-expressions/p-2/pos/11.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/exhaustive-when-expressions/p-2/pos/11.1.fir.kt deleted file mode 100644 index d3199791b40..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/exhaustive-when-expressions/p-2/pos/11.1.fir.kt +++ /dev/null @@ -1,18 +0,0 @@ -// SKIP_TXT - -/* - * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - * - * SPEC VERSION: 0.1-435 - * MAIN LINK: expressions, when-expression, exhaustive-when-expressions -> paragraph 2 -> sentence 11 - * NUMBER: 1 - * DESCRIPTION: Exhaustive when using nullable boolean values. - */ - -// TESTCASE NUMBER: 1 -fun case_1(value_1: Boolean?): String = when (value_1) { - true -> "" - false -> "" - null -> "" -} - diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/exhaustive-when-expressions/p-2/pos/11.1.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/exhaustive-when-expressions/p-2/pos/11.1.kt index a4a043260b4..1f2d190d9e9 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/exhaustive-when-expressions/p-2/pos/11.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/exhaustive-when-expressions/p-2/pos/11.1.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // SKIP_TXT // LANGUAGE: -ProhibitSimplificationOfNonTrivialConstBooleanExpressions diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/exhaustive-when-expressions/p-2/pos/11.3.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/exhaustive-when-expressions/p-2/pos/11.3.fir.kt index 8c829c3a324..84dd4ef5564 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/exhaustive-when-expressions/p-2/pos/11.3.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/exhaustive-when-expressions/p-2/pos/11.3.fir.kt @@ -1,5 +1,14 @@ // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-435 + * MAIN LINK: expressions, when-expression, exhaustive-when-expressions -> paragraph 2 -> sentence 11 + * NUMBER: 3 + * DESCRIPTION: Exhaustive when using subclasses of the nullable sealed class. + * HELPERS: sealedClasses + */ // TESTCASE NUMBER: 1 fun case_1(value_1: SealedClass?): Int = when (value_1) { diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/exhaustive-when-expressions/p-2/pos/3.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/exhaustive-when-expressions/p-2/pos/3.1.fir.kt deleted file mode 100644 index 2d04aa7ff2a..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/exhaustive-when-expressions/p-2/pos/3.1.fir.kt +++ /dev/null @@ -1,17 +0,0 @@ -// SKIP_TXT - -/* - * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - * - * SPEC VERSION: 0.1-100 - * MAIN LINK: expressions, when-expression, exhaustive-when-expressions -> paragraph 2 -> sentence 3 - * NUMBER: 1 - * DESCRIPTION: Exhaustive when using boolean values. - */ - -// TESTCASE NUMBER: 1 -fun case_1(value_1: Boolean): String = when (value_1) { - true -> "" - false -> "" -} - diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/exhaustive-when-expressions/p-2/pos/3.1.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/exhaustive-when-expressions/p-2/pos/3.1.kt index 3e4cda55e96..467234ace3c 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/exhaustive-when-expressions/p-2/pos/3.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/exhaustive-when-expressions/p-2/pos/3.1.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // SKIP_TXT // LANGUAGE: -ProhibitSimplificationOfNonTrivialConstBooleanExpressions diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/exhaustive-when-expressions/p-2/pos/7.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/exhaustive-when-expressions/p-2/pos/7.1.fir.kt index 94eb7910223..4e728ea11aa 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/exhaustive-when-expressions/p-2/pos/7.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/exhaustive-when-expressions/p-2/pos/7.1.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-435 + * MAIN LINK: expressions, when-expression, exhaustive-when-expressions -> paragraph 2 -> sentence 7 + * NUMBER: 1 + * DESCRIPTION: Exhaustive when using subclasses of the sealed class. + * HELPERS: sealedClasses + */ // TESTCASE NUMBER: 1 fun case_1(value_1: SealedClass): Int = when (value_1) { diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-1/pos/3.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-1/pos/3.1.fir.kt index cff477f9e55..a8ab9841c33 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-1/pos/3.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-1/pos/3.1.fir.kt @@ -1,5 +1,14 @@ // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-100 + * MAIN LINK: expressions, when-expression -> paragraph 1 -> sentence 3 + * NUMBER: 1 + * DESCRIPTION: Empty when with bound value. + */ + // TESTCASE NUMBER: 1 fun case_1(value_1: Int) { when (value_1) {} diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-2/neg/2.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-2/neg/2.1.fir.kt index 36d510000d8..7a82c1cb125 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-2/neg/2.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-2/neg/2.1.fir.kt @@ -1,5 +1,15 @@ // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-100 + * MAIN LINK: expressions, when-expression -> paragraph 2 -> sentence 2 + * NUMBER: 1 + * DESCRIPTION: When with non-boolean value in the when condition. + * HELPERS: typesProvider + */ + // TESTCASE NUMBER: 1 fun case_1(value_1: Int, value_2: String, value_3: TypesProvider): String { when { diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-2/neg/2.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-2/neg/2.2.fir.kt index d21e26e8aa5..36759aae17d 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-2/neg/2.2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-2/neg/2.2.fir.kt @@ -1,5 +1,15 @@ // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-100 + * MAIN LINK: expressions, when-expression -> paragraph 2 -> sentence 2 + * NUMBER: 2 + * DESCRIPTION: When without bound value, forbidden comma in the when condition. + * HELPERS: typesProvider, classes + */ + // TESTCASE NUMBER: 1 fun case_1(value_1: TypesProvider) { when { diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-2/neg/2.2.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-2/neg/2.2.kt index 0230f016946..689843c9cf7 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-2/neg/2.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-2/neg/2.2.kt @@ -13,8 +13,8 @@ // TESTCASE NUMBER: 1 fun case_1(value_1: TypesProvider) { when { - getBoolean(), value_1.getBoolean() -> return - value_1.getBoolean() && getBoolean(), getLong() == 1000L -> return + getBoolean(), value_1.getBoolean() -> return + value_1.getBoolean() && getBoolean(), getLong() == 1000L -> return Out(), getLong(), {}, Any(), throw Exception() -> return } diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-2/pos/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-2/pos/1.1.fir.kt index e816658a58d..bfd1ddfa0a3 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-2/pos/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-2/pos/1.1.fir.kt @@ -1,6 +1,17 @@ +// LANGUAGE: +WarnAboutNonExhaustiveWhenOnAlgebraicTypes // !DIAGNOSTICS: -UNUSED_EXPRESSION -DEBUG_INFO_SMARTCAST // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-100 + * MAIN LINK: expressions, when-expression -> paragraph 2 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: When without bound value, various expressions in the control structure body. + * HELPERS: typesProvider, classes, functions + */ + // TESTCASE NUMBER: 1 fun case_1(value_1: Int) { when { @@ -60,11 +71,14 @@ fun case_5(value_1: Int, value_2: Int, value_3: Boolean?) { false -> "2" null -> "3" } - value_1 == 5 -> when (value_3) { + value_1 == 5 -> when (value_3) { true -> "1" false -> "2" + else -> "" + } + value_1 == 6 -> when (value_3) { + else -> "" } - value_1 == 6 -> when (value_3) {} } } @@ -108,7 +122,6 @@ fun case_8(value_1: Int, value_2: Int) = when { /* * TESTCASE NUMBER: 9 - * UNEXPECTED BEHAVIOUR * ISSUES: KT-37249 */ fun case_9(value_1: Int, value_2: String, value_3: String) = when { diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-2/pos/1.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-2/pos/1.2.fir.kt index 5c22fa8a9c3..b41828127b7 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-2/pos/1.2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-2/pos/1.2.fir.kt @@ -1,5 +1,14 @@ // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-100 + * MAIN LINK: expressions, when-expression -> paragraph 2 -> sentence 1 + * NUMBER: 2 + * DESCRIPTION: Allowed break and continue in the control structure body of when. + */ + // TESTCASE NUMBER: 1 fun case_1(value_1: Int): String { while (true) { diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-2/pos/2.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-2/pos/2.1.fir.kt index 61813107bac..2647f5bfff6 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-2/pos/2.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-2/pos/2.1.fir.kt @@ -1,5 +1,15 @@ // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-100 + * MAIN LINK: expressions, when-expression -> paragraph 2 -> sentence 2 + * NUMBER: 1 + * DESCRIPTION: When without bound value, various boolean values in the when condition. + * HELPERS: typesProvider, enumClasses, sealedClasses, classes + */ + // TESTCASE NUMBER: 1 fun case_1(value_1: Boolean, value_2: Long): Int { return when { diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-2/pos/2.3.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-2/pos/2.3.fir.kt index 48d326691e9..cc335673230 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-2/pos/2.3.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-2/pos/2.3.fir.kt @@ -1,5 +1,17 @@ // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-100 + * MAIN LINK: expressions, when-expression -> paragraph 2 -> sentence 2 + * NUMBER: 3 + * DESCRIPTION: 'When' without bound value and with Nothing in condition (subtype of Boolean). + * DISCUSSION + * ISSUES: KT-25948 + * HELPERS: typesProvider + */ + // TESTCASE NUMBER: 1 fun case_1(value_1: TypesProvider) { when { diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-3/neg/2.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-3/neg/2.1.fir.kt index 6ad632b1948..4025e6d8bd8 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-3/neg/2.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-3/neg/2.1.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-218 + * MAIN LINK: expressions, when-expression -> paragraph 3 -> sentence 2 + * NUMBER: 1 + * DESCRIPTION: The else condition must also be in the last when entry of when expression, otherwise it is a compile-time error + */ + // FILE: JavaEnum.java enum JavaEnum { Val_1, diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-4/neg/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-4/neg/1.1.fir.kt deleted file mode 100644 index d5813d11d74..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-4/neg/1.1.fir.kt +++ /dev/null @@ -1,68 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -// SKIP_TXT -// FULL_JDK - -/* - * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) - * - * SPEC VERSION: 0.1-313 - * MAIN LINK: expressions, when-expression -> paragraph 4 -> sentence 1 - * NUMBER: 1 - * DESCRIPTION: it is possible to replace the else condition with an always-true condition - */ - -// FILE: JavaEnum.java - -enum JavaEnum { - Val_1, - Val_2, -} - -// FILE: KotlinClass.kt - -// TESTCASE NUMBER: 1 -fun case1() { - val z = JavaEnum.Val_1 - val when2 = when (z) { - JavaEnum.Val_1 -> { } - JavaEnum.Val_1 -> { } - } - -} - -// TESTCASE NUMBER: 2 - -fun case2() { - val b = false - val when2: Any = when (b) { - false -> { } - false -> { } - } -} - -// TESTCASE NUMBER: 3 - -fun case3() { - val a = false - val when2: Any = when (a) { - true -> { } - true -> { } - } -} - -// TESTCASE NUMBER: 4 - -fun case4() { - val x: SClass = SClass.B() - val when2 = when (x){ - is SClass.A ->{ } - is SClass.B ->{ } - is SClass.B ->{ } - } -} - -sealed class SClass { - class A : SClass() - class B : SClass() - class C : SClass() -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-4/neg/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-4/neg/1.1.kt index 72a33276c38..e33647bc41a 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-4/neg/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-4/neg/1.1.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !LANGUAGE: +ProhibitSimplificationOfNonTrivialConstBooleanExpressions // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-4/pos/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-4/pos/1.1.fir.kt index 6e08d9702b7..e19d4f2400e 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-4/pos/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-4/pos/1.1.fir.kt @@ -1,3 +1,4 @@ +// !LANGUAGE: -ProhibitSimplificationOfNonTrivialConstBooleanExpressions // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT // FULL_JDK diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-5/neg/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-5/neg/1.1.fir.kt index 838fb981492..1f2aad68466 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-5/neg/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-5/neg/1.1.fir.kt @@ -1,6 +1,16 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-313 + * MAIN LINK: expressions, when-expression -> paragraph 5 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: 'When' with bound value and with different variants of expressions in the control structure body. + * HELPERS: typesProvider, classes, functions + */ + // TESTCASE NUMBER: 5 fun case_5(value_1: Int, value_2: Int, value_3: Boolean?) { when (value_1) { diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-5/pos/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-5/pos/1.1.fir.kt index 74e3561d2a6..948427291be 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-5/pos/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-5/pos/1.1.fir.kt @@ -1,6 +1,17 @@ +// LANGUAGE: +WarnAboutNonExhaustiveWhenOnAlgebraicTypes // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-313 + * MAIN LINK: expressions, when-expression -> paragraph 5 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: 'When' with bound value and with different variants of expressions in the control structure body. + * HELPERS: typesProvider, classes, functions + */ + // TESTCASE NUMBER: 1 fun case_1(value_1: Int) { when (value_1) { @@ -46,8 +57,12 @@ fun case_4(value_1: Int, value_2: String, value_3: String) { // TESTCASE NUMBER: 5 fun case_5(value_1: Int, value_2: Int, value_3: Boolean?) { when (value_1) { - 1 -> "3" - 2 -> "" + 1 -> when (value_3) { + else -> "3" + } + 2 -> when (value_3) { + else -> "" + } 3 -> when (value_3) { else -> "" } @@ -55,7 +70,6 @@ fun case_5(value_1: Int, value_2: Int, value_3: Boolean?) { true -> "1" false -> "2" null -> "3" - else -> "" } 5 -> when (value_3) { true -> "1" @@ -70,7 +84,9 @@ fun case_5(value_1: Int, value_2: Int, value_3: Boolean?) { // TESTCASE NUMBER: 6 fun case_6(value_1: Int, value_2: Int, value_3: Boolean?) = when (value_1) { - 1 -> 3 + 1 -> when (value_3) { + else -> 3 + } else -> when (value_3) { true -> 1 false -> 2 @@ -104,7 +120,6 @@ fun case_8(value_1: Int, value_2: Int) = when (value_1) { /* * TESTCASE NUMBER: 9 - * UNEXPECTED BEHAVIOUR * ISSUES: KT-37249 */ fun case_9(value_1: Int, value_2: String, value_3: String): Any { diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-5/pos/1.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-5/pos/1.2.fir.kt index 869a7858f43..62dbba523d1 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-5/pos/1.2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-5/pos/1.2.fir.kt @@ -1,5 +1,14 @@ // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-313 + * MAIN LINK: expressions, when-expression -> paragraph 5 -> sentence 1 + * NUMBER: 2 + * DESCRIPTION: 'When' with bound value and allowed break and continue expression (without labels) in the control structure body. + */ + // TESTCASE NUMBER: 1 fun case_1(value_1: Int): Int { while (true) { diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/neg/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/neg/1.1.fir.kt deleted file mode 100644 index 8234e962ff6..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/neg/1.1.fir.kt +++ /dev/null @@ -1,28 +0,0 @@ -// SKIP_TXT - -// TESTCASE NUMBER: 1 -fun case_1(value_1: Any): String { - when (value_1) { - EmptyClass -> return "" - } - - return "" -} - -// TESTCASE NUMBER: 2 -fun case_2(value_1: Any): String { - when (value_1) { - Any -> return "" - } - - return "" -} - -// TESTCASE NUMBER: 3 -fun case_3(value_1: Any): String { - when (value_1) { - Nothing -> return "" - } - - return "" -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/neg/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/neg/1.1.kt index 92972e18420..5c74e6b545d 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/neg/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/neg/1.1.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // SKIP_TXT /* diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/neg/1.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/neg/1.2.fir.kt index 0fb4613719c..63aecf1c4b0 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/neg/1.2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/neg/1.2.fir.kt @@ -1,5 +1,15 @@ // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-296 + * MAIN LINK: expressions, when-expression -> paragraph 6 -> sentence 1 + * NUMBER: 2 + * DESCRIPTION: 'When' with bound value and type test condition on the non-type operand of the type checking operator. + * HELPERS: classes + */ + // TESTCASE NUMBER: 1 fun case_1(value_1: Any, value_2: Int): String { when (value_1) { diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/neg/3.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/neg/3.1.fir.kt deleted file mode 100644 index 8ceb2af57ba..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/neg/3.1.fir.kt +++ /dev/null @@ -1,11 +0,0 @@ -// SKIP_TXT - -// TESTCASE NUMBER: 1 -fun case_1(value_1: Int, value_2: TypesProvider): String { - when (value_1) { - -1000L..100 -> return "" - value_2.getInt()..getLong() -> return "" - } - - return "" -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/neg/3.1.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/neg/3.1.kt index 1fb5a21d30b..a1a0bda1e9e 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/neg/3.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/neg/3.1.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // SKIP_TXT /* diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/neg/3.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/neg/3.2.fir.kt index eac297ce352..ca331d82b42 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/neg/3.2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/neg/3.2.fir.kt @@ -1,6 +1,16 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-296 + * MAIN LINK: expressions, when-expression -> paragraph 6 -> sentence 3 + * NUMBER: 2 + * DESCRIPTION: 'When' with bound value and 'when condition' with contains operator and type without defined contains operator. + * HELPERS: classes + */ + // TESTCASE NUMBER: 1 fun case_1(value_1: Int, value_2: EmptyClass, value_3: Int, value_4: Any): String { when (value_1) { diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/neg/5.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/neg/5.1.fir.kt deleted file mode 100644 index df41b84a999..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/neg/5.1.fir.kt +++ /dev/null @@ -1,13 +0,0 @@ -// SKIP_TXT - -// TESTCASE NUMBER: 3 -fun case_3(value_1: Boolean, value_2: Boolean, value_3: Long) { - when (value_1) { - value_2 -> {} - !value_2 -> {} - getBoolean() && value_2 -> {} - getChar() != 'a' -> {} - getList() === getAny() -> {} - value_3 <= 11 -> {} - } -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/neg/5.1.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/neg/5.1.kt index 09bb012aaf9..f73ea9833bd 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/neg/5.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/neg/5.1.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // SKIP_TXT /* diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/neg/7.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/neg/7.1.fir.kt index 6294d3fd8a4..2310f8097db 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/neg/7.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/neg/7.1.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-313 + * MAIN LINK: expressions, when-expression -> paragraph 6 -> sentence 7 + * NUMBER: 1 + * DESCRIPTION: 'When' with bound value and with else branch not in the last position. + */ + // TESTCASE NUMBER: 1 fun case_1(value_1: Int): String = when (value_1) { else -> "" diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/neg/7.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/neg/7.2.fir.kt index 542f8be4df0..062db0a6aee 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/neg/7.2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/neg/7.2.fir.kt @@ -1,5 +1,13 @@ // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-435 + * MAIN LINK: expressions, when-expression -> paragraph 6 -> sentence 7 + * NUMBER: 2 + * DESCRIPTION: 'When' without bound value and with 'else' branch not in the last position. + */ // TESTCASE NUMBER: 1 fun case_1(value_1: Int): String = when { diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/pos/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/pos/1.1.fir.kt index 738eb1f2cb7..862a98f7241 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/pos/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/pos/1.1.fir.kt @@ -1,5 +1,15 @@ // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-296 + * MAIN LINK: expressions, when-expression -> paragraph 6 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: 'When' with bound value and type test condition. + * HELPERS: classes, objects + */ + // TESTCASE NUMBER: 1 fun case_1(value_1: Any): String { when (value_1) { diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/pos/1.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/pos/1.2.fir.kt index 42086c467b8..dbbace2a795 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/pos/1.2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/pos/1.2.fir.kt @@ -1,5 +1,16 @@ +// LANGUAGE: +WarnAboutNonExhaustiveWhenOnAlgebraicTypes // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-296 + * MAIN LINK: expressions, when-expression -> paragraph 6 -> sentence 1 + * NUMBER: 2 + * DESCRIPTION: 'When' with bound value and type test condition (invert type checking operator). + * HELPERS: classes, sealedClasses, objects + */ + // TESTCASE NUMBER: 1 fun case_1(value_1: SealedClass) = when (value_1) { !is SealedChild1 -> {} @@ -34,6 +45,7 @@ fun case_4(value_1: SealedClass?) { when (value_1) { !is SealedChild2 -> {} // including null is SealedChild2? -> {} // redundant nullable type check + else -> {} } } diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/pos/1.3.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/pos/1.3.fir.kt index a4137b9fdd5..9c5fc20e698 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/pos/1.3.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/pos/1.3.fir.kt @@ -1,5 +1,15 @@ // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-296 + * MAIN LINK: expressions, when-expression -> paragraph 6 -> sentence 1 + * NUMBER: 3 + * DESCRIPTION: 'When' with bound value and enumaration of type test conditions. + * HELPERS: classes, sealedClasses, objects + */ + // TESTCASE NUMBER: 1 fun case_1(value_1: Any) = when (value_1) { is Int -> {} diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/pos/1.4.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/pos/1.4.fir.kt index cea1d73a122..f1d72961711 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/pos/1.4.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/pos/1.4.fir.kt @@ -1,5 +1,15 @@ // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-296 + * MAIN LINK: expressions, when-expression -> paragraph 6 -> sentence 1 + * NUMBER: 4 + * DESCRIPTION: 'When' with bound value and enumaration of type test conditions (with invert type checking operator). + * HELPERS: sealedClasses + */ + // TESTCASE NUMBER: 1 fun case_1(value_1: SealedClass): String = when (value_1) { is SealedChild1, !is SealedChild3 -> "" diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/pos/5.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/pos/5.1.fir.kt index 158c5d90262..fd17627d9c9 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/pos/5.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/pos/5.1.fir.kt @@ -1,5 +1,15 @@ +// LANGUAGE: +WarnAboutNonExhaustiveWhenOnAlgebraicTypes // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-435 + * MAIN LINK: expressions, when-expression -> paragraph 6 -> sentence 5 + * NUMBER: 1 + * DESCRIPTION: 'When' with enumeration of the different variants of expressions in 'when condition'. + * HELPERS: typesProvider, classes, functions + */ // TESTCASE NUMBER: 1 fun case_1(value_1: Any?) { @@ -24,9 +34,10 @@ fun case_2(value_1: Number, value_2: Int) { // TESTCASE NUMBER: 3 fun case_3(value_1: Boolean, value_2: Boolean, value_3: Long) { - when (value_1) { + when (value_1) { value_2 -> {} !value_2 -> {} + else -> {} } } diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/pos/5.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/pos/5.2.fir.kt index 39c07ac0443..f8d934e4232 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/pos/5.2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/pos/5.2.fir.kt @@ -1,5 +1,15 @@ +// LANGUAGE: +WarnAboutNonExhaustiveWhenOnAlgebraicTypes // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-435 + * MAIN LINK: expressions, when-expression -> paragraph 6 -> sentence 5 + * NUMBER: 2 + * DESCRIPTION: 'When' with different variants of the arithmetic expressions (additive expression and multiplicative expression) in 'when condition'. + * HELPERS: typesProvider, classes, functions + */ // TESTCASE NUMBER: 1 fun case_1(value_1: Any?) { diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/pos/6.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/pos/6.1.fir.kt index eb371fc5811..72c1b190d73 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/pos/6.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/pos/6.1.fir.kt @@ -1,5 +1,13 @@ // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-435 + * MAIN LINK: expressions, when-expression -> paragraph 6 -> sentence 6 + * NUMBER: 1 + * DESCRIPTION: 'When' with bound value and not allowed break and continue expression (without labels) in 'when condition'. + */ // TESTCASE NUMBER: 1 fun case_1(value_1: Int): String { diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/call-with-an-explicit-type-receiver/p-3/pos/2.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/call-with-an-explicit-type-receiver/p-3/pos/2.1.fir.kt index 6e4b1c6b827..d9941fafdec 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/call-with-an-explicit-type-receiver/p-3/pos/2.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/call-with-an-explicit-type-receiver/p-3/pos/2.1.fir.kt @@ -1,6 +1,14 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-401 + * MAIN LINK: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver, call-with-an-explicit-type-receiver -> paragraph 3 -> sentence 2 + * NUMBER: 1 + * DESCRIPTION: + */ /* * TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/1.1.fir.kt index 077d9ab227c..88ec81a919e 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/1.1.fir.kt @@ -1,6 +1,20 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-268 + * MAIN LINK: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 1 + * PRIMARY LINKS: overload-resolution, c-level-partition -> paragraph 1 -> sentence 1 + * overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 3 -> sentence 1 + * overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 2 -> sentence 1 + * overload-resolution, receivers -> paragraph 7 -> sentence 2 + * overload-resolution, receivers -> paragraph 7 -> sentence 3 + * NUMBER: 1 + * DESCRIPTION: sets of non-extension member callables only + */ + package tests.test2 // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/2.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/2.2.fir.kt index 3bc99352e20..116b37ac629 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/2.2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/2.2.fir.kt @@ -1,5 +1,20 @@ // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-268 + * MAIN LINK: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 2 + * PRIMARY LINKS: overload-resolution, c-level-partition -> paragraph 1 -> sentence 1 + * overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 3 -> sentence 1 + * overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 3 -> sentence 2 + * overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 2 -> sentence 1 + * NUMBER: 2 + * DESCRIPTION: extension calls with explicit and implicit receiver + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-36475 + */ + // TESTCASE NUMBER: 1 class Case1 { fun bar() { diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/2.4.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/2.4.fir.kt index c9dca858b0e..2611d639e43 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/2.4.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/2.4.fir.kt @@ -1,6 +1,21 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-268 + * MAIN LINK: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 2 + * PRIMARY LINKS: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 3 + * overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 4 + * overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 5 + * overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 11 -> sentence 1 + * overload-resolution, receivers -> paragraph 5 -> sentence 1 + * overload-resolution, building-the-overload-candidate-set-ocs, call-with-trailing-lambda-expressions -> paragraph 1 -> sentence 2 + * NUMBER: 4 + * DESCRIPTION: sets of local, explicitly imported, declared in the package scope and star-imported extension callables + */ + // FILE: Extensions.kt package libPackage diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-named-parameters/p-1/pos/2.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-named-parameters/p-1/pos/2.1.fir.kt index 0d5da6c4462..bd4f528b28d 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-named-parameters/p-1/pos/2.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-named-parameters/p-1/pos/2.1.fir.kt @@ -1,6 +1,18 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -UNREACHABLE_CODE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -IMPLICIT_NOTHING_RETURN_TYPE -DEBUG_INFO_LEAKING_THIS -EXTENSION_SHADOWED_BY_MEMBER // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-280 + * MAIN LINK: overload-resolution, building-the-overload-candidate-set-ocs, call-with-named-parameters -> paragraph 1 -> sentence 2 + * PRIMARY LINKS: overload-resolution, building-the-overload-candidate-set-ocs, call-with-named-parameters -> paragraph 3 -> sentence 1 + * overload-resolution, building-the-overload-candidate-set-ocs, call-with-named-parameters -> paragraph 2 -> sentence 1 + * overload-resolution, building-the-overload-candidate-set-ocs, call-with-named-parameters -> paragraph 4 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: Implicit receiver: sets of non-extension member callables, local, explicitly imported, declared in the package scope and star-imported extension callables + */ + // TESTCASE NUMBER: 1, 2, 3, 4, 5 // FILE: Marker.kt diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.1.fir.kt index c4f5cc9c7db..8052a2cf64b 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.1.fir.kt @@ -1,6 +1,18 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -UNREACHABLE_CODE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -IMPLICIT_NOTHING_RETURN_TYPE -DEBUG_INFO_LEAKING_THIS -EXTENSION_SHADOWED_BY_MEMBER // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-300 + * MAIN LINK: overload-resolution, building-the-overload-candidate-set-ocs, call-with-trailing-lambda-expressions -> paragraph 1 -> sentence 2 + * PRIMARY LINKS: overload-resolution, building-the-overload-candidate-set-ocs, call-with-named-parameters -> paragraph 3 -> sentence 1 + * overload-resolution, building-the-overload-candidate-set-ocs, call-with-named-parameters -> paragraph 2 -> sentence 1 + * overload-resolution, building-the-overload-candidate-set-ocs, call-with-named-parameters -> paragraph 4 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: call-with-trailing-lambda-expressions,Implicit receiver: sets of non-extension member callables, local, explicitly imported, declared in the package scope and star-imported extension callables + */ + // TESTCASE NUMBER: 1, 2, 3, 4, 5 // FILE: Marker.kt diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.10.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.10.fir.kt deleted file mode 100644 index c63ac44152f..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.10.fir.kt +++ /dev/null @@ -1,62 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -// SKIP_TXT - - -// FILE: TestCase1.kt -// TESTCASE NUMBER: 1 -package testsCase1 - -import libPackageCase1.* - -fun case1() { - listOf(elements = arrayOf(1), body = { "" }) -} -// FILE: Lib1.kt -package libPackageCase1 - -fun listOf(vararg elements: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -// FILE: TestCase2.kt -// TESTCASE NUMBER: 2 -package testsCase2 -import libPackageCase2.* - -fun case2() { - listOf(elements = arrayOf(1), body = { "" }) -} - - -class A { - operator fun invoke(): T = TODO() -} - -// FILE: Lib2.kt -package libPackageCase2 -import testsCase2.* - -fun listOf(vararg elements: T = TODO(), body: () -> T = { TODO() }): List = TODO() -val listOf: A - get() = A() - -// FILE: TestCase3.kt -// TESTCASE NUMBER: 3 -package testsCase3 -import libPackageCase3.* - -fun case3() { - listOf(elements = arrayOf(1), body = { "" }) -} - - -class A { - operator fun invoke(vararg elements: T = TODO(), body: () -> T = { TODO() }): List = TODO() -} - -// FILE: Lib3.kt -package libPackageCase3 -import testsCase3.* - -private fun listOf(vararg elements: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -val listOf: A - get() = A() diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.10.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.10.kt index 329119252c2..98c10ce9c1c 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.10.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.10.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.12.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.12.fir.kt deleted file mode 100644 index 6fc076764d2..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.12.fir.kt +++ /dev/null @@ -1,153 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -NOTHING_TO_INLINE -EXTENSION_SHADOWED_BY_MEMBER -EXTENSION_FUNCTION_SHADOWED_BY_MEMBER_PROPERTY_WITH_INVOKE -// SKIP_TXT - - -// FILE: TestCase1.kt -// TESTCASE NUMBER: 1 -package testsCase1 - -import libPackageCase1.* -import libPackageCase1Explicit.listOf - -class Case1() { - fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - - fun case1() { - fun Case1.listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - - listOf(elements1 = arrayOf(1), body = { "" }) - } -} -// FILE: Lib1.kt -package libPackageCase1 -import testsCase1.* - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() -fun Case1.listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -// FILE: Lib2.kt -package libPackageCase1Explicit -import testsCase1.* - -fun Case1.listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -// FILE: LibtestsPack1.kt -package testsCase1 -fun Case1.listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - - -// FILE: TestCase2.kt -// TESTCASE NUMBER: 2 -package testsCase2 -import libPackageCase2.* -import libPackageCase2Explicit.listOf - -class Case2() { - fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - - val listOf: A - get() = A() - - fun case1() { - fun Case2.listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - - listOf(elements1 = arrayOf(1), body = { "" }) - } -} - -class A { - operator fun invoke(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() -} -// FILE: Lib3.kt -package libPackageCase2 -import testsCase2.* - -val Case2.listOf: A - get() = A() - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() -fun Case2.listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -// FILE: Lib4.kt -package libPackageCase2Explicit -import testsCase2.* - -val Case2.listOf: A - get() = A() - -fun Case2.listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -// FILE: LibtestsPack2.kt -package testsCase2 -val Case2.listOf: A - get() = A() - -fun Case2.listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - - -// FILE: TestCase3.kt -// TESTCASE NUMBER: 3 -package testsCase3 -import libPackageCase3.* -import libPackageCase3Explicit.listOf - -class Case3() { - fun Case3.listOf(vararg elements1: T = TODO(), body: () -> T = - { TODO() }): List = TODO() - - val listOf: A - get() = A() - - fun case1() { - fun Case3.listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - - listOf(elements1 = arrayOf(1), body = { "" }) - } -} - -class A { - operator fun invoke(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() -} -// FILE: Lib5.kt -// TESTCASE NUMBER: 3 - -package libPackageCase3 -import testsCase3.* - -val Case3.listOf: A - get() = A() - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() -fun Case3.listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -// FILE: Lib6.kt -// TESTCASE NUMBER: 3 - -package libPackageCase3Explicit -import testsCase3.* - -val Case3.listOf: A - get() = A() - -fun Case3.listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -// FILE: LibtestsPack3.kt -// TESTCASE NUMBER: 3 - -package testsCase3 -val Case3.listOf: A - get() = A() - -fun Case3.listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.12.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.12.kt index 01369d2fa0c..cff5f729bcc 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.12.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.12.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -NOTHING_TO_INLINE -EXTENSION_SHADOWED_BY_MEMBER -EXTENSION_FUNCTION_SHADOWED_BY_MEMBER_PROPERTY_WITH_INVOKE // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.13.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.13.fir.kt deleted file mode 100644 index 130903c46db..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.13.fir.kt +++ /dev/null @@ -1,182 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -NOTHING_TO_INLINE -EXTENSION_FUNCTION_SHADOWED_BY_MEMBER_PROPERTY_WITH_INVOKE -// SKIP_TXT - - -// FILE: TestCase1.kt -// TESTCASE NUMBER: 1 -package testsCase1 - -import libPackageCase1.* -import libPackageCase1Explicit.listOf - -class Case1() { - - fun case1_0() { - fun Case1.listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - - listOf(elements1 = arrayOf(1), body = { "" }) - - fun case1_1() { - fun Case1.listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - listOf(elements1 = arrayOf(1), body = { "" }) - } - } - -} - -// FILE: Lib1.kt -package libPackageCase1 -import testsCase1.* - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() -fun Case1.listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -// FILE: Lib2.kt -package libPackageCase1Explicit -import testsCase1.* - -fun Case1.listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -// FILE: LibtestsPack1.kt -package testsCase1 -fun Case1.listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - - -// FILE: TestCase2.kt - -/* - * TESTCASE NUMBER: 2 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-37179 - */ -package testsCase2 -import libPackageCase2.* -import libPackageCase2Explicit.listOf - -class Case2() { - - fun case1_0() { - fun Case2.listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - listOf(elements1 = arrayOf(1), body = { "" }) - - fun case1_1() { - fun Case2.listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - listOf(elements1 = arrayOf(1), body = { "" }) - } - } - - val Case2.listOf: A - get() = A() - - fun Case2.listOf(vararg elements1: T = TODO(), body: () -> T = - { TODO() }): List = TODO() - - fun case2_0() { - listOf(elements1 = arrayOf(1), body = { "" }) - } - -} - -class A { - operator fun invoke(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() -} - -// FILE: Lib3.kt -// TESTCASE NUMBER: 2 -package libPackageCase2 -import testsCase2.* - -val Case2.listOf: A - get() = A() - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() -fun Case2.listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -// FILE: Lib4.kt -// TESTCASE NUMBER: 2 - -package libPackageCase2Explicit -import testsCase2.* - -fun Case2.listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -// FILE: LibtestsPack2.kt -// TESTCASE NUMBER: 2 - -package testsCase2 -fun Case2.listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - - -// FILE: TestCase3.kt - -/* - * TESTCASE NUMBER: 3 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-37179 - */ -package testsCase3 -import libPackageCase3.* -import libPackageCase3Explicit.listOf - -class Case3() { - - fun case1_0() { - //fun Case3.listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - listOf(elements1 = arrayOf(1), body = { "" }) - - fun case1_1() { - // fun Case3.listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - listOf(elements1 = arrayOf(1), body = { "" }) - } - } - - val Case3.listOf: A - get() = A() - - //fun Case3.listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - - fun case2_0() { - listOf(elements1 = arrayOf(1), body = { "" }) - } - -} - -class A { - operator fun invoke(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() -} - -// FILE: Lib5.kt -// TESTCASE NUMBER: 3 -package libPackageCase3 -import testsCase3.* - -val Case3.listOf: A - get() = A() - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() -fun Case3.listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -// FILE: Lib6.kt -// TESTCASE NUMBER: 3 - -package libPackageCase3Explicit -import testsCase3.* - -fun Case3.listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -// FILE: LibtestsPack3.kt -// TESTCASE NUMBER: 3 -package testsCase3 -fun Case3.listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.13.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.13.kt index 4d9f5ad0029..12a1a9d711d 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.13.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.13.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -NOTHING_TO_INLINE -EXTENSION_FUNCTION_SHADOWED_BY_MEMBER_PROPERTY_WITH_INVOKE // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.14.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.14.fir.kt deleted file mode 100644 index 702522beeb9..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.14.fir.kt +++ /dev/null @@ -1,125 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -NOTHING_TO_INLINE -// SKIP_TXT - - -// FILE: TestCase1.kt -// TESTCASE NUMBER: 1 - -package testsCase1 - -import libPackageCase1.* -import libPackageCase1Explicit.listOf - -class Case1() { - - fun case1() { - listOf(elements1 = arrayOf(1), body = { "" }) - } -} - -// FILE: Lib1.kt -package libPackageCase1 -import testsCase1.* - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() -fun Case1.listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -// FILE: Lib2.kt -package libPackageCase1Explicit -import testsCase1.* - -fun Case1.listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -// FILE: LibtestsPack1.kt -package testsCase1 -fun Case1.listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - - -// FILE: TestCase2.kt -// TESTCASE NUMBER: 2 - -package testsCase2 -import libPackageCase2.* -import libPackageCase2Explicit.listOf - -class Case2() { - - fun case1() { - listOf(elements1 = arrayOf(1), body = { "" }) - } -} - -class A { - operator fun invoke(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() -} - -// FILE: Lib3.kt -package libPackageCase2 -import testsCase2.* - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() -fun Case2.listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -// FILE: Lib4.kt -package libPackageCase2Explicit -import testsCase2.* - -val Case2.listOf: A - get() = A() - -fun Case2.listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -// FILE: LibtestsPack2.kt -package testsCase2 -fun Case2.listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - - -// FILE: TestCase3.kt -// TESTCASE NUMBER: 3 - -package testsCase3 -import libPackageCase3.* -import libPackageCase3Explicit.listOf - -class Case3() { - - fun case1() { - listOf(elements1 = arrayOf(1), body = { "" }) - } -} - -class A { - operator fun invoke(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() -} - -// FILE: Lib5.kt -package libPackageCase3 -import testsCase3.* - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() -fun Case3.listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -// FILE: Lib6.kt -package libPackageCase3Explicit -import testsCase3.* - -val Case3.listOf: A - get() = A() - -private fun Case3.listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -// FILE: LibtestsPack3.kt -package testsCase3 -fun Case3.listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.14.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.14.kt index 4b86cb6b48f..62288b716cd 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.14.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.14.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -NOTHING_TO_INLINE // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.15.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.15.fir.kt deleted file mode 100644 index d6149941f07..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.15.fir.kt +++ /dev/null @@ -1,115 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -NOTHING_TO_INLINE -// SKIP_TXT - - -// FILE: TestCase1.kt -// TESTCASE NUMBER: 1 -package testsCase1 - -import libPackageCase1.* -import libPackageCase1Explicit.listOf - -class Case1() { - - fun case1() { - listOf(elements1 = arrayOf(1), body = { "" }) - } -} - -// FILE: Lib1.kt -package libPackageCase1 -import testsCase1.* - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() -fun Case1.listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -// FILE: Lib2.kt -package libPackageCase1Explicit - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -// FILE: LibtestsPack1.kt -package testsCase1 -fun Case1.listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - - -// FILE: TestCase2.kt -// TESTCASE NUMBER: 2 -package testsCase2 -import libPackageCase2.* -import libPackageCase2Explicit.listOf - -class Case2() { - - fun case1() { - listOf(elements1 = arrayOf(1), body = { "" }) - } -} - -class A { - operator fun invoke(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() -} - -// FILE: Lib3.kt -package libPackageCase2 -import testsCase2.* - -val Case2.listOf: A - get() = A() - -fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() -fun Case2.listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -// FILE: Lib4.kt -package libPackageCase2Explicit - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -// FILE: LibtestsPack2.kt -package testsCase2 -fun Case2.listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() -val Case2.listOf: A - get() = A() - -// FILE: TestCase3.kt -// TESTCASE NUMBER: 3 -package testsCase3 -import libPackageCase3.* -import libPackageCase3Explicit.listOf - -class Case3() { - - fun case1() { - listOf(elements1 = arrayOf(1), body = { "" }) - } -} - -class A { - operator fun invoke(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() -} - -// FILE: Lib5.kt -package libPackageCase3 -import testsCase3.* - -fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() -fun Case3.listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -// FILE: Lib6.kt -package libPackageCase3Explicit - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -// FILE: LibtestsPack3.kt -package testsCase3 - -val Case3.listOf: A - get() = A() - -private fun Case3.listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.15.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.15.kt index abd352f8ff3..7819744cf69 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.15.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.15.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -NOTHING_TO_INLINE // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.16.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.16.fir.kt deleted file mode 100644 index 32f98430eb9..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.16.fir.kt +++ /dev/null @@ -1,112 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -NOTHING_TO_INLINE -// SKIP_TXT - - -// FILE: TestCase1.kt -// TESTCASE NUMBER: 1 -package testsCase1 - -import libPackageCase1.* -import libPackageCase1Explicit.listOf - -class Case1() { - - fun case() { - listOf(elements1 = arrayOf(1), body = { "" }) - } -} - -// FILE: Lib1.kt -package libPackageCase1 -import testsCase1.* - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() -fun Case1.listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -// FILE: Lib2.kt -package libPackageCase1Explicit - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -// FILE: LibtestsPack1.kt -package testsCase1 - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - - -// FILE: TestCase2.kt -// TESTCASE NUMBER: 2 -package testsCase2 -import libPackageCase2.* -import libPackageCase2Explicit.listOf - -class Case2() { - - fun case() { - listOf(elements1 = arrayOf(1), body = { "" }) - } -} - -class A { - operator fun invoke(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() -} - - -// FILE: Lib3.kt -package libPackageCase2 -import testsCase2.* - -val Case2.listOf: A - get() = A() - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() -fun Case2.listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -// FILE: Lib4.kt -package libPackageCase2Explicit - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -// FILE: LibtestsPack2.kt -package testsCase2 - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - - -// FILE: TestCase3.kt -// TESTCASE NUMBER: 3 -package testsCase3 -import libPackageCase3.* -import libPackageCase3Explicit.listOf - -class Case3() { - - fun case() { - listOf(elements1 = arrayOf(1), body = { "" }) - } -} - -class A { - operator fun invoke(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() -} - - -// FILE: Lib5.kt -package libPackageCase3 -import testsCase3.* - -val Case3.listOf: A - get() = A() - -fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() -private fun Case3.listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -// FILE: Lib6.kt -package libPackageCase3Explicit - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -// FILE: LibtestsPack3.kt -package testsCase3 - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.16.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.16.kt index ae4c76b5c65..75bcb8de518 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.16.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.16.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -NOTHING_TO_INLINE // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.17.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.17.fir.kt deleted file mode 100644 index 9dd394133d9..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.17.fir.kt +++ /dev/null @@ -1,110 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -// SKIP_TXT - -// TESTCASE NUMBER: 0, 1, 2, 3, 4 -// FILE: Extensions1.kt -package libPackage - -class A() { - infix fun foo(x: ()->Int) = "member fun foo" -} - -// FILE: Extensions2.kt -// TESTCASE NUMBER: 0 - -package sentence3 -import libPackage.A - -infix fun A.foo(x: ()->Int) = "pack scope extension fun foo" - -// FILE: TestCase1.kt -// TESTCASE NUMBER: 1 - -package sentence3 -import libPackage.A - -class Case1() { - infix fun A.foo(x: ()->Int) = "local extension fun foo" - - fun case1() { - val a = A() - a foo {1} - A() foo {1} - } -} -// FILE: TestCase2.kt -// TESTCASE NUMBER: 2 - -package sentence3 -import libPackage.A - -interface Case2 { - infix fun A.foo(x: ()->Int) = "local extension fun foo" - - fun case2() { - val a = A() - a foo {1} - A() foo {1} - } -} - -// FILE: TestCase3.kt -// TESTCASE NUMBER: 3 -package testPack -import libPackage.A - -infix fun A.foo(x: ()->Int) = "my package scope top level trim" - - -fun case3() { - infix fun A.foo(x: ()->Int) = "my local scope trim" - - val a = A() - a foo {1} - A() foo {1} -} - -// FILE: TestCase4.kt -// TESTCASE NUMBER: 4 -package testPackNew -import libPackage.A - -infix fun A.foo(x: ()->Int) = "my package scope top level trim" - - -fun case4() { - - infix fun A.foo(x: ()->Int) = "my local trim" - - fun subfun() { - infix fun A.foo(x: ()->Int) = "my local trim" - val a = A() - a foo {1} - A() foo {1} - } -} - -// FILE: TestCase5.kt -// TESTCASE NUMBER: 5 -package testPackNew - -class A() { - fun foo(i: ()->Int) {} - infix fun A.foo(i: ()->Int) {} - - fun bar(a: A) { - //todo: add info if function is infix one - a foo {1} - } - - fun buz(a: A) { - fun foo(i: ()->Int) {} - //todo: add info if function is infix one - a foo {1} - } - - fun boo(a: A) { - infix fun A.foo(i: ()->Int) {} - a foo {1} - } -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.17.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.17.kt index f1d0638b32b..faff9f15e32 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.17.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.17.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -EXTENSION_SHADOWED_BY_MEMBER // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.8.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.8.fir.kt deleted file mode 100644 index 39c6c4c0aea..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.8.fir.kt +++ /dev/null @@ -1,95 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -NOTHING_TO_INLINE -// SKIP_TXT - - -// FILE: TestCase1.kt -// TESTCASE NUMBER: 1 -package testsCase1 - -import libPackageCase1.* -import libPackageCase1Explicit.listOf - -fun case1() { - listOf(elements1 = arrayOf(1), body = { "" }) -} - -// FILE: Lib1.kt -package libPackageCase1 - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -// FILE: Lib2.kt -package libPackageCase1Explicit - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -// FILE: LibtestsPack1.kt -package testsCase1 - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - - -// FILE: TestCase2.kt -// TESTCASE NUMBER: 2 -package testsCase2 -import libPackageCase2.* -import libPackageCase2Explicit.listOf - -fun case2() { - listOf(elements1 = arrayOf(1), body = { "" }) -} - -class A { - operator fun invoke(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() -} -// FILE: Lib3.kt -package libPackageCase2 - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -// FILE: Lib4.kt -package libPackageCase2Explicit -import testsCase2.* - -val listOf: A - get() = A() - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -// FILE: LibtestsPack2.kt -package testsCase2 - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - - -// FILE: TestCase3.kt -// TESTCASE NUMBER: 3 -package testsCase3 -import libPackageCase3.* -import libPackageCase3Explicit.listOf - -fun case3() { - listOf(elements1 = arrayOf(1), body = { "" }) -} - -class A { - operator fun invoke(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() -} -// FILE: Lib5.kt -package libPackageCase3 - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -// FILE: Lib6.kt -package libPackageCase3Explicit -import testsCase3.* - -val listOf: A - get() = A() - -private fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -// FILE: LibtestsPack3.kt -package testsCase3 - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.8.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.8.kt index 7b3ece080b4..fca702366fc 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.8.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.8.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -NOTHING_TO_INLINE // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.9.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.9.fir.kt deleted file mode 100644 index a0a44b05895..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.9.fir.kt +++ /dev/null @@ -1,78 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -NOTHING_TO_INLINE -// SKIP_TXT - - -// FILE: TestCase1.kt -// TESTCASE NUMBER: 1 -package testsCase1 - -import libPackageCase1.* - -fun case1() { - listOf(elements1 = arrayOf(1), body = { "" }) -} - -// FILE: Lib1.kt -package libPackageCase1 - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -// FILE: LibtestsPack1.kt -package testsCase1 - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -// FILE: TestCase2.kt -// TESTCASE NUMBER: 2 -package testsCase2 -import libPackageCase2.* - -fun case2() { - listOf(elements1 = arrayOf(1), body = { "" }) -} - -// FILE: Lib2.kt -package libPackageCase2 - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -// FILE: LibtestsPack2.kt -package testsCase2 -import testsCase2.* - -public val listOf: A - get() = A() - -class A { - operator fun invoke(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() -} - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - - -// FILE: TestCase3.kt -// TESTCASE NUMBER: 3 -package testsCase3 -import libPackageCase3.* - -fun case3() { - listOf(elements1 = arrayOf(1), body = { "" }) -} - -// FILE: Lib3.kt -package libPackageCase3 - -public fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() - -// FILE: LibtestsPack3.kt -package testsCase3 -import testsCase3.* - -public val listOf: A - get() = A() - -class A { - operator fun invoke(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() -} - -private fun listOf(vararg elements1: T = TODO(), body: () -> T = { TODO() }): List = TODO() diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.9.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.9.kt index cb6dc9bfe66..6a4ae31930a 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.9.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.9.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -NOTHING_TO_INLINE // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/2.3.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/2.3.fir.kt deleted file mode 100644 index 8460559f846..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/2.3.fir.kt +++ /dev/null @@ -1,44 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -NOTHING_TO_INLINE -// SKIP_TXT - -// FILE: Lib1.kt -package libPackageCase1 -import testsCase1.* - -public fun emptyArray(): Array = TODO() -fun Case1.emptyArray(): Array = TODO() - -// FILE: Lib2.kt -package libPackageCase1Explicit -import testsCase1.* - -fun Case1.emptyArray(): Array = TODO() - -public fun emptyArray(): Array = TODO() -// FILE: Lib3.kt -package libPackageCase1ExplicitDuplicate -import testsCase1.* - -fun Case1.emptyArray(): Array = TODO() - -public fun emptyArray(): Array = TODO() - -// FILE: LibtestsPack.kt -package testsCase1 -fun Case1.emptyArray(): Array = TODO() - -public fun emptyArray(): Array = TODO() - -// FILE: TestCase.kt -package testsCase1 -import libPackageCase1.* -import libPackageCase1Explicit.emptyArray -import libPackageCase1ExplicitDuplicate.emptyArray - -// TESTCASE NUMBER: 1 -class Case1(){ - - fun case1() { - emptyArray() - } -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/2.3.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/2.3.kt index 48e5a636ddf..3bfe3b54c84 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/2.3.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/2.3.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -NOTHING_TO_INLINE // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/2.4.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/2.4.fir.kt index aed6992bcc0..2426e5a4b26 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/2.4.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/2.4.fir.kt @@ -1,6 +1,22 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -NOTHING_TO_INLINE // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-278 + * MAIN LINK: overload-resolution, building-the-overload-candidate-set-ocs, call-without-an-explicit-receiver -> paragraph 5 -> sentence 2 + * PRIMARY LINKS: overload-resolution, building-the-overload-candidate-set-ocs, call-without-an-explicit-receiver -> paragraph 4 -> sentence 1 + * overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 4 + * overload-resolution, building-the-overload-candidate-set-ocs, call-without-an-explicit-receiver -> paragraph 8 -> sentence 1 + * overload-resolution, building-the-overload-candidate-set-ocs, call-without-an-explicit-receiver -> paragraph 6 -> sentence 1 + * overload-resolution, building-the-overload-candidate-set-ocs, call-with-specified-type-parameters -> paragraph 1 -> sentence 2 + * NUMBER: 4 + * DESCRIPTION: The overload candidate sets for each pair of implicit receivers: declared in the package scope extension callables + */ + + + // FILE: TestCase1.kt // TESTCASE NUMBER: 1 package testsCase1 diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/2.5.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/2.5.fir.kt deleted file mode 100644 index 56aea5542c8..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/2.5.fir.kt +++ /dev/null @@ -1,39 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -NOTHING_TO_INLINE -// SKIP_TXT - -// FILE: Lib1.kt -package libPackageCase1 -import testsCase1.* - -public fun emptyArray(): Array = TODO() -fun Case1.emptyArray(): Array = TODO() -// FILE: Lib2.kt -package libPackageCase1Duplicate -import testsCase1.* - -public fun emptyArray(): Array = TODO() -fun Case1.emptyArray(): Array = TODO() - -// FILE: Lib3.kt -package libPackageCase1Explicit - -public fun emptyArray(): Array = TODO() - -// FILE: LibtestsPack.kt -package testsCase1 - -public fun emptyArray(): Array = TODO() - -// FILE: TestCase.kt -package testsCase1 -import libPackageCase1.* -import libPackageCase1Duplicate.* -import libPackageCase1Explicit.emptyArray - -// TESTCASE NUMBER: 1 -class Case1(){ - - fun case1() { - emptyArray() - } -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/2.5.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/2.5.kt index ddc065d9604..ba9f45898e4 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/2.5.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/2.5.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -NOTHING_TO_INLINE // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/4.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/4.1.fir.kt deleted file mode 100644 index 0e64c4af9aa..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/4.1.fir.kt +++ /dev/null @@ -1,28 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -// SKIP_TXT - - - -// FILE: TestCase1.kt -// TESTCASE NUMBER: 1 - -package tests.case1 - -import lib.case1.* - -interface I -class A : I -class B : I - -fun case1(){ - A.invoke() -} - -// FILE: Lib.kt -package lib.case1 - -//fun A() : String = "" - -object A { - /*operator*/ fun invoke() : Int = 1 -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/4.1.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/4.1.kt index bf8957ae740..0475628a24f 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/4.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/4.1.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/4.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/4.2.fir.kt index fca9358bb92..1589bb99250 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/4.2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/4.2.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-464 + * MAIN LINK: overload-resolution, building-the-overload-candidate-set-ocs, call-without-an-explicit-receiver -> paragraph 5 -> sentence 4 + * PRIMARY LINKS: overload-resolution, building-the-overload-candidate-set-ocs, call-without-an-explicit-receiver -> paragraph 5 -> sentence 6 + * NUMBER: 2 + * DESCRIPTION: Top-level non-extension functions named f: callables implicitly imported into the current file; + */ // FILE: TestCase1.kt diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/6.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/6.1.fir.kt deleted file mode 100644 index 87767dbce34..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/6.1.fir.kt +++ /dev/null @@ -1,112 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -// SKIP_TXT - - -// FILE: TestCase1.kt -/* - * TESTCASE NUMBER: 1 - * UNEXPECTED BEHAVIOUR - */ -package testPackCase1 -import libCase1.* -import kotlin.text.* - -fun case1() { - Regex("") -} - -// FILE: Lib1.kt -package libCase1 -fun Regex(pattern: String) {} - - -// FILE: TestCase2.kt -/* - * TESTCASE NUMBER: 2 - * ISSUES: KT-39073 - */ -package testPackCase2 -import libCase2.a.* -import libCase2.b.* -import kotlin.text.* - - -fun case2() { - Regex("") -} - -// FILE: Lib2.kt -package libCase2.a -fun Regex(pattern: String) {} - -// FILE: Lib3.kt -package libCase2.b -fun Regex(pattern: String) {} - - -// FILE: TestCase4.kt -/* - * TESTCASE NUMBER: 4 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-39157 - */ -package testPackCase4 -import libCase4.a.* -import libCase4.b.* -import kotlin.text.* - -fun case4() { - Regex("") -} - -// FILE: Lib4.kt -package libCase4.a -fun Regex(pattern: String) {} - -// FILE: Lib5.kt -package libCase4.b -class Regex(pattern: String) {} - - - -// FILE: TestCase5.kt -/* - * TESTCASE NUMBER: 5 - * UNEXPECTED BEHAVIOUR - */ -package testPackCase5 -import libCase5.a.* -import libCase5.b.* - -fun case5() { - Regex("") -} - -// FILE: Lib6.kt -package libCase5.a -fun Regex(pattern: String) {} - -// FILE: Lib7.kt -package libCase5.b -class Regex(pattern: String) {} - -// FILE: TestCase6.kt -/* - * TESTCASE NUMBER: 6 - * UNEXPECTED BEHAVIOUR - */ -package testPackCase6 -import libCase6.a.* -import libCase6.b.* - -fun case6() { - MyRegex("") -} - -// FILE: Lib8.kt -package libCase6.a -fun MyRegex(pattern: String) {} - -// FILE: Lib9.kt -package libCase6.b -class MyRegex(pattern: String) {} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/6.1.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/6.1.kt index 88524b4ed98..d2c5fc428a1 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/6.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/6.1.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/pos/4.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/pos/4.2.fir.kt index bafbccb7df2..093977ff827 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/pos/4.2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/pos/4.2.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-464 + * MAIN LINK: overload-resolution, building-the-overload-candidate-set-ocs, call-without-an-explicit-receiver -> paragraph 5 -> sentence 4 + * PRIMARY LINKS: overload-resolution, building-the-overload-candidate-set-ocs, call-without-an-explicit-receiver -> paragraph 5 -> sentence 5 + * NUMBER: 2 + * DESCRIPTION: Top-level non-extension functions named f: callables explicitly imported into the current file; + */ // FILE: TestCase1.kt // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/pos/4.3.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/pos/4.3.fir.kt index 3719e6eee4d..c7ffa14b684 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/pos/4.3.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/pos/4.3.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-464 + * MAIN LINK: overload-resolution, building-the-overload-candidate-set-ocs, call-without-an-explicit-receiver -> paragraph 5 -> sentence 4 + * PRIMARY LINKS: overload-resolution, building-the-overload-candidate-set-ocs, call-without-an-explicit-receiver -> paragraph 5 -> sentence 6 + * NUMBER: 3 + * DESCRIPTION: Top-level non-extension functions named f: callables implicitly imported into the current file; + */ // FILE: TestCase1.kt // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/pos/4.4.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/pos/4.4.fir.kt index 91392d430a6..c283ae591f8 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/pos/4.4.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/pos/4.4.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-464 + * MAIN LINK: overload-resolution, building-the-overload-candidate-set-ocs, call-without-an-explicit-receiver -> paragraph 5 -> sentence 4 + * PRIMARY LINKS: overload-resolution, building-the-overload-candidate-set-ocs, call-without-an-explicit-receiver -> paragraph 5 -> sentence 6 + * NUMBER: 4 + * DESCRIPTION: Top-level non-extension functions named f: callables implicitly imported into the current file; + */ // FILE: TestCase1.kt // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/pos/4.5.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/pos/4.5.fir.kt index 3808916ae6a..1841201e09c 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/pos/4.5.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/pos/4.5.fir.kt @@ -1,6 +1,16 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-464 + * MAIN LINK: overload-resolution, building-the-overload-candidate-set-ocs, call-without-an-explicit-receiver -> paragraph 5 -> sentence 4 + * PRIMARY LINKS: overload-resolution, building-the-overload-candidate-set-ocs, call-without-an-explicit-receiver -> paragraph 5 -> sentence 5 + * declarations, type-alias -> paragraph 1 -> sentence 1 + * NUMBER: 5 + * DESCRIPTION: Top-level non-extension functions named f: callables explicitly imported into the current file; + */ // FILE: TestCase1.kt // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/pos/4.6.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/pos/4.6.fir.kt index 22f4133808b..0c7d0442d98 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/pos/4.6.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/pos/4.6.fir.kt @@ -1,6 +1,16 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-464 + * MAIN LINK: overload-resolution, building-the-overload-candidate-set-ocs, call-without-an-explicit-receiver -> paragraph 5 -> sentence 4 + * PRIMARY LINKS: overload-resolution, building-the-overload-candidate-set-ocs, call-without-an-explicit-receiver -> paragraph 5 -> sentence 5 + * declarations, type-alias -> paragraph 1 -> sentence 1 + * NUMBER: 6 + * DESCRIPTION: Top-level non-extension functions named f: callables explicitly imported into the current file; + */ // FILE: TestCase1.kt // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/pos/6.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/pos/6.2.fir.kt index e9da362acf1..2e8f1bc0a24 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/pos/6.2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/pos/6.2.fir.kt @@ -1,6 +1,14 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-401 + * MAIN LINK: overload-resolution, building-the-overload-candidate-set-ocs, call-without-an-explicit-receiver -> paragraph 5 -> sentence 6 + * NUMBER: 2 + * DESCRIPTION: + */ // FILE: TestCase11.kt /* diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/pos/6.3.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/pos/6.3.fir.kt index e8480d5395f..73075fadab0 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/pos/6.3.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/pos/6.3.fir.kt @@ -1,6 +1,14 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-401 + * MAIN LINK: overload-resolution, building-the-overload-candidate-set-ocs, call-without-an-explicit-receiver -> paragraph 5 -> sentence 6 + * NUMBER: 3 + * DESCRIPTION: + */ // FILE: TestCase1.kt /* diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/1.1.fir.kt deleted file mode 100644 index cb18202f514..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/1.1.fir.kt +++ /dev/null @@ -1,84 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -EXTENSION_SHADOWED_BY_MEMBER -// SKIP_TXT - -// FILE: Extensions1.kt -package libPackage - -class A() { - fun foo(x: Int) = "member fun foo" -} - -// FILE: Extensions2.kt -// TESTCASE NUMBER: 1, 2, 3, 4 - -package sentence3 -import libPackage.A - -fun A.foo(x: Int) = "pack scope extension fun foo" - -// FILE: TestCase1.kt -// TESTCASE NUMBER: 1 - -package sentence3 -import libPackage.A - -class Case1() { - fun A.foo(x: Int) = "local extension fun foo" - - fun case1() { - val a = A() - a foo 1 - A() foo 1 - } -} -// FILE: TestCase2.kt -// TESTCASE NUMBER: 2 - -package sentence3 -import libPackage.A - -interface Case2 { - fun A.foo(x: Int) = "local extension fun foo" - - fun case2() { - val a = A() - a foo 1 - A() foo 1 - } -} - -// FILE: TestCase3.kt -// TESTCASE NUMBER: 3 -package testPack -import libPackage.A - -fun A.foo(x: Int) = "my package scope top level contains" - - -fun case3() { - fun A.foo(x: Int) ="my local scope contains" - - val a = A() - a foo 1 - A() foo 1 -} - -// FILE: TestCase4.kt -// TESTCASE NUMBER: 4 -package testPackNew -import libPackage.A - -fun A.foo(x: Int) = "my package scope top level contains" - - -fun case4() { - - fun A.foo(x: Int) = "my local contains" - - fun subfun() { - fun A.foo(x: Int) = "my local contains" - val a = A() - a foo 1 - A() foo 1 - } -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/1.1.kt index f435005908f..535b9a9b785 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/1.1.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -EXTENSION_SHADOWED_BY_MEMBER // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/1.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/1.2.fir.kt deleted file mode 100644 index ccca80ffb74..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/1.2.fir.kt +++ /dev/null @@ -1,103 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -// SKIP_TXT - -// FILE: Extensions1.kt -package libPackage - -operator fun CharSequence.contains(regex: Regex): Boolean { - println("my contains") - return true -} -// FILE: Extensions2.kt - -package sentence3 - -operator fun CharSequence.contains(regex: Regex): Boolean { - println("my package scope contains") - return true -} - -// FILE: TestCase1.kt -// TESTCASE NUMBER: 1 - -package sentence3 -import libPackage.contains - -class Case1() { - operator fun CharSequence.contains(regex: Regex): Boolean { - println("my local class scope contains") - return true - } - - fun case1() { - val regex = Regex("") - "" contains regex - } -} -// FILE: TestCase2.kt -// TESTCASE NUMBER: 2 - -package sentence3 -import libPackage.contains - -interface Case2 { - operator fun CharSequence.contains(regex: Regex): Boolean { - println("my local interface scope contains") - return true - } - - fun case2() { - val regex = Regex("") - "" contains regex - } -} - -// FILE: TestCase3.kt -// TESTCASE NUMBER: 3 -package testPack -import libPackage.contains - -operator fun CharSequence.contains(regex: Regex): Boolean { - println("my package scope top level contains") - return true -} - -fun case3() { - operator fun CharSequence.contains(regex: Regex): Boolean { - println("my package scope top level contains") - return true - } - - val regex = Regex("") - "" contains regex -} - -// FILE: TestCase4.kt -// TESTCASE NUMBER: 4 -package testPackNew -import libPackage.contains - -operator fun CharSequence.contains(regex: Regex): Boolean { - println("my package scope top level contains") - return true -} - -fun case4() { - - operator fun CharSequence.contains(regex: Regex): Boolean { - println("my local contains") - return true - } - - fun subfun() { - - operator fun CharSequence.contains(regex: Regex): Boolean { - println("my local contains") - return true - } - - val regex = Regex("") - "" contains regex - - } -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/1.2.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/1.2.kt index bb44eb5a6d1..5dc85c02bb0 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/1.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/1.2.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/1.3.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/1.3.fir.kt deleted file mode 100644 index 796b41a6103..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/1.3.fir.kt +++ /dev/null @@ -1,48 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -// SKIP_TXT - -// FILE: Extensions1.kt -package libPackage - -operator fun CharSequence.contains(regex: Regex): Boolean { - println("my contains") - return true -} -// FILE: Extensions2.kt - -package sentence3 - -operator fun CharSequence.contains(regex: Regex): Boolean { - println("my package scope contains") - return true -} - -// FILE: TestCase1.kt -// TESTCASE NUMBER: 1 - -package sentence3 -import libPackage.contains - - -fun case1() { - val regex = Regex("") - "" contains regex -} - -// FILE: TestCase2.kt -// TESTCASE NUMBER: 2 - -package sentence3 -import libPackage.contains - - -fun case2() { - operator fun CharSequence.contains(regex: Regex): Boolean { - println("my local contains") - return true - } - - val regex = Regex("") - "" contains regex -} - diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/1.3.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/1.3.kt index 0289f1c0e41..cd4daacedbd 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/1.3.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/1.3.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/1.4.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/1.4.fir.kt deleted file mode 100644 index 52244e0c3d5..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/1.4.fir.kt +++ /dev/null @@ -1,45 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -// SKIP_TXT - -// FILE: Extensions1.kt -package libPackage - - operator fun CharSequence.contains(regex: Regex): Boolean { - println("my contains") - return true -} -// FILE: Extensions2.kt - -package sentence3 - - operator fun CharSequence.contains(regex: Regex): Boolean { - println("my package scope contains") - return true -} - -// FILE: TestCase1.kt -// TESTCASE NUMBER: 1 - -package sentence3 -import libPackage.* - - -fun case1() { - val regex = Regex("") - "" contains regex -} - -// FILE: TestCase2.kt -// TESTCASE NUMBER: 2 -package testPack -import libPackage.* - - operator fun CharSequence.contains(regex: Regex): Boolean { - println("my package scope top level contains") - return true -} - -fun case2() { - val regex = Regex("") - "" contains regex -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/1.4.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/1.4.kt index f4774607753..88f4535198a 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/1.4.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/1.4.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/4.5.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/4.5.fir.kt deleted file mode 100644 index 114b6082441..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/4.5.fir.kt +++ /dev/null @@ -1,20 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -// SKIP_TXT - -// FILE: Extensions.kt -package libPackage - -private infix operator fun CharSequence.contains(regex: Regex): Boolean { - println("my contains") - return true -} - -// FILE: TestCase2.kt -package sentence3 -import libPackage.* //nothing to import, extension is private - -// TESTCASE NUMBER: 1 -fun case1() { - val regex = Regex("") - "" contains regex -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/4.5.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/4.5.kt index e4497234d36..3b4ae493c30 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/4.5.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/4.5.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/pos/4.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/pos/4.1.fir.kt deleted file mode 100644 index c2253b17284..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/pos/4.1.fir.kt +++ /dev/null @@ -1,109 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -// SKIP_TXT - -// TESTCASE NUMBER: 0, 1, 2, 3, 4 -// FILE: Extensions1.kt -package libPackage - -class A() { - infix fun foo(x: Int) = "member fun foo" -} - -// FILE: Extensions2.kt -// TESTCASE NUMBER: 0 - -package sentence3 -import libPackage.A -infix fun A.foo(x: Int) = "pack scope extension fun foo" - -// FILE: TestCase1.kt -// TESTCASE NUMBER: 1 - -package sentence3 -import libPackage.A - -class Case1() { - infix fun A.foo(x: Int) = "local extension fun foo" - - fun case1() { - val a = A() - a foo 1 - A() foo 1 - } -} -// FILE: TestCase2.kt -// TESTCASE NUMBER: 2 - -package sentence3 -import libPackage.A - -interface Case2 { - infix fun A.foo(x: Int) = "local extension fun foo" - - fun case2() { - val a = A() - a foo 1 - A() foo 1 - } -} - -// FILE: TestCase3.kt -// TESTCASE NUMBER: 3 -package testPack -import libPackage.A - -infix fun A.foo(x: Int) = "my package scope top level contains" - - -fun case3() { - infix fun A.foo(x: Int) = "my local scope contains" - - val a = A() - a foo 1 - A() foo 1 -} - -// FILE: TestCase4.kt -// TESTCASE NUMBER: 4 -package testPackNew -import libPackage.A - -infix fun A.foo(x: Int) = "my package scope top level contains" - - -fun case4() { - - infix fun A.foo(x: Int) = "my local contains" - - fun subfun() { - infix fun A.foo(x: Int) = "my local contains" - val a = A() - a foo 1 - A() foo 1 - } -} - -// FILE: TestCase5.kt -// TESTCASE NUMBER: 5 -package testPackNew - -class A() { - fun foo(i: Int) {} - infix fun A.foo(i: Int) {} - - fun bar(a: A) { - //todo: add info if function is infix one - a foo 1 - } - - fun buz(a: A){ - fun foo(i: Int) {} - //todo: add info if function is infix one - a foo 1 - } - - fun boo(a: A){ - infix fun A.foo(i: Int) {} - a foo 1 - } -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/pos/4.1.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/pos/4.1.kt index 86a5d942549..f063834253b 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/pos/4.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/pos/4.1.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -EXTENSION_SHADOWED_BY_MEMBER // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/pos/4.3.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/pos/4.3.fir.kt deleted file mode 100644 index d7a6209b7b8..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/pos/4.3.fir.kt +++ /dev/null @@ -1,46 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -// SKIP_TXT - -// FILE: Extensions1.kt -package libPackage - -infix operator fun CharSequence.contains(regex: Regex): Boolean { - println("my contains") - return true -} -// FILE: Extensions2.kt - -package sentence3 - -infix operator fun CharSequence.contains(regex: Regex): Boolean { - println("my package scope contains") - return true -} - -// FILE: TestCase1.kt -// TESTCASE NUMBER: 1 - -package sentence3 -import libPackage.contains - - -fun case1() { - val regex = Regex("") - "" contains regex -} - -// FILE: TestCase2.kt -// TESTCASE NUMBER: 2 - -package sentence3 -import libPackage.contains - - -fun case2() { - infix operator fun CharSequence.contains(regex: Regex): Boolean { - println("my local contains") - return true - } - val regex = Regex("") - "" contains regex -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/pos/4.3.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/pos/4.3.kt index ef71ac80c1d..941e0e939dd 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/pos/4.3.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/pos/4.3.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/neg/2.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/neg/2.1.fir.kt index d5c40ff6212..3c370bbbd84 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/neg/2.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/neg/2.1.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-448 + * MAIN LINK: overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 1 -> sentence 2 + * PRIMARY LINKS: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: call with lambda as argument + */ // FILE: TestCase1.kt /* diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/neg/2.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/neg/2.2.fir.kt index 50c4ebb4b36..3b5897315d5 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/neg/2.2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/neg/2.2.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-448 + * MAIN LINK: overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 1 -> sentence 2 + * PRIMARY LINKS: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 1 + * NUMBER: 2 + * DESCRIPTION: plusAssign as inline function + */ // FILE: TestCase1.kt /* diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/neg/2.5.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/neg/2.5.fir.kt index c5a74d36c71..62d45575c09 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/neg/2.5.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/neg/2.5.fir.kt @@ -1,6 +1,17 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-448 + * MAIN LINK: overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 1 -> sentence 2 + * PRIMARY LINKS: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 1 + * NUMBER: 5 + * DESCRIPTION: inline plusAssign functions + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-39819 + */ // TESTCASE NUMBER: 1 // FILE: TestCase1.kt diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/neg/2.6.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/neg/2.6.fir.kt index 0f326859055..ebad6dfe6dc 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/neg/2.6.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/neg/2.6.fir.kt @@ -1,6 +1,17 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-448 + * MAIN LINK: overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 1 -> sentence 2 + * PRIMARY LINKS: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 1 + * NUMBER: 6 + * DESCRIPTION: without inline plusAssign functions + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-39820 + */ // FILE: TestCase1.kt diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/neg/2.7.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/neg/2.7.fir.kt index 8daa6024a47..0024797553b 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/neg/2.7.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/neg/2.7.fir.kt @@ -1,6 +1,17 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-448 + * MAIN LINK: overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 1 -> sentence 2 + * PRIMARY LINKS: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 1 + * NUMBER: 7 + * DESCRIPTION: without inline plusAssign functions + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-39820 + */ // FILE: TestCase1.kt diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/neg/2.8.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/neg/2.8.fir.kt index b88d3c68012..89fd02accf2 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/neg/2.8.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/neg/2.8.fir.kt @@ -1,6 +1,17 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-448 + * MAIN LINK: overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 1 -> sentence 2 + * PRIMARY LINKS: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 1 + * NUMBER: 8 + * DESCRIPTION: without inline plusAssign functions + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-39820 + */ // FILE: TestCase1.kt diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/neg/2.9.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/neg/2.9.fir.kt index d048d73efea..a5e87bed0f9 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/neg/2.9.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/neg/2.9.fir.kt @@ -1,6 +1,16 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-448 + * MAIN LINK: overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 1 -> sentence 2 + * PRIMARY LINKS: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 1 + * overload-resolution, determining-function-applicability-for-a-specific-call, description -> paragraph 2 -> sentence 2 + * NUMBER: 9 + * DESCRIPTION: without inline plusAssign functions + */ // FILE: TestCase1.kt diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/pos/2.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/pos/2.1.fir.kt deleted file mode 100644 index 7bdee51a08a..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/pos/2.1.fir.kt +++ /dev/null @@ -1,35 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -// SKIP_TXT - - -// FILE: LibCase1b.kt -// TESTCASE NUMBER: 1 -package LibPackCase1.b - -import testPackCase1.B -import LibPackCase1.a.* - -inline operator fun B?.plusAssign( c: ()->C) { //(2) - val x = {1} - this += x //to (1) - this += x -} - -class C - -// FILE: TestCase1.kt -package testPackCase1 - -import LibPackCase1.a.* -import LibPackCase1.b.* - -class B { - private inline operator fun plusAssign(crossinline c: ()->C) {} - private inline operator fun plus(crossinline c: ()->C): C =C() -} - -// FILE: LibCase1a.kt -package LibPackCase1.a -import testPackCase1.B - -inline operator fun B?.plusAssign( c: ()->Int) { } //(1) diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/pos/2.1.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/pos/2.1.kt index 56beea31c85..f684ee3a49a 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/pos/2.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/pos/2.1.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/pos/2.3.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/pos/2.3.fir.kt deleted file mode 100644 index fd8fca835a4..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/pos/2.3.fir.kt +++ /dev/null @@ -1,114 +0,0 @@ -// !DIAGNOSTICS: -UNNECESSARY_SAFE_CALL -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -// SKIP_TXT - - -// FILE: TestCase1.kt -// TESTCASE NUMBER: 1 -package testPackCase1 - -fun case1(a: A, c: C) { - a?.b .plusAssign(c) - - val x = { - a?.b.plusAssign(c) - }() - - a?.b.plusAssign({ c }()) -} - -class A(val b: B) - -class B { - operator fun plusAssign(c: C) { - print("1") - } - - operator fun plus(c: C): C { - print("2") - return c - } -} - -class C - -// FILE: TestCase2.kt -// TESTCASE NUMBER: 2 -package testPackCase2 - -fun case2(a: A?, c: C) { - - a?.b += c - a?.b.plusAssign(c) - - val x = { - a?.b += c - a?.b.plusAssign(c) - }() - - a?.b += { c }() - - a?.b.plusAssign({ c }()) - -} - -class A(val b: B) - -class B { - operator fun plusAssign(c: C) { - print("1") - } - - operator fun plus(c: C): C { - print("2") - return c - } -} - -operator fun B?.plusAssign(c: C) { - print("3") -} - -class C -// FILE: TestCase3.kt -// TESTCASE NUMBER: 3 -package testPackCase3 - -fun case3(a: A?, c: C) { - - a?.b += c - a?.b.plusAssign(c) - - val x = { - a?.b += c - a?.b.plusAssign(c) - }() - - a?.b += { c }() - - a?.b.plusAssign({ c }()) - -} - -class A(val b: B) - -class B { - operator fun plusAssign(c: C) { - print("1") - } - - operator fun plus(c: C): C { - print("2") - return c - } -} - -operator fun B?.plusAssign(c: C) { - print("3") -} - -operator fun B?.plusAssign(c: Any) { - print("4") -} - - -class C diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/pos/2.3.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/pos/2.3.kt index d31bf895c60..f7f1281d6f9 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/pos/2.3.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/pos/2.3.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNNECESSARY_SAFE_CALL -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-2/pos/3.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-2/pos/3.2.fir.kt index 32589007141..f54e463ec6d 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-2/pos/3.2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-2/pos/3.2.fir.kt @@ -1,5 +1,4 @@ -// FIR_IDENTICAL -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -EXTENSION_SHADOWED_BY_MEMBER +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT /* @@ -7,18 +6,16 @@ * * SPEC VERSION: 0.1-268 * MAIN LINK: overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 2 -> sentence 3 - * PRIMARY LINKS: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 1 + * PRIMARY LINKS: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 2 * overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 4 -> sentence 1 - * NUMBER: 1 + * NUMBER: 2 * DESCRIPTION: Non-extension member callables */ -// FILE: LibCase1.kt -// TESTCASE NUMBER: 1, 2 -// TESTCASE NUMBER: 1, 2 +// FILE: LibCase11.kt +// TESTCASE NUMBER: 1 package libPackage - import testPackCase1.Case import testPackCase1.Case.Inv import testPackCase1.Case.E @@ -28,61 +25,61 @@ operator fun Case.E.plus(value: Int) = Inv() operator fun Case.Inv.invoke(i: Int) = 1 -// FILE: TestCase1.kt -// TESTCASE NUMBER: 1, 2 +// FILE: TestCase11.kt +// TESTCASE NUMBER: 1 package testPackCase1 import libPackage.plus import libPackage.* import libPackage.invoke - class Case() { class E(val plus: Inv? = null) { - operator fun plus(value: Int) = Case() + /*operator*/ fun plus(value: Int) = Case() } class Inv() { - operator fun invoke(value: Int) = Case() + /*operator*/ fun invoke(value: Int) = Case() } fun foo(e: E) { operator fun E.plus(value: Int) = Case() run { - e+1 + e + 1 } - e+1 - e.plus(1) - e.plus?.invoke(1) //ok + e + 1 + } } -// FILE: LibCase3.kt -// TESTCASE NUMBER: 3, 4 +// FILE: LibCase12.kt +// TESTCASE NUMBER: 2 package libPackage -import testPackCase3.Case -import testPackCase3.Case.Inv -import testPackCase3.Case.E +import testPackCase2.Case +import testPackCase2.Case.Inv +import testPackCase2.Case.E -operator fun Case.E.plus(value: Int) = Inv() +operator fun Case.E.plus(value: Int) = Inv() operator fun Case.Inv.invoke(i: Int) = 1 -// FILE: TestCase3.kt -// TESTCASE NUMBER: 3, 4 -package testPackCase3 +// FILE: TestCase12.kt +// TESTCASE NUMBER: 2 +package testPackCase2 import libPackage.plus import libPackage.* import libPackage.invoke +operator fun Case.E.plus(value: Int) = Case() + class Case() { class E(val plus: Inv? = null) { - operator fun plus(value: Int) = Case() + /*operator*/ fun plus(value: Int) = Case() } class Inv() { - operator fun invoke(value: Int) = Case() + /*operator*/ fun invoke(value: Int) = Case() } fun foo(e: E) { @@ -91,89 +88,79 @@ class Case() { run { operator fun E.plus(value: Int) = Case() - e+1 + e + 1 } - e+1 - } - fun boo(e: E) { - /*operator*/ fun E.plus(value: Int) = Case() - - run { - /*operator*/ fun E.plus(value: Int) = Case() - - e+1 - } - e+1 + e + 1 } } -// FILE: LibCase5.kt -// TESTCASE NUMBER: 5, 6 +// FILE: LibCase3.kt +// TESTCASE NUMBER: 3 package libPackage - -import testPackCase5.Case -import testPackCase5.Case.Inv -import testPackCase5.Case.E +import testPackCase3.Case +import testPackCase3.Case.Inv +import testPackCase3.Case.E operator fun Case.E.plusAssign(value: Int) {} operator fun Case.Inv.invoke(i: Int) {} -// FILE: TestCase6.kt -// TESTCASE NUMBER: 5, 6 -package testPackCase5 +// FILE: TestCase3.kt +// TESTCASE NUMBER: 3 +package testPackCase3 import libPackage.plusAssign -import libPackage.* import libPackage.invoke - +import libPackage.* class Case() { class E(val plusAssign: Inv? = null) { - operator fun plusAssign(value: Int) {} + /*operator*/ fun plusAssign(value: Int) {} } class Inv() { - operator fun invoke(value: Int) {} + /*operator*/ fun invoke(value: Int) {} } fun foo(e: E) { - operator fun Case.E.plusAssign(value: Int) {} + operator fun E.plusAssign(value: Int) {} run { - e+=1 + e += 1 } - e+=1 - e.plusAssign(1) - e.plusAssign?.invoke(1) //ok + e += 1 + } } -// FILE: LibCase7.kt -// TESTCASE NUMBER: 7, 8 +// FILE: LibCase4.kt +// TESTCASE NUMBER: 4 package libPackage -import testPackCase8.Case -import testPackCase8.Case.Inv -import testPackCase8.Case.E +import testPackCase4.Case +import testPackCase4.Case.Inv +import testPackCase4.Case.E operator fun Case.E.plusAssign(value: Int) {} operator fun Case.Inv.invoke(i: Int) {} -// FILE: TestCase8.kt -// TESTCASE NUMBER: 7, 8 -package testPackCase8 + +// FILE: TestCase4.kt +// TESTCASE NUMBER: 4 +package testPackCase4 import libPackage.plusAssign import libPackage.* import libPackage.invoke +operator fun Case.E.plusAssign(value: Int) {} + class Case() { class E(val plusAssign: Inv? = null) { - operator fun plusAssign(value: Int) {} + /*operator*/ fun plusAssign(value: Int) {} } class Inv() { - operator fun invoke(value: Int) {} + /*operator*/ fun invoke(value: Int) {} } fun foo(e: E) { @@ -182,60 +169,48 @@ class Case() { run { operator fun E.plusAssign(value: Int) {} - e+=1 + e += 1 } - e+=1 - } - fun boo(e: E) { - /*operator*/ fun E.plusAssign(value: Int) {} - - run { - /*operator*/ fun E.plusAssign(value: Int) {} - - e+=1 - } - e+=1 + e += 1 } } -// FILE: LibCase9.kt -// TESTCASE NUMBER: 9, 10 -package libPackage -import testPackCase10.Iterable -import testPackCase10.Inv +// FILE: TestCase5.kt +/* + * TESTCASE NUMBER: 5 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-36996 + */ +package testPackCase5 +import kotlin.reflect.KProperty -operator fun Iterable.iterator() : CharIterator = TODO() -operator fun Inv.invoke() {} +class Delegate { + /*operator*/ fun getValue(thisRef: Any?, property: KProperty<*>): String { + return "" + } -// FILE: TestCase10.kt -// TESTCASE NUMBER: 9, 10 -package testPackCase10 -import libPackage.iterator -import libPackage.invoke - -class Iterable(iterator: Inv) { - operator fun iterator() : CharIterator = TODO() + /*operator*/ fun setValue(thisRef: Any?, property: KProperty<*>, value: String) { + } } -class Inv(val c: Char) { - operator fun invoke(): CharIterator = TODO() +operator fun Delegate.getValue(thisRef: Any?, property: KProperty<*>): String { + return "" } +operator fun Delegate.setValue(thisRef: Any?, property: KProperty<*>, value: String) {} -operator fun Iterable.iterator() : CharIterator = TODO() +fun case() { + class Test { + var p: String by Delegate() -fun case(){ - operator fun Iterable.iterator() : CharIterator = TODO() - val iterable: Iterable = Iterable(Inv('c')) - - fun foo(){ - iterable.iterator() - for (i in iterable) { - println(i) + operator fun Delegate.getValue(thisRef: Any?, property: KProperty<*>): String { + return "" + } + operator fun Delegate.setValue(thisRef: Any?, property: KProperty<*>, value: String) { } } - iterable.iterator() - for (i in iterable) { - println(i) - } + val test = Test() + test.p = "NEW" + val x = test.p + } diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-4/neg/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-4/neg/1.1.fir.kt index d96c5005b08..c2d4fff0462 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-4/neg/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-4/neg/1.1.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-268 + * MAIN LINK: overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 4 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: properties available through the invoke convention are non-eligible for operator calls + */ + // FILE: TestCase1.kt /* * TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-4/pos/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-4/pos/1.1.fir.kt index 4f5a9381985..0fb22161b71 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-4/pos/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-4/pos/1.1.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-268 + * MAIN LINK: overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 4 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: properties available through the invoke convention are non-eligible for operator calls + */ + // FILE: TestCase1.kt /* * TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/1.1.fir.kt deleted file mode 100644 index 33044ab1f35..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/1.1.fir.kt +++ /dev/null @@ -1,30 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -// SKIP_TXT - - -// FILE: TestCase1.kt -// TESTCASE NUMBER: 1 -package testPackCase1 - -import testPackCase1.I2.Companion.foo -import testPackCase1.I1.Companion.foo - -class Case2() : I2, I1{ - - fun test(){ - foo(1) - foo(1) - } -} - -interface I2{ - companion object { - fun foo(x: Int): Unit = print(1) // (1) - } -} - -interface I1{ - companion object { - fun foo(x: Int): String = "print(2)" // (2) - } -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/1.1.kt index 9932b7a11c3..58fb90243de 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/1.1.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/1.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/1.2.fir.kt deleted file mode 100644 index 01b94ed5a3b..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/1.2.fir.kt +++ /dev/null @@ -1,42 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -// SKIP_TXT - - -// FILE: TestCase1.kt -// TESTCASE NUMBER: 1 -package testPackCase1 - -import testPackCase1.I2.Companion.foo -import testPackCase1.I1.Companion.foo - -class Case2() : I2, I1, I3 { - - fun test() { - foo(1) // resolved to (2) - foo(1) - } -} - -interface I2 { - companion object { - fun foo(x: Int): Unit = print(1) // (1) - } -} - -interface I1 { - companion object { - fun foo(x: Int): String = "print(2)" // (2) - } -} - -interface I3 { - companion object { - fun foo(x: Short): Unit = print(3) // (3) - } -} - -interface I4 { - companion object { - fun foo(x: Any): Unit = print(4) // (4) - } -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/1.2.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/1.2.kt index 80bfab247ec..ebc7eee5ee4 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/1.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/1.2.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.1.fir.kt index 0e0d39ad12b..2bdf5eeb228 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.1.fir.kt @@ -1,6 +1,18 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-387 + * MAIN LINK: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 11 -> sentence 4 + * PRIMARY LINKS: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 1 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 3 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 11 -> sentence 4 + * built-in-types-and-their-semantics, built-in-integer-types-1, integer-type-widening -> paragraph 3 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: call with explicit receiver: different built-in integer types and one of them is kotlin.Int + */ // TESTCASE NUMBER: 1 class Case1 diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.2.fir.kt index 81b291c1cb8..c1070686e00 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.2.fir.kt @@ -1,6 +1,18 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-387 + * MAIN LINK: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 11 -> sentence 4 + * PRIMARY LINKS: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 1 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 3 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 11 -> sentence 4 + * built-in-types-and-their-semantics, built-in-integer-types-1, integer-type-widening -> paragraph 3 -> sentence 1 + * NUMBER: 2 + * DESCRIPTION: call with explicit receiver (built-in integer types extesnsion): different built-in integer types and one of them is kotlin.Int + */ // FILE: TestCase11.kt // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.3.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.3.fir.kt index df3672b17a1..39f157f8941 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.3.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.3.fir.kt @@ -1,6 +1,18 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-387 + * MAIN LINK: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 11 -> sentence 4 + * PRIMARY LINKS: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 1 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 3 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 11 -> sentence 4 + * built-in-types-and-their-semantics, built-in-integer-types-1, integer-type-widening -> paragraph 3 -> sentence 1 + * NUMBER: 3 + * DESCRIPTION: call with implicit receiver: different built-in integer types and one of them is kotlin.Int + */ // TESTCASE NUMBER: 1 class Case1 diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.4.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.4.fir.kt index 1c275829b95..b5f734b2e50 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.4.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.4.fir.kt @@ -1,6 +1,18 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-387 + * MAIN LINK: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 11 -> sentence 4 + * PRIMARY LINKS: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 1 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 3 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 11 -> sentence 4 + * built-in-types-and-their-semantics, built-in-integer-types-1, integer-type-widening -> paragraph 3 -> sentence 1 + * NUMBER: 4 + * DESCRIPTION: call with implicit receiver (built-in integer types extesnsion): different built-in integer types and one of them is kotlin.Int + */ // FILE: TestCase1.kt // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.5.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.5.fir.kt index 3d33412f547..f5d3022b542 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.5.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.5.fir.kt @@ -1,6 +1,19 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-387 + * MAIN LINK: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 11 -> sentence 4 + * PRIMARY LINKS: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 1 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 3 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 11 -> sentence 4 + * built-in-types-and-their-semantics, built-in-integer-types-1, integer-type-widening -> paragraph 3 -> sentence 1 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 7 -> sentence 3 + * NUMBER: 5 + * DESCRIPTION: call with explicit receiver + */ // TESTCASE NUMBER: 5 class Case5 { diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/5.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/5.1.fir.kt deleted file mode 100644 index 675e91bb849..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/5.1.fir.kt +++ /dev/null @@ -1,24 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -// SKIP_TXT - - -// TESTCASE NUMBER: 1 -class Case1() { - fun foo(y: Int, x: Int): String = TODO() // (1.1) - fun foo(vararg x: Int): Unit = TODO() // (1.2) - - fun case(){ - foo(1, 1) - foo(1, 1) - } -} -// TESTCASE NUMBER: 2 -class Case2() { - fun foo(y: Any?, x: Any?): String = TODO() // (1.1) - fun foo(vararg x: Any?): Unit = TODO() // (1.2) - - fun case(){ - foo(1, 1) - foo(1, 1) - } -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/5.1.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/5.1.kt index 18caf2b7e7a..cca240e49f0 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/5.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/5.1.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.1.fir.kt index 8a2e5f8b86a..b9653304ad1 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.1.fir.kt @@ -1,6 +1,17 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-387 + * MAIN LINK: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 12 -> sentence 2 + * PRIMARY LINKS: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 1 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 3 + * built-in-types-and-their-semantics, built-in-integer-types-1, integer-type-widening -> paragraph 3 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: call with explicit receiver: different built-in integer types and one of them is kotlin.Int + */ // TESTCASE NUMBER: 1 class Case1 diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.2.fir.kt index 9ee6cd4ccae..acf3a6072fa 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.2.fir.kt @@ -1,6 +1,17 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-387 + * MAIN LINK: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 12 -> sentence 2 + * PRIMARY LINKS: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 1 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 3 + * built-in-types-and-their-semantics, built-in-integer-types-1, integer-type-widening -> paragraph 3 -> sentence 1 + * NUMBER: 2 + * DESCRIPTION: call with explicit receiver (built-in integer types extesnsion): different built-in integer types and one of them is kotlin.Int + */ // FILE: TestCase11.kt // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.3.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.3.fir.kt deleted file mode 100644 index 279e69f937b..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.3.fir.kt +++ /dev/null @@ -1,86 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -// SKIP_TXT - - -// TESTCASE NUMBER: 1 -class Case1 - -fun case1(case: Case1) { - case.apply { - //to (1.1) - boo(1) - //(1.1) return type is String - boo(1) - //to (1.1) - boo(x = 1) - //(1.1) return type is String - boo(x = 1) - } -} - -fun Case1.boo(x: Int): String = TODO() //(1.1) -fun Case1.boo(x: Long): Unit = TODO() //(1.2) -fun Case1.boo(x: Short): Unit = TODO() //(1.3) -fun Case1.boo(x: Byte): Unit = TODO() //(1.4) - -// TESTCASE NUMBER: 2 -class Case2 { - fun boo(x: Int, y: Int): String = TODO() //(1.1) - fun boo(x: Long, y: Int): Unit = TODO() //(1.2) - fun boo(x: Short, y: Int): Unit = TODO() //(1.3) - fun boo(x: Byte, y: Int): Unit = TODO() //(1.4) -} - -fun case2(case: Case2) { - case.apply { - //to (1.1) - boo(1, 2) - //(1.1) return type is String - boo(1, 2) - //to (1.1) - boo(x = 1, y = 2) - //(1.1) return type is String - boo(x = 1, y = 2) - } -} - -// TESTCASE NUMBER: 3 -class Case3 { - fun boo(x: Int, y: Int): String = TODO() //(1.1) - fun boo(x: Int, y: Short): Unit = TODO() //(1.2) -} - -fun case3(case: Case3) { - case.apply { - //to (1.1) - boo(1, 2) - //(1.1) return type is String - boo(1, 2) - //to (1.1) - boo(x = 1, y = 2) - //(1.1) return type is String - boo(x = 1, y = 2) - } -} - - -// TESTCASE NUMBER: 4 -class Case4 { - operator fun minus(x: Int): String = TODO() //(1.1) - operator fun minus(x: Long): Unit = TODO() //(1.2) - operator fun minus(x: Short): Unit = TODO() //(1.3) - operator fun minus(x: Byte): Unit = TODO() //(1.4) -} - -fun case4(case: Case4) { - case.apply { - //to (1.1) - minus(1) - //(1.1) return type is String - minus(1) - //to (1.1) - this - 1 - //(1.1) return type is String - this - 1 - } -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.3.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.3.kt index 887750054bb..38d0c3fecd3 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.3.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.3.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.4.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.4.fir.kt deleted file mode 100644 index 1bc1d334880..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.4.fir.kt +++ /dev/null @@ -1,74 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -// SKIP_TXT - - -// FILE: TestCase1.kt -// TESTCASE NUMBER: 1 -package testPackCase1 -private fun Int.boo(x: Int): String = TODO() //(1.1) -private fun Int.boo(x: Long): Unit = TODO() //(1.2) -private fun Int.boo(x: Short): Unit = TODO() //(1.3) -private fun Int.boo(x: Byte): Unit = TODO() //(1.4) - -fun case1() { - 1.apply { - //to (1.1) - boo(1) - //(1.1) return type is String - boo(1) - //to (1.1) - boo(x = 1) - //(1.1) return type is String - boo(x = 1) - } -} - - -// FILE: TestCase2.kt -// TESTCASE NUMBER: 2 -package testPackCase2 - -class Case2 { - private fun Int.boo(x: Int, y: Int): String = TODO() //(1.1) - private fun Short.boo(x: Int, y: Int): Unit = TODO() //(1.2) - private fun Long.boo(x: Int, y: Int): Unit = TODO() //(1.3) - private fun Byte.boo(x: Int, y: Int): Unit = TODO() //(1.4) - - fun case2() { - 1.apply { - //to (1.1) - boo(1, 2) - //(1.1) return type is String - boo(1, 2) - //to (1.1) - boo(x = 1, y = 2) - //(1.1) return type is String - boo(x = 1, y = 2) - } - } -} - - - - -// FILE: TestCase4.kt -// TESTCASE NUMBER: 4 -package testPackCase4 - -private operator fun Int.minus(x: String): String = TODO() //(1.1) -private operator fun Short.minus(x: String): Unit = TODO() //(1.2) -private operator fun Byte.minus(x: String): Unit = TODO() //(1.3) -private operator fun Long.minus(x: String): Unit = TODO() //(1.4) - -fun case4() { - 1.apply { - //to (1.1) - minus("1") - //(1.1) return type is String - minus("1") - //to (1.1) - this-"1" - //(1.1) return type is String - this-"1" - } -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.4.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.4.kt index 1cd083148d2..7447abbc246 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.4.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.4.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.5.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.5.fir.kt index f939b6fb066..57e96a57213 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.5.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.5.fir.kt @@ -1,6 +1,17 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-387 + * MAIN LINK: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 12 -> sentence 2 + * PRIMARY LINKS: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 1 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 3 + * built-in-types-and-their-semantics, built-in-integer-types-1, integer-type-widening -> paragraph 3 -> sentence 1 + * NUMBER: 5 + * DESCRIPTION: infix call: different built-in integer types and one of them is kotlin.Int + */ // TESTCASE NUMBER: 1 class Case1{ diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.6.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.6.fir.kt index 4f5325def2e..3c42b212b6c 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.6.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.6.fir.kt @@ -1,6 +1,17 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-387 + * MAIN LINK: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 12 -> sentence 2 + * PRIMARY LINKS: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 1 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 3 + * built-in-types-and-their-semantics, built-in-integer-types-1, integer-type-widening -> paragraph 3 -> sentence 1 + * NUMBER: 6 + * DESCRIPTION: infix call (built-in integer types extesnsion): different built-in integer types and one of them is kotlin.Int + */ // TESTCASE NUMBER: 1 class Case1{ diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.7.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.7.fir.kt index 4b01347b98e..a515f119f5f 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.7.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.7.fir.kt @@ -1,6 +1,19 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-387 + * MAIN LINK: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 12 -> sentence 2 + * PRIMARY LINKS: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 1 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 3 + * built-in-types-and-their-semantics, built-in-integer-types-1, integer-type-widening -> paragraph 3 -> sentence 1 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 17 -> sentence 1 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 17 -> sentence 3 + * NUMBER: 7 + * DESCRIPTION: different built-in integer types and one of them is kotlin.Int + */ // FILE: TestCase1.kt diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.1.fir.kt deleted file mode 100644 index 6c244becb75..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.1.fir.kt +++ /dev/null @@ -1,64 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -// SKIP_TXT - -// TESTCASE NUMBER: 1 -class Case1() { - fun foo(x: Int, y: Number?): Unit = TODO() // (1) - fun foo(vararg x: Short): Unit = TODO()//(2) - - fun testcase() { - foo(1, 1) - } -} - -// TESTCASE NUMBER: 2 -class Case2() { - fun foo(y: Any, x: Any): Unit = TODO() // (1.1) - fun foo(vararg x: Int?): Unit = TODO() // (1.2) - - fun case(){ - foo(1, 1) - } -} -// TESTCASE NUMBER: 3 -class Case3() { - fun foo(y: Any, x: Any): Unit = TODO() // (1.1) - fun foo(vararg x: Int?): Unit = TODO() // (1.2) - - fun case(){ - foo(1, 1) - } -} - -// TESTCASE NUMBER: 4 -class Case4() { - fun foo(y: Int, x: Short): Unit = TODO() // (1.1) - fun foo(y: Int, x: Long): Unit = TODO() // (1.2) - - fun case(){ - foo(1, 1) - } -} - - -// TESTCASE NUMBER: 5 -class Case5() { - fun foo(y: Int, x: Short): Unit = TODO() // (1.1) - fun foo(y: Int, x: Long, a : Any =""): Unit = TODO() // (1.2) - - fun case(){ - foo(1, 1) - foo(1, 1) - } -} - -// TESTCASE NUMBER: 6 - -class A : B, C -interface B -interface C -fun foo(x: B) {} //(1) -fun foo(y: C, z: String = "foo") {} //2 -fun bar() { - foo(A()) //OVERLOAD_RESOLUTION_AMBIGUITY -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.1.kt index b89eb4645bf..cfe347626d6 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.1.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.2.fir.kt deleted file mode 100644 index 8ef337d0e8e..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.2.fir.kt +++ /dev/null @@ -1,14 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -// SKIP_TXT - - -// TESTCASE NUMBER: 6 -// NOTE: todo link new sentences -class A : B, C -interface B -interface C -fun foo(x: B) {} //(1) -fun foo(y: C, z: String = "foo") {} //2 -fun bar() { - foo(A()) //OVERLOAD_RESOLUTION_AMBIGUITY -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.2.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.2.kt index 0632bcd8505..10f9a212207 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.2.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.3.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.3.fir.kt deleted file mode 100644 index e9099b6d312..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.3.fir.kt +++ /dev/null @@ -1,55 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -// SKIP_TXT - - -// FILE: TestCase1.kt -// TESTCASE NUMBER: 1 -package testPackCase1 - -import testPackCase1.I2.Companion.foo -import testPackCase1.I1.Companion.foo - -class Case2() : I2, I1{ - - fun test(){ - foo(1) - } -} - -interface I2{ - companion object { - fun foo(x: Int): Unit = print(1) // (1) - } -} - -interface I1{ - companion object { - fun foo(x: Int): String = "print(2)" // (2) - } -} - -// FILE: TestCase2.kt -// TESTCASE NUMBER: 2 -package testPackCase2 - -import testPackCase2.I2.Companion.foo -import testPackCase2.I1.Companion.foo - -class Case2() : I2, I1{ - - fun test(){ - foo(1) - } -} - -interface I2{ - companion object { - fun foo(x: Int): Unit = print(1) // (1) - } -} - -interface I1{ - companion object { - fun foo(x: Int): String = "print(2)" // (2) - } -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.3.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.3.kt index 5137f3c4871..f5114c85200 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.3.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.3.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.4.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.4.fir.kt deleted file mode 100644 index 63aa2383257..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.4.fir.kt +++ /dev/null @@ -1,43 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -// SKIP_TXT - - -// FILE: TestCase1.kt -// TESTCASE NUMBER: 1 -package testPackCase1 - -import testPackCase1.I2.Companion.foo -import testPackCase1.I1.Companion.foo -import testPackCase1.I3.Companion.foo -import testPackCase1.I4.Companion.foo - -class Case1() : I2, I1, I3, I4 { - - fun test() { - foo(1) - } -} - -interface I2 { - companion object { - fun foo(x: Int): Unit = print(1) // (1) - } -} - -interface I1 { - companion object { - fun foo(x: Int): String = "print(2)" // (2) - } -} - -interface I3 { - companion object { - fun foo(x: Short): Unit = print(3) // (3) - } -} - -interface I4 { - companion object { - fun foo(x: Int): Unit = print(4) // (4) - } -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.4.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.4.kt index 3c2ad1647f0..b5970d25c98 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.4.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.4.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.5.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.5.fir.kt deleted file mode 100644 index e0e7c74f189..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.5.fir.kt +++ /dev/null @@ -1,47 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -// SKIP_TXT - - -// FILE: TestCase1.kt -/* - * TESTCASE NUMBER: 1 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-38912 - */ -package testPackCase1 - -import testPackCase1.I2.Companion.foo -import testPackCase1.I1.Companion.foo -import testPackCase1.I3.Companion.foo -import testPackCase1.I4.Companion.foo - -class Case1() : I2, I1, I3, I4 { - - fun test() { - foo(1) - } -} - -interface I2 { - companion object { - fun foo(x: Int): Unit = print(1) // (1) - } -} - -interface I1 { - companion object { - fun foo(x: Int, y: Any = ""): String = "print(2)" // (2) - } -} - -interface I3 { - companion object { - fun foo(x: Short): Unit = print(3) // (3) - } -} - -interface I4 { - companion object { - fun foo(x: Int, y: Any = ""): Unit = print(4) // (4) - } -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.5.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.5.kt index d7e575f5d06..910daaf551c 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.5.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.5.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.6.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.6.fir.kt deleted file mode 100644 index e72b9caf02d..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.6.fir.kt +++ /dev/null @@ -1,43 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -// SKIP_TXT - - -// FILE: TestCase1.kt -// TESTCASE NUMBER: 1 -package testPackCase1 - -import testPackCase1.I2.Companion.foo -import testPackCase1.I1.Companion.foo -import testPackCase1.I3.Companion.foo -import testPackCase1.I4.Companion.foo - -class Case1() : I2, I1, I3, I4 { - - fun test() { - foo(1) - } -} - -interface I2 { - companion object { - fun foo(x: Int, y: Any): Unit = print(1) // (1) - } -} - -interface I1 { - companion object { - fun foo(x: Int, z: Any = "", vararg y: Any): String = "print(2)" // (2) - } -} - -interface I3 { - companion object { - fun foo(x: Short, z: Any = "", vararg y: Any): Unit = print(3) // (3) - } -} - -interface I4 { - companion object { - fun foo(x: Int, z: Any = "", vararg y: Any): Unit = print(4) // (4) - } -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.6.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.6.kt index 64f53a9bbd7..ed981419679 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.6.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.6.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.7.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.7.fir.kt deleted file mode 100644 index 32478fd2649..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.7.fir.kt +++ /dev/null @@ -1,43 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -// SKIP_TXT - - -// FILE: TestCase1.kt -// TESTCASE NUMBER: 1 -package testPackCase1 - -import testPackCase1.I2.Companion.foo -import testPackCase1.I1.Companion.foo -import testPackCase1.I3.Companion.foo -import testPackCase1.I4.Companion.foo - -class Case1() : I2, I1, I3, I4 { - - fun test() { - foo(1) - } -} - -interface I2 { - companion object { - fun foo(x: Int, y: Any): Unit = print(1) // (1) - } -} - -interface I1 { - companion object { - fun foo(x: Int, vararg y: Any): String = "print(2)" // (2) - } -} - -interface I3 { - companion object { - fun foo(x: Short, vararg y: Any): Unit = print(3) // (3) - } -} - -interface I4 { - companion object { - fun foo(x: Int, vararg y: Any): Unit = print(4) // (4) - } -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.7.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.7.kt index 3f4c5e9ac5a..16327976a87 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.7.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.7.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-17/neg/2.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-17/neg/2.1.fir.kt index 5fcf17c51c3..e9356469300 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-17/neg/2.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-17/neg/2.1.fir.kt @@ -1,6 +1,14 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-387 + * MAIN LINK: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 17 -> sentence 2 + * NUMBER: 1 + * DESCRIPTION: If several properties are equally applicable, this is an overload ambiguity as usual + */ // FILE: TestCase1.kt /* * TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-17/neg/2.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-17/neg/2.2.fir.kt index 953ec86cf2a..0fce6d87c19 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-17/neg/2.2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-17/neg/2.2.fir.kt @@ -1,6 +1,14 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-387 + * MAIN LINK: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 17 -> sentence 2 + * NUMBER: 2 + * DESCRIPTION: If several properties are equally applicable, this is an overload ambiguity as usual (both are parametrized) + */ // FILE: TestCase1.kt /* * TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-3/pos/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-3/pos/1.1.fir.kt deleted file mode 100644 index 98163267850..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-3/pos/1.1.fir.kt +++ /dev/null @@ -1,36 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -// SKIP_TXT - - -// TESTCASE NUMBER: 1 -class Case1() { - fun foo(x: CharSequence): Unit = TODO() // (3) - fun foo(x: String, z: String = ""): String = TODO() // (4) - - fun case() { - foo("") - foo("") - } -} - -// TESTCASE NUMBER: 2 -class Case2() { - fun foo(y: Any?, x: Any?): Unit = TODO() // (1.1) - fun foo(vararg x: Int): String = TODO() // (1.2) - - fun case() { - foo(1, 1) - foo(1, 1) - } -} - -// TESTCASE NUMBER: 3 -class Case3() { - fun foo(x: CharSequence, x1: String = ""): Unit = TODO() // (3) - fun foo(x: String, z: Any = ""): String = TODO() // (4) - - fun case() { - foo("") - foo("") - } -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-3/pos/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-3/pos/1.1.kt index af737c69b91..97a0e5de594 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-3/pos/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-3/pos/1.1.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-3/pos/1.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-3/pos/1.2.fir.kt index 49f9a0f1761..68da8c0c3a7 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-3/pos/1.2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-3/pos/1.2.fir.kt @@ -1,6 +1,17 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-387 + * MAIN LINK: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 1 + * PRIMARY LINKS: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 4 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 7 -> sentence 1 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 8 -> sentence 1 + * NUMBER: 2 + * DESCRIPTION: If both X_k and Y_k are built-in integer types, a type constraint Widen(X_k) <:Widen(Y_k) is built + */ // TESTCASE NUMBER: 1 class Case1 { diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-3/pos/1.3.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-3/pos/1.3.fir.kt index 42585770eae..e9fa28c2836 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-3/pos/1.3.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-3/pos/1.3.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-387 + * MAIN LINK: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 1 + * PRIMARY LINKS: built-in-types-and-their-semantics, built-in-integer-types-1, integer-type-widening -> paragraph 3 -> sentence 2 + * NUMBER: 3 + * DESCRIPTION: prefer kotlin.Short to kotlin.Byte. + */ // TESTCASE NUMBER: 1 class Case1() { diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-3/pos/1.4.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-3/pos/1.4.fir.kt index 638d88cf5a4..642a5a9dee5 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-3/pos/1.4.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-3/pos/1.4.fir.kt @@ -1,6 +1,19 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-387 + * MAIN LINK: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 1 + * PRIMARY LINKS: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 4 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 7 -> sentence 1 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 8 -> sentence 1 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 17 -> sentence 1 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 17 -> sentence 3 + * NUMBER: 4 + * DESCRIPTION: for every non-default argument of the call a type constraint is built unless both are built-in integer types (Companion property-like callable) + */ // TESTCASE NUMBER: 1 class Case1() { diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/neg/2.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/neg/2.1.fir.kt deleted file mode 100644 index 9deed170b15..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/neg/2.1.fir.kt +++ /dev/null @@ -1,12 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -// SKIP_TXT - -// TESTCASE NUMBER: 1 -class A : B, C -interface B -interface C -fun foo(x: B) {} //(1) -fun foo(y: C, z: String = "foo") {} //2 -fun case1() { - foo(A()) //OVERLOAD_RESOLUTION_AMBIGUITY -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/neg/2.1.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/neg/2.1.kt index e2e68eb3edc..1a5a3a25fe0 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/neg/2.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/neg/2.1.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/neg/2.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/neg/2.2.fir.kt deleted file mode 100644 index ebc3f32287f..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/neg/2.2.fir.kt +++ /dev/null @@ -1,74 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -// SKIP_TXT - - -// FILE: TestCase1.kt -/* - * TESTCASE NUMBER: 1 - * NOTE: - */ -package testPackCase1 - -import LibPackCase1.a.boo -import LibPackCase1.b.boo - -fun case1 (b: B?){ - b.boo({ C() }) - b.boo({1}) -} - -class B { -// private fun boo(c: () -> C) {} -} -class C - -// FILE: LibCase11.kt -package LibPackCase1.b -import LibPackCase1.a.* -import testPackCase1.B -import testPackCase1.C - -fun B?.boo( c: ()->C) {} //(2) - - -// FILE: LibCase12.kt -package LibPackCase1.a -import testPackCase1.B - -fun B?.boo( c: ()->Int) { //(1) -} - -// FILE: TestCase2.kt -/* - * TESTCASE NUMBER: 2 - */ -package testPackCase2 - -import LibPackCase2.a.* -import LibPackCase2.b.* - -fun case2 (b: B?){ - b.boo({ C() }) - b.boo({1}) -} - -class B { -// private fun boo(c: () -> C) {} -} -class C - -// FILE: LibCase21.kt -package LibPackCase2.b -import LibPackCase2.a.* -import testPackCase2.B -import testPackCase2.C - -fun B?.boo( c: ()->C) {} //(2) - - -// FILE: LibCase22.kt -package LibPackCase2.a -import testPackCase2.B - -fun B?.boo( c: ()->Int) { //(1) -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/neg/2.2.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/neg/2.2.kt index f339692ffaf..1300ed080c4 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/neg/2.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/neg/2.2.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/neg/2.3.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/neg/2.3.fir.kt index 426b263a640..fcf5f9fa2b1 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/neg/2.3.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/neg/2.3.fir.kt @@ -1,6 +1,14 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-464 + * MAIN LINK: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 9 -> sentence 2 + * NUMBER: 3 + * DESCRIPTION: receiver of intersection type ambuguity + */ // TESTCASE NUMBER: 1 interface A1 diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/pos/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/pos/1.1.fir.kt deleted file mode 100644 index 2d413d334d6..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/pos/1.1.fir.kt +++ /dev/null @@ -1,24 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -// SKIP_TXT - -// TESTCASE NUMBER: 1 -class A : B, C -interface B -interface C -fun foo(x: B) {} //(1) -fun foo(y: C, z: String = "foo") : String = "" //2 -fun case1(a: A) { - foo(a) - foo(a) -} - -// TESTCASE NUMBER: 2 -class A2 : B2, C2 -interface B2 -interface C2 -fun boo(x: B2) ="" //(1) -fun boo(y: C, z: String = "boo") {} //2 -fun case2(a: A2) { - boo(a) - boo(a) -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/pos/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/pos/1.1.kt index 0ba47757134..7ba5f29e019 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/pos/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/pos/1.1.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/p-2/pos/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/p-2/pos/1.1.fir.kt index f8afa389d19..8ca4f00789f 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/p-2/pos/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/p-2/pos/1.1.fir.kt @@ -1,6 +1,14 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-387 + * MAIN LINK: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, rationale-1 -> paragraph 2 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: The most specific callable can forward itself to any other callable from the overload candidate set, while the opposite is not true. + */ // TESTCASE NUMBER: 1 class Case1 { diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/p-3/neg/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/p-3/neg/1.1.fir.kt deleted file mode 100644 index 37f52f16cc6..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/p-3/neg/1.1.fir.kt +++ /dev/null @@ -1,14 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -// SKIP_TXT - - -// TESTCASE NUMBER: 1 -class Case1 { - fun List.foo(x: T?) {} - - fun List.foo(x: T) {} - - fun case(x: List, y: T) { - x.foo(y) - } -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/p-3/neg/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/p-3/neg/1.1.kt index f29b2d89fbc..92313d4695e 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/p-3/neg/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/p-3/neg/1.1.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/determining-function-applicability-for-a-specific-call/description/p-2/neg/2.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/determining-function-applicability-for-a-specific-call/description/p-2/neg/2.1.fir.kt index 70e5f580fb0..dd46b886d8b 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/determining-function-applicability-for-a-specific-call/description/p-2/neg/2.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/determining-function-applicability-for-a-specific-call/description/p-2/neg/2.1.fir.kt @@ -1,6 +1,16 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-448 + * MAIN LINK: overload-resolution, determining-function-applicability-for-a-specific-call, description -> paragraph 2 -> sentence 2 + * PRIMARY LINKS: overload-resolution, determining-function-applicability-for-a-specific-call, description -> paragraph 4 -> sentence 3 + * SECONDARY LINKS: overload-resolution, determining-function-applicability-for-a-specific-call, description -> paragraph 5 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: explicit receiver with lambda + */ // FILE: TestCase1.kt /* diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/receivers/p-5/pos/5.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/receivers/p-5/pos/5.1.fir.kt index 06d690eee85..f0aa980b5d2 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/receivers/p-5/pos/5.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/receivers/p-5/pos/5.1.fir.kt @@ -1,6 +1,17 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-278 + * MAIN LINK: overload-resolution, receivers -> paragraph 5 -> sentence 5 + * PRIMARY LINKS: overload-resolution, receivers -> paragraph 5 -> sentence 4 + * overload-resolution, building-the-overload-candidate-set-ocs, call-without-an-explicit-receiver -> paragraph 5 -> sentence 2 + * NUMBER: 1 + * DESCRIPTION: Superclass companion object receivers are prioritized according to the inheritance order + */ + // FILE: TestCase1.kt // TESTCASE NUMBER: 1 package testsCase1 diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-1/pos/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-1/pos/1.1.fir.kt deleted file mode 100644 index 1ebc65323d6..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-1/pos/1.1.fir.kt +++ /dev/null @@ -1,26 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -// SKIP_TXT - - -// FILE: TestCase1.kt -/* - * TESTCASE NUMBER: 1 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-39220 - */ -package testPackCase1 - -import kotlin.reflect.KFunction2 - -interface Foo { - fun resolve(var1: Int): String - fun resolve(var1: String): String -} - -fun bar(f: KFunction2) {} - -fun main() { - bar(Foo::resolve) // OK in OI, Ambiguity in NI - bar(Foo::resolve) // OK - bar(Foo::resolve) // OK -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-1/pos/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-1/pos/1.1.kt index a975001b130..ec989434249 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-1/pos/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-1/pos/1.1.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT @@ -30,7 +31,7 @@ interface Foo { fun bar(f: KFunction2) {} fun main() { - bar(Foo::resolve) // OK + bar(Foo::resolve) // OK in OI, Ambiguity in NI bar(Foo::resolve) // OK bar(Foo::resolve) // OK -} \ No newline at end of file +} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/neg/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/neg/1.1.fir.kt index 380968481d4..a00bf837e49 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/neg/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/neg/1.1.fir.kt @@ -1,6 +1,21 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-413 + * MAIN LINK: overload-resolution, resolving-callable-references, bidirectional-resolution-for-callable-calls -> paragraph 3 -> sentence 1 + * PRIMARY LINKS: overload-resolution, resolving-callable-references, bidirectional-resolution-for-callable-calls -> paragraph 3 -> sentence 2 + * overload-resolution, resolving-callable-references, bidirectional-resolution-for-callable-calls -> paragraph 3 -> sentence 3 + * overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 5 -> sentence 1 + * SECONDARY LINKS: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 1 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 4 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 7 -> sentence 1 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 8 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: a callable reference is itself an argument to an overloaded function call + */ // TESTCASE NUMBER: 1 class Case1() { diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.1.fir.kt index 949d6c58107..882a4e53e38 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.1.fir.kt @@ -1,6 +1,20 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-413 + * MAIN LINK: overload-resolution, resolving-callable-references, bidirectional-resolution-for-callable-calls -> paragraph 3 -> sentence 1 + * PRIMARY LINKS: overload-resolution, resolving-callable-references, bidirectional-resolution-for-callable-calls -> paragraph 3 -> sentence 2 + * overload-resolution, resolving-callable-references, bidirectional-resolution-for-callable-calls -> paragraph 3 -> sentence 3 + * SECONDARY LINKS: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 1 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 4 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 7 -> sentence 1 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 8 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: a callable reference is itself an argument to an overloaded function call + */ // TESTCASE NUMBER: 1 class Case1() { diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.2.fir.kt index b38503cd69a..3a3791eba64 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.2.fir.kt @@ -1,6 +1,20 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-413 + * MAIN LINK: overload-resolution, resolving-callable-references, bidirectional-resolution-for-callable-calls -> paragraph 3 -> sentence 1 + * PRIMARY LINKS: overload-resolution, resolving-callable-references, bidirectional-resolution-for-callable-calls -> paragraph 3 -> sentence 2 + * overload-resolution, resolving-callable-references, bidirectional-resolution-for-callable-calls -> paragraph 3 -> sentence 3 + * SECONDARY LINKS: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 1 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 4 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 7 -> sentence 1 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 8 -> sentence 1 + * NUMBER: 2 + * DESCRIPTION: a callable reference is itself an argument to an overloaded function call + */ // TESTCASE NUMBER: 1 class Case1 { diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.3.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.3.fir.kt index 43c612575e7..a5985a0fdec 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.3.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.3.fir.kt @@ -1,6 +1,20 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-413 + * MAIN LINK: overload-resolution, resolving-callable-references, bidirectional-resolution-for-callable-calls -> paragraph 3 -> sentence 1 + * PRIMARY LINKS: overload-resolution, resolving-callable-references, bidirectional-resolution-for-callable-calls -> paragraph 3 -> sentence 2 + * overload-resolution, resolving-callable-references, bidirectional-resolution-for-callable-calls -> paragraph 3 -> sentence 3 + * SECONDARY LINKS: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 1 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 4 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 7 -> sentence 1 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 8 -> sentence 1 + * NUMBER: 3 + * DESCRIPTION: a callable reference is itself an argument to an overloaded function call + */ // TESTCASE NUMBER: 1 class Case1() { diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.4.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.4.fir.kt index 858ae5cb8c2..59ee1c603aa 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.4.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.4.fir.kt @@ -1,6 +1,20 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-413 + * MAIN LINK: overload-resolution, resolving-callable-references, bidirectional-resolution-for-callable-calls -> paragraph 3 -> sentence 1 + * PRIMARY LINKS: overload-resolution, resolving-callable-references, bidirectional-resolution-for-callable-calls -> paragraph 3 -> sentence 2 + * overload-resolution, resolving-callable-references, bidirectional-resolution-for-callable-calls -> paragraph 3 -> sentence 3 + * SECONDARY LINKS: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 1 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 4 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 7 -> sentence 1 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 8 -> sentence 1 + * NUMBER: 4 + * DESCRIPTION: a callable reference is itself an argument to an overloaded function call + */ // TESTCASE NUMBER: 1 class Case1() { diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/p-2/pos/2.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/p-2/pos/2.1.fir.kt index 53a257dc94e..bd74854084d 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/p-2/pos/2.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/p-2/pos/2.1.fir.kt @@ -1,6 +1,14 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-401 + * MAIN LINK: overload-resolution, resolving-callable-references -> paragraph 2 -> sentence 2 + * NUMBER: 1 + * DESCRIPTION: the case of a call with a callable reference as a not parameter + */ // FILE: TestCase1.kt // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.1.fir.kt index 76480559666..2f2c3cae2e3 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.1.fir.kt @@ -1,6 +1,16 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-413 + * MAIN LINK: overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 1 -> sentence 1 + * PRIMARY LINKS: overload-resolution, determining-function-applicability-for-a-specific-call, description -> paragraph 5 -> sentence 1 + * SECONDARY LINKS: overload-resolution, determining-function-applicability-for-a-specific-call, description -> paragraph 3 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: the case of a call with a callable reference as a not parameter + */ // FILE: TestCase1.kt // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.2.fir.kt deleted file mode 100644 index c9f43952332..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.2.fir.kt +++ /dev/null @@ -1,37 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -// SKIP_TXT - - - -// FILE: TestCase1.kt -// TESTCASE NUMBER: 1 -package testsCase1 -import libCase1.* -import kotlin.text.format - -fun case1() { - val y1 =(String)::format -} - -// FILE: LibCase1.kt -package libCase1 - -val String.Companion.format: String - get() = "1" - - -// FILE: TestCase2.kt -// TESTCASE NUMBER: 2 -package testsCase2 -import libCase2.* -import kotlin.text.* - -fun case2() { - val y1 =(String)::format -} - -// FILE: LibCase2.kt -package libCase2 - -val String.Companion.format: String - get() = "1" diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.2.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.2.kt index 633157898ac..5308b42be7d 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.2.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.3.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.3.fir.kt deleted file mode 100644 index a9c62086655..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.3.fir.kt +++ /dev/null @@ -1,44 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -// SKIP_TXT - - - -// FILE: TestCase1.kt -// TESTCASE NUMBER: 1 -package testsCase1 -import libCase1.* - -fun case1() { - val y1 =(A)::boo -} - -// FILE: LibCase1.kt -package libCase1 - -class A{ - companion object{} -} -val A.Companion.boo: String - get() = "1" -fun A.Companion.boo(): String ="" - - -// FILE: TestCase2.kt -// TESTCASE NUMBER: 1 -package testsCase2 -import libCase2.A -import libCase2.boo - -fun case2() { - val y1 =(A)::boo -} - -// FILE: LibCase2.kt -package libCase2 - -class A{ - companion object{} -} -val A.Companion.boo: String - get() = "1" -fun A.Companion.boo(): String ="" diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.3.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.3.kt index 4e9cefacd27..a0a8e98da62 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.3.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.3.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.4.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.4.fir.kt deleted file mode 100644 index 25abc6329fc..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.4.fir.kt +++ /dev/null @@ -1,37 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -// SKIP_TXT - - - - -// FILE: TestCase1.kt -// TESTCASE NUMBER: 1 -package testsCase1 -import libCase1.boo - -fun case1() { - val y1 =1::boo -} - -// FILE: LibCase1.kt -package libCase1 - -val Int.boo: String - get() = "1" -fun Int.boo(): String ="" - -// FILE: TestCase2.kt -// TESTCASE NUMBER: 2 -package testsCase2 -import libCase2.* - -fun case2() { - val y1 =1::boo -} - -// FILE: LibCase2.kt -package libCase2 - -val Int.boo: String - get() = "1" -fun Int.boo(): String ="" diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.4.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.4.kt index a7253129484..13e5858212b 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.4.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.4.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.5.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.5.fir.kt deleted file mode 100644 index 26ad667d71e..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.5.fir.kt +++ /dev/null @@ -1,59 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -// SKIP_TXT - - - - -// FILE: TestCase1.kt -// TESTCASE NUMBER: 1 -package testsCase1 -import libCase1.boo - -fun case1() { - val y1 =::boo -} - -// FILE: LibCase1.kt -package libCase1 - -val boo: String - get() = "1" -fun boo(): String ="" - -// FILE: TestCase2.kt -// TESTCASE NUMBER: 2 -package testsCase2 -import libCase2.* - -fun case2() { - val y1 =::boo -} - -val boo: String - get() = "1" -fun boo(): String ="" - -// FILE: LibCase2.kt -package libCase2 - -fun boo(): String ="" - - -// FILE: TestCase3.kt -// TESTCASE NUMBER: 2 -package testsCase3 -import libCase3.* - -fun case3() { - val y1 =::boo -} - -val boo: String - get() = "1" -fun boo(): String ="" - -// FILE: LibCase3.kt -package libCase3 - -val boo: String - get() = "1" diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.5.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.5.kt index 2371b6ce905..570a5cebdb0 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.5.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.5.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.1.fir.kt index d7b77e750bb..ccff6db2f11 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.1.fir.kt @@ -1,6 +1,16 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-413 + * MAIN LINK: overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 1 -> sentence 1 + * PRIMARY LINKS: overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 5 -> sentence 1 + * SECONDARY LINKS: overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 6 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: the case of a call with a callable reference as a not parameter + */ // FILE: TestCase1.kt // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.2.fir.kt index d1f2ca2c172..6ad6d995dce 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.2.fir.kt @@ -1,6 +1,18 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-409 + * MAIN LINK: overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 1 -> sentence 1 + * PRIMARY LINKS: overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 2 -> sentence 2 + * overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 2 -> sentence 3 + * overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 2 -> sentence 4 + * overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 2 -> sentence 6 + * NUMBER: 2 + * DESCRIPTION: the case of a call with a callable reference as a not parameter + */ // FILE: TestCase1.kt diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.3.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.3.fir.kt index 6e4047aab2b..1303a01a627 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.3.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.3.fir.kt @@ -1,6 +1,18 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-409 + * MAIN LINK: overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 1 -> sentence 1 + * PRIMARY LINKS: overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 2 -> sentence 2 + * overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 2 -> sentence 3 + * overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 2 -> sentence 4 + * overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 2 -> sentence 6 + * NUMBER: 3 + * DESCRIPTION: the case of a call with a callable reference as a not parameter + */ // FILE: TestCase1.kt diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.3.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.3.kt index 98f15c2da14..4f2e042a8d4 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.3.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.3.kt @@ -21,6 +21,7 @@ package testsCase1 class Case() { fun case(v: V) { + // InitializertTypeCheckerMismatch bug val va: () -> String = (V)::a val vb: () -> String = (V)::b diff --git a/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/operator-assignments/p-2/neg/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/operator-assignments/p-2/neg/1.1.fir.kt deleted file mode 100644 index 3150df4d89e..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/operator-assignments/p-2/neg/1.1.fir.kt +++ /dev/null @@ -1,18 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -// SKIP_TXT - -class B(var a: Int) { - operator fun plus(value: Int): B { - a= a + value - return this - } - operator fun plusAssign(value: Int): Unit { - a= a + value - } -} - -// TESTCASE NUMBER: 1 -fun case1() { - var b = B(1) - b += 1 -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/operator-assignments/p-2/neg/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/operator-assignments/p-2/neg/1.1.kt index c830788a879..85359a89f90 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/operator-assignments/p-2/neg/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/operator-assignments/p-2/neg/1.1.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/p-1/neg/2.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/p-1/neg/2.1.fir.kt index 2fe706f4dfe..b5a51786f6e 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/p-1/neg/2.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/p-1/neg/2.1.fir.kt @@ -1,6 +1,16 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-222 + * MAIN LINK: statements, assignments -> paragraph 1 -> sentence 2 + * NUMBER: 1 + * DESCRIPTION: Both left-hand and right-hand sides of an assignment must be expressions + */ + + /* * TESTCASE NUMBER: 1 * NOTE: right-hand side of an assignment must be expression diff --git a/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/p-2/neg/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/p-2/neg/1.1.fir.kt index 573ea76e144..7f43c999567 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/p-2/neg/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/p-2/neg/1.1.fir.kt @@ -1,6 +1,17 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-222 + * MAIN LINK: statements, assignments -> paragraph 2 -> sentence 1 + * PRIMARY LINKS: statements, assignments -> paragraph 3 -> sentence 1 + * statements, assignments, simple-assignments -> paragraph 1 -> sentence 2 + * NUMBER: 1 + * DESCRIPTION: Check the expression is not assignable if an identifier referring to an unmutable property + */ + /* * TESTCASE NUMBER: 1 * NOTE: an identifier referring to a unmutable property diff --git a/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/p-2/neg/1.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/p-2/neg/1.2.fir.kt index 8591618ac42..e625400b03d 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/p-2/neg/1.2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/p-2/neg/1.2.fir.kt @@ -1,6 +1,18 @@ // !DIAGNOSTICS: -UNSAFE_CALL -UNREACHABLE_CODE -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-222 + * MAIN LINK: statements, assignments -> paragraph 2 -> sentence 1 + * PRIMARY LINKS: statements, assignments -> paragraph 3 -> sentence 2 + * statements, assignments, simple-assignments -> paragraph 1 -> sentence 2 + * NUMBER: 2 + * DESCRIPTION: Check the expression is not assignable if a navigation expression referring to an unmutable property + */ + + /* * TESTCASE NUMBER: 1 * NOTE: a navigation expression referring to a unmutable property diff --git a/compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements/do-while-loop-statement/p-3/neg/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements/do-while-loop-statement/p-3/neg/1.1.fir.kt index 69b70c0daa8..42d9171a3de 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements/do-while-loop-statement/p-3/neg/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements/do-while-loop-statement/p-3/neg/1.1.fir.kt @@ -1,6 +1,16 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-253 + * MAIN LINK: statements, loop-statements, do-while-loop-statement -> paragraph 3 -> sentence 1 + * PRIMARY LINKS: statements, loop-statements, do-while-loop-statement -> paragraph 1 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: condition expression is not a subtype of kotlin.Boolean. + */ + // TESTCASE NUMBER: 1 fun case1() { do { diff --git a/compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements/while-loop-statement/p-3/neg/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements/while-loop-statement/p-3/neg/1.1.fir.kt index bcc8df0aca3..0e992c92ffc 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements/while-loop-statement/p-3/neg/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements/while-loop-statement/p-3/neg/1.1.fir.kt @@ -1,6 +1,17 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-253 + * MAIN LINK: statements, loop-statements, while-loop-statement -> paragraph 3 -> sentence 1 + * PRIMARY LINKS: statements, loop-statements, while-loop-statement -> paragraph 1 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: condition expression is not a subtype of kotlin.Boolean. + * HELPERS: checkType + */ + // FILE: KotlinClass.kt // TESTCASE NUMBER: 1 fun case1() { diff --git a/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-cast-sink-stability/p-5/neg/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-cast-sink-stability/p-5/neg/1.1.fir.kt index 10678542697..b3e506a6197 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-cast-sink-stability/p-5/neg/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-cast-sink-stability/p-5/neg/1.1.fir.kt @@ -1,6 +1,18 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-268 + * MAIN LINK: type-inference, smart-casts, smart-cast-sink-stability -> paragraph 5 -> sentence 1 + * PRIMARY LINKS: overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 4 -> sentence 1 + * overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 2 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: smart case for property `plus` available through the operator invoke + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-36876 + */ // TESTCASE NUMBER: 1 class Case1() { diff --git a/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-cast-sink-stability/p-5/pos/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-cast-sink-stability/p-5/pos/1.1.fir.kt index b48312d5f0d..805c1606c14 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-cast-sink-stability/p-5/pos/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-cast-sink-stability/p-5/pos/1.1.fir.kt @@ -1,6 +1,18 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-268 + * MAIN LINK: type-inference, smart-casts, smart-cast-sink-stability -> paragraph 5 -> sentence 1 + * PRIMARY LINKS: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 1 -> sentence 1 + * overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 3 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: smart cast for the property available through the operator invoke + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-36876 + */ // TESTCASE NUMBER: 1 class Case1() { diff --git a/compiler/tests-spec/testData/diagnostics/linked/type-system/introduction-1/p-6/neg/2.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/type-system/introduction-1/p-6/neg/2.1.fir.kt index 0561bee122f..0e3a24eec72 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/type-system/introduction-1/p-6/neg/2.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/type-system/introduction-1/p-6/neg/2.1.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-100 + * MAIN LINK: type-system, introduction-1 -> paragraph 6 -> sentence 2 + * NUMBER: 1 + * DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the class. + */ + // TESTCASE NUMBER: 1 fun case_1() { val x: Int = null diff --git a/compiler/tests-spec/testData/diagnostics/linked/type-system/introduction-1/p-6/neg/2.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/type-system/introduction-1/p-6/neg/2.2.fir.kt index fa33372e65d..8d43eef7069 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/type-system/introduction-1/p-6/neg/2.2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/type-system/introduction-1/p-6/neg/2.2.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-100 + * MAIN LINK: type-system, introduction-1 -> paragraph 6 -> sentence 2 + * NUMBER: 2 + * DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the class. + */ + // TESTCASE NUMBER: 1 fun case_1(x: Int = null) { println(x) diff --git a/compiler/tests-spec/testData/diagnostics/linked/type-system/introduction-1/p-6/neg/2.3.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/type-system/introduction-1/p-6/neg/2.3.fir.kt index 28b1a89f29a..8129b33c32a 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/type-system/introduction-1/p-6/neg/2.3.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/type-system/introduction-1/p-6/neg/2.3.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-100 + * MAIN LINK: type-system, introduction-1 -> paragraph 6 -> sentence 2 + * NUMBER: 3 + * DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the class. + */ + // TESTCASE NUMBER: 1 fun case_1(x: T = null) { println(x) diff --git a/compiler/tests-spec/testData/diagnostics/linked/type-system/introduction-1/p-8/pos/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/type-system/introduction-1/p-8/pos/1.1.fir.kt index 35e1899dd64..bdc4d710194 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/type-system/introduction-1/p-8/pos/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/type-system/introduction-1/p-8/pos/1.1.fir.kt @@ -1,6 +1,17 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-296 + * MAIN LINK: type-system, introduction-1 -> paragraph 8 -> sentence 1 + * PRIMARY LINKS: type-system, type-kinds, built-in-types, kotlin.any -> paragraph 1 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the class. + * HELPERS: checkType + */ + // TESTCASE NUMBER: 1 fun case_1() { checkSubtype(10) diff --git a/compiler/tests-spec/testData/diagnostics/linked/type-system/introduction-1/p-8/pos/2.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/type-system/introduction-1/p-8/pos/2.1.fir.kt index cf47a1b8225..d22dc58dc6d 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/type-system/introduction-1/p-8/pos/2.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/type-system/introduction-1/p-8/pos/2.1.fir.kt @@ -1,6 +1,16 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -UNREACHABLE_CODE // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-100 + * MAIN LINK: type-system, introduction-1 -> paragraph 8 -> sentence 2 + * NUMBER: 1 + * DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the class. + * HELPERS: checkType + */ + // TESTCASE NUMBER: 1 fun case_1() { checkSubtype(return) diff --git a/compiler/tests-spec/testData/diagnostics/linked/type-system/subtyping/subtyping-for-intersection-types/p-1/pos/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/type-system/subtyping/subtyping-for-intersection-types/p-1/pos/1.1.fir.kt index 26409818711..5f864fe7b17 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/type-system/subtyping/subtyping-for-intersection-types/p-1/pos/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/type-system/subtyping/subtyping-for-intersection-types/p-1/pos/1.1.fir.kt @@ -1,6 +1,16 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-464 + * MAIN LINK: type-system, subtyping, subtyping-for-intersection-types -> paragraph 1 -> sentence 1 + * PRIMARY LINKS: type-system, subtyping, subtyping-for-intersection-types -> paragraph 2 -> sentence 3 + * NUMBER: 1 + * DESCRIPTION: intersection type inferred for enum classes + * HELPERS: checkType, functions + */ /* * TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/linked/type-system/subtyping/subtyping-for-intersection-types/p-1/pos/1.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/type-system/subtyping/subtyping-for-intersection-types/p-1/pos/1.2.fir.kt deleted file mode 100644 index 0047eaf7ebf..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/type-system/subtyping/subtyping-for-intersection-types/p-1/pos/1.2.fir.kt +++ /dev/null @@ -1,154 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -// SKIP_TXT - - - -// TESTCASE NUMBER: 1 -fun case1() { - val x = case1(object : A1, B1 {}) - checkSubtype(x) - checkSubtype(x) -} - - -interface A1 { - fun fooA() = "A" -} - -interface B1 { - fun fooB() = "B" -} - -fun case1(case: T): T where T : A1, T : B1 = case - -// TESTCASE NUMBER: 2 -fun case2() { - fun case2(case: T): T where T : A2, T : B2 = case - - val x = case2(C2()) - checkSubtype(x) - checkSubtype(x) -} - -class C2: A2, B2 - -interface A2 { - fun fooA() = "A" -} - -interface B2 { - fun fooB() = "B" -} - -// TESTCASE NUMBER: 3 -fun case3() { - val x = case3(object : A3, B3 {}) - checkSubtype(x) - checkSubtype(x) -} - - -interface A3 { - fun fooA() = "A" -} - -interface B3 { - fun fooB() = "B" -} - -fun case3(case: T): T where T : A3, T : B3 = case - -// TESTCASE NUMBER: 4 -fun case4() { - fun case4(case: T): T where T : A4, T : B4 = case - - val x = case4(C4()) - checkSubtype(x) - checkSubtype(x) -} - -class C4: A4, B4 - -interface A4 { - fun fooA() = "A" -} - -interface B4 { - fun fooB() = "B" -} - - - -// TESTCASE NUMBER: 5 -fun case5() { - val x = "" case5 object : A5, B5 {} - checkSubtype(x) - checkSubtype(x) -} - - -interface A5 { - fun fooA() = "A" -} - -interface B5 { - fun fooB() = "B" -} - -infix fun CharSequence.case5(case: T): T where T : A5, T : B5 = case - -// TESTCASE NUMBER: 6 -fun case6() { - infix fun CharSequence.case6(case: T): T where T : A6, T : B6 = case - - val x = "" case6 C6() - checkSubtype(x) - checkSubtype(x) -} - -class C6: A6, B6 - -interface A6 { - fun fooA() = "A" -} - -interface B6 { - fun fooB() = "B" -} - -// TESTCASE NUMBER: 7 -fun case7() { - val x = case7(object : A7, B7 {}) - checkSubtype(x) - checkSubtype(x) -} - - -interface A7 { - fun fooA() = "A" -} - -interface B7 { - fun fooB() = "B" -} - -fun case7(case: T): T where T : A7, T : B7 = case - -// TESTCASE NUMBER: 8 -fun case8() { - infix fun CharSequence.case8(case: T): T where T : A8, T : B8 = case - - val x = "" case8 C8() - checkSubtype(x) - checkSubtype(x) -} - -class C8: A8, B8 - -interface A8 { - fun fooA() = "A" -} - -interface B8 { - fun fooB() = "B" -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/type-system/subtyping/subtyping-for-intersection-types/p-1/pos/1.2.kt b/compiler/tests-spec/testData/diagnostics/linked/type-system/subtyping/subtyping-for-intersection-types/p-1/pos/1.2.kt index bf6b752f631..7349c8931fd 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/type-system/subtyping/subtyping-for-intersection-types/p-1/pos/1.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/type-system/subtyping/subtyping-for-intersection-types/p-1/pos/1.2.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/type-system/subtyping/subtyping-for-intersection-types/p-1/pos/1.3.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/type-system/subtyping/subtyping-for-intersection-types/p-1/pos/1.3.fir.kt index a59a20b142d..7066213ecee 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/type-system/subtyping/subtyping-for-intersection-types/p-1/pos/1.3.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/type-system/subtyping/subtyping-for-intersection-types/p-1/pos/1.3.fir.kt @@ -1,6 +1,16 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-464 + * MAIN LINK: type-system, subtyping, subtyping-for-intersection-types -> paragraph 1 -> sentence 1 + * PRIMARY LINKS: type-system, subtyping, subtyping-for-intersection-types -> paragraph 2 -> sentence 3 + * NUMBER: 3 + * DESCRIPTION: intersection type inferred for function + * HELPERS: checkType, functions + */ // TESTCASE NUMBER: 1 // UNEXPECTED BEHAVIOUR diff --git a/compiler/tests-spec/testData/diagnostics/linked/type-system/subtyping/subtyping-rules/p-2/pos/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/type-system/subtyping/subtyping-rules/p-2/pos/1.1.fir.kt deleted file mode 100644 index 18676df18d2..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/type-system/subtyping/subtyping-rules/p-2/pos/1.1.fir.kt +++ /dev/null @@ -1,117 +0,0 @@ -// !DIAGNOSTICS: -UNREACHABLE_CODE -UNUSED_PARAMETER -// SKIP_TXT - - - -// TESTCASE NUMBER: 1 -class A - -fun foo() : A = A() - -interface AI{ - val ai0: String - get() = "" -} - -val AI.ai1: Int - get() = 1 - - -fun case1(a: A, ai: AI , nothing: Nothing) { - - checkSubtype(a) - checkSubtype(nothing) - - checkSubtype(foo()) - checkSubtype(nothing) - - checkSubtype(ai) - checkSubtype(nothing) - - checkSubtype(ai.ai0) - checkSubtype(nothing) - - checkSubtype(ai.ai1) - checkSubtype(nothing) - - checkSubtype(nothing) - checkSubtype(nothing) -} - -// TESTCASE NUMBER: 2 -fun case2( nothing: Nothing) { - - checkSubtype("a") - checkSubtype(nothing) - checkSubtype(nothing) - checkSubtype("") - - checkSubtype(1) - checkSubtype(nothing) - - checkSubtype(1.0) - checkSubtype(nothing) - - checkSubtype(true) - checkSubtype(nothing) - - checkSubtype(Unit) - checkSubtype(nothing) - - checkSubtype(Exception()) - checkSubtype(nothing) -} -// TESTCASE NUMBER: 3 - -class A3(val x : Int){ - - class Nested{ - fun case3(nothing: Nothing) { - checkSubtype(this) - checkSubtype(this) - checkSubtype(nothing) - } - } - - inner class AInner() { - fun foo() = x - fun case3(nothing: Nothing) { - checkSubtype(this) - checkSubtype(this) - checkSubtype(nothing) - } - } - - - companion object{ - private fun case3(nothing: Nothing) { - checkSubtype(this) - checkSubtype(this) - checkSubtype(nothing) - } - } -} - -// TESTCASE NUMBER: 4 -class A4(val x: Int) { - - interface AN - - inner class AInner() { - fun foo() = x - } - - companion object {} -} - -fun case4(a: A4, an: A4.AN, nothing: Nothing) { - - checkSubtype(A4.Companion) - checkSubtype(nothing) - - checkSubtype(a.AInner()) - checkSubtype(nothing) - - checkSubtype(an) - checkSubtype(nothing) -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/type-system/subtyping/subtyping-rules/p-2/pos/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/type-system/subtyping/subtyping-rules/p-2/pos/1.1.kt index 2c27b16798f..cfef349ff0d 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/type-system/subtyping/subtyping-rules/p-2/pos/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/type-system/subtyping/subtyping-rules/p-2/pos/1.1.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNREACHABLE_CODE -UNUSED_PARAMETER // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/type-system/type-contexts-and-scopes/inner-and-nested-type-contexts/p-1/neg/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/type-system/type-contexts-and-scopes/inner-and-nested-type-contexts/p-1/neg/1.1.fir.kt deleted file mode 100644 index d111fa9916e..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/type-system/type-contexts-and-scopes/inner-and-nested-type-contexts/p-1/neg/1.1.fir.kt +++ /dev/null @@ -1,22 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -USELESS_IS_CHECK -// SKIP_TXT - - -// TESTCASE NUMBER: 1 - -class Case1(val x: AT) { - - inner class C() { - fun case1a(x: Any) { - if (x is AT) { - "" - } - } - - fun case1b(x: Any) { - when (x) { - is AT -> println("at") - } - } - } -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/type-system/type-contexts-and-scopes/inner-and-nested-type-contexts/p-1/neg/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/type-system/type-contexts-and-scopes/inner-and-nested-type-contexts/p-1/neg/1.1.kt index 6010f40d0cb..6e42dbb4b82 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/type-system/type-contexts-and-scopes/inner-and-nested-type-contexts/p-1/neg/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/type-system/type-contexts-and-scopes/inner-and-nested-type-contexts/p-1/neg/1.1.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -USELESS_IS_CHECK // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/type-system/type-contexts-and-scopes/inner-and-nested-type-contexts/p-1/neg/1.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/type-system/type-contexts-and-scopes/inner-and-nested-type-contexts/p-1/neg/1.2.fir.kt deleted file mode 100644 index b07eb3379cb..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/type-system/type-contexts-and-scopes/inner-and-nested-type-contexts/p-1/neg/1.2.fir.kt +++ /dev/null @@ -1,41 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -USELESS_IS_CHECK -IMPLICIT_CAST_TO_ANY -// SKIP_TXT - - -// TESTCASE NUMBER: 1 - -class Case1(val x: AT) { - - inner class C() { - fun case1a(x: Any) { - if (x is AT) { - "" - } - } - - fun case1b(x: Any) = when (x) { - is AT -> println("at") - else -> "" - } - - } -} - -// TESTCASE NUMBER: 2 - -class Case2(val x: AT) { - - inner class C() { - fun case2a(x: CharSequence) { - if (x is AT) { - "" - } - } - - fun case2b(x: CharSequence) { - when (x) { - is AT -> "" - } - } - } -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/type-system/type-contexts-and-scopes/inner-and-nested-type-contexts/p-1/neg/1.2.kt b/compiler/tests-spec/testData/diagnostics/linked/type-system/type-contexts-and-scopes/inner-and-nested-type-contexts/p-1/neg/1.2.kt index b557ecf4055..98421402bb5 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/type-system/type-contexts-and-scopes/inner-and-nested-type-contexts/p-1/neg/1.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/type-system/type-contexts-and-scopes/inner-and-nested-type-contexts/p-1/neg/1.2.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -USELESS_IS_CHECK -IMPLICIT_CAST_TO_ANY // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/type-system/type-contexts-and-scopes/inner-and-nested-type-contexts/p-1/neg/2.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/type-system/type-contexts-and-scopes/inner-and-nested-type-contexts/p-1/neg/2.1.fir.kt deleted file mode 100644 index 9c49898f6e4..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/type-system/type-contexts-and-scopes/inner-and-nested-type-contexts/p-1/neg/2.1.fir.kt +++ /dev/null @@ -1,26 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -// SKIP_TXT - - -// TESTCASE NUMBER: 1 -class Case1(val x: AT) { - - class B(val y: AT) { - fun case1() { - val k: AT - } - } - - class C() { - fun case1(x: Any) { - when (x) { - is AT -> println("at") - else -> println("else") - } - } - } - - class D() { - fun case1(x: Any) : AT = TODO() - } -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/type-system/type-contexts-and-scopes/inner-and-nested-type-contexts/p-1/neg/2.1.kt b/compiler/tests-spec/testData/diagnostics/linked/type-system/type-contexts-and-scopes/inner-and-nested-type-contexts/p-1/neg/2.1.kt index 05ff7ca7dc2..55b6de9520c 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/type-system/type-contexts-and-scopes/inner-and-nested-type-contexts/p-1/neg/2.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/type-system/type-contexts-and-scopes/inner-and-nested-type-contexts/p-1/neg/2.1.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/type-system/type-contexts-and-scopes/inner-and-nested-type-contexts/p-1/pos/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/type-system/type-contexts-and-scopes/inner-and-nested-type-contexts/p-1/pos/1.1.fir.kt deleted file mode 100644 index 48246bc07d3..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/type-system/type-contexts-and-scopes/inner-and-nested-type-contexts/p-1/pos/1.1.fir.kt +++ /dev/null @@ -1,44 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -USELESS_IS_CHECK -UNCHECKED_CAST -// SKIP_TXT - - -// TESTCASE NUMBER: 1 - -class Case1(val x: AT) { - - inner class B(val y: AT) { - fun case1a(k: AT) { - k checkType { check() } - with(k) { - this checkType { check() } - } - - } - - fun case1b() { - val k: AT = x - k checkType { check() } - - when (k) { - is AT -> { - k checkType { check() } - } - } - } - - fun case1c() { - val k: AT = x!! - - if (k is AT) { - k checkType { check() } - } - } - } - - inner class D() { - fun boo(x: Any): AT = TODO() - fun case1() { - boo("") checkType { check() } - } - } -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/type-system/type-contexts-and-scopes/inner-and-nested-type-contexts/p-1/pos/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/type-system/type-contexts-and-scopes/inner-and-nested-type-contexts/p-1/pos/1.1.kt index 91013f0334c..d36769ca039 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/type-system/type-contexts-and-scopes/inner-and-nested-type-contexts/p-1/pos/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/type-system/type-contexts-and-scopes/inner-and-nested-type-contexts/p-1/pos/1.1.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -USELESS_IS_CHECK -UNCHECKED_CAST // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/type-system/type-contexts-and-scopes/inner-and-nested-type-contexts/p-1/pos/1.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/type-system/type-contexts-and-scopes/inner-and-nested-type-contexts/p-1/pos/1.2.fir.kt deleted file mode 100644 index 21cc535386b..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/type-system/type-contexts-and-scopes/inner-and-nested-type-contexts/p-1/pos/1.2.fir.kt +++ /dev/null @@ -1,64 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -USELESS_IS_CHECK -// SKIP_TXT - - -// TESTCASE NUMBER: 1 - -class Case1(val x: AT) { - - inner class B(val y: AT) { - fun case1a() { - val k: AT = x - - if (k is AT) { - "" - } - } - - fun case1b() { - val k: AT = x - - when (k) { - is AT -> "" - } - } - } - - inner class D() { - fun boo(x: Any): AT = TODO() - fun case1() { - boo("") checkType { check() } - } - } -} - -// TESTCASE NUMBER: 2 - -class Case2(val x: AT) { - - inner class B(val y: AT) { - fun case2a() { - val k: AT = x - - if (k is AT) { - "" - } - } - - fun case2b() { - val k: AT = x - - when (k) { - is AT -> "" - } - } - } - - - inner class C() { - fun boo(x: Any): AT = TODO() - fun case2() { - boo("") checkType { check() } - } - } -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/type-system/type-contexts-and-scopes/inner-and-nested-type-contexts/p-1/pos/1.2.kt b/compiler/tests-spec/testData/diagnostics/linked/type-system/type-contexts-and-scopes/inner-and-nested-type-contexts/p-1/pos/1.2.kt index 40f81ff3b45..0c2e1e1bc43 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/type-system/type-contexts-and-scopes/inner-and-nested-type-contexts/p-1/pos/1.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/type-system/type-contexts-and-scopes/inner-and-nested-type-contexts/p-1/pos/1.2.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -USELESS_IS_CHECK // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/type-system/type-kinds/built-in-types/kotlin.any/p-1/pos/1.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/type-system/type-kinds/built-in-types/kotlin.any/p-1/pos/1.2.fir.kt index f67fbb7fa4a..addd84b0743 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/type-system/type-kinds/built-in-types/kotlin.any/p-1/pos/1.2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/type-system/type-kinds/built-in-types/kotlin.any/p-1/pos/1.2.fir.kt @@ -1,6 +1,17 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-296 + * MAIN LINK: type-system, type-kinds, built-in-types, kotlin.any -> paragraph 1 -> sentence 1 + * PRIMARY LINKS: type-system, introduction-1 -> paragraph 7 -> sentence 1 + * NUMBER: 2 + * DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the class. + * HELPERS: checkType, functions + */ + // TESTCASE NUMBER: 1 fun case_1() { checkSubtype("") diff --git a/compiler/tests-spec/testData/diagnostics/linked/type-system/type-kinds/built-in-types/kotlin.nothing/p-1/neg/2.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/type-system/type-kinds/built-in-types/kotlin.nothing/p-1/neg/2.1.fir.kt index 3b932e45111..2a770f5327f 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/type-system/type-kinds/built-in-types/kotlin.nothing/p-1/neg/2.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/type-system/type-kinds/built-in-types/kotlin.nothing/p-1/neg/2.1.fir.kt @@ -1,6 +1,17 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -UNREACHABLE_CODE // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-213 + * MAIN LINK: type-system, type-kinds, built-in-types, kotlin.nothing -> paragraph 1 -> sentence 2 + * NUMBER: 1 + * DESCRIPTION: Check of Nothing type + * HELPERS: checkType + */ + + // TESTCASE NUMBER: 1 class Case1(val nothing: Nothing) diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/annotation-classes/neg/1.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/annotation-classes/neg/1.fir.kt deleted file mode 100644 index 28ac2b83271..00000000000 --- a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/annotation-classes/neg/1.fir.kt +++ /dev/null @@ -1,64 +0,0 @@ -// TESTCASE NUMBER: 2, 3, 4 -@Target(AnnotationTarget.CONSTRUCTOR) -annotation class Case12_1 - -@Target(AnnotationTarget.CONSTRUCTOR) -@Retention(AnnotationRetention.SOURCE) -@Repeatable -annotation class Case12_2 - -// TESTCASE NUMBER: 1 -annotation class Case1 @JvmOverloads constructor(val x: Int) - -// TESTCASE NUMBER: 2 -annotation class Case2 @[Case12_2 Case12_2 Case12_2 Case12_2 Case12_2 Case12_2 JvmOverloads Case12_1] constructor(x: Int = 10) - -// TESTCASE NUMBER: 3 -annotation class Case3 @Case12_2 @Case12_1 @Case12_2 @`JvmOverloads` @Case12_2 @Case12_2 constructor(x: Int = 10) - -// TESTCASE NUMBER: 4 -annotation class Case4 @Case12_2 @[Case12_2 Case12_2 Case12_2 Case12_2 Case12_2 Case12_2 JvmOverloads Case12_1] @Case12_2 @Case12_2 constructor(x: Int = 10) - -// TESTCASE NUMBER: 5 -annotation class Case5 @[JvmOverloads] constructor(val x: Int) - -// TESTCASE NUMBER: 6 -annotation class Case6 @JvmOverloads constructor() - -// TESTCASE NUMBER: 7 -annotation class Case7@JvmOverloads constructor() {} - -// TESTCASE NUMBER: 8 -annotation class Case8 @`JvmOverloads` constructor() - -// TESTCASE NUMBER: 9 -annotation class Case9 @JvmOverloads constructor(val x: Int) - -// TESTCASE NUMBER: 10 -annotation class Case10 @JvmOverloads constructor(val x: Int) - -// TESTCASE NUMBER: 11 -annotation class Case11 > @JvmOverloads constructor(val x: Int) - -// TESTCASE NUMBER: 12 -annotation class Case12 @JvmOverloads constructor(val x: Int) where T: Number - -// TESTCASE NUMBER: 13 -annotation class Case13 constructor(val x: Int) { - annotation class Case1 @JvmOverloads constructor(val x: Int) -} - -// TESTCASE NUMBER: 14 -annotation class Case14 @JvmOverloads constructor(val x: Int) { - annotation class Case1 constructor(val x: Int) -} - -// TESTCASE NUMBER: 15 -object Case15 { - annotation class Case15 @JvmOverloads constructor(val x: Int) -} - -// TESTCASE NUMBER: 16 -class Case16 { - annotation class Case16 @JvmOverloads constructor(val x: Int) -} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/annotation-classes/neg/1.kt b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/annotation-classes/neg/1.kt index 4ad4cc4dda7..fabca5a3b28 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/annotation-classes/neg/1.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/annotation-classes/neg/1.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL /* * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) * diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/2.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/2.fir.kt deleted file mode 100644 index 0d05435d922..00000000000 --- a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/2.fir.kt +++ /dev/null @@ -1,8 +0,0 @@ -/* - * TESTCASE NUMBER: 1 - * UNEXPECTED BEHAVIOUR - */ -@Target(AnnotationTarget.TYPE) -annotation class Ann(val x: Int) - -abstract class Foo : @Ann(unresolved_reference) Any() diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/2.kt b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/2.kt index bd29b800254..3a4d839d114 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/2.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/2.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL /* * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) * diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/3.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/3.fir.kt deleted file mode 100644 index c5d75c9394d..00000000000 --- a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/3.fir.kt +++ /dev/null @@ -1,14 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER - -// TESTCASE NUMBER: 1, 2, 3 -@Target(AnnotationTarget.TYPE) -annotation class Ann(val x: Int) - -// TESTCASE NUMBER: 1 -fun foo(i: Inv<@Ann(unresolved_reference) String>) {} - -// TESTCASE NUMBER: 2 -fun test(vararg a: @Ann(unresolved_reference) Any) {} - -// TESTCASE NUMBER: 3 -class A(a: @Ann(unresolved_reference) T) diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/3.kt b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/3.kt index 63ce8bc6073..e65a6ed3fe1 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/3.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/3.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER /* @@ -11,6 +12,8 @@ */ // TESTCASE NUMBER: 1, 2, 3 +package sometest + @Target(AnnotationTarget.TYPE) annotation class Ann(val x: Int) diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/3.txt b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/3.txt index bf84feedf72..53295548234 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/3.txt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/3.txt @@ -1,26 +1,28 @@ package -public fun foo(/*0*/ i: Inv<@Ann kotlin.String>): kotlin.Unit -public fun test(/*0*/ vararg a: @Ann kotlin.Any /*kotlin.Array*/): kotlin.Unit +package sometest { + public fun foo(/*0*/ i: sometest.Inv<@sometest.Ann kotlin.String>): kotlin.Unit + public fun test(/*0*/ vararg a: @sometest.Ann kotlin.Any /*kotlin.Array*/): kotlin.Unit -public final class A { - public constructor A(/*0*/ a: @Ann T) - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} + public final class A { + public constructor A(/*0*/ a: @sometest.Ann T) + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } -@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE}) public final annotation class Ann : kotlin.Annotation { - public constructor Ann(/*0*/ x: kotlin.Int) - public final val x: kotlin.Int - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} + @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE}) public final annotation class Ann : kotlin.Annotation { + public constructor Ann(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } -public final class Inv { - public constructor Inv() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + public final class Inv { + public constructor Inv() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/4.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/4.fir.kt deleted file mode 100644 index 1c7a77bcc9f..00000000000 --- a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/4.fir.kt +++ /dev/null @@ -1,5 +0,0 @@ -// TESTCASE NUMBER: 1 -@Target(AnnotationTarget.TYPE) -annotation class Ann(val x: Int) - -fun case_1(): Inv<@Ann(unresolved_reference) String> = TODO() diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/4.kt b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/4.kt index 67d49a5f005..08ff797a485 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/4.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/4.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL /* * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) * @@ -8,6 +9,8 @@ */ // TESTCASE NUMBER: 1 +package sometest + @Target(AnnotationTarget.TYPE) annotation class Ann(val x: Int) diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/4.txt b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/4.txt index e642b39cb3a..f7f7e5d189b 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/4.txt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/4.txt @@ -1,18 +1,20 @@ package -public fun case_1(): Inv<@Ann kotlin.String> +package sometest { + public fun case_1(): sometest.Inv<@sometest.Ann kotlin.String> -@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE}) public final annotation class Ann : kotlin.Annotation { - public constructor Ann(/*0*/ x: kotlin.Int) - public final val x: kotlin.Int - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} + @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE}) public final annotation class Ann : kotlin.Annotation { + public constructor Ann(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } -public final class Inv { - public constructor Inv() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + public final class Inv { + public constructor Inv() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/5.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/5.fir.kt index 3bc9d1af0ed..7d904331e09 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/5.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/5.fir.kt @@ -1,3 +1,12 @@ +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: annotations, type-annotations + * NUMBER: 5 + * DESCRIPTION: Type annotations on upper bounds with unresolved reference in parameters. + * ISSUES: KT-28424 + */ + // TESTCASE NUMBER: 1, 2 @Target(AnnotationTarget.TYPE) annotation class Ann(val x: Int) diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/6.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/6.fir.kt deleted file mode 100644 index f200e716961..00000000000 --- a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/6.fir.kt +++ /dev/null @@ -1,36 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER - -// TESTCASE NUMBER: 1, 2 -@Target(AnnotationTarget.TYPE) -annotation class Ann(val x: Int) - -/* - * TESTCASE NUMBER: 1 - * UNEXPECTED BEHAVIOUR - */ -fun case_1(a: Any) { - if (a is @Ann(unresolved_reference) String) return -} - -/* - * TESTCASE NUMBER: 2 - * UNEXPECTED BEHAVIOUR - */ -fun case_2(a: Any) { - a as @Ann(unresolved_reference) String // OK, no error in IDE and in the compiler -} - -/* - * TESTCASE NUMBER: 3 - * UNEXPECTED BEHAVIOUR - */ -fun case_3_1(a: Any) {} - -fun case_3_2(a: Any) { - case_3_1(a as @Ann(unresolved_reference) String) // OK, no error in IDE and in the compiler -} - -// TESTCASE NUMBER: 4 -fun case_4(a: Any) { - val x = a as @Ann(unresolved_reference) String // ERROR, has error in IDE and in the compiler -} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/6.kt b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/6.kt index 32732481eab..fa767dcdb48 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/6.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/6.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER /* diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/common/neg/1.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/common/neg/1.fir.kt index 52e388d5187..9e2d5e9b021 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/common/neg/1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/common/neg/1.fir.kt @@ -1,5 +1,13 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: contracts, analysis, common + * NUMBER: 1 + * DESCRIPTION: Analysis by contracts with mixed CallsInPlace and Returns effects. + */ + // FILE: contracts.kt package contracts diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/common/pos/1.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/common/pos/1.fir.kt index fed1d7bec38..3b239dc9615 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/common/pos/1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/common/pos/1.fir.kt @@ -1,5 +1,13 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: contracts, analysis, common + * NUMBER: 1 + * DESCRIPTION: Analysis by contracts with mixed CallsInPlace and Returns effects. + */ + // FILE: contracts.kt package contracts diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/1.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/1.fir.kt deleted file mode 100644 index 545bb0baedb..00000000000 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/1.fir.kt +++ /dev/null @@ -1,75 +0,0 @@ -// !OPT_IN: kotlin.contracts.ExperimentalContracts -// SKIP_TXT - -// TESTCASE NUMBER: 1 -fun case_1() { - val value_1: Int - funWithAtLeastOnceCallsInPlace { value_1 = 10 } - value_1.inc() -} - -// TESTCASE NUMBER: 2 -fun case_2() { - val value_1: Int - funWithAtMostOnceCallsInPlace { value_1 = 10 } - value_1.inc() -} - -// TESTCASE NUMBER: 3 -fun case_3() { - val value_1: Int - funWithUnknownCallsInPlace { value_1 = 10 } - value_1.inc() -} - -// TESTCASE NUMBER: 4 -fun case_4() { - var value_1: Int - var value_2: Int - funWithAtMostOnceCallsInPlace { value_1 = 10 } - funWithUnknownCallsInPlace { value_2 = 10 } - value_1.dec() - value_2.div(10) -} - -// TESTCASE NUMBER: 5 -class case_5 { - val value_1: Int - val value_2: Int - val value_3: Int - var value_4: Int - var value_5: Int - init { - funWithAtMostOnceCallsInPlace { value_1 = 1 } - funWithUnknownCallsInPlace { value_2 = 1 } - funWithAtLeastOnceCallsInPlace { value_3 = 1 } - funWithAtMostOnceCallsInPlace { value_4 = 2 } - funWithUnknownCallsInPlace { value_5 = 3 } - } -} - -// TESTCASE NUMBER: 6 -fun case_6() { - val value_1: Int - for (i in 0..1) - funWithExactlyOnceCallsInPlace { value_1 = 10 } - value_1.dec() -} - -// TESTCASE NUMBER: 7 -fun case_7() { - var value_1: Int - var i = 0 - while (i < 10) { - funWithExactlyOnceCallsInPlace { value_1 = 10 } - i++ - } - value_1.dec() -} - -// TESTCASE NUMBER: 8 -fun case_8() { - var value_1: Int - if (true) funWithAtLeastOnceCallsInPlace { value_1 = 10 } - value_1.dec() -} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/1.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/1.kt index 897b378581d..c3c4b572168 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/1.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/1.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !OPT_IN: kotlin.contracts.ExperimentalContracts // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/2.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/2.fir.kt index 0b016ef6fdb..2a91557f2ae 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/2.fir.kt @@ -1,6 +1,15 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: contracts, analysis, controlFlow, initialization + * NUMBER: 2 + * DESCRIPTION: val/var reassignment and/or uninitialized variable usages based on nested CallsInPlace effects with wrong invocation kind + * HELPERS: contractFunctions + */ + // TESTCASE NUMBER: 1 fun case_1() { val value_1: Int diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/3.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/3.fir.kt index 0aa0c8103c5..d1764de1b12 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/3.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/3.fir.kt @@ -1,15 +1,26 @@ +// LANGUAGE: +WarnAboutNonExhaustiveWhenOnAlgebraicTypes // !OPT_IN: kotlin.contracts.ExperimentalContracts // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: contracts, analysis, controlFlow, initialization + * NUMBER: 3 + * DESCRIPTION: val/var reassignment and/or uninitialized variable usages with compelx control flow inside/outside lambda of contract function with CallsInPlace effect + * HELPERS: enumClasses, contractFunctions + */ + // TESTCASE NUMBER: 1 fun case_1(value_1: EnumClass?) { val value_2: Int - when (value_1) { + when (value_1) { EnumClass.NORTH -> funWithExactlyOnceCallsInPlace { value_2 = 1 } EnumClass.SOUTH -> funWithExactlyOnceCallsInPlace { value_2 = 2 } EnumClass.EAST -> funWithExactlyOnceCallsInPlace { value_2 = 4 } null -> funWithExactlyOnceCallsInPlace { value_2 = 5 } + else -> {} } value_2.inc() diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/4.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/4.fir.kt index cb0a1afcaf6..a8b9c636537 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/4.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/4.fir.kt @@ -1,6 +1,15 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: contracts, analysis, controlFlow, initialization + * NUMBER: 4 + * DESCRIPTION: CallsInPlace contract functions with name shadowing and wrong invocation kind + * HELPERS: contractFunctions + */ + // TESTCASE NUMBER: 1 fun case_1() { val value_1: Int diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/5.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/5.fir.kt index 76a16a85c5f..c75833d0764 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/5.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/5.fir.kt @@ -1,38 +1,40 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: contracts, analysis, controlFlow, initialization + * NUMBER: 5 + * DESCRIPTION: CallsInPlace contract functions with invalid lambda passing to function parameter. + * HELPERS: contractFunctions + */ + // TESTCASE NUMBER: 1 fun case_1() { - val value_1: Int - funWithExactlyOnceCallsInPlace({ value_1 = 10 }) - value_1.inc() + var value_1: Int + val l = { value_1 = 10 } + funWithAtLeastOnceCallsInPlace(l) + value_1.inc() } // TESTCASE NUMBER: 2 fun case_2() { var value_1: Int - val l = { value_1 = 10 } + val l = fun () { value_1 = 10 } funWithAtLeastOnceCallsInPlace(l) value_1.inc() } // TESTCASE NUMBER: 3 fun case_3() { - var value_1: Int - val l = fun () { value_1 = 10 } - funWithAtLeastOnceCallsInPlace(l) - value_1.inc() -} - -// TESTCASE NUMBER: 4 -fun case_4() { var value_1: Int funWithAtLeastOnceCallsInPlace(fun () { value_1 = 10 }) value_1.inc() } -// TESTCASE NUMBER: 5 -fun case_5() { +// TESTCASE NUMBER: 4 +fun case_4() { val value_1: Int val o = object { fun l() { value_1 = 10 } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/3.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/3.fir.kt index 20d2d374433..1befe5455f3 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/3.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/3.fir.kt @@ -1,6 +1,15 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: contracts, analysis, controlFlow, initialization + * NUMBER: 3 + * DESCRIPTION: val/var assignments or subsequent usages with compelx control flow inside/outside lambda of contract function with CallsInPlace effect + * HELPERS: enumClasses, contractFunctions + */ + // TESTCASE NUMBER: 1 fun case_1(value_1: EnumClass?) { val value_2: Int diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/4.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/4.fir.kt index bf67f755518..04f1badb34a 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/4.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/4.fir.kt @@ -1,6 +1,15 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: contracts, analysis, controlFlow, initialization + * NUMBER: 4 + * DESCRIPTION: CallsInPlace contract functions with name shadowing + * HELPERS: contractFunctions + */ + // TESTCASE NUMBER: 1 fun case_1() { val value_1: Int diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/5.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/5.fir.kt index d3f64de6cd1..3bb6218896a 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/5.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/5.fir.kt @@ -1,5 +1,13 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: contracts, analysis, controlFlow, initialization + * NUMBER: 5 + * DESCRIPTION: Smart initialization with correspond contract function with default value before lambda. + * ISSUES: KT-26444 + */ // FILE: contracts.kt diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/6.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/6.fir.kt deleted file mode 100644 index 1827ea9ba89..00000000000 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/6.fir.kt +++ /dev/null @@ -1,49 +0,0 @@ -// !OPT_IN: kotlin.contracts.ExperimentalContracts - -// FILE: contracts.kt - -package contracts - -import kotlin.contracts.* - -// TESTCASE NUMBER: 3 -inline fun case_3(block1: () -> Unit, block2: () -> Unit, block3: () -> Unit) { - contract { - callsInPlace(block1, InvocationKind.EXACTLY_ONCE) - callsInPlace(block2, InvocationKind.AT_LEAST_ONCE) - callsInPlace(block3, InvocationKind.EXACTLY_ONCE) - } - block1() - block2() - block2() - block3() -} - -// FILE: main.kt - -import contracts.* - -// TESTCASE NUMBER: 1 -fun case_1() { - val value_1: Int - funWithExactlyOnceCallsInPlace({ value_1 = 11 }) - value_1.inc() -} - -// TESTCASE NUMBER: 2 -fun case_2() { - var value_1: Int - funWithAtLeastOnceCallsInPlace({ value_1 = 11 }) - value_1.inc() -} - -// TESTCASE NUMBER: 3 -fun case_3() { - val value_1: Int - var value_2: Int - val value_3: Int - contracts.case_3({ value_1 = 1 }, { value_2 = 2 }, { value_3 = 3 }) - value_1.inc() - value_2.inc() - value_3.inc() -} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/6.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/6.kt index 5fd04f941ac..98ceff54f3c 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/6.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/6.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !OPT_IN: kotlin.contracts.ExperimentalContracts /* diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/neg/1.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/neg/1.fir.kt deleted file mode 100644 index a9d8b209e5b..00000000000 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/neg/1.fir.kt +++ /dev/null @@ -1,37 +0,0 @@ -// LANGUAGE: -BreakContinueInInlineLambdas -// !OPT_IN: kotlin.contracts.ExperimentalContracts -// SKIP_TXT - -// TESTCASE NUMBER: 1 -fun case_1(value_1: Boolean) { - while (value_1) { - funWithExactlyOnceCallsInPlace { - break - } - println("1") - } - - loop@ for (i in 0..10) { - funWithExactlyOnceCallsInPlace { - break@loop - } - println("1") - } -} - -// TESTCASE NUMBER: 2 -fun case_2(value_1: Boolean) { - for (i in 0..10) { - funWithExactlyOnceCallsInPlace { - continue - } - println("1") - } - - loop@ while (value_1) { - funWithExactlyOnceCallsInPlace { - continue@loop - } - println("1") - } -} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/neg/1.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/neg/1.kt index d9e8d210d20..22d235cde31 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/neg/1.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/neg/1.kt @@ -1,3 +1,5 @@ +// FIR_IDENTICAL +// LANGUAGE: -BreakContinueInInlineLambdas // !OPT_IN: kotlin.contracts.ExperimentalContracts // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/1.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/1.fir.kt index c1cd9790d80..d8b2b0ace26 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/1.fir.kt @@ -2,6 +2,15 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: contracts, analysis, controlFlow, unreachableCode + * NUMBER: 1 + * DESCRIPTION: Unreachable code detection using contract function with CallsInPlace effect + * HELPERS: contractFunctions + */ + // TESTCASE NUMBER: 1 fun case_1() { funWithExactlyOnceCallsInPlace { diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/3.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/3.fir.kt index 961d075d430..7587b92b1b0 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/3.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/3.fir.kt @@ -1,6 +1,15 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: contracts, analysis, controlFlow, unreachableCode + * NUMBER: 3 + * DESCRIPTION: Unreachable code detection using local functions or labdas combined with contract functions with CallsInPlace effect + * HELPERS: contractFunctions + */ + // TESTCASE NUMBER: 1 fun case_1() { funWithExactlyOnceCallsInPlace { diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/4.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/4.fir.kt index f507043794d..6aa70344684 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/4.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/4.fir.kt @@ -1,6 +1,15 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: contracts, analysis, controlFlow, unreachableCode + * NUMBER: 4 + * DESCRIPTION: Unreachable code detection using nested contract functions with CallsInPlace effect + * HELPERS: contractFunctions + */ + // TESTCASE NUMBER: 1 fun case_1() { funWithExactlyOnceCallsInPlace { diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/5.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/5.fir.kt index 7f4a67246c6..14a1776a0f3 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/5.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/5.fir.kt @@ -1,6 +1,15 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: contracts, analysis, controlFlow, unreachableCode + * NUMBER: 5 + * DESCRIPTION: Unreachable code detection using contract functions with complex control flow inside + * HELPERS: contractFunctions + */ + // TESTCASE NUMBER: 1 fun case_1(b: Boolean?) { funWithExactlyOnceCallsInPlace { diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/6.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/6.fir.kt index e10b41a920d..4a7e4a5fb3d 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/6.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/6.fir.kt @@ -1,6 +1,15 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: contracts, analysis, controlFlow, unreachableCode + * NUMBER: 6 + * DESCRIPTION: Check for lack of unreachable code report when in complex control flow of contract function lambda not all branches are doing non-local return + * HELPERS: contractFunctions + */ + // TESTCASE NUMBER: 1 fun case_1(b: Boolean?, c: Boolean) { funWithExactlyOnceCallsInPlace { diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/7.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/7.fir.kt index bb23427b17f..dc98b5005be 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/7.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/7.fir.kt @@ -1,5 +1,14 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: contracts, analysis, controlFlow, unreachableCode + * NUMBER: 7 + * DESCRIPTION: Smart initialization with correspond contract function with default value before lambda. + * ISSUES: KT-26444 + */ + // FILE: contracts.kt package contracts diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/1.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/1.fir.kt index bd8509dd768..015273ca0e3 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/1.fir.kt @@ -1,6 +1,15 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: contracts, analysis, smartcasts + * NUMBER: 1 + * DESCRIPTION: Smartcasts using Returns effects with simple type checking, not-null conditions and custom condition (condition for smartcast outside contract). + * HELPERS: contractFunctions + */ + // TESTCASE NUMBER: 1 fun case_1(value_1: Any?) { funWithReturns(value_1 !is String) @@ -10,14 +19,14 @@ fun case_1(value_1: Any?) { // TESTCASE NUMBER: 2 fun case_2(value_1: Int?) { funWithReturnsAndInvertCondition(value_1 != null) - println(value_1.inc()) // inc resolves to compiler/tests-spec/testData/diagnostics/helpers/classes.kt which accepts `Class?` + println(value_1.inc()) println(value_1.unaryPlus()) } // TESTCASE NUMBER: 3 fun case_3(value_1: Int?) { funWithReturns(value_1 == null) - println(value_1.inc()) // inc resolves to compiler/tests-spec/testData/diagnostics/helpers/classes.kt which accepts `Class?` + println(value_1.inc()) println(value_1.unaryPlus()) } @@ -45,7 +54,7 @@ object case_7_object { } fun case_7() { funWithReturns(case_7_object.prop_1 == null) - case_7_object.prop_1.inc() // inc resolves to compiler/tests-spec/testData/diagnostics/helpers/classes.kt which accepts `Class?` + case_7_object.prop_1.inc() } // TESTCASE NUMBER: 8 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/10.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/10.fir.kt index b52e0374f24..233ee565c4a 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/10.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/10.fir.kt @@ -1,5 +1,15 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: contracts, analysis, smartcasts + * NUMBER: 10 + * DESCRIPTION: Check smartcasts using double negation (returnsFalse/invert type checking/not operator). + * ISSUES: KT-26176 + * HELPERS: contractFunctions + */ + // FILE: contracts.kt package contracts diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/11.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/11.fir.kt index 01671375a5b..d237e7b9b2c 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/11.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/11.fir.kt @@ -1,5 +1,14 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: contracts, analysis, smartcasts + * NUMBER: 11 + * DESCRIPTION: Smartcast using many of the various Returns effects on the same values. + * HELPERS: contractFunctions + */ + // FILE: contracts.kt package contracts diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/12.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/12.fir.kt index b098c7ff11f..57bc046c811 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/12.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/12.fir.kt @@ -1,5 +1,15 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: contracts, analysis, smartcasts + * NUMBER: 12 + * DESCRIPTION: Check smartcast to upper bound of the types in disjunction. + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-1982 + */ + // FILE: contracts.kt package contracts diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/13.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/13.fir.kt index fb9da4d70dd..a62dfcf2be4 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/13.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/13.fir.kt @@ -1,5 +1,14 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: contracts, analysis, smartcasts + * NUMBER: 13 + * DESCRIPTION: Smartcast using many of the various Returns effects on the same values. + * HELPERS: contractFunctions + */ + // FILE: contracts.kt package contracts diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/14.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/14.fir.kt index fb9da4d70dd..a550373bcf7 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/14.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/14.fir.kt @@ -1,5 +1,14 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: contracts, analysis, smartcasts + * NUMBER: 14 + * DESCRIPTION: Smartcast using many of the various Returns effects on the same values. + * HELPERS: contractFunctions + */ + // FILE: contracts.kt package contracts diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/15.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/15.fir.kt index 412f0116fcd..820cc317334 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/15.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/15.fir.kt @@ -1,5 +1,15 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: contracts, analysis, smartcasts + * NUMBER: 15 + * DESCRIPTION: Check smartcasts working if type checking for contract function is used + * ISSUES: KT-27241 + * HELPERS: contractFunctions + */ + // FILE: contracts.kt package contracts diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/2.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/2.fir.kt index 5aa6d852dea..25ac86dacc1 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/2.fir.kt @@ -1,6 +1,15 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: contracts, analysis, smartcasts + * NUMBER: 2 + * DESCRIPTION: Smartcasts using Returns effects with complex (conjunction/disjunction) type checking and not-null conditions outside contract (custom condition). + * HELPERS: contractFunctions + */ + // TESTCASE NUMBER: 1 fun case_1(value_1: Any?, value_2: Any?) { funWithReturns(value_1 !is String || value_2 !is Number) diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/3.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/3.fir.kt index 899059c12ab..fa00b5e19fe 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/3.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/3.fir.kt @@ -1,5 +1,13 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: contracts, analysis, smartcasts + * NUMBER: 3 + * DESCRIPTION: Smartcasts using Returns effects with complex (conjunction/disjunction) type checking and not-null conditions inside contract. + */ + // FILE: contracts.kt package contracts diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/4.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/4.fir.kt index 3a93ae31dc4..79725c7e061 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/4.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/4.fir.kt @@ -1,5 +1,13 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: contracts, analysis, smartcasts + * NUMBER: 4 + * DESCRIPTION: Smartcasts using Returns effects with simple type checking and not-null conditions on receiver inside contract. + */ + // FILE: contracts.kt package contracts diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/5.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/5.fir.kt index 2b022f8c1c4..b4821df2d27 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/5.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/5.fir.kt @@ -1,5 +1,13 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: contracts, analysis, smartcasts + * NUMBER: 5 + * DESCRIPTION: Smartcasts using Returns effects with complex (conjunction/disjunction) type checking and not-null conditions on receiver inside contract. + */ + // FILE: contracts.kt package contracts diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/6.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/6.fir.kt index db9e71af3a9..a01a513fc65 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/6.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/6.fir.kt @@ -1,5 +1,13 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: contracts, analysis, smartcasts + * NUMBER: 6 + * DESCRIPTION: Smartcasts using Returns effects with complex (conjunction/disjunction) type checking and not-null conditions on receiver and some values (mixed) inside contract. + */ + // FILE: contracts.kt package contracts diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/7.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/7.fir.kt index 185c0406eab..3a3a9f875ea 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/7.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/7.fir.kt @@ -1,5 +1,13 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: contracts, analysis, smartcasts + * NUMBER: 7 + * DESCRIPTION: Smartcasts using Returns effects with nested or subsequent contract function calls. + */ + // FILE: contracts.kt package contracts diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/8.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/8.fir.kt index bb61a0fac14..c735bca2c36 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/8.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/8.fir.kt @@ -1,5 +1,15 @@ +// LANGUAGE: +WarnAboutNonExhaustiveWhenOnAlgebraicTypes // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: contracts, analysis, smartcasts + * NUMBER: 8 + * DESCRIPTION: Smartcasts using some Returns effects. + * HELPERS: contractFunctions + */ + // FILE: contracts.kt package contracts @@ -100,7 +110,7 @@ fun case_4(value_1: Number, value_2: (() -> Unit)?) { // TESTCASE NUMBER: 5 fun case_5(value_1: Number?, value_2: String?) { - when (value_2.case_5(value_1)) { + when (value_2.case_5(value_1)) { true -> { println(value_2.length) println(value_1.toByte()) @@ -109,6 +119,7 @@ fun case_5(value_1: Number?, value_2: String?) { println(value_2.length) println(value_1.inv()) } + else -> {} } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/9.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/9.fir.kt deleted file mode 100644 index 3b3dfaf4962..00000000000 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/9.fir.kt +++ /dev/null @@ -1,28 +0,0 @@ -// !OPT_IN: kotlin.contracts.ExperimentalContracts -// SKIP_TXT - -// TESTCASE NUMBER: 1 -fun case_1(arg: Int?) { - funWithAtMostOnceCallsInPlace { arg!! } - arg.inc() -} - -// TESTCASE NUMBER: 2 -fun case_2(arg: Int?) { - funWithUnknownCallsInPlace { arg!! } - arg.inc() -} - -// TESTCASE NUMBER: 3 -fun case_3() { - val value_1: Boolean? - funWithAtMostOnceCallsInPlace { value_1 = false } - value_1.not() -} - -// TESTCASE NUMBER: 4 -fun case_4() { - val value_1: Boolean? - funWithUnknownCallsInPlace { value_1 = true } - value_1.not() -} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/9.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/9.kt index 752475c82f8..63f547044b1 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/9.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/9.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !OPT_IN: kotlin.contracts.ExperimentalContracts // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/1.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/1.fir.kt index 28d2a0005b8..aac007753ae 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/1.fir.kt @@ -1,6 +1,15 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: contracts, analysis, smartcasts + * NUMBER: 1 + * DESCRIPTION: Smartcasts using Returns effects with simple type checking, not-null conditions and custom condition (condition for smartcast outside contract). + * HELPERS: contractFunctions + */ + // TESTCASE NUMBER: 1 fun case_1(value_1: Any?) { funWithReturns(value_1 is String) diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/10.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/10.fir.kt index d3733929f5c..0ee3d9aef45 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/10.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/10.fir.kt @@ -1,6 +1,16 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: contracts, analysis, smartcasts + * NUMBER: 10 + * DESCRIPTION: Smartcasts with correspond contract function with default value in last parameter. + * ISSUES: KT-26444 + * HELPERS: contractFunctions + */ + // FILE: contracts.kt package contracts diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/11.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/11.fir.kt index 3b226006a5d..43762d05e78 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/11.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/11.fir.kt @@ -1,5 +1,15 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: contracts, analysis, smartcasts + * NUMBER: 11 + * DESCRIPTION: Check smartcasts with passing same fields of instances of the same class in contract function with conjunction not-null condition. + * ISSUES: KT-26300 + * HELPERS: contractFunctions + */ + // FILE: contracts.kt package contracts diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/12.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/12.fir.kt index 9b28dfa5e71..a1499e67e3f 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/12.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/12.fir.kt @@ -1,6 +1,17 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: contracts, analysis, smartcasts + * NUMBER: 12 + * DESCRIPTION: Smartcasts after non-null assertions or not-null value assignment in lambdas of contract function with 'exactly once' or 'at least once' CallsInPlace effects. + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-26148 + * HELPERS: contractFunctions + */ + // TESTCASE NUMBER: 1 fun case_1(arg: Int?) { funWithExactlyOnceCallsInPlace { arg!! } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/13.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/13.fir.kt index b098c7ff11f..ab575094d6e 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/13.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/13.fir.kt @@ -1,5 +1,15 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: contracts, analysis, smartcasts + * NUMBER: 13 + * DESCRIPTION: Check smartcast to upper bound of the types in disjunction. + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-1982 + */ + // FILE: contracts.kt package contracts diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/14.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/14.fir.kt index c40e4eae670..e41d8b5f15f 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/14.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/14.fir.kt @@ -1,5 +1,15 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: contracts, analysis, smartcasts + * NUMBER: 14 + * DESCRIPTION: Check smartcast with non-null assertion for a contract function. + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-26856 + */ + // FILE: contracts.kt package contracts diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/2.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/2.fir.kt index 10ad2ff982b..6b11d3bf3d2 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/2.fir.kt @@ -1,6 +1,15 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: contracts, analysis, smartcasts + * NUMBER: 2 + * DESCRIPTION: Smartcasts using Returns effects with complex (conjunction/disjunction) type checking and not-null conditions outside contract (custom condition). + * HELPERS: contractFunctions + */ + // TESTCASE NUMBER: 1 fun case_1(value_1: Any?, value_2: Any?) { funWithReturns(value_1 is String && value_2 is Number) diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/3.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/3.fir.kt index 5a59d937565..619af4bfc1a 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/3.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/3.fir.kt @@ -1,5 +1,13 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: contracts, analysis, smartcasts + * NUMBER: 3 + * DESCRIPTION: Smartcasts using Returns effects with complex (conjunction/disjunction) type checking and not-null conditions inside contract. + */ + // FILE: contracts.kt package contracts diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/4.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/4.fir.kt index 7ba53150f31..c8107819c49 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/4.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/4.fir.kt @@ -1,5 +1,13 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: contracts, analysis, smartcasts + * NUMBER: 4 + * DESCRIPTION: Smartcasts using Returns effects with simple type checking and not-null conditions on receiver inside contract. + */ + // FILE: contracts.kt package contracts diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/5.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/5.fir.kt index 4ea924e043e..83970b1a8b0 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/5.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/5.fir.kt @@ -1,5 +1,13 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: contracts, analysis, smartcasts + * NUMBER: 5 + * DESCRIPTION: Smartcasts using Returns effects with complex (conjunction/disjunction) type checking and not-null conditions on receiver inside contract. + */ + // FILE: contracts.kt package contracts diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/6.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/6.fir.kt index 360f055c49f..49fedd2ba5e 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/6.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/6.fir.kt @@ -1,5 +1,13 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: contracts, analysis, smartcasts + * NUMBER: 6 + * DESCRIPTION: Smartcasts using Returns effects with complex (conjunction/disjunction) type checking and not-null conditions on receiver and some values (mixed) inside contract. + */ + // FILE: contracts.kt package contracts diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/7.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/7.fir.kt index a124f6cc06e..7e72e9eabbe 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/7.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/7.fir.kt @@ -1,5 +1,13 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: contracts, analysis, smartcasts + * NUMBER: 7 + * DESCRIPTION: Smartcasts using Returns effects with nested or subsequent contract function calls. + */ + // FILE: contracts.kt package contracts diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/8.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/8.fir.kt index eaa3610736f..267fce944b8 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/8.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/8.fir.kt @@ -1,5 +1,15 @@ +// LANGUAGE: +WarnAboutNonExhaustiveWhenOnAlgebraicTypes // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: contracts, analysis, smartcasts + * NUMBER: 8 + * DESCRIPTION: Smartcasts using some Returns effects. + * HELPERS: contractFunctions + */ + // FILE: contracts.kt package contracts @@ -104,7 +114,7 @@ fun case_4(value_1: Number, value_2: (() -> Unit)?) { * ISSUES: KT-26612 */ fun case_5(value_1: Number?, value_2: String?) { - when (value_2.case_5(value_1)) { + when (value_2.case_5(value_1)) { true -> { println(value_2.length) println(value_1.toByte()) @@ -113,6 +123,7 @@ fun case_5(value_1: Number?, value_2: String?) { println(value_2.length) println(value_1.inv()) } + else -> {} } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/9.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/9.fir.kt index 332f792891c..20bacf5caf8 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/9.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/9.fir.kt @@ -1,5 +1,14 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: contracts, analysis, smartcasts + * NUMBER: 9 + * DESCRIPTION: Smartcast using complex condition with some contract functions (Returns effect). + * HELPERS: typesProvider, contractFunctions + */ + // FILE: contracts.kt package contracts diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/1.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/1.fir.kt index bfa5ca7f910..90c367dd18c 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/1.fir.kt @@ -1,6 +1,14 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER -UNREACHABLE_CODE -UNUSED_EXPRESSION // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: contracts, declarations, contractBuilder, common + * NUMBER: 1 + * DESCRIPTION: Contract isn't first statement. + */ + import kotlin.contracts.* // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/10.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/10.fir.kt index ce47cc9eb56..f378615edd7 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/10.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/10.fir.kt @@ -1,5 +1,14 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: contracts, declarations, contractBuilder, common + * NUMBER: 10 + * DESCRIPTION: Contract with label after 'contract' keyword. + * ISSUES: KT-26153 + */ + import kotlin.contracts.* // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/11.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/11.fir.kt index 68a1702ca70..735031f0255 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/11.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/11.fir.kt @@ -1,5 +1,14 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: contracts, declarations, contractBuilder, common + * NUMBER: 11 + * DESCRIPTION: Functions with contracts and external contract builder. + * ISSUES: KT-26186 + */ + // FILE: builder.kt package builder diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/12.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/12.fir.kt index 156cc41ba7a..047b2194ce6 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/12.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/12.fir.kt @@ -1,5 +1,14 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: contracts, declarations, contractBuilder, common + * NUMBER: 12 + * DESCRIPTION: Functions with contracts and external effect builder. + * ISSUES: KT-26186 + */ + // FILE: builder.kt package builder diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/13.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/13.fir.kt index c77a22a08d5..e97df485f29 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/13.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/13.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER -UNREACHABLE_CODE -UNUSED_EXPRESSION // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: contracts, declarations, contractBuilder, common + * NUMBER: 13 + * DESCRIPTION: Contract function with CallsInPlace effect with not allowed implies. + * ISSUES: KT-26409 + */ + import kotlin.contracts.* // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/14.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/14.fir.kt index 1f5630592cc..d666fb6c577 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/14.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/14.fir.kt @@ -1,6 +1,16 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: contracts, declarations, contractBuilder, common + * NUMBER: 14 + * DESCRIPTION: Contract is first statement in control flow terms, but not in tokens order terms. + * ISSUES: KT-26153 + * HELPERS: functions + */ + import kotlin.contracts.* // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/17.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/17.fir.kt index 650d0d311bd..d50570d7eea 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/17.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/17.fir.kt @@ -1,6 +1,16 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER -UNREACHABLE_CODE -UNUSED_EXPRESSION // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: contracts, declarations, contractBuilder, common + * NUMBER: 17 + * DESCRIPTION: contracts with Nothing expressions in implies. + * DISCUSSION + * ISSUES: KT-25948 + */ + import kotlin.contracts.* // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/2.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/2.fir.kt index 14b7beba44a..d205f50ba70 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/2.fir.kt @@ -1,6 +1,14 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER -UNREACHABLE_CODE -UNUSED_EXPRESSION // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: contracts, declarations, contractBuilder, common + * NUMBER: 2 + * DESCRIPTION: contracts with not allowed simple conditions in implies + */ + import kotlin.contracts.* // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/3.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/3.fir.kt index 5b51237bd16..b29e738c0ab 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/3.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/3.fir.kt @@ -1,6 +1,14 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER -UNREACHABLE_CODE -UNUSED_EXPRESSION // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: contracts, declarations, contractBuilder, common + * NUMBER: 3 + * DESCRIPTION: contracts with not allowed complex conditions in implies. + */ + import kotlin.contracts.* // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/4.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/4.fir.kt index e80a67137d7..d099f193e68 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/4.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/4.fir.kt @@ -1,6 +1,14 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER -UNREACHABLE_CODE -UNUSED_EXPRESSION // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: contracts, declarations, contractBuilder, common + * NUMBER: 4 + * DESCRIPTION: contracts with not allowed conditions with constants in implies. + */ + import kotlin.contracts.* // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/5.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/5.fir.kt index abe919315e1..28d9c960e00 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/5.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/5.fir.kt @@ -1,6 +1,14 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER -UNREACHABLE_CODE -UNUSED_EXPRESSION // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: contracts, declarations, contractBuilder, common + * NUMBER: 5 + * DESCRIPTION: contracts with not allowed expressions in implies. + */ + import kotlin.contracts.* // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/6.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/6.fir.kt index a2dee8ecb31..c6074542a4e 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/6.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/6.fir.kt @@ -2,6 +2,15 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER -UNREACHABLE_CODE -UNUSED_EXPRESSION // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: contracts, declarations, contractBuilder, common + * NUMBER: 6 + * DESCRIPTION: contracts with not function parameters in implies. + * HELPERS: typesProvider + */ + import kotlin.contracts.* // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/7.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/7.fir.kt index 485c111e4d2..0cf185b0e37 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/7.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/7.fir.kt @@ -1,6 +1,16 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER -UNREACHABLE_CODE -UNUSED_EXPRESSION // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: contracts, declarations, contractBuilder, common + * NUMBER: 7 + * DESCRIPTION: Contract function with 'this' labeled by not current extensible object + * ISSUES: KT-26149 + * HELPERS: typesProvider + */ + import kotlin.contracts.* // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/8.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/8.fir.kt index 6dca0c96728..9906205d640 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/8.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/8.fir.kt @@ -1,6 +1,14 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER -UNREACHABLE_CODE -UNUSED_EXPRESSION // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: contracts, declarations, contractBuilder, common + * NUMBER: 8 + * DESCRIPTION: Not allowed empty contract. + */ + import kotlin.contracts.* // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/9.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/9.fir.kt index 0b9eff94ad0..20f07937764 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/9.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/9.fir.kt @@ -1,6 +1,14 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER -UNREACHABLE_CODE -UNUSED_EXPRESSION // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: contracts, declarations, contractBuilder, common + * NUMBER: 9 + * DESCRIPTION: Function with contract as returned expression. + */ + import kotlin.contracts.* // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/pos/1.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/pos/1.fir.kt index fba2c451f4e..1b0e478854a 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/pos/1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/pos/1.fir.kt @@ -1,5 +1,12 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: contracts, declarations, contractBuilder, common + * NUMBER: 1 + * DESCRIPTION: Functions with simple contracts. + */ import kotlin.contracts.* diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/callsInPlace/neg/1.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/callsInPlace/neg/1.fir.kt index 1dea6936ddc..654fc7d668c 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/callsInPlace/neg/1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/callsInPlace/neg/1.fir.kt @@ -1,5 +1,14 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: contracts, declarations, contractBuilder, effects, callsInPlace + * NUMBER: 1 + * DESCRIPTION: contract functions with CallsInPlace with dynamic InvocationKind. + * ISSUES: KT-26152 + */ + import kotlin.contracts.* // TESTCASE NUMBER: 1, 2, 3, 4 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/callsInPlace/neg/2.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/callsInPlace/neg/2.fir.kt index 4b625ccea73..df76917ad87 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/callsInPlace/neg/2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/callsInPlace/neg/2.fir.kt @@ -1,5 +1,14 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: contracts, declarations, contractBuilder, effects, callsInPlace + * NUMBER: 2 + * DESCRIPTION: functions with contract and duplicate CallsInPlace. + * ISSUES: KT-26150 + */ + import kotlin.contracts.* // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/common/neg/1.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/common/neg/1.fir.kt index d22826b92a5..9ff431c9102 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/common/neg/1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/common/neg/1.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: contracts, declarations, contractBuilder, effects, common + * NUMBER: 1 + * DESCRIPTION: Indirect effect functions call. + * ISSUES: KT-26175 + */ + import kotlin.contracts.* // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/1.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/1.fir.kt index 202d2e41723..e724ca91d72 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/1.fir.kt @@ -1,5 +1,14 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: contracts, declarations, contractBuilder, effects, returns + * NUMBER: 1 + * DESCRIPTION: Using equality with expressions in implies. + * ISSUES: KT-26178 + */ + import kotlin.contracts.* // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/2.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/2.fir.kt index 289e78b00bd..fc515d63326 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/2.fir.kt @@ -1,5 +1,13 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: contracts, declarations, contractBuilder, effects, returns + * NUMBER: 2 + * DESCRIPTION: Using equality with not labeled 'this' in implies. + */ + import kotlin.contracts.* // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/3.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/3.fir.kt index 63fa9436a53..f019219726f 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/3.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/3.fir.kt @@ -1,5 +1,15 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: contracts, declarations, contractBuilder, effects, returns + * NUMBER: 3 + * DESCRIPTION: Using reference equality in implies. + * ISSUES: KT-26177 + * HELPERS: objects + */ + import kotlin.contracts.* // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/4.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/4.fir.kt index 5946edac1fe..7bb3dfdc070 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/4.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/4.fir.kt @@ -1,5 +1,14 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: contracts, declarations, contractBuilder, effects, returns + * NUMBER: 4 + * DESCRIPTION: Using equality with literals in implies. + * ISSUES: KT-26178 + */ + import kotlin.contracts.* // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/5.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/5.fir.kt index d8b99b51fd1..4efa8cf7404 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/5.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/5.fir.kt @@ -1,5 +1,14 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: contracts, declarations, contractBuilder, effects, returns + * NUMBER: 5 + * DESCRIPTION: Contract on the extension function with Boolean upper bound (Boolean or Nothing) or smartcast to Boolean. + * DISCUSSION + */ + import kotlin.contracts.* // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/6.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/6.fir.kt index 844c71050af..9c7fbb50f86 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/6.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/6.fir.kt @@ -1,5 +1,13 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: contracts, declarations, contractBuilder, effects, returns + * NUMBER: 6 + * DESCRIPTION: Contract on the extension function with smartcast to Boolean. + */ + import kotlin.contracts.* // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/7.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/7.fir.kt index ac3daf8d6bb..aa7acc940f2 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/7.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/7.fir.kt @@ -1,6 +1,15 @@ // !LANGUAGE: +AllowContractsForNonOverridableMembers +AllowReifiedGenericsInContracts // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: contracts, declarations, contractBuilder, effects, returns + * NUMBER: 7 + * DESCRIPTION: Returns effect with type checking with generic parameter + * ISSUES: KT-26296 + */ + import kotlin.contracts.* // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/pos/1.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/pos/1.fir.kt deleted file mode 100644 index e27633c4534..00000000000 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/pos/1.fir.kt +++ /dev/null @@ -1,76 +0,0 @@ -// !OPT_IN: kotlin.contracts.ExperimentalContracts -// !DIAGNOSTICS: -FINAL_UPPER_BOUND - -import kotlin.contracts.* - -// TESTCASE NUMBER: 1 -fun case_1(value_1: Boolean) { - contract { returns() implies (value_1) } - if (!value_1) throw Exception() -} - -// TESTCASE NUMBER: 2 -fun case_2(value_1: Boolean): Boolean { - contract { returns(false) implies (!value_1) } - return value_1 -} - -// TESTCASE NUMBER: 3 -fun Boolean.case_3() { - contract { returns() implies (!this@case_3) } - if (this@case_3) throw Exception() -} - -// TESTCASE NUMBER: 5 -fun case_5(value_1: Any?) { - contract { returns() implies (value_1 is String) } - if (value_1 !is String) throw Exception() -} - -// TESTCASE NUMBER: 6 -fun case_6(value_1: Any?) { - contract { returns() implies (value_1 !is String?) } - if (value_1 is String?) throw Exception() -} - -// TESTCASE NUMBER: 7 -fun Any?.case_7() { - contract { returns() implies (this@case_7 is Number) } - if (this !is Number) throw Exception() -} - -// TESTCASE NUMBER: 8 -fun T?.case_8() { - contract { returns() implies (this@case_8 !is ClassLevel3?) } - if (this is ClassLevel3?) throw Exception() -} - -// TESTCASE NUMBER: 9 -fun T.case_9(): Boolean? { - contract { returns(null) implies (this@case_9 is Byte?) } - return if (this is Byte?) null else true -} - -// TESTCASE NUMBER: 10 -fun case_10(value_1: Any?) { - contract { returns() implies (value_1 == null) } - if (value_1 != null) throw Exception() -} - -// TESTCASE NUMBER: 11 -fun case_11(value_1: Any?): Boolean? { - contract { returns(null) implies (value_1 != null) } - return if (value_1 != null) null else true -} - -// TESTCASE NUMBER: 12 -fun Char.case_12() { - contract { returns() implies (this@case_12 == null) } - if (this@case_12 != null) throw Exception() -} - -// TESTCASE NUMBER: 13 -fun T?.case_13() { - contract { returns() implies (this@case_13 == null) } - if (this != null) throw Exception() -} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/pos/1.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/pos/1.kt index 56d9db5eab2..95502160ee1 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/pos/1.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/pos/1.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !OPT_IN: kotlin.contracts.ExperimentalContracts // !DIAGNOSTICS: -FINAL_UPPER_BOUND diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractFunction/neg/1.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractFunction/neg/1.fir.kt index 8c3ebb36e9b..3de9ba14e35 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractFunction/neg/1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractFunction/neg/1.fir.kt @@ -1,5 +1,13 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: contracts, declarations, contractFunction + * NUMBER: 1 + * DESCRIPTION: Check that recursion isn't allowed in contract functions with CallsInPlace effect. + */ + import kotlin.contracts.* // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractFunction/neg/2.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractFunction/neg/2.fir.kt index e073cc751d2..61fb8227e1f 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractFunction/neg/2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractFunction/neg/2.fir.kt @@ -1,6 +1,16 @@ // !LANGUAGE: +AllowContractsForNonOverridableMembers +AllowReifiedGenericsInContracts // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: contracts, declarations, contractFunction + * NUMBER: 2 + * DESCRIPTION: Check report about use contracts in literal functions, lambdas or not top-level functions. + * ISSUES: KT-26149 + * HELPERS: classes + */ + import kotlin.contracts.* // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractFunction/neg/4.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractFunction/neg/4.fir.kt index 3d9a2f07bb8..d122fdfb880 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractFunction/neg/4.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractFunction/neg/4.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: contracts, declarations, contractFunction + * NUMBER: 4 + * DESCRIPTION: Check that fun with contract and CallsInPlace effect is an inline function. + * ISSUES: KT-27090 + */ + import kotlin.contracts.* // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractFunction/pos/1.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractFunction/pos/1.fir.kt index e757ca131a9..f46bd783517 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractFunction/pos/1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractFunction/pos/1.fir.kt @@ -1,5 +1,13 @@ // !OPT_IN: kotlin.contracts.ExperimentalContracts +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: contracts, declarations, contractFunction + * NUMBER: 1 + * DESCRIPTION: Use a contract function before the declaration it. + */ + import kotlin.contracts.* // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/1.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/1.fir.kt index 0667e6b4c1e..2cbe08703e4 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/1.fir.kt @@ -1,7 +1,16 @@ -// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE +// !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT // WITH_EXTENDED_CHECKERS +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 1 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, functions, typealiases, properties, enumClasses, interfaces, sealedClasses + */ + // TESTCASE NUMBER: 1 fun case_1(x: Any?) { if (x != null is Boolean) { @@ -237,7 +246,7 @@ fun case_14() { // TESTCASE NUMBER: 15 fun case_15(x: EmptyObject) { - val t = if (x === null is Boolean is Boolean is Boolean) "" else { + val t = if (x === null is Boolean is Boolean is Boolean) "" else { x x.equals(null) x.propT diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/1.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/1.kt index 2a3aef2d51e..4eb5642b039 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/1.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/1.kt @@ -1,5 +1,6 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +// WITH_EXTENDED_CHECKERS /* * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/10.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/10.fir.kt index 0d3db5c98f7..5d02b3be8bc 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/10.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/10.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 10 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, enumClasses, interfaces, sealedClasses + */ + // TESTCASE NUMBER: 1 fun case_1() { var x: Any? = null diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/11.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/11.fir.kt index d936cac6cc6..47459b33fc2 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/11.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/11.fir.kt @@ -1,6 +1,17 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 11 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28369 + */ + // TESTCASE NUMBER: 1 fun case_1() { var x: Boolean? = true diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/12.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/12.fir.kt index 60eb14b4ef9..010e29518d4 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/12.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/12.fir.kt @@ -1,6 +1,17 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 12 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28370 + */ + // TESTCASE NUMBER: 1 fun case_1() { var x: Int? = 11 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/12.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/12.kt index 3d0aee4caab..653a3796073 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/12.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/12.kt @@ -1,4 +1,3 @@ - // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/13.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/13.fir.kt index e69732111ff..0d950cdecae 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/13.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/13.fir.kt @@ -1,6 +1,17 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 13 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30507 + */ + // TESTCASE NUMBER: 1 fun case_1(x: Class?) { x!! diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/14.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/14.fir.kt index 8c4334f1522..6bbaeccbb59 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/14.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/14.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 14 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + // TESTCASE NUMBER: 1 fun case_1(x: Int?) { if ((x is Int) ?: (x is Int)) { diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/15.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/15.fir.kt index 21ce50c13d0..00d5f0044da 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/15.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/15.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 15 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + /* * TESTCASE NUMBER: 1 * UNEXPECTED BEHAVIOUR diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/16.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/16.fir.kt index ccfb8d5d8ea..2c34b745447 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/16.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/16.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 16 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + /* * TESTCASE NUMBER: 1 * UNEXPECTED BEHAVIOUR diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/17.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/17.fir.kt index 17c6b93d487..436beaf03d8 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/17.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/17.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 17 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + /* * TESTCASE NUMBER: 1 * ISSUES: KT-28362 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/19.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/19.fir.kt index 2857a53103c..d0046616c11 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/19.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/19.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 19 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + /* * TESTCASE NUMBER: 1 * UNEXPECTED BEHAVIOUR diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/2.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/2.fir.kt index f066c301f2f..4fa0a03db0e 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/2.fir.kt @@ -1,6 +1,14 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 2 + * DESCRIPTION: Raw data flow analysis test + */ + // TESTCASE NUMBER: 1 fun case_1(x: Any?) { if (x is Nothing) { diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/20.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/20.fir.kt index 72cee6be7be..96e5820655d 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/20.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/20.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 20 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + /* * TESTCASE NUMBER: 1 * UNEXPECTED BEHAVIOUR diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/21.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/21.fir.kt index d8f71881074..c33363afaf3 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/21.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/21.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 21 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + /* * TESTCASE NUMBER: 1 * UNEXPECTED BEHAVIOUR diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/22.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/22.fir.kt index 465ca77eee3..bfd176e45a3 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/22.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/22.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 22 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + /* * TESTCASE NUMBER: 1 * UNEXPECTED BEHAVIOUR diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/23.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/23.fir.kt index 22c486bdc43..70f08933ad7 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/23.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/23.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 23 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + /* * TESTCASE NUMBER: 1 * ISSUES: KT-28965 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/24.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/24.fir.kt index 990629000cb..92b04018e97 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/24.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/24.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 24 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + /* * TESTCASE NUMBER: 1 * UNEXPECTED BEHAVIOUR diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/25.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/25.fir.kt index 7fb1dae812e..327cc079f93 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/25.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/25.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 25 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + // TESTCASE NUMBER: 1, 2 class ClassWithEqualsOverride { override fun equals(other: Any?) = true diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/26.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/26.fir.kt index 67c95ead7a5..d45eef5fe12 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/26.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/26.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 26 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + /* * TESTCASE NUMBER: 1 * UNEXPECTED BEHAVIOUR diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/27.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/27.fir.kt index d176e25d8ab..24aed4fd652 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/27.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/27.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 27 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + /* * TESTCASE NUMBER: 1 * UNEXPECTED BEHAVIOUR diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/28.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/28.fir.kt index 4045bdcfc5b..c78b6065b30 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/28.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/28.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 28 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + // TESTCASE NUMBER: 1 fun > Inv.case_1() { if (this is MutableList<*>) { diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/29.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/29.fir.kt index 8d379408107..ecf0e2872df 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/29.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/29.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 29 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, enumClasses, interfaces, sealedClasses + */ + // TESTCASE NUMBER: 1 fun case_1(a: Any?) { while (true) { diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/3.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/3.fir.kt index 7c97ee79652..a463027674a 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/3.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/3.fir.kt @@ -2,6 +2,15 @@ // SKIP_TXT // WITH_EXTENDED_CHECKERS +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 3 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, enumClasses, interfaces, sealedClasses + */ + // TESTCASE NUMBER: 1 fun case_1(x: Nothing?) { if (x is Int) { diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/3.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/3.kt index ac93878e19e..50aa83f8b60 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/3.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/3.kt @@ -1,5 +1,6 @@ -// !DIAGNOSTICS: -UNUSED_EXPRESSION +// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNREACHABLE_CODE // SKIP_TXT +// WITH_EXTENDED_CHECKERS /* * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) @@ -20,10 +21,10 @@ fun case_1(x: Nothing?) { // TESTCASE NUMBER: 2 fun case_2(x: Nothing) { - if (x is Unit) { + if (x is Unit) { x x.inv() - } + } } // TESTCASE NUMBER: 3 @@ -36,10 +37,10 @@ fun case_3(x: Nothing?) { // TESTCASE NUMBER: 4 fun case_4(x: Nothing) { - if (x !is EnumClass) else { + if (x !is EnumClass) else { x x.fun_1() - } + } } // TESTCASE NUMBER: 5 @@ -60,10 +61,10 @@ fun case_6(x: Nothing?) { // TESTCASE NUMBER: 7 fun case_7(x: Nothing) { - if (!(x is DeepObject.A.B.C.D.E.F.G.J)) else { + if (!(x is DeepObject.A.B.C.D.E.F.G.J)) else { x x.prop_1 - } + } } // TESTCASE NUMBER: 8 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/30.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/30.fir.kt index 39c7f27b128..fa61689188e 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/30.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/30.fir.kt @@ -1,6 +1,16 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 30 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + * ISSUES: KT-30907 + */ + // TESTCASE NUMBER: 1 class Case1(val x: Any?) { val y = x!! diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/31.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/31.fir.kt index f252b8a1f8e..4774e02e9a5 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/31.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/31.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 31 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + // TESTCASE NUMBER: 1 fun case_1(x: Interface1) = x fun case_1(x: Interface2) = x diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/32.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/32.fir.kt index bda64361c71..b4176428192 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/32.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/32.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 32 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + // TESTCASE NUMBER: 1, 2, 3, 4, 5 fun stringArg(number: String) {} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/33.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/33.fir.kt index ccdfa442312..d39338e134c 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/33.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/33.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 33 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + // TESTCASE NUMBER: 1, 2, 3, 4, 5 fun nullableStringArg(number: String?) {} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/34.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/34.fir.kt index 2e463be24b9..e76953afdd3 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/34.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/34.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 34 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + /* * TESTCASE NUMBER: 1 * UNEXPECTED BEHAVIOUR diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/35.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/35.fir.kt index 7ca12988f2a..dcb2f38bbe4 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/35.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/35.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 35 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + /* * TESTCASE NUMBER: 1 * UNEXPECTED BEHAVIOUR diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/36.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/36.fir.kt index 8021514c0f2..5f70e70eda0 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/36.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/36.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 36 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + /* * TESTCASE NUMBER: 1 * UNEXPECTED BEHAVIOUR @@ -9,14 +18,14 @@ fun case_1(x: Class?, y: Any) { x?.prop_12 = if (y is String) "" else throw Exception() y - y.toUpperCase() + y.uppercase() } // TESTCASE NUMBER: 2 fun case_2(x: Class?, y: Any) { x?.prop_9 = y is String || return y - y.toUpperCase() + y.uppercase() } /* @@ -27,7 +36,7 @@ fun case_2(x: Class?, y: Any) { fun case_3(x: Class?, y: Any) { x?.prop_12 = y as String y - y.toUpperCase() + y.uppercase() } /* @@ -38,7 +47,7 @@ fun case_3(x: Class?, y: Any) { fun case_4(x: Class?, y: Any) { x?.prop_12 = y as? String ?: return y - y.toUpperCase() + y.uppercase() } /* @@ -49,14 +58,14 @@ fun case_4(x: Class?, y: Any) { fun case_5(x: Class?, y: String?) { x?.prop_12 = y ?: return y - y.toUpperCase() + y.uppercase() } // TESTCASE NUMBER: 6 fun case_6(x: Class?, y: String?) { x?.prop_9 = y !is String && throw Exception() y - y.toUpperCase() + y.uppercase() } /* @@ -67,7 +76,7 @@ fun case_6(x: Class?, y: String?) { fun case_7(x: Class?, y: String?) { x?.prop_12 = y!! y - y.toUpperCase() + y.uppercase() } /* @@ -78,5 +87,5 @@ fun case_7(x: Class?, y: String?) { fun case_8(x: Class?, y: String?) { x?.prop_12 = if (y === null) throw Exception() else "" y - y.toUpperCase() + y.uppercase() } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/37.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/37.fir.kt index cade362f053..128d219b537 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/37.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/37.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 37 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + /* * TESTCASE NUMBER: 1 * UNEXPECTED BEHAVIOUR diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/38.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/38.fir.kt index b2bc2aa2116..5d3623ad9d0 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/38.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/38.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 38 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + /* * TESTCASE NUMBER: 1 * UNEXPECTED BEHAVIOUR diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/39.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/39.fir.kt index 39dcef1676f..ef2698bdb8c 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/39.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/39.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 39 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + /* * TESTCASE NUMBER: 1 * UNEXPECTED BEHAVIOUR diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/4.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/4.fir.kt index 0c7ef71b92a..d87066b5c27 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/4.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/4.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 4 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: properties, functions + */ + // TESTCASE NUMBER: 1 fun case_1(x: Any?) { if (x is Int is Boolean) { diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/40.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/40.fir.kt index 13bf9e4186e..e3af2838851 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/40.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/40.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 40 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + /* * TESTCASE NUMBER: 1 * ISSUES: KT-8819 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/41.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/41.fir.kt index 5e64af57716..d28da5a0b96 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/41.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/41.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 41 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + // TESTCASE NUMBER: 1 inline fun case_1(x: Any?) { when (x) { diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/42.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/42.fir.kt index 2029cfca36d..ab5fd3c23a1 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/42.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/42.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 42 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + /* * TESTCASE NUMBER: 1 * ISSUES: KT-1982 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/43.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/43.fir.kt index 78cd7387cb0..1ae34d8c39c 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/43.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/43.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 43 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + /* * TESTCASE NUMBER: 1 * ISSUES: KT-10461 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/44.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/44.fir.kt index e508fce8e1f..981a0711a9b 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/44.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/44.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 44 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes + */ + /* * TESTCASE NUMBER: 1 * ISSUES: KT-25747 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/45.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/45.fir.kt index f776ca252e2..262f16fee26 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/45.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/45.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 45 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + /* * TESTCASE NUMBER: 1 * ISSUES: KT-22996 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/5.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/5.fir.kt index d82c2a0bc42..88190aabefe 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/5.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/5.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 5 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, enumClasses, interfaces, sealedClasses + */ + // TESTCASE NUMBER: 1 class Case1 { inline fun case_1(x: Any?) { diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/6.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/6.fir.kt index 374ffce1a5c..5f0405f2ac1 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/6.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/6.fir.kt @@ -2,6 +2,15 @@ // SKIP_TXT // WITH_EXTENDED_CHECKERS +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 6 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, enumClasses, interfaces, sealedClasses + */ + // TESTCASE NUMBER: 1 fun case_1(x: Any?) { if (x is Int || x !is Int) { diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/6.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/6.kt index 208545c6ede..e5ae99d5759 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/6.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/6.kt @@ -1,5 +1,6 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +// WITH_EXTENDED_CHECKERS /* * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/7.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/7.fir.kt index 8c4334f1522..9ff3ae02b0e 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/7.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/7.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 7 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes + */ + // TESTCASE NUMBER: 1 fun case_1(x: Int?) { if ((x is Int) ?: (x is Int)) { diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/8.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/8.fir.kt index 64668fcac49..98cdb058888 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/8.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/8.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 8 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, enumClasses, interfaces, sealedClasses + */ + // TESTCASE NUMBER: 1 fun case_1(x: Class?) { if (x?.fun_4()?.fun_4()?.fun_4()?.fun_4() != null) { diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/9.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/9.fir.kt index eac9f55adf6..bd614d519ea 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/9.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/9.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 9 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, enumClasses, interfaces, sealedClasses + */ + // TESTCASE NUMBER: 1 fun case_1(x: T?, y: K?) { x as T diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/1.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/1.fir.kt index 51dd52f27ff..aac2e518a43 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/1.fir.kt @@ -217,17 +217,17 @@ fun case_11(x: TypealiasNullableStringIndirect?, y: TypealiasNullableStringIndir // TESTCASE NUMBER: 12 fun case_12(x: TypealiasNullableStringIndirect, y: TypealiasNullableStringIndirect) = if (x == null) "1" -else if (y === null) x -else if (y === null) x.equals(null) -else if (y === null) x.propT -else if (y === null) x.propAny -else if (y === null) x.propNullableT -else if (y === null) x.propNullableAny -else if (y === null) x.funT() -else if (y === null) x.funAny() -else if (y === null) x.funNullableT() -else if (y === null) x.funNullableAny() -else "-1" + else if (y === null) x + else if (y === null) x.equals(null) + else if (y === null) x.propT + else if (y === null) x.propAny + else if (y === null) x.propNullableT + else if (y === null) x.propNullableAny + else if (y === null) x.funT() + else if (y === null) x.funAny() + else if (y === null) x.funNullableT() + else if (y === null) x.funNullableAny() + else "-1" // TESTCASE NUMBER: 13 fun case_13(x: otherpackage.Case13?) = @@ -260,43 +260,43 @@ fun case_14() { if (a.x != null) { if (a.x != null) { if (a.x !== null) { - if (a.x != null) { - if (a.x != null) { - if (a.x != null) { - if (a.x !== null) { - if (a.x != null) { - if (a.x != null) { - if (a.x !== null) { - if (a.x != null) { - if (a.x != null) { - if (a.x != null) { - if (a.x !== null) { - if (a.x != null) { - if (a.x !== null) { - a.x - a.x.equals(null) - a.x.propT - a.x.propAny - a.x.propNullableT - a.x.propNullableAny - a.x.funT() - a.x.funAny() - a.x.funNullableT() - a.x.funNullableAny() - } - } - } - } - } - } - } - } - } - } - } - } - } - } + if (a.x != null) { + if (a.x != null) { + if (a.x != null) { + if (a.x !== null) { + if (a.x != null) { + if (a.x != null) { + if (a.x !== null) { + if (a.x != null) { + if (a.x != null) { + if (a.x != null) { + if (a.x !== null) { + if (a.x != null) { + if (a.x !== null) { + a.x + a.x.equals(null) + a.x.propT + a.x.propAny + a.x.propNullableT + a.x.propNullableAny + a.x.funT() + a.x.funAny() + a.x.funNullableT() + a.x.funNullableAny() + } + } + } + } + } + } + } + } + } + } + } + } + } + } } } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/1.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/1.kt index 3060ff72d38..ac10d1b0405 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/1.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/1.kt @@ -1,5 +1,6 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +// TODO: https://youtrack.jetbrains.com/issue/KT-49862 /* * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) @@ -55,18 +56,18 @@ fun case_2(x: Nothing?) { // TESTCASE NUMBER: 3 fun case_3() { if (Object.prop_1 == null) - else { - Object.prop_1 - Object.prop_1.equals(null) - Object.prop_1.propT - Object.prop_1.propAny - Object.prop_1.propNullableT - Object.prop_1.propNullableAny - Object.prop_1.funT() - Object.prop_1.funAny() - Object.prop_1.funNullableT() - Object.prop_1.funNullableAny() - } + else { + Object.prop_1 + Object.prop_1.equals(null) + Object.prop_1.propT + Object.prop_1.propAny + Object.prop_1.propNullableT + Object.prop_1.propNullableAny + Object.prop_1.funT() + Object.prop_1.funAny() + Object.prop_1.funNullableT() + Object.prop_1.funNullableAny() + } } // TESTCASE NUMBER: 4 @@ -273,15 +274,15 @@ fun case_14() { if (a.x != null) { if (a.x !== null) { a.x - a.x.equals(null) - a.x.propT - a.x.propAny - a.x.propNullableT - a.x.propNullableAny - a.x.funT() - a.x.funAny() - a.x.funNullableT() - a.x.funNullableAny() + a.x.equals(null) + a.x.propT + a.x.propAny + a.x.propNullableT + a.x.propNullableAny + a.x.funT() + a.x.funAny() + a.x.funNullableT() + a.x.funNullableAny() } } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/10.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/10.fir.kt index 428316c2381..b58857016ca 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/10.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/10.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 10 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, functions, properties + */ + // TESTCASE NUMBER: 1 fun case_1() { val x = expandInv(Inv(select(10, null))) diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/11.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/11.fir.kt index 4ccf2e150e2..adb39e95419 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/11.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/11.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 11 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, functions, interfaces, properties + */ + // TESTCASE NUMBER: 1 fun , C: Out> case_1(a: C, b: B) = select(a.x, b.x) diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/12.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/12.fir.kt index 8090f83bde5..cc1d22affb4 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/12.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/12.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 12 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, interfaces, properties, functions + */ + // TESTCASE NUMBER: 1 fun T.case_1() { if (this != null) { diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/13.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/13.fir.kt index dfe9c176bb4..9d5c1822ff1 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/13.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/13.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 13 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, interfaces, properties, functions + */ + // TESTCASE NUMBER: 1 fun case_1(x: T) { var y = null diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/14.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/14.fir.kt index ad17b5af95b..c69a964eefd 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/14.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/14.fir.kt @@ -1,6 +1,14 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 14 + * DESCRIPTION: Raw data flow analysis test + */ + // TESTCASE NUMBER: 1 fun case_1(vararg x: Int?) { if (x != null) { diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/15.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/15.fir.kt index 7e0ece94ee2..11b5637d539 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/15.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/15.fir.kt @@ -1,6 +1,16 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 15 + * DESCRIPTION: Raw data flow analysis test + * NOTE: performance test + * HELPERS: classes, interfaces, functions, properties + */ + // TESTCASE NUMBER: 1 open class Case1_1 : InterfaceWithTypeParameter1 open class Case1_2 : InterfaceWithTypeParameter1 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/16.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/16.fir.kt index 6ecdeabdfb1..097ef62fdab 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/16.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/16.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION, -NAME_SHADOWING, -UNUSED_VARIABLE // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 16 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: objects, properties, classes, functions + */ + // TESTCASE NUMBER: 1 fun case_1(x: Int?) { if (x == null) return diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/17.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/17.fir.kt index 3be297029c7..e74aaf1748a 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/17.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/17.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 17 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: objects, properties, classes, functions + */ + // TESTCASE NUMBER: 1 fun case_1(x: Int?) { if (x == null) throw Exception() diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/18.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/18.fir.kt index d8eba6229a6..6e4f4334a2f 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/18.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/18.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 18 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: objects, properties, classes, functions + */ + // TESTCASE NUMBER: 1 fun case_1(x: Int?) { while (true) { diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/19.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/19.fir.kt index e9451bceef0..a69292c747f 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/19.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/19.fir.kt @@ -2,6 +2,15 @@ // SKIP_TXT // WITH_EXTENDED_CHECKERS +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 19 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, enumClasses, interfaces, sealedClasses + */ + // TESTCASE NUMBER: 1 fun case_1(x: Any?) { if (x is Int) { diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/19.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/19.kt index 1f54e532cd0..1b5e9427e07 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/19.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/19.kt @@ -1,5 +1,6 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +// WITH_EXTENDED_CHECKERS /* * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/2.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/2.fir.kt index bdd3b1696a9..6deee3e3902 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/2.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 2 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: objects, enumClasses, properties, functions + */ + // FILE: other_package.kt package otherpackage diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/20.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/20.fir.kt index 79e93eccd48..77937df8e28 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/20.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/20.fir.kt @@ -2,6 +2,15 @@ // SKIP_TXT // WITH_EXTENDED_CHECKERS +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 20 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, enumClasses, interfaces, sealedClasses + */ + // TESTCASE NUMBER: 1 fun case_1(x: Any?) { if (x is Int || false) { diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/20.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/20.kt index a450f13a266..60c7d81874a 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/20.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/20.kt @@ -1,5 +1,6 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +// WITH_EXTENDED_CHECKERS /* * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/21.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/21.fir.kt index b367166e0d3..a99df8f14e3 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/21.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/21.fir.kt @@ -2,6 +2,15 @@ // SKIP_TXT // WITH_EXTENDED_CHECKERS +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 21 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, enumClasses, interfaces, sealedClasses + */ + // TESTCASE NUMBER: 1 fun case_1(x: Any?) { if (x is Int == true) { diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/21.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/21.kt index 48194b10dd6..4328727a86e 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/21.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/21.kt @@ -1,5 +1,6 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +// WITH_EXTENDED_CHECKERS /* * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/22.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/22.fir.kt index ffa59a58faf..447c65adb67 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/22.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/22.fir.kt @@ -2,6 +2,15 @@ // SKIP_TXT // WITH_EXTENDED_CHECKERS +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 22 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, enumClasses, interfaces, sealedClasses + */ + // TESTCASE NUMBER: 1 fun case_1(x: Any?) { if (x is Int) { diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/22.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/22.kt index 4d2fe4b0224..12f549f55e2 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/22.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/22.kt @@ -1,5 +1,6 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +// WITH_EXTENDED_CHECKERS /* * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/23.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/23.fir.kt index 04361b28e0e..6a21d8af93e 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/23.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/23.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 23 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, enumClasses, interfaces, sealedClasses + */ + // TESTCASE NUMBER: 1 class Case1 { inline fun case_1(x: Any?) { diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/24.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/24.fir.kt index d02d75873c5..02490443b9d 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/24.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/24.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 24 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, enumClasses, interfaces, sealedClasses + */ + // TESTCASE NUMBER: 1 fun case_1(x: Any?) where T: CharSequence { x as T diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/25.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/25.fir.kt index 366e087d92b..f2fc9cee9ed 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/25.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/25.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 25 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, enumClasses, interfaces, sealedClasses + */ + /* * TESTCASE NUMBER: 1 * UNEXPECTED BEHAVIOUR diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/26.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/26.fir.kt index 366e087d92b..da65eb44a0e 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/26.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/26.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 26 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, enumClasses, interfaces, sealedClasses + */ + /* * TESTCASE NUMBER: 1 * UNEXPECTED BEHAVIOUR diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/27.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/27.fir.kt index 366e087d92b..3ecf639fed8 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/27.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/27.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 27 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, enumClasses, interfaces, sealedClasses + */ + /* * TESTCASE NUMBER: 1 * UNEXPECTED BEHAVIOUR diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/28.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/28.fir.kt index c85d30ed3cb..77a67b9e1a5 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/28.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/28.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 28 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, enumClasses, interfaces, sealedClasses + */ + // TESTCASE NUMBER: 1 fun case_1(x: Int?) { if (x?.inv() != null) { diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/29.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/29.fir.kt index 85556968d5e..2c8d1113934 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/29.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/29.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 29 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, properties, objects, typealiases, enumClasses, interfaces, sealedClasses + */ + // TESTCASE NUMBER: 1 fun case_1(x: Class?) { if (x?.prop_8?.prop_8?.prop_8?.prop_8 != null) { diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/3.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/3.fir.kt index d71c5d92dcb..d7188954886 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/3.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/3.fir.kt @@ -1,7 +1,16 @@ -// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE +// !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT // WITH_EXTENDED_CHECKERS +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 3 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: objects, enumClasses, classes, properties, typealiases + */ + // FILE: other_package.kt package otherpackage @@ -171,7 +180,7 @@ fun case_14() { // TESTCASE NUMBER: 15 fun case_15(x: TypealiasNullableString) { - val t = if (x != null) "" else { + val t = if (x != null) "" else { x } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/3.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/3.kt index 707c0d2343a..15c4e27be6b 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/3.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/3.kt @@ -1,5 +1,6 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +// WITH_EXTENDED_CHECKERS /* * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/30.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/30.fir.kt index bce710f566b..6d19e85d6e9 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/30.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/30.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 30 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, properties, objects, typealiases, enumClasses, interfaces, sealedClasses + */ + /* * TESTCASE NUMBER: 1 * UNEXPECTED BEHAVIOUR diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/31.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/31.fir.kt index 5810e18b74d..19703604db0 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/31.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/31.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 31 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, enumClasses, properties, interfaces, sealedClasses + */ + /* * TESTCASE NUMBER: 1 * UNEXPECTED BEHAVIOUR diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/32.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/32.fir.kt index 816971a85e6..6c70152de3c 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/32.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/32.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 32 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, enumClasses, interfaces, sealedClasses + */ + // TESTCASE NUMBER: 1 fun case_1(x: T?, y: K?) { x as T diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/33.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/33.fir.kt index e4ee8b8f3b7..5e1b471dd2e 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/33.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/33.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 33 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, enumClasses, interfaces, sealedClasses + */ + // TESTCASE NUMBER: 1 fun case_1() { var x: Any? = null diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/34.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/34.fir.kt index 0ef9aaa4584..47237eab1df 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/34.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/34.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 34 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + // TESTCASE NUMBER: 1 fun case_1() { var a: Any? = null diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/35.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/35.fir.kt index 51eebccae47..97f8c596fad 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/35.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/35.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 35 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, enumClasses, interfaces, sealedClasses + */ + /* * TESTCASE NUMBER: 1 * UNEXPECTED BEHAVIOUR diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/36.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/36.fir.kt index 48479cd6a1e..b3cf6abf555 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/36.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/36.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 36 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, functions, objects, typealiases, enumClasses, interfaces, sealedClasses + */ + // TESTCASE NUMBER: 1 fun case_1() { var a: Any? = null diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/37.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/37.fir.kt index 52812f985a3..fa7b839b025 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/37.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/37.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 37 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + /* * TESTCASE NUMBER: 1 * UNEXPECTED BEHAVIOUR diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/38.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/38.fir.kt index ea76d6eba04..bdd78a548f7 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/38.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/38.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 38 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + // TESTCASE NUMBER: 1 fun case_1(x: Comparable<*>?) { if (x is Byte?) { diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/39.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/39.fir.kt index c6b382d1a83..318085dfaef 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/39.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/39.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 39 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + /* * TESTCASE NUMBER: 1 * UNEXPECTED BEHAVIOUR diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/4.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/4.fir.kt index 8ff3a5f4b30..285b06b820d 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/4.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/4.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 4 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: objects, enumClasses, classes, properties, typealiases + */ + // FILE: other_package.kt package otherpackage diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/40.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/40.fir.kt index c31d1d048c9..23f5413282a 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/40.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/40.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 40 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + /* * TESTCASE NUMBER: 1 * ISSUES: KT-28242 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/41.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/41.fir.kt index 6da6932b766..b23edf491f1 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/41.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/41.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 41 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + /* * TESTCASE NUMBER: 1 * ISSUES: KT-28362 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/42.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/42.fir.kt index f5e610b9336..7d405d44a05 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/42.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/42.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 42 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + /* * TESTCASE NUMBER: 1 * UNEXPECTED BEHAVIOUR diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/43.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/43.fir.kt index 6cffb47cc5d..1a2b1d7a483 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/43.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/43.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 43 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + /* * TESTCASE NUMBER: 1 * ISSUES: KT-28670 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/44.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/44.fir.kt index 205d5b4f3f1..624f35048f4 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/44.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/44.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 44 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + /* * TESTCASE NUMBER: 1 * UNEXPECTED BEHAVIOUR diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/45.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/45.fir.kt index de8ba8f1d04..802a8909fe7 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/45.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/45.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 45 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + /* * TESTCASE NUMBER: 1 * UNEXPECTED BEHAVIOUR diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/46.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/46.fir.kt index bba59923ecc..9804bdcd683 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/46.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/46.fir.kt @@ -2,6 +2,15 @@ // SKIP_TXT // WITH_REFLECT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 46 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + import kotlin.reflect.* /* diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/47.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/47.fir.kt index 94ead5f4a98..acc61b4565c 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/47.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/47.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 47 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, enumClasses, interfaces, sealedClasses + */ + // TESTCASE NUMBER: 1 fun case_1(a: Any?) { while (true) { diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/48.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/48.fir.kt index 1a57cdc8b1b..838ec9439df 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/48.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/48.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 48 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + /* * TESTCASE NUMBER: 1 * UNEXPECTED BEHAVIOUR diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/49.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/49.fir.kt index 8f99f82197a..55014f8130d 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/49.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/49.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 49 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: annotations, classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + /* * TESTCASE NUMBER: 1 * UNEXPECTED BEHAVIOUR diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/5.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/5.fir.kt index 2d80ca49658..ae007c2a83c 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/5.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/5.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 5 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, interfaces, properties, functions + */ + // TESTCASE NUMBER: 1 fun case_1(x: Any?) { if (x is Number?) { diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/50.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/50.fir.kt index 4b8e4ea6ff8..e4dd2ec20b8 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/50.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/50.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 50 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + // TESTCASE NUMBER: 1 fun Any.case_1() { if (this is Inv<*>) { diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/51.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/51.fir.kt index 9a9a7fffb94..686e04f4719 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/51.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/51.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 51 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + // TESTCASE NUMBER: 1 fun case_1(x: Any?) { val y = run { diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/52.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/52.fir.kt index 48f1d63f1ad..87bdd9105ec 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/52.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/52.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 52 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + /* * TESTCASE NUMBER: 1 * UNEXPECTED BEHAVIOUR diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/53.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/53.fir.kt index c8d74bc455f..dc1b63816bd 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/53.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/53.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 53 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + // TESTCASE NUMBER: 1 fun case_1(x: Int) = "" fun case_1(x: Int?) = 10 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/54.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/54.fir.kt index 4acc3ca0de4..4b1c3ddc6b9 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/54.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/54.fir.kt @@ -1,6 +1,16 @@ +// LANGUAGE: +WarnAboutNonExhaustiveWhenOnAlgebraicTypes // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 54 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + /* * TESTCASE NUMBER: 1 * UNEXPECTED BEHAVIOUR @@ -136,8 +146,9 @@ fun case_7() { var b = a b b.length - when (true) { + when (true) { true -> b = a + else -> {} } b diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/55.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/55.fir.kt index c76300b1f3a..ddd3f99700f 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/55.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/55.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 55 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + /* * TESTCASE NUMBER: 1 * ISSUES: KT-10662 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/56.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/56.fir.kt index 87f90dea46f..b4fa0549145 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/56.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/56.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 56 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + // TESTCASE NUMBER: 1 fun case_1(x: Class?) { if (x != null) >>")!>x::fun_1 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/57.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/57.fir.kt index 890a5329cd8..d5267d7b83e 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/57.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/57.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 57 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + /* * TESTCASE NUMBER: 1 * ISSUES: KT-20656 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/58.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/58.fir.kt index 36ebdbb5c90..285f5e8e68f 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/58.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/58.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 58 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + /* * TESTCASE NUMBER: 1 * UNEXPECTED BEHAVIOUR diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/59.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/59.fir.kt index f672835e13e..0e89ef24aaf 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/59.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/59.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 59 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + /* * TESTCASE NUMBER: 1 * UNEXPECTED BEHAVIOUR diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/6.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/6.fir.kt index b4b81b847b3..fbf99b6926e 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/6.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/6.fir.kt @@ -1,7 +1,16 @@ -// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNREACHABLE_CODE -CAN_BE_VAL +// !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT // WITH_EXTENDED_CHECKERS +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 6 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, enumClasses, interfaces, objects, typealiases, properties, functions + */ + // FILE: other_types.kt package othertypes @@ -235,7 +244,7 @@ fun case_12(x: TypealiasNullableString, y: TypealiasNullableString, z1: Nothing? // TESTCASE NUMBER: 13 fun case_13(x: EmptyClass12_48?, z: Nothing?) = - if (x == z || x === z && x == z) { + if (x == z || x === z && x == z) { throw Exception() } else { x @@ -280,7 +289,7 @@ fun case_14() { // TESTCASE NUMBER: 15 fun case_15(x: TypealiasNullableString) { val y = null - val z = if (x === null || y == x && x === y || null === x) "" else { + val z = if (x === null || y == x && x === y || null === x) "" else { x x.equals(null) x.propT @@ -301,7 +310,7 @@ fun case_16() { if (x !== y) { x - x.hashCode() + x.hashCode() } } @@ -507,7 +516,7 @@ fun case_25(b: Boolean, z: Nothing?) { // TESTCASE NUMBER: 26 fun case_26(a: ((Float) -> Int?)?, b: Float?) { - var z = null + var z = null if (a != z == true && b != implicitNullableNothingProperty == true) { val x = a(b) @@ -645,7 +654,7 @@ fun case_32(a: DeepObject.A.B.C.D.E.F.G.J?) = // TESTCASE NUMBER: 33 fun case_33(a: ((Float) -> Int?)?, b: Float?, c: Boolean?) { - var z = null + var z = null if (true && a == z == true || b == null == true) { @@ -674,9 +683,9 @@ fun case_33(a: ((Float) -> Int?)?, b: Float?, c: Boolean?) { * ISSUES: KT-28329 */ fun case_34(z1: Boolean?) { - var z = null + var z = null - if (true && true && true && true && EnumClassWithNullableProperty.A.prop_1 != implicitNullableNothingProperty && EnumClassWithNullableProperty.A.prop_1 !== null && EnumClassWithNullableProperty.A.prop_1 !== z || z1 != implicitNullableNothingProperty || z1!! && true && true) { + if (true && true && true && true && EnumClassWithNullableProperty.A.prop_1 != implicitNullableNothingProperty && EnumClassWithNullableProperty.A.prop_1 !== null && EnumClassWithNullableProperty.A.prop_1 !== z || z1 != implicitNullableNothingProperty || z1!! && true && true) { } else { EnumClassWithNullableProperty.A.prop_1 @@ -709,11 +718,11 @@ fun case_35(a: DeepObject.A.B.C.D.E.F.G.J?) { * UNEXPECTED BEHAVIOUR */ fun case_36(x: Any) { - var z = null + var z = null if (x == z) { x - x.java + x.java } } @@ -735,7 +744,7 @@ fun case_38() { if (Object.prop_2 != z) else { Object.prop_2 - Object.prop_2.java + Object.prop_2.java } } @@ -750,7 +759,7 @@ fun case_39(x: Char?) { // TESTCASE NUMBER: 40 fun case_40() { val x: Unit? = null - var z = null + var z = null if (x == implicitNullableNothingProperty || z === x) { x @@ -819,7 +828,7 @@ fun case_44(x: TypealiasNullableString?, z1: Nothing?) // TESTCASE NUMBER: 45 fun case_45() { val a = Class() - var z: Nothing? = null + var z: Nothing? = null if (a.prop_4 != z || true) { if (a.prop_4 == null) { @@ -832,7 +841,7 @@ fun case_45() { // TESTCASE NUMBER: 46 fun case_46(x: TypealiasNullableString?, y: TypealiasNullableString) { val t: TypealiasNullableString = null - var z: Nothing? = null + var z: Nothing? = null if (x != nullableNothingProperty) { @@ -886,7 +895,7 @@ class Case49 { fun case_49() { val a = Case49() - var z = null + var z = null if (a.x === z) { a.x @@ -898,7 +907,7 @@ fun case_49() { fun case_50(x: TypealiasNullableString) { val z1 = null val z2 = null - val t = if (x != z1 && z2 !== x) "" else { + val t = if (x != z1 && z2 !== x) "" else { x x.hashCode() } @@ -909,7 +918,7 @@ fun case_51() { val x: TypealiasNullableNothing = null val z: Nothing? = null - if (x === z || z == x && x == z || false || false || false) { + if (x === z || z == x && x == z || false || false || false) { x x.hashCode() } @@ -989,11 +998,11 @@ fun case_56() { * UNEXPECTED BEHAVIOUR */ fun case_57(a: (() -> Unit)) { - var z = null + var z = null if (a == z) { & kotlin.Nothing")!>a - & kotlin.Nothing")!>a.java + & kotlin.Nothing")!>a.java } } @@ -1081,7 +1090,7 @@ fun case_61(x: Any?) { // TESTCASE NUMBER: 62 fun case_62(x: Any?) { - var z = null + var z = null if (x is Number? && x is Int? && x != z) { x x.equals(null) @@ -1195,7 +1204,7 @@ fun case_66(x: Any?, z1: Nothing?, z2: Nothing?, b: Boolean) { // TESTCASE NUMBER: 67 fun case_67(x: Any?) { - var z = null + var z = null if (x is ClassLevel1? && x is ClassLevel2? && x is ClassLevel3?) { if (x is ClassLevel4? && x != (fun (): Nothing? { return z })() && x is ClassLevel5?) { @@ -1289,7 +1298,7 @@ fun case_70(x: Any?) { */ fun case_71(t: Any?) { val z1 = null - var z2 = z1 + var z2 = z1 if (t is Interface1?) { if (t is Interface2?) { @@ -1313,9 +1322,9 @@ fun case_71(t: Any?) { * ISSUES: KT-28362, KT-27032, KT-35668 */ fun case_72(t: Any?, z1: Nothing?) { - var z2 = null + var z2 = null - if (t is Interface1? && t != z1 ?: z2 && t is Interface2?) { + if (t is Interface1? && t != z1 ?: z2 && t is Interface2?) { t t.itest1() t.itest2() diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/6.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/6.kt index 2aa7c3a7cbc..bb41e83a03f 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/6.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/6.kt @@ -1,5 +1,6 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +// WITH_EXTENDED_CHECKERS /* * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/60.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/60.fir.kt index a76d1e7b68b..8b654e281c3 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/60.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/60.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 60 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + // TESTCASE NUMBER: 1 fun case_1() { var x: String? = null diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/61.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/61.fir.kt index d617a63d04e..e9001fa3427 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/61.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/61.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 61 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + /* * TESTCASE NUMBER: 1 * UNEXPECTED BEHAVIOUR diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/63.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/63.fir.kt index 4731f44a32f..2e5132b0ab0 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/63.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/63.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 63 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + /* * TESTCASE NUMBER: 1 * UNEXPECTED BEHAVIOUR diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/64.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/64.fir.kt index 3bfd2535e7d..f21c07667b8 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/64.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/64.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 64 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + /* * TESTCASE NUMBER: 1 * UNEXPECTED BEHAVIOUR diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/65.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/65.fir.kt index cb236b54e29..f24858d2bd1 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/65.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/65.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 65 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + // TESTCASE NUMBER: 1 fun case_1(x: Class) { if (x.prop_13 !is String) return diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/66.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/66.fir.kt index cf0756976ad..775226541df 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/66.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/66.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 66 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + /* * TESTCASE NUMBER: 1 * UNEXPECTED BEHAVIOUR diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/67.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/67.fir.kt index 46f098c0c62..288edc8ea8d 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/67.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/67.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 67 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + // TESTCASE NUMBER: 1 fun case_1(x: Any?) { when (x) { diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/68.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/68.fir.kt index c30e110293a..f3a0b3bf25c 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/68.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/68.fir.kt @@ -2,6 +2,17 @@ // COMPARE_WITH_LIGHT_TREE // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 68 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-29083 + */ + // TESTCASE NUMBER: 1 fun case_1(x: Any?) { if (x!! is Int) { diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/69.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/69.fir.kt index fccc3073011..c87ffefdc1f 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/69.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/69.fir.kt @@ -1,6 +1,17 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 69 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-29083 + */ + // TESTCASE NUMBER: 1 fun test1(x: ClassLevel1?) { if (x!! is ClassLevel2) { diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/7.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/7.fir.kt index 6641fef664d..1c70f1fe20a 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/7.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/7.fir.kt @@ -1,7 +1,17 @@ -// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNREACHABLE_CODE -CAN_BE_VAL +// !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT // WITH_EXTENDED_CHECKERS +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 7 + * DESCRIPTION: Raw data flow analysis test + * UNEXPECTED BEHAVIOUR + * HELPERS: classes, enumClasses, objects, typealiases, properties, functions + */ + // FILE: other_package.kt package orherpackage @@ -38,7 +48,7 @@ fun case_1(x: Any?) { * ISSUES: KT-28159 */ fun case_2(x: Nothing?) { - if (x !== null && x !== null) { + if (x !== null && x !== null) { x } } @@ -80,7 +90,7 @@ fun case_4(x: Char?) { fun case_5() { val x: Unit? = null - if (x !== null || x !== null && x !== null || x !== null && x !== null) { + if (x !== null || x !== null && x !== null || x !== null && x !== null) { x x.equals(null) x.propT @@ -263,8 +273,8 @@ fun case_14() { // TESTCASE NUMBER: 15 fun case_15(x: TypealiasString?) { - var y = null - val t = if (x === null || x == y && x === y) "" else { + var y = null + val t = if (x === null || x == y && x === y) "" else { x.equals(null) x.propT x.propAny @@ -285,7 +295,7 @@ fun case_16() { if (x != null || x !== null || x != y) { x - x.hashCode() + x.hashCode() } } @@ -404,7 +414,7 @@ fun case_21() { // TESTCASE NUMBER: 22 fun case_22(a: (() -> Unit)?) { - var y = null + var y = null if (a != null || y != a) { a() ? & kotlin.Function0")!>a.equals(null) @@ -495,7 +505,7 @@ fun case_25(b: Boolean) { // TESTCASE NUMBER: 26 fun case_26(a: ((Float) -> Int?)?, b: Float?) { - var c: Nothing? = null + var c: Nothing? = null if (a != null == true && b != null == true || c != a == true && b != c == true) { val x = a(b) diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/7.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/7.kt index 95ed7cfd2b0..c4b1c1da826 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/7.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/7.kt @@ -1,5 +1,6 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +// WITH_EXTENDED_CHECKERS /* * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/70.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/70.fir.kt index d2f43ae9e5a..6c69c4b5812 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/70.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/70.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 70 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes + */ + /* * TESTCASE NUMBER: 1 * ISSUES: KT-11727 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/71.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/71.fir.kt index 597229978a9..ae80393fde2 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/71.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/71.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 71 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + /* * TESTCASE NUMBER: 1 * UNEXPECTED BEHAVIOUR diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/72.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/72.fir.kt index 1141fb35b16..37f01bcad09 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/72.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/72.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 72 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + /* * TESTCASE NUMBER: 1 * UNEXPECTED BEHAVIOUR diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/73.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/73.fir.kt index 52b7a3b0616..045dca25954 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/73.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/73.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 73 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + /* * TESTCASE NUMBER: 1 * UNEXPECTED BEHAVIOUR diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/8.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/8.fir.kt index 4c9addc0a43..71c91811966 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/8.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/8.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 8 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: properties, classes, functions + */ + // TESTCASE NUMBER: 1 fun case_1(x: Inv?) { if (x != null) { diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/9.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/9.fir.kt index 5108945f4a5..20dea65f411 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/9.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/9.fir.kt @@ -1,6 +1,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 9 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, properties, functions + */ + // TESTCASE NUMBER: 1 fun case_1(x: Out<out Int?>?) { if (x != null) { diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/local-variables/type-parameters/neg/1.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/local-variables/type-parameters/neg/1.fir.kt index 0ad2929d951..69ecb499085 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/local-variables/type-parameters/neg/1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/local-variables/type-parameters/neg/1.fir.kt @@ -1,6 +1,16 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: local-variables, type-parameters + * NUMBER: 1 + * DESCRIPTION: Local variables with forbidden type parameters. + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-8341 + */ + // TESTCASE NUMBER: 1 fun case_1() { val x1 = 1 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/pos/1.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/pos/1.fir.kt index db8b3bd26c9..3612c725935 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/pos/1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/pos/1.fir.kt @@ -1,6 +1,16 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: overload-resolution, building-the-overload-candidate-set-ocs, infix-function-call + * NUMBER: 1 + * DESCRIPTION: Not null Smartcast doesn't work in case of property infix call + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-36786 + */ + class C() { infix operator fun invoke(i: Int) { } //(1) } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/pos/2.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/pos/2.fir.kt index ab364f1cc06..80944c9951d 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/pos/2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/pos/2.fir.kt @@ -1,6 +1,16 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: overload-resolution, building-the-overload-candidate-set-ocs, infix-function-call + * NUMBER: 2 + * DESCRIPTION: is-check Smartcast doesn't work in case of property infix call + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-36786 + */ + class B(val memberVal: Any) class C() { infix operator fun invoke(i: Int) { } //(1) @@ -8,16 +18,16 @@ class C() { // TESTCASE NUMBER: 1 fun case1() { val b: B = B(C()) - b memberVal 1 //nok UNRESOLVED_REFERENCE - b.memberVal.invoke(2) //nok UNRESOLVED_REFERENCE - b.memberVal(1) //nok FUNCTION_EXPECTED + b memberVal 1 + b.memberVal.invoke(2) + b.memberVal(1) if (b.memberVal is C) { - b memberVal 1 //nok UNRESOLVED_REFERENCE !!!! - b.memberVal.invoke(1) //ok + b memberVal 1 + b.memberVal.invoke(1) - b.memberVal(1) //nok FUNCTION_EXPECTED !!! - (b.memberVal)(1) //ok + b.memberVal(1) + (b.memberVal)(1) } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/pos/2.kt b/compiler/tests-spec/testData/diagnostics/notLinked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/pos/2.kt index 21dde51489c..3d9cb94d06a 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/pos/2.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/pos/2.kt @@ -18,16 +18,16 @@ class C() { // TESTCASE NUMBER: 1 fun case1() { val b: B = B(C()) - b memberVal 1 //nok UNRESOLVED_REFERENCE_WRONG_RECEIVER - b.memberVal.invoke(2) //nok UNRESOLVED_REFERENCE_WRONG_RECEIVER - b.memberVal(1) //nok UNRESOLVED_REFERENCE_WRONG_RECEIVER + b memberVal 1 + b.memberVal.invoke(2) + b.memberVal(1) if (b.memberVal is C) { - b memberVal 1 //nok UNRESOLVED_REFERENCE_WRONG_RECEIVER !!!! - b.memberVal.invoke(1) //ok + b memberVal 1 + b.memberVal.invoke(1) - b.memberVal(1) //nok UNRESOLVED_REFERENCE_WRONG_RECEIVER !!! - (b.memberVal)(1) //ok + b.memberVal(1) + (b.memberVal)(1) } -} \ No newline at end of file +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/pos/3.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/pos/3.fir.kt index 90cb7dcd067..df49c079269 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/pos/3.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/pos/3.fir.kt @@ -1,6 +1,16 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: overload-resolution, building-the-overload-candidate-set-ocs, infix-function-call + * NUMBER: 3 + * DESCRIPTION: "Unsafe" cast doesn't work in case of property infix call + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-36786 + */ + class B(val memberVal: Any) class C() { infix operator fun invoke(i: Int) { } //(1) @@ -9,16 +19,16 @@ class C() { // TESTCASE NUMBER: 1 fun case1() { val b: B = B(C()) - b memberVal 1 //nok UNRESOLVED_REFERENCE - b.memberVal.invoke(2) //nok UNRESOLVED_REFERENCE - b.memberVal(1) //nok FUNCTION_EXPECTED + b memberVal 1 + b.memberVal.invoke(2) + b.memberVal(1) b.memberVal as C - b memberVal 1 //nok UNRESOLVED_REFERENCE !!!! - b.memberVal.invoke(1) //ok + b memberVal 1 + b.memberVal.invoke(1) - b.memberVal(1) //nok FUNCTION_EXPECTED !!! - (b.memberVal)(1) //ok + b.memberVal(1) + (b.memberVal)(1) } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/pos/3.kt b/compiler/tests-spec/testData/diagnostics/notLinked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/pos/3.kt index 2bf08c9e22b..b54080ccad0 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/pos/3.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/pos/3.kt @@ -19,16 +19,16 @@ class C() { // TESTCASE NUMBER: 1 fun case1() { val b: B = B(C()) - b memberVal 1 //nok UNRESOLVED_REFERENCE_WRONG_RECEIVER - b.memberVal.invoke(2) //nok UNRESOLVED_REFERENCE_WRONG_RECEIVER - b.memberVal(1) //nok UNRESOLVED_REFERENCE_WRONG_RECEIVER + b memberVal 1 + b.memberVal.invoke(2) + b.memberVal(1) b.memberVal as C - b memberVal 1 //nok UNRESOLVED_REFERENCE_WRONG_RECEIVER !!!! - b.memberVal.invoke(1) //ok + b memberVal 1 + b.memberVal.invoke(1) - b.memberVal(1) //nok UNRESOLVED_REFERENCE_WRONG_RECEIVER !!! - (b.memberVal)(1) //ok + b.memberVal(1) + (b.memberVal)(1) -} \ No newline at end of file +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/pos/4.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/pos/4.fir.kt index 73ed130c26f..b2aa4430e9d 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/pos/4.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/pos/4.fir.kt @@ -1,6 +1,17 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: overload-resolution, building-the-overload-candidate-set-ocs, infix-function-call + * NUMBER: 4 + * DESCRIPTION: Local extension infix extension callables + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-36786 + */ + + // TESTCASE NUMBER: 1, 2 // FILE: infixLib.kt package libPackage