Add 'Collection#contains' as a special case to psi2ir tests

This commit is contained in:
Dmitry Petrov
2019-12-03 11:47:21 +03:00
parent 26782d7216
commit 429bf78afa
3 changed files with 135 additions and 0 deletions
@@ -2,9 +2,66 @@ FILE fqName:<root> fileName:/implicitNotNullOnPlatformType.kt
FUN name:f visibility:public modality:FINAL <> (s:kotlin.String) returnType:kotlin.Unit
VALUE_PARAMETER name:s index:0 type:kotlin.String
BLOCK_BODY
CLASS CLASS name:MySet modality:FINAL visibility:public superTypes:[kotlin.collections.Set<kotlin.String>]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.MySet
CONSTRUCTOR visibility:public <> () returnType:<root>.MySet [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:MySet modality:FINAL visibility:public superTypes:[kotlin.collections.Set<kotlin.String>]'
PROPERTY name:size visibility:public modality:FINAL [val]
FUN name:<get-size> visibility:public modality:FINAL <> ($this:<root>.MySet) returnType:kotlin.Int
correspondingProperty: PROPERTY name:size visibility:public modality:FINAL [val]
$this: VALUE_PARAMETER name:<this> type:<root>.MySet
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-size> (): kotlin.Int declared in <root>.MySet'
CALL 'public final fun TODO (): kotlin.Nothing [inline] declared in kotlin' type=kotlin.Nothing origin=null
FUN name:contains visibility:public modality:FINAL <> ($this:<root>.MySet, element:kotlin.String) returnType:kotlin.Boolean
$this: VALUE_PARAMETER name:<this> type:<root>.MySet
VALUE_PARAMETER name:element index:0 type:kotlin.String
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun contains (element: kotlin.String): kotlin.Boolean declared in <root>.MySet'
CALL 'public final fun TODO (): kotlin.Nothing [inline] declared in kotlin' type=kotlin.Nothing origin=null
FUN name:containsAll visibility:public modality:FINAL <> ($this:<root>.MySet, elements:kotlin.collections.Collection<kotlin.String>) returnType:kotlin.Boolean
$this: VALUE_PARAMETER name:<this> type:<root>.MySet
VALUE_PARAMETER name:elements index:0 type:kotlin.collections.Collection<kotlin.String>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun containsAll (elements: kotlin.collections.Collection<kotlin.String>): kotlin.Boolean declared in <root>.MySet'
CALL 'public final fun TODO (): kotlin.Nothing [inline] declared in kotlin' type=kotlin.Nothing origin=null
FUN name:isEmpty visibility:public modality:FINAL <> ($this:<root>.MySet) returnType:kotlin.Boolean
$this: VALUE_PARAMETER name:<this> type:<root>.MySet
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun isEmpty (): kotlin.Boolean declared in <root>.MySet'
CALL 'public final fun TODO (): kotlin.Nothing [inline] declared in kotlin' type=kotlin.Nothing origin=null
FUN name:iterator visibility:public modality:FINAL <> ($this:<root>.MySet) returnType:kotlin.collections.Iterator<kotlin.String>
$this: VALUE_PARAMETER name:<this> type:<root>.MySet
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun iterator (): kotlin.collections.Iterator<kotlin.String> declared in <root>.MySet'
CALL 'public final fun TODO (): kotlin.Nothing [inline] declared in kotlin' type=kotlin.Nothing origin=null
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN name:test visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
CALL 'public final fun f (s: kotlin.String): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
s: CALL 'public open fun s (): kotlin.String? [operator] declared in <root>.J' type=kotlin.String? origin=null
CALL 'public final fun f (s: kotlin.String): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
s: GET_FIELD 'FIELD IR_EXTERNAL_JAVA_DECLARATION_STUB name:STRING type:kotlin.String? visibility:public [static]' type=kotlin.String? origin=GET_PROPERTY
FUN name:testContains visibility:public modality:FINAL <> (m:<root>.MySet) returnType:kotlin.Unit
VALUE_PARAMETER name:m index:0 type:<root>.MySet
BLOCK_BODY
CALL 'public final fun contains (element: kotlin.String): kotlin.Boolean declared in <root>.MySet' type=kotlin.Boolean origin=null
$this: GET_VAR 'm: <root>.MySet declared in <root>.testContains' type=<root>.MySet origin=null
element: GET_FIELD 'FIELD IR_EXTERNAL_JAVA_DECLARATION_STUB name:STRING type:kotlin.String? visibility:public [static]' type=kotlin.String? origin=GET_PROPERTY
CALL 'public final fun contains (element: kotlin.String): kotlin.Boolean declared in <root>.MySet' type=kotlin.Boolean origin=null
$this: GET_VAR 'm: <root>.MySet declared in <root>.testContains' type=<root>.MySet origin=null
element: CONST String type=kotlin.String value="abc"
@@ -1,11 +1,24 @@
// FILE: implicitNotNullOnPlatformType.kt
fun f(s: String) {}
class MySet : Set<String> {
override val size: Int get() = TODO()
override fun contains(element: String): Boolean = TODO()
override fun containsAll(elements: Collection<String>): Boolean = TODO()
override fun isEmpty(): Boolean = TODO()
override fun iterator(): Iterator<String> = TODO()
}
fun test() {
f(J.s())
f(J.STRING)
}
fun testContains(m: MySet) {
m.contains(J.STRING)
m.contains("abc")
}
// FILE: J.java
public class J {
public static String STRING = s();
@@ -2,6 +2,59 @@ FILE fqName:<root> fileName:/implicitNotNullOnPlatformType.kt
FUN name:f visibility:public modality:FINAL <> (s:kotlin.String) returnType:kotlin.Unit
VALUE_PARAMETER name:s index:0 type:kotlin.String
BLOCK_BODY
CLASS CLASS name:MySet modality:FINAL visibility:public superTypes:[kotlin.collections.Set<kotlin.String>]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.MySet
CONSTRUCTOR visibility:public <> () returnType:<root>.MySet [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:MySet modality:FINAL visibility:public superTypes:[kotlin.collections.Set<kotlin.String>]'
PROPERTY name:size visibility:public modality:OPEN [val]
FUN name:<get-size> visibility:public modality:OPEN <> ($this:<root>.MySet) returnType:kotlin.Int
correspondingProperty: PROPERTY name:size visibility:public modality:OPEN [val]
overridden:
public abstract fun <get-size> (): kotlin.Int declared in kotlin.collections.Set
$this: VALUE_PARAMETER name:<this> type:<root>.MySet
BLOCK_BODY
CALL 'public final fun TODO (): kotlin.Nothing [inline] declared in kotlin' type=kotlin.Nothing origin=null
FUN name:contains visibility:public modality:OPEN <> ($this:<root>.MySet, element:kotlin.String) returnType:kotlin.Boolean [operator]
overridden:
public abstract fun contains (element: E of kotlin.collections.Set): kotlin.Boolean [operator] declared in kotlin.collections.Set
$this: VALUE_PARAMETER name:<this> type:<root>.MySet
VALUE_PARAMETER name:element index:0 type:kotlin.String
BLOCK_BODY
CALL 'public final fun TODO (): kotlin.Nothing [inline] declared in kotlin' type=kotlin.Nothing origin=null
FUN name:containsAll visibility:public modality:OPEN <> ($this:<root>.MySet, elements:kotlin.collections.Collection<kotlin.String>) returnType:kotlin.Boolean
overridden:
public abstract fun containsAll (elements: kotlin.collections.Collection<E of kotlin.collections.Set>): kotlin.Boolean declared in kotlin.collections.Set
$this: VALUE_PARAMETER name:<this> type:<root>.MySet
VALUE_PARAMETER name:elements index:0 type:kotlin.collections.Collection<kotlin.String>
BLOCK_BODY
CALL 'public final fun TODO (): kotlin.Nothing [inline] declared in kotlin' type=kotlin.Nothing origin=null
FUN name:isEmpty visibility:public modality:OPEN <> ($this:<root>.MySet) returnType:kotlin.Boolean
overridden:
public abstract fun isEmpty (): kotlin.Boolean declared in kotlin.collections.Set
$this: VALUE_PARAMETER name:<this> type:<root>.MySet
BLOCK_BODY
CALL 'public final fun TODO (): kotlin.Nothing [inline] declared in kotlin' type=kotlin.Nothing origin=null
FUN name:iterator visibility:public modality:OPEN <> ($this:<root>.MySet) returnType:kotlin.collections.Iterator<kotlin.String> [operator]
overridden:
public abstract fun iterator (): kotlin.collections.Iterator<E of kotlin.collections.Set> [operator] declared in kotlin.collections.Set
$this: VALUE_PARAMETER name:<this> type:<root>.MySet
BLOCK_BODY
CALL 'public final fun TODO (): kotlin.Nothing [inline] declared in kotlin' type=kotlin.Nothing origin=null
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in kotlin.collections.Set
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int [fake_override] declared in kotlin.collections.Set
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String [fake_override] declared in kotlin.collections.Set
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN name:test visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
CALL 'public final fun f (s: kotlin.String): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
@@ -10,3 +63,15 @@ FILE fqName:<root> fileName:/implicitNotNullOnPlatformType.kt
CALL 'public final fun f (s: kotlin.String): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
s: TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String
GET_FIELD 'FIELD IR_EXTERNAL_JAVA_DECLARATION_STUB name:STRING type:kotlin.String? visibility:public [static]' type=kotlin.String? origin=GET_PROPERTY
FUN name:testContains visibility:public modality:FINAL <> (m:<root>.MySet) returnType:kotlin.Unit
VALUE_PARAMETER name:m index:0 type:<root>.MySet
BLOCK_BODY
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
CALL 'public open fun contains (element: kotlin.String): kotlin.Boolean [operator] declared in <root>.MySet' type=kotlin.Boolean origin=null
$this: GET_VAR 'm: <root>.MySet declared in <root>.testContains' type=<root>.MySet origin=null
element: TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String
GET_FIELD 'FIELD IR_EXTERNAL_JAVA_DECLARATION_STUB name:STRING type:kotlin.String? visibility:public [static]' type=kotlin.String? origin=GET_PROPERTY
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
CALL 'public open fun contains (element: kotlin.String): kotlin.Boolean [operator] declared in <root>.MySet' type=kotlin.Boolean origin=null
$this: GET_VAR 'm: <root>.MySet declared in <root>.testContains' type=<root>.MySet origin=null
element: CONST String type=kotlin.String value="abc"