[FIR] Properly approximate return type of callable declarations
- approximate intersection types in all non-local declarations - approximate local types in non-private non-local declarations
This commit is contained in:
committed by
Space Team
parent
0f70635fcb
commit
01c6c7dc59
+3
-3
@@ -70,13 +70,13 @@ public abstract interface I /* I*/ {
|
||||
|
||||
public final class InvalidPublicSupertype /* InvalidPublicSupertype*/ {
|
||||
@org.jetbrains.annotations.NotNull()
|
||||
private final java.lang.Object x;
|
||||
private final java.lang.Runnable x;
|
||||
|
||||
@org.jetbrains.annotations.NotNull()
|
||||
public final java.lang.Object bar();// bar()
|
||||
public final java.lang.Runnable bar();// bar()
|
||||
|
||||
@org.jetbrains.annotations.NotNull()
|
||||
public final java.lang.Object getX();// getX()
|
||||
public final java.lang.Runnable getX();// getX()
|
||||
|
||||
public InvalidPublicSupertype();// .ctor()
|
||||
|
||||
|
||||
+3
-3
@@ -36,11 +36,11 @@ fun test2(b: Boolean) {
|
||||
}
|
||||
|
||||
fun test3(b: Boolean) {
|
||||
var x = <!DEBUG_INFO_EXPRESSION_TYPE("<anonymous>")!>foo3 { 1 }<!>
|
||||
var x = <!DEBUG_INFO_EXPRESSION_TYPE("I1")!>foo3 { 1 }<!>
|
||||
if (b) {
|
||||
x = <!DEBUG_INFO_EXPRESSION_TYPE("<anonymous>")!>foo3 { 2 }<!>
|
||||
x = <!DEBUG_INFO_EXPRESSION_TYPE("I1")!>foo3 { 2 }<!>
|
||||
}
|
||||
x.bar()
|
||||
x.<!UNRESOLVED_REFERENCE!>bar<!>()
|
||||
}
|
||||
|
||||
fun test4(b: Boolean) {
|
||||
|
||||
@@ -36,11 +36,11 @@ fun test2(b: Boolean) {
|
||||
}
|
||||
|
||||
fun test3(b: Boolean) {
|
||||
var x = <!DEBUG_INFO_EXPRESSION_TYPE("<anonymous>")!>foo3 { 1 }<!>
|
||||
var x = <!DEBUG_INFO_EXPRESSION_TYPE("I1")!>foo3 { 1 }<!>
|
||||
if (b) {
|
||||
x = <!DEBUG_INFO_EXPRESSION_TYPE("<anonymous>")!>foo3 { 2 }<!>
|
||||
x = <!DEBUG_INFO_EXPRESSION_TYPE("I1")!>foo3 { 2 }<!>
|
||||
}
|
||||
x.bar()
|
||||
x.<!UNRESOLVED_REFERENCE!>bar<!>()
|
||||
}
|
||||
|
||||
fun test4(b: Boolean) {
|
||||
|
||||
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
// FIR_IDENTICAL
|
||||
// WITH_STDLIB
|
||||
|
||||
private val PRIMITIVE_CLASSES = listOf(Boolean::class, Byte::class, Char::class, Double::class, Float::class, Int::class, Long::class, Short::class)
|
||||
|
||||
// Map
|
||||
private val PRIMITIVE_TO_WRAPPER = PRIMITIVE_CLASSES.map { it.javaPrimitiveType to it.javaObjectType }.toMap()
|
||||
private val WRAPPER_TO_PRIMITIVE = PRIMITIVE_CLASSES.map { it.javaObjectType to it.javaPrimitiveType }.toMap()
|
||||
|
||||
val Class<*>.primitiveByWrapper: Class<*>?
|
||||
get() = WRAPPER_TO_PRIMITIVE[this]
|
||||
|
||||
val Class<*>.wrapperByPrimitive: Class<*>?
|
||||
get() = PRIMITIVE_TO_WRAPPER[this]
|
||||
compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/moreOnlyInputTypes.txt
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
package
|
||||
|
||||
private val PRIMITIVE_CLASSES: kotlin.collections.List<kotlin.reflect.KClass<out kotlin.Any>>
|
||||
private val PRIMITIVE_TO_WRAPPER: kotlin.collections.Map<java.lang.Class<out kotlin.Any>?, java.lang.Class<out kotlin.Any>>
|
||||
private val WRAPPER_TO_PRIMITIVE: kotlin.collections.Map<java.lang.Class<out kotlin.Any>, java.lang.Class<out kotlin.Any>?>
|
||||
public val java.lang.Class<*>.primitiveByWrapper: java.lang.Class<*>?
|
||||
public val java.lang.Class<*>.wrapperByPrimitive: java.lang.Class<*>?
|
||||
Reference in New Issue
Block a user