diff --git a/compiler/fir/analysis-tests/testData/extendedCheckers/RedundantModalityModifierChecker.kt b/compiler/fir/analysis-tests/testData/extendedCheckers/RedundantModalityModifierChecker.kt index 949e5551315..53ddeb6595a 100644 --- a/compiler/fir/analysis-tests/testData/extendedCheckers/RedundantModalityModifierChecker.kt +++ b/compiler/fir/analysis-tests/testData/extendedCheckers/RedundantModalityModifierChecker.kt @@ -22,6 +22,7 @@ interface B { abstract var bar: Unit abstract fun foo() } +interface Foo expect abstract class AbstractClass : Foo { abstract override fun foo() diff --git a/compiler/fir/analysis-tests/testData/extendedCheckers/RedundantModalityModifierChecker.txt b/compiler/fir/analysis-tests/testData/extendedCheckers/RedundantModalityModifierChecker.txt index 622cc81c0f7..194e6a3c588 100644 --- a/compiler/fir/analysis-tests/testData/extendedCheckers/RedundantModalityModifierChecker.txt +++ b/compiler/fir/analysis-tests/testData/extendedCheckers/RedundantModalityModifierChecker.txt @@ -36,7 +36,9 @@ FILE: RedundantModalityModifierChecker.kt public abstract fun foo(): R|kotlin/Unit| } - public abstract expect class AbstractClass : R|ERROR CLASS: Symbol not found, for `Foo`| { + public abstract interface Foo : R|kotlin/Any| { + } + public abstract expect class AbstractClass : R|Foo| { public expect constructor(): R|AbstractClass| { super() } diff --git a/compiler/fir/analysis-tests/testData/resolve/cfg/initBlockAndInPlaceLambda.kt b/compiler/fir/analysis-tests/testData/resolve/cfg/initBlockAndInPlaceLambda.kt index 9ee834e3e1c..41ef10d358a 100644 --- a/compiler/fir/analysis-tests/testData/resolve/cfg/initBlockAndInPlaceLambda.kt +++ b/compiler/fir/analysis-tests/testData/resolve/cfg/initBlockAndInPlaceLambda.kt @@ -5,7 +5,7 @@ interface A { val b: B? } -class C(a: A, b: b) { +class C(a: A, b: B) { init { val c = a.b?.let { C(a, it) diff --git a/compiler/fir/analysis-tests/testData/resolve/cfg/initBlockAndInPlaceLambda.txt b/compiler/fir/analysis-tests/testData/resolve/cfg/initBlockAndInPlaceLambda.txt index 996d335ff9f..74398115deb 100644 --- a/compiler/fir/analysis-tests/testData/resolve/cfg/initBlockAndInPlaceLambda.txt +++ b/compiler/fir/analysis-tests/testData/resolve/cfg/initBlockAndInPlaceLambda.txt @@ -7,7 +7,7 @@ FILE: initBlockAndInPlaceLambda.kt } public final class C : R|kotlin/Any| { - public constructor(a: R|A|, b: R|ERROR CLASS: Symbol not found, for `b`|): R|C| { + public constructor(a: R|A|, b: R|B|): R|C| { super() } diff --git a/compiler/fir/analysis-tests/testData/resolve/defaultJavaImportHiding.kt b/compiler/fir/analysis-tests/testData/resolve/defaultJavaImportHiding.kt index e0bacc6cecd..d57847105bd 100644 --- a/compiler/fir/analysis-tests/testData/resolve/defaultJavaImportHiding.kt +++ b/compiler/fir/analysis-tests/testData/resolve/defaultJavaImportHiding.kt @@ -1,3 +1,4 @@ +// FULL_JDK // FILE: util/HashMap.java package util; diff --git a/compiler/fir/analysis-tests/testData/resolve/defaultJavaImportHiding.txt b/compiler/fir/analysis-tests/testData/resolve/defaultJavaImportHiding.txt index 9d61b0d4d25..9ef553ca14f 100644 --- a/compiler/fir/analysis-tests/testData/resolve/defaultJavaImportHiding.txt +++ b/compiler/fir/analysis-tests/testData/resolve/defaultJavaImportHiding.txt @@ -1,7 +1,7 @@ FILE: LinkedList.kt - public final class LinkedList : R|ERROR CLASS: Symbol not found, for `java.util.LinkedList`| { + public final class LinkedList : R|java/util/LinkedList| { public constructor(): R|foo/LinkedList| { - super`|>() + super|>() } } @@ -13,9 +13,9 @@ FILE: HashSet.kt } FILE: main.kt - public final class LinkedHashMap : R|ERROR CLASS: Symbol not found, for `java.util.LinkedHashMap`| { + public final class LinkedHashMap : R|java/util/LinkedHashMap| { public constructor(): R|foo/LinkedHashMap| { - super`|>() + super|>() } } diff --git a/compiler/fir/analysis-tests/testData/resolve/diagnostics/localAnnotationClass.kt b/compiler/fir/analysis-tests/testData/resolve/diagnostics/localAnnotationClass.kt index c897e0dcda6..9ee1d8fe997 100644 --- a/compiler/fir/analysis-tests/testData/resolve/diagnostics/localAnnotationClass.kt +++ b/compiler/fir/analysis-tests/testData/resolve/diagnostics/localAnnotationClass.kt @@ -1,7 +1,7 @@ fun foo() { annotation class Ann - @Anno class Local { + @Ann class Local { // There should also be NESTED_CLASS_NOT_ALLOWED report here. annotation class Nested } diff --git a/compiler/fir/analysis-tests/testData/resolve/diagnostics/localAnnotationClass.txt b/compiler/fir/analysis-tests/testData/resolve/diagnostics/localAnnotationClass.txt index fd3f41d618d..183cf050e24 100644 --- a/compiler/fir/analysis-tests/testData/resolve/diagnostics/localAnnotationClass.txt +++ b/compiler/fir/analysis-tests/testData/resolve/diagnostics/localAnnotationClass.txt @@ -7,7 +7,7 @@ FILE: localAnnotationClass.kt } - @R|ERROR CLASS: Symbol not found, for `Anno`|() local final class Local : R|kotlin/Any| { + @R|Ann|() local final class Local : R|kotlin/Any| { public constructor(): R|Local| { super() } diff --git a/compiler/fir/analysis-tests/testData/resolve/diagnostics/typeArgumentsNotAllowed.kt b/compiler/fir/analysis-tests/testData/resolve/diagnostics/typeArgumentsNotAllowed.kt new file mode 100644 index 00000000000..85055733a6b --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolve/diagnostics/typeArgumentsNotAllowed.kt @@ -0,0 +1,34 @@ +package rest + +abstract class Foo { + abstract val x: T + + abstract fun foo(): T +} + +fun foo() { + bar<T>() + barT>>>() +} + +fun bar() {} + +object Best { + +} + +val a = rest.MyClass +val b = Best.MyClass + +class B +class C<Boolean>> : B<F<Boolean>>() + +fun gest() {} + +fun fest() { + val b: List<T> + gest<T>() + gest() + val c: ListT>>> + gestT>>>() +} \ No newline at end of file diff --git a/compiler/fir/analysis-tests/testData/resolve/diagnostics/typeArgumentsNotAllowed.txt b/compiler/fir/analysis-tests/testData/resolve/diagnostics/typeArgumentsNotAllowed.txt new file mode 100644 index 00000000000..c00ebee9d92 --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolve/diagnostics/typeArgumentsNotAllowed.txt @@ -0,0 +1,49 @@ +FILE: typeArgumentsNotAllowed.kt + public abstract class Foo : R|kotlin/Any| { + public constructor(): R|rest/Foo| { + super() + } + + public abstract val x: + public get(): + + public abstract fun foo(): + + } + public final fun foo(): R|kotlin/Unit| { + R|rest/bar|<>() + R|rest/bar|<>() + } + public final fun bar(): R|kotlin/Unit| { + } + public final object Best : R|kotlin/Any| { + private constructor(): R|rest/Best| { + super() + } + + } + public final val a: = Q|rest|.# + public get(): + public final val b: = Q|rest/Best|.# + public get(): + public final class B : R|kotlin/Any| { + public constructor(): R|rest/B| { + super() + } + + } + public final class C : R|kotlin/Any| { + public constructor(): R|rest/C| { + super() + } + + } + public final fun gest(): R|kotlin/Unit| { + } + public final fun fest(): R|kotlin/Unit| { + lval b: + R|rest/gest|<>() + R|rest/gest|() + lval c: + R|rest/gest|<>() + } diff --git a/compiler/fir/analysis-tests/testData/resolve/diagnostics/upperBoundViolated.kt b/compiler/fir/analysis-tests/testData/resolve/diagnostics/upperBoundViolated.kt index 5ab1247d452..2dbc6b6b1d9 100644 --- a/compiler/fir/analysis-tests/testData/resolve/diagnostics/upperBoundViolated.kt +++ b/compiler/fir/analysis-tests/testData/resolve/diagnostics/upperBoundViolated.kt @@ -14,8 +14,8 @@ fun test() { val b1 = B<Int>() val b2 = B() val b3 = B<Any?>() - val b4 = B() - val b5 = B<B>() + val b4 = B<UnexistingType>() + val b5 = B<B>() fest<Boolean>() fest() fest() diff --git a/compiler/fir/analysis-tests/testData/resolve/diagnostics/upperBoundViolated.txt b/compiler/fir/analysis-tests/testData/resolve/diagnostics/upperBoundViolated.txt index e99de8fe0ed..f0c353ed66f 100644 --- a/compiler/fir/analysis-tests/testData/resolve/diagnostics/upperBoundViolated.txt +++ b/compiler/fir/analysis-tests/testData/resolve/diagnostics/upperBoundViolated.txt @@ -22,8 +22,8 @@ FILE: upperBoundViolated.kt lval b1: R|B| = R|/B.B|() lval b2: R|B| = R|/B.B|() lval b3: R|B| = R|/B.B|() - lval b4: R|B| = R|/B.B|() - lval b5: R|B>| = R|/B.B||>() + lval b4: R|B| = R|/B.B|<>() + lval b5: R|B| = R|/B.B|<>() R|/fest|() R|/fest|() R|/fest|() diff --git a/compiler/fir/analysis-tests/testData/resolve/expresssions/CallBasedInExpressionGenerator.kt b/compiler/fir/analysis-tests/testData/resolve/expresssions/CallBasedInExpressionGenerator.kt index 046f46615d0..1843aa9905b 100644 --- a/compiler/fir/analysis-tests/testData/resolve/expresssions/CallBasedInExpressionGenerator.kt +++ b/compiler/fir/analysis-tests/testData/resolve/expresssions/CallBasedInExpressionGenerator.kt @@ -1,5 +1,15 @@ package org.jetbrains.kotlin.codegen.range.inExpression +interface ExpressionCodegen +interface KtSimpleNameExpression +interface InExpressionGenerator +interface StackValue +open class BranchedValue +interface Type +interface KotlinType +interface Label +interface InstructionAdapter + class CallBasedInExpressionGenerator( val codegen: ExpressionCodegen, operatorReference: KtSimpleNameExpression @@ -8,10 +18,10 @@ class CallBasedInExpressionGenerator( private val isInverted = operatorReference.getReferencedNameElementType() == KtTokens.NOT_IN override fun generate(argument: StackValue): BranchedValue = - gen(argument).let { if (isInverted) Invert(it) else it } + gen(argument).let { if (isInverted) Invert(it) else it } private fun gen(argument: StackValue): BranchedValue = - object : BranchedValue(argument, null, argument.type, Opcodes.IFEQ) { + object : BranchedValue(argument, null, argument.type, Opcodes.IFEQ) { override fun putSelector(type: Type, kotlinType: KotlinType?, v: InstructionAdapter) { invokeFunction(v) coerceTo(type, kotlinType, v) diff --git a/compiler/fir/analysis-tests/testData/resolve/expresssions/CallBasedInExpressionGenerator.txt b/compiler/fir/analysis-tests/testData/resolve/expresssions/CallBasedInExpressionGenerator.txt index bc64e9602cc..e2d481f68c6 100644 --- a/compiler/fir/analysis-tests/testData/resolve/expresssions/CallBasedInExpressionGenerator.txt +++ b/compiler/fir/analysis-tests/testData/resolve/expresssions/CallBasedInExpressionGenerator.txt @@ -1,11 +1,33 @@ FILE: CallBasedInExpressionGenerator.kt - public final class CallBasedInExpressionGenerator : R|ERROR CLASS: Symbol not found, for `InExpressionGenerator`| { - public constructor(codegen: R|ERROR CLASS: Symbol not found, for `ExpressionCodegen`|, operatorReference: R|ERROR CLASS: Symbol not found, for `KtSimpleNameExpression`|): R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator| { + public abstract interface ExpressionCodegen : R|kotlin/Any| { + } + public abstract interface KtSimpleNameExpression : R|kotlin/Any| { + } + public abstract interface InExpressionGenerator : R|kotlin/Any| { + } + public abstract interface StackValue : R|kotlin/Any| { + } + public open class BranchedValue : R|kotlin/Any| { + public constructor(): R|org/jetbrains/kotlin/codegen/range/inExpression/BranchedValue| { super() } - public final val codegen: R|ERROR CLASS: Symbol not found, for `ExpressionCodegen`| = R|/codegen| - public get(): R|ERROR CLASS: Symbol not found, for `ExpressionCodegen`| + } + public abstract interface Type : R|kotlin/Any| { + } + public abstract interface KotlinType : R|kotlin/Any| { + } + public abstract interface Label : R|kotlin/Any| { + } + public abstract interface InstructionAdapter : R|kotlin/Any| { + } + public final class CallBasedInExpressionGenerator : R|org/jetbrains/kotlin/codegen/range/inExpression/InExpressionGenerator| { + public constructor(codegen: R|org/jetbrains/kotlin/codegen/range/inExpression/ExpressionCodegen|, operatorReference: R|org/jetbrains/kotlin/codegen/range/inExpression/KtSimpleNameExpression|): R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator| { + super() + } + + public final val codegen: R|org/jetbrains/kotlin/codegen/range/inExpression/ExpressionCodegen| = R|/codegen| + public get(): R|org/jetbrains/kotlin/codegen/range/inExpression/ExpressionCodegen| private final val resolvedCall: = R|/operatorReference|.#(R|/codegen|.#) private get(): @@ -13,8 +35,8 @@ FILE: CallBasedInExpressionGenerator.kt private final val isInverted: R|kotlin/Boolean| = ==(R|/operatorReference|.#(), #.#) private get(): R|kotlin/Boolean| - public final override fun generate(argument: R|ERROR CLASS: Symbol not found, for `StackValue`|): R|ERROR CLASS: Symbol not found, for `BranchedValue`| { - ^generate this@R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator|.R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator.gen|(R|/argument|).#( = let@fun (it: R|kotlin/Any?|): { + public final override fun generate(argument: R|org/jetbrains/kotlin/codegen/range/inExpression/StackValue|): R|org/jetbrains/kotlin/codegen/range/inExpression/BranchedValue| { + ^generate this@R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator|.R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator.gen|(R|/argument|).R|kotlin/let|( = let@fun (it: R|org/jetbrains/kotlin/codegen/range/inExpression/BranchedValue|): R|org/jetbrains/kotlin/codegen/range/inExpression/BranchedValue| { ^ when () { this@R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator|.R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator.isInverted| -> { #(R|/it|) @@ -28,18 +50,18 @@ FILE: CallBasedInExpressionGenerator.kt ) } - private final fun gen(argument: R|ERROR CLASS: Symbol not found, for `StackValue`|): R|ERROR CLASS: Symbol not found, for `BranchedValue`| { - ^gen object : R|ERROR CLASS: Symbol not found, for `BranchedValue`| { + private final fun gen(argument: R|org/jetbrains/kotlin/codegen/range/inExpression/StackValue|): R|org/jetbrains/kotlin/codegen/range/inExpression/BranchedValue| { + ^gen object : R|org/jetbrains/kotlin/codegen/range/inExpression/BranchedValue| { private constructor(): R|| { - super(R|/argument|, Null(null), R|/argument|.#, #.#) + super(R|/argument|, Null(null), R|/argument|.#, #.#) } - public final override fun putSelector(type: R|ERROR CLASS: Symbol not found, for `Type`|, kotlinType: R|ERROR CLASS: Symbol not found, for `KotlinType?`|, v: R|ERROR CLASS: Symbol not found, for `InstructionAdapter`|): R|kotlin/Unit| { + public final override fun putSelector(type: R|org/jetbrains/kotlin/codegen/range/inExpression/Type|, kotlinType: R|org/jetbrains/kotlin/codegen/range/inExpression/KotlinType?|, v: R|org/jetbrains/kotlin/codegen/range/inExpression/InstructionAdapter|): R|kotlin/Unit| { this@R|/|.R|/.invokeFunction|(R|/v|) #(R|/type|, R|/kotlinType|, R|/v|) } - public final override fun condJump(jumpLabel: R|ERROR CLASS: Symbol not found, for `Label`|, v: R|ERROR CLASS: Symbol not found, for `InstructionAdapter`|, jumpIfFalse: R|kotlin/Boolean|): R|kotlin/Unit| { + public final override fun condJump(jumpLabel: R|org/jetbrains/kotlin/codegen/range/inExpression/Label|, v: R|org/jetbrains/kotlin/codegen/range/inExpression/InstructionAdapter|, jumpIfFalse: R|kotlin/Boolean|): R|kotlin/Unit| { this@R|/|.R|/.invokeFunction|(R|/v|) R|/v|.#(when () { R|/jumpIfFalse| -> { @@ -52,7 +74,7 @@ FILE: CallBasedInExpressionGenerator.kt , R|/jumpLabel|) } - private final fun invokeFunction(v: R|ERROR CLASS: Symbol not found, for `InstructionAdapter`|): R|kotlin/Unit| { + private final fun invokeFunction(v: R|org/jetbrains/kotlin/codegen/range/inExpression/InstructionAdapter|): R|kotlin/Unit| { lval result: = this@R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator|.R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator.codegen|.#(this@R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator|.R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator.resolvedCall|.#, this@R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator|.R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator.resolvedCall|, #()) R|/result|.#(R|/result|.#, R|/result|.#, R|/v|) } diff --git a/compiler/fir/analysis-tests/testData/resolve/fakeRecursiveSupertype.txt b/compiler/fir/analysis-tests/testData/resolve/fakeRecursiveSupertype.txt index 664066f8034..6a3d5f6c834 100644 --- a/compiler/fir/analysis-tests/testData/resolve/fakeRecursiveSupertype.txt +++ b/compiler/fir/analysis-tests/testData/resolve/fakeRecursiveSupertype.txt @@ -1,5 +1,5 @@ FILE: fakeRecursiveSupertype.kt - public final class My : R|ERROR CLASS: Loop in supertype: /My -> /My| { + public final class My : /My> { public constructor(): R|My| { super() } @@ -11,7 +11,7 @@ FILE: fakeRecursiveSupertype.kt } } - public final class His : R|ERROR CLASS: Loop in supertype: /His -> /Your| { + public final class His : /Your> { public constructor(): R|His| { super() } diff --git a/compiler/fir/analysis-tests/testData/resolve/fakeRecursiveTypealias.kt b/compiler/fir/analysis-tests/testData/resolve/fakeRecursiveTypealias.kt index b67f1545153..9ce2d49bfb6 100644 --- a/compiler/fir/analysis-tests/testData/resolve/fakeRecursiveTypealias.kt +++ b/compiler/fir/analysis-tests/testData/resolve/fakeRecursiveTypealias.kt @@ -1,5 +1,5 @@ import incorrect.directory.Your -typealias My = incorrect.directory.My +typealias My = incorrect.directory.My typealias Your = Your \ No newline at end of file diff --git a/compiler/fir/analysis-tests/testData/resolve/fakeRecursiveTypealias.txt b/compiler/fir/analysis-tests/testData/resolve/fakeRecursiveTypealias.txt index b059aa61af3..a6efbf787fa 100644 --- a/compiler/fir/analysis-tests/testData/resolve/fakeRecursiveTypealias.txt +++ b/compiler/fir/analysis-tests/testData/resolve/fakeRecursiveTypealias.txt @@ -1,3 +1,3 @@ FILE: fakeRecursiveTypealias.kt - public final typealias My = R|ERROR CLASS: Symbol not found, for `incorrect.directory.My`| - public final typealias Your = R|ERROR CLASS: Loop in supertype: /Your -> /Your| + public final typealias My = + public final typealias Your = /Your> diff --git a/compiler/fir/analysis-tests/testData/resolve/multifile/sealedStarImport.kt b/compiler/fir/analysis-tests/testData/resolve/multifile/sealedStarImport.kt index cfe3423e264..19b178b5232 100644 --- a/compiler/fir/analysis-tests/testData/resolve/multifile/sealedStarImport.kt +++ b/compiler/fir/analysis-tests/testData/resolve/multifile/sealedStarImport.kt @@ -15,7 +15,7 @@ package other import test.Test.* abstract class Factory { - abstract fun createTest(): Test + abstract fun createTest(): Test abstract fun createObj(): O diff --git a/compiler/fir/analysis-tests/testData/resolve/multifile/sealedStarImport.txt b/compiler/fir/analysis-tests/testData/resolve/multifile/sealedStarImport.txt index bcf1b06837c..5e81cbcc178 100644 --- a/compiler/fir/analysis-tests/testData/resolve/multifile/sealedStarImport.txt +++ b/compiler/fir/analysis-tests/testData/resolve/multifile/sealedStarImport.txt @@ -28,7 +28,7 @@ FILE: main.kt super() } - public abstract fun createTest(): R|ERROR CLASS: Symbol not found, for `Test`| + public abstract fun createTest(): public abstract fun createObj(): R|test/Test.O| diff --git a/compiler/fir/analysis-tests/testData/resolve/typeParameterVsNested.kt b/compiler/fir/analysis-tests/testData/resolve/typeParameterVsNested.kt index d9e6671eed0..fd699615f25 100644 --- a/compiler/fir/analysis-tests/testData/resolve/typeParameterVsNested.kt +++ b/compiler/fir/analysis-tests/testData/resolve/typeParameterVsNested.kt @@ -9,9 +9,9 @@ abstract class My { abstract fun foo(arg: T) - abstract val y: My.T + abstract val y: My.T - abstract val z: test.My.T + abstract val z: test.My.T class Some : T() } diff --git a/compiler/fir/analysis-tests/testData/resolve/typeParameterVsNested.txt b/compiler/fir/analysis-tests/testData/resolve/typeParameterVsNested.txt index 2c547192089..2cf68d22f0a 100644 --- a/compiler/fir/analysis-tests/testData/resolve/typeParameterVsNested.txt +++ b/compiler/fir/analysis-tests/testData/resolve/typeParameterVsNested.txt @@ -18,11 +18,11 @@ FILE: typeParameterVsNested.kt public abstract fun foo(arg: R|test/My.T|): R|kotlin/Unit| - public abstract val y: R|test/My.T| - public get(): R|test/My.T| + public abstract val y: + public get(): - public abstract val z: R|test/My.T| - public get(): R|test/My.T| + public abstract val z: + public get(): public final class Some : R|test/My.T| { public constructor(): R|test/My.Some| { @@ -32,7 +32,7 @@ FILE: typeParameterVsNested.kt } } - public abstract class Your : R|ERROR CLASS: Type parameter cannot be a super-type: T| { + public abstract class Your : { public constructor(): R|test/Your| { super() } diff --git a/compiler/fir/analysis-tests/testData/resolve/types/capturedParametersOfInnerClasses.kt b/compiler/fir/analysis-tests/testData/resolve/types/capturedParametersOfInnerClasses.kt index f78eb42830c..3ef73ef7c30 100644 --- a/compiler/fir/analysis-tests/testData/resolve/types/capturedParametersOfInnerClasses.kt +++ b/compiler/fir/analysis-tests/testData/resolve/types/capturedParametersOfInnerClasses.kt @@ -10,4 +10,4 @@ class A { fun foo(c: A.B.C) {} -fun foo(c: A.B.C) {} \ No newline at end of file +fun foo(c: A.B.C) {} \ No newline at end of file diff --git a/compiler/fir/analysis-tests/testData/resolve/types/capturedParametersOfInnerClasses.txt b/compiler/fir/analysis-tests/testData/resolve/types/capturedParametersOfInnerClasses.txt index 1a9af7518eb..459c37e8e6e 100644 --- a/compiler/fir/analysis-tests/testData/resolve/types/capturedParametersOfInnerClasses.txt +++ b/compiler/fir/analysis-tests/testData/resolve/types/capturedParametersOfInnerClasses.txt @@ -27,5 +27,5 @@ FILE: capturedParametersOfInnerClasses.kt } public final fun foo(c: R|A.B.C|): R|kotlin/Unit| { } - public final fun foo(c: R|A.B.C|): R|kotlin/Unit| { + public final fun foo(c: ): R|kotlin/Unit| { } diff --git a/compiler/fir/analysis-tests/testData/resolve/visibility/exposedSupertype.kt b/compiler/fir/analysis-tests/testData/resolve/visibility/exposedSupertype.kt index 861275d5b04..540afd11c7a 100644 --- a/compiler/fir/analysis-tests/testData/resolve/visibility/exposedSupertype.kt +++ b/compiler/fir/analysis-tests/testData/resolve/visibility/exposedSupertype.kt @@ -58,6 +58,6 @@ class Test6 : E, C.CPublic { } -class Test7 : D.PublicButProtected { +class Test7 : D.PublicButProtected { } \ No newline at end of file diff --git a/compiler/fir/analysis-tests/testData/resolve/visibility/exposedSupertype.txt b/compiler/fir/analysis-tests/testData/resolve/visibility/exposedSupertype.txt index 1fa211858a0..6634ed366dc 100644 --- a/compiler/fir/analysis-tests/testData/resolve/visibility/exposedSupertype.txt +++ b/compiler/fir/analysis-tests/testData/resolve/visibility/exposedSupertype.txt @@ -92,7 +92,7 @@ FILE: exposedSupertype.kt } } - public final class Test7 : R|ERROR CLASS: Symbol not found, for `D.PublicButProtected`| { + public final class Test7 : { public constructor(): R|Test7| { super() } diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/KJKComplexHierarchyNestedLoop.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/KJKComplexHierarchyNestedLoop.kt index cb863d7ced1..4b1603dfc7b 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/KJKComplexHierarchyNestedLoop.kt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/KJKComplexHierarchyNestedLoop.kt @@ -1,6 +1,6 @@ // FILE: K1.kt class K2: J1() { - class Q : Nested() + class Q : Nested() fun bar() { foo() baz() diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/KJKComplexHierarchyNestedLoop.txt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/KJKComplexHierarchyNestedLoop.txt index 4c55ec3e552..bcfee608d9a 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/KJKComplexHierarchyNestedLoop.txt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/KJKComplexHierarchyNestedLoop.txt @@ -4,9 +4,9 @@ FILE: K1.kt super() } - public final class Q : R|ERROR CLASS: Symbol not found, for `Nested`| { + public final class Q : { public constructor(): R|K2.Q| { - super() + super<>() } } diff --git a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java index 00c9e09a8ef..c6b0cd971c4 100644 --- a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java @@ -966,6 +966,11 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest { runTest("compiler/fir/analysis-tests/testData/resolve/diagnostics/superclassNotAccessibleFromInterface.kt"); } + @TestMetadata("typeArgumentsNotAllowed.kt") + public void testTypeArgumentsNotAllowed() throws Exception { + runTest("compiler/fir/analysis-tests/testData/resolve/diagnostics/typeArgumentsNotAllowed.kt"); + } + @TestMetadata("typeOfAnnotationMember.kt") public void testTypeOfAnnotationMember() throws Exception { runTest("compiler/fir/analysis-tests/testData/resolve/diagnostics/typeOfAnnotationMember.kt"); diff --git a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithLightTreeTestGenerated.java b/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithLightTreeTestGenerated.java index 58b52e032cf..d62df59226d 100644 --- a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithLightTreeTestGenerated.java +++ b/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithLightTreeTestGenerated.java @@ -966,6 +966,11 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos runTest("compiler/fir/analysis-tests/testData/resolve/diagnostics/superclassNotAccessibleFromInterface.kt"); } + @TestMetadata("typeArgumentsNotAllowed.kt") + public void testTypeArgumentsNotAllowed() throws Exception { + runTest("compiler/fir/analysis-tests/testData/resolve/diagnostics/typeArgumentsNotAllowed.kt"); + } + @TestMetadata("typeOfAnnotationMember.kt") public void testTypeOfAnnotationMember() throws Exception { runTest("compiler/fir/analysis-tests/testData/resolve/diagnostics/typeOfAnnotationMember.kt"); diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/DefaultDeclarationCheckers.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/DefaultDeclarationCheckers.kt index 370839c1cfe..83403fc3a13 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/DefaultDeclarationCheckers.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/DefaultDeclarationCheckers.kt @@ -23,7 +23,7 @@ object CommonDeclarationCheckers : DeclarationCheckers() { ) override val constructorCheckers: List = listOf( - FirConstructorAllowedChecker + FirConstructorAllowedChecker, ) override val controlFlowAnalyserCheckers: List = listOf( diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/DefaultExpressionCheckers.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/DefaultExpressionCheckers.kt index 2d6e04a8c92..6f554dc5aac 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/DefaultExpressionCheckers.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/DefaultExpressionCheckers.kt @@ -15,6 +15,7 @@ object CommonExpressionCheckers : ExpressionCheckers() { FirQualifiedSupertypeExtendedByOtherSupertypeChecker, FirProjectionsOnNonClassTypeArgumentChecker, FirUpperBoundViolatedChecker, + FirTypeArgumentsNotAllowedExpressionChecker, ) override val functionCallCheckers: List = listOf() } \ No newline at end of file diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirTypeArgumentsNotAllowedExpressionChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirTypeArgumentsNotAllowedExpressionChecker.kt new file mode 100644 index 00000000000..c45208fe452 --- /dev/null +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirTypeArgumentsNotAllowedExpressionChecker.kt @@ -0,0 +1,72 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.fir.analysis.checkers.expression + +import com.intellij.lang.LighterASTNode +import com.intellij.openapi.util.Ref +import com.intellij.psi.PsiElement +import com.intellij.psi.PsiErrorElement +import com.intellij.util.diff.FlyweightCapableTreeStructure +import org.jetbrains.kotlin.KtNodeTypes.TYPE_ARGUMENT_LIST +import org.jetbrains.kotlin.fir.FirLightSourceElement +import org.jetbrains.kotlin.fir.FirSourceElement +import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext +import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter +import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors +import org.jetbrains.kotlin.fir.expressions.FirQualifiedAccessExpression +import org.jetbrains.kotlin.fir.expressions.FirResolvedQualifier +import org.jetbrains.kotlin.fir.lightNode +import org.jetbrains.kotlin.fir.psi +import org.jetbrains.kotlin.psi.KtTypeArgumentList + +object FirTypeArgumentsNotAllowedExpressionChecker : FirQualifiedAccessChecker() { + override fun check(functionCall: FirQualifiedAccessExpression, context: CheckerContext, reporter: DiagnosticReporter) { + // analyze type parameters near + // package names + val explicitReceiver = functionCall.explicitReceiver + + if (explicitReceiver is FirResolvedQualifier && explicitReceiver.symbol == null) { + if (explicitReceiver.source?.hasAnyArguments() == true) { + reporter.report(explicitReceiver.source) + return + } + } + } + + private fun FirSourceElement.hasAnyArguments(): Boolean { + val localPsi = this.psi + val localLight = this.lightNode + + if (localPsi != null && localPsi !is PsiErrorElement) { + return localPsi.hasAnyArguments() + } else if (localLight != null && this is FirLightSourceElement) { + return localLight.hasAnyArguments(this.tree) + } + + return false + } + + private fun PsiElement.hasAnyArguments(): Boolean { + return this.children.size > 1 && this.children[1] is KtTypeArgumentList + } + + private fun LighterASTNode.hasAnyArguments(tree: FlyweightCapableTreeStructure): Boolean { + val children = getChildren(tree) + return children.count { it != null } > 1 && children[1]?.tokenType == TYPE_ARGUMENT_LIST + } + + private fun LighterASTNode.getChildren(tree: FlyweightCapableTreeStructure): Array { + val childrenRef = Ref>() + val childCount = tree.getChildren(this, childrenRef) + return if (childCount > 0) childrenRef.get() else emptyArray() + } + + private fun DiagnosticReporter.report(source: FirSourceElement?) { + source?.let { + report(FirErrors.TYPE_ARGUMENTS_NOT_ALLOWED.on(it)) + } + } +} \ No newline at end of file diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/collectors/components/ErrorNodeDiagnosticCollectorComponent.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/collectors/components/ErrorNodeDiagnosticCollectorComponent.kt index c37b14e0fa2..03af8e82d6d 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/collectors/components/ErrorNodeDiagnosticCollectorComponent.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/collectors/components/ErrorNodeDiagnosticCollectorComponent.kt @@ -12,9 +12,7 @@ import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter import org.jetbrains.kotlin.fir.analysis.diagnostics.FirDiagnosticFactory0 import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors import org.jetbrains.kotlin.fir.declarations.FirErrorFunction -import org.jetbrains.kotlin.fir.diagnostics.ConeDiagnostic -import org.jetbrains.kotlin.fir.diagnostics.ConeSimpleDiagnostic -import org.jetbrains.kotlin.fir.diagnostics.ConeStubDiagnostic +import org.jetbrains.kotlin.fir.diagnostics.* import org.jetbrains.kotlin.fir.diagnostics.DiagnosticKind.* import org.jetbrains.kotlin.fir.expressions.FirErrorExpression import org.jetbrains.kotlin.fir.expressions.FirErrorLoop @@ -22,6 +20,7 @@ import org.jetbrains.kotlin.fir.references.FirErrorNamedReference import org.jetbrains.kotlin.fir.resolve.calls.CandidateApplicability import org.jetbrains.kotlin.fir.resolve.diagnostics.* import org.jetbrains.kotlin.fir.types.FirErrorTypeRef +import org.jetbrains.kotlin.utils.addToStdlib.safeAs class ErrorNodeDiagnosticCollectorComponent(collector: AbstractDiagnosticCollector) : AbstractDiagnosticCollectorComponent(collector) { override fun visitErrorLoop(errorLoop: FirErrorLoop, data: CheckerContext) { @@ -64,8 +63,10 @@ class ErrorNodeDiagnosticCollectorComponent(collector: AbstractDiagnosticCollect is ConeOperatorAmbiguityError -> FirErrors.ASSIGN_OPERATOR_AMBIGUITY.on(source, diagnostic.candidates) is ConeVariableExpectedError -> FirErrors.VARIABLE_EXPECTED.on(source) is ConeTypeMismatchError -> FirErrors.TYPE_MISMATCH.on(source, diagnostic.expectedType, diagnostic.actualType) + is ConeUnexpectedTypeArgumentsError -> FirErrors.TYPE_ARGUMENTS_NOT_ALLOWED.on(diagnostic.source.safeAs() ?: source) is ConeSimpleDiagnostic -> diagnostic.getFactory().on(source) is ConeStubDiagnostic -> null + is ConeIntermediateDiagnostic -> null else -> throw IllegalArgumentException("Unsupported diagnostic type: ${diagnostic.javaClass}") } reporter.report(coneDiagnostic) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt index 7020196fda4..bfda1da579e 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt @@ -80,6 +80,7 @@ object FirErrors { val PROJECTION_ON_NON_CLASS_TYPE_ARGUMENT by error0() val UPPER_BOUND_VIOLATED by error0() + val TYPE_ARGUMENTS_NOT_ALLOWED by error0() val MANY_COMPANION_OBJECTS by error0() val LOCAL_OBJECT_NOT_ALLOWED by error0() diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/diagnostics/ConeDiagnostic.kt b/compiler/fir/cones/src/org/jetbrains/kotlin/fir/diagnostics/ConeDiagnostic.kt similarity index 85% rename from compiler/fir/tree/src/org/jetbrains/kotlin/fir/diagnostics/ConeDiagnostic.kt rename to compiler/fir/cones/src/org/jetbrains/kotlin/fir/diagnostics/ConeDiagnostic.kt index cbad17b4001..f8f4e967917 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/diagnostics/ConeDiagnostic.kt +++ b/compiler/fir/cones/src/org/jetbrains/kotlin/fir/diagnostics/ConeDiagnostic.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ diff --git a/compiler/fir/cones/src/org/jetbrains/kotlin/fir/types/ConeTypes.kt b/compiler/fir/cones/src/org/jetbrains/kotlin/fir/types/ConeTypes.kt index 2d1f0e0d2d4..1fa05488b79 100644 --- a/compiler/fir/cones/src/org/jetbrains/kotlin/fir/types/ConeTypes.kt +++ b/compiler/fir/cones/src/org/jetbrains/kotlin/fir/types/ConeTypes.kt @@ -5,6 +5,7 @@ package org.jetbrains.kotlin.fir.types +import org.jetbrains.kotlin.fir.diagnostics.ConeDiagnostic import org.jetbrains.kotlin.fir.symbols.ConeClassLikeLookupTag import org.jetbrains.kotlin.fir.symbols.ConeClassifierLookupTag import org.jetbrains.kotlin.name.ClassId @@ -82,7 +83,7 @@ typealias ConeKotlinErrorType = ConeClassErrorType class ConeClassLikeErrorLookupTag(override val classId: ClassId) : ConeClassLikeLookupTag() -class ConeClassErrorType(val reason: String) : ConeClassLikeType() { +class ConeClassErrorType(val diagnostic: ConeDiagnostic) : ConeClassLikeType() { override val lookupTag: ConeClassLikeLookupTag get() = ConeClassLikeErrorLookupTag(ClassId.fromString("")) diff --git a/compiler/fir/cones/src/org/jetbrains/kotlin/fir/types/TypeRenderer.kt b/compiler/fir/cones/src/org/jetbrains/kotlin/fir/types/TypeRenderer.kt index 4cc2103549d..25b65c17a66 100644 --- a/compiler/fir/cones/src/org/jetbrains/kotlin/fir/types/TypeRenderer.kt +++ b/compiler/fir/cones/src/org/jetbrains/kotlin/fir/types/TypeRenderer.kt @@ -14,7 +14,7 @@ fun ConeKotlinType.render(): String { return when (this) { is ConeTypeVariableType -> "TypeVariable(${this.lookupTag.name})" is ConeDefinitelyNotNullType -> "${original.render()}!!" - is ConeClassErrorType -> "ERROR CLASS: $reason" + is ConeClassErrorType -> "ERROR CLASS: ${diagnostic.reason}" is ConeCapturedType -> "CapturedType(${constructor.projection.render()})" is ConeClassLikeType -> { buildString { diff --git a/compiler/fir/dump/src/org/jetbrains/kotlin/fir/dump/HtmlFirDump.kt b/compiler/fir/dump/src/org/jetbrains/kotlin/fir/dump/HtmlFirDump.kt index 2f163290329..d71927a5bc4 100644 --- a/compiler/fir/dump/src/org/jetbrains/kotlin/fir/dump/HtmlFirDump.kt +++ b/compiler/fir/dump/src/org/jetbrains/kotlin/fir/dump/HtmlFirDump.kt @@ -838,7 +838,7 @@ class HtmlFirDump internal constructor(private var linkResolver: FirLinkResolver private fun FlowContent.generate(type: ConeKotlinType) { when (type) { - is ConeClassErrorType -> error { +type.reason } + is ConeClassErrorType -> error { +type.diagnostic.reason } is ConeClassLikeType -> return generate(type) is ConeTypeParameterType -> resolved { symbolRef(type.lookupTag.toSymbol()) { @@ -901,7 +901,7 @@ class HtmlFirDump internal constructor(private var linkResolver: FirLinkResolver unresolved++ generateList(typeRef.qualifier, separator = ".") { simpleName(it.name) - generateTypeProjections(it.typeArguments) + generateTypeProjections(it.typeArgumentList.typeArguments) } if (typeRef.isMarkedNullable) { +"?" diff --git a/compiler/fir/fir2ir/jvm-backend/src/org/jetbrains/kotlin/fir/backend/jvm/FirJvmClassCodegen.kt b/compiler/fir/fir2ir/jvm-backend/src/org/jetbrains/kotlin/fir/backend/jvm/FirJvmClassCodegen.kt index 41f16278860..c2d9206ed62 100644 --- a/compiler/fir/fir2ir/jvm-backend/src/org/jetbrains/kotlin/fir/backend/jvm/FirJvmClassCodegen.kt +++ b/compiler/fir/fir2ir/jvm-backend/src/org/jetbrains/kotlin/fir/backend/jvm/FirJvmClassCodegen.kt @@ -22,6 +22,7 @@ import org.jetbrains.kotlin.fir.declarations.FirDeclarationOrigin import org.jetbrains.kotlin.fir.declarations.FirFunction import org.jetbrains.kotlin.fir.declarations.FirTypeParameter import org.jetbrains.kotlin.fir.declarations.builder.* +import org.jetbrains.kotlin.fir.diagnostics.ConeIntermediateDiagnostic import org.jetbrains.kotlin.fir.typeContext import org.jetbrains.kotlin.fir.scopes.impl.withReplacedConeType import org.jetbrains.kotlin.fir.serialization.FirElementSerializer @@ -61,7 +62,7 @@ class FirJvmClassCodegen( private val approximator = object : AbstractTypeApproximator(session.typeContext) { override fun createErrorType(message: String): SimpleTypeMarker { - return ConeKotlinErrorType(message) + return ConeKotlinErrorType(ConeIntermediateDiagnostic(message)) } } diff --git a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaUtils.kt b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaUtils.kt index b08c531bb17..5d19ec1b384 100644 --- a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaUtils.kt +++ b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaUtils.kt @@ -14,8 +14,7 @@ import org.jetbrains.kotlin.fir.builder.FirBuilderDsl import org.jetbrains.kotlin.fir.declarations.FirRegularClass import org.jetbrains.kotlin.fir.declarations.FirTypeParameter import org.jetbrains.kotlin.fir.declarations.FirValueParameter -import org.jetbrains.kotlin.fir.diagnostics.ConeSimpleDiagnostic -import org.jetbrains.kotlin.fir.diagnostics.DiagnosticKind +import org.jetbrains.kotlin.fir.diagnostics.* import org.jetbrains.kotlin.fir.expressions.* import org.jetbrains.kotlin.fir.expressions.builder.* import org.jetbrains.kotlin.fir.java.declarations.buildJavaValueParameter @@ -75,7 +74,9 @@ internal fun FirTypeRef.toConeKotlinTypeProbablyFlexible( is FirJavaTypeRef -> { type.toConeKotlinTypeWithoutEnhancement(session, javaTypeParameterStack) } - else -> ConeKotlinErrorType("Unexpected type reference in JavaClassUseSiteMemberScope: ${this::class.java}") + else -> ConeKotlinErrorType( + ConeSimpleDiagnostic("Unexpected type reference in JavaClassUseSiteMemberScope: ${this::class.java}") + ) } internal fun JavaType.toFirJavaTypeRef(session: FirSession, javaTypeParameterStack: JavaTypeParameterStack): FirJavaTypeRef { @@ -217,7 +218,9 @@ private fun FirTypeParameter.getErasedUpperBound( // E.g. `class A` // To prevent recursive calls return defaultValue() instead potentiallyRecursiveTypeParameter: FirTypeParameter? = null, - defaultValue: (() -> ConeKotlinType) = { ConeKotlinErrorType("Can't compute erased upper bound of type parameter `$this`") } + defaultValue: (() -> ConeKotlinType) = { + ConeKotlinErrorType(ConeIntermediateDiagnostic("Can't compute erased upper bound of type parameter `$this`")) + } ): ConeKotlinType { if (this === potentiallyRecursiveTypeParameter) return defaultValue() @@ -318,7 +321,7 @@ private fun JavaClassifierType.toConeKotlinTypeForFlexibleBound( val symbol = javaTypeParameterStack[classifier] ConeTypeParameterTypeImpl(symbol.toLookupTag(), isNullable = !isLowerBound) } - else -> ConeKotlinErrorType("Unexpected classifier: $classifier") + else -> ConeKotlinErrorType(ConeSimpleDiagnostic("Unexpected classifier: $classifier")) } } @@ -393,7 +396,7 @@ private fun JavaType?.toConeProjectionWithoutEnhancement( } is JavaClassifierType -> toConeKotlinTypeWithoutEnhancement(session, javaTypeParameterStack) is JavaArrayType -> toConeKotlinTypeWithoutEnhancement(session, javaTypeParameterStack) - else -> ConeClassErrorType("Unexpected type argument: $this") + else -> ConeClassErrorType(ConeSimpleDiagnostic("Unexpected type argument: $this")) } } @@ -498,7 +501,7 @@ private fun JavaType.toFirResolvedTypeRef( forTypeParameterBounds = false ) return buildResolvedTypeRef { - type = ConeClassErrorType("Unexpected JavaType: $this") + type = ConeClassErrorType(ConeSimpleDiagnostic("Unexpected JavaType: $this")) } } diff --git a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/enhancement/javaTypeUtils.kt b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/enhancement/javaTypeUtils.kt index e68ffe222cb..69459d3fee5 100644 --- a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/enhancement/javaTypeUtils.kt +++ b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/enhancement/javaTypeUtils.kt @@ -248,7 +248,7 @@ internal data class TypeAndDefaultQualifiers( ) internal fun FirTypeRef.typeArguments(): List = - (this as? FirUserTypeRef)?.qualifier?.lastOrNull()?.typeArguments.orEmpty() + (this as? FirUserTypeRef)?.qualifier?.lastOrNull()?.typeArgumentList?.typeArguments.orEmpty() internal fun JavaType.typeArguments(): List = (this as? JavaClassifierType)?.typeArguments.orEmpty() diff --git a/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/DeclarationsConverter.kt b/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/DeclarationsConverter.kt index d20951ae5be..eb47c057d7f 100644 --- a/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/DeclarationsConverter.kt +++ b/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/DeclarationsConverter.kt @@ -47,6 +47,7 @@ import org.jetbrains.kotlin.fir.types.* import org.jetbrains.kotlin.fir.types.builder.* import org.jetbrains.kotlin.fir.types.impl.ConeClassLikeTypeImpl import org.jetbrains.kotlin.fir.types.impl.FirQualifierPartImpl +import org.jetbrains.kotlin.fir.types.impl.FirTypeArgumentListImpl import org.jetbrains.kotlin.lexer.KtModifierKeywordToken import org.jetbrains.kotlin.lexer.KtTokens.* import org.jetbrains.kotlin.name.ClassId @@ -1601,10 +1602,16 @@ class DeclarationsConverter( if (identifier == null) return buildErrorTypeRef { diagnostic = ConeSimpleDiagnostic("Incomplete user type", DiagnosticKind.Syntax) } - val qualifierPart = FirQualifierPartImpl(identifier.nameAsSafeName()).apply { typeArguments += firTypeArguments } + val theSource = userType.toFirSourceElement() + val qualifierPart = FirQualifierPartImpl( + identifier.nameAsSafeName(), + FirTypeArgumentListImpl(theSource).apply { + typeArguments += firTypeArguments + } + ) return buildUserTypeRef { - source = userType.toFirSourceElement() + source = theSource isMarkedNullable = isNullable qualifier.add(qualifierPart) simpleFirUserType?.qualifier?.let { this.qualifier.addAll(0, it) } diff --git a/compiler/fir/raw-fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/RawFirBuilder.kt b/compiler/fir/raw-fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/RawFirBuilder.kt index 9639e3169b6..67298b4ea2f 100644 --- a/compiler/fir/raw-fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/RawFirBuilder.kt +++ b/compiler/fir/raw-fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/RawFirBuilder.kt @@ -6,6 +6,7 @@ package org.jetbrains.kotlin.fir.builder import com.intellij.psi.PsiElement +import com.intellij.psi.PsiErrorElement import com.intellij.psi.tree.IElementType import org.jetbrains.kotlin.descriptors.ClassKind import org.jetbrains.kotlin.descriptors.Modality @@ -35,6 +36,7 @@ import org.jetbrains.kotlin.fir.types.* import org.jetbrains.kotlin.fir.types.builder.* import org.jetbrains.kotlin.fir.types.impl.ConeClassLikeTypeImpl import org.jetbrains.kotlin.fir.types.impl.FirQualifierPartImpl +import org.jetbrains.kotlin.fir.types.impl.FirTypeArgumentListImpl import org.jetbrains.kotlin.fir.types.impl.FirTypePlaceholderProjection import org.jetbrains.kotlin.lexer.KtTokens.* import org.jetbrains.kotlin.name.ClassId @@ -1225,14 +1227,19 @@ class RawFirBuilder( this.source = source isMarkedNullable = isNullable var ktQualifier: KtUserType? = unwrappedElement + do { - val firQualifier = FirQualifierPartImpl(referenceExpression!!.getReferencedNameAsName()) - for (typeArgument in ktQualifier!!.typeArguments) { - firQualifier.typeArguments += typeArgument.convert() - } + val firQualifier = FirQualifierPartImpl( + referenceExpression!!.getReferencedNameAsName(), + FirTypeArgumentListImpl(source).apply { + for (typeArgument in ktQualifier!!.typeArguments) { + typeArguments += typeArgument.convert() + } + } + ) qualifier.add(firQualifier) - ktQualifier = ktQualifier.qualifier + ktQualifier = ktQualifier!!.qualifier referenceExpression = ktQualifier?.referenceExpression } while (referenceExpression != null) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/deserialization/AbstractAnnotationDeserializer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/deserialization/AbstractAnnotationDeserializer.kt index 00e8a1b07c2..629cf2d6047 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/deserialization/AbstractAnnotationDeserializer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/deserialization/AbstractAnnotationDeserializer.kt @@ -192,7 +192,7 @@ abstract class AbstractAnnotationDeserializer( return buildAnnotationCall { annotationTypeRef = symbol?.let { buildResolvedTypeRef { - type = it.constructType(emptyList(), isNullable = false) + type = it.constructType(emptyArray(), isNullable = false) } } ?: buildErrorTypeRef { diagnostic = ConeUnresolvedSymbolError(classId) } argumentList = buildArgumentList { diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/deserialization/FirTypeDeserializer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/deserialization/FirTypeDeserializer.kt index 7f591640b4e..b5b904d7c1a 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/deserialization/FirTypeDeserializer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/deserialization/FirTypeDeserializer.kt @@ -9,9 +9,9 @@ import org.jetbrains.kotlin.builtins.functions.FunctionClassDescriptor import org.jetbrains.kotlin.fir.FirSession import org.jetbrains.kotlin.fir.declarations.FirDeclarationOrigin import org.jetbrains.kotlin.fir.declarations.FirTypeParameterRefsOwner -import org.jetbrains.kotlin.fir.declarations.FirTypeParametersOwner import org.jetbrains.kotlin.fir.declarations.addDefaultBoundIfNecessary import org.jetbrains.kotlin.fir.declarations.builder.FirTypeParameterBuilder +import org.jetbrains.kotlin.fir.diagnostics.ConeSimpleDiagnostic import org.jetbrains.kotlin.fir.resolve.toSymbol import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.firUnsafe import org.jetbrains.kotlin.fir.symbols.ConeClassLikeLookupTag @@ -104,7 +104,7 @@ class FirTypeDeserializer( //c.components.flexibleTypeDeserializer.create(proto, id, lowerBound, upperBound) } - return simpleType(proto, attributes) ?: ConeKotlinErrorType("?!id:0") + return simpleType(proto, attributes) ?: ConeKotlinErrorType(ConeSimpleDiagnostic("?!id:0")) } private fun typeParameterSymbol(typeParameterId: Int): ConeTypeParameterLookupTag? = @@ -203,7 +203,9 @@ class FirTypeDeserializer( } else -> null } - return result ?: ConeClassErrorType("Bad suspend function in metadata with constructor: $functionTypeConstructor") + return result ?: ConeClassErrorType( + ConeSimpleDiagnostic("Bad suspend function in metadata with constructor: $functionTypeConstructor") + ) } private fun typeSymbol(proto: ProtoBuf.Type): ConeClassifierLookupTag? { @@ -227,7 +229,8 @@ class FirTypeDeserializer( } val variance = ProtoEnumFlags.variance(typeArgumentProto.projection) - val type = typeArgumentProto.type(typeTable) ?: return ConeKotlinErrorType("No type recorded") + val type = typeArgumentProto.type(typeTable) + ?: return ConeKotlinErrorType(ConeSimpleDiagnostic("No type recorded")) // TODO: check that here we don't have any attributes val coneType = type(type, ConeAttributes.Empty) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/ResolveUtils.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/ResolveUtils.kt index 9a86f76dcc6..8c907da8339 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/ResolveUtils.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/ResolveUtils.kt @@ -10,12 +10,14 @@ import org.jetbrains.kotlin.builtins.functions.FunctionClassDescriptor import org.jetbrains.kotlin.descriptors.ClassKind import org.jetbrains.kotlin.fir.* import org.jetbrains.kotlin.fir.declarations.* +import org.jetbrains.kotlin.fir.diagnostics.ConeIntermediateDiagnostic +import org.jetbrains.kotlin.fir.diagnostics.ConeSimpleDiagnostic import org.jetbrains.kotlin.fir.diagnostics.ConeStubDiagnostic +import org.jetbrains.kotlin.fir.diagnostics.ConeUnexpectedTypeArgumentsError import org.jetbrains.kotlin.fir.expressions.* import org.jetbrains.kotlin.fir.expressions.builder.FirResolvedReifiedParameterReferenceBuilder import org.jetbrains.kotlin.fir.expressions.builder.buildExpressionWithSmartcast import org.jetbrains.kotlin.fir.expressions.builder.buildResolvedQualifier -import org.jetbrains.kotlin.fir.typeContext import org.jetbrains.kotlin.fir.references.FirErrorNamedReference import org.jetbrains.kotlin.fir.references.FirResolvedNamedReference import org.jetbrains.kotlin.fir.references.FirSuperReference @@ -26,10 +28,8 @@ import org.jetbrains.kotlin.fir.resolve.calls.ImplicitDispatchReceiverValue import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeUnresolvedNameError import org.jetbrains.kotlin.fir.resolve.providers.FirProvider import org.jetbrains.kotlin.fir.resolve.providers.FirSymbolProvider -import org.jetbrains.kotlin.fir.resolve.providers.bindSymbolToLookupTag import org.jetbrains.kotlin.fir.resolve.providers.getSymbolByTypeRef import org.jetbrains.kotlin.fir.resolve.substitution.AbstractConeSubstitutor -import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.resultType import org.jetbrains.kotlin.fir.scopes.impl.FirDeclaredMemberScopeProvider import org.jetbrains.kotlin.fir.scopes.impl.withReplacedConeType @@ -176,7 +176,14 @@ fun FirClassifierSymbol<*>.constructType( ConeTypeParameterTypeImpl(this.toLookupTag(), isNullable, attributes) } is FirClassSymbol -> { - ConeClassLikeTypeImpl(this.toLookupTag(), typeArguments, isNullable, attributes) + val errorTypeRef = typeArguments.find { + it is ConeClassErrorType + } + if (errorTypeRef is ConeClassErrorType) { + ConeClassErrorType(errorTypeRef.diagnostic) + } else { + ConeClassLikeTypeImpl(this.toLookupTag(), typeArguments, isNullable, attributes) + } } is FirTypeAliasSymbol -> { ConeClassLikeTypeImpl( @@ -190,11 +197,8 @@ fun FirClassifierSymbol<*>.constructType( } } -fun FirClassifierSymbol<*>.constructType(parts: List, isNullable: Boolean): ConeKotlinType = - constructType(parts.toTypeProjections(), isNullable) - fun List.toTypeProjections(): Array = - asReversed().flatMap { it.typeArguments.map { typeArgument -> typeArgument.toConeTypeProjection() } }.toTypedArray() + asReversed().flatMap { it.typeArgumentList.typeArguments.map { typeArgument -> typeArgument.toConeTypeProjection() } }.toTypedArray() fun FirFunction<*>.constructFunctionalTypeRef(isSuspend: Boolean = false): FirResolvedTypeRef { val receiverTypeRef = when (this) { @@ -203,7 +207,7 @@ fun FirFunction<*>.constructFunctionalTypeRef(isSuspend: Boolean = false): FirRe else -> null } val parameters = valueParameters.map { - it.returnTypeRef.coneTypeSafe() ?: ConeKotlinErrorType("No type for parameter") + it.returnTypeRef.coneTypeSafe() ?: ConeKotlinErrorType(ConeSimpleDiagnostic("No type for parameter")) } val rawReturnType = (this as FirTypedDeclaration).returnTypeRef.coneType @@ -327,7 +331,7 @@ fun BodyResolveComponents.typeFromCallee(access: T): FirReso val implicitReceiver = implicitReceiverStack[labelName] buildResolvedTypeRef { source = null - type = implicitReceiver?.type ?: ConeKotlinErrorType("Unresolved this@$labelName") + type = implicitReceiver?.type ?: ConeKotlinErrorType(ConeSimpleDiagnostic("Unresolved this@$labelName")) } } is FirSuperReference -> { diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/SamResolution.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/SamResolution.kt index 9e755784f8a..612e15e6959 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/SamResolution.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/SamResolution.kt @@ -14,6 +14,7 @@ import org.jetbrains.kotlin.fir.declarations.builder.FirTypeParameterBuilder import org.jetbrains.kotlin.fir.declarations.builder.buildSimpleFunction import org.jetbrains.kotlin.fir.declarations.builder.buildValueParameter import org.jetbrains.kotlin.fir.declarations.impl.FirDeclarationStatusImpl +import org.jetbrains.kotlin.fir.diagnostics.ConeIntermediateDiagnostic import org.jetbrains.kotlin.fir.typeContext import org.jetbrains.kotlin.fir.resolve.calls.FirSyntheticFunctionSymbol import org.jetbrains.kotlin.fir.resolve.substitution.substitutorByMap @@ -348,7 +349,7 @@ private val PUBLIC_METHOD_NAMES_IN_OBJECT = setOf("equals", "hashCode", "getClas private fun FirSimpleFunction.getFunctionTypeForAbstractMethod(): ConeLookupTagBasedType { val parameterTypes = valueParameters.map { - it.returnTypeRef.coneTypeSafe() ?: ConeKotlinErrorType("No type for parameter $it") + it.returnTypeRef.coneTypeSafe() ?: ConeKotlinErrorType(ConeIntermediateDiagnostic("No type for parameter $it")) } return createFunctionalType( diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/FirReceivers.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/FirReceivers.kt index aeb6376ccc6..cafa415e25e 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/FirReceivers.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/FirReceivers.kt @@ -6,6 +6,7 @@ package org.jetbrains.kotlin.fir.resolve.calls import org.jetbrains.kotlin.fir.FirSession +import org.jetbrains.kotlin.fir.diagnostics.ConeIntermediateDiagnostic import org.jetbrains.kotlin.fir.expressions.FirExpression import org.jetbrains.kotlin.fir.expressions.FirThisReceiverExpression import org.jetbrains.kotlin.fir.expressions.builder.buildExpressionWithSmartcast @@ -43,7 +44,7 @@ abstract class AbstractExplicitReceiverValue : AbstractExplic override val type: ConeKotlinType // NB: safe cast is necessary here get() = explicitReceiver.typeRef.coneTypeSafe() - ?: ConeKotlinErrorType("No type calculated for: ${explicitReceiver.renderWithType()}") // TODO: assert here + ?: ConeKotlinErrorType(ConeIntermediateDiagnostic("No type calculated for: ${explicitReceiver.renderWithType()}")) // TODO: assert here override val receiverExpression: FirExpression get() = explicitReceiver diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionStages.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionStages.kt index be69797c4ad..ebba441d570 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionStages.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionStages.kt @@ -8,6 +8,7 @@ package org.jetbrains.kotlin.fir.resolve.calls import org.jetbrains.kotlin.descriptors.Visibilities import org.jetbrains.kotlin.fir.FirSession import org.jetbrains.kotlin.fir.declarations.* +import org.jetbrains.kotlin.fir.diagnostics.ConeSimpleDiagnostic import org.jetbrains.kotlin.fir.expressions.FirExpression import org.jetbrains.kotlin.fir.expressions.FirQualifiedAccessExpression import org.jetbrains.kotlin.fir.expressions.FirResolvedQualifier @@ -235,7 +236,7 @@ internal object CheckCallableReferenceExpectedType : CheckerStage() { expectedReturnType = extractInputOutputTypesFromCallableReferenceExpectedType(expectedType, callInfo.session)?.outputType ) is FirVariable<*> -> createKPropertyType(fir, resultingReceiverType, returnTypeRef) - else -> ConeKotlinErrorType("Unknown callable kind: ${fir::class}") + else -> ConeKotlinErrorType(ConeSimpleDiagnostic("Unknown callable kind: ${fir::class}")) }.let(candidate.substitutor::substituteOrSelf) candidate.resultingTypeForCallableReference = resultingType diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/InferenceComponents.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/InferenceComponents.kt index 3f57aef502c..68a494e041e 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/InferenceComponents.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/InferenceComponents.kt @@ -7,6 +7,7 @@ package org.jetbrains.kotlin.fir.resolve.inference import org.jetbrains.kotlin.fir.FirSession import org.jetbrains.kotlin.fir.PrivateForInline +import org.jetbrains.kotlin.fir.diagnostics.ConeIntermediateDiagnostic import org.jetbrains.kotlin.fir.resolve.ScopeSession import org.jetbrains.kotlin.fir.resolve.transformers.ReturnTypeCalculator import org.jetbrains.kotlin.fir.types.ConeClassErrorType @@ -28,7 +29,7 @@ class InferenceComponents( ) { val approximator: AbstractTypeApproximator = object : AbstractTypeApproximator(ctx) { override fun createErrorType(message: String): SimpleTypeMarker { - return ConeClassErrorType(message) + return ConeClassErrorType(ConeIntermediateDiagnostic(message)) } } val trivialConstraintTypeInferenceOracle = TrivialConstraintTypeInferenceOracle.create(ctx) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/providers/impl/FirTypeResolverImpl.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/providers/impl/FirTypeResolverImpl.kt index e3ed44807d6..0a77c86220f 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/providers/impl/FirTypeResolverImpl.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/providers/impl/FirTypeResolverImpl.kt @@ -7,6 +7,9 @@ package org.jetbrains.kotlin.fir.resolve.providers.impl import org.jetbrains.kotlin.builtins.KotlinBuiltIns import org.jetbrains.kotlin.fir.FirSession +import org.jetbrains.kotlin.fir.diagnostics.ConeIntermediateDiagnostic +import org.jetbrains.kotlin.fir.diagnostics.ConeSimpleDiagnostic +import org.jetbrains.kotlin.fir.diagnostics.ConeUnexpectedTypeArgumentsError import org.jetbrains.kotlin.fir.render import org.jetbrains.kotlin.fir.resolve.* import org.jetbrains.kotlin.fir.resolve.providers.bindSymbolToLookupTag @@ -91,7 +94,16 @@ class FirTypeResolverImpl(private val session: FirSession) : FirTypeResolver { areBareTypesAllowed: Boolean ): ConeKotlinType { if (symbol == null) { - return ConeKotlinErrorType("Symbol not found, for `${typeRef.render()}`") + return ConeKotlinErrorType(ConeSimpleDiagnostic("Symbol not found, for `${typeRef.render()}`")) + } + if (symbol is FirTypeParameterSymbol) { + for (part in typeRef.qualifier) { + if (part.typeArgumentList.typeArguments.isNotEmpty()) { + return ConeClassErrorType( + ConeUnexpectedTypeArgumentsError("Type arguments not allowed", part.typeArgumentList.source) + ) + } + } } var typeArguments = typeRef.qualifier.toTypeProjections() if (symbol is FirRegularClassSymbol) { @@ -101,11 +113,16 @@ class FirTypeResolverImpl(private val session: FirSession) : FirTypeResolver { val substitutor = substitutor ?: ConeSubstitutor.Empty val n = symbol.fir.typeParameters.size - typeArguments.size if (n < 0) { - typeArguments = (1..symbol.fir.typeParameters.size).map { ConeClassErrorType("Type arguments number mismatch") }.toTypedArray() + typeArguments = (1..symbol.fir.typeParameters.size).map { + ConeClassErrorType( + ConeSimpleDiagnostic("Type arguments number mismatch") + ) + }.toTypedArray() } else { val argumentsFromOuterClassesAndParents = symbol.fir.typeParameters.takeLast(n).map { val type = ConeTypeParameterTypeImpl(ConeTypeParameterLookupTag(it.symbol), isNullable = false) - substitutor.substituteOrNull(type) ?: ConeClassErrorType("Type argument not defined") + substitutor.substituteOrNull(type) + ?: ConeClassErrorType(ConeSimpleDiagnostic("Type argument not defined")) }.toTypedArray() typeArguments += argumentsFromOuterClassesAndParents } @@ -152,7 +169,7 @@ class FirTypeResolverImpl(private val session: FirSession) : FirTypeResolver { } is FirFunctionTypeRef -> createFunctionalType(typeRef) is FirDelegatedTypeRef -> resolveType(typeRef.typeRef, scope, areBareTypesAllowed) - is FirDynamicTypeRef -> ConeKotlinErrorType("Not supported: ${typeRef::class.simpleName}") + is FirDynamicTypeRef -> ConeKotlinErrorType(ConeIntermediateDiagnostic("Not supported: ${typeRef::class.simpleName}")) else -> error("!") } } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirAbstractTreeTransformerWithSuperTypes.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirAbstractTreeTransformerWithSuperTypes.kt index 64719b35b8e..c4f0505cef7 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirAbstractTreeTransformerWithSuperTypes.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirAbstractTreeTransformerWithSuperTypes.kt @@ -10,6 +10,7 @@ import org.jetbrains.kotlin.fir.declarations.FirClass import org.jetbrains.kotlin.fir.declarations.FirMemberDeclaration import org.jetbrains.kotlin.fir.declarations.FirRegularClass import org.jetbrains.kotlin.fir.declarations.FirResolvePhase +import org.jetbrains.kotlin.fir.diagnostics.ConeSimpleDiagnostic import org.jetbrains.kotlin.fir.expressions.FirStatement import org.jetbrains.kotlin.fir.resolve.lookupSuperTypes import org.jetbrains.kotlin.fir.resolve.providers.getNestedClassifierScope @@ -84,7 +85,7 @@ abstract class FirAbstractTreeTransformerWithSuperTypes( fun createSubstitutionForSupertype(superType: ConeLookupTagBasedType, session: FirSession): ConeSubstitutor { val klass = superType.lookupTag.toSymbol(session)?.fir as? FirRegularClass ?: return ConeSubstitutor.Empty val arguments = superType.typeArguments.map { - it as? ConeKotlinType ?: ConeClassErrorType("illegal projection usage") + it as? ConeKotlinType ?: ConeClassErrorType(ConeSimpleDiagnostic("illegal projection usage")) } val mapping = klass.typeParameters.map { it.symbol }.zip(arguments).toMap() return ConeSubstitutorByMap(mapping) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirCallCompletionResultsWriterTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirCallCompletionResultsWriterTransformer.kt index 5a9b94c48a8..c24267ba1a4 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirCallCompletionResultsWriterTransformer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirCallCompletionResultsWriterTransformer.kt @@ -324,7 +324,7 @@ class FirCallCompletionResultsWriterTransformer( val typeRef = argument.typeRef as FirResolvedTypeRef buildTypeProjectionWithVariance { source = argument.source - this.typeRef = typeRef.withReplacedConeType(type) + this.typeRef = if (typeRef.type is ConeClassErrorType) typeRef else typeRef.withReplacedConeType(type) variance = argument.variance } } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirSpecificTypeResolverTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirSpecificTypeResolverTransformer.kt index 9f491d3010a..758c816962f 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirSpecificTypeResolverTransformer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirSpecificTypeResolverTransformer.kt @@ -6,15 +6,19 @@ package org.jetbrains.kotlin.fir.resolve.transformers import org.jetbrains.kotlin.fir.FirSession +import org.jetbrains.kotlin.fir.FirSourceElement import org.jetbrains.kotlin.fir.PrivateForInline import org.jetbrains.kotlin.fir.declarations.FirResolvePhase +import org.jetbrains.kotlin.fir.diagnostics.ConeUnexpectedTypeArgumentsError import org.jetbrains.kotlin.fir.resolve.typeResolver import org.jetbrains.kotlin.fir.scopes.FirScope import org.jetbrains.kotlin.fir.types.* +import org.jetbrains.kotlin.fir.types.builder.buildErrorTypeRef import org.jetbrains.kotlin.fir.types.builder.buildResolvedFunctionTypeRef import org.jetbrains.kotlin.fir.types.builder.buildResolvedTypeRef import org.jetbrains.kotlin.fir.visitors.CompositeTransformResult import org.jetbrains.kotlin.fir.visitors.compose +import org.jetbrains.kotlin.utils.addToStdlib.safeAs class FirSpecificTypeResolverTransformer( override val session: FirSession, @@ -56,11 +60,20 @@ class FirSpecificTypeResolverTransformer( } private fun transformType(typeRef: FirTypeRef, resolvedType: ConeKotlinType): CompositeTransformResult { - return buildResolvedTypeRef { - source = typeRef.source - type = resolvedType.takeIfAcceptable() ?: return typeRef.compose() - annotations += typeRef.annotations - delegatedTypeRef = typeRef + return if (resolvedType !is ConeClassErrorType) { + buildResolvedTypeRef { + source = typeRef.source + type = resolvedType.takeIfAcceptable() ?: return typeRef.compose() + annotations += typeRef.annotations + delegatedTypeRef = typeRef + } + } else { + buildErrorTypeRef { + source = resolvedType.diagnostic.safeAs() + ?.source.safeAs() + ?: typeRef.source + diagnostic = resolvedType.diagnostic + } }.compose() } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirDeclarationsResolveTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirDeclarationsResolveTransformer.kt index 70b559bd3db..69ab2a1c350 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirDeclarationsResolveTransformer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirDeclarationsResolveTransformer.kt @@ -11,6 +11,7 @@ import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.declarations.builder.buildValueParameter import org.jetbrains.kotlin.fir.declarations.impl.FirDefaultPropertyAccessor import org.jetbrains.kotlin.fir.declarations.synthetic.FirSyntheticProperty +import org.jetbrains.kotlin.fir.diagnostics.ConeIntermediateDiagnostic import org.jetbrains.kotlin.fir.diagnostics.ConeSimpleDiagnostic import org.jetbrains.kotlin.fir.diagnostics.DiagnosticKind import org.jetbrains.kotlin.fir.expressions.* @@ -914,7 +915,9 @@ open class FirDeclarationsResolveTransformer(transformer: FirBodyResolveTransfor if (valueParameter.returnTypeRef is FirImplicitTypeRef) { valueParameter.transformReturnTypeRef( StoreType, - valueParameter.returnTypeRef.resolvedTypeFromPrototype(ConeKotlinErrorType("No type for parameter")) + valueParameter.returnTypeRef.resolvedTypeFromPrototype( + ConeKotlinErrorType(ConeSimpleDiagnostic("No type for parameter")) + ) ) } return valueParameter.compose() diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirExpressionsResolveTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirExpressionsResolveTransformer.kt index 4665342b759..f1aee465f37 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirExpressionsResolveTransformer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirExpressionsResolveTransformer.kt @@ -11,6 +11,7 @@ import org.jetbrains.kotlin.fir.* import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.diagnostics.ConeSimpleDiagnostic import org.jetbrains.kotlin.fir.diagnostics.ConeStubDiagnostic +import org.jetbrains.kotlin.fir.diagnostics.ConeIntermediateDiagnostic import org.jetbrains.kotlin.fir.diagnostics.DiagnosticKind import org.jetbrains.kotlin.fir.expressions.* import org.jetbrains.kotlin.fir.expressions.builder.buildErrorExpression @@ -77,7 +78,7 @@ open class FirExpressionsResolveTransformer(transformer: FirBodyResolveTransform callee.replaceBoundSymbol(it) } qualifiedAccessExpression.resultType = buildResolvedTypeRef { - type = implicitReceiver?.type ?: ConeKotlinErrorType("Unresolved this@$labelName") + type = implicitReceiver?.type ?: ConeKotlinErrorType(ConeSimpleDiagnostic("Unresolved this@$labelName")) } qualifiedAccessExpression } @@ -658,7 +659,8 @@ open class FirExpressionsResolveTransformer(transformer: FirBodyResolveTransform private fun FirConstKind<*>.expectedConeType(): ConeKotlinType { fun constructLiteralType(classId: ClassId, isNullable: Boolean = false): ConeKotlinType { - val symbol = symbolProvider.getClassLikeSymbolByFqName(classId) ?: return ConeClassErrorType("Missing stdlib class: $classId") + val symbol = symbolProvider.getClassLikeSymbolByFqName(classId) + ?: return ConeClassErrorType(ConeSimpleDiagnostic("Missing stdlib class: $classId")) return symbol.toLookupTag().constructClassType(emptyArray(), isNullable) } return when (this) { diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/types/ConeInferenceContext.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/types/ConeInferenceContext.kt index ca6f3d03f00..033fc69a237 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/types/ConeInferenceContext.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/types/ConeInferenceContext.kt @@ -5,6 +5,7 @@ package org.jetbrains.kotlin.fir.types +import org.jetbrains.kotlin.fir.diagnostics.ConeIntermediateDiagnostic import org.jetbrains.kotlin.fir.resolve.* import org.jetbrains.kotlin.fir.resolve.calls.NoSubstitutor import org.jetbrains.kotlin.fir.resolve.providers.FirSymbolProvider @@ -327,7 +328,7 @@ interface ConeInferenceContext : TypeSystemInferenceExtensionContext, ConeTypeCo } override fun createErrorTypeWithCustomConstructor(debugName: String, constructor: TypeConstructorMarker): KotlinTypeMarker { - return ConeKotlinErrorType("$debugName c: $constructor") + return ConeKotlinErrorType(ConeIntermediateDiagnostic("$debugName c: $constructor")) } override fun CapturedTypeMarker.captureStatus(): CaptureStatus { @@ -346,7 +347,7 @@ interface ConeInferenceContext : TypeSystemInferenceExtensionContext, ConeTypeCo override fun TypeConstructorMarker.toErrorType(): SimpleTypeMarker { require(this is ErrorTypeConstructor) - return ConeClassErrorType(reason) + return ConeClassErrorType(ConeIntermediateDiagnostic(reason)) } override fun findCommonIntegerLiteralTypesSuperType(explicitSupertypes: List): SimpleTypeMarker? { diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/types/impl/FirErrorTypeRefImpl.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/types/impl/FirErrorTypeRefImpl.kt index 0cf145cf959..112df06909a 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/types/impl/FirErrorTypeRefImpl.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/types/impl/FirErrorTypeRefImpl.kt @@ -24,7 +24,7 @@ internal class FirErrorTypeRefImpl( override val diagnostic: ConeDiagnostic, ) : FirErrorTypeRef() { override val annotations: MutableList = mutableListOf() - override val type: ConeKotlinType = ConeClassErrorType(diagnostic.reason) + override val type: ConeKotlinType = ConeClassErrorType(diagnostic) override val delegatedTypeRef: FirTypeRef? get() = null override val isSuspend: Boolean = false diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirRenderer.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirRenderer.kt index a4b7a3f0715..f960a0b9456 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirRenderer.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirRenderer.kt @@ -871,9 +871,9 @@ class FirRenderer(builder: StringBuilder, private val mode: RenderMode = RenderM print(".") } print(qualifier.name) - if (qualifier.typeArguments.isNotEmpty()) { + if (qualifier.typeArgumentList.typeArguments.isNotEmpty()) { print("<") - qualifier.typeArguments.renderSeparated() + qualifier.typeArgumentList.typeArguments.renderSeparated() print(">") } } diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/diagnostics/CommonDiagnostics.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/diagnostics/CommonDiagnostics.kt new file mode 100644 index 00000000000..f8cbd715b02 --- /dev/null +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/diagnostics/CommonDiagnostics.kt @@ -0,0 +1,10 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.fir.diagnostics + +class ConeUnexpectedTypeArgumentsError(override val reason: String, val source: Any? = null) : ConeDiagnostic() + +class ConeIntermediateDiagnostic(override val reason: String) : ConeDiagnostic() diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/symbols/impl/FirVariableSymbol.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/symbols/impl/FirVariableSymbol.kt index cf875732418..365f1d54c50 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/symbols/impl/FirVariableSymbol.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/symbols/impl/FirVariableSymbol.kt @@ -12,7 +12,6 @@ import org.jetbrains.kotlin.fir.declarations.FirVariable import org.jetbrains.kotlin.fir.diagnostics.ConeDiagnostic import org.jetbrains.kotlin.fir.expressions.FirExpression import org.jetbrains.kotlin.fir.symbols.CallableId -import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.Name diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/types/FirQualifierPart.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/types/FirQualifierPart.kt index 508e1a4e846..c8c51fd9e19 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/types/FirQualifierPart.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/types/FirQualifierPart.kt @@ -5,9 +5,15 @@ package org.jetbrains.kotlin.fir.types +import org.jetbrains.kotlin.fir.FirSourceElement import org.jetbrains.kotlin.name.Name +interface FirTypeArgumentList { + val source: FirSourceElement + val typeArguments: List +} + interface FirQualifierPart { val name: Name - val typeArguments: List + val typeArgumentList: FirTypeArgumentList } \ No newline at end of file diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/types/impl/FirQualifierPartImpl.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/types/impl/FirQualifierPartImpl.kt index c1c0723432c..ad233384167 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/types/impl/FirQualifierPartImpl.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/types/impl/FirQualifierPartImpl.kt @@ -5,10 +5,14 @@ package org.jetbrains.kotlin.fir.types.impl +import org.jetbrains.kotlin.fir.FirSourceElement import org.jetbrains.kotlin.fir.types.FirQualifierPart +import org.jetbrains.kotlin.fir.types.FirTypeArgumentList import org.jetbrains.kotlin.fir.types.FirTypeProjection import org.jetbrains.kotlin.name.Name -class FirQualifierPartImpl(override val name: Name) : FirQualifierPart { +class FirTypeArgumentListImpl(override val source: FirSourceElement) : FirTypeArgumentList { override val typeArguments = mutableListOf() -} \ No newline at end of file +} + +class FirQualifierPartImpl(override val name: Name, override val typeArgumentList: FirTypeArgumentList) : FirQualifierPart \ No newline at end of file diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/types/impl/FirUserTypeRefImpl.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/types/impl/FirUserTypeRefImpl.kt index 601df3e4c2e..3479d2782ad 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/types/impl/FirUserTypeRefImpl.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/types/impl/FirUserTypeRefImpl.kt @@ -24,14 +24,14 @@ open class FirUserTypeRefImpl( override fun acceptChildren(visitor: FirVisitor, data: D) { for (part in qualifier) { - part.typeArguments.forEach { it.accept(visitor, data) } + part.typeArgumentList.typeArguments.forEach { it.accept(visitor, data) } } annotations.forEach { it.accept(visitor, data) } } override fun transformChildren(transformer: FirTransformer, data: D): FirUserTypeRefImpl { for (part in qualifier) { - (part.typeArguments as MutableList).transformInplace(transformer, data) + (part.typeArgumentList.typeArguments as MutableList).transformInplace(transformer, data) } transformAnnotations(transformer, data) return this diff --git a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/ImplementationConfigurator.kt b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/ImplementationConfigurator.kt index 0f83d59d33d..0c3015caa63 100644 --- a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/ImplementationConfigurator.kt +++ b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/ImplementationConfigurator.kt @@ -147,7 +147,7 @@ object ImplementationConfigurator : AbstractFirTreeImplementationConfigurator() } val errorTypeRefImpl = impl(errorTypeRef) { - default("type", "ConeClassErrorType(diagnostic.reason)") + default("type", "ConeClassErrorType(diagnostic)") default("delegatedTypeRef") { value = "null" withGetter = true diff --git a/compiler/testData/diagnostics/tests/EnumEntryAsType.fir.kt b/compiler/testData/diagnostics/tests/EnumEntryAsType.fir.kt index 17172e59b82..b565259e877 100644 --- a/compiler/testData/diagnostics/tests/EnumEntryAsType.fir.kt +++ b/compiler/testData/diagnostics/tests/EnumEntryAsType.fir.kt @@ -3,53 +3,53 @@ enum class Color { RED { - fun simpleName(): RED = null!! + fun RED> simpleName(): RED = null!! } } -class MyColor(val x: Color.RED, y: Color.RED) : Color.RED { +class MyColor(val x: Color.RED, y: Color.RED) : Color.RED { - var z: Color.RED = Color.RED + var z: Color.RED = Color.RED set(arg: Color.RED) { z = arg } - fun foo(arg: Color.RED): Color.RED = arg + fun foo(arg: Color.RED): Color.RED = arg - fun bar(): Color.RED { - class Local : Color.RED - fun local(arg: Color.RED): Color.RED = arg - val temp: Color.RED = Color.RED - temp as? Color.RED - if (temp is Color.RED) { - return temp as Color.RED + fun bar(): Color.RED { + class Local : Color.RED + fun local(arg: Color.RED): Color.RED = arg + val temp: Color.RED = Color.RED + temp as? Color.RED + if (temp is Color.RED) { + return temp as Color.RED } - val obj = object : Color.RED {} - if (obj is Color.RED) { + val obj = object : Color.RED {} + if (obj is Color.RED) { return obj } return Color.RED } } -fun create(): Array? = null +fun create(): Array? = null -interface Your +interface YourColor.RED> -class His : Your +class His : Your -fun otherCreate(): Array? = null +fun Color.RED> otherCreate(): Array? = null -typealias RedAlias = Color.RED +typealias RedAlias = Color.RED -typealias ArrayOfEnumEntry = Array +typealias ArrayOfEnumEntry = Array typealias ArrayOfEnumEntryAlias = Array fun bar(a: Any): T = a as T fun foo() { - foo() + foo<Color.RED>() foo() bar(Color.RED) } -fun Array.foo(entries: Array): Array = null!! \ No newline at end of file +fun Array.foo(entries: Array): Array = null!! \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/LocalClassAndShortSubpackageNames.fir.kt b/compiler/testData/diagnostics/tests/LocalClassAndShortSubpackageNames.fir.kt index cf97ae1f74a..d0782f54f32 100644 --- a/compiler/testData/diagnostics/tests/LocalClassAndShortSubpackageNames.fir.kt +++ b/compiler/testData/diagnostics/tests/LocalClassAndShortSubpackageNames.fir.kt @@ -9,7 +9,7 @@ package foo fun f() { class Local1 { - fun g() : bar.X? = null + fun g() : bar.X? = null } class Local2 { fun g() : foo.bar.X? = null diff --git a/compiler/testData/diagnostics/tests/MultipleBounds.fir.kt b/compiler/testData/diagnostics/tests/MultipleBounds.fir.kt index f614ee902c9..4611bc8e25a 100644 --- a/compiler/testData/diagnostics/tests/MultipleBounds.fir.kt +++ b/compiler/testData/diagnostics/tests/MultipleBounds.fir.kt @@ -45,7 +45,7 @@ class Foo() {} class Bar -class Buzz where T : Bar, T : nioho +class Buzz where T : Bar, T : nioho class X class Y where T : Foo, T : Bar diff --git a/compiler/testData/diagnostics/tests/PackageInTypePosition.fir.kt b/compiler/testData/diagnostics/tests/PackageInTypePosition.fir.kt index 4969f3b9ee1..2233cadbdee 100644 --- a/compiler/testData/diagnostics/tests/PackageInTypePosition.fir.kt +++ b/compiler/testData/diagnostics/tests/PackageInTypePosition.fir.kt @@ -6,4 +6,4 @@ package foo // FILE: b.kt -@foo fun bar(p: foo): foo = null!! \ No newline at end of file +@foo fun bar(p: foo): foo = null!! \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/PackageQualified.fir.kt b/compiler/testData/diagnostics/tests/PackageQualified.fir.kt index 16faade22a4..7c99db7eb3a 100644 --- a/compiler/testData/diagnostics/tests/PackageQualified.fir.kt +++ b/compiler/testData/diagnostics/tests/PackageQualified.fir.kt @@ -6,14 +6,14 @@ package foobar.a import java.* val a : java.util.List? = null - val a2 : util.List? = null - val a3 : LinkedList? = null + val a2 : util.List? = null + val a3 : LinkedList? = null // FILE: b.kt package foobar abstract class Foo() { - abstract val x : T + abstract val x : T } // FILE: b.kt @@ -21,7 +21,7 @@ package foobar.a import java.util.* val b : List? = a - val b1 : util.List? = a + val b1 : util.List? = a // FILE: b.kt package foobar diff --git a/compiler/testData/diagnostics/tests/ResolveToJava.fir.kt b/compiler/testData/diagnostics/tests/ResolveToJava.fir.kt index 223ad431198..d8af20c4f8b 100644 --- a/compiler/testData/diagnostics/tests/ResolveToJava.fir.kt +++ b/compiler/testData/diagnostics/tests/ResolveToJava.fir.kt @@ -15,10 +15,10 @@ import java.lang.Comparable as Com val l : MutableList = ArrayList() fun test(l : java.util.List) { - val x : java.List + val x : java.List val y : java.util.List val b : java.lang.Object - val z : java.utils.List + val z : java.utils.List val f : java.io.File? = null diff --git a/compiler/testData/diagnostics/tests/Unresolved.fir.kt b/compiler/testData/diagnostics/tests/Unresolved.fir.kt index d4133613353..c35692ac67c 100644 --- a/compiler/testData/diagnostics/tests/Unresolved.fir.kt +++ b/compiler/testData/diagnostics/tests/Unresolved.fir.kt @@ -3,8 +3,8 @@ package unresolved class Pair(val a: A, val b: B) fun testGenericArgumentsCount() { - val p1: Pair = Pair(2, 2) - val p2: Pair = Pair(2, 2) + val p1: Pair = Pair(2, 2) + val p2: Pair = Pair(2, 2) } fun testUnresolved() { diff --git a/compiler/testData/diagnostics/tests/annotations/AmbigiousAnnotationConstructor.fir.kt b/compiler/testData/diagnostics/tests/annotations/AmbigiousAnnotationConstructor.fir.kt index e2fb989be02..10cf14219e2 100644 --- a/compiler/testData/diagnostics/tests/annotations/AmbigiousAnnotationConstructor.fir.kt +++ b/compiler/testData/diagnostics/tests/annotations/AmbigiousAnnotationConstructor.fir.kt @@ -2,5 +2,5 @@ import java.util.ArrayList @ArrayList(1, 1) fun b() {} -@Xoo(x) fun c() {} +@Xoo(x) fun c() {} @java.lang.Deprecated(x) fun a() {} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/annotations/AnnotationForObject.fir.kt b/compiler/testData/diagnostics/tests/annotations/AnnotationForObject.fir.kt index d775c840fa8..f3ac5821eb6 100644 --- a/compiler/testData/diagnostics/tests/annotations/AnnotationForObject.fir.kt +++ b/compiler/testData/diagnostics/tests/annotations/AnnotationForObject.fir.kt @@ -1,3 +1,3 @@ // Check that there won't be "Rewrite at slice ANNOTATION key" exception - EA-36935 -@someErrorAnnotation object Test { +@someErrorAnnotation object Test { } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/annotations/UnresolvedAnnotationOnObject.fir.kt b/compiler/testData/diagnostics/tests/annotations/UnresolvedAnnotationOnObject.fir.kt index 6d25c741128..c960d92fb4c 100644 --- a/compiler/testData/diagnostics/tests/annotations/UnresolvedAnnotationOnObject.fir.kt +++ b/compiler/testData/diagnostics/tests/annotations/UnresolvedAnnotationOnObject.fir.kt @@ -3,7 +3,7 @@ package test // Checks that there is no rewrite error at ANNOTATION slice because of resolving annotations for object in lazy resolve and resolving // object as property (method tries to resolve annotations too). -@BadAnnotation +@BadAnnotation object SomeObject val some = SomeObject \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/annotations/invalidTypesInAnnotationConstructor.fir.kt b/compiler/testData/diagnostics/tests/annotations/invalidTypesInAnnotationConstructor.fir.kt index ac9b90e906d..76dab2f5243 100644 --- a/compiler/testData/diagnostics/tests/annotations/invalidTypesInAnnotationConstructor.fir.kt +++ b/compiler/testData/diagnostics/tests/annotations/invalidTypesInAnnotationConstructor.fir.kt @@ -34,7 +34,7 @@ annotation class Ann8(val p1: Array, val p4: Array) annotation class Ann9( - val error: Unresolved = Unresolved.VALUE + val error: Unresolved = Unresolved.VALUE ) diff --git a/compiler/testData/diagnostics/tests/annotations/kt1860-negative.fir.kt b/compiler/testData/diagnostics/tests/annotations/kt1860-negative.fir.kt index e19143ff1bd..5384dd184df 100644 --- a/compiler/testData/diagnostics/tests/annotations/kt1860-negative.fir.kt +++ b/compiler/testData/diagnostics/tests/annotations/kt1860-negative.fir.kt @@ -1,10 +1,10 @@ // !WITH_NEW_INFERENCE -fun foo(@varargs f : Int) {} +fun foo(@varargs f : Int) {} var bar : Int = 1 - set(@varargs v) {} + set(@varargs v) {} -val x : (Int) -> Int = {@varargs x : Int -> x} +val x : (Int) -> Int = {@varargs x : Int -> x} -class Hello(@varargs args: Any) { +class Hello(@varargs args: Any) { } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/annotations/unresolvedReferenceRange.fir.kt b/compiler/testData/diagnostics/tests/annotations/unresolvedReferenceRange.fir.kt index 9ef01c335a4..ea387f03efe 100644 --- a/compiler/testData/diagnostics/tests/annotations/unresolvedReferenceRange.fir.kt +++ b/compiler/testData/diagnostics/tests/annotations/unresolvedReferenceRange.fir.kt @@ -1,5 +1,5 @@ -@Ann class A -@Ann class B -@Ann(1) class C -@kotlin.Ann(1) class D -@kotlin.annotation.Ann(1) class E \ No newline at end of file +@Ann class A +@Ann class B +@Ann(1) class C +@kotlin.Ann(1) class D +@kotlin.annotation.Ann(1) class E \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax.fir.kt b/compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax.fir.kt index 0004c530a0d..56ed249b618 100644 --- a/compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax.fir.kt @@ -27,7 +27,7 @@ class Test { fun List.testClassLiteral3() = b::class fun List.testUnresolved1() = unresolved::foo - fun List.testUnresolved2() = a::foo + fun List.testUnresolved2() = a<unresolved>::foo fun List.testUnresolved3() = a<>::foo fun List.testUnresolved4() = unresolved?::foo } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/callableReference/ea81649_errorPropertyLHS.fir.kt b/compiler/testData/diagnostics/tests/callableReference/ea81649_errorPropertyLHS.fir.kt index c477e447579..a949a0b92f1 100644 --- a/compiler/testData/diagnostics/tests/callableReference/ea81649_errorPropertyLHS.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/ea81649_errorPropertyLHS.fir.kt @@ -5,7 +5,7 @@ // MODULE: m1 // FILE: bar.kt -fun bar(ff: Err.() -> Unit) { +fun bar(ff: Err.() -> Unit) { } // MODULE: m2(m1) diff --git a/compiler/testData/diagnostics/tests/callableReference/noExceptionOnRedCodeWithArrayLikeCall.fir.kt b/compiler/testData/diagnostics/tests/callableReference/noExceptionOnRedCodeWithArrayLikeCall.fir.kt index 02ada4d5b93..d159fc7bea3 100644 --- a/compiler/testData/diagnostics/tests/callableReference/noExceptionOnRedCodeWithArrayLikeCall.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/noExceptionOnRedCodeWithArrayLikeCall.fir.kt @@ -2,10 +2,10 @@ class DTO { val q: Int = 0 - operator fun get(prop: KProperty1<*, Int>): Int = 0 + operator fun get(prop: KProperty1<*, Int>): Int = 0 } -fun foo(intDTO: DTO?, p: KProperty1<*, Int>) { +fun foo(intDTO: DTO?, p: KProperty1<*, Int>) { if (intDTO != null) { intDTO[DTO::q] intDTO.q diff --git a/compiler/testData/diagnostics/tests/cast/IsErasedToErrorType.fir.kt b/compiler/testData/diagnostics/tests/cast/IsErasedToErrorType.fir.kt index 21dd6efa00e..3521a70e015 100644 --- a/compiler/testData/diagnostics/tests/cast/IsErasedToErrorType.fir.kt +++ b/compiler/testData/diagnostics/tests/cast/IsErasedToErrorType.fir.kt @@ -1 +1 @@ -fun testing(a: Any) = a is UnresolvedType +fun testing(a: Any) = a is UnresolvedType diff --git a/compiler/testData/diagnostics/tests/cast/bare/ErrorsInSubstitution.fir.kt b/compiler/testData/diagnostics/tests/cast/bare/ErrorsInSubstitution.fir.kt index 08f161ac261..ba73bd8bf95 100644 --- a/compiler/testData/diagnostics/tests/cast/bare/ErrorsInSubstitution.fir.kt +++ b/compiler/testData/diagnostics/tests/cast/bare/ErrorsInSubstitution.fir.kt @@ -3,7 +3,7 @@ interface B interface G: B -fun f(p: B): Any { +fun f(p: B): Any { val v = p as G return checkSubtype>(v) } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/cast/bare/FromErrorType.fir.kt b/compiler/testData/diagnostics/tests/cast/bare/FromErrorType.fir.kt index 671a9ba8318..0beebab158e 100644 --- a/compiler/testData/diagnostics/tests/cast/bare/FromErrorType.fir.kt +++ b/compiler/testData/diagnostics/tests/cast/bare/FromErrorType.fir.kt @@ -2,7 +2,7 @@ class G -fun foo(p: P) { +fun foo(p: P) { val v = p as G? checkSubtype>(v!!) } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/cast/bare/ToErrorType.fir.kt b/compiler/testData/diagnostics/tests/cast/bare/ToErrorType.fir.kt index 9508e3d1fd5..fa1241fd4d2 100644 --- a/compiler/testData/diagnostics/tests/cast/bare/ToErrorType.fir.kt +++ b/compiler/testData/diagnostics/tests/cast/bare/ToErrorType.fir.kt @@ -1,6 +1,6 @@ class P fun foo(p: P): Any { - val v = p as G + val v = p as G return v } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/classLiteral/arrays.fir.kt b/compiler/testData/diagnostics/tests/classLiteral/arrays.fir.kt index 8b87530bb2a..411b895c84c 100644 --- a/compiler/testData/diagnostics/tests/classLiteral/arrays.fir.kt +++ b/compiler/testData/diagnostics/tests/classLiteral/arrays.fir.kt @@ -1,7 +1,7 @@ // !LANGUAGE: +BareArrayClassLiteral val a01 = Array::class -val a02 = Array::class +val a02 = Array<Array>::class val a03 = Array::class val a04 = Array?>::class val a05 = Array::class diff --git a/compiler/testData/diagnostics/tests/classObjects/typeParametersInAnnonymousObject.fir.kt b/compiler/testData/diagnostics/tests/classObjects/typeParametersInAnnonymousObject.fir.kt index 48fd14b7bea..500b19bc6fc 100644 --- a/compiler/testData/diagnostics/tests/classObjects/typeParametersInAnnonymousObject.fir.kt +++ b/compiler/testData/diagnostics/tests/classObjects/typeParametersInAnnonymousObject.fir.kt @@ -15,12 +15,12 @@ fun case_3() { } val x = object> { - fun test() = 10 as T // OK + fun test() = 10 as T // OK } fun case_4() { val x = object { - fun test() = 10 as T + fun test() = 10 as T } val y = x.test() // type y is T diff --git a/compiler/testData/diagnostics/tests/classObjects/typeParametersInAnnonymousObject_after.fir.kt b/compiler/testData/diagnostics/tests/classObjects/typeParametersInAnnonymousObject_after.fir.kt index d6f2b51acda..6dfb2d8eafe 100644 --- a/compiler/testData/diagnostics/tests/classObjects/typeParametersInAnnonymousObject_after.fir.kt +++ b/compiler/testData/diagnostics/tests/classObjects/typeParametersInAnnonymousObject_after.fir.kt @@ -15,12 +15,12 @@ fun case_3() { } val x = object> { - fun test() = 10 as T // OK + fun test() = 10 as T // OK } fun case_4() { val x = object { - fun test() = 10 as T + fun test() = 10 as T } val y = x.test() // type y is T diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/fieldAsClassDelegate.fir.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/fieldAsClassDelegate.fir.kt index d9e888fbb9a..f1b42c6e79b 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/fieldAsClassDelegate.fir.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/fieldAsClassDelegate.fir.kt @@ -23,7 +23,7 @@ object DefaultHttpClientWithFun : HttpClient by fClient() { private fun fClient() = HttpClientImpl() -private fun lazy(init: () -> T): kotlin.Lazy { +private fun lazy(init: () -> T): kotlin.Lazy { init() null!! } diff --git a/compiler/testData/diagnostics/tests/cyclicHierarchy/withCompanion/noMembers_after.fir.kt b/compiler/testData/diagnostics/tests/cyclicHierarchy/withCompanion/noMembers_after.fir.kt index e25e2bfd70f..9eaf38b7ce6 100644 --- a/compiler/testData/diagnostics/tests/cyclicHierarchy/withCompanion/noMembers_after.fir.kt +++ b/compiler/testData/diagnostics/tests/cyclicHierarchy/withCompanion/noMembers_after.fir.kt @@ -9,7 +9,7 @@ public class C { open class Base () - class Foo : Data() + class Foo : Data() companion object : DerivedAbstract() } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/cyclicHierarchy/withCompanion/noMembers_before.fir.kt b/compiler/testData/diagnostics/tests/cyclicHierarchy/withCompanion/noMembers_before.fir.kt index 7f56616a319..0702677a7b5 100644 --- a/compiler/testData/diagnostics/tests/cyclicHierarchy/withCompanion/noMembers_before.fir.kt +++ b/compiler/testData/diagnostics/tests/cyclicHierarchy/withCompanion/noMembers_before.fir.kt @@ -9,7 +9,7 @@ public class C { open class Base () - class Foo : Data() + class Foo : Data() companion object : DerivedAbstract() } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/dataClasses/errorTypesInDataClasses.fir.kt b/compiler/testData/diagnostics/tests/dataClasses/errorTypesInDataClasses.fir.kt index 2d4f2129a41..736df5ef737 100644 --- a/compiler/testData/diagnostics/tests/dataClasses/errorTypesInDataClasses.fir.kt +++ b/compiler/testData/diagnostics/tests/dataClasses/errorTypesInDataClasses.fir.kt @@ -1,6 +1,6 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -data class A(val i: Int, val j: G) -data class B(val i: G, val j: G) +data class A(val i: Int, val j: G) +data class B(val i: G, val j: G) fun fa(a: A) { diff --git a/compiler/testData/diagnostics/tests/declarationChecks/finiteBoundRestriction/CasesWithOneTypeParameter.fir.kt b/compiler/testData/diagnostics/tests/declarationChecks/finiteBoundRestriction/CasesWithOneTypeParameter.fir.kt index 16c6cc9b815..ec0aa21c5a5 100644 --- a/compiler/testData/diagnostics/tests/declarationChecks/finiteBoundRestriction/CasesWithOneTypeParameter.fir.kt +++ b/compiler/testData/diagnostics/tests/declarationChecks/finiteBoundRestriction/CasesWithOneTypeParameter.fir.kt @@ -11,7 +11,7 @@ interface B1> interface AA> interface BB>> -interface A> +interface AList> class X class D>>> \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/declarationChecks/localVariablesWithTypeParameters_1_3.fir.kt b/compiler/testData/diagnostics/tests/declarationChecks/localVariablesWithTypeParameters_1_3.fir.kt index 9e97918528a..cdd2daa3385 100644 --- a/compiler/testData/diagnostics/tests/declarationChecks/localVariablesWithTypeParameters_1_3.fir.kt +++ b/compiler/testData/diagnostics/tests/declarationChecks/localVariablesWithTypeParameters_1_3.fir.kt @@ -11,7 +11,7 @@ fun test() { const val a3 = 0 lateinit val a4 = 0 val a5 by Delegate() - val a6 by Delegate() + val a6 by Delegate<T>() } class Delegate { diff --git a/compiler/testData/diagnostics/tests/declarationChecks/localVariablesWithTypeParameters_1_4.fir.kt b/compiler/testData/diagnostics/tests/declarationChecks/localVariablesWithTypeParameters_1_4.fir.kt index 106619857c6..5ac8f27a0d5 100644 --- a/compiler/testData/diagnostics/tests/declarationChecks/localVariablesWithTypeParameters_1_4.fir.kt +++ b/compiler/testData/diagnostics/tests/declarationChecks/localVariablesWithTypeParameters_1_4.fir.kt @@ -11,7 +11,7 @@ fun test() { const val a3 = 0 lateinit val a4 = 0 val a5 by Delegate() - val a6 by Delegate() + val a6 by Delegate<T>() } class Delegate { diff --git a/compiler/testData/diagnostics/tests/duplicateJvmSignature/functionAndProperty/withErrorTypes.fir.kt b/compiler/testData/diagnostics/tests/duplicateJvmSignature/functionAndProperty/withErrorTypes.fir.kt index 142dfe5fdb2..efd84d48fca 100644 --- a/compiler/testData/diagnostics/tests/duplicateJvmSignature/functionAndProperty/withErrorTypes.fir.kt +++ b/compiler/testData/diagnostics/tests/duplicateJvmSignature/functionAndProperty/withErrorTypes.fir.kt @@ -1,4 +1,4 @@ interface T { - val x: ErrorType - fun getX(): ErrorType1 + val x: ErrorType + fun getX(): ErrorType1 } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/enum/ifEnumEntry.fir.kt b/compiler/testData/diagnostics/tests/enum/ifEnumEntry.fir.kt index 3995bc0e6fc..031b4d647df 100644 --- a/compiler/testData/diagnostics/tests/enum/ifEnumEntry.fir.kt +++ b/compiler/testData/diagnostics/tests/enum/ifEnumEntry.fir.kt @@ -3,4 +3,4 @@ enum class MyEnum { SECOND } -fun foo(me: MyEnum): Boolean = if (me is MyEnum.FIRST) true else false \ No newline at end of file +fun foo(me: MyEnum): Boolean = if (me is MyEnum.FIRST) true else false \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/enum/inheritFromEnumEntry.fir.kt b/compiler/testData/diagnostics/tests/enum/inheritFromEnumEntry.fir.kt index 46f04bf9900..28ca2a055d6 100644 --- a/compiler/testData/diagnostics/tests/enum/inheritFromEnumEntry.fir.kt +++ b/compiler/testData/diagnostics/tests/enum/inheritFromEnumEntry.fir.kt @@ -2,4 +2,4 @@ enum class E { ENTRY } -class A : E.ENTRY +class A : E.ENTRY diff --git a/compiler/testData/diagnostics/tests/enum/isEnumEntry.fir.kt b/compiler/testData/diagnostics/tests/enum/isEnumEntry.fir.kt index 28becfcb3db..5a42423771b 100644 --- a/compiler/testData/diagnostics/tests/enum/isEnumEntry.fir.kt +++ b/compiler/testData/diagnostics/tests/enum/isEnumEntry.fir.kt @@ -3,4 +3,4 @@ enum class MyEnum { SECOND } -fun foo(me: MyEnum): Boolean = me is MyEnum.FIRST \ No newline at end of file +fun foo(me: MyEnum): Boolean = me is MyEnum.FIRST \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/evaluate/inlineClasses/constructorOfUnsignedType.fir.kt b/compiler/testData/diagnostics/tests/evaluate/inlineClasses/constructorOfUnsignedType.fir.kt index efab6641d11..5b019bbfc18 100644 --- a/compiler/testData/diagnostics/tests/evaluate/inlineClasses/constructorOfUnsignedType.fir.kt +++ b/compiler/testData/diagnostics/tests/evaluate/inlineClasses/constructorOfUnsignedType.fir.kt @@ -12,10 +12,10 @@ inline class ULong(private val l: Long) // FILE: test.kt -annotation class AnnoUB(val ub0: UByte, val ub1: UByte) -annotation class AnnoUS(val us0: UShort, val us1: UShort) -annotation class AnnoUI(val ui0: UInt, val ui1: UInt, val ui2: UInt, val ui3: UInt) -annotation class AnnoUL(val ul0: ULong, val ul1: ULong) +annotation class AnnoUB(val ub0: UByte, val ub1: UByte) +annotation class AnnoUS(val us0: UShort, val us1: UShort) +annotation class AnnoUI(val ui0: UInt, val ui1: UInt, val ui2: UInt, val ui3: UInt) +annotation class AnnoUL(val ul0: ULong, val ul1: ULong) const val ub0 = UByte(1) const val us0 = UShort(2) @@ -37,8 +37,8 @@ fun f2() {} @AnnoUL(ul0, ULong(5)) fun f3() {} -const val explicit: UInt = UInt(2) +const val explicit: UInt = UInt(2) -const val nullable: UInt? = UInt(3) +const val nullable: UInt? = UInt(3) -annotation class NullableAnno(val u: UInt?) \ No newline at end of file +annotation class NullableAnno(val u: UInt?) \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/functionAsExpression/WithGenericParameters.fir.kt b/compiler/testData/diagnostics/tests/functionAsExpression/WithGenericParameters.fir.kt index 963a47446f4..a99fcbd3c0f 100644 --- a/compiler/testData/diagnostics/tests/functionAsExpression/WithGenericParameters.fir.kt +++ b/compiler/testData/diagnostics/tests/functionAsExpression/WithGenericParameters.fir.kt @@ -4,10 +4,10 @@ interface A fun devNull(a: Any?){} -val generic_fun = fun(t: T): T = null!! -val extension_generic_fun = funT.(t: T): T = null!! +val generic_fun = fun(t: T): T = null!! +val extension_generic_fun = funT.(t: T): T = null!! -fun fun_with_where() = fun T.(t: T): T where T: A = null!! +fun fun_with_where() = fun T.(t: T): T where T: A = null!! fun outer() { diff --git a/compiler/testData/diagnostics/tests/functionLiterals/assignmentOperationInLambdaWithExpectedType.fir.kt b/compiler/testData/diagnostics/tests/functionLiterals/assignmentOperationInLambdaWithExpectedType.fir.kt index b6362529419..4aa592018aa 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/assignmentOperationInLambdaWithExpectedType.fir.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/assignmentOperationInLambdaWithExpectedType.fir.kt @@ -6,7 +6,7 @@ fun test(bal: Array) { val b: () -> Int = { bar = 4 } - val c: () -> UNRESOLVED = { bal[2] = 3 } + val c: () -> UNRESOLVED = { bal[2] = 3 } val d: () -> Int = { bar += 4 } diff --git a/compiler/testData/diagnostics/tests/generics/RawTypeInIsExpression.fir.kt b/compiler/testData/diagnostics/tests/generics/RawTypeInIsExpression.fir.kt index e106601f1e6..84b651c6558 100644 --- a/compiler/testData/diagnostics/tests/generics/RawTypeInIsExpression.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/RawTypeInIsExpression.fir.kt @@ -1,7 +1,7 @@ package p public fun foo(a: Any) { - a is Map + a is Map a is Map a is Map a is Map<*, *> diff --git a/compiler/testData/diagnostics/tests/generics/RawTypeInIsPattern.fir.kt b/compiler/testData/diagnostics/tests/generics/RawTypeInIsPattern.fir.kt index f76110a228e..d32724f21a9 100644 --- a/compiler/testData/diagnostics/tests/generics/RawTypeInIsPattern.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/RawTypeInIsPattern.fir.kt @@ -1,6 +1,6 @@ -public fun foo(a: Any, b: Map) { +public fun foo(a: Any, b: Map) { when (a) { - is Map -> {} + is Map -> {} is Map -> {} is Map -> {} is Map<*, *> -> {} diff --git a/compiler/testData/diagnostics/tests/generics/argumentsForT.fir.kt b/compiler/testData/diagnostics/tests/generics/argumentsForT.fir.kt index ff8797c74e8..9fd1bf6eac9 100644 --- a/compiler/testData/diagnostics/tests/generics/argumentsForT.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/argumentsForT.fir.kt @@ -1,7 +1,7 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER -fun foo(t: T) {} +fun foo(t: T) {} interface A class B -fun foo1(t: T>) {} \ No newline at end of file +fun foo1(t: T>) {} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/generics/capturedParameters/uncheckedCast.fir.kt b/compiler/testData/diagnostics/tests/generics/capturedParameters/uncheckedCast.fir.kt index 7b382fd4076..d924703b4ef 100644 --- a/compiler/testData/diagnostics/tests/generics/capturedParameters/uncheckedCast.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/capturedParameters/uncheckedCast.fir.kt @@ -18,11 +18,11 @@ fun foo(x: Any, y: Any) : Any { } // bare type - if (y is Outer.Inner) { + if (y is Outer.Inner) { return y } - y as Outer<*>.Inner + y as Outer<*>.Inner return C() } diff --git a/compiler/testData/diagnostics/tests/generics/finalUpperBoundWithoutOverride.fir.kt b/compiler/testData/diagnostics/tests/generics/finalUpperBoundWithoutOverride.fir.kt index e78300647c8..a6da0745c19 100644 --- a/compiler/testData/diagnostics/tests/generics/finalUpperBoundWithoutOverride.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/finalUpperBoundWithoutOverride.fir.kt @@ -51,19 +51,19 @@ interface MessageManager9 : Manager { fun execute4() {} } -object MessageManager10 : Message5() { +object MessageManager10 : Message5() { fun execute() {} } -class MessageManager11 : Message5>() { - fun > execute() {} +class MessageManager11 : Message5>() { + fun Message5> execute() {} } -data class MessageManager12(val x: Int) : Message5() { +data class MessageManager12(val x: Int) : Message5() { fun execute() {} } -sealed class MessageManager13 : Message5() { +sealed class MessageManager13 : Message5() { fun execute() {} } diff --git a/compiler/testData/diagnostics/tests/generics/genericsInType.fir.kt b/compiler/testData/diagnostics/tests/generics/genericsInType.fir.kt index 176fd4ff604..b2510012b35 100644 --- a/compiler/testData/diagnostics/tests/generics/genericsInType.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/genericsInType.fir.kt @@ -29,8 +29,8 @@ fun test() { a.Baz>() } -fun > x() {} +fun Foo> x() {} fun Foo.Bar.ext() {} -fun ex1(a: Foo.Bar): Foo.Bar { +fun ex1(a: Foo.Bar): Foo.Bar { } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromCompanionObject_after.fir.kt b/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromCompanionObject_after.fir.kt index dcc376a304d..04b6b1a6d9a 100644 --- a/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromCompanionObject_after.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromCompanionObject_after.fir.kt @@ -15,7 +15,7 @@ class A { // Does not work, could be Outer.Inner // TODO: Should work? - fun foo(x: Inner) { + fun foo(x: Inner) { // Inner() call use companion as implicit receiver val y: Outer.Inner = Inner() } diff --git a/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromCompanionObject_before.fir.kt b/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromCompanionObject_before.fir.kt index 6a546fe3d55..ac09e49cde3 100644 --- a/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromCompanionObject_before.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromCompanionObject_before.fir.kt @@ -15,7 +15,7 @@ class A { // Does not work, could be Outer.Inner // TODO: Should work? - fun foo(x: Inner) { + fun foo(x: Inner) { // Inner() call use companion as implicit receiver val y: Outer.Inner = Inner() } diff --git a/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClasses.fir.kt b/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClasses.fir.kt index 0f218668cf2..403fff39cdb 100644 --- a/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClasses.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClasses.fir.kt @@ -7,14 +7,14 @@ open class Outer { class Derived : Outer() { fun foo(): Inner = null!! - fun baz(): Alias = null!! + fun baz(): Alias = null!! } class A : Outer() { class B : Outer() { fun bar(): Inner = null!! - fun x(): Alias = null!! + fun x(): Alias = null!! } } diff --git a/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocal.fir.kt b/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocal.fir.kt index bcb0aa6dfa0..24288b90fe2 100644 --- a/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocal.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocal.fir.kt @@ -10,12 +10,12 @@ private fun foobar() = { fun a() = A() } - typealias LocalAlias = A + typealias LocalAlias = A } class Derived : LocalOuter() { fun foo(): LocalInner = null!! - fun bar(): LocalAlias = null!! + fun bar(): LocalAlias = null!! } Derived() @@ -27,12 +27,12 @@ private fun noParameters() = { fun a() = A() } - typealias LocalAlias2 = A + typealias LocalAlias2 = A } class Derived2 : LocalOuter2() { fun foo(): LocalInner2 = null!! - fun bar(): LocalAlias2 = null!! + fun bar(): LocalAlias2 = null!! } Derived2() diff --git a/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocalInsideInner.fir.kt b/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocalInsideInner.fir.kt index 0ac26948940..2c9678e9b4d 100644 --- a/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocalInsideInner.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocalInsideInner.fir.kt @@ -12,12 +12,12 @@ class Outer { fun a() = A() } - typealias LocalAlias = A + typealias LocalAlias = A } class Derived : LocalOuter() { fun foo(): LocalInner = null!! - fun bar(): LocalAlias = null!! + fun bar(): LocalAlias = null!! } Derived() @@ -29,12 +29,12 @@ class Outer { fun a() = A() } - typealias LocalAlias2 = A + typealias LocalAlias2 = A } class Derived2 : LocalOuter2() { fun foo(): LocalInner2 = null!! - fun bar(): LocalAlias2 = null!! + fun bar(): LocalAlias2 = null!! } Derived2() } diff --git a/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesTransitive.fir.kt b/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesTransitive.fir.kt index 1ea8a5ee22e..cd1d366be6a 100644 --- a/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesTransitive.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesTransitive.fir.kt @@ -10,7 +10,7 @@ open class BaseDerived2 : BaseDerived1() class Derived : BaseDerived2() { fun foo(): Inner = null!! - fun baz(): Alias = null!! + fun baz(): Alias = null!! } fun foo() { diff --git a/compiler/testData/diagnostics/tests/generics/innerClasses/importedInner.fir.kt b/compiler/testData/diagnostics/tests/generics/innerClasses/importedInner.fir.kt index 5246f574368..277b1590282 100644 --- a/compiler/testData/diagnostics/tests/generics/innerClasses/importedInner.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/innerClasses/importedInner.fir.kt @@ -17,4 +17,4 @@ class Outer { class E -fun bar(x: Inner) {} +fun bar(x: Inner) {} diff --git a/compiler/testData/diagnostics/tests/generics/innerClasses/outerArgumentsRequired.fir.kt b/compiler/testData/diagnostics/tests/generics/innerClasses/outerArgumentsRequired.fir.kt index a26cddf1a78..e97ffda4092 100644 --- a/compiler/testData/diagnostics/tests/generics/innerClasses/outerArgumentsRequired.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/innerClasses/outerArgumentsRequired.fir.kt @@ -15,9 +15,9 @@ class A { val y: B.C? = null val z: B.D? = null - val c: C? = null - val d: D? = null + val c: C? = null + val d: D? = null - val innerMost: Innermost? = null + val innerMost: Innermost? = null } } diff --git a/compiler/testData/diagnostics/tests/generics/innerClasses/qualifiedOuter.fir.kt b/compiler/testData/diagnostics/tests/generics/innerClasses/qualifiedOuter.fir.kt index e365762a123..d9151f7d797 100644 --- a/compiler/testData/diagnostics/tests/generics/innerClasses/qualifiedOuter.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/innerClasses/qualifiedOuter.fir.kt @@ -4,7 +4,7 @@ class Outer { inner class Inner - fun foo(x: Outer.Inner, y: Outer.Inner, z: Inner) { + fun foo(x: Outer.Inner, y: Outer.Inner, z: Inner) { var inner = Inner() x.checkType { _() } x.checkType { _.Inner>() } diff --git a/compiler/testData/diagnostics/tests/generics/innerClasses/qualifiedTypesResolution.fir.kt b/compiler/testData/diagnostics/tests/generics/innerClasses/qualifiedTypesResolution.fir.kt index b21c57691f4..0886b8195ce 100644 --- a/compiler/testData/diagnostics/tests/generics/innerClasses/qualifiedTypesResolution.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/innerClasses/qualifiedTypesResolution.fir.kt @@ -38,14 +38,14 @@ fun ok4(): Outer.Obj.Nested2.Inner5 = null!! fun ok5(): test.Outer.Obj.Nested2.Inner5 = null!! // All arguments are resolved -fun errorTypeWithArguments(): Q.W.R.M = null!! +fun errorTypeWithArguments(): Q.W.R.M = null!! fun error1(): Outer.Inner.Inner3 = null!! -fun error2(): Outer.Inner.Inner2 = null!! -fun error3(): Outer.Inner.Inner3 = null!! +fun error2(): Outer.Inner.Inner2 = null!! +fun error3(): Outer.Inner.Inner3 = null!! -fun error4(): Outer.Nested.Inner4 = null!! -fun error5(): Outer.Obj.Nested2.Inner5 = null!! -fun error6(): Outer.Obj.Nested2.Inner5 = null!! +fun error4(): Outer.Nested.Inner4 = null!! +fun error5(): Outer.Obj.Nested2.Inner5 = null!! +fun error6(): Outer.Obj.Nested2.Inner5 = null!! -fun error7(): test.Outer.Obj.Nested2.Inner5 = null!! \ No newline at end of file +fun error7(): test.Outer.Obj.Nested2.Inner5 = null!! \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/generics/unresolvedClassifierInWhere.fir.kt b/compiler/testData/diagnostics/tests/generics/unresolvedClassifierInWhere.fir.kt index 1b8f7fe01eb..dff5d7e5efa 100644 --- a/compiler/testData/diagnostics/tests/generics/unresolvedClassifierInWhere.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/unresolvedClassifierInWhere.fir.kt @@ -1,14 +1,14 @@ -interface I0> -interface I1 where T : Unresolved1 -interface I2> where T : Unresolved3 +interface I0Unresolved0> +interface I1 where T : Unresolved1 +interface I2Unresolved2> where T : Unresolved3 -fun > foo0() {} -fun foo1() where E : Unresolved5 {} -fun > foo2() where E : Unresolved7 {} +fun Unresolved4> foo0() {} +fun foo1() where E : Unresolved5 {} +fun Unresolved6> foo2() where E : Unresolved7 {} -val E.p1: Int +val Unresolved7> E.p1: Int get() = 1 -val E.p2: Int where E : Unresolved8 +val E.p2: Int where E : Unresolved8 get() = 1 -val E.p3: Int where E : Unresolved10 +val Unresolved9> E.p3: Int where E : Unresolved10 get() = 1 diff --git a/compiler/testData/diagnostics/tests/imports/ExplicitPackageImportsAmbiguity.fir.kt b/compiler/testData/diagnostics/tests/imports/ExplicitPackageImportsAmbiguity.fir.kt index 770dd1bcc1e..3681822157e 100644 --- a/compiler/testData/diagnostics/tests/imports/ExplicitPackageImportsAmbiguity.fir.kt +++ b/compiler/testData/diagnostics/tests/imports/ExplicitPackageImportsAmbiguity.fir.kt @@ -14,4 +14,4 @@ package c import a.x import b.x -class Y : x.X \ No newline at end of file +class Y : x.X \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/imports/propertyClassFileDependencyRecursion.fir.kt b/compiler/testData/diagnostics/tests/imports/propertyClassFileDependencyRecursion.fir.kt index 92a05929628..4567a1b7efe 100644 --- a/compiler/testData/diagnostics/tests/imports/propertyClassFileDependencyRecursion.fir.kt +++ b/compiler/testData/diagnostics/tests/imports/propertyClassFileDependencyRecursion.fir.kt @@ -4,7 +4,7 @@ package test import other.prop // Note: "prop" is expected to be unresolved and replaced to Any -class PropType: prop +class PropType: prop // Note: this time "prop" should be resolved and type should be inferred for "checkTypeProp" val checkTypeProp = prop diff --git a/compiler/testData/diagnostics/tests/incompleteCode/SupertypeOfErrorType.fir.kt b/compiler/testData/diagnostics/tests/incompleteCode/SupertypeOfErrorType.fir.kt index f821e212a64..7a65c973dea 100644 --- a/compiler/testData/diagnostics/tests/incompleteCode/SupertypeOfErrorType.fir.kt +++ b/compiler/testData/diagnostics/tests/incompleteCode/SupertypeOfErrorType.fir.kt @@ -15,7 +15,7 @@ fun foo() { } } -fun bar(i: Int, a: U) { +fun bar(i: Int, a: U) { val r = if (true) i else a val b: Any = r } diff --git a/compiler/testData/diagnostics/tests/incompleteCode/controlStructuresErrors.fir.kt b/compiler/testData/diagnostics/tests/incompleteCode/controlStructuresErrors.fir.kt index 5b570ea91e8..f39e79c2d34 100644 --- a/compiler/testData/diagnostics/tests/incompleteCode/controlStructuresErrors.fir.kt +++ b/compiler/testData/diagnostics/tests/incompleteCode/controlStructuresErrors.fir.kt @@ -19,7 +19,7 @@ fun test1() { } } -fun test2(l: List) { +fun test2(l: List) { l.map { it!! } diff --git a/compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError/typeReferenceError.fir.kt b/compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError/typeReferenceError.fir.kt index d611ecb41b0..9892136cb06 100644 --- a/compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError/typeReferenceError.fir.kt +++ b/compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError/typeReferenceError.fir.kt @@ -1,3 +1,3 @@ package typeReferenceError -class Pair<:(val c: fun main() \ No newline at end of file +class Pair<:(val c: fun main() \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inference/commonSuperTypeOfErrorTypes.fir.kt b/compiler/testData/diagnostics/tests/inference/commonSuperTypeOfErrorTypes.fir.kt index fd904f52bdd..6c0f29c534a 100644 --- a/compiler/testData/diagnostics/tests/inference/commonSuperTypeOfErrorTypes.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/commonSuperTypeOfErrorTypes.fir.kt @@ -8,14 +8,14 @@ fun consume(x: Foo, y: Foo) {} fun materialize() = null as T fun test() { - consume( - materialize<Foo>>(), - materialize<Foo>>() + consume( + materialize<Foo>>(), + materialize<Foo>>() ) consume( - materialize<Foo>>(), - materialize<Foo>() + materialize<Foo>>(), + materialize<Foo>() ) } diff --git a/compiler/testData/diagnostics/tests/inference/constraints/errorUpperBoundConstraint.fir.kt b/compiler/testData/diagnostics/tests/inference/constraints/errorUpperBoundConstraint.fir.kt index 79934290420..06dfe08ed67 100644 --- a/compiler/testData/diagnostics/tests/inference/constraints/errorUpperBoundConstraint.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/constraints/errorUpperBoundConstraint.fir.kt @@ -19,7 +19,7 @@ public class Foo { // FILE: test.kt -fun test(e: ErrorType) { +fun test(e: ErrorType) { Foo.foo { Sam.Result.create(e) } diff --git a/compiler/testData/diagnostics/tests/inference/kt11963.fir.kt b/compiler/testData/diagnostics/tests/inference/kt11963.fir.kt index e68a9995bba..fa555dbf04d 100644 --- a/compiler/testData/diagnostics/tests/inference/kt11963.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/kt11963.fir.kt @@ -1 +1 @@ -val .something> abc \ No newline at end of file +val KClass.something> abc \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inference/reportingImprovements/cannotInferParameterTypeWithInference.fir.kt b/compiler/testData/diagnostics/tests/inference/reportingImprovements/cannotInferParameterTypeWithInference.fir.kt index 2196201049b..ce72acfd102 100644 --- a/compiler/testData/diagnostics/tests/inference/reportingImprovements/cannotInferParameterTypeWithInference.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/reportingImprovements/cannotInferParameterTypeWithInference.fir.kt @@ -10,7 +10,7 @@ fun test1() { } } -fun bar(f: (A)->Unit) {} +fun bar(f: (A)->Unit) {} fun test2() { bar { a -> } // here we don't have 'cannot infer parameter type' error diff --git a/compiler/testData/diagnostics/tests/inner/accessingToJavaNestedClass.fir.kt b/compiler/testData/diagnostics/tests/inner/accessingToJavaNestedClass.fir.kt index 52727dbaa20..cb24e778266 100644 --- a/compiler/testData/diagnostics/tests/inner/accessingToJavaNestedClass.fir.kt +++ b/compiler/testData/diagnostics/tests/inner/accessingToJavaNestedClass.fir.kt @@ -47,18 +47,18 @@ fun test() { val ic: I.NC = I.NC() val ii: I.NI? = null - val bc: B.NC = B.NC() - val bic: B.IC = B().IC() - val bi: B.NI? = null + val bc: B.NC = B.NC() + val bic: B.IC = B().IC() + val bi: B.NI? = null - val cc: C.NC = C.NC() - val ci: C.NI? = null + val cc: C.NC = C.NC() + val ci: C.NI? = null - val dc: D.NC = D.NC() - val dic: D.IC = D().IC() - val di: D.NI? = null + val dc: D.NC = D.NC() + val dic: D.IC = D().IC() + val di: D.NI? = null - val kc: K.NC = K.NC() - val kic: K.IC = K().IC() - val ki: K.NI? = null + val kc: K.NC = K.NC() + val kic: K.IC = K().IC() + val ki: K.NI? = null } diff --git a/compiler/testData/diagnostics/tests/inner/accessingToKotlinNestedClass.fir.kt b/compiler/testData/diagnostics/tests/inner/accessingToKotlinNestedClass.fir.kt index ca268ade9cc..a1fdb2b5baf 100644 --- a/compiler/testData/diagnostics/tests/inner/accessingToKotlinNestedClass.fir.kt +++ b/compiler/testData/diagnostics/tests/inner/accessingToKotlinNestedClass.fir.kt @@ -31,14 +31,14 @@ fun test() { val ic: I.NC = I.NC() val ii: I.NI? = null - val bc: B.NC = B.NC() - val bic: B.IC = B().IC() - val bi: B.NI? = null + val bc: B.NC = B.NC() + val bic: B.IC = B().IC() + val bi: B.NI? = null - val cc: C.NC = C.NC() - val ci: C.NI? = null + val cc: C.NC = C.NC() + val ci: C.NI? = null - val dc: D.NC = D.NC() - val dic: D.IC = D().IC() - val di: D.NI? = null + val dc: D.NC = D.NC() + val dic: D.IC = D().IC() + val di: D.NI? = null } diff --git a/compiler/testData/diagnostics/tests/inner/deepInnerClass.fir.kt b/compiler/testData/diagnostics/tests/inner/deepInnerClass.fir.kt index 2431bd87d21..f53f5e9484c 100644 --- a/compiler/testData/diagnostics/tests/inner/deepInnerClass.fir.kt +++ b/compiler/testData/diagnostics/tests/inner/deepInnerClass.fir.kt @@ -3,11 +3,11 @@ interface P class A { class B { fun test() { - class C() : P { - companion object : P { + class C() : P { + companion object : P { } - inner class D : P + inner class D : P } } } diff --git a/compiler/testData/diagnostics/tests/j+k/accessClassObjectFromJava.fir.kt b/compiler/testData/diagnostics/tests/j+k/accessClassObjectFromJava.fir.kt index af234b504c3..345b1dfa9a1 100644 --- a/compiler/testData/diagnostics/tests/j+k/accessClassObjectFromJava.fir.kt +++ b/compiler/testData/diagnostics/tests/j+k/accessClassObjectFromJava.fir.kt @@ -2,7 +2,7 @@ class Foo { companion object { val bar = 1 - fun test(a: Foo.`object`) { + fun test(a: Foo.`object`) { } diff --git a/compiler/testData/diagnostics/tests/modifiers/IllegalModifiers.fir.kt b/compiler/testData/diagnostics/tests/modifiers/IllegalModifiers.fir.kt index 4f47b9e219a..c8617fa7164 100644 --- a/compiler/testData/diagnostics/tests/modifiers/IllegalModifiers.fir.kt +++ b/compiler/testData/diagnostics/tests/modifiers/IllegalModifiers.fir.kt @@ -1,4 +1,4 @@ -@myAnnotation public +@myAnnotation public package illegal_modifiers abstract class A() { diff --git a/compiler/testData/diagnostics/tests/objects/kt21515/annotationConstructor.fir.kt b/compiler/testData/diagnostics/tests/objects/kt21515/annotationConstructor.fir.kt index 52c9decb651..8b877fd0ba9 100644 --- a/compiler/testData/diagnostics/tests/objects/kt21515/annotationConstructor.fir.kt +++ b/compiler/testData/diagnostics/tests/objects/kt21515/annotationConstructor.fir.kt @@ -8,6 +8,6 @@ open class Base { class Derived : Base() { - @Foo + @Foo fun foo() = 42 } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/objects/kt21515/classifierFromCompanionObjectNew.fir.kt b/compiler/testData/diagnostics/tests/objects/kt21515/classifierFromCompanionObjectNew.fir.kt index 80326a4b109..f4c55925430 100644 --- a/compiler/testData/diagnostics/tests/objects/kt21515/classifierFromCompanionObjectNew.fir.kt +++ b/compiler/testData/diagnostics/tests/objects/kt21515/classifierFromCompanionObjectNew.fir.kt @@ -72,28 +72,28 @@ class C : O.B() { val n: FromCompanionC? = null // INVISIBLE: direct superclasses themselves. - val a: A? = null - val b: B? = null + val a: A? = null + val b: B? = null // DEPRECATED: Classifiers from companions of direct superclasses - val e: FromCompanionA? = null - val f: FromCompanionB? = null + val e: FromCompanionA? = null + val f: FromCompanionB? = null // INVISIBLE: "cousin" supertypes themselves - val g: Alpha? = null - val h: Beta? = null - val i: Gamma? = null + val g: Alpha? = null + val h: Beta? = null + val i: Gamma? = null // DEPRECATED: classifiers from "cousin" superclasses - val k: FromAlpha? = null - val l: FromBeta? = null - val m: FromGamma? = null + val k: FromAlpha? = null + val l: FromBeta? = null + val m: FromGamma? = null // INVISIBLE: We don't see classifiers from companions of "cousin" superclasses - val o: FromCompanionAlpha? = null - val p: FromCompanionBeta? = null - val q: FromCompanionGamma? = null + val o: FromCompanionAlpha? = null + val p: FromCompanionBeta? = null + val q: FromCompanionGamma? = null // DEPRECATED: Classifiers from supertypes of our own companion - val r: FromDelta? = null + val r: FromDelta? = null } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/objects/kt21515/classifierFromCompanionObjectOld.fir.kt b/compiler/testData/diagnostics/tests/objects/kt21515/classifierFromCompanionObjectOld.fir.kt index f2d2fb0820e..a3ec54538f5 100644 --- a/compiler/testData/diagnostics/tests/objects/kt21515/classifierFromCompanionObjectOld.fir.kt +++ b/compiler/testData/diagnostics/tests/objects/kt21515/classifierFromCompanionObjectOld.fir.kt @@ -71,28 +71,28 @@ class C : O.B() { val n: FromCompanionC? = null // INVISIBLE: direct superclasses themselves. - val a: A? = null - val b: B? = null + val a: A? = null + val b: B? = null // DEPRECATED: Classifiers from companions of direct superclasses - val e: FromCompanionA? = null - val f: FromCompanionB? = null + val e: FromCompanionA? = null + val f: FromCompanionB? = null // INVISIBLE: "cousin" supertypes themselves - val g: Alpha? = null - val h: Beta? = null - val i: Gamma? = null + val g: Alpha? = null + val h: Beta? = null + val i: Gamma? = null // DEPRECATED: classifiers from "cousin" superclasses - val k: FromAlpha? = null - val l: FromBeta? = null - val m: FromGamma? = null + val k: FromAlpha? = null + val l: FromBeta? = null + val m: FromGamma? = null // INVISIBLE: We don't see classifiers from companions of "cousin" superclasses - val o: FromCompanionAlpha? = null - val p: FromCompanionBeta? = null - val q: FromCompanionGamma? = null + val o: FromCompanionAlpha? = null + val p: FromCompanionBeta? = null + val q: FromCompanionGamma? = null // DEPRECATED: Classifiers from supertypes of our own companion - val r: FromDelta? = null + val r: FromDelta? = null } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/objects/kt21515/inheritedFromDeprecatedNew.fir.kt b/compiler/testData/diagnostics/tests/objects/kt21515/inheritedFromDeprecatedNew.fir.kt index 118f24674a3..35e04b77e2d 100644 --- a/compiler/testData/diagnostics/tests/objects/kt21515/inheritedFromDeprecatedNew.fir.kt +++ b/compiler/testData/diagnostics/tests/objects/kt21515/inheritedFromDeprecatedNew.fir.kt @@ -73,28 +73,28 @@ open class C : O.B() { open class n : FromCompanionC() // INVISIBLE: direct superclasses themselves. - open class a : A() - open class b : B() + open class a : A() + open class b : B() // DEPRECATED: Classifiers from companions of direct superclasses - open class e : FromCompanionA() - open class f : FromCompanionB() + open class e : FromCompanionA() + open class f : FromCompanionB() // INVISIBLE: "cousin" supertypes themselves - open class g : Alpha() - open class h : Beta() - open class i : Gamma() + open class g : Alpha() + open class h : Beta() + open class i : Gamma() // DEPRECATED: classifiers from "cousin" superclasses - open class k : FromAlpha() - open class l : FromBeta() - open class m : FromGamma() + open class k : FromAlpha() + open class l : FromBeta() + open class m : FromGamma() // INVISIBLE: We don't see classifiers from companions of "cousin" superclasses - open class o : FromCompanionAlpha() - open class p : FromCompanionBeta() - open class q : FromCompanionGamma() + open class o : FromCompanionAlpha() + open class p : FromCompanionBeta() + open class q : FromCompanionGamma() // DEPRECATED: Classifiers from supertypes of our own companion - open class r : FromDelta() + open class r : FromDelta() } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/objects/kt21515/inheritedFromDeprecatedOld.fir.kt b/compiler/testData/diagnostics/tests/objects/kt21515/inheritedFromDeprecatedOld.fir.kt index 99dfc2d318b..52532436fbc 100644 --- a/compiler/testData/diagnostics/tests/objects/kt21515/inheritedFromDeprecatedOld.fir.kt +++ b/compiler/testData/diagnostics/tests/objects/kt21515/inheritedFromDeprecatedOld.fir.kt @@ -73,28 +73,28 @@ open class C : O.B() { open class n : FromCompanionC() // INVISIBLE: direct superclasses themselves. - open class a : A() - open class b : B() + open class a : A() + open class b : B() // DEPRECATED: Classifiers from companions of direct superclasses - open class e : FromCompanionA() - open class f : FromCompanionB() + open class e : FromCompanionA() + open class f : FromCompanionB() // INVISIBLE: "cousin" supertypes themselves - open class g : Alpha() - open class h : Beta() - open class i : Gamma() + open class g : Alpha() + open class h : Beta() + open class i : Gamma() // DEPRECATED: classifiers from "cousin" superclasses - open class k : FromAlpha() - open class l : FromBeta() - open class m : FromGamma() + open class k : FromAlpha() + open class l : FromBeta() + open class m : FromGamma() // INVISIBLE: We don't see classifiers from companions of "cousin" superclasses - open class o : FromCompanionAlpha() - open class p : FromCompanionBeta() - open class q : FromCompanionGamma() + open class o : FromCompanionAlpha() + open class p : FromCompanionBeta() + open class q : FromCompanionGamma() // DEPRECATED: Classifiers from supertypes of our own companion - open class r : FromDelta() + open class r : FromDelta() } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/objects/kt21515/staticsFromJavaNew.fir.kt b/compiler/testData/diagnostics/tests/objects/kt21515/staticsFromJavaNew.fir.kt index 0f496a4ac54..e214f8a5eff 100644 --- a/compiler/testData/diagnostics/tests/objects/kt21515/staticsFromJavaNew.fir.kt +++ b/compiler/testData/diagnostics/tests/objects/kt21515/staticsFromJavaNew.fir.kt @@ -27,7 +27,7 @@ open class Base { } class Derived : Base() { - fun test(javaStaticInTypePosition: Classifier) { + fun test(javaStaticInTypePosition: Classifier) { method() property Classifier() @@ -42,7 +42,7 @@ class Derived : Base() { syntheticProperty = 42 } - class JavaStaticInSupertypeList : Classifier() { + class JavaStaticInSupertypeList : Classifier() { } } diff --git a/compiler/testData/diagnostics/tests/objects/kt21515/staticsFromJavaOld.fir.kt b/compiler/testData/diagnostics/tests/objects/kt21515/staticsFromJavaOld.fir.kt index 3c16005da1b..9e720eb0fed 100644 --- a/compiler/testData/diagnostics/tests/objects/kt21515/staticsFromJavaOld.fir.kt +++ b/compiler/testData/diagnostics/tests/objects/kt21515/staticsFromJavaOld.fir.kt @@ -27,7 +27,7 @@ open class Base { } class Derived : Base() { - fun test(javaStaticInTypePosition: Classifier) { + fun test(javaStaticInTypePosition: Classifier) { method() property Classifier() @@ -42,7 +42,7 @@ class Derived : Base() { syntheticProperty = 42 } - class JavaStaticInSupertypeList : Classifier() { + class JavaStaticInSupertypeList : Classifier() { } } diff --git a/compiler/testData/diagnostics/tests/override/MissingDelegate.fir.kt b/compiler/testData/diagnostics/tests/override/MissingDelegate.fir.kt index fe97c08736a..291c6dfff84 100644 --- a/compiler/testData/diagnostics/tests/override/MissingDelegate.fir.kt +++ b/compiler/testData/diagnostics/tests/override/MissingDelegate.fir.kt @@ -1,3 +1,3 @@ -class C : Base1 by Base2(1) { +class C : Base1 by Base2(1) { fun test() { } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/override/OverrideWithErrors.fir.kt b/compiler/testData/diagnostics/tests/override/OverrideWithErrors.fir.kt index e492c6cfbeb..e7f361f10c8 100644 --- a/compiler/testData/diagnostics/tests/override/OverrideWithErrors.fir.kt +++ b/compiler/testData/diagnostics/tests/override/OverrideWithErrors.fir.kt @@ -1,9 +1,9 @@ package test open class A { - open fun foo(a: E) {} + open fun foo(a: E) {} } class B : A() { - override fun foo(a: E) {} + override fun foo(a: E) {} } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/qualifiedExpression/TypeWithError.fir.kt b/compiler/testData/diagnostics/tests/qualifiedExpression/TypeWithError.fir.kt index 852b5d5c946..76fa1a05831 100644 --- a/compiler/testData/diagnostics/tests/qualifiedExpression/TypeWithError.fir.kt +++ b/compiler/testData/diagnostics/tests/qualifiedExpression/TypeWithError.fir.kt @@ -15,18 +15,18 @@ fun test1(a: A.B.): A.B. { val aa: A.B. = null!! } -fun test2(a: A.e.C): A.e.C { - val aa: A.e.C = null!! +fun test2(a: A.e.C): A.e.C { + val aa: A.e.C = null!! } -fun test3(a: a.A.C): a.A.C { - val aa: a.A.C = null!! +fun test3(a: a.A.C): a.A.C { + val aa: a.A.C = null!! } -fun test4(a: A.B.ee): A.B.ee { - val aa: A.B.ee = null!! +fun test4(a: A.B.ee): A.B.ee { + val aa: A.B.ee = null!! } -fun test5(a: A.ee): A.ee { - val aa: A.ee = null!! +fun test5(a: A.ee): A.ee { + val aa: A.ee = null!! } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/redeclarations/shadowedExtension/extensionOnErrorType.fir.kt b/compiler/testData/diagnostics/tests/redeclarations/shadowedExtension/extensionOnErrorType.fir.kt index 10292f79764..5824c1a9911 100644 --- a/compiler/testData/diagnostics/tests/redeclarations/shadowedExtension/extensionOnErrorType.fir.kt +++ b/compiler/testData/diagnostics/tests/redeclarations/shadowedExtension/extensionOnErrorType.fir.kt @@ -3,5 +3,5 @@ interface G { val bar: Int } -fun G.foo() {} -val G.bar: Int get() = 42 \ No newline at end of file +fun G.foo() {} +val G.bar: Int get() = 42 \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/regressions/ea65509.fir.kt b/compiler/testData/diagnostics/tests/regressions/ea65509.fir.kt index b636cc4d0db..fe1ec979569 100644 --- a/compiler/testData/diagnostics/tests/regressions/ea65509.fir.kt +++ b/compiler/testData/diagnostics/tests/regressions/ea65509.fir.kt @@ -1,5 +1,5 @@ // !DIAGNOSTICS: -FUNCTION_DECLARATION_WITH_NO_NAME class ClassB() { - private inner class ClassC: super.@ClassA() { + private inner class ClassC: super.@ClassA() { } } diff --git a/compiler/testData/diagnostics/tests/regressions/itselfAsUpperBoundLocal.fir.kt b/compiler/testData/diagnostics/tests/regressions/itselfAsUpperBoundLocal.fir.kt index abfb4754be7..bc6664a8ec9 100644 --- a/compiler/testData/diagnostics/tests/regressions/itselfAsUpperBoundLocal.fir.kt +++ b/compiler/testData/diagnostics/tests/regressions/itselfAsUpperBoundLocal.fir.kt @@ -1,5 +1,5 @@ // !WITH_NEW_INFERENCE fun bar() { - fun foo() {} + fun T?> foo() {} foo() } diff --git a/compiler/testData/diagnostics/tests/regressions/kt402.fir.kt b/compiler/testData/diagnostics/tests/regressions/kt402.fir.kt index 9594f32f227..8c4f0e9fe3d 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt402.fir.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt402.fir.kt @@ -1,7 +1,7 @@ package kt402 fun getTypeChecker() : (Any)->Boolean { - { a : Any -> a is T } // reports unsupported + { a : Any -> a is T } // reports unsupported } fun f() : (Any) -> Boolean { return { a : Any -> a is String } diff --git a/compiler/testData/diagnostics/tests/regressions/kt6508.fir.kt b/compiler/testData/diagnostics/tests/regressions/kt6508.fir.kt index 059496b69ea..f04e1d3dab8 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt6508.fir.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt6508.fir.kt @@ -18,7 +18,7 @@ import foo.View //import foo.TextView fun String.gah(view:View ?) { - if (view is TextView) + if (view is TextView) view else TextView() as foo.TextView } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/regressions/kt9620.fir.kt b/compiler/testData/diagnostics/tests/regressions/kt9620.fir.kt index e5c89b2cf7c..83b299cfe75 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt9620.fir.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt9620.fir.kt @@ -1,14 +1,14 @@ // KT-9620 AssertionError in checkBounds -interface E1, D> +interface E1D, D> interface A interface B interface D -interface E2, D<B>> +interface E2D, D<B>> // KT-11354 AE from DescriptorResolver open class L() -class M : L>() +class M : L<C>() diff --git a/compiler/testData/diagnostics/tests/resolve/CycleInTypeArgs.fir.kt b/compiler/testData/diagnostics/tests/resolve/CycleInTypeArgs.fir.kt index d62d8547efd..4010ec60f97 100644 --- a/compiler/testData/diagnostics/tests/resolve/CycleInTypeArgs.fir.kt +++ b/compiler/testData/diagnostics/tests/resolve/CycleInTypeArgs.fir.kt @@ -1,3 +1,3 @@ -class Class1>> +class Class1Class2>> -class Class2>> \ No newline at end of file +class Class2Class1>> \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/scopes/classHeader/classGenericParameters.fir.kt b/compiler/testData/diagnostics/tests/scopes/classHeader/classGenericParameters.fir.kt index b2c9645be50..ea6f18ea862 100644 --- a/compiler/testData/diagnostics/tests/scopes/classHeader/classGenericParameters.fir.kt +++ b/compiler/testData/diagnostics/tests/scopes/classHeader/classGenericParameters.fir.kt @@ -1,6 +1,6 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER -class A { +class ANested, F: Inner, G: Interface> { class Nested @@ -9,7 +9,7 @@ class A { interface Interface } -class B where T : Nested, F: Inner, G: Interface { +class B where T : Nested, F: Inner, G: Interface { class Nested diff --git a/compiler/testData/diagnostics/tests/scopes/classHeader/classParents.fir.kt b/compiler/testData/diagnostics/tests/scopes/classHeader/classParents.fir.kt index a87ecd7dbde..62efb4e9665 100644 --- a/compiler/testData/diagnostics/tests/scopes/classHeader/classParents.fir.kt +++ b/compiler/testData/diagnostics/tests/scopes/classHeader/classParents.fir.kt @@ -2,7 +2,7 @@ interface I -class A(impl: Interface) : Nested(), Interface by impl, Inner, I { +class A(impl: Interface) : Nested(), Interface by impl, Inner, I { class Nested diff --git a/compiler/testData/diagnostics/tests/scopes/classHeader/objectParents.fir.kt b/compiler/testData/diagnostics/tests/scopes/classHeader/objectParents.fir.kt index 006964e0753..5542db1e57c 100644 --- a/compiler/testData/diagnostics/tests/scopes/classHeader/objectParents.fir.kt +++ b/compiler/testData/diagnostics/tests/scopes/classHeader/objectParents.fir.kt @@ -3,7 +3,7 @@ interface I val aImpl: A.Interface get() = null!! -object A : Nested(), Interface by aImpl, I { +object A : Nested(), Interface by aImpl, I { class Nested diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/nestedClassesFromInterface.fir.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/nestedClassesFromInterface.fir.kt index 86803e93c81..425199e54f3 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/nestedClassesFromInterface.fir.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/nestedClassesFromInterface.fir.kt @@ -9,19 +9,19 @@ interface B { } class X: A { - val a: A_ = A_() + val a: A_ = A_() val b: A.A_ = A.A_() companion object { - val a: A_ = A_() + val a: A_ = A_() } } class Y: B { - val a: B_ = B_() + val a: B_ = B_() val b: B.B_ = B.B_() companion object { - val b: B_ = B_() + val b: B_ = B_() } } diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/nestedCompanionClass.fir.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/nestedCompanionClass.fir.kt index 022e9873218..ecf6f1eb430 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/nestedCompanionClass.fir.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/nestedCompanionClass.fir.kt @@ -7,14 +7,14 @@ open class A { } class C: A() { - val b: B = null!! + val b: B = null!! init { B() } object O { - val b: B = null!! + val b: B = null!! init { B() @@ -22,7 +22,7 @@ class C: A() { } class K { - val b: B = null!! + val b: B = null!! init { B() @@ -30,7 +30,7 @@ class C: A() { } inner class I { - val b: B = null!! + val b: B = null!! init { B() diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/nestedFromJava.fir.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/nestedFromJava.fir.kt index c7309cf95d4..8271dcb6922 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/nestedFromJava.fir.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/nestedFromJava.fir.kt @@ -23,7 +23,7 @@ public class C extends B implements A { // FILE: 1.kt class X: A { - val a_s: A_S = null!! + val a_s: A_S = null!! init { A_S() @@ -32,7 +32,7 @@ class X: A { } object xD { - val a_: A_S = null!! + val a_: A_S = null!! init { A_S() @@ -66,7 +66,7 @@ class Y: B() { } class Z: C() { - val a_s: A_S = null!! + val a_s: A_S = null!! val b_: B_ = null!! val b_s: B_S = null!! @@ -77,7 +77,7 @@ class Z: C() { } object X { - val a_s: A_S = null!! + val a_s: A_S = null!! val b_: B_ = null!! val b_s: B_S = null!! diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromContainingClass_after.fir.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromContainingClass_after.fir.kt index 8e5caf4cc7c..cec28c570e2 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromContainingClass_after.fir.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromContainingClass_after.fir.kt @@ -30,7 +30,7 @@ open class A : J() { foo() bar() val a: Int = baz() - val b: T = baz() + val b: T = baz() } } @@ -39,14 +39,14 @@ open class A : J() { foo() bar() val a: Int = baz() - val b: T = baz() + val b: T = baz() } fun test() { foo() bar() val a: Int = baz() - val b: T = baz() + val b: T = baz() } fun bar() {} diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromContainingClass_before.fir.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromContainingClass_before.fir.kt index ba4c3d8f877..5d06c7093b8 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromContainingClass_before.fir.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromContainingClass_before.fir.kt @@ -30,7 +30,7 @@ open class A : J() { foo() bar() val a: Int = baz() - val b: T = baz() + val b: T = baz() } } @@ -39,14 +39,14 @@ open class A : J() { foo() bar() val a: Int = baz() - val b: T = baz() + val b: T = baz() } fun test() { foo() bar() val a: Int = baz() - val b: T = baz() + val b: T = baz() } fun bar() {} diff --git a/compiler/testData/diagnostics/tests/scopes/kt1080.fir.kt b/compiler/testData/diagnostics/tests/scopes/kt1080.fir.kt index 546784bb76e..096aba3959c 100644 --- a/compiler/testData/diagnostics/tests/scopes/kt1080.fir.kt +++ b/compiler/testData/diagnostics/tests/scopes/kt1080.fir.kt @@ -10,7 +10,7 @@ import d import d.Test import b.d -class Some: Test() +class Some: Test() //FILE:b.kt diff --git a/compiler/testData/diagnostics/tests/scopes/kt900.fir.kt b/compiler/testData/diagnostics/tests/scopes/kt900.fir.kt index 8aab758b541..a4895cf04bf 100644 --- a/compiler/testData/diagnostics/tests/scopes/kt900.fir.kt +++ b/compiler/testData/diagnostics/tests/scopes/kt900.fir.kt @@ -4,7 +4,7 @@ package a fun foo() { - val b : B = B() //only B() is unresolved, but in ": B" and "B.foo()" B should also be unresolved + val b : B = B() //only B() is unresolved, but in ": B" and "B.foo()" B should also be unresolved B.foo() P.foo() diff --git a/compiler/testData/diagnostics/tests/smartCasts/localDelegatedPropertyAfter.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/localDelegatedPropertyAfter.fir.kt index 71c37998cfd..1cb3d4a5a2a 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/localDelegatedPropertyAfter.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/localDelegatedPropertyAfter.fir.kt @@ -2,7 +2,7 @@ class AlternatingDelegate { var counter: Int = 0 - operator fun getValue(thisRef: Any?, property: KProperty<*>): Any? = + operator fun getValue(thisRef: Any?, property: KProperty<*>): Any? = if (counter++ % 2 == 0) 42 else "" } diff --git a/compiler/testData/diagnostics/tests/smartCasts/localDelegatedPropertyBefore.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/localDelegatedPropertyBefore.fir.kt index ef0139a1c22..30b73bd37e7 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/localDelegatedPropertyBefore.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/localDelegatedPropertyBefore.fir.kt @@ -2,7 +2,7 @@ class AlternatingDelegate { var counter: Int = 0 - operator fun getValue(thisRef: Any?, property: KProperty<*>): Any? = + operator fun getValue(thisRef: Any?, property: KProperty<*>): Any? = if (counter++ % 2 == 0) 42 else "" } diff --git a/compiler/testData/diagnostics/tests/substitutions/upperBoundsSubstitutionForOverloadResolutionWithErrorTypes.fir.kt b/compiler/testData/diagnostics/tests/substitutions/upperBoundsSubstitutionForOverloadResolutionWithErrorTypes.fir.kt index 89c3f648ab8..0093cea4f43 100644 --- a/compiler/testData/diagnostics/tests/substitutions/upperBoundsSubstitutionForOverloadResolutionWithErrorTypes.fir.kt +++ b/compiler/testData/diagnostics/tests/substitutions/upperBoundsSubstitutionForOverloadResolutionWithErrorTypes.fir.kt @@ -1,7 +1,7 @@ // !WITH_NEW_INFERENCE // !DIAGNOSTICS: -CONFLICTING_JVM_DECLARATIONS -UNUSED_PARAMETER -fun f1(l: List1): T {throw Exception()} // ERROR type here -fun f1(l: List2): T {throw Exception()} // ERROR type here +fun f1(l: List1): T {throw Exception()} // ERROR type here +fun f1(l: List2): T {throw Exception()} // ERROR type here fun f1(c: Collection): T{throw Exception()} fun test(l: List) { diff --git a/compiler/testData/diagnostics/tests/subtyping/kt2744.fir.kt b/compiler/testData/diagnostics/tests/subtyping/kt2744.fir.kt index eb1496c3f65..931df767968 100644 --- a/compiler/testData/diagnostics/tests/subtyping/kt2744.fir.kt +++ b/compiler/testData/diagnostics/tests/subtyping/kt2744.fir.kt @@ -1,3 +1,3 @@ -class X : S +class X : S fun f(l: List) {} diff --git a/compiler/testData/diagnostics/tests/subtyping/kt304.fir.kt b/compiler/testData/diagnostics/tests/subtyping/kt304.fir.kt index aab7fe69d26..23e3d4ddc84 100644 --- a/compiler/testData/diagnostics/tests/subtyping/kt304.fir.kt +++ b/compiler/testData/diagnostics/tests/subtyping/kt304.fir.kt @@ -1,6 +1,6 @@ //KT-304: Resolve supertype reference to class anyway -open class Foo() : Bar() { +open class Foo() : Bar() { } open class Bar() { diff --git a/compiler/testData/diagnostics/tests/subtyping/unresolvedSupertype.fir.kt b/compiler/testData/diagnostics/tests/subtyping/unresolvedSupertype.fir.kt index 077053d4845..747200b11b1 100644 --- a/compiler/testData/diagnostics/tests/subtyping/unresolvedSupertype.fir.kt +++ b/compiler/testData/diagnostics/tests/subtyping/unresolvedSupertype.fir.kt @@ -1,7 +1,7 @@ -interface A1 : B +interface A1 : B -interface A2 : B() +interface A2 : B() -class A3 : B, B +class A3 : B, B -enum class A4 : B +enum class A4 : B diff --git a/compiler/testData/diagnostics/tests/thisAndSuper/Super.fir.kt b/compiler/testData/diagnostics/tests/thisAndSuper/Super.fir.kt index f4a59c31889..3c2c730f68a 100644 --- a/compiler/testData/diagnostics/tests/thisAndSuper/Super.fir.kt +++ b/compiler/testData/diagnostics/tests/thisAndSuper/Super.fir.kt @@ -50,13 +50,13 @@ class CG : G { fun test() { super.foo() // OK super>.foo() // Warning - super>.foo() // Error + super>.foo() // Error super>.foo() // Error } } // The case when no supertype is resolved -class ERROR() : UR { +class ERROR() : UR { fun test() { super.foo() diff --git a/compiler/testData/diagnostics/tests/thisAndSuper/unqualifiedSuper/unqualifiedSuperWithUnresolvedBase.fir.kt b/compiler/testData/diagnostics/tests/thisAndSuper/unqualifiedSuper/unqualifiedSuperWithUnresolvedBase.fir.kt index 655be3d83df..a14f01a25bd 100644 --- a/compiler/testData/diagnostics/tests/thisAndSuper/unqualifiedSuper/unqualifiedSuperWithUnresolvedBase.fir.kt +++ b/compiler/testData/diagnostics/tests/thisAndSuper/unqualifiedSuper/unqualifiedSuperWithUnresolvedBase.fir.kt @@ -21,7 +21,7 @@ interface Interface { get() = 222 } -class ClassDerivedFromUnresolved : Base(), Interface, Unresolved { +class ClassDerivedFromUnresolved : Base(), Interface, Unresolved { override fun foo() {} override fun bar() {} diff --git a/compiler/testData/diagnostics/tests/typealias/capturingTypeParametersFromOuterClass.fir.kt b/compiler/testData/diagnostics/tests/typealias/capturingTypeParametersFromOuterClass.fir.kt index 377d2af6c7d..5063beb7941 100644 --- a/compiler/testData/diagnostics/tests/typealias/capturingTypeParametersFromOuterClass.fir.kt +++ b/compiler/testData/diagnostics/tests/typealias/capturingTypeParametersFromOuterClass.fir.kt @@ -17,13 +17,13 @@ class Outer { fun foo() { class Local { - typealias LTF = List - typealias LTL = List + typealias LTF = List + typealias LTL = List } fun localfun() = object { - typealias LTF = List - typealias LTLF = List + typealias LTF = List + typealias LTLF = List } } diff --git a/compiler/testData/diagnostics/tests/typealias/exposedExpandedType.fir.kt b/compiler/testData/diagnostics/tests/typealias/exposedExpandedType.fir.kt index a7da9744b31..752c8da45eb 100644 --- a/compiler/testData/diagnostics/tests/typealias/exposedExpandedType.fir.kt +++ b/compiler/testData/diagnostics/tests/typealias/exposedExpandedType.fir.kt @@ -19,7 +19,7 @@ class Outer { internal typealias TestProtected3 = Protected private typealias TestProtected4 = Protected typealias TestProtected5 = L - typealias TestProtected6 = L + typealias TestProtected6 = L<TestProtected1> typealias TestInternal1 = Internal protected typealias TestInternal2 = Internal diff --git a/compiler/testData/diagnostics/tests/typealias/inheritedNestedTypeAlias.kt b/compiler/testData/diagnostics/tests/typealias/inheritedNestedTypeAlias.kt index e8236f87a47..d962dbfe289 100644 --- a/compiler/testData/diagnostics/tests/typealias/inheritedNestedTypeAlias.kt +++ b/compiler/testData/diagnostics/tests/typealias/inheritedNestedTypeAlias.kt @@ -16,6 +16,6 @@ class Derived : Base() { val x1: InnerCell = InnerCell(42) val x2: Base.InnerCell = InnerCell(42) - val test1: CT = Cell(42) + val test1: CT = Cell(42) val test2: Base.CT = Cell(42) } diff --git a/compiler/testData/diagnostics/tests/typealias/inhreritedTypeAliasQualifiedByDerivedClass.fir.kt b/compiler/testData/diagnostics/tests/typealias/inhreritedTypeAliasQualifiedByDerivedClass.fir.kt index 3007b87c660..467aa8ce24f 100644 --- a/compiler/testData/diagnostics/tests/typealias/inhreritedTypeAliasQualifiedByDerivedClass.fir.kt +++ b/compiler/testData/diagnostics/tests/typealias/inhreritedTypeAliasQualifiedByDerivedClass.fir.kt @@ -6,8 +6,8 @@ open class Base { class Derived : Base() -fun test(x: Derived.Nested) = x +fun test(x: Derived.Nested) = x -fun Base.testWithImplicitReceiver(x: Nested) { - val y: Nested = x +fun Base.testWithImplicitReceiver(x: Nested) { + val y: Nested = x } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/typealias/innerTypeAliasAsType.fir.kt b/compiler/testData/diagnostics/tests/typealias/innerTypeAliasAsType.fir.kt index 38b340f6a24..7e36f3a46b5 100644 --- a/compiler/testData/diagnostics/tests/typealias/innerTypeAliasAsType.fir.kt +++ b/compiler/testData/diagnostics/tests/typealias/innerTypeAliasAsType.fir.kt @@ -11,12 +11,12 @@ class Outer { typealias InnerAlias = Inner typealias GenericInnerAlias = GenericInner - fun test1(x: NestedAlias) = x - fun test2(x: GenericNestedAlias) = x - fun test3(x: GenericNestedAlias) = x - fun test4(x: InnerAlias) = x - fun test5(x: GenericInnerAlias) = x - fun test6(x: GenericInnerAlias) = x + fun test1(x: NestedAlias) = x + fun test2(x: GenericNestedAlias) = x + fun test3(x: GenericNestedAlias) = x + fun test4(x: InnerAlias) = x + fun test5(x: GenericInnerAlias) = x + fun test6(x: GenericInnerAlias) = x } fun test1(x: Outer.NestedAlias) = x fun test2(x: Outer.NestedAlias) = x diff --git a/compiler/testData/diagnostics/tests/typealias/javaStaticMembersViaTypeAlias.fir.kt b/compiler/testData/diagnostics/tests/typealias/javaStaticMembersViaTypeAlias.fir.kt index 6e37ba13213..f43ca000422 100644 --- a/compiler/testData/diagnostics/tests/typealias/javaStaticMembersViaTypeAlias.fir.kt +++ b/compiler/testData/diagnostics/tests/typealias/javaStaticMembersViaTypeAlias.fir.kt @@ -33,14 +33,14 @@ val seeAlsoDerivedFoo: String = JDerived.foo() // Referencing nested classes via type alias should be prohibited // (in type position and in expression position) -val testNested1: JT.Nested = JT.Nested() -val testNested2: KT.Nested = KT.Nested() -val testNested3: IT.Nested = IT.Nested() -val testInner1: JT.Inner = JT.Inner() -val testInner2: KT.Inner = KT.Inner() -fun testNestedAsTypeArgument1(x: List) {} -fun testNestedAsTypeArgument2(x: List) {} -fun testNestedAsTypeArgument3(x: List) {} -fun testInnerAsTypeArgument1(x: List) {} -fun testInnerAsTypeArgument2(x: List) {} +val testNested1: JT.Nested = JT.Nested() +val testNested2: KT.Nested = KT.Nested() +val testNested3: IT.Nested = IT.Nested() +val testInner1: JT.Inner = JT.Inner() +val testInner2: KT.Inner = KT.Inner() +fun testNestedAsTypeArgument1(x: List) {} +fun testNestedAsTypeArgument2(x: List) {} +fun testNestedAsTypeArgument3(x: List) {} +fun testInnerAsTypeArgument1(x: List) {} +fun testInnerAsTypeArgument2(x: List) {} diff --git a/compiler/testData/diagnostics/tests/typealias/kt14518.fir.kt b/compiler/testData/diagnostics/tests/typealias/kt14518.fir.kt index 8af18fe0e40..d784411d7a2 100644 --- a/compiler/testData/diagnostics/tests/typealias/kt14518.fir.kt +++ b/compiler/testData/diagnostics/tests/typealias/kt14518.fir.kt @@ -5,6 +5,6 @@ class OuterClass { typealias NestedType = NestedClass } -typealias ON1 = OuterClass.NestedClass +typealias ON1 = OuterClass.NestedClass typealias ON2 = OuterClass.NestedType typealias ON3 = OuterClass.NestedType \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/typealias/localTypeAlias.kt b/compiler/testData/diagnostics/tests/typealias/localTypeAlias.kt index b82a38dc66a..639017392be 100644 --- a/compiler/testData/diagnostics/tests/typealias/localTypeAlias.kt +++ b/compiler/testData/diagnostics/tests/typealias/localTypeAlias.kt @@ -6,12 +6,12 @@ fun emptyList(): List = null!! fun foo() { typealias LT = List - val a: LT = emptyList() + val a: LT = emptyList() - fun localFun(): LT { + fun localFun(): LT { typealias LLT = List - val b: LLT = a + val b: LLT = a return b } diff --git a/compiler/testData/diagnostics/tests/typealias/localTypeAliasConstructor.fir.kt b/compiler/testData/diagnostics/tests/typealias/localTypeAliasConstructor.fir.kt index 9ef9044cf81..e0628eca641 100644 --- a/compiler/testData/diagnostics/tests/typealias/localTypeAliasConstructor.fir.kt +++ b/compiler/testData/diagnostics/tests/typealias/localTypeAliasConstructor.fir.kt @@ -4,8 +4,8 @@ class Cell(val x: TC) fun id(x: T): T { typealias C = Cell - class Local(val cell: C) + class Local(val cell: C) val cx = C(x) - val c: C = Local(cx).cell + val c: C = Local(cx).cell return c.x } diff --git a/compiler/testData/diagnostics/tests/typealias/localTypeAliasRecursive.fir.kt b/compiler/testData/diagnostics/tests/typealias/localTypeAliasRecursive.fir.kt index 571a38bf315..c7425ad95aa 100644 --- a/compiler/testData/diagnostics/tests/typealias/localTypeAliasRecursive.fir.kt +++ b/compiler/testData/diagnostics/tests/typealias/localTypeAliasRecursive.fir.kt @@ -1,7 +1,7 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER -TOPLEVEL_TYPEALIASES_ONLY fun outer() { - typealias Test1 = Test1 - typealias Test2 = List - typealias Test3 = List> + typealias Test1 = Test1 + typealias Test2 = List + typealias Test3 = List> } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/typealias/nested.fir.kt b/compiler/testData/diagnostics/tests/typealias/nested.fir.kt index 77a8316109e..e4fbb6a3a32 100644 --- a/compiler/testData/diagnostics/tests/typealias/nested.fir.kt +++ b/compiler/testData/diagnostics/tests/typealias/nested.fir.kt @@ -6,8 +6,8 @@ class C { typealias P2 = Pair fun p() = P2(1, 1) - fun first(p: P2) = p.x1 - fun second(p: P2) = p.x2 + fun first(p: P2) = p.x1 + fun second(p: P2) = p.x2 } val p1 = Pair(1, 1) diff --git a/compiler/testData/diagnostics/tests/typealias/nestedCapturingTypeParameters.fir.kt b/compiler/testData/diagnostics/tests/typealias/nestedCapturingTypeParameters.fir.kt index 08e34472f34..70fcde4afc2 100644 --- a/compiler/testData/diagnostics/tests/typealias/nestedCapturingTypeParameters.fir.kt +++ b/compiler/testData/diagnostics/tests/typealias/nestedCapturingTypeParameters.fir.kt @@ -6,11 +6,11 @@ class C { typealias P2 = Pair typealias PT2 = Pair - fun first(p: P2) = p.x1 - fun second(p: P2) = p.x2 + fun first(p: P2) = p.x1 + fun second(p: P2) = p.x2 - fun first2(p: PT2) = p.x1 - fun second2(p: PT2) = p.x2 + fun first2(p: PT2) = p.x1 + fun second2(p: PT2) = p.x2 } val p1 = Pair(1, 1) diff --git a/compiler/testData/diagnostics/tests/typealias/typeAliasAsBareType.fir.kt b/compiler/testData/diagnostics/tests/typealias/typeAliasAsBareType.fir.kt index 58a8a49211c..086b5bc7967 100644 --- a/compiler/testData/diagnostics/tests/typealias/typeAliasAsBareType.fir.kt +++ b/compiler/testData/diagnostics/tests/typealias/typeAliasAsBareType.fir.kt @@ -31,5 +31,5 @@ fun testLocal(x: Any) { class C typealias CA = C if (x is C) {} - if (x is CA) {} + if (x is CA) {} } diff --git a/compiler/testData/diagnostics/tests/typealias/typeAliasesInQualifiers.fir.kt b/compiler/testData/diagnostics/tests/typealias/typeAliasesInQualifiers.fir.kt index 3610ef548bf..685dfd227f7 100644 --- a/compiler/testData/diagnostics/tests/typealias/typeAliasesInQualifiers.fir.kt +++ b/compiler/testData/diagnostics/tests/typealias/typeAliasesInQualifiers.fir.kt @@ -38,13 +38,13 @@ enum class EnumSample { fun foo( a0: test.ClassSample.Nested, - a1: test.ClassAlias.Nested, + a1: test.ClassAlias.Nested, b0: test.ObjectSample.Nested, - b1: test.ObjectAlias.Nested, + b1: test.ObjectAlias.Nested, c0: test.EnumSample.Nested, - c1: test.EnumAlias.Nested + c1: test.EnumAlias.Nested ) { test.ClassSample::Nested test.ClassAlias::Nested diff --git a/compiler/testData/diagnostics/tests/variance/InPosition.fir.kt b/compiler/testData/diagnostics/tests/variance/InPosition.fir.kt index a6700c0f240..b84281d69e9 100644 --- a/compiler/testData/diagnostics/tests/variance/InPosition.fir.kt +++ b/compiler/testData/diagnostics/tests/variance/InPosition.fir.kt @@ -41,10 +41,10 @@ interface Test { fun neOk11(i: Inv) fun neOk12(i: Inv) - fun neOk30(i: Pair) - fun neOk31(i: Pair) - fun neOk32(i: Inv) + fun neOk30(i: Pair) + fun neOk31(i: Pair) + fun neOk32(i: Inv) fun neOk33(i: Inv<>) - fun neOk34(i: Inv) - fun neOk35(i: Inv) + fun neOk34(i: Inv) + fun neOk35(i: Inv) } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/variance/InvariantPosition.fir.kt b/compiler/testData/diagnostics/tests/variance/InvariantPosition.fir.kt index cadf0d1db0e..803061cfe6e 100644 --- a/compiler/testData/diagnostics/tests/variance/InvariantPosition.fir.kt +++ b/compiler/testData/diagnostics/tests/variance/InvariantPosition.fir.kt @@ -38,10 +38,10 @@ interface Test { var neOk22: Inv var neOk23: Inv - var neOk30: Pair - var neOk31: Pair - var neOk32: Inv + var neOk30: Pair + var neOk31: Pair + var neOk32: Inv var neOk33: Inv<> - var neOk34: Inv - var neOk35: Inv + var neOk34: Inv + var neOk35: Inv } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/variance/OutPosition.fir.kt b/compiler/testData/diagnostics/tests/variance/OutPosition.fir.kt index 87ee9d31e5f..0bf6f456bd6 100644 --- a/compiler/testData/diagnostics/tests/variance/OutPosition.fir.kt +++ b/compiler/testData/diagnostics/tests/variance/OutPosition.fir.kt @@ -33,10 +33,10 @@ interface Test { fun neOk10(): Inv fun neOk11(): Inv - fun neOk30(): Pair - fun neOk31(): Pair - fun neOk32(): Inv + fun neOk30(): Pair + fun neOk31(): Pair + fun neOk32(): Inv fun neOk33(): Inv<> - fun neOk34(): Inv - fun neOk35(): Inv + fun neOk34(): Inv + fun neOk35(): Inv } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/variance/ea1337846.fir.kt b/compiler/testData/diagnostics/tests/variance/ea1337846.fir.kt index bfac78ff16e..be951bd9da2 100644 --- a/compiler/testData/diagnostics/tests/variance/ea1337846.fir.kt +++ b/compiler/testData/diagnostics/tests/variance/ea1337846.fir.kt @@ -11,11 +11,11 @@ typealias EachSegmentComparator = (currentSegment: SegmentType, otherSegment: SegmentType, relationship: Int) -> Boolean interface ComputablePath - : Path + : Path where NumberType: Number, - PointType: ComputablePoint, - SegmentType: ComputableLineSegment + PointType: ComputablePoint, + SegmentType: ComputableLineSegment { - fun anyTwoSegments(comparator: EachSegmentComparator>): Boolean + fun anyTwoSegments(comparator: EachSegmentComparator<ComputableSegment>): Boolean } diff --git a/compiler/testData/diagnostics/tests/when/ExhaustiveEnumIs.fir.kt b/compiler/testData/diagnostics/tests/when/ExhaustiveEnumIs.fir.kt index 3c58abd2073..36e5d1dc4b1 100644 --- a/compiler/testData/diagnostics/tests/when/ExhaustiveEnumIs.fir.kt +++ b/compiler/testData/diagnostics/tests/when/ExhaustiveEnumIs.fir.kt @@ -4,8 +4,8 @@ enum class MyEnum { fun foo(x: MyEnum): Int { return when (x) { - is MyEnum.A -> 1 - is MyEnum.B -> 2 - is MyEnum.C -> 3 + is MyEnum.A -> 1 + is MyEnum.B -> 2 + is MyEnum.C -> 3 } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/when/ExhaustiveEnumMixed.fir.kt b/compiler/testData/diagnostics/tests/when/ExhaustiveEnumMixed.fir.kt index 6ff1b9e4ba9..e230cc17a05 100644 --- a/compiler/testData/diagnostics/tests/when/ExhaustiveEnumMixed.fir.kt +++ b/compiler/testData/diagnostics/tests/when/ExhaustiveEnumMixed.fir.kt @@ -5,7 +5,7 @@ enum class MyEnum { fun foo(x: MyEnum): Int { return when (x) { MyEnum.A -> 1 - is MyEnum.B -> 2 - is MyEnum.C -> 3 + is MyEnum.B -> 2 + is MyEnum.C -> 3 } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithStdLib/InaccessibleInternalClass.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/InaccessibleInternalClass.fir.kt index 55ad0bf66d9..d8bfab4b7d0 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/InaccessibleInternalClass.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/InaccessibleInternalClass.fir.kt @@ -10,6 +10,6 @@ package kotlin.sequences import p.* interface I { - val v1: FilteringSequence + val v1: FilteringSequence val v2: IndexingSequence } diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/callableReferenceOnUnresolvedLHS.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/callableReferenceOnUnresolvedLHS.fir.kt index 87486d2a91b..f7b4d61a233 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/callableReferenceOnUnresolvedLHS.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/callableReferenceOnUnresolvedLHS.fir.kt @@ -3,7 +3,7 @@ interface Inv class Impl : Inv -class Scope(private val implClass: j.Class) { +class Scope(private val implClass: j.Class) { fun foo(c: Collection) { val hm = c.asSequence() .filter(implClass::isInstance) diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/noDefaultCoroutineImports.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/noDefaultCoroutineImports.fir.kt index 1db1a12faeb..11ef48e60a9 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/noDefaultCoroutineImports.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/noDefaultCoroutineImports.fir.kt @@ -1,7 +1,7 @@ // FILE: 1.kt // COMMON_COROUTINES_TEST -fun test(c: Continuation) {} +fun test(c: Continuation) {} // FILE: 2.kt import COROUTINES_PACKAGE.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctionType/suspendFunctionN.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctionType/suspendFunctionN.fir.kt index d81d77f6fa0..22d898ca1a1 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctionType/suspendFunctionN.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctionType/suspendFunctionN.fir.kt @@ -1,4 +1,4 @@ // JAVAC_SKIP -typealias Test1 = SuspendFunction0 -typealias Test2 = kotlin.SuspendFunction0 +typealias Test1 = SuspendFunction0 +typealias Test2 = kotlin.SuspendFunction0 typealias Test3 = kotlin.coroutines.SuspendFunction0 \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithStdLib/regression/kt37727.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/regression/kt37727.fir.kt index 78e83c40e2d..4dec0aed824 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/regression/kt37727.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/regression/kt37727.fir.kt @@ -1,5 +1,5 @@ -data class A(val x: Set = setOf()) { - fun with(x: Set? = null) { +data class A(val x: Set = setOf()) { + fun with(x: Set? = null) { A(x ?: this.x) } } diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/fir/RenderingForDebugInfo.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/fir/RenderingForDebugInfo.kt index c4a2f0459fa..665dc7aeccd 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/fir/RenderingForDebugInfo.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/fir/RenderingForDebugInfo.kt @@ -12,7 +12,7 @@ fun ConeKotlinType.renderForDebugInfo(): String { return when (this) { is ConeTypeVariableType -> "TypeVariable(${this.lookupTag.name})" is ConeDefinitelyNotNullType -> "${original.renderForDebugInfo()}!!" - is ConeClassErrorType -> "ERROR CLASS: $reason" + is ConeClassErrorType -> "ERROR CLASS: ${diagnostic.reason}" is ConeCapturedType -> "CapturedType(${constructor.projection.renderForDebugInfo()})" is ConeClassLikeType -> { buildString { diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/fir/KtDeclarationAndFirDeclarationEqualityChecker.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/fir/KtDeclarationAndFirDeclarationEqualityChecker.kt index 151fb0ee00a..90066f727b1 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/fir/KtDeclarationAndFirDeclarationEqualityChecker.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/fir/KtDeclarationAndFirDeclarationEqualityChecker.kt @@ -60,8 +60,8 @@ object KtDeclarationAndFirDeclarationEqualityChecker { val renderedQualifier = qualifier.joinToString(separator = ".") { part -> buildString { append(part.name) - if (part.typeArguments.isNotEmpty()) { - part.typeArguments.joinTo(this, prefix = "<", postfix = ">") { it.renderTypeAsKotlinType() } + if (part.typeArgumentList.typeArguments.isNotEmpty()) { + part.typeArgumentList.typeArguments.joinTo(this, prefix = "<", postfix = ">") { it.renderTypeAsKotlinType() } } } } diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/types/FirKtType.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/types/FirKtType.kt index 75d9ec05ec4..a0fa6c0e924 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/types/FirKtType.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/types/FirKtType.kt @@ -79,7 +79,7 @@ internal class KtFirErrorType( override val coneType by weakRef(coneType) override val typeCheckerContext by weakRef(typeCheckerContext) - override val error: String get() = withValidityAssertion { coneType.reason } + override val error: String get() = withValidityAssertion { coneType.diagnostic.reason } } internal class KtFirTypeParameterType(