KT-16440 ClassConstructorDescriptorImpl has null returnType
Set constructor return type in FunctionDescriptorResolver#createConstructorDescriptor (it seems to be the only place where ClassConstructorDescriptorImpl#initialize(...) is called, but returnType is not set).
This commit is contained in:
@@ -317,6 +317,7 @@ class FunctionDescriptorResolver(
|
|||||||
DescriptorUtils.getDefaultConstructorVisibility(classDescriptor)
|
DescriptorUtils.getDefaultConstructorVisibility(classDescriptor)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
constructor.returnType = classDescriptor.defaultType
|
||||||
if (DescriptorUtils.isAnnotationClass(classDescriptor)) {
|
if (DescriptorUtils.isAnnotationClass(classDescriptor)) {
|
||||||
CompileTimeConstantUtils.checkConstructorParametersType(valueParameters, trace)
|
CompileTimeConstantUtils.checkConstructorParametersType(valueParameters, trace)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
class A
|
||||||
|
|
||||||
|
val test = A()
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
FILE /contructorCall.kt
|
||||||
|
CLASS CLASS A
|
||||||
|
CONSTRUCTOR public constructor A()
|
||||||
|
BLOCK_BODY
|
||||||
|
DELEGATING_CONSTRUCTOR_CALL 'constructor Any()'
|
||||||
|
INSTANCE_INITIALIZER_CALL classDescriptor='A'
|
||||||
|
PROPERTY public val test: A
|
||||||
|
FIELD PROPERTY_BACKING_FIELD public val test: A
|
||||||
|
EXPRESSION_BODY
|
||||||
|
CALL 'constructor A()' type=A origin=null
|
||||||
|
FUN DEFAULT_PROPERTY_ACCESSOR public fun <get-test>(): A
|
||||||
|
BLOCK_BODY
|
||||||
|
RETURN type=kotlin.Nothing from='<get-test>(): A'
|
||||||
|
GET_FIELD 'test: A' type=A origin=null
|
||||||
@@ -470,6 +470,12 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("contructorCall.kt")
|
||||||
|
public void testContructorCall() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/ir/irText/expressions/contructorCall.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("conventionComparisons.kt")
|
@TestMetadata("conventionComparisons.kt")
|
||||||
public void testConventionComparisons() throws Exception {
|
public void testConventionComparisons() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/ir/irText/expressions/conventionComparisons.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/ir/irText/expressions/conventionComparisons.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user