FIR: Fix incorrect optimization for integer literals
This commit is contained in:
@@ -45,7 +45,7 @@ interface ConeTypeContext : TypeSystemContext, TypeSystemOptimizationContext, Ty
|
||||
override fun SimpleTypeMarker.fastCorrespondingSupertypes(constructor: TypeConstructorMarker): List<SimpleTypeMarker>? {
|
||||
require(this is ConeKotlinType)
|
||||
return if (this is ConeIntegerLiteralType) {
|
||||
supertypes
|
||||
supertypes.filter { isEqualTypeConstructors(constructor, it.typeConstructor()) }
|
||||
} else {
|
||||
session.correspondingSupertypesCache.getCorrespondingSupertypes(this, constructor)
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -8,7 +8,7 @@ interface Foo<F> {
|
||||
fun <S> select(vararg args: S): S = TODO()
|
||||
|
||||
class Bar<B : B> : Foo<B> {
|
||||
val v = <!DEBUG_INFO_EXPRESSION_TYPE("B?")!>select(
|
||||
val v = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any?")!>select(
|
||||
getSum(),
|
||||
42
|
||||
)<!>
|
||||
|
||||
@@ -4,7 +4,7 @@ package collections
|
||||
fun <T> testCollection(c: Collection<T>, t: T) {
|
||||
c.size
|
||||
c.isEmpty()
|
||||
c.contains(1)
|
||||
c.<!INAPPLICABLE_CANDIDATE!>contains<!>(1)
|
||||
val iterator: Iterator<T> = c.iterator()
|
||||
c.containsAll(c)
|
||||
|
||||
@@ -20,7 +20,7 @@ fun <T> testCollection(c: Collection<T>, t: T) {
|
||||
fun <T> testMutableCollection(c: MutableCollection<T>, t: T) {
|
||||
c.size
|
||||
c.isEmpty()
|
||||
c.contains(1)
|
||||
c.<!INAPPLICABLE_CANDIDATE!>contains<!>(1)
|
||||
val iterator: Iterator<T> = c.iterator()
|
||||
c.containsAll(c)
|
||||
|
||||
@@ -62,7 +62,7 @@ fun <T> testMutableList(l: MutableList<T>, t: T) {
|
||||
fun <T> testSet(s: Set<T>, t: T) {
|
||||
s.size
|
||||
s.isEmpty()
|
||||
s.contains(1)
|
||||
s.<!INAPPLICABLE_CANDIDATE!>contains<!>(1)
|
||||
val iterator: Iterator<T> = s.iterator()
|
||||
s.containsAll(s)
|
||||
|
||||
@@ -78,7 +78,7 @@ fun <T> testSet(s: Set<T>, t: T) {
|
||||
fun <T> testMutableSet(s: MutableSet<T>, t: T) {
|
||||
s.size
|
||||
s.isEmpty()
|
||||
s.contains(1)
|
||||
s.<!INAPPLICABLE_CANDIDATE!>contains<!>(1)
|
||||
val iterator: Iterator<T> = s.iterator()
|
||||
s.containsAll(s)
|
||||
|
||||
@@ -108,4 +108,4 @@ fun <K, V> testMutableMap(m: MutableMap<K, V>) {
|
||||
val mutableSet1: MutableSet<MutableMap.MutableEntry<K, V>> = m.entries
|
||||
}
|
||||
|
||||
fun <T> array(vararg t: T): Array<T> {}
|
||||
fun <T> array(vararg t: T): Array<T> {}
|
||||
|
||||
Vendored
+1
-1
@@ -2,7 +2,7 @@
|
||||
// FILE: KotlinFile.kt
|
||||
fun foo(javaClass: JavaClass<Int>): Int {
|
||||
val inner = javaClass.createInner<String>()
|
||||
return inner.doSomething(1, "") { }
|
||||
return inner.<!INAPPLICABLE_CANDIDATE!>doSomething<!>(1, "") { }
|
||||
}
|
||||
|
||||
// FILE: JavaClass.java
|
||||
|
||||
+14
-14
@@ -11,10 +11,10 @@ FILE fqName:<root> fileName:/kt30796.kt
|
||||
VALUE_PARAMETER name:value2 index:1 type:T of <root>.test
|
||||
BLOCK_BODY
|
||||
VAR name:x1 type:kotlin.Any [val]
|
||||
BLOCK type=T of <root>.test origin=ELVIS
|
||||
BLOCK type=kotlin.Any origin=ELVIS
|
||||
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:T of <root>.test [val]
|
||||
GET_VAR 'value: T of <root>.test declared in <root>.test' type=T of <root>.test origin=null
|
||||
WHEN type=T of <root>.test origin=ELVIS
|
||||
WHEN type=kotlin.Any origin=ELVIS
|
||||
BRANCH
|
||||
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
|
||||
arg0: GET_VAR 'val tmp_0: T of <root>.test [val] declared in <root>.test' type=T of <root>.test origin=null
|
||||
@@ -24,18 +24,18 @@ FILE fqName:<root> fileName:/kt30796.kt
|
||||
if: CONST Boolean type=kotlin.Boolean value=true
|
||||
then: GET_VAR 'val tmp_0: T of <root>.test [val] declared in <root>.test' type=T of <root>.test origin=null
|
||||
VAR name:x2 type:kotlin.Any [val]
|
||||
BLOCK type=T of <root>.test origin=ELVIS
|
||||
BLOCK type=kotlin.Any origin=ELVIS
|
||||
VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:T of <root>.test [val]
|
||||
GET_VAR 'value: T of <root>.test declared in <root>.test' type=T of <root>.test origin=null
|
||||
WHEN type=T of <root>.test origin=ELVIS
|
||||
WHEN type=kotlin.Any origin=ELVIS
|
||||
BRANCH
|
||||
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
|
||||
arg0: GET_VAR 'val tmp_1: T of <root>.test [val] declared in <root>.test' type=T of <root>.test origin=null
|
||||
arg1: CONST Null type=kotlin.Nothing? value=null
|
||||
then: BLOCK type=T of <root>.test origin=ELVIS
|
||||
then: BLOCK type=kotlin.Any origin=ELVIS
|
||||
VAR IR_TEMPORARY_VARIABLE name:tmp_2 type:T of <root>.test [val]
|
||||
GET_VAR 'value2: T of <root>.test declared in <root>.test' type=T of <root>.test origin=null
|
||||
WHEN type=T of <root>.test origin=ELVIS
|
||||
WHEN type=kotlin.Any origin=ELVIS
|
||||
BRANCH
|
||||
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
|
||||
arg0: GET_VAR 'val tmp_2: T of <root>.test [val] declared in <root>.test' type=T of <root>.test origin=null
|
||||
@@ -48,7 +48,7 @@ FILE fqName:<root> fileName:/kt30796.kt
|
||||
if: CONST Boolean type=kotlin.Boolean value=true
|
||||
then: GET_VAR 'val tmp_1: T of <root>.test [val] declared in <root>.test' type=T of <root>.test origin=null
|
||||
VAR name:x3 type:kotlin.Any [val]
|
||||
BLOCK type=T of <root>.test origin=ELVIS
|
||||
BLOCK type=kotlin.Any origin=ELVIS
|
||||
VAR IR_TEMPORARY_VARIABLE name:tmp_3 type:T of <root>.test [val]
|
||||
BLOCK type=T of <root>.test origin=ELVIS
|
||||
VAR IR_TEMPORARY_VARIABLE name:tmp_4 type:T of <root>.test [val]
|
||||
@@ -62,7 +62,7 @@ FILE fqName:<root> fileName:/kt30796.kt
|
||||
BRANCH
|
||||
if: CONST Boolean type=kotlin.Boolean value=true
|
||||
then: GET_VAR 'val tmp_4: T of <root>.test [val] declared in <root>.test' type=T of <root>.test origin=null
|
||||
WHEN type=T of <root>.test origin=ELVIS
|
||||
WHEN type=kotlin.Any origin=ELVIS
|
||||
BRANCH
|
||||
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
|
||||
arg0: GET_VAR 'val tmp_3: T of <root>.test [val] declared in <root>.test' type=T of <root>.test origin=null
|
||||
@@ -72,7 +72,7 @@ FILE fqName:<root> fileName:/kt30796.kt
|
||||
if: CONST Boolean type=kotlin.Boolean value=true
|
||||
then: GET_VAR 'val tmp_3: T of <root>.test [val] declared in <root>.test' type=T of <root>.test origin=null
|
||||
VAR name:x4 type:kotlin.Any [val]
|
||||
BLOCK type=T of <root>.test origin=ELVIS
|
||||
BLOCK type=kotlin.Any origin=ELVIS
|
||||
VAR IR_TEMPORARY_VARIABLE name:tmp_5 type:T of <root>.test [val]
|
||||
BLOCK type=T of <root>.test origin=ELVIS
|
||||
VAR IR_TEMPORARY_VARIABLE name:tmp_6 type:T of <root>.test [val]
|
||||
@@ -86,7 +86,7 @@ FILE fqName:<root> fileName:/kt30796.kt
|
||||
BRANCH
|
||||
if: CONST Boolean type=kotlin.Boolean value=true
|
||||
then: GET_VAR 'val tmp_6: T of <root>.test [val] declared in <root>.test' type=T of <root>.test origin=null
|
||||
WHEN type=T of <root>.test origin=ELVIS
|
||||
WHEN type=kotlin.Any origin=ELVIS
|
||||
BRANCH
|
||||
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
|
||||
arg0: GET_VAR 'val tmp_5: T of <root>.test [val] declared in <root>.test' type=T of <root>.test origin=null
|
||||
@@ -111,7 +111,7 @@ FILE fqName:<root> fileName:/kt30796.kt
|
||||
then: TYPE_OP type=kotlin.Int origin=IMPLICIT_CAST typeOperand=kotlin.Int
|
||||
GET_VAR 'val tmp_7: kotlin.Int? [val] declared in <root>.test' type=kotlin.Int? origin=null
|
||||
VAR name:x6 type:kotlin.Any [val]
|
||||
BLOCK type=T of <root>.test origin=ELVIS
|
||||
BLOCK type=kotlin.Any origin=ELVIS
|
||||
VAR IR_TEMPORARY_VARIABLE name:tmp_8 type:T of <root>.test [val]
|
||||
BLOCK type=T of <root>.test origin=ELVIS
|
||||
VAR IR_TEMPORARY_VARIABLE name:tmp_9 type:T of <root>.test [val]
|
||||
@@ -126,7 +126,7 @@ FILE fqName:<root> fileName:/kt30796.kt
|
||||
BRANCH
|
||||
if: CONST Boolean type=kotlin.Boolean value=true
|
||||
then: GET_VAR 'val tmp_9: T of <root>.test [val] declared in <root>.test' type=T of <root>.test origin=null
|
||||
WHEN type=T of <root>.test origin=ELVIS
|
||||
WHEN type=kotlin.Any origin=ELVIS
|
||||
BRANCH
|
||||
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
|
||||
arg0: GET_VAR 'val tmp_8: T of <root>.test [val] declared in <root>.test' type=T of <root>.test origin=null
|
||||
@@ -136,7 +136,7 @@ FILE fqName:<root> fileName:/kt30796.kt
|
||||
if: CONST Boolean type=kotlin.Boolean value=true
|
||||
then: GET_VAR 'val tmp_8: T of <root>.test [val] declared in <root>.test' type=T of <root>.test origin=null
|
||||
VAR name:x7 type:kotlin.Any [val]
|
||||
BLOCK type=T of <root>.test origin=ELVIS
|
||||
BLOCK type=kotlin.Any origin=ELVIS
|
||||
VAR IR_TEMPORARY_VARIABLE name:tmp_10 type:T of <root>.test? [val]
|
||||
BLOCK type=T of <root>.test? origin=ELVIS
|
||||
VAR IR_TEMPORARY_VARIABLE name:tmp_11 type:T of <root>.test? [val]
|
||||
@@ -152,7 +152,7 @@ FILE fqName:<root> fileName:/kt30796.kt
|
||||
if: CONST Boolean type=kotlin.Boolean value=true
|
||||
then: TYPE_OP type=T of <root>.test origin=IMPLICIT_CAST typeOperand=T of <root>.test
|
||||
GET_VAR 'val tmp_11: T of <root>.test? [val] declared in <root>.test' type=T of <root>.test? origin=null
|
||||
WHEN type=T of <root>.test origin=ELVIS
|
||||
WHEN type=kotlin.Any origin=ELVIS
|
||||
BRANCH
|
||||
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
|
||||
arg0: GET_VAR 'val tmp_10: T of <root>.test? [val] declared in <root>.test' type=T of <root>.test? origin=null
|
||||
|
||||
@@ -17,7 +17,7 @@ open class Case1<K : Number> {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("M & L & K & T!! & kotlin.Any?")!>x<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("M & L & K & T!! & kotlin.Any?")!>x<!>.toByte()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("M & L & K & T!! & kotlin.Any?")!>x<!>.length
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("M & L & K & T!! & kotlin.Any?")!>x<!>.<!AMBIGUITY!>get<!>(0)
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("M & L & K & T!! & kotlin.Any?")!>x<!>.get(0)
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("M & L & K & T!! & kotlin.Any?")!>x<!>.size
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("M & L & K & T!! & kotlin.Any?")!>x<!>.isEmpty()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("M & L & K & T!! & kotlin.Any?")!>x<!>[null]
|
||||
|
||||
@@ -17,7 +17,7 @@ open class Case1<K : Number> {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("M & L & K & T!! & kotlin.Any?")!>x<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("M & L & K & T!! & kotlin.Any?")!>x<!>.toByte()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("M & L & K & T!! & kotlin.Any?")!>x<!>.length
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("M & L & K & T!! & kotlin.Any?")!>x<!>.<!AMBIGUITY!>get<!>(0)
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("M & L & K & T!! & kotlin.Any?")!>x<!>.get(0)
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("M & L & K & T!! & kotlin.Any?")!>x<!>.size
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("M & L & K & T!! & kotlin.Any?")!>x<!>.isEmpty()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("M & L & K & T!! & kotlin.Any?")!>x<!>[null]
|
||||
|
||||
@@ -17,7 +17,7 @@ open class Case1<K : Number> {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("M & L & K & T!! & kotlin.Any?")!>x<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("M & L & K & T!! & kotlin.Any?")!>x<!>.toByte()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("M & L & K & T!! & kotlin.Any?")!>x<!>.length
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("M & L & K & T!! & kotlin.Any?")!>x<!>.<!AMBIGUITY!>get<!>(0)
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("M & L & K & T!! & kotlin.Any?")!>x<!>.get(0)
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("M & L & K & T!! & kotlin.Any?")!>x<!>.size
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("M & L & K & T!! & kotlin.Any?")!>x<!>.isEmpty()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("M & L & K & T!! & kotlin.Any?")!>x<!>[null]
|
||||
|
||||
Reference in New Issue
Block a user