From a5b224fda183ecf4ac696973d187abff2fb7baed Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Thu, 5 Nov 2020 23:27:41 +0300 Subject: [PATCH] [IR] add new testdata after rebase --- .../ir/irText/classes/cloneable.kt.txt | 49 ++++++ ...egatedImplementationOfJavaInterface.kt.txt | 42 +++++ .../annotationsOnDelegatedMembers.kt.txt | 58 +++++++ .../inlineCollectionOfInlineClass.kt.txt | 115 +++++++++++++ .../exhaustiveWhenElseBranch.kt.txt | 123 ++++++++++++++ .../sam/genericSamSmartcast.kt.txt | 12 ++ .../firProblems/AbstractMutableMap.kt.txt | 40 +++++ .../irText/firProblems/AllCandidates.kt.txt | 38 +++++ .../firProblems/AnnotationInAnnotation.kt.txt | 39 +++++ .../ClashResolutionDescriptor.kt.txt | 77 +++++++++ .../irText/firProblems/DeepCopyIrTree.kt.txt | 97 +++++++++++ .../DelegationAndInheritanceFromJava.kt.txt | 62 +++++++ .../firProblems/InnerClassInAnonymous.kt.txt | 60 +++++++ .../ir/irText/firProblems/MultiList.kt.txt | 159 ++++++++++++++++++ .../SameJavaFieldReferences.kt.txt | 5 + .../irText/firProblems/SignatureClash.kt.txt | 91 ++++++++++ .../ir/irText/firProblems/VarInInit.kt.txt | 25 +++ .../irText/firProblems/candidateSymbol.kt.txt | 67 ++++++++ .../coercionToUnitForNestedWhen.kt.txt | 40 +++++ .../ir/irText/firProblems/putIfAbsent.kt.txt | 17 ++ .../irText/firProblems/v8arrayToList.kt.txt | 18 ++ .../ir/irText/types/javaWildcardType.kt.txt | 56 ++++++ .../nnStringVsT.kt.txt | 11 ++ .../nnStringVsTAny.kt.txt | 11 ++ .../nnStringVsTConstrained.kt.txt | 11 ++ .../nnStringVsTXArray.kt.txt | 11 ++ .../nnStringVsTXString.kt.txt | 11 ++ .../nullCheckOnLambdaResult/stringVsT.kt.txt | 11 ++ .../stringVsTAny.kt.txt | 11 ++ .../stringVsTConstrained.kt.txt | 11 ++ .../stringVsTXArray.kt.txt | 11 ++ .../stringVsTXString.kt.txt | 11 ++ .../ir/irText/types/rawTypeInSignature.kt.txt | 93 ++++++++++ 33 files changed, 1493 insertions(+) create mode 100644 compiler/testData/ir/irText/classes/cloneable.kt.txt create mode 100644 compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/inlineCollectionOfInlineClass.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/exhaustiveWhenElseBranch.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/sam/genericSamSmartcast.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/AbstractMutableMap.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/AllCandidates.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/AnnotationInAnnotation.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/ClashResolutionDescriptor.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/DeepCopyIrTree.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/InnerClassInAnonymous.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/MultiList.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/SameJavaFieldReferences.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/SignatureClash.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/VarInInit.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/candidateSymbol.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/coercionToUnitForNestedWhen.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/putIfAbsent.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/v8arrayToList.kt.txt create mode 100644 compiler/testData/ir/irText/types/javaWildcardType.kt.txt create mode 100644 compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsT.kt.txt create mode 100644 compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsTAny.kt.txt create mode 100644 compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsTConstrained.kt.txt create mode 100644 compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsTXArray.kt.txt create mode 100644 compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsTXString.kt.txt create mode 100644 compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsT.kt.txt create mode 100644 compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTAny.kt.txt create mode 100644 compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTConstrained.kt.txt create mode 100644 compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTXArray.kt.txt create mode 100644 compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTXString.kt.txt create mode 100644 compiler/testData/ir/irText/types/rawTypeInSignature.kt.txt diff --git a/compiler/testData/ir/irText/classes/cloneable.kt.txt b/compiler/testData/ir/irText/classes/cloneable.kt.txt new file mode 100644 index 00000000000..52bc36eeb0c --- /dev/null +++ b/compiler/testData/ir/irText/classes/cloneable.kt.txt @@ -0,0 +1,49 @@ +class A : Cloneable { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + +} + +interface I : Cloneable { + + + + +} + +class C : I { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + +} + +class OC : I { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + protected override fun clone(): OC { + return TODO("IrConstructorCall") + } + + + + +} + diff --git a/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.kt.txt b/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.kt.txt new file mode 100644 index 00000000000..3a45ad54790 --- /dev/null +++ b/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.kt.txt @@ -0,0 +1,42 @@ +class Test : J { + constructor(j: J) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + private val j: J + field = j + private get + + @NotNull(...) + override fun returnNotNull(): @EnhancedNullability String { + return #j.returnNotNull() + } + + @Nullable(...) + override fun returnNullable(): @EnhancedNullability String? { + return #j.returnNullable() + } + + override fun returnsFlexible(): @FlexibleNullability String? { + return #j.returnsFlexible() + } + + override fun takeFlexible(x: @FlexibleNullability String?) { + #j.takeFlexible(x = x) + } + + override fun takeNotNull(x: @EnhancedNullability String) { + #j.takeNotNull(x = x) + } + + override fun takeNullable(x: @EnhancedNullability String?) { + #j.takeNullable(x = x) + } + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.kt.txt b/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.kt.txt new file mode 100644 index 00000000000..eee0a88853e --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.kt.txt @@ -0,0 +1,58 @@ +annotation class Ann : Annotation { + constructor() /* primary */ + + + +} + +interface IFoo { + @Ann + abstract val testVal: String + abstract get + + @Ann + abstract fun testFun() + @Ann + abstract val String.testExtVal: String + abstract get + + @Ann + abstract fun String.testExtFun() + + + +} + +class DFoo : IFoo { + constructor(d: IFoo) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + private /*final field*/ val $$delegate_0: IFoo = d + @Ann + override fun String.testExtFun() { + #$$delegate_0.testExtFun($receiver = ) + } + + @Ann + override fun testFun() { + #$$delegate_0.testFun() + } + + override val String.testExtVal: String + override get(): String { + return #$$delegate_0.($receiver = ) + } + + override val testVal: String + override get(): String { + return #$$delegate_0.() + } + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/inlineCollectionOfInlineClass.kt.txt b/compiler/testData/ir/irText/declarations/inlineCollectionOfInlineClass.kt.txt new file mode 100644 index 00000000000..ab6ed5434a2 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/inlineCollectionOfInlineClass.kt.txt @@ -0,0 +1,115 @@ +inline class IT { + constructor(x: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = x + get + + override fun toString(): String { + return "IT(" + +"x=" + +#x + +")" + } + + override fun hashCode(): Int { + return #x.hashCode() + } + + override operator fun equals(other: Any?): Boolean { + when { + other !is IT -> return false + } + val tmp0_other_with_cast: IT = other as IT + when { + EQEQ(arg0 = #x, arg1 = #x).not() -> return false + } + return true + } + +} + +inline class InlineMutableSet : MutableSet { + constructor(ms: MutableSet) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + private val ms: MutableSet + field = ms + private get + + override val size: Int + override get(): Int { + return .().() + } + + override operator fun contains(element: IT): Boolean { + return .().contains(element = element) + } + + override fun containsAll(elements: Collection): Boolean { + return .().containsAll(elements = elements) + } + + override fun isEmpty(): Boolean { + return .().isEmpty() + } + + override fun add(element: IT): Boolean { + return .().add(element = element) + } + + override fun addAll(elements: Collection): Boolean { + return .().addAll(elements = elements) + } + + override fun clear() { + .().clear() + } + + override operator fun iterator(): MutableIterator { + return .().iterator() + } + + override fun remove(element: IT): Boolean { + return .().remove(element = element) + } + + override fun removeAll(elements: Collection): Boolean { + return .().removeAll(elements = elements) + } + + override fun retainAll(elements: Collection): Boolean { + return .().retainAll(elements = elements) + } + + override fun toString(): String { + return "InlineMutableSet(" + +"ms=" + +#ms + +")" + } + + override fun hashCode(): Int { + return #ms.hashCode() + } + + override operator fun equals(other: Any?): Boolean { + when { + other !is InlineMutableSet -> return false + } + val tmp0_other_with_cast: InlineMutableSet = other as InlineMutableSet + when { + EQEQ(arg0 = #ms, arg1 = #ms).not() -> return false + } + return true + } + +} + diff --git a/compiler/testData/ir/irText/expressions/exhaustiveWhenElseBranch.kt.txt b/compiler/testData/ir/irText/expressions/exhaustiveWhenElseBranch.kt.txt new file mode 100644 index 00000000000..add11e0452e --- /dev/null +++ b/compiler/testData/ir/irText/expressions/exhaustiveWhenElseBranch.kt.txt @@ -0,0 +1,123 @@ +enum class A : Enum { + private constructor() /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + V1 init = TODO("IrEnumConstructorCall") + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): A /* Synthetic body for ENUM_VALUEOF */ + +} + +fun testVariableAssignment_throws(a: A) { + val x: Int + { //BLOCK + val tmp0_subject: A = a + when { + EQEQ(arg0 = tmp0_subject, arg1 = A) -> x = 11 + true -> noWhenBranchMatchedException() + } + } +} + +fun testStatement_empty(a: A) { + { //BLOCK + val tmp0_subject: A = a + when { + EQEQ(arg0 = tmp0_subject, arg1 = A) -> 1 /*~> Unit */ + } + } +} + +fun testParenthesized_throwsJvm(a: A) { + { //BLOCK + val tmp0_subject: A = a + when { + EQEQ(arg0 = tmp0_subject, arg1 = A) -> 1 /*~> Unit */ + } + } +} + +fun testAnnotated_throwsJvm(a: A) { + { //BLOCK + val tmp0_subject: A = a + when { + EQEQ(arg0 = tmp0_subject, arg1 = A) -> 1 /*~> Unit */ + } + } +} + +fun testExpression_throws(a: A): Int { + return { //BLOCK + val tmp0_subject: A = a + when { + EQEQ(arg0 = tmp0_subject, arg1 = A) -> 1 + true -> noWhenBranchMatchedException() + } + } +} + +fun testIfTheElseStatement_empty(a: A, flag: Boolean) { + when { + flag -> 0 /*~> Unit */ + true -> { //BLOCK + { //BLOCK + val tmp0_subject: A = a + when { + EQEQ(arg0 = tmp0_subject, arg1 = A) -> 1 /*~> Unit */ + } + } + } + } +} + +fun testIfTheElseParenthesized_throwsJvm(a: A, flag: Boolean) { + when { + flag -> 0 /*~> Unit */ + true -> { //BLOCK + { //BLOCK + val tmp0_subject: A = a + when { + EQEQ(arg0 = tmp0_subject, arg1 = A) -> 1 /*~> Unit */ + } + } + } + } +} + +fun testIfTheElseAnnotated_throwsJvm(a: A, flag: Boolean) { + when { + flag -> 0 /*~> Unit */ + true -> { //BLOCK + { //BLOCK + val tmp0_subject: A = a + when { + EQEQ(arg0 = tmp0_subject, arg1 = A) -> 1 /*~> Unit */ + } + } + } + } +} + +fun testLambdaResultExpression_throws(a: A) { + local fun (): Int { + return { //BLOCK + val tmp0_subject: A = a + when { + EQEQ(arg0 = tmp0_subject, arg1 = A) -> 1 + true -> noWhenBranchMatchedException() + } + } + } +.invoke() /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/expressions/sam/genericSamSmartcast.kt.txt b/compiler/testData/ir/irText/expressions/sam/genericSamSmartcast.kt.txt new file mode 100644 index 00000000000..1f3d46dbcf1 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/sam/genericSamSmartcast.kt.txt @@ -0,0 +1,12 @@ +fun f(x: Any): String { + when { + x is A<*> -> { //BLOCK + return x /*as A */.call(block = local fun (y: Any?): @FlexibleNullability String? { + return "OK" + } + /*-> @FlexibleNullability I<@FlexibleNullability T?>? */) /*!! String */ + } + } + return "Fail" +} + diff --git a/compiler/testData/ir/irText/firProblems/AbstractMutableMap.kt.txt b/compiler/testData/ir/irText/firProblems/AbstractMutableMap.kt.txt new file mode 100644 index 00000000000..f9802b6e6c8 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/AbstractMutableMap.kt.txt @@ -0,0 +1,40 @@ +class MyMap : AbstractMutableMap { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + override fun put(key: K, value: V): V? { + return null + } + + override val entries: MutableSet> + override get(): MutableSet> { + return mutableSetOf>() + } + + + + + + + + + + + + + + + + + + + + + + + +} + diff --git a/compiler/testData/ir/irText/firProblems/AllCandidates.kt.txt b/compiler/testData/ir/irText/firProblems/AllCandidates.kt.txt new file mode 100644 index 00000000000..eaff1fa52d2 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/AllCandidates.kt.txt @@ -0,0 +1,38 @@ +class ResolvedCall { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +class MyCandidate { + constructor(resolvedCall: ResolvedCall<*>) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val resolvedCall: ResolvedCall<*> + field = resolvedCall + get + + + + +} + +private fun allCandidatesResult(allCandidates: Collection): @FlexibleNullability OverloadResolutionResultsImpl<@FlexibleNullability A?>? { + return apply<@FlexibleNullability OverloadResolutionResultsImpl<@FlexibleNullability A?>?>($receiver = nameNotFound<@FlexibleNullability A?>(), block = local fun @FlexibleNullability OverloadResolutionResultsImpl<@FlexibleNullability A?>?.() { + /*!! OverloadResolutionResultsImpl<@FlexibleNullability A?> */.setAllCandidates<@FlexibleNullability A?>(allCandidates = map>($receiver = allCandidates, transform = local fun (it: MyCandidate): ResolvedCall { + return it.() as ResolvedCall + } +)) + } +) +} + diff --git a/compiler/testData/ir/irText/firProblems/AnnotationInAnnotation.kt.txt b/compiler/testData/ir/irText/firProblems/AnnotationInAnnotation.kt.txt new file mode 100644 index 00000000000..a0ca0adc401 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/AnnotationInAnnotation.kt.txt @@ -0,0 +1,39 @@ +annotation class Storage : Annotation { + constructor(value: String) /* primary */ + val value: String + field = value + get + + + + +} + +annotation class State : Annotation { + constructor(name: String, storages: Array) /* primary */ + val name: String + field = name + get + + val storages: Array + field = storages + get + + + + +} + +@State(...) +class Test { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + diff --git a/compiler/testData/ir/irText/firProblems/ClashResolutionDescriptor.kt.txt b/compiler/testData/ir/irText/firProblems/ClashResolutionDescriptor.kt.txt new file mode 100644 index 00000000000..51444e6a76f --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/ClashResolutionDescriptor.kt.txt @@ -0,0 +1,77 @@ +interface ComponentContainer { + + + +} + +interface PlatformSpecificExtension> { + + + +} + +interface ComponentDescriptor { + + + +} + +abstract class PlatformExtensionsClashResolver> { + constructor(applicableTo: Class) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val applicableTo: Class + field = applicableTo + get + + + + +} + +class ClashResolutionDescriptor> { + constructor(container: ComponentContainer, resolver: PlatformExtensionsClashResolver, clashedComponents: List) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + private val resolver: PlatformExtensionsClashResolver + field = resolver + private get + + private val clashedComponents: List + field = clashedComponents + private get + + + + +} + +private val registrationMap: HashMap + field = hashMapOf() + private get + +fun resolveClashesIfAny(container: ComponentContainer, clashResolvers: List>) { + { //BLOCK + val tmp0_iterator: Iterator> = clashResolvers.iterator() + while (tmp0_iterator.hasNext()) { //BLOCK + val resolver: PlatformExtensionsClashResolver<*> = tmp0_iterator.next() + { //BLOCK + val clashedComponents: Collection = { //BLOCK + val tmp1_elvis_lhs: Collection? = ().get(key = resolver.()) as? Collection + when { + EQEQ(arg0 = tmp1_elvis_lhs, arg1 = null) -> continue + true -> tmp1_elvis_lhs + } + } + val substituteDescriptor: ClashResolutionDescriptor>>>>> = TODO("IrConstructorCall") + } + } + } +} + diff --git a/compiler/testData/ir/irText/firProblems/DeepCopyIrTree.kt.txt b/compiler/testData/ir/irText/firProblems/DeepCopyIrTree.kt.txt new file mode 100644 index 00000000000..ef5e95b41a7 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/DeepCopyIrTree.kt.txt @@ -0,0 +1,97 @@ +interface IrType { + + + +} + +interface TypeRemapper { + abstract fun enterScope(irTypeParametersContainer: IrTypeParametersContainer) + abstract fun remapType(type: IrType): IrType + abstract fun leaveScope() + + + +} + +interface IrTypeParametersContainer : IrDeclaration, IrDeclarationParent { + abstract var typeParameters: List + abstract get + abstract set + + + + +} + +interface IrDeclaration { + + + +} + +interface IrTypeParameter : IrDeclaration { + abstract val superTypes: MutableList + abstract get + + + + +} + +interface IrDeclarationParent { + + + +} + +class DeepCopyIrTreeWithSymbols { + constructor(typeRemapper: TypeRemapper) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + private val typeRemapper: TypeRemapper + field = typeRemapper + private get + + private fun copyTypeParameter(declaration: IrTypeParameter): IrTypeParameter { + return declaration + } + + fun IrTypeParametersContainer.copyTypeParametersFrom(other: IrTypeParametersContainer) { + .( = map($receiver = other.(), transform = local fun (it: IrTypeParameter): IrTypeParameter { + return .copyTypeParameter(declaration = it) + } +)) + withinScope($receiver = .(), irTypeParametersContainer = , fn = local fun () { + { //BLOCK + val tmp0_iterator: Iterator> = zip($receiver = .(), other = other.()).iterator() + while (tmp0_iterator.hasNext()) { //BLOCK + val tmp1_loop_parameter: Pair = tmp0_iterator.next() + val thisTypeParameter: IrTypeParameter = tmp1_loop_parameter.component1() + val otherTypeParameter: IrTypeParameter = tmp1_loop_parameter.component2() + { //BLOCK + mapTo>($receiver = otherTypeParameter.(), destination = thisTypeParameter.(), transform = local fun (it: IrType): IrType { + return .().remapType(type = it) + } +) /*~> Unit */ + } + } + } + } +) + } + + + + +} + +inline fun TypeRemapper.withinScope(irTypeParametersContainer: IrTypeParametersContainer, fn: Function0): T { + .enterScope(irTypeParametersContainer = irTypeParametersContainer) + val result: T = fn.invoke() + .leaveScope() + return result +} + diff --git a/compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.kt.txt b/compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.kt.txt new file mode 100644 index 00000000000..4587750062c --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.kt.txt @@ -0,0 +1,62 @@ +class Impl : A, B { + constructor(b: B) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + private /*final field*/ val $$delegate_0: B = b + override fun add(element: @FlexibleNullability String?): Boolean { + return #$$delegate_0.add(element = element) + } + + override fun addAll(elements: Collection<@FlexibleNullability String?>): Boolean { + return #$$delegate_0.addAll(elements = elements) + } + + override fun clear() { + #$$delegate_0.clear() + } + + override operator fun contains(element: @FlexibleNullability String?): Boolean { + return #$$delegate_0.contains(element = element) + } + + override fun containsAll(elements: Collection<@FlexibleNullability String?>): Boolean { + return #$$delegate_0.containsAll(elements = elements) + } + + override fun isEmpty(): Boolean { + return #$$delegate_0.isEmpty() + } + + override operator fun iterator(): MutableIterator<@FlexibleNullability String?> { + return #$$delegate_0.iterator() + } + + override fun remove(element: @FlexibleNullability String?): Boolean { + return #$$delegate_0.remove(element = element) + } + + override fun removeAll(elements: Collection<@FlexibleNullability String?>): Boolean { + return #$$delegate_0.removeAll(elements = elements) + } + + override fun retainAll(elements: Collection<@FlexibleNullability String?>): Boolean { + return #$$delegate_0.retainAll(elements = elements) + } + + override val size: Int + override get(): Int { + return #$$delegate_0.() + } + + + + +} + +fun box(): String { + return "OK" +} + diff --git a/compiler/testData/ir/irText/firProblems/InnerClassInAnonymous.kt.txt b/compiler/testData/ir/irText/firProblems/InnerClassInAnonymous.kt.txt new file mode 100644 index 00000000000..ac1758bf056 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/InnerClassInAnonymous.kt.txt @@ -0,0 +1,60 @@ +fun box(): String { + val obj: = { //BLOCK + local class { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val end: String + field = "K" + get + + fun foo(): String { + return TODO("IrConstructorCall").bar() + } + + local inner class Some : Base { + constructor(s: String) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun bar(): String { + return .().plus(other = .()) + } + + + + + } + + local open inner class Base { + constructor(s: String) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val s: String + field = s + get + + + + + } + + + + + } + + + TODO("IrConstructorCall") + } + return obj.foo() +} + diff --git a/compiler/testData/ir/irText/firProblems/MultiList.kt.txt b/compiler/testData/ir/irText/firProblems/MultiList.kt.txt new file mode 100644 index 00000000000..d3f9d6e0079 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/MultiList.kt.txt @@ -0,0 +1,159 @@ +data class Some { + constructor(value: T) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val value: T + field = value + get + + operator fun component1(): T { + return #value + } + + fun copy(value: T = #value): Some { + return TODO("IrConstructorCall") + } + + override fun toString(): String { + return "Some(" + +"value=" + +#value + +")" + } + + override fun hashCode(): Int { + return when { + EQEQ(arg0 = #value, arg1 = null) -> 0 + true -> #value.hashCode() + } + } + + override operator fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is Some -> return false + } + val tmp0_other_with_cast: Some = other as Some + when { + EQEQ(arg0 = #value, arg1 = #value).not() -> return false + } + return true + } + +} + +interface MyList : List> { + + + + + + + + + + + + + + + + + +} + +open class SomeList : MyList, ArrayList> { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +} + +class FinalList : SomeList { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +} + diff --git a/compiler/testData/ir/irText/firProblems/SameJavaFieldReferences.kt.txt b/compiler/testData/ir/irText/firProblems/SameJavaFieldReferences.kt.txt new file mode 100644 index 00000000000..28599c3a714 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/SameJavaFieldReferences.kt.txt @@ -0,0 +1,5 @@ +fun foo() { + val ref1: KProperty0 = ::someJavaField + val ref2: KProperty0 = ::someJavaField +} + diff --git a/compiler/testData/ir/irText/firProblems/SignatureClash.kt.txt b/compiler/testData/ir/irText/firProblems/SignatureClash.kt.txt new file mode 100644 index 00000000000..a5ba4f95802 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/SignatureClash.kt.txt @@ -0,0 +1,91 @@ +typealias Some = Function1 +object Factory { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun foo(a: String): String { + return "Alpha" + } + + fun foo(a: String, f: Function1): String { + return "Omega" + } + + + + +} + +interface Base { + + + +} + +interface Delegate : Base { + abstract fun bar() + + + +} + +interface Derived : Delegate { + + + + +} + +data class DataClass : Derived, Delegate { + constructor(delegate: Delegate) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val delegate: Delegate + field = delegate + get + + override fun bar() { + #delegate.bar() + } + + operator fun component1(): Delegate { + return #delegate + } + + fun copy(delegate: Delegate = #delegate): DataClass { + return TODO("IrConstructorCall") + } + + override fun toString(): String { + return "DataClass(" + +"delegate=" + +#delegate + +")" + } + + override fun hashCode(): Int { + return #delegate.hashCode() + } + + override operator fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is DataClass -> return false + } + val tmp0_other_with_cast: DataClass = other as DataClass + when { + EQEQ(arg0 = #delegate, arg1 = #delegate).not() -> return false + } + return true + } + +} + diff --git a/compiler/testData/ir/irText/firProblems/VarInInit.kt.txt b/compiler/testData/ir/irText/firProblems/VarInInit.kt.txt new file mode 100644 index 00000000000..b0a0634a3c6 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/VarInInit.kt.txt @@ -0,0 +1,25 @@ +class Some { + constructor(foo: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + var foo: Int + field = foo + get + set + + init { + when { + less(arg0 = .(), arg1 = 0) -> { //BLOCK + .( = 0) + } + } + } + + + + +} + diff --git a/compiler/testData/ir/irText/firProblems/candidateSymbol.kt.txt b/compiler/testData/ir/irText/firProblems/candidateSymbol.kt.txt new file mode 100644 index 00000000000..30d819580f8 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/candidateSymbol.kt.txt @@ -0,0 +1,67 @@ +class Candidate { + constructor(symbol: AbstractFirBasedSymbol<*>) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val symbol: AbstractFirBasedSymbol<*> + field = symbol + get + + + + +} + +abstract class AbstractFirBasedSymbol where E : FirSymbolOwner, E : FirDeclaration { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + lateinit var fir: E + get + set + + + + +} + +interface FirDeclaration { + + + +} + +interface FirSymbolOwner where E : FirSymbolOwner, E : FirDeclaration { + abstract val symbol: AbstractFirBasedSymbol + abstract get + + + + +} + +interface FirCallableMemberDeclaration> : FirSymbolOwner, FirDeclaration { + abstract override val symbol: AbstractFirBasedSymbol + abstract override get + + + + +} + +fun foo(candidate: Candidate) { + val me: FirSymbolOwner<*> = candidate.().() + when { + when { + me is FirCallableMemberDeclaration<*> -> EQEQ(arg0 = me /*as FirCallableMemberDeclaration> */.(), arg1 = null).not() + true -> false + } -> { //BLOCK + } + } +} + diff --git a/compiler/testData/ir/irText/firProblems/coercionToUnitForNestedWhen.kt.txt b/compiler/testData/ir/irText/firProblems/coercionToUnitForNestedWhen.kt.txt new file mode 100644 index 00000000000..8f3c59033f7 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/coercionToUnitForNestedWhen.kt.txt @@ -0,0 +1,40 @@ +private const val BACKSLASH: Char + field = '\' + private get + +private fun Reader.nextChar(): Char? { + return { //BLOCK + val tmp0_safe_receiver: Int? = takeUnless($receiver = .read(), predicate = local fun (it: Int): Boolean { + return EQEQ(arg0 = it, arg1 = -1) + } +) + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + true -> tmp0_safe_receiver.toChar() + } + } +} + +fun Reader.consumeRestOfQuotedSequence(sb: StringBuilder, quote: Char) { + var ch: Char? = nextChar($receiver = ) + while (when { + EQEQ(arg0 = ch, arg1 = null).not() -> EQEQ(arg0 = ch, arg1 = quote).not() + true -> false + }) { //BLOCK + when { + EQEQ(arg0 = ch, arg1 = ()) -> { //BLOCK + val tmp0_safe_receiver: Char? = nextChar($receiver = ) + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + true -> let($receiver = tmp0_safe_receiver, block = local fun (it: Char): @FlexibleNullability StringBuilder? { + return sb.append(p0 = it) + } +) + } + } /*~> Unit */ + true -> sb.append(p0 = ch) /*~> Unit */ + } + ch = nextChar($receiver = ) + } +} + diff --git a/compiler/testData/ir/irText/firProblems/putIfAbsent.kt.txt b/compiler/testData/ir/irText/firProblems/putIfAbsent.kt.txt new file mode 100644 index 00000000000..21fba8220b0 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/putIfAbsent.kt.txt @@ -0,0 +1,17 @@ +class Owner { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun foo(x: T, y: T) { + val map: MutableMap = mutableMapOf() + map.putIfAbsent(p0 = x, p1 = y) /*~> Unit */ + } + + + + +} + diff --git a/compiler/testData/ir/irText/firProblems/v8arrayToList.kt.txt b/compiler/testData/ir/irText/firProblems/v8arrayToList.kt.txt new file mode 100644 index 00000000000..cc6c848bb8d --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/v8arrayToList.kt.txt @@ -0,0 +1,18 @@ +class V8Array { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +fun box(): String { + val array: V8Array = TODO("IrConstructorCall") + val list: List = toList(array = array) as List + return list.get(index = 0) +} + diff --git a/compiler/testData/ir/irText/types/javaWildcardType.kt.txt b/compiler/testData/ir/irText/types/javaWildcardType.kt.txt new file mode 100644 index 00000000000..c2b7a406202 --- /dev/null +++ b/compiler/testData/ir/irText/types/javaWildcardType.kt.txt @@ -0,0 +1,56 @@ +interface K { + abstract fun kf1(): Collection + abstract fun kf2(): Collection + abstract fun kg1(c: Collection) + abstract fun kg2(c: Collection) + + + +} + +class C : J, K { + constructor(j: J, k: K) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + private /*final field*/ val $$delegate_0: J = j + override fun jf1(): @FlexibleNullability MutableCollection? { + return #$$delegate_0.jf1() + } + + override fun jf2(): @FlexibleNullability MutableCollection<@FlexibleNullability CharSequence?>? { + return #$$delegate_0.jf2() + } + + override fun jg1(c: @FlexibleNullability MutableCollection?) { + #$$delegate_0.jg1(c = c) + } + + override fun jg2(c: @FlexibleNullability MutableCollection<@FlexibleNullability CharSequence?>?) { + #$$delegate_0.jg2(c = c) + } + + private /*final field*/ val $$delegate_1: K = k + override fun kf1(): Collection { + return #$$delegate_1.kf1() + } + + override fun kf2(): Collection { + return #$$delegate_1.kf2() + } + + override fun kg1(c: Collection) { + #$$delegate_1.kg1(c = c) + } + + override fun kg2(c: Collection) { + #$$delegate_1.kg2(c = c) + } + + + + +} + diff --git a/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsT.kt.txt b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsT.kt.txt new file mode 100644 index 00000000000..88a2da6bc36 --- /dev/null +++ b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsT.kt.txt @@ -0,0 +1,11 @@ +fun useT(fn: Function0): T { + return fn.invoke() +} + +fun testNoNullCheck() { + useT<@EnhancedNullability String>(fn = local fun (): @EnhancedNullability String { + return notNullString() + } +) /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsTAny.kt.txt b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsTAny.kt.txt new file mode 100644 index 00000000000..59069d0279c --- /dev/null +++ b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsTAny.kt.txt @@ -0,0 +1,11 @@ +fun useTAny(fn: Function0): T { + return fn.invoke() +} + +fun testNoNullCheck() { + useTAny<@EnhancedNullability String>(fn = local fun (): @EnhancedNullability String { + return notNullString() + } +) /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsTConstrained.kt.txt b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsTConstrained.kt.txt new file mode 100644 index 00000000000..7fdb4b1b7aa --- /dev/null +++ b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsTConstrained.kt.txt @@ -0,0 +1,11 @@ +fun useTConstrained(xs: Array, fn: Function0): T { + return fn.invoke() +} + +fun testWithNullCheck(xs: Array) { + useTConstrained(xs = xs, fn = local fun (): String { + return notNullString() /*!! String */ + } +) /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsTXArray.kt.txt b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsTXArray.kt.txt new file mode 100644 index 00000000000..acd032fcdb5 --- /dev/null +++ b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsTXArray.kt.txt @@ -0,0 +1,11 @@ +fun useTX(x: T, fn: Function0): T { + return fn.invoke() +} + +fun testWithNullCheck(xs: Array) { + useTX(x = xs, fn = local fun (): Serializable { + return notNullString() /*!! String */ + } +) /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsTXString.kt.txt b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsTXString.kt.txt new file mode 100644 index 00000000000..a4457625d58 --- /dev/null +++ b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsTXString.kt.txt @@ -0,0 +1,11 @@ +fun useTX(x: T, fn: Function0): T { + return fn.invoke() +} + +fun testWithNullCheck() { + useTX(x = "", fn = local fun (): String { + return notNullString() /*!! String */ + } +) /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsT.kt.txt b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsT.kt.txt new file mode 100644 index 00000000000..3fa5e00208b --- /dev/null +++ b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsT.kt.txt @@ -0,0 +1,11 @@ +fun useT(fn: Function0): T { + return fn.invoke() +} + +fun testNoNullCheck() { + useT<@FlexibleNullability String?>(fn = local fun (): @FlexibleNullability String? { + return string() + } +) /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTAny.kt.txt b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTAny.kt.txt new file mode 100644 index 00000000000..9dadc44a84a --- /dev/null +++ b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTAny.kt.txt @@ -0,0 +1,11 @@ +fun useTAny(fn: Function0): T { + return fn.invoke() +} + +fun testNoNullCheck() { + useTAny<@FlexibleNullability String?>(fn = local fun (): @FlexibleNullability String? { + return string() + } +) /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTConstrained.kt.txt b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTConstrained.kt.txt new file mode 100644 index 00000000000..1eb947d9c69 --- /dev/null +++ b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTConstrained.kt.txt @@ -0,0 +1,11 @@ +fun useTConstrained(xs: Array, fn: Function0): T { + return fn.invoke() +} + +fun testWithNullCheck(xs: Array) { + useTConstrained(xs = xs, fn = local fun (): String { + return string() /*!! String */ + } +) /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTXArray.kt.txt b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTXArray.kt.txt new file mode 100644 index 00000000000..ffd23807511 --- /dev/null +++ b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTXArray.kt.txt @@ -0,0 +1,11 @@ +fun useTX(x: T, fn: Function0): T { + return fn.invoke() +} + +fun testNoNullCheck(xs: Array) { + useTX<@FlexibleNullability Serializable?>(x = xs, fn = local fun (): @FlexibleNullability Serializable? { + return string() + } +) /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTXString.kt.txt b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTXString.kt.txt new file mode 100644 index 00000000000..db333c23664 --- /dev/null +++ b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTXString.kt.txt @@ -0,0 +1,11 @@ +fun useTX(x: T, fn: Function0): T { + return fn.invoke() +} + +fun testNoNullCheck() { + useTX<@FlexibleNullability String?>(x = "", fn = local fun (): @FlexibleNullability String? { + return string() + } +) /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/types/rawTypeInSignature.kt.txt b/compiler/testData/ir/irText/types/rawTypeInSignature.kt.txt new file mode 100644 index 00000000000..2ba226222d0 --- /dev/null +++ b/compiler/testData/ir/irText/types/rawTypeInSignature.kt.txt @@ -0,0 +1,93 @@ +class GenericInv { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +class GenericIn { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +class GenericOut { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +fun testReturnsRawGenericInv(j: JRaw): @FlexibleNullability @RawType GenericInv? { + return j.returnsRawGenericInv() +} + +fun testReturnsRawGenericIn(j: JRaw): @FlexibleNullability @RawType GenericIn? { + return j.returnsRawGenericIn() +} + +fun testReturnsRawGenericOut(j: JRaw): @FlexibleNullability @RawType GenericOut? { + return j.returnsRawGenericOut() +} + +class KRaw : JRaw { + constructor(j: JRaw) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + private /*final field*/ val $$delegate_0: JRaw = j + override fun returnsRawGenericIn(): @FlexibleNullability @RawType GenericIn? { + return #$$delegate_0.returnsRawGenericIn() + } + + override fun returnsRawGenericInv(): @FlexibleNullability @RawType GenericInv? { + return #$$delegate_0.returnsRawGenericInv() + } + + override fun returnsRawGenericOut(): @FlexibleNullability @RawType GenericOut? { + return #$$delegate_0.returnsRawGenericOut() + } + + override fun returnsRawList(): @FlexibleNullability @RawType MutableList? { + return #$$delegate_0.returnsRawList() + } + + override fun takesRawGenericIn(g: @FlexibleNullability @RawType GenericIn?) { + #$$delegate_0.takesRawGenericIn(g = g) + } + + override fun takesRawGenericInv(g: @FlexibleNullability @RawType GenericInv?) { + #$$delegate_0.takesRawGenericInv(g = g) + } + + override fun takesRawGenericOut(g: @FlexibleNullability @RawType GenericOut?) { + #$$delegate_0.takesRawGenericOut(g = g) + } + + override fun takesRawList(list: @FlexibleNullability @RawType MutableList?) { + #$$delegate_0.takesRawList(list = list) + } + + + + +} +