EA-46019 - assert: PropertyCodegen.generatePropertyDelegateAccess: delegate type can be null when delegate expression is unresolved and back-end called from light class generation
This commit is contained in:
@@ -40,6 +40,7 @@ import org.jetbrains.jet.lang.resolve.java.JvmAbi;
|
|||||||
import org.jetbrains.jet.lang.resolve.java.JvmStdlibNames;
|
import org.jetbrains.jet.lang.resolve.java.JvmStdlibNames;
|
||||||
import org.jetbrains.jet.lang.resolve.java.kt.DescriptorKindUtils;
|
import org.jetbrains.jet.lang.resolve.java.kt.DescriptorKindUtils;
|
||||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||||
|
import org.jetbrains.jet.lang.types.ErrorUtils;
|
||||||
import org.jetbrains.jet.lang.types.JetType;
|
import org.jetbrains.jet.lang.types.JetType;
|
||||||
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
|
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
|
||||||
|
|
||||||
@@ -114,7 +115,10 @@ public class PropertyCodegen extends GenerationStateAware {
|
|||||||
modifiers |= ACC_VOLATILE;
|
modifiers |= ACC_VOLATILE;
|
||||||
}
|
}
|
||||||
JetType delegateType = bindingContext.get(BindingContext.EXPRESSION_TYPE, p.getDelegateExpression());
|
JetType delegateType = bindingContext.get(BindingContext.EXPRESSION_TYPE, p.getDelegateExpression());
|
||||||
assert delegateType != null : "Type of delegate should be recorded: " + p.getText();
|
if (delegateType == null) {
|
||||||
|
// If delegate expression is unresolved reference
|
||||||
|
delegateType = ErrorUtils.createErrorType("Delegate type");
|
||||||
|
}
|
||||||
Type type = typeMapper.mapType(delegateType);
|
Type type = typeMapper.mapType(delegateType);
|
||||||
return v.newField(p, modifiers, JvmAbi.getPropertyDelegateName(propertyDescriptor.getName()), type.getDescriptor(),
|
return v.newField(p, modifiers, JvmAbi.getPropertyDelegateName(propertyDescriptor.getName()), type.getDescriptor(),
|
||||||
null, null);
|
null, null);
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
class SomeProp() {
|
||||||
|
fun get(t: Any, metadata: PropertyMetadataImpl) = 42
|
||||||
|
}
|
||||||
|
|
||||||
|
class Some<caret>() {
|
||||||
|
val renderer by SomeProp()
|
||||||
|
}
|
||||||
@@ -87,6 +87,10 @@ public class JetJavaFacadeTest extends LightCodeInsightFixtureTestCase {
|
|||||||
doTestWrapClass();
|
doTestWrapClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testEa46019() {
|
||||||
|
doTestWrapClass();
|
||||||
|
}
|
||||||
|
|
||||||
public void testEa38770() {
|
public void testEa38770() {
|
||||||
myFixture.configureByFile(getTestName(true) + ".kt");
|
myFixture.configureByFile(getTestName(true) + ".kt");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user