From 4ed6ece78b354e35ee5a8835a731dee3da3312e2 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Mon, 2 Oct 2023 11:52:01 +0200 Subject: [PATCH] Test: IR source ranges: make line/column -1 for negative offsets Before this commit, test data for 'synthesizedDataClassMembers' test was different between PSI and LT, because we had SYNTHETIC_OFFSET = -2 for synthetic functions and NaiveSourceBasedFileEntryImpl calculated line/column as 0 for LT. In this commit the dumper was edited to count -1 as line -1 / column -1 independent of a file entry used. --- .../synthesizedDataClassMembers.fir.txt | 230 +++++++++--------- .../handlers/IrSourceRangesDumpHandler.kt | 8 +- 2 files changed, 122 insertions(+), 116 deletions(-) diff --git a/compiler/testData/ir/sourceRanges/declarations/synthesizedDataClassMembers.fir.txt b/compiler/testData/ir/sourceRanges/declarations/synthesizedDataClassMembers.fir.txt index a30bc19ee10..7b51f41294b 100644 --- a/compiler/testData/ir/sourceRanges/declarations/synthesizedDataClassMembers.fir.txt +++ b/compiler/testData/ir/sourceRanges/declarations/synthesizedDataClassMembers.fir.txt @@ -39,135 +39,135 @@ @3:8..18 GET_VAR ': .C declared in .C.' type=.C origin=null @1:8..18 FUN GENERATED_DATA_CLASS_MEMBER name:component1 visibility:public modality:FINAL <> ($this:.C) returnType:kotlin.Int [operator] @1:8..18 VALUE_PARAMETER name: type:.C - @0:0..0 BLOCK_BODY - @0:0..0 RETURN type=kotlin.Nothing from='public final fun component1 (): kotlin.Int [operator] declared in .C' - @0:0..0 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null - @0:0..0 GET_VAR ': .C declared in .C.component1' type=.C origin=null + @-1:-1..-1 BLOCK_BODY + @-1:-1..-1 RETURN type=kotlin.Nothing from='public final fun component1 (): kotlin.Int [operator] declared in .C' + @-1:-1..-1 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null + @-1:-1..-1 GET_VAR ': .C declared in .C.component1' type=.C origin=null @2:8..21 FUN GENERATED_DATA_CLASS_MEMBER name:component2 visibility:public modality:FINAL <> ($this:.C) returnType:kotlin.String [operator] @2:8..21 VALUE_PARAMETER name: type:.C - @0:0..0 BLOCK_BODY - @0:0..0 RETURN type=kotlin.Nothing from='public final fun component2 (): kotlin.String [operator] declared in .C' - @0:0..0 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.String visibility:private [final]' type=kotlin.String origin=null - @0:0..0 GET_VAR ': .C declared in .C.component2' type=.C origin=null + @-1:-1..-1 BLOCK_BODY + @-1:-1..-1 RETURN type=kotlin.Nothing from='public final fun component2 (): kotlin.String [operator] declared in .C' + @-1:-1..-1 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + @-1:-1..-1 GET_VAR ': .C declared in .C.component2' type=.C origin=null @3:8..18 FUN GENERATED_DATA_CLASS_MEMBER name:component3 visibility:public modality:FINAL <> ($this:.C) returnType:kotlin.Any [operator] @3:8..18 VALUE_PARAMETER name: type:.C - @0:0..0 BLOCK_BODY - @0:0..0 RETURN type=kotlin.Nothing from='public final fun component3 (): kotlin.Any [operator] declared in .C' - @0:0..0 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:z type:kotlin.Any visibility:private [final]' type=kotlin.Any origin=null - @0:0..0 GET_VAR ': .C declared in .C.component3' type=.C origin=null + @-1:-1..-1 BLOCK_BODY + @-1:-1..-1 RETURN type=kotlin.Nothing from='public final fun component3 (): kotlin.Any [operator] declared in .C' + @-1:-1..-1 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:z type:kotlin.Any visibility:private [final]' type=kotlin.Any origin=null + @-1:-1..-1 GET_VAR ': .C declared in .C.component3' type=.C origin=null @0:0..4:1 FUN GENERATED_DATA_CLASS_MEMBER name:copy visibility:public modality:FINAL <> ($this:.C, x:kotlin.Int, y:kotlin.String, z:kotlin.Any) returnType:.C @0:0..4:1 VALUE_PARAMETER name: type:.C @1:8..18 VALUE_PARAMETER name:x index:0 type:kotlin.Int - @0:0..0 EXPRESSION_BODY - @0:0..0 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null - @0:0..0 GET_VAR ': .C declared in .C.copy' type=.C origin=null + @-1:-1..-1 EXPRESSION_BODY + @-1:-1..-1 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null + @-1:-1..-1 GET_VAR ': .C declared in .C.copy' type=.C origin=null @2:8..21 VALUE_PARAMETER name:y index:1 type:kotlin.String - @0:0..0 EXPRESSION_BODY - @0:0..0 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.String visibility:private [final]' type=kotlin.String origin=null - @0:0..0 GET_VAR ': .C declared in .C.copy' type=.C origin=null + @-1:-1..-1 EXPRESSION_BODY + @-1:-1..-1 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + @-1:-1..-1 GET_VAR ': .C declared in .C.copy' type=.C origin=null @3:8..18 VALUE_PARAMETER name:z index:2 type:kotlin.Any - @0:0..0 EXPRESSION_BODY - @0:0..0 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:z type:kotlin.Any visibility:private [final]' type=kotlin.Any origin=null - @0:0..0 GET_VAR ': .C declared in .C.copy' type=.C origin=null - @0:0..0 BLOCK_BODY - @0:0..0 RETURN type=kotlin.Nothing from='public final fun copy (x: kotlin.Int, y: kotlin.String, z: kotlin.Any): .C declared in .C' - @0:0..0 CONSTRUCTOR_CALL 'public constructor (x: kotlin.Int, y: kotlin.String, z: kotlin.Any) [primary] declared in .C' type=.C origin=null - @0:0..0 GET_VAR 'x: kotlin.Int declared in .C.copy' type=kotlin.Int origin=null - @0:0..0 GET_VAR 'y: kotlin.String declared in .C.copy' type=kotlin.String origin=null - @0:0..0 GET_VAR 'z: kotlin.Any declared in .C.copy' type=kotlin.Any origin=null + @-1:-1..-1 EXPRESSION_BODY + @-1:-1..-1 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:z type:kotlin.Any visibility:private [final]' type=kotlin.Any origin=null + @-1:-1..-1 GET_VAR ': .C declared in .C.copy' type=.C origin=null + @-1:-1..-1 BLOCK_BODY + @-1:-1..-1 RETURN type=kotlin.Nothing from='public final fun copy (x: kotlin.Int, y: kotlin.String, z: kotlin.Any): .C declared in .C' + @-1:-1..-1 CONSTRUCTOR_CALL 'public constructor (x: kotlin.Int, y: kotlin.String, z: kotlin.Any) [primary] declared in .C' type=.C origin=null + @-1:-1..-1 GET_VAR 'x: kotlin.Int declared in .C.copy' type=kotlin.Int origin=null + @-1:-1..-1 GET_VAR 'y: kotlin.String declared in .C.copy' type=kotlin.String origin=null + @-1:-1..-1 GET_VAR 'z: kotlin.Any declared in .C.copy' type=kotlin.Any origin=null @-1:-1..-1 FUN GENERATED_DATA_CLASS_MEMBER name:toString visibility:public modality:OPEN <> ($this:.C) returnType:kotlin.String @-1:-1..-1 VALUE_PARAMETER name: type:.C - @0:0..0 BLOCK_BODY - @0:0..0 RETURN type=kotlin.Nothing from='public open fun toString (): kotlin.String declared in .C' - @0:0..0 STRING_CONCATENATION type=kotlin.String - @0:0..0 CONST String type=kotlin.String value="C(" - @0:0..0 CONST String type=kotlin.String value="x=" - @0:0..0 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null - @0:0..0 GET_VAR ': .C declared in .C.toString' type=.C origin=null - @0:0..0 CONST String type=kotlin.String value=", " - @0:0..0 CONST String type=kotlin.String value="y=" - @0:0..0 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.String visibility:private [final]' type=kotlin.String origin=null - @0:0..0 GET_VAR ': .C declared in .C.toString' type=.C origin=null - @0:0..0 CONST String type=kotlin.String value=", " - @0:0..0 CONST String type=kotlin.String value="z=" - @0:0..0 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:z type:kotlin.Any visibility:private [final]' type=kotlin.Any origin=null - @0:0..0 GET_VAR ': .C declared in .C.toString' type=.C origin=null - @0:0..0 CONST String type=kotlin.String value=")" + @-1:-1..-1 BLOCK_BODY + @-1:-1..-1 RETURN type=kotlin.Nothing from='public open fun toString (): kotlin.String declared in .C' + @-1:-1..-1 STRING_CONCATENATION type=kotlin.String + @-1:-1..-1 CONST String type=kotlin.String value="C(" + @-1:-1..-1 CONST String type=kotlin.String value="x=" + @-1:-1..-1 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null + @-1:-1..-1 GET_VAR ': .C declared in .C.toString' type=.C origin=null + @-1:-1..-1 CONST String type=kotlin.String value=", " + @-1:-1..-1 CONST String type=kotlin.String value="y=" + @-1:-1..-1 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + @-1:-1..-1 GET_VAR ': .C declared in .C.toString' type=.C origin=null + @-1:-1..-1 CONST String type=kotlin.String value=", " + @-1:-1..-1 CONST String type=kotlin.String value="z=" + @-1:-1..-1 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:z type:kotlin.Any visibility:private [final]' type=kotlin.Any origin=null + @-1:-1..-1 GET_VAR ': .C declared in .C.toString' type=.C origin=null + @-1:-1..-1 CONST String type=kotlin.String value=")" @-1:-1..-1 FUN GENERATED_DATA_CLASS_MEMBER name:hashCode visibility:public modality:OPEN <> ($this:.C) returnType:kotlin.Int @-1:-1..-1 VALUE_PARAMETER name: type:.C - @0:0..0 BLOCK_BODY - @0:0..0 VAR name:result type:kotlin.Int [var] - @0:0..0 CALL 'public open fun hashCode (): kotlin.Int [fake_override] declared in kotlin.Int' type=kotlin.Int origin=null - @0:0..0 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null - @0:0..0 GET_VAR ': .C declared in .C.hashCode' type=.C origin=null - @0:0..0 SET_VAR 'var result: kotlin.Int [var] declared in .C.hashCode' type=kotlin.Unit origin=EQ - @0:0..0 CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null - @0:0..0 CALL 'public final fun times (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null - @0:0..0 GET_VAR 'var result: kotlin.Int [var] declared in .C.hashCode' type=kotlin.Int origin=null - @0:0..0 CONST Int type=kotlin.Int value=31 - @0:0..0 CALL 'public open fun hashCode (): kotlin.Int [fake_override] declared in kotlin.String' type=kotlin.Int origin=null - @0:0..0 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.String visibility:private [final]' type=kotlin.String origin=null - @0:0..0 GET_VAR ': .C declared in .C.hashCode' type=.C origin=null - @0:0..0 SET_VAR 'var result: kotlin.Int [var] declared in .C.hashCode' type=kotlin.Unit origin=EQ - @0:0..0 CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null - @0:0..0 CALL 'public final fun times (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null - @0:0..0 GET_VAR 'var result: kotlin.Int [var] declared in .C.hashCode' type=kotlin.Int origin=null - @0:0..0 CONST Int type=kotlin.Int value=31 - @0:0..0 CALL 'public open fun hashCode (): kotlin.Int declared in kotlin.Any' type=kotlin.Int origin=null - @0:0..0 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:z type:kotlin.Any visibility:private [final]' type=kotlin.Any origin=null - @0:0..0 GET_VAR ': .C declared in .C.hashCode' type=.C origin=null - @0:0..0 RETURN type=kotlin.Nothing from='public open fun hashCode (): kotlin.Int declared in .C' - @0:0..0 GET_VAR 'var result: kotlin.Int [var] declared in .C.hashCode' type=kotlin.Int origin=null + @-1:-1..-1 BLOCK_BODY + @-1:-1..-1 VAR name:result type:kotlin.Int [var] + @-1:-1..-1 CALL 'public open fun hashCode (): kotlin.Int [fake_override] declared in kotlin.Int' type=kotlin.Int origin=null + @-1:-1..-1 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null + @-1:-1..-1 GET_VAR ': .C declared in .C.hashCode' type=.C origin=null + @-1:-1..-1 SET_VAR 'var result: kotlin.Int [var] declared in .C.hashCode' type=kotlin.Unit origin=EQ + @-1:-1..-1 CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null + @-1:-1..-1 CALL 'public final fun times (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null + @-1:-1..-1 GET_VAR 'var result: kotlin.Int [var] declared in .C.hashCode' type=kotlin.Int origin=null + @-1:-1..-1 CONST Int type=kotlin.Int value=31 + @-1:-1..-1 CALL 'public open fun hashCode (): kotlin.Int [fake_override] declared in kotlin.String' type=kotlin.Int origin=null + @-1:-1..-1 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + @-1:-1..-1 GET_VAR ': .C declared in .C.hashCode' type=.C origin=null + @-1:-1..-1 SET_VAR 'var result: kotlin.Int [var] declared in .C.hashCode' type=kotlin.Unit origin=EQ + @-1:-1..-1 CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null + @-1:-1..-1 CALL 'public final fun times (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null + @-1:-1..-1 GET_VAR 'var result: kotlin.Int [var] declared in .C.hashCode' type=kotlin.Int origin=null + @-1:-1..-1 CONST Int type=kotlin.Int value=31 + @-1:-1..-1 CALL 'public open fun hashCode (): kotlin.Int declared in kotlin.Any' type=kotlin.Int origin=null + @-1:-1..-1 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:z type:kotlin.Any visibility:private [final]' type=kotlin.Any origin=null + @-1:-1..-1 GET_VAR ': .C declared in .C.hashCode' type=.C origin=null + @-1:-1..-1 RETURN type=kotlin.Nothing from='public open fun hashCode (): kotlin.Int declared in .C' + @-1:-1..-1 GET_VAR 'var result: kotlin.Int [var] declared in .C.hashCode' type=kotlin.Int origin=null @-1:-1..-1 FUN GENERATED_DATA_CLASS_MEMBER name:equals visibility:public modality:OPEN <> ($this:.C, other:kotlin.Any?) returnType:kotlin.Boolean [operator] @-1:-1..-1 VALUE_PARAMETER name: type:.C @-1:-1..-1 VALUE_PARAMETER name:other index:0 type:kotlin.Any? - @0:0..0 BLOCK_BODY - @0:0..0 WHEN type=kotlin.Unit origin=null - @0:0..0 BRANCH - @0:0..0 CALL 'public final fun EQEQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQEQ - @0:0..0 GET_VAR ': .C declared in .C.equals' type=.C origin=null - @0:0..0 GET_VAR 'other: kotlin.Any? declared in .C.equals' type=kotlin.Any? origin=null - @0:0..0 RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in .C' - @0:0..0 CONST Boolean type=kotlin.Boolean value=true - @0:0..0 WHEN type=kotlin.Unit origin=null - @0:0..0 BRANCH - @0:0..0 TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=.C - @0:0..0 GET_VAR 'other: kotlin.Any? declared in .C.equals' type=kotlin.Any? origin=null - @0:0..0 RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in .C' - @0:0..0 CONST Boolean type=kotlin.Boolean value=false - @0:0..0 VAR IR_TEMPORARY_VARIABLE name:tmp0_other_with_cast type:.C [val] - @0:0..0 TYPE_OP type=.C origin=CAST typeOperand=.C - @0:0..0 GET_VAR 'other: kotlin.Any? declared in .C.equals' type=kotlin.Any? origin=null - @0:0..0 WHEN type=kotlin.Unit origin=null - @0:0..0 BRANCH - @0:0..0 CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ - @0:0..0 CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ - @0:0..0 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null - @0:0..0 GET_VAR ': .C declared in .C.equals' type=.C origin=null - @0:0..0 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null - @0:0..0 GET_VAR 'val tmp0_other_with_cast: .C [val] declared in .C.equals' type=.C origin=null - @0:0..0 RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in .C' - @0:0..0 CONST Boolean type=kotlin.Boolean value=false - @0:0..0 WHEN type=kotlin.Unit origin=null - @0:0..0 BRANCH - @0:0..0 CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ - @0:0..0 CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ - @0:0..0 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.String visibility:private [final]' type=kotlin.String origin=null - @0:0..0 GET_VAR ': .C declared in .C.equals' type=.C origin=null - @0:0..0 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.String visibility:private [final]' type=kotlin.String origin=null - @0:0..0 GET_VAR 'val tmp0_other_with_cast: .C [val] declared in .C.equals' type=.C origin=null - @0:0..0 RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in .C' - @0:0..0 CONST Boolean type=kotlin.Boolean value=false - @0:0..0 WHEN type=kotlin.Unit origin=null - @0:0..0 BRANCH - @0:0..0 CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ - @0:0..0 CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ - @0:0..0 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:z type:kotlin.Any visibility:private [final]' type=kotlin.Any origin=null - @0:0..0 GET_VAR ': .C declared in .C.equals' type=.C origin=null - @0:0..0 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:z type:kotlin.Any visibility:private [final]' type=kotlin.Any origin=null - @0:0..0 GET_VAR 'val tmp0_other_with_cast: .C [val] declared in .C.equals' type=.C origin=null - @0:0..0 RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in .C' - @0:0..0 CONST Boolean type=kotlin.Boolean value=false - @0:0..0 RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in .C' - @0:0..0 CONST Boolean type=kotlin.Boolean value=true + @-1:-1..-1 BLOCK_BODY + @-1:-1..-1 WHEN type=kotlin.Unit origin=null + @-1:-1..-1 BRANCH + @-1:-1..-1 CALL 'public final fun EQEQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQEQ + @-1:-1..-1 GET_VAR ': .C declared in .C.equals' type=.C origin=null + @-1:-1..-1 GET_VAR 'other: kotlin.Any? declared in .C.equals' type=kotlin.Any? origin=null + @-1:-1..-1 RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in .C' + @-1:-1..-1 CONST Boolean type=kotlin.Boolean value=true + @-1:-1..-1 WHEN type=kotlin.Unit origin=null + @-1:-1..-1 BRANCH + @-1:-1..-1 TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=.C + @-1:-1..-1 GET_VAR 'other: kotlin.Any? declared in .C.equals' type=kotlin.Any? origin=null + @-1:-1..-1 RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in .C' + @-1:-1..-1 CONST Boolean type=kotlin.Boolean value=false + @-1:-1..-1 VAR IR_TEMPORARY_VARIABLE name:tmp0_other_with_cast type:.C [val] + @-1:-1..-1 TYPE_OP type=.C origin=CAST typeOperand=.C + @-1:-1..-1 GET_VAR 'other: kotlin.Any? declared in .C.equals' type=kotlin.Any? origin=null + @-1:-1..-1 WHEN type=kotlin.Unit origin=null + @-1:-1..-1 BRANCH + @-1:-1..-1 CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + @-1:-1..-1 CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + @-1:-1..-1 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null + @-1:-1..-1 GET_VAR ': .C declared in .C.equals' type=.C origin=null + @-1:-1..-1 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null + @-1:-1..-1 GET_VAR 'val tmp0_other_with_cast: .C [val] declared in .C.equals' type=.C origin=null + @-1:-1..-1 RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in .C' + @-1:-1..-1 CONST Boolean type=kotlin.Boolean value=false + @-1:-1..-1 WHEN type=kotlin.Unit origin=null + @-1:-1..-1 BRANCH + @-1:-1..-1 CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + @-1:-1..-1 CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + @-1:-1..-1 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + @-1:-1..-1 GET_VAR ': .C declared in .C.equals' type=.C origin=null + @-1:-1..-1 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + @-1:-1..-1 GET_VAR 'val tmp0_other_with_cast: .C [val] declared in .C.equals' type=.C origin=null + @-1:-1..-1 RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in .C' + @-1:-1..-1 CONST Boolean type=kotlin.Boolean value=false + @-1:-1..-1 WHEN type=kotlin.Unit origin=null + @-1:-1..-1 BRANCH + @-1:-1..-1 CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + @-1:-1..-1 CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + @-1:-1..-1 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:z type:kotlin.Any visibility:private [final]' type=kotlin.Any origin=null + @-1:-1..-1 GET_VAR ': .C declared in .C.equals' type=.C origin=null + @-1:-1..-1 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:z type:kotlin.Any visibility:private [final]' type=kotlin.Any origin=null + @-1:-1..-1 GET_VAR 'val tmp0_other_with_cast: .C [val] declared in .C.equals' type=.C origin=null + @-1:-1..-1 RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in .C' + @-1:-1..-1 CONST Boolean type=kotlin.Boolean value=false + @-1:-1..-1 RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in .C' + @-1:-1..-1 CONST Boolean type=kotlin.Boolean value=true @0:0..4:1 VALUE_PARAMETER INSTANCE_RECEIVER name: type:.C diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/backend/handlers/IrSourceRangesDumpHandler.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/backend/handlers/IrSourceRangesDumpHandler.kt index 5e64602ecbe..97ca2aafd93 100644 --- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/backend/handlers/IrSourceRangesDumpHandler.kt +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/backend/handlers/IrSourceRangesDumpHandler.kt @@ -64,7 +64,13 @@ class IrSourceRangesDumpHandler( val elementRenderer = RenderIrElementVisitor() private fun printElement(element: IrElement) { - val sourceRangeInfo = fileEntry.getSourceRangeInfo(element.startOffset, element.endOffset) + var sourceRangeInfo = fileEntry.getSourceRangeInfo(element.startOffset, element.endOffset) + if (element.startOffset < 0) { + sourceRangeInfo = sourceRangeInfo.copy(startLineNumber = -1, startColumnNumber = -1) + } + if (element.endOffset < 0) { + sourceRangeInfo = sourceRangeInfo.copy(endLineNumber = -1, endColumnNumber = -1) + } printer.println("@${sourceRangeInfo.render()} ${element.accept(elementRenderer, null)}") }