Dump absent type arguments

This commit is contained in:
Dmitry Petrov
2017-05-04 17:22:23 +03:00
parent ddb2b7508b
commit f5fde2c24f
13 changed files with 24 additions and 3 deletions
@@ -132,7 +132,6 @@ class DumpIrTreeVisitor(out: Appendable): IrElementVisitor<Unit, String> {
override fun visitMemberAccess(expression: IrMemberAccessExpression, data: String) {
expression.dumpLabeledElementWith(data) {
dumpTypeArguments(expression)
expression.dispatchReceiver?.accept(this, "\$this")
expression.extensionReceiver?.accept(this, "\$receiver")
for (valueParameter in expression.descriptor.valueParameters) {
@@ -143,9 +142,11 @@ class DumpIrTreeVisitor(out: Appendable): IrElementVisitor<Unit, String> {
private fun dumpTypeArguments(expression: IrMemberAccessExpression) {
for (typeParameter in expression.descriptor.original.typeParameters) {
val typeArgument = expression.getTypeArgument(typeParameter) ?: continue
val renderedParameter = DescriptorRenderer.ONLY_NAMES_WITH_SHORT_TYPES.render(typeParameter)
val renderedType = DescriptorRenderer.ONLY_NAMES_WITH_SHORT_TYPES.renderType(typeArgument)
val typeArgument = expression.getTypeArgument(typeParameter)
val renderedType = typeArgument?.let {
DescriptorRenderer.ONLY_NAMES_WITH_SHORT_TYPES.renderType(typeArgument)
} ?: "null"
printer.println("$renderedParameter: $renderedType")
}
}
+1
View File
@@ -48,6 +48,7 @@ FILE /classes.kt
CONSTRUCTOR private constructor TestEnumClass()
BLOCK_BODY
ENUM_CONSTRUCTOR_CALL 'constructor Enum(String, Int)'
<E : Enum<E>>: null
INSTANCE_INITIALIZER_CALL classDescriptor='TestEnumClass'
FUN FAKE_OVERRIDE protected final override fun clone(): kotlin.Any
$this: VALUE_PARAMETER this@Enum: Enum<TestEnumClass>
@@ -32,6 +32,7 @@ FILE /dataClassesGeneric.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='copy(T = ...): Test1<T>'
CALL 'constructor Test1(T)' type=Test1<T> origin=null
<T>: null
x: GET_VAR 'value-parameter x: T = ...' type=T origin=null
FUN GENERATED_DATA_CLASS_MEMBER public open override fun toString(): kotlin.String
$this: VALUE_PARAMETER this@Test1: Test1<T>
@@ -31,6 +31,7 @@ FILE /delegatingConstructorCallToTypeAliasConstructor.kt
CONSTRUCTOR public constructor C1()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'constructor Cell(String)'
<T>: null
value: CONST String type=kotlin.String value='O'
INSTANCE_INITIALIZER_CALL classDescriptor='C1'
PROPERTY FAKE_OVERRIDE public final override val value: kotlin.String
@@ -48,6 +49,7 @@ FILE /delegatingConstructorCallToTypeAliasConstructor.kt
CONSTRUCTOR public constructor C2()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'constructor Cell(String)'
<T>: null
value: CONST String type=kotlin.String value='K'
INSTANCE_INITIALIZER_CALL classDescriptor='C2'
PROPERTY FAKE_OVERRIDE public final override val value: kotlin.String
+5
View File
@@ -4,6 +4,7 @@ FILE /enum.kt
CONSTRUCTOR private constructor TestEnum1()
BLOCK_BODY
ENUM_CONSTRUCTOR_CALL 'constructor Enum(String, Int)'
<E : Enum<E>>: null
INSTANCE_INITIALIZER_CALL classDescriptor='TestEnum1'
ENUM_ENTRY enum entry TEST1
init: ENUM_CONSTRUCTOR_CALL 'constructor TestEnum1()'
@@ -42,6 +43,7 @@ FILE /enum.kt
VALUE_PARAMETER value-parameter x: kotlin.Int
BLOCK_BODY
ENUM_CONSTRUCTOR_CALL 'constructor Enum(String, Int)'
<E : Enum<E>>: null
INSTANCE_INITIALIZER_CALL classDescriptor='TestEnum2'
PROPERTY public final val x: kotlin.Int
FIELD PROPERTY_BACKING_FIELD public final val x: kotlin.Int
@@ -94,6 +96,7 @@ FILE /enum.kt
CONSTRUCTOR private constructor TestEnum3()
BLOCK_BODY
ENUM_CONSTRUCTOR_CALL 'constructor Enum(String, Int)'
<E : Enum<E>>: null
INSTANCE_INITIALIZER_CALL classDescriptor='TestEnum3'
ENUM_ENTRY enum entry TEST
init: ENUM_CONSTRUCTOR_CALL 'constructor TEST()'
@@ -165,6 +168,7 @@ FILE /enum.kt
VALUE_PARAMETER value-parameter x: kotlin.Int
BLOCK_BODY
ENUM_CONSTRUCTOR_CALL 'constructor Enum(String, Int)'
<E : Enum<E>>: null
INSTANCE_INITIALIZER_CALL classDescriptor='TestEnum4'
PROPERTY public final val x: kotlin.Int
FIELD PROPERTY_BACKING_FIELD public final val x: kotlin.Int
@@ -305,6 +309,7 @@ FILE /enum.kt
CONST Int type=kotlin.Int value='0'
BLOCK_BODY
ENUM_CONSTRUCTOR_CALL 'constructor Enum(String, Int)'
<E : Enum<E>>: null
INSTANCE_INITIALIZER_CALL classDescriptor='TestEnum5'
PROPERTY public final val x: kotlin.Int
FIELD PROPERTY_BACKING_FIELD public final val x: kotlin.Int
@@ -5,6 +5,7 @@ FILE /enumWithSecondaryCtor.kt
VALUE_PARAMETER value-parameter x: kotlin.Int
BLOCK_BODY
ENUM_CONSTRUCTOR_CALL 'constructor Enum(String, Int)'
<E : Enum<E>>: null
INSTANCE_INITIALIZER_CALL classDescriptor='Test0'
PROPERTY public final val x: kotlin.Int
FIELD PROPERTY_BACKING_FIELD public final val x: kotlin.Int
@@ -55,6 +56,7 @@ FILE /enumWithSecondaryCtor.kt
VALUE_PARAMETER value-parameter x: kotlin.Int
BLOCK_BODY
ENUM_CONSTRUCTOR_CALL 'constructor Enum(String, Int)'
<E : Enum<E>>: null
INSTANCE_INITIALIZER_CALL classDescriptor='Test1'
PROPERTY public final val x: kotlin.Int
FIELD PROPERTY_BACKING_FIELD public final val x: kotlin.Int
@@ -108,6 +110,7 @@ FILE /enumWithSecondaryCtor.kt
VALUE_PARAMETER value-parameter x: kotlin.Int
BLOCK_BODY
ENUM_CONSTRUCTOR_CALL 'constructor Enum(String, Int)'
<E : Enum<E>>: null
INSTANCE_INITIALIZER_CALL classDescriptor='Test2'
PROPERTY public final val x: kotlin.Int
FIELD PROPERTY_BACKING_FIELD public final val x: kotlin.Int
@@ -55,6 +55,7 @@ FILE /dataClassMembers.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='copy(T = ..., String = ...): Test<T>'
CALL 'constructor Test(T, String = ...)' type=Test<T> origin=null
<T>: null
x: GET_VAR 'value-parameter x: T = ...' type=T origin=null
y: GET_VAR 'value-parameter y: String = ...' type=kotlin.String origin=null
FUN GENERATED_DATA_CLASS_MEMBER public open override fun toString(): kotlin.String
@@ -38,6 +38,7 @@ FILE /delegatedMembers.kt
VALUE_PARAMETER value-parameter x: X
BLOCK_BODY
CALL 'qux(TT, X): Unit' type=kotlin.Unit origin=null
<X>: null
$this: GET_FIELD '`Test$IBase$delegate`: IBase<TT>' type=IBase<TT> origin=null
receiver: GET_VAR 'this@Test: Test<TT>' type=Test<TT> origin=null
t: GET_VAR 'value-parameter t: TT' type=TT origin=null
@@ -4,6 +4,7 @@ FILE /enumEntryAsReceiver.kt
CONSTRUCTOR private constructor X()
BLOCK_BODY
ENUM_CONSTRUCTOR_CALL 'constructor Enum(String, Int)'
<E : Enum<E>>: null
INSTANCE_INITIALIZER_CALL classDescriptor='X'
ENUM_ENTRY enum entry B
init: ENUM_CONSTRUCTOR_CALL 'constructor B()'
@@ -17,6 +17,7 @@ FILE /objectAsCallable.kt
CONSTRUCTOR private constructor En()
BLOCK_BODY
ENUM_CONSTRUCTOR_CALL 'constructor Enum(String, Int)'
<E : Enum<E>>: null
INSTANCE_INITIALIZER_CALL classDescriptor='En'
ENUM_ENTRY enum entry X
init: ENUM_CONSTRUCTOR_CALL 'constructor En()'
+1
View File
@@ -4,6 +4,7 @@ FILE /values.kt
CONSTRUCTOR private constructor Enum()
BLOCK_BODY
ENUM_CONSTRUCTOR_CALL 'constructor Enum(String, Int)'
<E : Enum<E>>: null
INSTANCE_INITIALIZER_CALL classDescriptor='Enum'
ENUM_ENTRY enum entry A
init: ENUM_CONSTRUCTOR_CALL 'constructor Enum()'
@@ -30,8 +30,10 @@ FILE /typeAliasCtorForGenericClass.kt
BLOCK_BODY
VAR val b: B<kotlin.Int> /* = A<kotlin.Int> */
CALL 'constructor A(Int)' type=A<kotlin.Int> origin=null
<Q>: null
q: CONST Int type=kotlin.Int value='2'
VAR val b2: B2<kotlin.Int> /* = A<A<kotlin.Int>> */
CALL 'constructor A(A<Int>)' type=A<A<kotlin.Int>> origin=null
<Q>: null
q: GET_VAR 'b: B<Int> /* = A<Int> */' type=B<kotlin.Int> /* = A<kotlin.Int> */ origin=null
+1
View File
@@ -4,6 +4,7 @@ FILE /enumEntry.kt
CONSTRUCTOR private constructor Z()
BLOCK_BODY
ENUM_CONSTRUCTOR_CALL 'constructor Enum(String, Int)'
<E : Enum<E>>: null
INSTANCE_INITIALIZER_CALL classDescriptor='Z'
ENUM_ENTRY enum entry ENTRY
init: ENUM_CONSTRUCTOR_CALL 'constructor ENTRY()'