FIR IDE: run FIR highlighting test on all test data

Similarly to FIR diagnostic tests. This commit enable all available test
data and check the reported error messages by FIR. This helps identify
some issues in formatting of FIR diagnostics.

The changes on the test file are mechanically generated. Failed tests
are disabled with `// IGNORE_FIR` and are re-enabled in the second
commit.
This commit is contained in:
Tianyu Geng
2021-03-16 16:55:07 -07:00
committed by Dmitriy Novozhilov
parent 6592407492
commit f38c0cf348
158 changed files with 2802 additions and 130 deletions
@@ -204,6 +204,7 @@ import org.jetbrains.kotlinx.serialization.idea.AbstractSerializationQuickFixTes
fun main(args: Array<String>) {
System.setProperty("java.awt.headless", "true")
generateTestGroupSuite(args) {
val excludedFirTestdataPattern = "^(.+)\\.fir\\.kts?\$"
testGroup("idea/jvm-debugger/jvm-debugger-test/test", "idea/jvm-debugger/jvm-debugger-test/testData") {
testClass<AbstractKotlinSteppingTest> {
model(
@@ -323,18 +324,18 @@ fun main(args: Array<String>) {
}
testClass<AbstractKotlinHighlightingPassTest> {
model("checker", recursive = false)
model("checker/regression")
model("checker/recovery")
model("checker/rendering")
model("checker/scripts", extension = "kts")
model("checker/duplicateJvmSignature")
model("checker/infos", testMethod = "doTestWithInfos")
model("checker/diagnosticsMessage")
model("checker", recursive = false, excludedPattern = excludedFirTestdataPattern)
model("checker/regression", excludedPattern = excludedFirTestdataPattern)
model("checker/recovery", excludedPattern = excludedFirTestdataPattern)
model("checker/rendering", excludedPattern = excludedFirTestdataPattern)
model("checker/scripts", extension = "kts", excludedPattern = excludedFirTestdataPattern)
model("checker/duplicateJvmSignature", excludedPattern = excludedFirTestdataPattern)
model("checker/infos", testMethod = "doTestWithInfos", excludedPattern = excludedFirTestdataPattern)
model("checker/diagnosticsMessage", excludedPattern = excludedFirTestdataPattern)
}
testClass<AbstractKotlinHighlightWolfPassTest> {
model("checker/wolf")
model("checker/wolf", excludedPattern = excludedFirTestdataPattern)
}
testClass<AbstractJavaAgainstKotlinSourceCheckerTest> {
@@ -1126,12 +1127,12 @@ fun main(args: Array<String>) {
}
testClass<AbstractFirKotlinHighlightingPassTest> {
model("checker", recursive = false)
model("checker/regression")
model("checker/recovery")
model("checker/rendering")
model("checker/infos")
model("checker/diagnosticsMessage")
model("checker", recursive = false, excludedPattern = excludedFirTestdataPattern)
model("checker/regression", excludedPattern = excludedFirTestdataPattern)
model("checker/recovery", excludedPattern = excludedFirTestdataPattern)
model("checker/rendering", excludedPattern = excludedFirTestdataPattern)
model("checker/infos", excludedPattern = excludedFirTestdataPattern)
model("checker/diagnosticsMessage", excludedPattern = excludedFirTestdataPattern)
}
@@ -11,17 +11,26 @@ import org.jetbrains.kotlin.idea.test.withCustomCompilerOptions
import org.jetbrains.kotlin.idea.withPossiblyDisabledDuplicatedFirSourceElementsException
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.test.uitls.IgnoreTests
import org.jetbrains.kotlin.test.uitls.IgnoreTests.DIRECTIVES
import org.jetbrains.kotlin.test.uitls.IgnoreTests.cleanUpIdenticalFirTestFile
import org.jetbrains.kotlin.test.uitls.IgnoreTests.getFirTestFile
import java.io.File
abstract class AbstractFirKotlinHighlightingPassTest : AbstractKotlinHighlightingPassTest() {
override val captureExceptions: Boolean = false
override fun isFirPlugin(): Boolean = true
override fun fileName(): String = getFirTestFile(originalTestFile()).name
private fun originalTestFile(): File = testDataFile(super.fileName())
override fun doTest(filePath: String) {
IgnoreTests.runTestIfEnabledByFileDirective(testDataFilePath(), IgnoreTests.DIRECTIVES.FIR_COMPARISON) {
IgnoreTests.runTestIfNotDisabledByFileDirective(originalTestFile().toPath(), DIRECTIVES.IGNORE_FIR) {
myFixture.configureByFile(fileName())
checkHighlighting(checkWarnings = false, checkInfos = false, checkWeakWarnings = false)
cleanUpIdenticalFirTestFile(originalTestFile())
}
}
@@ -46,4 +55,4 @@ abstract class AbstractFirKotlinHighlightingPassTest : AbstractKotlinHighlightin
}
}
}
}
}
@@ -33,7 +33,7 @@ public class FirKotlinHighlightingPassTestGenerated extends AbstractFirKotlinHig
}
public void testAllFilesPresentInChecker() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/checker"), Pattern.compile("^(.+)\\.kt$"), null, false);
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/checker"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), false);
}
@TestMetadata("AnnotationOnFile.kt")
@@ -376,7 +376,7 @@ public class FirKotlinHighlightingPassTestGenerated extends AbstractFirKotlinHig
}
public void testAllFilesPresentInRegression() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/checker/regression"), Pattern.compile("^(.+)\\.kt$"), null, true);
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/checker/regression"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
}
@TestMetadata("AmbiguityOnLazyTypeComputation.kt")
@@ -619,7 +619,7 @@ public class FirKotlinHighlightingPassTestGenerated extends AbstractFirKotlinHig
}
public void testAllFilesPresentInRecovery() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/checker/recovery"), Pattern.compile("^(.+)\\.kt$"), null, true);
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/checker/recovery"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
}
@TestMetadata("namelessMembers.kt")
@@ -647,7 +647,7 @@ public class FirKotlinHighlightingPassTestGenerated extends AbstractFirKotlinHig
}
public void testAllFilesPresentInRendering() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/checker/rendering"), Pattern.compile("^(.+)\\.kt$"), null, true);
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/checker/rendering"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
}
@TestMetadata("TypeInferenceError.kt")
@@ -665,7 +665,7 @@ public class FirKotlinHighlightingPassTestGenerated extends AbstractFirKotlinHig
}
public void testAllFilesPresentInInfos() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/checker/infos"), Pattern.compile("^(.+)\\.kt$"), null, true);
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/checker/infos"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
}
@TestMetadata("CapturedConstructorParameter.kt")
@@ -758,7 +758,7 @@ public class FirKotlinHighlightingPassTestGenerated extends AbstractFirKotlinHig
}
public void testAllFilesPresentInDiagnosticsMessage() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/checker/diagnosticsMessage"), Pattern.compile("^(.+)\\.kt$"), null, true);
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/checker/diagnosticsMessage"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
}
@TestMetadata("fullPackageFQNameOnVisiblityError.kt")
@@ -5,10 +5,14 @@
package org.jetbrains.kotlin.test.uitls
import com.intellij.openapi.util.io.FileUtil
import org.jetbrains.kotlin.test.KtAssert
import java.io.File
import java.nio.file.Files
import java.nio.file.Path
object IgnoreTests {
private val isTeamCityBuild: Boolean = System.getProperty("TEAMCITY_VERSION") != null
private const val INSERT_DIRECTIVE_AUTOMATICALLY = false // TODO use environment variable instead
private const val ALWAYS_CONSIDER_TEST_AS_PASSING = false // TODO use environment variable instead
@@ -173,9 +177,53 @@ object IgnoreTests {
const val FIR_COMPARISON_MULTILINE_COMMENT = "/* FIR_COMPARISON */"
const val IGNORE_FIR = "// IGNORE_FIR"
const val FIX_ME = "// FIX_ME: "
const val FIR_IDENTICAL = "// FIR_IDENTICAL"
}
enum class DirectivePosition {
FIRST_LINE_IN_FILE, LAST_LINE_IN_FILE
}
}
fun getFirTestFile(originalTestFile: File): File {
if (originalTestFile.readText().startsWith(DIRECTIVES.FIR_IDENTICAL)) {
return originalTestFile
}
val firTestFile = deriveFirTestFile(originalTestFile)
if (!firTestFile.exists()) {
FileUtil.copy(originalTestFile, firTestFile)
}
return firTestFile
}
fun cleanUpIdenticalFirTestFile(originalTestFile: File) {
val firTestFile = deriveFirTestFile(originalTestFile)
if (firTestFile.exists() && firTestFile.readText().trim() == originalTestFile.readText().trim()) {
val message = if (isTeamCityBuild) {
"Please remove .fir.kt dump and add // FIR_IDENTICAL to test source"
} else {
// The FIR test file is identical with the original file. We should remove the FIR file and mark "FIR_IDENTICAL" in the
// original file
firTestFile.delete()
val content = originalTestFile.readText()
originalTestFile.writer().use {
it.appendLine(DIRECTIVES.FIR_IDENTICAL)
it.append(content)
}
"Deleted .fir.kt dump, added // FIR_IDENTICAL to test source"
}
KtAssert.fail(
"""
Dumps via FIR & via old FE are the same.
$message
Please re-run the test now
""".trimIndent()
)
}
}
private fun deriveFirTestFile(originalTestFile: File) =
originalTestFile.parentFile.resolve(originalTestFile.name.removeSuffix(".kt") + ".fir.kt")
}
+174
View File
@@ -0,0 +1,174 @@
package abstract
class MyClass() {
//properties
<error descr="[MUST_BE_INITIALIZED_OR_BE_ABSTRACT] Property must be initialized or be abstract">val a: Int</error>
val a1: Int = 1
<error descr="[ABSTRACT_PROPERTY_IN_NON_ABSTRACT_CLASS] Abstract property 'a2' in non-abstract class 'MyClass'">abstract</error> val a2: Int
<error descr="[ABSTRACT_PROPERTY_IN_NON_ABSTRACT_CLASS] Abstract property 'a3' in non-abstract class 'MyClass'">abstract</error> val a3: Int = 1
<error descr="[MUST_BE_INITIALIZED_OR_BE_ABSTRACT] Property must be initialized or be abstract">var b: Int</error> private set
var b1: Int = 0; private set
<error descr="[ABSTRACT_PROPERTY_IN_NON_ABSTRACT_CLASS] Abstract property 'b2' in non-abstract class 'MyClass'">abstract</error> var b2: Int private set
<error descr="[ABSTRACT_PROPERTY_IN_NON_ABSTRACT_CLASS] Abstract property 'b3' in non-abstract class 'MyClass'">abstract</error> var b3: Int = 0; private set
<error descr="[MUST_BE_INITIALIZED] Property must be initialized">var c: Int</error> set(v: Int) { field = v }
var c1: Int = 0; set(v: Int) { field = v }
<error descr="[ABSTRACT_PROPERTY_IN_NON_ABSTRACT_CLASS] Abstract property 'c2' in non-abstract class 'MyClass'">abstract</error> var c2: Int set(v: Int) { field = v }
<error descr="[ABSTRACT_PROPERTY_IN_NON_ABSTRACT_CLASS] Abstract property 'c3' in non-abstract class 'MyClass'">abstract</error> var c3: Int = 0; set(v: Int) { field = v }
val e: Int get() = a
val e1: Int = <error descr="[PROPERTY_INITIALIZER_NO_BACKING_FIELD] Initializer is not allowed here because this property has no backing field">0</error>; get() = a
<error descr="[ABSTRACT_PROPERTY_IN_NON_ABSTRACT_CLASS] Abstract property 'e2' in non-abstract class 'MyClass'">abstract</error> val e2: Int get() = a
<error descr="[ABSTRACT_PROPERTY_IN_NON_ABSTRACT_CLASS] Abstract property 'e3' in non-abstract class 'MyClass'">abstract</error> val e3: Int = 0; get() = a
//methods
<error descr="[NON_ABSTRACT_FUNCTION_WITH_NO_BODY] Function 'f' without a body must be abstract">fun f()</error>
fun g() {}
<error descr="[ABSTRACT_FUNCTION_IN_NON_ABSTRACT_CLASS] Abstract function 'h' in non-abstract class 'MyClass'">abstract</error> fun h()
<error descr="[ABSTRACT_FUNCTION_IN_NON_ABSTRACT_CLASS] Abstract function 'j' in non-abstract class 'MyClass'"><error descr="[ABSTRACT_FUNCTION_WITH_BODY] A function 'j' with body cannot be abstract">abstract</error></error> fun j() {}
}
abstract class MyAbstractClass() {
//properties
<error descr="[MUST_BE_INITIALIZED_OR_BE_ABSTRACT] Property must be initialized or be abstract">val a: Int</error>
val a1: Int = 1
abstract val a2: Int
abstract val a3: Int = <error descr="[ABSTRACT_PROPERTY_WITH_INITIALIZER] Property with initializer cannot be abstract">1</error>
<error descr="[MUST_BE_INITIALIZED_OR_BE_ABSTRACT] Property must be initialized or be abstract">var b: Int</error> private set
var b1: Int = 0; private set
abstract var b2: Int <error descr="[PRIVATE_SETTER_FOR_ABSTRACT_PROPERTY] Private setters are not allowed for abstract properties">private</error> set
abstract var b3: Int = <error descr="[ABSTRACT_PROPERTY_WITH_INITIALIZER] Property with initializer cannot be abstract">0</error>; <error descr="[PRIVATE_SETTER_FOR_ABSTRACT_PROPERTY] Private setters are not allowed for abstract properties">private</error> set
<error descr="[MUST_BE_INITIALIZED] Property must be initialized">var c: Int</error> set(v: Int) { field = v }
var c1: Int = 0; set(v: Int) { field = v }
abstract var c2: Int <error descr="[ABSTRACT_PROPERTY_WITH_SETTER] Property with setter implementation cannot be abstract">set(v: Int) { field = v }</error>
abstract var c3: Int = <error descr="[ABSTRACT_PROPERTY_WITH_INITIALIZER] Property with initializer cannot be abstract">0</error>; <error descr="[ABSTRACT_PROPERTY_WITH_SETTER] Property with setter implementation cannot be abstract">set(v: Int) { field = v }</error>
val e: Int get() = a
val e1: Int = <error descr="[PROPERTY_INITIALIZER_NO_BACKING_FIELD] Initializer is not allowed here because this property has no backing field">0</error>; get() = a
abstract val e2: Int <error descr="[ABSTRACT_PROPERTY_WITH_GETTER] Property with getter implementation cannot be abstract">get() = a</error>
abstract val e3: Int = <error descr="[ABSTRACT_PROPERTY_WITH_INITIALIZER] Property with initializer cannot be abstract">0</error>; <error descr="[ABSTRACT_PROPERTY_WITH_GETTER] Property with getter implementation cannot be abstract">get() = a</error>
//methods
<error descr="[NON_ABSTRACT_FUNCTION_WITH_NO_BODY] Function 'f' without a body must be abstract">fun f()</error>
fun g() {}
abstract fun h()
<error descr="[ABSTRACT_FUNCTION_WITH_BODY] A function 'j' with body cannot be abstract">abstract</error> fun j() {}
}
interface MyTrait {
//properties
val a: Int
val a1: Int = <error descr="[PROPERTY_INITIALIZER_IN_INTERFACE] Property initializers are not allowed in interfaces">1</error>
abstract val a2: Int
abstract val a3: Int = <error descr="[ABSTRACT_PROPERTY_WITH_INITIALIZER] Property with initializer cannot be abstract">1</error>
var b: Int <error descr="[PRIVATE_SETTER_FOR_ABSTRACT_PROPERTY] Private setters are not allowed for abstract properties">private</error> set
var b1: Int = <error descr="[PROPERTY_INITIALIZER_IN_INTERFACE] Property initializers are not allowed in interfaces">0</error>; <error descr="[PRIVATE_SETTER_FOR_OPEN_PROPERTY] Private setters are not allowed for open properties">private</error> set
abstract var b2: Int <error descr="[PRIVATE_SETTER_FOR_ABSTRACT_PROPERTY] Private setters are not allowed for abstract properties">private</error> set
abstract var b3: Int = <error descr="[ABSTRACT_PROPERTY_WITH_INITIALIZER] Property with initializer cannot be abstract">0</error>; <error descr="[PRIVATE_SETTER_FOR_ABSTRACT_PROPERTY] Private setters are not allowed for abstract properties">private</error> set
<error descr="[BACKING_FIELD_IN_INTERFACE] Property in an interface cannot have a backing field">var c: Int</error> set(v: Int) { field = v }
<error descr="[BACKING_FIELD_IN_INTERFACE] Property in an interface cannot have a backing field">var c1: Int</error> = <error descr="[PROPERTY_INITIALIZER_IN_INTERFACE] Property initializers are not allowed in interfaces">0</error>; set(v: Int) { field = v }
abstract var c2: Int <error descr="[ABSTRACT_PROPERTY_WITH_SETTER] Property with setter implementation cannot be abstract">set(v: Int) { field = v }</error>
abstract var c3: Int = <error descr="[ABSTRACT_PROPERTY_WITH_INITIALIZER] Property with initializer cannot be abstract">0</error>; <error descr="[ABSTRACT_PROPERTY_WITH_SETTER] Property with setter implementation cannot be abstract">set(v: Int) { field = v }</error>
val e: Int get() = a
val e1: Int = <error descr="[PROPERTY_INITIALIZER_IN_INTERFACE] Property initializers are not allowed in interfaces">0</error>; get() = a
abstract val e2: Int <error descr="[ABSTRACT_PROPERTY_WITH_GETTER] Property with getter implementation cannot be abstract">get() = a</error>
abstract val e3: Int = <error descr="[ABSTRACT_PROPERTY_WITH_INITIALIZER] Property with initializer cannot be abstract">0</error>; <error descr="[ABSTRACT_PROPERTY_WITH_GETTER] Property with getter implementation cannot be abstract">get() = a</error>
//methods
fun f()
fun g() {}
abstract fun h()
<error descr="[ABSTRACT_FUNCTION_WITH_BODY] A function 'j' with body cannot be abstract">abstract</error> fun j() {}
}
enum class MyEnum() {
;
//properties
<error descr="[MUST_BE_INITIALIZED_OR_BE_ABSTRACT] Property must be initialized or be abstract">val a: Int</error>
val a1: Int = 1
abstract val a2: Int
abstract val a3: Int = <error descr="[ABSTRACT_PROPERTY_WITH_INITIALIZER] Property with initializer cannot be abstract">1</error>
<error descr="[MUST_BE_INITIALIZED_OR_BE_ABSTRACT] Property must be initialized or be abstract">var b: Int</error> private set
var b1: Int = 0; private set
abstract var b2: Int <error descr="[PRIVATE_SETTER_FOR_ABSTRACT_PROPERTY] Private setters are not allowed for abstract properties">private</error> set
abstract var b3: Int = <error descr="[ABSTRACT_PROPERTY_WITH_INITIALIZER] Property with initializer cannot be abstract">0</error>; <error descr="[PRIVATE_SETTER_FOR_ABSTRACT_PROPERTY] Private setters are not allowed for abstract properties">private</error> set
<error descr="[MUST_BE_INITIALIZED] Property must be initialized">var c: Int</error> set(v: Int) { field = v }
var c1: Int = 0; set(v: Int) { field = v }
abstract var c2: Int <error descr="[ABSTRACT_PROPERTY_WITH_SETTER] Property with setter implementation cannot be abstract">set(v: Int) { field = v }</error>
abstract var c3: Int = <error descr="[ABSTRACT_PROPERTY_WITH_INITIALIZER] Property with initializer cannot be abstract">0</error>; <error descr="[ABSTRACT_PROPERTY_WITH_SETTER] Property with setter implementation cannot be abstract">set(v: Int) { field = v }</error>
val e: Int get() = a
val e1: Int = <error descr="[PROPERTY_INITIALIZER_NO_BACKING_FIELD] Initializer is not allowed here because this property has no backing field">0</error>; get() = a
abstract val e2: Int <error descr="[ABSTRACT_PROPERTY_WITH_GETTER] Property with getter implementation cannot be abstract">get() = a</error>
abstract val e3: Int = <error descr="[ABSTRACT_PROPERTY_WITH_INITIALIZER] Property with initializer cannot be abstract">0</error>; <error descr="[ABSTRACT_PROPERTY_WITH_GETTER] Property with getter implementation cannot be abstract">get() = a</error>
//methods
<error descr="[NON_ABSTRACT_FUNCTION_WITH_NO_BODY] Function 'f' without a body must be abstract">fun f()</error>
fun g() {}
abstract fun h()
<error descr="[ABSTRACT_FUNCTION_WITH_BODY] A function 'j' with body cannot be abstract">abstract</error> fun j() {}
}
abstract enum class MyAbstractEnum() {}
//properties
<error descr="[MUST_BE_INITIALIZED] Property must be initialized">val a: Int</error>
val a1: Int = 1
abstract val a2: Int
abstract val a3: Int = 1
<error descr="[MUST_BE_INITIALIZED] Property must be initialized">var b: Int</error> private set
var b1: Int = 0; private set
abstract var b2: Int private set
abstract var b3: Int = 0; private set
<error descr="[MUST_BE_INITIALIZED] Property must be initialized">var c: Int</error> set(v: Int) { field = v }
var c1: Int = 0; set(v: Int) { field = v }
abstract var c2: Int set(v: Int) { field = v }
abstract var c3: Int = 0; set(v: Int) { field = v }
val e: Int get() = a
val e1: Int = <error descr="[PROPERTY_INITIALIZER_NO_BACKING_FIELD] Initializer is not allowed here because this property has no backing field">0</error>; get() = a
abstract val e2: Int get() = a
abstract val e3: Int = 0; get() = a
//methods
<error descr="[NON_MEMBER_FUNCTION_NO_BODY] Function 'f' must have a body">fun f()</error>
fun g() {}
abstract fun h()
abstract fun j() {}
//creating an instance
abstract class B1(
val i: Int,
val s: String
) {
}
class B2() : B1(1, "r") {}
abstract class B3(i: Int) {
}
fun foo(a: B3) {
val a = B3(1)
val b = B1(2, "s")
}
+25
View File
@@ -0,0 +1,25 @@
@file:kotlin.Deprecated("message")
@file:Suppress(BAR)
@file:Suppress(BAZ)
@<error descr="Expecting \"file:\" prefix for file annotations">k</error>otlin.Deprecated("message")
@<error descr="Expecting \"file:\" prefix for file annotations">S</error>uppress(BAR)
@<error descr="Expecting \"file:\" prefix for file annotations">S</error>uppress(BAZ)
@file:myAnnotation(1, "string")
@file:boo.myAnnotation(1, BAR)
@file:myAnnotation(N, BAZ)
@<error descr="Expecting \"file:\" prefix for file annotations">m</error>yAnnotation(1, "string")
@<error descr="Expecting \"file:\" prefix for file annotations">b</error>oo.myAnnotation(1, "string")
@<error descr="Expecting \"file:\" prefix for file annotations">m</error>yAnnotation(N, BAZ)
package boo
const val BAZ = "baz"
const val N = 0
@Target(AnnotationTarget.FILE)
@Retention(AnnotationRetention.SOURCE)
@Repeatable
annotation class myAnnotation(val i: Int, val s: String)
+32
View File
@@ -0,0 +1,32 @@
annotation class A(val i: Int)
annotation class Z(val i: Int)
<error descr="[INAPPLICABLE_CANDIDATE] Inapplicable candidate(s): /Z.Z">@Z("BAD")</error> @Suppress("TYPE_MISMATCH")
fun some0() {}
<error descr="[INAPPLICABLE_CANDIDATE] Inapplicable candidate(s): /Z.Z">@Z("BAD")</error> <error descr="[INAPPLICABLE_CANDIDATE] Inapplicable candidate(s): /Z.Z">@Z("BAD")</error> @Suppress("TYPE_MISMATCH")
fun some01() {}
@Suppress("TYPE_MISMATCH") <error descr="[INAPPLICABLE_CANDIDATE] Inapplicable candidate(s): /Z.Z">@Z("BAD")</error>
fun some1() {
}
@Suppress("TYPE_MISMATCH") <error descr="[INAPPLICABLE_CANDIDATE] Inapplicable candidate(s): /Z.Z">@Z("BAD")</error> <error descr="[INAPPLICABLE_CANDIDATE] Inapplicable candidate(s): /Z.Z">@Z("BAD")</error>
fun some11() {
}
<error descr="[INAPPLICABLE_CANDIDATE] Inapplicable candidate(s): /A.A">@A("BAD")</error> @Suppress("TYPE_MISMATCH")
fun some2() {
}
@Suppress("TYPE_MISMATCH") <error descr="[INAPPLICABLE_CANDIDATE] Inapplicable candidate(s): /A.A">@A("BAD")</error>
fun some3() {
}
<error descr="[INAPPLICABLE_CANDIDATE] Inapplicable candidate(s): /A.A">@A("BAD")</error> <error descr="[INAPPLICABLE_CANDIDATE] Inapplicable candidate(s): /A.A">@A("BAD")</error>
fun some4() {
}
<error descr="[INAPPLICABLE_CANDIDATE] Inapplicable candidate(s): /Z.Z">@Z("BAD")</error>
fun someN() {
}
+27
View File
@@ -0,0 +1,27 @@
interface NoC {
init {
}
val a : Int get() = 1
init {
}
}
class WithC() {
val x : Int = 42
init {
val b = x
}
val a : Int get() = 1
init {
val z = <error descr="[UNRESOLVED_REFERENCE] Unresolved reference: b">b</error>
val zz = x
}
}
@@ -0,0 +1,31 @@
class A() {
override fun equals(a : Any?) : Boolean = false
}
fun f(): Unit {
var x: Int? = 1
x = 1
x + 1
x.plus(1)
x < 1
x += 1
x == 1
x != 1
A() == 1
x === "1"
x !== "1"
x === 1
x !== 1
x..2
x in 1..2
val y : Boolean? = true
false || y
y && true
y && 1
}
+10
View File
@@ -0,0 +1,10 @@
open class A {}
open class B<T : A>()
class Pair<A, B>
abstract class C<T : B<Int>, X : (B<Char>) -> Pair<B<Any>, B<A>>>() : B<Any>() { // 2 errors
val a = B<Char>() // error
abstract val x : (B<Char>) -> B<Any>
}
+13
View File
@@ -0,0 +1,13 @@
fun test() {
foo<Int?>()
foo<Int>()
bar<Int?>()
bar<Int>()
bar<Double?>()
bar<Double>()
1.<error descr="[INAPPLICABLE_CANDIDATE] Inapplicable candidate(s): /buzz">buzz</error><Double>()
}
fun <T : Any> foo() {}
fun <T : Int?> bar() {}
fun <T : Int> Int.buzz() : Unit {}
+15
View File
@@ -0,0 +1,15 @@
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
open class A<T>
class B<X : A<X>>()
class C : A<C>()
val a = B<C>()
val a1 = B<Int>()
class X<A, B : A>()
val b = X<Any, X<A<C>, C>>()
val b0 = X<Any, Any?>()
val b1 = X<Any, X<A<C>, String>>()
+28
View File
@@ -0,0 +1,28 @@
class C {
fun f (a : Boolean, b : Boolean) {
b@ (while (true)
a@ {
<error descr="[NOT_A_LOOP_LABEL] The label does not denote a loop">break@f</error>
break
break@b
<error descr="[NOT_A_LOOP_LABEL] The label does not denote a loop">break@a</error>
})
<error descr="[BREAK_OR_CONTINUE_OUTSIDE_A_LOOP] 'break' and 'continue' are only allowed inside a loop">continue</error>
b@ (while (true)
a@ {
<error descr="[NOT_A_LOOP_LABEL] The label does not denote a loop">continue@f</error>
continue
continue@b
<error descr="[NOT_A_LOOP_LABEL] The label does not denote a loop">continue@a</error>
})
<error descr="[BREAK_OR_CONTINUE_OUTSIDE_A_LOOP] 'break' and 'continue' are only allowed inside a loop">break</error>
<error descr="[BREAK_OR_CONTINUE_OUTSIDE_A_LOOP] 'break' and 'continue' are only allowed inside a loop">continue@f</error>
<error descr="[BREAK_OR_CONTINUE_OUTSIDE_A_LOOP] 'break' and 'continue' are only allowed inside a loop">break@f</error>
}
}
+117
View File
@@ -0,0 +1,117 @@
package html
import java.util.*
interface Factory<T> {
fun create() : T
}
interface Element
class TextElement(val text : String) : Element
abstract class Tag(val name : String) : Element {
val children = ArrayList<Element>()
val attributes = HashMap<String, String>()
protected fun <T : Element> initTag(init : T.() -> Unit) : T
{
val tag = T.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: create">create</error>()
tag.init()
children.add(tag)
return tag
}
}
abstract class TagWithText(name : String) : Tag(name) {
operator fun String.unaryPlus() {
children.add(TextElement(this))
}
}
class HTML() : TagWithText("html") {
companion object : Factory<HTML> {
override fun create() = HTML()
}
fun head(init : Head.() -> Unit) = initTag<Head>(init)
fun body(init : Body.() -> Unit) = initTag<Body>(init)
}
class Head() : TagWithText("head") {
companion object : Factory<Head> {
override fun create() = Head()
}
fun title(init : Title.() -> Unit) = initTag<Title>(init)
}
class Title() : TagWithText("title")
abstract class BodyTag(name : String) : TagWithText(name) {
}
class Body() : BodyTag("body") {
companion object : Factory<Body> {
override fun create() = Body()
}
fun b(init : B.() -> Unit) = initTag<B>(init)
fun p(init : P.() -> Unit) = initTag<P>(init)
fun h1(init : H1.() -> Unit) = initTag<H1>(init)
fun a(href : String, init : A.() -> Unit) {
val a = initTag<A>(init)
a.href = href
}
}
class B() : BodyTag("b")
class P() : BodyTag("p")
class H1() : BodyTag("h1")
class A() : BodyTag("a") {
var href : String?
get() = attributes["href"]
set(value) {
if (value != null)
attributes["href"] = value
}
}
operator fun MutableMap<String, String>.set(key : String, value : String) = this.put(key, value)
fun html(init : HTML.() -> Unit) : HTML {
val html = HTML()
html.init()
return html
}
fun result(args : Array<String>) =
html {
head {
title {+"XML encoding with Groovy"}
}
body {
h1 {+"XML encoding with Groovy"}
p {+"this format can be used as an alternative markup to XML"}
// an element with attributes and text content
a(href = "https://groovy.codehaus.org") {+"Groovy"}
// mixed content
p {
+"This is some"
b {+"mixed"}
+"text. For more see the"
a(href = "https://groovy.codehaus.org") {+"Groovy"}
+"project"
}
p {+"some text"}
// content generated by
p {
for (arg in args)
+arg
}
}
}
+1 -1
View File
@@ -1,4 +1,4 @@
// FIR_COMPARISON
// FIR_IDENTICAL
fun <T> checkSubtype(t: T) = t
+1 -1
View File
@@ -1,4 +1,4 @@
// FIR_COMPARISON
// FIR_IDENTICAL
enum class E {
ENTRY;
+31
View File
@@ -0,0 +1,31 @@
package Jet86
class A {
companion object {
val x = 1
}
<error descr="[MANY_COMPANION_OBJECTS] Only one companion object is allowed per class">companion</error> object Another { // error
val x = 1
}
}
class B() {
val x = 12
}
object b {
companion object {
val x = 1
}
// error
}
val a = A.x
val c = B.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: x">x</error>
val d = b.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: x">x</error>
val s = System // error
fun test() {
System.out.println()
java.lang.System.out.println()
}
+10
View File
@@ -0,0 +1,10 @@
fun <T> checkSubtype(t: T) = t
fun test() {
checkSubtype<Byte>(1)
checkSubtype<Int>(1)
<error descr="[INAPPLICABLE_CANDIDATE] Inapplicable candidate(s): /checkSubtype">checkSubtype</error><Double>(1)
1 as Byte
1 as Int
1 as Double
}
+39
View File
@@ -0,0 +1,39 @@
open class NoC
class NoC1 : NoC()
class WithC0() : NoC()
open class WithC1() : NoC()
class NoC2 : <error descr="[SUPERTYPE_NOT_INITIALIZED] This type has a constructor, and thus must be initialized here">WithC1</error>
class NoC3 : WithC1()
class WithC2() : <error descr="[SUPERTYPE_NOT_INITIALIZED] This type has a constructor, and thus must be initialized here">WithC1</error>
class NoPC {
}
class WithPC0() {
}
class WithPC1(a : Int) {
}
class Foo() : WithPC0(), <error descr="Type expected"><error descr="[SYNTAX] Syntax error">this</error></error>() {
}
class WithCPI_Dup(x : Int) {
<error descr="[MUST_BE_INITIALIZED_OR_BE_ABSTRACT] Property must be initialized or be abstract">var x : Int</error>
}
class WithCPI(x : Int) {
val a = 1
val xy : Int = x
}
class NoCPI {
val a = 1
var ab = <error descr="[PROPERTY_INITIALIZER_NO_BACKING_FIELD] Initializer is not allowed here because this property has no backing field">1</error>
get() = 1
set(v) {}
}
+30
View File
@@ -0,0 +1,30 @@
interface A {
fun foo() {}
}
interface B : A, E {}
interface C : <error descr="[OTHER_ERROR] Unknown (other) error">B</error> {}
interface D : <error descr="[OTHER_ERROR] Unknown (other) error">B</error> {}
interface E : F {}
interface F : D, C {}
interface G : F {}
interface H : F {}
val a : A? = null
val b : B? = null
val c : C? = null
val d : D? = null
val e : E? = null
val f : F? = null
val g : G? = null
val h : H? = null
fun test() {
a?.foo()
b?.foo()
c?.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: foo">foo</error>()
d?.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: foo">foo</error>()
e?.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: foo">foo</error>()
f?.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: foo">foo</error>()
g?.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: foo">foo</error>()
h?.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: foo">foo</error>()
}
+17
View File
@@ -0,0 +1,17 @@
class A {
internal companion object {
class B {
class C
interface D
companion object {}
}
}
}
fun <error descr="[EXPOSED_RECEIVER_TYPE] public member exposes its internal receiver type 'C'">A.Companion.B.C</error>.foo() {}
interface E : <error descr="[EXPOSED_SUPER_INTERFACE] public sub-interface exposes its internal supertype 'D'">A.Companion.B.D</error>
val <error descr="[EXPOSED_PROPERTY_TYPE] public property exposes its internal type 'Companion'">x</error> = A.Companion.B
class F<T : <error descr="[EXPOSED_TYPE_PARAMETER_BOUND] public generic exposes its internal parameter bound type 'B'">A.Companion.B</error>>(val x: T)
+19
View File
@@ -0,0 +1,19 @@
private class A
open class B<T>(val x: T)
class C(<error descr="[EXPOSED_PARAMETER_TYPE] public function exposes its private parameter type 'A'">x: A</error>): <error descr="[EXPOSED_SUPER_CLASS] public subclass exposes its private supertype 'A'">B<A></error>(x)
private class D {
class E
}
fun <error descr="[EXPOSED_FUNCTION_RETURN_TYPE] public function exposes its private return type 'A'">create</error>() = A()
fun <error descr="[EXPOSED_FUNCTION_RETURN_TYPE] public function exposes its private return type 'A'">create</error>(<error descr="[EXPOSED_PARAMETER_TYPE] public function exposes its private parameter type 'A'">a: A</error>) = B(a)
val <error descr="[EXPOSED_PROPERTY_TYPE] public property exposes its private type 'A'">x</error> = create()
val <error descr="[EXPOSED_PROPERTY_TYPE] public property exposes its private type 'A'">y</error> = create(x)
val <error descr="[EXPOSED_PROPERTY_TYPE] public property exposes its private type 'E'">z</error>: B<D.E>? = null
+70
View File
@@ -0,0 +1,70 @@
fun Int?.optint() : Unit {}
val Int?.optval : Unit get() = Unit
fun <T: Any, E> T.foo(x : E, y : A) : T {
y.plus(1)
y plus 1
y + 1.0
this?.minus<T>(this)
return this
}
class A
infix operator fun A.plus(a : Any) {
1.foo()
true.<error descr="[INAPPLICABLE_CANDIDATE] Inapplicable candidate(s): /foo">foo</error>()
1
}
infix operator fun A.plus(a : Int) {
1
}
fun <T> T.minus(t : T) : Int = 1
fun test() {
val y = 1.abs
}
val Int.abs : Int
get() = if (this > 0) this else -this;
<error descr="[EXTENSION_PROPERTY_MUST_HAVE_ACCESSORS_OR_BE_ABSTRACT] Extension property must have accessors or be abstract">val <T> T.foo : T</error>
fun Int.foo() = this
// FILE: b.kt
//package null_safety
fun parse(cmd: String): Command? { return null }
class Command() {
// fun equals(other : Any?) : Boolean
val foo : Int = 0
}
operator fun Any.equals(other : Any?) : Boolean = true
fun Any?.equals1(other : Any?) : Boolean = true
fun Any.equals2(other : Any?) : Boolean = true
fun main(args: Array<String>) {
System.out.print(1)
val command = parse("")
command.foo
command<error descr="[UNSAFE_CALL] Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Command?">.</error>equals(null)
command?.equals(null)
command.equals1(null)
command?.equals1(null)
val c = Command()
c?.equals2(null)
if (command == null) 1
}
+82
View File
@@ -0,0 +1,82 @@
import java.util.*;
fun <T> checkSubtype(t: T) = t
class NotRange1() {
}
abstract class NotRange2() {
abstract operator fun iterator() : Unit
}
abstract class ImproperIterator1 {
abstract operator fun hasNext() : Boolean
}
abstract class NotRange3() {
abstract operator fun iterator() : ImproperIterator1
}
abstract class ImproperIterator2 {
abstract operator fun next() : Boolean
}
abstract class NotRange4() {
abstract operator fun iterator() : ImproperIterator2
}
abstract class ImproperIterator3 {
abstract operator fun hasNext() : Int
abstract operator fun next() : Int
}
abstract class NotRange5() {
abstract operator fun iterator() : ImproperIterator3
}
abstract class AmbiguousHasNextIterator {
abstract operator fun hasNext() : Boolean
val hasNext : Boolean get() = false
abstract operator fun next() : Int
}
abstract class NotRange6() {
abstract operator fun iterator() : AmbiguousHasNextIterator
}
abstract class ImproperIterator4 {
val hasNext : Int get() = 1
abstract operator fun next() : Int
}
abstract class NotRange7() {
abstract operator fun iterator() : ImproperIterator3
}
abstract class GoodIterator {
abstract operator fun hasNext() : Boolean
abstract operator fun next() : Int
}
abstract class Range0() {
abstract operator fun iterator() : GoodIterator
}
abstract class Range1() {
abstract operator fun iterator() : Iterator<Int>
}
fun test(notRange1: NotRange1, notRange2: NotRange2, notRange3: NotRange3, notRange4: NotRange4, notRange5: NotRange5, notRange6: NotRange6, notRange7: NotRange7, range0: Range0, range1: Range1) {
<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: hasNext"><error descr="[UNRESOLVED_REFERENCE] Unresolved reference: iterator"><error descr="[UNRESOLVED_REFERENCE] Unresolved reference: next">for (i in notRange1)</error></error></error>;
<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: hasNext"><error descr="[UNRESOLVED_REFERENCE] Unresolved reference: next">for (i in notRange2)</error></error>;
<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: next">for (i in notRange3)</error>;
<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: hasNext">for (i in notRange4)</error>;
for (i in notRange5);
for (i in notRange6);
for (i in notRange7);
for (i in range0);
for (i in range1);
for (i in (checkSubtype<List<Int>>(ArrayList<Int>())));
}
+2 -2
View File
@@ -1,3 +1,3 @@
// FIR_COMPARISON
// FIR_IDENTICAL
fun <T> foo<error><SOME_TYPE></error> () {}
fun <T> foo<error><SOME_TYPE></error> () {}
+162
View File
@@ -0,0 +1,162 @@
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
// RUNTIME
fun none() {}
fun unitEmptyInfer() {}
fun unitEmpty() : Unit {}
fun unitEmptyReturn() : Unit {return}
fun unitIntReturn() : Unit {return 1}
fun unitUnitReturn() : Unit {return Unit}
fun test1() : Any = { return }
fun test2() : Any = a@ {return@a 1}
fun test3() : Any { return }
fun bbb() {
return 1
}
fun foo(expr: StringBuilder): Int {
val c = 'a'
when(c) {
0.toChar() -> throw Exception("zero")
else -> throw Exception("nonzero" + c)
}
}
fun unitShort() : Unit = Unit
fun unitShortConv() : Unit = 1
fun unitShortNull() : Unit = null
fun intEmpty() : Int {}
fun intShortInfer() = 1
fun intShort() : Int = 1
//fun intBlockInfer() {1}
fun intBlock() : Int {return 1}
fun intBlock1() : Int {1}
fun intString(): Int = "s"
fun intFunctionLiteral(): Int = { 10 }
fun blockReturnUnitMismatch() : Int {return}
fun blockReturnValueTypeMismatch() : Int {return 3.4}
fun blockReturnValueTypeMatch() : Int {return 1}
fun blockReturnValueTypeMismatchUnit() : Int {return Unit}
fun blockAndAndMismatch() : Int {
true && false
}
fun blockAndAndMismatch1() : Int {
return true && false
}
fun blockAndAndMismatch2() : Int {
(return true) && (return false)
}
fun blockAndAndMismatch3() : Int {
true || false
}
fun blockAndAndMismatch4() : Int {
return true || false
}
fun blockAndAndMismatch5() : Int {
(return true) || (return false)
}
fun blockReturnValueTypeMatch1() : Int {
return if (1 > 2) 1.0 else 2.0
}
fun blockReturnValueTypeMatch2() : Int {
return <error descr="[INVALID_IF_AS_EXPRESSION] 'if' must have both main and 'else' branches if used as an expression">if</error> (1 > 2) 1
}
fun blockReturnValueTypeMatch3() : Int {
return if (1 > 2) else 1
}
fun blockReturnValueTypeMatch4() : Int {
if (1 > 2)
return 1.0
else return 2.0
}
fun blockReturnValueTypeMatch5() : Int {
if (1 > 2)
return 1.0
return 2.0
}
fun blockReturnValueTypeMatch6() : Int {
if (1 > 2)
else return 1.0
return 2.0
}
fun blockReturnValueTypeMatch7() : Int {
if (1 > 2)
1.0
else 2.0
}
fun blockReturnValueTypeMatch8() : Int {
if (1 > 2)
1.0
else 2.0
return 1
}
fun blockReturnValueTypeMatch9() : Int {
if (1 > 2)
1.0
}
fun blockReturnValueTypeMatch10() : Int {
return <error descr="[INVALID_IF_AS_EXPRESSION] 'if' must have both main and 'else' branches if used as an expression">if</error> (1 > 2) 1
}
fun blockReturnValueTypeMatch11() : Int {
if (1 > 2)
else 1.0
}
fun blockReturnValueTypeMatch12() : Int {
if (1 > 2)
return 1
else return 1.0
}
fun blockNoReturnIfValDeclaration(): Int {
val x = 1
}
fun blockNoReturnIfEmptyIf(): Int {
if (1 < 2) {} else {}
}
fun blockNoReturnIfUnitInOneBranch(): Int {
if (1 < 2) {
return 1
} else {
if (3 < 4) {
} else {
return 2
}
}
}
fun nonBlockReturnIfEmptyIf(): Int = if (1 < 2) {} else {}
fun nonBlockNoReturnIfUnitInOneBranch(): Int = if (1 < 2) {} else 2
val a = return 1
class A() {
}
fun illegalConstantBody(): Int = "s"
fun illegalConstantBlock(): String {
return 1
}
fun illegalIfBody(): Int =
if (1 < 2) 'a' else { 1.0 }
fun illegalIfBlock(): Boolean {
if (1 < 2)
return false
else { return 1 }
}
fun illegalReturnIf(): Char {
return if (1 < 2) 'a' else { 1 }
}
fun returnNothing(): Nothing {
throw 1
}
fun f(): Int {
if (1 < 2) { return 1 } else returnNothing()
}
fun f1(): Int = if (1 < 2) 1 else returnNothing()
+42
View File
@@ -0,0 +1,42 @@
interface A<in T> {}
interface B<T> : A<Int> {}
interface C<T> : B<T>, A<T> {}
interface C1<T> : B<T>, A<Any> {}
interface D : C<Boolean>, B<Double>{}
interface A1<out T> {}
interface B1 : A1<Int> {}
interface B2 : A1<Any>, B1 {}
interface BA1<T> {}
interface BB1 : BA1<Int> {}
interface BB2 : BA1<Any>, BB1 {}
//package x {
interface xAA1<out T> {}
interface xAB1 : xAA1<Int> {}
interface xAB3 : xAA1<Comparable<Int>> {}
interface xAB2 : xAA1<Number>, xAB1, xAB3 {}
//}
//package x2 {
interface x2AA1<out T> {}
interface x2AB1 : x2AA1<Any> {}
interface x2AB3 : x2AA1<Comparable<Int>> {}
interface x2AB2 : x2AA1<Number>, x2AB1, x2AB3 {}
//}
//package x3 {
interface x3AA1<in T> {}
interface x3AB1 : x3AA1<Any> {}
interface x3AB3 : x3AA1<Comparable<Int>> {}
interface x3AB2 : x3AA1<Number>, x3AB1, x3AB3 {}
//}
//package sx2 {
interface sx2AA1<in T> {}
interface sx2AB1 : sx2AA1<Int> {}
interface sx2AB3 : sx2AA1<Comparable<Int>> {}
interface sx2AB2 : sx2AA1<Number>, sx2AB1, sx2AB3 {}
//}
+46
View File
@@ -0,0 +1,46 @@
class IncDec() {
operator fun inc() : IncDec = this
operator fun dec() : IncDec = this
}
fun testIncDec() {
var x = IncDec()
x++
++x
x--
--x
x = x++
x = x--
x = ++x
x = --x
}
class WrongIncDec() {
operator fun inc() : Int = 1
operator fun dec() : Int = 1
}
fun testWrongIncDec() {
var x = WrongIncDec()
x++
++x
x--
--x
}
class UnitIncDec() {
operator fun inc() : Unit {}
operator fun dec() : Unit {}
}
fun testUnitIncDec() {
var x = UnitIncDec()
x++
++x
x--
--x
x = x++
x = x--
x = ++x
x = --x
}
+7
View File
@@ -0,0 +1,7 @@
fun test() {
if (1 is Int) {
if (1 is Boolean) {
}
}
}
+56
View File
@@ -0,0 +1,56 @@
// RUNTIME
@JvmStatic
class A {
@JvmStatic
companion object {
@JvmStatic fun a1() {
}
}
@JvmStatic
object A {
@JvmStatic fun a2() {
}
}
fun test() {
val s = object {
@JvmStatic fun a3() {
}
}
}
@JvmStatic fun a4() {
}
}
@JvmStatic
interface B {
companion object {
@JvmStatic fun a1() {
}
}
object A {
@JvmStatic fun a2() {
}
}
fun test() {
val s = object {
@JvmStatic fun a3() {
}
}
}
@JvmStatic fun a4() {
}
}
+3 -2
View File
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// FIR_COMPARISON
object A {
val x : Int = 0
@@ -13,10 +14,10 @@
}
b.foo()
<error>object B</error> {
<error descr="[LOCAL_OBJECT_NOT_ALLOWED] Named object 'B' is a singleton and cannot be local. Try to use anonymous object instead">object B</error> {
fun foo() {}
}
B.foo()
}
val bb = <error>B</error>.<error>foo</error>()
val bb = <error descr="[UNRESOLVED_REFERENCE] Unresolved reference: B">B</error>.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: foo">foo</error>()
+2 -2
View File
@@ -1,7 +1,7 @@
// FIR_COMPARISON
// FIR_IDENTICAL
// LANGUAGE_VERSION: 1.4
fun main(<warning descr="[UNUSED_PARAMETER] Parameter 'args' is never used">args</warning>: Array<String>) {
}
}
+2 -2
View File
@@ -1,7 +1,7 @@
// FIR_COMPARISON
// FIR_IDENTICAL
// LANGUAGE_VERSION: 1.3
fun main(args: Array<String>) {
}
}
+65
View File
@@ -0,0 +1,65 @@
package Jet87
open class A() {
fun foo() : Int = 1
}
interface B {
fun bar() : Double = 1.0;
}
class C() : A(), B
class D() {
companion object : A(), B {}
}
class Test1<T>()
where
T : A,
T : B,
B : T // error
{
fun test(t : T) {
T.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: foo">foo</error>()
T.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: bar">bar</error>()
t.foo()
t.bar()
}
}
fun test() {
Test1<B>()
Test1<A>()
Test1<C>()
}
class Foo() {}
class Bar<T : Foo>
class Buzz<T> where T : Bar<Int>, T : <error descr="[UNRESOLVED_REFERENCE] Unresolved reference: nioho">nioho</error>
class X<T : Foo>
class Y<T> where T : Foo, T : Bar<Foo>
fun <T> test2(t : T)
where
T : A,
T : B,
B : T
{
T.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: foo">foo</error>()
T.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: bar">bar</error>()
t.foo()
t.bar()
}
val t1 = <error descr="[INAPPLICABLE_CANDIDATE] Inapplicable candidate(s): Jet87/test2">test2</error><A>(A())
val t2 = <error descr="[INAPPLICABLE_CANDIDATE] Inapplicable candidate(s): Jet87/test2">test2</error><B>(C())
val t3 = test2<C>(C())
val <T, B: T> Pair<T, B>.x : Int get() = 0
class Pair<A, B>()
+9
View File
@@ -0,0 +1,9 @@
sealed <error descr="[REDUNDANT_MODIFIER] Modifier 'abstract' is redundant because 'sealed' is present">abstract</error> class First
<error descr="[REDUNDANT_MODIFIER] Modifier 'abstract' is redundant because 'sealed' is present">abstract</error> sealed class Second
abstract class Base {
abstract <error descr="[REDUNDANT_MODIFIER] Modifier 'open' is redundant because 'abstract' is present">open</error> fun foo()
<error descr="[REDUNDANT_MODIFIER] Modifier 'open' is redundant because 'abstract' is present">open</error> abstract val name: String
}
+28
View File
@@ -0,0 +1,28 @@
package nestedObjects
object A {
val b = B
val d = A.B.A
object B {
val a = A
val e = B.A
object A {
val a = A
val b = B
val x = nestedObjects.A.B.A
val y = this@A
}
}
}
object B {
val b = B
val c = A.B
}
val a = A
val b = B
val c = A.B
val d = A.B.A
val e = B.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: A">A</error>.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: B">B</error>
+2 -2
View File
@@ -1,7 +1,7 @@
// FIR_COMPARISON
// FIR_IDENTICAL
class Test
val localTest1 = Test() <error>-</error> 12
val localTest2 = Test() <error>></error> 12
val localTest3 = Test() <error><</error> 12
val localTest3 = Test() <error><</error> 12
+10
View File
@@ -0,0 +1,10 @@
// test for KT-5337
package test
annotation class A(val value: String)
<error descr="[INAPPLICABLE_CANDIDATE] Inapplicable candidate(s): test/A.A">@A(null)</error>
fun foo() {}
<error descr="[INAPPLICABLE_CANDIDATE] Inapplicable candidate(s): test/A.A">@A(null)</error>
class B
+1 -1
View File
@@ -1,4 +1,4 @@
// FIR_COMPARISON
// FIR_IDENTICAL
fun test() {
val a : Int? = 0
if (a != null) {
+18
View File
@@ -0,0 +1,18 @@
// Test for KT-8187
interface A {
fun get(x: Int)
}
class B : A by <error descr="[ABSTRACT_MEMBER_NOT_IMPLEMENTED] Object <anonymous> is not abstract and does not implement abstract member org.jetbrains.kotlin.fir.declarations.impl.FirSimpleFunctionImpl@181a2e4a: public abstract fun /A.get(x: R|kotlin/Int|): R|kotlin/Unit|
">object</error> : A {}
class C : A by (<error descr="[ABSTRACT_MEMBER_NOT_IMPLEMENTED] Object <anonymous> is not abstract and does not implement abstract member org.jetbrains.kotlin.fir.declarations.impl.FirSimpleFunctionImpl@181a2e4a: public abstract fun /A.get(x: R|kotlin/Int|): R|kotlin/Unit|
">object</error> : A {})
class D : A by 1 <error descr="[NONE_APPLICABLE] None of the following functions are applicable: [kotlin/Int.plus, kotlin/Int.plus, kotlin/Int.plus, ...]">+</error> (<error descr="[ABSTRACT_MEMBER_NOT_IMPLEMENTED] Object <anonymous> is not abstract and does not implement abstract member org.jetbrains.kotlin.fir.declarations.impl.FirSimpleFunctionImpl@181a2e4a: public abstract fun /A.get(x: R|kotlin/Int|): R|kotlin/Unit|
">object</error> : A {})
fun bar() {
val e = object : A by <error descr="[ABSTRACT_MEMBER_NOT_IMPLEMENTED] Object <anonymous> is not abstract and does not implement abstract member org.jetbrains.kotlin.fir.declarations.impl.FirSimpleFunctionImpl@181a2e4a: public abstract fun /A.get(x: R|kotlin/Int|): R|kotlin/Unit|
">object</error> : A {} {}
}
+28
View File
@@ -0,0 +1,28 @@
package toplevelObjectDeclarations
open class Foo(y : Int) {
open fun foo() : Int = 1
}
<error descr="[INAPPLICABLE_CANDIDATE] Inapplicable candidate(s): toplevelObjectDeclarations/Foo.Foo">class T : <error descr="[SUPERTYPE_NOT_INITIALIZED] This type has a constructor, and thus must be initialized here">Foo</error> {}</error>
<error descr="[INAPPLICABLE_CANDIDATE] Inapplicable candidate(s): toplevelObjectDeclarations/Foo.Foo">object A : <error descr="[SUPERTYPE_NOT_INITIALIZED] This type has a constructor, and thus must be initialized here">Foo</error> {
val x : Int = 2
fun test() : Int {
return x + foo()
}
}</error>
object B : A {}
val x = A.foo()
val y = object : Foo(x) {
init {
x + 12
}
override fun foo() : Int = 1
}
val z = y.foo()
+40
View File
@@ -0,0 +1,40 @@
package override
interface MyTrait {
fun foo()
}
abstract class MyAbstractClass {
abstract fun bar()
}
open class MyClass : MyTrait, MyAbstractClass() {
override fun foo() {}
override fun bar() {}
}
class MyChildClass : MyClass() {}
<error descr="[ABSTRACT_MEMBER_NOT_IMPLEMENTED] Class MyIllegalClass is not abstract and does not implement abstract member org.jetbrains.kotlin.fir.declarations.impl.FirSimpleFunctionImpl@dae9e3: public abstract fun override/MyTrait.foo(): R|kotlin/Unit|
">class MyIllegalClass</error> : MyTrait, MyAbstractClass() {}
<error descr="[ABSTRACT_CLASS_MEMBER_NOT_IMPLEMENTED] Class MyIllegalClass2 is not abstract and does not implement abstract base class member org.jetbrains.kotlin.fir.declarations.impl.FirSimpleFunctionImpl@62434f8c: public abstract fun override/MyAbstractClass.bar(): R|kotlin/Unit|
">class MyIllegalClass2</error> : MyTrait, MyAbstractClass() {
override fun foo() {}
}
<error descr="[ABSTRACT_MEMBER_NOT_IMPLEMENTED] Class MyIllegalClass3 is not abstract and does not implement abstract member org.jetbrains.kotlin.fir.declarations.impl.FirSimpleFunctionImpl@dae9e3: public abstract fun override/MyTrait.foo(): R|kotlin/Unit|
">class MyIllegalClass3</error> : MyTrait, MyAbstractClass() {
override fun bar() {}
}
<error descr="[ABSTRACT_CLASS_MEMBER_NOT_IMPLEMENTED] Class MyIllegalClass4 is not abstract and does not implement abstract base class member org.jetbrains.kotlin.fir.declarations.impl.FirSimpleFunctionImpl@62434f8c: public abstract fun override/MyAbstractClass.bar(): R|kotlin/Unit|
">class MyIllegalClass4</error> : MyTrait, MyAbstractClass() {
fun foo() {}
override fun other() {}
}
class MyChildClass1 : MyClass() {
fun foo() {}
override fun bar() {}
}
+35
View File
@@ -0,0 +1,35 @@
interface MyTrait<T> {
fun foo(t: T) : T
}
abstract class MyAbstractClass<T> {
abstract fun bar(t: T) : T
}
open class MyGenericClass<T> : MyTrait<T>, MyAbstractClass<T>() {
override fun foo(t: T) = t
override fun bar(t: T) = t
}
class MyChildClass : MyGenericClass<Int>() {}
class MyChildClass1<T> : MyGenericClass<T>() {}
class MyChildClass2<T> : MyGenericClass<T>() {
fun foo(t: T) = t
override fun bar(t: T) = t
}
open class MyClass : MyTrait<Int>, MyAbstractClass<String>() {
override fun foo(t: Int) = t
override fun bar(t: String) = t
}
class MyIllegalGenericClass1<T> : MyTrait<T>, MyAbstractClass<T>() {}
class MyIllegalGenericClass2<T, R> : MyTrait<T>, MyAbstractClass<R>() {
override fun foo(r: R) = r
}
class MyIllegalClass1 : MyTrait<Int>, MyAbstractClass<String>() {}
class MyIllegalClass2<T> : MyTrait<Int>, MyAbstractClass<Int>() {
fun foo(t: T) = t
fun bar(t: T) = t
}
+2 -2
View File
@@ -1,4 +1,4 @@
// FIR_COMPARISON
// FIR_IDENTICAL
package a
@@ -42,4 +42,4 @@ abstract class Collection<E> : Iterable<E> {
}
return current.done()
}
}
}
+1 -1
View File
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
class X {
<error>val x : Int</error>
}
@@ -12,4 +13,3 @@ class Y1 {
class Z : Y() {
}
// FIR_COMPARISON
+6
View File
@@ -0,0 +1,6 @@
interface A<T> {}
interface B<T> {}
interface C<T> {}
interface D<T> {}
interface Test : A<in Int>, B<out Int>, C<*>???, D<Int> {}
+25
View File
@@ -0,0 +1,25 @@
var x : Int = 1 + x
get() : Int = 1
set(value : Long) {
field = value.toInt()
field = 1.toLong()
}
val xx : Int = <error descr="[PROPERTY_INITIALIZER_NO_BACKING_FIELD] Initializer is not allowed here because this property has no backing field">1 + x</error>
get() : Int = 1
<error descr="[VAL_WITH_SETTER] A 'val'-property cannot have a setter">set(value : Long) {}</error>
val p : Int = <error descr="[PROPERTY_INITIALIZER_NO_BACKING_FIELD] Initializer is not allowed here because this property has no backing field">1</error>
get() = 1
class Test() {
var a : Int = 111
var b : Int get() = a; set(x) { a = x }
init {
}
fun f() {
}
}
+15
View File
@@ -0,0 +1,15 @@
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
package qualified_expressions
fun test(s: IntRange?) {
val a: Int = s?.start
val b: Int? = s?.start
val c: Int = s?.start ?: -11
val d: Int = s?.start ?: "empty"
val e: String = s?.start ?: "empty"
val f: Int = s?.endInclusive ?: b ?: 1
val g: Boolean? = e.startsWith("s")//?.length
}
fun String.startsWith(s: String): Boolean = true
+22
View File
@@ -0,0 +1,22 @@
class Dup {
fun Dup() : Unit {
this@Dup
}
}
class A() {
fun foo() : Unit {
this@A
<error descr="[UNRESOLVED_LABEL] Unresolved label">this@a</error>
this
}
val x = this@A.foo()
val y = this.foo()
val z = foo()
}
fun foo1() : Unit {
<error descr="[NO_THIS] 'this' is not defined in this context">this</error>
<error descr="[UNRESOLVED_LABEL] Unresolved label">this@a</error>
}
+18
View File
@@ -0,0 +1,18 @@
fun <T> checkSubtype(t: T) = t
class A(val a:Int) {
inner class B() {
val x = checkSubtype<B>(this@B)
val y = checkSubtype<A>(this@A)
val z = checkSubtype<B>(this)
val Int.xx : Int get() = checkSubtype<Int>(this)
fun Byte.xx() : Double.() -> Unit {
checkSubtype<Byte>(this)
val a: Double.() -> Unit = { checkSubtype<Double>(this) + checkSubtype<Byte>(this@xx) }
val b: Double.() -> Unit = a@{checkSubtype<Double>(this@a) + checkSubtype<Byte>(this@xx) }
val c = a@{<error descr="[UNRESOLVED_LABEL] Unresolved label">this@a</error> + checkSubtype<Byte>(this@xx) }
return (a@{checkSubtype<Double>(this@a) + checkSubtype<Byte>(this@xx) })
}
}
}
+29
View File
@@ -0,0 +1,29 @@
// !DIAGNOSTICS: -DUPLICATE_CLASS_NAMES
<error descr="[REDECLARATION] Conflicting declarations: [/a]">val a : Int = 1</error>
<error descr="[REDECLARATION] Conflicting declarations: [/a]">val a : Int = 1</error>
<error descr="[CONFLICTING_OVERLOADS] Conflicting overloads: [/foo]">fun foo()</error> {}
<error descr="[CONFLICTING_OVERLOADS] Conflicting overloads: [/foo]">fun foo()</error> {}
enum class EnumClass {
FOO,
FOO
}
class A {
<error descr="[REDECLARATION] Conflicting declarations: [/A.a]">val a : Int = 1</error>
<error descr="[REDECLARATION] Conflicting declarations: [/A.a]">val a : Int = 1</error>
<error descr="[CONFLICTING_OVERLOADS] Conflicting overloads: [/A.foo]">fun foo()</error> {}
<error descr="[CONFLICTING_OVERLOADS] Conflicting overloads: [/A.foo]">fun foo()</error> {}
}
object B {
<error descr="[REDECLARATION] Conflicting declarations: [B.C]">class C</error>
<error descr="[REDECLARATION] Conflicting declarations: [B.C]">class C</error>
}
fun <T, T> PairParam() {}
class PParam<T, T> {}
val <T, T> T.fooParam : Int get() = 1
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_FIR
// !DIAGNOSTICS: -DUPLICATE_CLASS_NAMES
val <error>a</error> : Int = 1
val <error>a</error> : Int = 1
+12
View File
@@ -0,0 +1,12 @@
//package redeclarations {
<error descr="[REDECLARATION] Conflicting declarations: [A, /A]">object A</error> {
val x : Int = 0
val A = 1
}
<error descr="[REDECLARATION] Conflicting declarations: [A, /A]">class A {}</error>
<error descr="[REDECLARATION] Conflicting declarations: [A, A]">val A = 1</error>
//}
-2
View File
@@ -1,5 +1,3 @@
// IGNORE_FIR
//package redeclarations {
object <error>A</error> {
val x : Int = 0
+48
View File
@@ -0,0 +1,48 @@
import java.*
import java.util.*
import utils.*
import java.io.PrintStream
import java.lang.Comparable as Com
fun <T> checkSubtype(t: T) = t
val l : MutableList<in Int> = ArrayList<Int>()
fun test(l : List<Int>) {
val x : <error descr="[UNRESOLVED_REFERENCE] Unresolved reference: java.List">java.List</error>
val y : List<Int>
val b : java.lang.Object
val a : java.util.List<Int>
val z : <error descr="[UNRESOLVED_REFERENCE] Unresolved reference: java.utils.List<R|kotlin/Int|>">java.utils.List<Int></error>
val f : java.io.File? = null
Collections.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: emptyList">emptyList</error>
Collections.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: emptyList">emptyList</error><Int>
Collections.emptyList<Int>()
Collections.emptyList()
checkSubtype<Set<Int>?>(Collections.singleton<Int>(1))
Collections.<error descr="[INAPPLICABLE_CANDIDATE] Inapplicable candidate(s): java/util/Collections.singleton">singleton</error><Int>(1.0)
List<Int>
val o = "sdf" as Object
try {
// ...
}
catch(e: Throwable) {
System.out.println(e.message)
}
PrintStream("sdf")
val c : Com<Int>? = null
checkSubtype<java.lang.Comparable<Int>?>(c)
// Collections.sort<Integer>(ArrayList<Integer>())
}
@@ -0,0 +1,6 @@
// IGNORE_DUPLICATED_FIR_SOURCE_EXCEPTION
import kotlin.reflect.KClass
annotation class Ann(val value: KClass<*>)
@Ann(Array<<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: String123">String123</error>>::class) class A
@@ -0,0 +1,13 @@
// IGNORE_FIR
interface Base {
fun foo(): Int
var bar: Int
val qux: Int
}
class Derived : Base {
override fun foo(): <error descr="[RETURN_TYPE_MISMATCH_ON_OVERRIDE] Return type of 'foo' is not a subtype of the return type of the overridden member 'public abstract fun foo(): Int defined in Base'">String</error> = ""
override var bar: <error descr="[VAR_TYPE_MISMATCH_ON_OVERRIDE] Type of 'bar' doesn't match the type of the overridden var-property 'public abstract var bar: Int defined in Base'">String</error> = ""
override val qux: <error descr="[PROPERTY_TYPE_MISMATCH_ON_OVERRIDE] Type of 'qux' is not a subtype of the overridden property 'public abstract val qux: Int defined in Base'">String</error> = ""
}
+3 -1
View File
@@ -1,3 +1,5 @@
// IGNORE_FIR
interface Base {
fun foo(): Int
var bar: Int
@@ -8,4 +10,4 @@ class Derived : Base {
override fun foo(): <error descr="[RETURN_TYPE_MISMATCH_ON_OVERRIDE] Return type of 'foo' is not a subtype of the return type of the overridden member 'public abstract fun foo(): Int defined in Base'">String</error> = ""
override var bar: <error descr="[VAR_TYPE_MISMATCH_ON_OVERRIDE] Type of 'bar' doesn't match the type of the overridden var-property 'public abstract var bar: Int defined in Base'">String</error> = ""
override val qux: <error descr="[PROPERTY_TYPE_MISMATCH_ON_OVERRIDE] Type of 'qux' is not a subtype of the overridden property 'public abstract val qux: Int defined in Base'">String</error> = ""
}
}
+10
View File
@@ -0,0 +1,10 @@
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
class Rule(val apply: () -> Unit)
fun foo() {
val rule: Rule? = Rule { }
rule?.apply()
val apply = rule?.apply
<error descr="[UNSAFE_IMPLICIT_INVOKE_CALL] Reference has a nullable type 'kotlin/Function0<kotlin/Unit>?', use explicit \"?.invoke\" to make a function-like call instead.">apply</error>()
}
+19
View File
@@ -0,0 +1,19 @@
class A {
operator fun component1() = 42
operator fun component2() = 42
}
fun arrayA(): Array<A> = null!!
fun foo(a: A, c: Int) {
val (a, b) = a
val arr = arrayA()
for ((c, d) in arr) {
}
}
fun f(p: Int): Int {
val p = 2
val p = 3
return p
}
+23
View File
@@ -0,0 +1,23 @@
fun demo() {
val abc = 1
val a = ""
val asd = 1
val bar = 5
fun map(f : () -> Any?) : Int = 1
fun buzz(f : () -> Any?) : Int = 1
val sdf = 1
val foo = 3;
use("$abc")
use("$")
use("$.$.asdf$\t")
use("asd\$")
use("asd$a\x")
use("asd$a$asd$ $<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: xxx">xxx</error>")
use("fosdfasdo${1 + bar + 100}}sdsdfgdsfsdf")
use("foo${bar + map {foo}}sdfsdf")
use("foo${bar + map { "foo" }}sdfsdf")
use("foo${bar + map {
"foo$sdf${ buzz{}}" }}sdfsdf")
}
fun use(s: String) {}
+49
View File
@@ -0,0 +1,49 @@
// KT-286 Check supertype lists
/*
In a supertype list:
Same type should not be mentioned twice
Same type should not be indirectly mentioned with incoherent type arguments
Every interface's required dependencies should be satisfied
No final types should appear
Only one class is allowed
*/
class C1()
open class OC1()
open class C2 {}
open class C3 {}
interface T1 {}
interface T2<T> {}
interface <error descr="[CONSTRUCTOR_IN_INTERFACE] An interface may not have a constructor">Test()</error> {
}
interface Test1 : <error descr="[INTERFACE_WITH_SUPERCLASS] An interface cannot inherit from a class"><error descr="[SUPERTYPE_INITIALIZED_IN_INTERFACE] Interfaces cannot initialize supertypes">C2</error></error>() {}
interface Test2 : <error descr="[INTERFACE_WITH_SUPERCLASS] An interface cannot inherit from a class">C2</error> {}
interface Test3 : <error descr="[INTERFACE_WITH_SUPERCLASS] An interface cannot inherit from a class">C2</error>, C3 {}
interface Test4 : T1 {}
interface Test5 : T1, T1 {}
interface Test6 : <error descr="[INTERFACE_WITH_SUPERCLASS] An interface cannot inherit from a class">C1</error> {}
class CTest1() : OC1() {}
class CTest2 : <error descr="[SUPERTYPE_NOT_INITIALIZED] This type has a constructor, and thus must be initialized here">C2</error> {}
class CTest3 : <error descr="[SUPERTYPE_NOT_INITIALIZED] This type has a constructor, and thus must be initialized here">C2</error>, C3 {}
class CTest4 : T1 {}
class CTest5 : T1, T1 {}
class CTest6 : <error descr="[SUPERTYPE_NOT_INITIALIZED] This type has a constructor, and thus must be initialized here">C1</error> {}
-2
View File
@@ -1,4 +1,3 @@
// IGNORE_FIR
// KT-286 Check supertype lists
/*
@@ -48,4 +47,3 @@ class CTest4 : T1 {}
class CTest5 : T1, <error>T1</error> {}
class CTest6 : <error>C1</error> {}
+10
View File
@@ -0,0 +1,10 @@
open class bar()
interface <error descr="[CONSTRUCTOR_IN_INTERFACE] An interface may not have a constructor">Foo()</error> : <error descr="[INTERFACE_WITH_SUPERCLASS] An interface cannot inherit from a class"><error descr="[SUPERTYPE_INITIALIZED_IN_INTERFACE] Interfaces cannot initialize supertypes">bar</error></error>(), bar, bar {
}
interface Foo2 : <error descr="[INTERFACE_WITH_SUPERCLASS] An interface cannot inherit from a class">bar</error>, Foo {
}
open class Foo1() : bar(), bar, Foo, <error descr="[UNRESOLVED_REFERENCE] Unresolved reference: <init>">Foo</error>() {}
open class Foo12 : bar(), bar {}
-2
View File
@@ -1,5 +1,3 @@
// IGNORE_FIR
open class bar()
interface Foo<error>()</error> : <error>bar</error><error>()</error>, <error><error>bar</error></error>, <error><error>bar</error></error> {
+9
View File
@@ -0,0 +1,9 @@
// IGNORE_FIR
package foo
open class A<T>
fun <T> f(<warning descr="[UNUSED_PARAMETER] Parameter 't' is never used">t</warning>: T<error descr="[TYPE_ARGUMENTS_NOT_ALLOWED] Type arguments are not allowed for type parameters"><T></error>) {}
fun <T> use(<warning descr="[UNUSED_PARAMETER] Parameter 'b' is never used">b</warning>: foo<error descr="[TYPE_ARGUMENTS_NOT_ALLOWED] Type arguments are not allowed here"><T></error>.A<T>) {}
+2
View File
@@ -1,3 +1,5 @@
// IGNORE_FIR
package foo
open class A<T>
+11
View File
@@ -0,0 +1,11 @@
// See KT-9438: Enforce the Single Instantiation Inheritance Rule for type parameters
interface A
interface B
interface D<T>
interface CorrectF<T> where T : D<A>, T : D<B>
fun <T> bar() where T : D<A>, T : D<B> {}
+161
View File
@@ -0,0 +1,161 @@
fun t1() : Int{
return 0
1
}
fun t1a() : Int {
return
return 1
1
}
fun t1b() : Int {
return 1
return 1
1
}
fun t1c() : Int {
return 1
return
1
}
fun t2() : Int {
if (1 > 2)
return 1
else return 1
1
}
fun t2a() : Int {
if (1 > 2) {
return 1
1
} else { return 1
2
}
1
}
fun t3() : Any {
if (1 > 2)
return 2
else return ""
1
}
fun t4(a : Boolean) : Int {
do {
return 1
}
while (a)
1
}
fun t4break(a : Boolean) : Int {
do {
break
}
while (a)
return 1
}
fun t5() : Int {
do {
return 1
2
}
while (1 > 2)
return 1
}
fun t6() : Int {
while (1 > 2) {
return 1
2
}
return 1
}
fun t6break() : Int {
while (1 > 2) {
break
2
}
return 1
}
fun t7(b : Int) : Int {
for (i in 1..b) {
return 1
2
}
return 1
}
fun t7break(b : Int) : Int {
for (i in 1..b) {
return 1
2
}
return 1
}
fun t7() : Int {
try {
return 1
2
}
catch (<error descr="[TYPE_MISMATCH] Type mismatch: inferred type is kotlin/Any but kotlin/Throwable was expected">e : Any</error>) {
2
}
return 1 // this is OK, like in Java
}
fun t8() : Int {
try {
return 1
2
}
catch (<error descr="[TYPE_MISMATCH] Type mismatch: inferred type is kotlin/Any but kotlin/Throwable was expected">e : Any</error>) {
return 1
2
}
return 1
}
fun blockAndAndMismatch() : Boolean {
(return true) || (return false)
return true
}
fun tf() : Int {
try {return 1} finally{return 1}
return 1
}
fun failtest(a : Int) : Int {
if (fail() || true) {
}
return 1
}
fun foo(a : Nothing) : Unit {
1
a
2
}
fun fail() : Nothing {
throw java.lang.RuntimeException()
}
fun nullIsNotNothing() : Unit {
val x : Int? = 1
if (x != null) {
return
}
fail()
}
+43
View File
@@ -0,0 +1,43 @@
// IGNORE_FIR
package unresolved
class Pair<A, B>(<warning>a</warning>: A, <warning>b</warning>: B)
fun testGenericArgumentsCount() {
val <warning>p1</warning>: Pair<error><Int></error> = Pair(2, 2)
val <warning>p2</warning>: <error>Pair</error> = Pair(2, 2)
}
fun testUnresolved() {
if (<error>a</error> is String) {
val <warning>s</warning> = <error>a</error>
}
<error>foo</error>(<error>a</error>)
val s = "s"
<error>foo</error>(s)
foo1(<error>i</error>)
s.<error>foo</error>()
when(<error>a</error>) {
is Int -> <error>a</error>
is String -> <error>a</error>
else -> <error>a</error>
}
<<<<<<< Updated upstream
for (j in <error>collection</error>) {
var i: Int = <error>j</error>
i += 1
foo1(<error>j</error>)
}
=======
<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: hasNext"><error descr="[UNRESOLVED_REFERENCE] Unresolved reference: next">for (j in <error descr="[UNRESOLVED_REFERENCE] Unresolved reference: collection">collection</error>) {
var i: Int = j
i += 1
foo1(j)
}</error></error>
>>>>>>> Stashed changes
}
fun foo1(<warning>i</warning>: Int) {}
+2
View File
@@ -1,3 +1,5 @@
// IGNORE_FIR
package unresolved
class Pair<A, B>(<warning>a</warning>: A, <warning>b</warning>: B)
+1 -2
View File
@@ -1,4 +1,4 @@
// FIR_COMPARISON
// FIR_IDENTICAL
fun test(<warning textAttributesKey="NOT_USED_ELEMENT_ATTRIBUTES">unusedParam</warning>: Int) { // UNUSED_PARAMETER
val str = ":)"
@@ -17,4 +17,3 @@ fun test(<warning textAttributesKey="NOT_USED_ELEMENT_ATTRIBUTES">unusedParam</w
redundantInitializer = 2
test(redundantInitializer)
}
+40
View File
@@ -0,0 +1,40 @@
package variance
abstract class Consumer<in T> {}
abstract class Producer<out T> {}
abstract class Usual<T> {}
fun foo(c: Consumer<Int>, p: Producer<Int>, u: Usual<Int>) {
val c1: Consumer<Any> = c
val c2: Consumer<Int> = c1
val p1: Producer<Any> = p
val p2: Producer<Int> = p1
val u1: Usual<Any> = u
val u2: Usual<Int> = u1
}
//Arrays copy example
class Array<T>(val length : Int, val t : T) {
fun get(index : Int) : T { return t }
fun set(index : Int, value : T) { /* ... */ }
}
fun copy1(from : Array<Any>, to : Array<Any>) {}
fun copy2(from : Array<out Any>, to : Array<in Any>) {}
fun <T> copy3(from : Array<out T>, to : Array<in T>) {}
fun copy4(from : Array<out Number>, to : Array<in Int>) {}
fun f(ints: Array<Int>, any: Array<Any>, numbers: Array<Number>) {
<error descr="[INAPPLICABLE_CANDIDATE] Inapplicable candidate(s): variance/copy1">copy1</error>(ints, any)
copy2(ints, any) //ok
<error descr="[INAPPLICABLE_CANDIDATE] Inapplicable candidate(s): variance/copy2">copy2</error>(ints, numbers)
copy3<Int>(ints, numbers)
copy4(ints, numbers) //ok
}
+45
View File
@@ -0,0 +1,45 @@
fun Int.foo() : Boolean = true
fun foo() : Int {
val s = ""
val x = 1
when (x) {
is String -> 1
!is Int -> 1
is Any? -> 1
s -> 1
1 -> 1
1 <error descr="[AMBIGUITY] Ambiguity between candidates: [kotlin/Int.plus, kotlin/Int.plus, kotlin/Int.plus, ...]">+</error> <error descr="[UNRESOLVED_REFERENCE] Unresolved reference: a">a</error> -> 1
in 1..<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: a">a</error> -> 1
!in 1..<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: a">a</error> -> 1
else -> 1
}
return 0
}
val _type_test : Int = foo() // this is needed to ensure the inferred return type of foo()
fun test() {
val x = 1;
val s = "";
when (x) {
s -> 1
"" -> 1
x -> 1
1 -> 1
else -> 1
}
val z = 1
when (z) {
else -> 1
1 -> 2
}
when (z) {
else -> 1
}
}
+2 -3
View File
@@ -1,5 +1,4 @@
// FIR_COMPARISON
// FIR_IDENTICAL
// KT-3750 When without else
enum class A {
@@ -14,4 +13,4 @@ val B.foo: Int
A.e1 -> 1
A.e2 -> 3
}
}
}
+65
View File
@@ -0,0 +1,65 @@
fun nonExhaustiveInt(x: Int) = <error descr="[NO_ELSE_IN_WHEN] 'when' expression must be exhaustive, add necessary 'else' branch">when</error>(x) {
0 -> false
}
fun nonExhaustiveBoolean(b: Boolean) = <error descr="[NO_ELSE_IN_WHEN] 'when' expression must be exhaustive, add necessary 'true' branch or 'else' branch instead">when</error>(b) {
false -> 0
}
fun nonExhaustiveNullableBoolean(b: Boolean?) = <error descr="[NO_ELSE_IN_WHEN] 'when' expression must be exhaustive, add necessary 'null' branch or 'else' branch instead">when</error>(b) {
false -> 0
true -> 1
}
enum class Color {
RED,
GREEN,
BLUE
}
fun nonExhaustiveEnum(c: Color) = <error descr="[NO_ELSE_IN_WHEN] 'when' expression must be exhaustive, add necessary 'RED', 'BLUE' branches or 'else' branch instead">when</error>(c) {
Color.GREEN -> 0xff00
}
fun nonExhaustiveNullable(c: Color?) = <error descr="[NO_ELSE_IN_WHEN] 'when' expression must be exhaustive, add necessary 'GREEN', 'null' branches or 'else' branch instead">when</error>(c) {
Color.RED -> 0xff
Color.BLUE -> 0xff0000
}
fun whenOnEnum(c: Color) {
when(c) {
Color.BLUE -> {}
Color.GREEN -> {}
}
}
enum class EnumInt {
A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15
}
fun whenOnLongEnum(i: EnumInt) = <error descr="[NO_ELSE_IN_WHEN] 'when' expression must be exhaustive, add necessary 'A0', 'A1', 'A2', 'A3', 'A4', 'A5', 'A6', ... branches or 'else' branch instead">when</error> (i) {
EnumInt.A7 -> 7
}
sealed class Variant {
object Singleton : Variant()
class Something : Variant()
object Another : Variant()
}
fun nonExhaustiveSealed(v: Variant) = <error descr="[NO_ELSE_IN_WHEN] 'when' expression must be exhaustive, add necessary 'is Something', 'Another' branches or 'else' branch instead">when</error>(v) {
Variant.Singleton -> false
}
fun nonExhaustiveNullableSealed(v: Variant?) = <error descr="[NO_ELSE_IN_WHEN] 'when' expression must be exhaustive, add necessary 'Another', 'null' branches or 'else' branch instead">when</error>(v) {
Variant.Singleton -> false
is Variant.Something -> true
}
sealed class Empty
fun nonExhaustiveEmpty(e: Empty) = <error descr="[NO_ELSE_IN_WHEN] 'when' expression must be exhaustive, add necessary 'else' branch">when</error>(e) {}
fun nonExhaustiveNullableEmpty(e: Empty?) = <error descr="[NO_ELSE_IN_WHEN] 'when' expression must be exhaustive, add necessary 'null' branch or 'else' branch instead">when</error>(e) {}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
package a.b
<error descr="[HIDDEN] Symbol kotlin/internal/InlineOnly.InlineOnly is invisible">@kotlin.internal.InlineOnly</error>
inline fun foo() {}
@@ -0,0 +1,5 @@
// IGNORE_FIR
interface ApplicationFeature<in P : Pipeline<*>, B : Any, V>
open class Pipeline<TSubject : Any>()
fun <A : Pipeline<*>, T : Any, V> A.feature(feature: <error descr="[WRONG_NUMBER_OF_TYPE_ARGUMENTS] 3 type arguments expected for ApplicationFeature">ApplicationFeature<A, T></error>) : Unit {}
@@ -1,3 +1,5 @@
// IGNORE_FIR
interface ApplicationFeature<in P : Pipeline<*>, B : Any, V>
open class Pipeline<TSubject : Any>()
fun <A : Pipeline<*>, T : Any, V> A.feature(<warning>feature</warning>: ApplicationFeature<error descr="[WRONG_NUMBER_OF_TYPE_ARGUMENTS] 3 type arguments expected for interface ApplicationFeature<in P : Pipeline<*>, B : Any, V>"><A, T></error>) : Unit {}
fun <A : Pipeline<*>, T : Any, V> A.feature(<warning>feature</warning>: ApplicationFeature<error descr="[WRONG_NUMBER_OF_TYPE_ARGUMENTS] 3 type arguments expected for interface ApplicationFeature<in P : Pipeline<*>, B : Any, V>"><A, T></error>) : Unit {}
@@ -0,0 +1,7 @@
class A {
inner class XYZ
fun foo() {
val v: A.XYZ = A.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: XYZ">XYZ</error>()
}
}
@@ -1,5 +1,5 @@
// FIR_COMPARISON
// FIR_IDENTICAL
class C<V>() {
<error descr="[INAPPLICABLE_LATEINIT_MODIFIER] 'lateinit' modifier is not allowed on properties of a type with nullable upper bound">lateinit</error> var item: V
}
}
@@ -0,0 +1,9 @@
// IGNORE_FIR
package name.that.may.be.very.long
import java.io.Serializable
interface Foo<T> : Comparable<Foo<T>>, Serializable, Cloneable
fun test(<warning>f</warning>: <error descr="[WRONG_NUMBER_OF_TYPE_ARGUMENTS] One type argument expected for interface Foo<T>">Foo</error>) {}
@@ -1,7 +1,9 @@
// IGNORE_FIR
package name.that.may.be.very.long
import java.io.Serializable
interface Foo<T> : Comparable<Foo<T>>, Serializable, Cloneable
fun test(<warning>f</warning>: <error descr="[WRONG_NUMBER_OF_TYPE_ARGUMENTS] One type argument expected for interface Foo<T>">Foo</error>) {}
fun test(<warning>f</warning>: <error descr="[WRONG_NUMBER_OF_TYPE_ARGUMENTS] One type argument expected for interface Foo<T>">Foo</error>) {}
@@ -0,0 +1,6 @@
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
val f = listOf("").<error descr="[INAPPLICABLE_CANDIDATE] Inapplicable candidate(s): /firstOrNull">firstOrNull</error>(1)
fun <T> listOf(element: T): List<T> = java.util.Collections.singletonList(element)
fun <T> Iterable<T>.firstOrNull(predicate: (T) -> Boolean): T? = null
@@ -0,0 +1,8 @@
fun call() {
val list : String? = "sdfknsdkfm"
"x" <error descr="[UNSAFE_OPERATOR_CALL] Operator call corresponds to a dot-qualified call 'R|<local>/list|.contains(String(x))' which is not allowed on a nullable receiver 'R|<local>/list|'. ">in</error> list
"x" <error descr="[UNSAFE_OPERATOR_CALL] Operator call corresponds to a dot-qualified call 'R|<local>/list|.contains(String(x))' which is not allowed on a nullable receiver 'R|<local>/list|'. ">!in</error> list
}
operator fun CharSequence.contains(other: CharSequence, ignoreCase: Boolean = false): Boolean = true
@@ -1,4 +1,4 @@
// FIR_COMPARISON
// FIR_IDENTICAL
<info>import</info> kotlin.reflect.KProperty
interface T
+2 -2
View File
@@ -1,4 +1,4 @@
// FIR_COMPARISON
// FIR_IDENTICAL
<info descr="null">inline</info> fun <T> run(f: () -> T) = f()
fun run2(f: () -> Unit) = f()
@@ -100,4 +100,4 @@ fun usage(param1: Int, param2: Int) {
withNoInlineParam({ println(<info descr="Value captured in a closure">param1</info>) }, { println(param2) })
}
fun println(<warning>a</warning>: Any) {}
fun println(<warning>a</warning>: Any) {}
+1 -1
View File
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
<info>abstract</info> class Test() {
<info>abstract</info> val x : Int
<info>abstract</info> val x1 : Int <info>get</info>
@@ -53,4 +54,3 @@ class TestPCParameters(w : Int, <warning>x</warning> : Int, val y : Int, var z :
fun foo() = <error>x</error>
}
// FIR_COMPARISON
+1 -1
View File
@@ -1,4 +1,4 @@
// FIR_COMPARISON
// FIR_IDENTICAL
fun baz(s: String?): Int {
return if (s == null) {
+1 -1
View File
@@ -1,4 +1,4 @@
// FIR_COMPARISON
// FIR_IDENTICAL
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
+2 -2
View File
@@ -1,4 +1,4 @@
// FIR_COMPARISON
// FIR_IDENTICAL
// See KT-15901
@@ -13,4 +13,4 @@ fun foo(): Any {
return a
}
return ""
}
}
+1 -1
View File
@@ -1,4 +1,4 @@
// FIR_COMPARISON
// FIR_IDENTICAL
package test2
+282
View File
@@ -0,0 +1,282 @@
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
open class A() {
fun foo() {
if (this is B) {
bar()
}
}
}
class B() : A() {
fun bar() {}
}
fun f9(a : A?) {
a?.foo()
a?.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: bar">bar</error>()
if (a is B) {
a.bar()
a.foo()
}
a?.foo()
a?.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: bar">bar</error>()
if (!(a is B)) {
a?.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: bar">bar</error>()
a?.foo()
}
if (!(a is B) || a.bar() == Unit) {
a?.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: bar">bar</error>()
}
if (!(a is B)) {
return;
}
a.bar()
a.foo()
}
fun fAny(a : Any?) {
if (a is B) {
a.bar()
a.foo()
}
if (!(a is B)) {
return;
}
a.bar()
a.foo()
}
fun f10(a : A?) {
if (!(a is B)) {
return;
}
if (!(a is B)) {
return;
}
}
class C() : A() {
fun bar() {
}
}
fun f101(a : A?) {
if (a is C) {
a.bar();
}
}
fun f11(a : A?) {
when (a) {
is B -> a.bar()
is A -> a.foo()
is Any -> a.foo()
is Any? -> a.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: bar">bar</error>()
else -> a?.foo()
}
}
fun f12(a : A?) {
when (a) {
is B -> a.bar()
is A -> a.foo()
is Any -> a.foo();
is Any? -> a.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: bar">bar</error>()
is C -> a.bar()
else -> a?.foo()
}
if (a is Any?) {
a?.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: bar">bar</error>()
}
if (a is B) {
a.bar()
}
}
fun f13(a : A?) {
if (a is B) {
a.foo()
a.bar()
}
else {
a?.foo()
<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: c">c</error>.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: bar">bar</error>()
}
a?.foo()
if (!(a is B)) {
a?.foo()
}
else {
a.foo()
}
a?.foo()
if (a is B && a.foo() == Unit) {
a.foo()
a.bar()
}
else {
a?.foo()
}
if (!(a is B) || !(a is C)) {
}
else {
}
if (!(a is B) || !(a is C)) {
}
if (!(a is B)) return
a.bar()
}
fun f14(a : A?) {
while (!(a is B)) {
}
a.bar()
}
fun f15(a : A?) {
do {
} while (!(a is B))
a.bar()
}
fun getStringLength(obj : Any) : Char? {
if (obj !is String)
return null
return obj.get(0) // no cast to kotlin.String is needed
}
fun toInt(i: Int?): Int = if (i != null) i else 0
fun illegalWhenBody(a: Any): Int = when(a) {
is Int -> a
is String -> a
else -> 1
}
fun illegalWhenBlock(a: Any): Int {
when(a) {
is Int -> return a
is String -> return a
else -> return 1
}
}
fun declarations(a: Any?) {
if (a is String) {
val p4: String = a
}
if (a is String?) {
if (a != null) {
val s: String = a
}
}
if (a != null) {
if (a is String?) {
val s: String = a
}
}
}
fun vars(a: Any?) {
var b: Int = 0
if (a is Int) {
b = a
}
}
fun returnFunctionLiteralBlock(a: Any?): Function0<Int> {
if (a is Int) return { a }
else return { 1 }
}
fun returnFunctionLiteral(a: Any?): Function0<Int> =
if (a is Int) (fun (): Int = a)
else { -> 1 }
fun mergeSmartCasts(a: Any?) {
if (a is String || a is Int) {
a.<error descr="[INAPPLICABLE_CANDIDATE] Inapplicable candidate(s): kotlin/Comparable.compareTo">compareTo</error>("")
a.toString()
}
if (a is Int || a is String) {
a.<error descr="[INAPPLICABLE_CANDIDATE] Inapplicable candidate(s): kotlin/Comparable.compareTo">compareTo</error>("")
}
when (a) {
is String, is Any -> a.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: compareTo">compareTo</error>("")
}
if (a is String && a is Any) {
val i: Int = a.compareTo("")
}
if (a is String && a.compareTo("") == 0) {}
if (a is String || a.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: compareTo">compareTo</error>("") == 0) {}
}
//mutability
fun f(): String {
var a: Any = 11
if (a is String) {
val i: String = a
a.compareTo("f")
val f: Function0<String> = {
a = 42
a
}
return a
}
return ""
}
class Mutable(var x: String?) {
val xx: String?
get() = x
fun foo(): String {
if (x is String) {
return x
}
if (x != null) {
return x
}
if (xx is String) {
return xx
}
return ""
}
fun bar(other: Mutable): String {
var y = other
if (y.x is String) {
return y.x
}
return ""
}
}
fun foo(aa: Any): Int {
var a = aa
if (a is Int) {
return a
}
return 1
}
fun inForLoop(x: Any?) {
if (x is Array<*>) {
for (i in x) {}
}
<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: hasNext"><error descr="[UNRESOLVED_REFERENCE] Unresolved reference: iterator"><error descr="[UNRESOLVED_REFERENCE] Unresolved reference: next">for (i in x) {}</error></error></error>
}
class ExplicitAccessorForAnnotation {
val tt: String? = "good"
get
fun foo(): String {
if (tt is String) {
return tt
}
return ""
}
}
+1 -1
View File
@@ -1,4 +1,4 @@
// FIR_COMPARISON
// FIR_IDENTICAL
interface A {
fun foo()
+10
View File
@@ -0,0 +1,10 @@
package kara.internal
/* Test somthing */
class MoreeFun {
fun wrte() {
val childen = 12
val come = childen
wrte()
}
}
@@ -0,0 +1,14 @@
abstract class Base {
abstract fun foo(oher: Int)
abstract val smalVal: Int
abstract fun smalFun()
}
class Other : Base() {
override fun foo(oher: Int) {
}
override val smalVal: Int get() = 1
override fun smalFun() {}
}
+1 -1
View File
@@ -1,4 +1,4 @@
// FIR_COMPARISON
// FIR_IDENTICAL
fun refs() {
var <warning>a</warning> = 1
+1 -1
View File
@@ -1,4 +1,4 @@
// FIR_COMPARISON
// FIR_IDENTICAL
interface I1
interface I2
+2 -2
View File
@@ -1,4 +1,4 @@
// FIR_COMPARISON
// FIR_IDENTICAL
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
@@ -16,4 +16,4 @@ fun bar(s: String?, r: String?): Int {
s != null -> <info descr="Smart cast to kotlin.String">s</info>
else -> ""
}).length
}
}
+1 -1
View File
@@ -1,4 +1,4 @@
// FIR_COMPARISON
// FIR_IDENTICAL
interface IA
interface IB
interface IC

Some files were not shown because too many files have changed in this diff Show More