Fix NPE on equals/hashCode of local function references
Anonymous classes for local function references implement their getOwner() as "return null" currently (KT-14291). To avoid NPE in this case, we now consider two local functions the same if their name and signature are equal. This is incorrect in general, but unlikely to cause major problems and is going to be fixed by KT-14291 eventually anyway #KT-17055
This commit is contained in:
@@ -2040,6 +2040,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("equalsHashCode.kt")
|
||||
public void testEqualsHashCode() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/callableReference/function/local/equalsHashCode.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("extension.kt")
|
||||
public void testExtension() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/callableReference/function/local/extension.kt");
|
||||
|
||||
@@ -2040,6 +2040,12 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("equalsHashCode.kt")
|
||||
public void testEqualsHashCode() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/callableReference/function/local/equalsHashCode.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("extension.kt")
|
||||
public void testExtension() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/callableReference/function/local/extension.kt");
|
||||
|
||||
Reference in New Issue
Block a user