[IR] Render different quotes depending on IR constant type

This is needed for ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT diagnostic
message, but also seems to be good improvement for IR dumps in tests.

^KT-62559
This commit is contained in:
Roman Efremov
2023-11-28 12:03:09 +01:00
committed by Space Team
parent 8f6b6e17be
commit 5cf33c3556
72 changed files with 358 additions and 349 deletions
@@ -45,7 +45,7 @@ FILE fqName:<root> fileName:/1.kt
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS CLASS name:MyClass3 modality:FINAL visibility:public superTypes:[kotlin.Any]
annotations:
JavaAnn(value = ['asd'])
JavaAnn(value = ["asd"])
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.MyClass3
CONSTRUCTOR visibility:public <> () returnType:<root>.MyClass3 [primary]
BLOCK_BODY
@@ -45,7 +45,7 @@ FILE fqName:<root> fileName:/1.kt
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS CLASS name:MyClass3 modality:FINAL visibility:public superTypes:[kotlin.Any]
annotations:
JavaAnn(value = ['asd'])
JavaAnn(value = ["asd"])
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.MyClass3
CONSTRUCTOR visibility:public <> () returnType:<root>.MyClass3 [primary]
BLOCK_BODY
@@ -4,7 +4,7 @@ FILE fqName:<root> fileName:/selfReferentialAnnotation.kt
CONSTRUCTOR visibility:public <> (e:kotlin.Int) returnType:<root>.Ann [primary]
VALUE_PARAMETER name:e index:0 type:kotlin.Int
annotations:
Ann(e = '1')
Ann(e = 1)
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ANNOTATION_CLASS name:Ann modality:OPEN visibility:public superTypes:[kotlin.Annotation]'
@@ -34,7 +34,7 @@ FILE fqName:<root> fileName:/selfReferentialAnnotation.kt
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS ANNOTATION_CLASS name:MyRequiresOptIn modality:OPEN visibility:public superTypes:[kotlin.Annotation]
annotations:
MyRequiresOptIn(a = '', b = GET_ENUM 'ENUM_ENTRY name:ERROR' type=<root>.MyRequiresOptIn.MyLevel)
MyRequiresOptIn(a = "", b = GET_ENUM 'ENUM_ENTRY name:ERROR' type=<root>.MyRequiresOptIn.MyLevel)
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.MyRequiresOptIn
CONSTRUCTOR visibility:public <> (a:kotlin.String, b:<root>.MyRequiresOptIn.MyLevel) returnType:<root>.MyRequiresOptIn [primary]
VALUE_PARAMETER name:a index:0 type:kotlin.String
@@ -42,7 +42,7 @@ FILE fqName:<root> fileName:/selfReferentialAnnotation.kt
CONST String type=kotlin.String value=""
VALUE_PARAMETER name:b index:1 type:<root>.MyRequiresOptIn.MyLevel
annotations:
MyRequiresOptIn(a = '', b = GET_ENUM 'ENUM_ENTRY name:WARNING' type=<root>.MyRequiresOptIn.MyLevel)
MyRequiresOptIn(a = "", b = GET_ENUM 'ENUM_ENTRY name:WARNING' type=<root>.MyRequiresOptIn.MyLevel)
EXPRESSION_BODY
GET_ENUM 'ENUM_ENTRY name:ERROR' type=<root>.MyRequiresOptIn.MyLevel
BLOCK_BODY
@@ -4,7 +4,7 @@ FILE fqName:<root> fileName:/selfReferentialAnnotation.kt
CONSTRUCTOR visibility:public <> (e:kotlin.Int) returnType:<root>.Ann [primary]
VALUE_PARAMETER name:e index:0 type:kotlin.Int
annotations:
Ann(e = '1')
Ann(e = 1)
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ANNOTATION_CLASS name:Ann modality:OPEN visibility:public superTypes:[kotlin.Annotation]'
@@ -34,7 +34,7 @@ FILE fqName:<root> fileName:/selfReferentialAnnotation.kt
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS ANNOTATION_CLASS name:MyRequiresOptIn modality:OPEN visibility:public superTypes:[kotlin.Annotation]
annotations:
MyRequiresOptIn(a = '', b = GET_ENUM 'ENUM_ENTRY name:ERROR' type=<root>.MyRequiresOptIn.MyLevel)
MyRequiresOptIn(a = "", b = GET_ENUM 'ENUM_ENTRY name:ERROR' type=<root>.MyRequiresOptIn.MyLevel)
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.MyRequiresOptIn
CONSTRUCTOR visibility:public <> (a:kotlin.String, b:<root>.MyRequiresOptIn.MyLevel) returnType:<root>.MyRequiresOptIn [primary]
VALUE_PARAMETER name:a index:0 type:kotlin.String
@@ -42,7 +42,7 @@ FILE fqName:<root> fileName:/selfReferentialAnnotation.kt
CONST String type=kotlin.String value=""
VALUE_PARAMETER name:b index:1 type:<root>.MyRequiresOptIn.MyLevel
annotations:
MyRequiresOptIn(a = '', b = GET_ENUM 'ENUM_ENTRY name:WARNING' type=<root>.MyRequiresOptIn.MyLevel)
MyRequiresOptIn(a = "", b = GET_ENUM 'ENUM_ENTRY name:WARNING' type=<root>.MyRequiresOptIn.MyLevel)
EXPRESSION_BODY
GET_ENUM 'ENUM_ENTRY name:ERROR' type=<root>.MyRequiresOptIn.MyLevel
BLOCK_BODY
+1 -1
View File
@@ -10,7 +10,7 @@ FILE fqName:<root> fileName:/box.kt
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
CONSTRUCTOR_CALL 'public constructor <init> (filter: @[FlexibleNullability] <root>.Condition<in @[FlexibleNullability] kotlin.String?>?) declared in <root>.J' type=<root>.J origin=null
filter: TYPE_OP type=@[FlexibleNullability] <root>.Condition<kotlin.Any?>? origin=SAM_CONVERSION typeOperand=@[FlexibleNullability] <root>.Condition<kotlin.Any?>?
TYPE_OP type=@[FlexibleNullability] kotlin.Function1<@[ParameterName(name = 't')] kotlin.Any?, kotlin.Boolean>? origin=IMPLICIT_CAST typeOperand=@[FlexibleNullability] kotlin.Function1<@[ParameterName(name = 't')] kotlin.Any?, kotlin.Boolean>?
TYPE_OP type=@[FlexibleNullability] kotlin.Function1<@[ParameterName(name = "t")] kotlin.Any?, kotlin.Boolean>? origin=IMPLICIT_CAST typeOperand=@[FlexibleNullability] kotlin.Function1<@[ParameterName(name = "t")] kotlin.Any?, kotlin.Boolean>?
GET_VAR 'filter: kotlin.Function1<kotlin.String, kotlin.Boolean>? declared in <root>.foo' type=kotlin.Function1<kotlin.String, kotlin.Boolean>? origin=null
RETURN type=kotlin.Nothing from='public final fun foo (filter: kotlin.Function1<kotlin.String, kotlin.Boolean>?): kotlin.String declared in <root>'
CONST String type=kotlin.String value="OK"