Test and fix for NPE in CFA #KT-9078 Fixed #EA-71535 Fixed
This commit is contained in:
@@ -587,6 +587,7 @@ public class JetFlowInformationProvider {
|
|||||||
@NotNull Map<Instruction, Edges<Map<VariableDescriptor, VariableControlFlowState>>> initializersMap
|
@NotNull Map<Instruction, Edges<Map<VariableDescriptor, VariableControlFlowState>>> initializersMap
|
||||||
) {
|
) {
|
||||||
Edges<Map<VariableDescriptor, VariableControlFlowState>> initializers = initializersMap.get(pseudocode.getExitInstruction());
|
Edges<Map<VariableDescriptor, VariableControlFlowState>> initializers = initializersMap.get(pseudocode.getExitInstruction());
|
||||||
|
if (initializers == null) return;
|
||||||
Set<VariableDescriptor> declaredVariables = getPseudocodeVariablesData().getDeclaredVariables(pseudocode, false);
|
Set<VariableDescriptor> declaredVariables = getPseudocodeVariablesData().getDeclaredVariables(pseudocode, false);
|
||||||
for (VariableDescriptor variable : declaredVariables) {
|
for (VariableDescriptor variable : declaredVariables) {
|
||||||
if (variable instanceof PropertyDescriptor) {
|
if (variable instanceof PropertyDescriptor) {
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
// KT-9078 (NPE in control flow analysis); EA-71535
|
||||||
|
abstract class KFunctionKt9005WorkAround<out R: Any?>(private val _functionInstance: Function<R>): kotlin.reflect.KCallable<R> {
|
||||||
|
private val _reflectedFunction: kotlin.reflect.KFunction<R> = _functionInstance.<!UNRESOLVED_REFERENCE!>reflect<!>() ?: throw IllegalStateException("")
|
||||||
|
|
||||||
|
private val _parameters: List<kotlin.reflect.KParameter> = run {
|
||||||
|
_functionInstance.javaClass.methods.first().<!UNRESOLVED_REFERENCE!>parameters<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>map<!> {
|
||||||
|
<!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>object<!> : kotlin.reflect.KParameter {
|
||||||
|
override val index: Int = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public abstract class KFunctionKt9005WorkAround</*0*/ out R> : kotlin.reflect.KCallable<R> {
|
||||||
|
public constructor KFunctionKt9005WorkAround</*0*/ out R>(/*0*/ _functionInstance: kotlin.Function<R>)
|
||||||
|
private final val _functionInstance: kotlin.Function<R>
|
||||||
|
private final val _parameters: kotlin.List<kotlin.reflect.KParameter>
|
||||||
|
private final val _reflectedFunction: kotlin.reflect.KFunction<R>
|
||||||
|
public abstract override /*1*/ /*fake_override*/ val annotations: kotlin.List<kotlin.Annotation>
|
||||||
|
public abstract override /*1*/ /*fake_override*/ val name: kotlin.String
|
||||||
|
public abstract override /*1*/ /*fake_override*/ val parameters: kotlin.List<kotlin.reflect.KParameter>
|
||||||
|
public abstract override /*1*/ /*fake_override*/ val returnType: kotlin.reflect.KType
|
||||||
|
public abstract override /*1*/ /*fake_override*/ fun call(/*0*/ vararg args: kotlin.Any? /*kotlin.Array<out kotlin.Any?>*/): R
|
||||||
|
public abstract override /*1*/ /*fake_override*/ fun callBy(/*0*/ args: kotlin.Map<kotlin.reflect.KParameter, kotlin.Any?>): R
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
+6
@@ -53,6 +53,12 @@ public class JetDiagnosticsTestWithStdLibGenerated extends AbstractJetDiagnostic
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt9078.kt")
|
||||||
|
public void testKt9078() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithStdLib/kt9078.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("outstar.kt")
|
@TestMetadata("outstar.kt")
|
||||||
public void testOutstar() throws Exception {
|
public void testOutstar() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithStdLib/outstar.kt");
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithStdLib/outstar.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user