diff --git a/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/LightTreeRawFirDeclarationBuilder.kt b/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/LightTreeRawFirDeclarationBuilder.kt index 0e26e68643e..dfe6d1a0b2f 100644 --- a/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/LightTreeRawFirDeclarationBuilder.kt +++ b/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/LightTreeRawFirDeclarationBuilder.kt @@ -920,7 +920,9 @@ class LightTreeRawFirDeclarationBuilder( arguments: List, ): FirDelegatedConstructorCall { return buildDelegatedConstructorCall { - source = delegatedConstructorSource ?: selfTypeSource?.fakeElement(KtFakeSourceElementKind.DelegatingConstructorCall) + source = delegatedConstructorSource + ?: primaryConstructor?.toFirSourceElement(KtFakeSourceElementKind.DelegatingConstructorCall) + ?: selfTypeSource?.fakeElement(KtFakeSourceElementKind.DelegatingConstructorCall) constructedTypeRef = delegatedSuperTypeRef.copyWithNewSourceKind(KtFakeSourceElementKind.ImplicitTypeRef) isThis = false calleeReference = buildExplicitSuperReference { diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/deadCode/initializationInUnreachableCode.fir.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/deadCode/initializationInUnreachableCode.fir.kt index 57eab53cc8d..51c0ff29613 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/deadCode/initializationInUnreachableCode.fir.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/deadCode/initializationInUnreachableCode.fir.kt @@ -1,13 +1,12 @@ -// COMPARE_WITH_LIGHT_TREE // ISSUE: KT-40851 fun error(): Nothing = throw Exception() -class Some() { +class Some() { var x: Int - val y: Int = error() + val y: Int = error() - init { + init { x = 1; } -} +} diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/deadCode/initializationInUnreachableCode.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/deadCode/initializationInUnreachableCode.kt index e4c1cee7fc0..4d09a8e592a 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/deadCode/initializationInUnreachableCode.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/deadCode/initializationInUnreachableCode.kt @@ -1,4 +1,3 @@ -// COMPARE_WITH_LIGHT_TREE // ISSUE: KT-40851 fun error(): Nothing = throw Exception() diff --git a/compiler/testData/ir/sourceRanges/annotations.fir.txt b/compiler/testData/ir/sourceRanges/annotations.fir.txt index aefd894add2..6697717f077 100644 --- a/compiler/testData/ir/sourceRanges/annotations.fir.txt +++ b/compiler/testData/ir/sourceRanges/annotations.fir.txt @@ -9,7 +9,7 @@ @1:38..63 CONSTRUCTOR visibility:public <> (description:kotlin.String) returnType:.MyAnnotation [primary] @1:39..62 VALUE_PARAMETER name:description index:0 type:kotlin.String @1:38..63 BLOCK_BODY - @0:0..1:63 DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + @1:38..63 DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' @1:38..63 INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ANNOTATION_CLASS name:MyAnnotation modality:OPEN visibility:internal superTypes:[kotlin.Annotation]' @1:39..62 PROPERTY name:description visibility:public modality:FINAL [val] @1:39..62 FIELD PROPERTY_BACKING_FIELD name:description type:kotlin.String visibility:private [final] diff --git a/compiler/testData/ir/sourceRanges/comments.fir.txt b/compiler/testData/ir/sourceRanges/comments.fir.txt index 74380586fbf..09edcca0fd0 100644 --- a/compiler/testData/ir/sourceRanges/comments.fir.txt +++ b/compiler/testData/ir/sourceRanges/comments.fir.txt @@ -9,7 +9,7 @@ @8:52..79 VALUE_PARAMETER name: type:.Foo @8:72..78 VALUE_PARAMETER name:x index:0 type:kotlin.Int @8:52..79 BLOCK_BODY - @8:4..10:36 DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + @8:52..79 DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' @8:52..79 INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Inner modality:FINAL visibility:public [inner] superTypes:[kotlin.Any]' @-1:-1..-1 FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] @-1:-1..-1 VALUE_PARAMETER name: type:kotlin.Any diff --git a/compiler/testData/ir/sourceRanges/declarations/kt29862.fir.txt b/compiler/testData/ir/sourceRanges/declarations/kt29862.fir.txt index 1f7d59e175e..eb8ecb8e700 100644 --- a/compiler/testData/ir/sourceRanges/declarations/kt29862.fir.txt +++ b/compiler/testData/ir/sourceRanges/declarations/kt29862.fir.txt @@ -3,7 +3,7 @@ @0:20..2:1 CONSTRUCTOR visibility:public <> (x:kotlin.Int) returnType:.Test1 [primary] @1:4..14 VALUE_PARAMETER name:x index:0 type:kotlin.Int @0:20..2:1 BLOCK_BODY - @0:0..3:1 DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + @0:20..2:1 DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' @0:20..2:1 INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Test1 modality:ABSTRACT visibility:public superTypes:[kotlin.Any]' @1:4..14 PROPERTY name:x visibility:public modality:FINAL [val] @1:4..14 FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final] @@ -27,7 +27,7 @@ @7:11..9:1 CONSTRUCTOR visibility:public <> (x:kotlin.Int) returnType:.Test2 [primary] @8:4..14 VALUE_PARAMETER name:x index:0 type:kotlin.Int @7:11..9:1 BLOCK_BODY - @5:0..14:1 DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + @7:11..9:1 DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' @7:11..9:1 INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Test2 modality:ABSTRACT visibility:public superTypes:[kotlin.Any]' @8:4..14 PROPERTY name:x visibility:public modality:FINAL [val] @8:4..14 FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final] @@ -44,7 +44,7 @@ @11:19..13:5 VALUE_PARAMETER name: type:.Test2 @12:8..18 VALUE_PARAMETER name:x index:0 type:kotlin.Int @11:19..13:5 BLOCK_BODY - @10:4..13:5 DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + @11:19..13:5 DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' @11:19..13:5 INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:TestInner modality:FINAL visibility:public [inner] superTypes:[kotlin.Any]' @12:8..18 PROPERTY name:x visibility:public modality:FINAL [val] @12:8..18 FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final] diff --git a/compiler/testData/ir/sourceRanges/declarations/primaryConstructors.fir.txt b/compiler/testData/ir/sourceRanges/declarations/primaryConstructors.fir.txt index af1309b99d2..ea08c7d0a12 100644 --- a/compiler/testData/ir/sourceRanges/declarations/primaryConstructors.fir.txt +++ b/compiler/testData/ir/sourceRanges/declarations/primaryConstructors.fir.txt @@ -3,7 +3,7 @@ @0:11..23 CONSTRUCTOR visibility:public <> (x:kotlin.Int) returnType:.Test1 [primary] @0:12..22 VALUE_PARAMETER name:x index:0 type:kotlin.Int @0:11..23 BLOCK_BODY - @0:0..23 DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + @0:11..23 DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' @0:11..23 INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Test1 modality:FINAL visibility:public superTypes:[kotlin.Any]' @0:12..22 PROPERTY name:x visibility:public modality:FINAL [val] @0:12..22 FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final] @@ -27,7 +27,7 @@ @3:0..32 CONSTRUCTOR visibility:internal <> (x:kotlin.Int) returnType:.Test2 [primary] @3:21..31 VALUE_PARAMETER name:x index:0 type:kotlin.Int @3:0..32 BLOCK_BODY - @2:0..3:32 DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + @3:0..32 DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' @3:0..32 INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Test2 modality:FINAL visibility:public superTypes:[kotlin.Any]' @3:21..31 PROPERTY name:x visibility:public modality:FINAL [val] @3:21..31 FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final] @@ -51,7 +51,7 @@ @9:0..23 CONSTRUCTOR visibility:public <> (x:kotlin.Int) returnType:.Test3 [primary] @9:12..22 VALUE_PARAMETER name:x index:0 type:kotlin.Int @9:0..23 BLOCK_BODY - @5:0..9:23 DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + @9:0..23 DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' @9:0..23 INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Test3 modality:FINAL visibility:public superTypes:[kotlin.Any]' @9:12..22 PROPERTY name:x visibility:public modality:FINAL [val] @9:12..22 FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final] @@ -79,7 +79,7 @@ @12:10..27 CONST String type=kotlin.String value="UNUSED_VARIABLE" @13:12..22 VALUE_PARAMETER name:x index:0 type:kotlin.Int @12:0..13:23 BLOCK_BODY - @11:0..13:23 DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + @12:0..13:23 DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' @12:0..13:23 INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Test4 modality:FINAL visibility:public superTypes:[kotlin.Any]' @13:12..22 PROPERTY name:x visibility:public modality:FINAL [val] @13:12..22 FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final] diff --git a/compiler/testData/ir/sourceRanges/declarations/synthesizedDataClassMembers.fir.txt b/compiler/testData/ir/sourceRanges/declarations/synthesizedDataClassMembers.fir.txt index 7b51f41294b..96b09ea38cc 100644 --- a/compiler/testData/ir/sourceRanges/declarations/synthesizedDataClassMembers.fir.txt +++ b/compiler/testData/ir/sourceRanges/declarations/synthesizedDataClassMembers.fir.txt @@ -5,7 +5,7 @@ @2:8..21 VALUE_PARAMETER name:y index:1 type:kotlin.String @3:8..18 VALUE_PARAMETER name:z index:2 type:kotlin.Any @0:12..4:1 BLOCK_BODY - @0:0..4:1 DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + @0:12..4:1 DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' @0:12..4:1 INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:C modality:FINAL visibility:public [data] superTypes:[kotlin.Any]' @1:8..18 PROPERTY name:x visibility:public modality:FINAL [val] @1:8..18 FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final] diff --git a/plugins/kotlinx-serialization/testData/codegen/Basic.asm.fir.txt b/plugins/kotlinx-serialization/testData/codegen/Basic.asm.fir.txt index aa319cb018e..5cb45013dc3 100644 --- a/plugins/kotlinx-serialization/testData/codegen/Basic.asm.fir.txt +++ b/plugins/kotlinx-serialization/testData/codegen/Basic.asm.fir.txt @@ -253,16 +253,14 @@ public final class ListOfUsers : java/lang/Object { LDC (list) INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V) LABEL (L1) - LINENUMBER (12) + LINENUMBER (13) ALOAD (0) INVOKESPECIAL (java/lang/Object, , ()V) - LABEL (L2) - LINENUMBER (13) ALOAD (0) ALOAD (1) PUTFIELD (ListOfUsers, list, Ljava/util/List;) RETURN - LABEL (L3) + LABEL (L2) } public void (int seen0, java.util.List list, kotlinx.serialization.internal.SerializationConstructorMarker serializationConstructorMarker) { @@ -542,16 +540,14 @@ public final class OptionalUser : java/lang/Object { LDC (user) INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V) LABEL (L1) - LINENUMBER (9) + LINENUMBER (10) ALOAD (0) INVOKESPECIAL (java/lang/Object, , ()V) - LABEL (L2) - LINENUMBER (10) ALOAD (0) ALOAD (1) PUTFIELD (OptionalUser, user, LUser;) RETURN - LABEL (L3) + LABEL (L2) } public void (User p0, int p1, kotlin.jvm.internal.DefaultConstructorMarker p2) { @@ -930,11 +926,9 @@ public final class User : java/lang/Object { LDC (lastName) INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V) LABEL (L1) - LINENUMBER (6) + LINENUMBER (7) ALOAD (0) INVOKESPECIAL (java/lang/Object, , ()V) - LABEL (L2) - LINENUMBER (7) ALOAD (0) ALOAD (1) PUTFIELD (User, firstName, Ljava/lang/String;) @@ -942,7 +936,7 @@ public final class User : java/lang/Object { ALOAD (2) PUTFIELD (User, lastName, Ljava/lang/String;) RETURN - LABEL (L3) + LABEL (L2) } public void (int seen0, java.lang.String firstName, java.lang.String lastName, kotlinx.serialization.internal.SerializationConstructorMarker serializationConstructorMarker) { diff --git a/plugins/kotlinx-serialization/testData/codegen/Sealed.asm.fir.txt b/plugins/kotlinx-serialization/testData/codegen/Sealed.asm.fir.txt index 03bde29c078..7c2db4644f7 100644 --- a/plugins/kotlinx-serialization/testData/codegen/Sealed.asm.fir.txt +++ b/plugins/kotlinx-serialization/testData/codegen/Sealed.asm.fir.txt @@ -219,16 +219,14 @@ public final class Container : java/lang/Object { LDC (r) INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V) LABEL (L1) - LINENUMBER (18) + LINENUMBER (19) ALOAD (0) INVOKESPECIAL (java/lang/Object, , ()V) - LABEL (L2) - LINENUMBER (19) ALOAD (0) ALOAD (1) PUTFIELD (Container, r, LResult;) RETURN - LABEL (L3) + LABEL (L2) } public void (int seen0, Result r, kotlinx.serialization.internal.SerializationConstructorMarker serializationConstructorMarker) {