Fix 'equals' for NotNullBasicValue
NotNullBasicValues were merged incorrectly sometimes, which caused problems with INSTANCEOF checks. #KT-18779 Fixed
This commit is contained in:
+1
-1
@@ -23,7 +23,7 @@ import org.jetbrains.org.objectweb.asm.Type
|
|||||||
import org.jetbrains.org.objectweb.asm.tree.analysis.BasicValue
|
import org.jetbrains.org.objectweb.asm.tree.analysis.BasicValue
|
||||||
|
|
||||||
class NotNullBasicValue(type: Type?) : StrictBasicValue(type) {
|
class NotNullBasicValue(type: Type?) : StrictBasicValue(type) {
|
||||||
override fun equals(other: Any?): Boolean = other is NotNullBasicValue
|
override fun equals(other: Any?): Boolean = other is NotNullBasicValue && other.type == type
|
||||||
// We do not differ not-nullable values, so we should always return the same hashCode
|
// We do not differ not-nullable values, so we should always return the same hashCode
|
||||||
// Actually it doesn't really matter because analyzer is not supposed to store values in hashtables
|
// Actually it doesn't really matter because analyzer is not supposed to store values in hashtables
|
||||||
override fun hashCode() = 0
|
override fun hashCode() = 0
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
sealed class Result {
|
||||||
|
class Failure(val exception: Exception) : Result()
|
||||||
|
class Success(val message: String) : Result()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
var result: Result
|
||||||
|
try {
|
||||||
|
result = Result.Success("OK")
|
||||||
|
}
|
||||||
|
catch (e: Exception) {
|
||||||
|
result = Result.Failure(Exception())
|
||||||
|
}
|
||||||
|
|
||||||
|
when (result) {
|
||||||
|
is Result.Failure -> throw result.exception
|
||||||
|
is Result.Success -> return result.message
|
||||||
|
}
|
||||||
|
}
|
||||||
+6
@@ -16229,6 +16229,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt18779.kt")
|
||||||
|
public void testKt18779() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/regressions/kt18779.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt1932.kt")
|
@TestMetadata("kt1932.kt")
|
||||||
public void testKt1932() throws Exception {
|
public void testKt1932() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/regressions/kt1932.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/regressions/kt1932.kt");
|
||||||
|
|||||||
@@ -16229,6 +16229,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt18779.kt")
|
||||||
|
public void testKt18779() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/regressions/kt18779.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt1932.kt")
|
@TestMetadata("kt1932.kt")
|
||||||
public void testKt1932() throws Exception {
|
public void testKt1932() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/regressions/kt1932.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/regressions/kt1932.kt");
|
||||||
|
|||||||
@@ -16229,6 +16229,12 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt18779.kt")
|
||||||
|
public void testKt18779() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/regressions/kt18779.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt1932.kt")
|
@TestMetadata("kt1932.kt")
|
||||||
public void testKt1932() throws Exception {
|
public void testKt1932() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/regressions/kt1932.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/regressions/kt1932.kt");
|
||||||
|
|||||||
@@ -19895,6 +19895,12 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt18779.kt")
|
||||||
|
public void testKt18779() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/regressions/kt18779.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt1932.kt")
|
@TestMetadata("kt1932.kt")
|
||||||
public void testKt1932() throws Exception {
|
public void testKt1932() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/regressions/kt1932.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/regressions/kt1932.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user