From 8d5facb15f51938ef3f8ef382cbfce481dd4776c Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Thu, 5 Nov 2020 02:47:53 +0300 Subject: [PATCH] [IR] add testdata for dumpKotlinLike --- .../ir/irText/classes/abstractMembers.kt.txt | 34 +++ .../irText/classes/annotationClasses.kt.txt | 44 +++ ...orderingInDelegatingConstructorCall.kt.txt | 54 ++++ .../ir/irText/classes/classMembers.kt.txt | 93 +++++++ .../testData/ir/irText/classes/classes.kt.txt | 57 ++++ .../ir/irText/classes/companionObject.kt.txt | 48 ++++ .../classes/dataClassWithArrayMembers.kt.txt | 253 ++++++++++++++++++ .../ir/irText/classes/dataClasses.kt.txt | 217 +++++++++++++++ .../irText/classes/dataClassesGeneric.kt.txt | 187 +++++++++++++ .../delegatedGenericImplementation.kt.txt | 79 ++++++ .../classes/delegatedImplementation.kt.txt | 168 ++++++++++++ ...dImplementationWithExplicitOverride.kt.txt | 46 ++++ ...nstructorCallToTypeAliasConstructor.kt.txt | 42 +++ ...tructorCallsInSecondaryConstructors.kt.txt | 34 +++ .../testData/ir/irText/classes/enum.kt.txt | 150 +++++++++++ .../irText/classes/enumClassModality.kt.txt | 159 +++++++++++ .../classes/enumWithMultipleCtors.kt.txt | 54 ++++ .../classes/enumWithSecondaryCtor.kt.txt | 85 ++++++ .../fakeOverridesForJavaStaticMembers.kt.txt | 14 + ...citNotNullOnDelegatedImplementation.kt.txt | 150 +++++++++++ .../ir/irText/classes/initBlock.kt.txt | 104 +++++++ .../testData/ir/irText/classes/initVal.kt.txt | 51 ++++ .../ir/irText/classes/initValInLambda.kt.txt | 22 ++ .../testData/ir/irText/classes/initVar.kt.txt | 114 ++++++++ .../ir/irText/classes/inlineClass.kt.txt | 35 +++ .../inlineClassSyntheticMethods.kt.txt | 66 +++++ .../ir/irText/classes/innerClass.kt.txt | 36 +++ ...innerClassWithDelegatingConstructor.kt.txt | 32 +++ .../testData/ir/irText/classes/kt31649.kt.txt | 87 ++++++ .../lambdaInDataClassDefaultParameter.kt.txt | 110 ++++++++ .../ir/irText/classes/localClasses.kt.txt | 20 ++ .../classes/objectLiteralExpressions.kt.txt | 120 +++++++++ .../classes/objectWithInitializers.kt.txt | 35 +++ .../ir/irText/classes/outerClassAccess.kt.txt | 52 ++++ .../irText/classes/primaryConstructor.kt.txt | 63 +++++ ...ConstructorWithSuperConstructorCall.kt.txt | 60 +++++ .../irText/classes/qualifiedSuperCalls.kt.txt | 50 ++++ .../ir/irText/classes/sealedClasses.kt.txt | 60 +++++ ...ructorWithInitializersFromClassBody.kt.txt | 57 ++++ .../classes/secondaryConstructors.kt.txt | 16 ++ .../ir/irText/classes/superCalls.kt.txt | 43 +++ .../irText/classes/superCallsComposed.kt.txt | 50 ++++ .../annotationsInAnnotationArguments.kt.txt | 38 +++ ...notationsWithDefaultParameterValues.kt.txt | 35 +++ .../annotationsWithVarargParameters.kt.txt | 23 ++ .../arrayInAnnotationArguments.kt.txt | 32 +++ .../classLiteralInAnnotation.kt.txt | 27 ++ .../annotations/classesWithAnnotations.kt.txt | 98 +++++++ ...nstExpressionsInAnnotationArguments.kt.txt | 23 ++ .../constructorsWithAnnotations.kt.txt | 29 ++ .../delegateFieldWithAnnotations.kt.txt | 16 ++ ...tedPropertyAccessorsWithAnnotations.kt.txt | 54 ++++ .../enumEntriesWithAnnotations.kt.txt | 33 +++ .../enumsInAnnotationArguments.kt.txt | 35 +++ .../annotations/fieldsWithAnnotations.kt.txt | 20 ++ .../annotations/fileAnnotations.kt.txt | 15 ++ .../functionsWithAnnotations.kt.txt | 15 ++ .../annotations/javaAnnotation.kt.txt | 12 + ...lDelegatedPropertiesWithAnnotations.kt.txt | 25 ++ ...multipleAnnotationsInSquareBrackets.kt.txt | 27 ++ ...ConstructorParameterWithAnnotations.kt.txt | 23 ++ .../propertiesWithAnnotations.kt.txt | 16 ++ ...ssorsFromClassHeaderWithAnnotations.kt.txt | 35 +++ .../propertyAccessorsWithAnnotations.kt.txt | 38 +++ ...pertySetterParameterWithAnnotations.kt.txt | 29 ++ .../receiverParameterWithAnnotations.kt.txt | 37 +++ ...spreadOperatorInAnnotationArguments.kt.txt | 15 ++ .../typeAliasesWithAnnotations.kt.txt | 14 + .../typeParametersWithAnnotations.kt.txt | 11 + .../valueParametersWithAnnotations.kt.txt | 30 +++ .../varargsInAnnotationArguments.kt.txt | 45 ++++ .../variablesWithAnnotations.kt.txt | 18 ++ .../catchParameterInTopLevelProperty.kt.txt | 8 + .../declarations/classLevelProperties.kt.txt | 60 +++++ .../declarations/constValInitializers.kt.txt | 28 ++ .../declarations/defaultArguments.kt.txt | 7 + .../declarations/delegatedProperties.kt.txt | 52 ++++ .../declarations/deprecatedProperty.kt.txt | 67 +++++ .../declarations/extensionProperties.kt.txt | 36 +++ .../irText/declarations/fakeOverrides.kt.txt | 48 ++++ .../declarations/fileWithAnnotations.kt.txt | 9 + .../fileWithTypeAliasesOnly.kt.txt | 1 + .../genericDelegatedProperty.kt.txt | 40 +++ .../declarations/interfaceProperties.kt.txt | 25 ++ .../ir/irText/declarations/kt27005.kt.txt | 12 + .../ir/irText/declarations/kt29833.kt.txt | 22 ++ .../ir/irText/declarations/kt35550.kt.txt | 29 ++ .../localClassWithOverrides.kt.txt | 49 ++++ .../localDelegatedProperties.kt.txt | 34 +++ .../declarations/localVarInDoWhile.kt.txt | 8 + .../multiplatform/expectClassInherited.kt.txt | 48 ++++ .../multiplatform/expectedEnumClass.kt.txt | 36 +++ .../multiplatform/expectedSealedClass.kt.txt | 38 +++ .../packageLevelProperties.kt.txt | 48 ++++ .../declarations/parameters/class.kt.txt | 48 ++++ .../parameters/constructor.kt.txt | 96 +++++++ .../parameters/dataClassMembers.kt.txt | 63 +++++ .../defaultPropertyAccessors.kt.txt | 51 ++++ .../parameters/delegatedMembers.kt.txt | 37 +++ .../irText/declarations/parameters/fun.kt.txt | 30 +++ .../parameters/genericInnerClass.kt.txt | 27 ++ .../declarations/parameters/lambdas.kt.txt | 27 ++ .../declarations/parameters/localFun.kt.txt | 19 ++ .../parameters/propertyAccessors.kt.txt | 84 ++++++ .../typeParameterBeforeBound.kt.txt | 21 ++ .../typeParameterBoundedBySubclass.kt.txt | 52 ++++ .../parameters/useNextParamInLambda.kt.txt | 28 ++ .../primaryCtorDefaultArguments.kt.txt | 16 ++ .../declarations/primaryCtorProperties.kt.txt | 21 ++ .../provideDelegate/differentReceivers.kt.txt | 40 +++ .../declarations/provideDelegate/local.kt.txt | 50 ++++ .../localDifferentReceivers.kt.txt | 43 +++ .../provideDelegate/member.kt.txt | 58 ++++ .../provideDelegate/memberExtension.kt.txt | 46 ++++ .../provideDelegate/topLevel.kt.txt | 46 ++++ .../ir/irText/declarations/typeAlias.kt.txt | 20 ++ .../errors/suppressedNonPublicCall.kt.txt | 19 ++ .../irText/errors/unresolvedReference.kt.txt | 16 ++ .../argumentMappedWithError.kt.txt | 12 + .../ir/irText/expressions/arrayAccess.kt.txt | 12 + .../irText/expressions/arrayAssignment.kt.txt | 13 + .../arrayAugmentedAssignment1.kt.txt | 51 ++++ .../arrayAugmentedAssignment2.kt.txt | 22 ++ .../ir/irText/expressions/assignments.kt.txt | 27 ++ .../expressions/augmentedAssignment1.kt.txt | 32 +++ .../expressions/augmentedAssignment2.kt.txt | 58 ++++ .../augmentedAssignmentWithExpression.kt.txt | 35 +++ .../expressions/badBreakContinue.kt.txt | 29 ++ .../ir/irText/expressions/bangbang.kt.txt | 30 +++ .../booleanConstsInAndAndOrOr.kt.txt | 14 + .../expressions/booleanOperators.kt.txt | 22 ++ .../boundCallableReferences.kt.txt | 34 +++ .../ir/irText/expressions/boxOk.kt.txt | 4 + .../irText/expressions/breakContinue.kt.txt | 51 ++++ .../breakContinueInLoopHeader.kt.txt | 83 ++++++ .../expressions/breakContinueInWhen.kt.txt | 82 ++++++ .../callWithReorderedArguments.kt.txt | 32 +++ .../adaptedExtensionFunctions.kt.txt | 45 ++++ .../adaptedWithCoercionToUnit.kt.txt | 46 ++++ .../boundInlineAdaptedReference.kt.txt | 20 ++ .../boundInnerGenericConstructor.kt.txt | 44 +++ .../caoWithAdaptationForSam.kt.txt | 117 ++++++++ .../constructorWithAdaptedArguments.kt.txt | 70 +++++ ...ithDefaultParametersAsKCallableStar.kt.txt | 47 ++++ .../callableReferences/genericMember.kt.txt | 27 ++ .../importedFromObject.kt.txt | 38 +++ .../callableReferences/kt37131.kt.txt | 38 +++ .../suspendConversion.kt.txt | 105 ++++++++ .../callableReferences/typeArguments.kt.txt | 33 +++ ...MemberReferenceWithAdaptedArguments.kt.txt | 67 +++++ .../withAdaptationForSam.kt.txt | 21 ++ .../withAdaptedArguments.kt.txt | 85 ++++++ .../withArgumentAdaptationAndReceiver.kt.txt | 79 ++++++ .../withVarargViewedAsArray.kt.txt | 53 ++++ .../ir/irText/expressions/calls.kt.txt | 24 ++ .../expressions/castToTypeParameter.kt.txt | 51 ++++ .../expressions/catchParameterAccess.kt.txt | 10 + .../expressions/chainOfSafeCalls.kt.txt | 48 ++++ .../irText/expressions/classReference.kt.txt | 19 ++ .../irText/expressions/coercionToUnit.kt.txt | 28 ++ .../complexAugmentedAssignment.kt.txt | 133 +++++++++ ...onstructorWithOwnTypeParametersCall.kt.txt | 32 +++ .../irText/expressions/contructorCall.kt.txt | 16 ++ .../expressions/conventionComparisons.kt.txt | 29 ++ .../irText/expressions/destructuring1.kt.txt | 40 +++ .../destructuringWithUnderscore.kt.txt | 44 +++ .../ir/irText/expressions/dotQualified.kt.txt | 14 + .../ir/irText/expressions/elvis.kt.txt | 64 +++++ .../expressions/enumEntryAsReceiver.kt.txt | 27 ++ ...numEntryReferenceFromEnumEntryClass.kt.txt | 20 ++ .../ir/irText/expressions/equality.kt.txt | 12 + .../ir/irText/expressions/equals.kt.txt | 16 ++ .../expressions/extFunInvokeAsFun.kt.txt | 8 + .../expressions/extFunSafeInvoke.kt.txt | 10 + .../extensionPropertyGetterCall.kt.txt | 9 + .../ir/irText/expressions/field.kt.txt | 14 + .../comparableWithDoubleOrFloat.kt.txt | 20 ++ ...qeqRhsConditionPossiblyAffectingLhs.kt.txt | 7 + .../floatingPointCompareTo.kt.txt | 80 ++++++ .../floatingPointEqeq.kt.txt | 86 ++++++ .../floatingPointEquals.kt.txt | 116 ++++++++ .../floatingPointExcleq.kt.txt | 86 ++++++ .../floatingPointLess.kt.txt | 62 +++++ .../nullableAnyAsIntToDouble.kt.txt | 13 + .../nullableFloatingPointEqeq.kt.txt | 46 ++++ ...ameterWithPrimitiveNumericSupertype.kt.txt | 68 +++++ .../whenByFloatingPoint.kt.txt | 80 ++++++ .../testData/ir/irText/expressions/for.kt.txt | 45 ++++ .../expressions/forWithBreakContinue.kt.txt | 70 +++++ .../forWithImplicitReceivers.kt.txt | 66 +++++ .../expressions/funImportedFromObject.kt.txt | 22 ++ .../arrayAsVarargAfterSamArgument_fi.kt.txt | 58 ++++ .../basicFunInterfaceConversion.kt.txt | 18 ++ .../funInterface/castFromAny.kt.txt | 12 + .../funInterface/partialSam.kt.txt | 80 ++++++ .../samConversionInVarargs.kt.txt | 41 +++ .../samConversionInVarargsMixed.kt.txt | 21 ++ .../samConversionOnCallableReference.kt.txt | 39 +++ .../samConversionsWithSmartCasts.kt.txt | 80 ++++++ ...ricConstructorCallWithTypeArguments.kt.txt | 24 ++ .../expressions/genericPropertyCall.kt.txt | 9 + .../expressions/genericPropertyRef.kt.txt | 77 ++++++ .../ir/irText/expressions/identity.kt.txt | 12 + .../ir/irText/expressions/ifElseIf.kt.txt | 40 +++ ...implicitCastInReturnFromConstructor.kt.txt | 19 ++ .../implicitCastOnPlatformType.kt.txt | 4 + .../expressions/implicitCastToNonNull.kt.txt | 34 +++ .../implicitCastToTypeParameter.kt.txt | 41 +++ ...citNotNullInDestructuringAssignment.kt.txt | 16 ++ .../testData/ir/irText/expressions/in.kt.txt | 16 ++ .../expressions/incrementDecrement.kt.txt | 98 +++++++ .../expressions/interfaceThisRef.kt.txt | 11 + .../javaSyntheticGenericPropertyAccess.kt.txt | 17 ++ .../javaSyntheticPropertyAccess.kt.txt | 17 ++ .../jvmFieldWithIntersectionTypes.kt.txt | 85 ++++++ .../jvmInstanceFieldReference.kt.txt | 24 ++ .../jvmStaticFieldReference.kt.txt | 38 +++ .../ir/irText/expressions/kt16904.kt.txt | 72 +++++ .../ir/irText/expressions/kt16905.kt.txt | 53 ++++ .../ir/irText/expressions/kt23030.kt.txt | 58 ++++ .../ir/irText/expressions/kt24804.kt.txt | 27 ++ .../ir/irText/expressions/kt27933.kt.txt | 13 + .../ir/irText/expressions/kt28006.kt.txt | 40 +++ .../ir/irText/expressions/kt28456.kt.txt | 43 +++ .../ir/irText/expressions/kt28456a.kt.txt | 19 ++ .../ir/irText/expressions/kt28456b.kt.txt | 41 +++ .../ir/irText/expressions/kt30020.kt.txt | 90 +++++++ .../ir/irText/expressions/kt30796.kt.txt | 86 ++++++ .../ir/irText/expressions/kt35730.kt.txt | 27 ++ .../ir/irText/expressions/kt36956.kt.txt | 37 +++ .../ir/irText/expressions/kt36963.kt.txt | 7 + .../ir/irText/expressions/kt37570.kt.txt | 26 ++ .../ir/irText/expressions/kt37779.kt.txt | 11 + .../ir/irText/expressions/lambdaInCAO.kt.txt | 41 +++ .../ir/irText/expressions/literals.kt.txt | 68 +++++ .../expressions/memberTypeArguments.kt.txt | 20 ++ .../membersImportedFromObject.kt.txt | 45 ++++ .../expressions/multipleThisReferences.kt.txt | 67 +++++ .../nullCheckOnGenericLambdaReturn.kt.txt | 48 ++++ .../nullCheckOnLambdaReturn.kt.txt | 54 ++++ .../expressions/objectAsCallable.kt.txt | 48 ++++ .../expressions/objectClassReference.kt.txt | 17 ++ .../irText/expressions/objectReference.kt.txt | 103 +++++++ ...enceInClosureInSuperConstructorCall.kt.txt | 28 ++ .../objectReferenceInFieldInitializer.kt.txt | 25 ++ .../outerClassInstanceReference.kt.txt | 31 +++ .../expressions/primitiveComparisons.kt.txt | 96 +++++++ .../primitivesImplicitConversions.kt.txt | 53 ++++ .../expressions/propertyReferences.kt.txt | 138 ++++++++++ .../ir/irText/expressions/references.kt.txt | 39 +++ .../expressions/reflectionLiterals.kt.txt | 46 ++++ .../irText/expressions/safeAssignment.kt.txt | 27 ++ .../safeCallWithIncrementDecrement.kt.txt | 71 +++++ .../ir/irText/expressions/safeCalls.kt.txt | 91 +++++++ .../sam/arrayAsVarargAfterSamArgument.kt.txt | 45 ++++ .../sam/genericSamProjectedOut.kt.txt | 15 ++ .../expressions/sam/samByProjectedType.kt.txt | 7 + .../expressions/sam/samConstructors.kt.txt | 25 ++ ...mConversionInGenericConstructorCall.kt.txt | 9 + ...nversionInGenericConstructorCall_NI.kt.txt | 49 ++++ .../sam/samConversionToGeneric.kt.txt | 52 ++++ .../expressions/sam/samConversions.kt.txt | 30 +++ .../sam/samConversionsWithSmartCasts.kt.txt | 67 +++++ .../expressions/sam/samOperators.kt.txt | 18 ++ .../setFieldWithImplicitCast.kt.txt | 20 ++ ...nedToUnsignedConversions_annotation.kt.txt | 9 + .../signedToUnsignedConversions_test.kt.txt | 58 ++++ .../irText/expressions/simpleOperators.kt.txt | 44 +++ .../expressions/simpleUnaryOperators.kt.txt | 24 ++ .../ir/irText/expressions/smartCasts.kt.txt | 38 +++ .../smartCastsWithDestructuring.kt.txt | 31 +++ ...specializedTypeAliasConstructorCall.kt.txt | 21 ++ .../expressions/stringComparisons.kt.txt | 16 ++ .../ir/irText/expressions/stringPlus.kt.txt | 12 + .../irText/expressions/stringTemplates.kt.txt | 48 ++++ ...pendConversionOnArbitraryExpression.kt.txt | 177 ++++++++++++ .../temporaryInEnumEntryInitializer.kt.txt | 28 ++ .../expressions/temporaryInInitBlock.kt.txt | 25 ++ .../thisOfGenericOuterClass.kt.txt | 55 ++++ ...oObjectInNestedClassConstructorCall.kt.txt | 52 ++++ .../thisReferenceBeforeClassDeclared.kt.txt | 63 +++++ .../ir/irText/expressions/throw.kt.txt | 12 + .../ir/irText/expressions/tryCatch.kt.txt | 27 ++ .../tryCatchWithImplicitCast.kt.txt | 13 + .../typeAliasConstructorReference.kt.txt | 46 ++++ .../irText/expressions/typeArguments.kt.txt | 7 + .../irText/expressions/typeOperators.kt.txt | 22 ++ .../typeParameterClassLiteral.kt.txt | 38 +++ .../unsignedIntegerLiterals.kt.txt | 40 +++ .../expressions/useImportedMember.kt.txt | 114 ++++++++ .../ir/irText/expressions/values.kt.txt | 76 ++++++ .../ir/irText/expressions/vararg.kt.txt | 12 + .../expressions/varargWithImplicitCast.kt.txt | 14 + .../expressions/variableAsFunctionCall.kt.txt | 35 +++ .../variableAsFunctionCallWithGenerics.kt.txt | 24 ++ .../ir/irText/expressions/when.kt.txt | 67 +++++ .../expressions/whenCoercedToUnit.kt.txt | 9 + .../ir/irText/expressions/whenElse.kt.txt | 6 + .../ir/irText/expressions/whenReturn.kt.txt | 14 + .../irText/expressions/whenReturnUnit.kt.txt | 16 ++ .../expressions/whenUnusedExpression.kt.txt | 15 ++ .../whenWithSubjectVariable.kt.txt | 18 ++ .../ir/irText/expressions/whileDoWhile.kt.txt | 50 ++++ .../irText/firProblems/BaseFirBuilder.kt.txt | 16 ++ .../ir/irText/firProblems/FirBuilder.kt.txt | 26 ++ .../ir/irText/firProblems/deprecated.kt.txt | 14 + .../irText/lambdas/anonymousFunction.kt.txt | 7 + .../lambdas/destructuringInLambda.kt.txt | 69 +++++ .../ir/irText/lambdas/extensionLambda.kt.txt | 7 + .../ir/irText/lambdas/justLambda.kt.txt | 14 + .../ir/irText/lambdas/localFunction.kt.txt | 14 + .../lambdas/multipleImplicitReceivers.kt.txt | 58 ++++ .../ir/irText/lambdas/nonLocalReturn.kt.txt | 51 ++++ .../ir/irText/lambdas/samAdapter.kt.txt | 8 + .../irText/regressions/coercionInLoop.kt.txt | 18 ++ .../regressions/integerCoercionToT.kt.txt | 50 ++++ .../ir/irText/regressions/kt24114.kt.txt | 44 +++ .../newInference/fixationOrder1.kt.txt | 23 ++ .../typeAliasCtorForGenericClass.kt.txt | 23 ++ .../typeParametersInImplicitCast.kt.txt | 7 + .../ir/irText/singletons/companion.kt.txt | 31 +++ .../ir/irText/singletons/enumEntry.kt.txt | 20 ++ .../ir/irText/singletons/object.kt.txt | 31 +++ .../ir/irText/stubs/builtinMap.kt.txt | 10 + .../ir/irText/stubs/constFromBuiltins.kt.txt | 4 + .../genericClassInDifferentModule_m1.kt.txt | 25 ++ .../genericClassInDifferentModule_m2.kt.txt | 28 ++ .../javaConstructorWithTypeParameters.kt.txt | 16 ++ .../testData/ir/irText/stubs/javaEnum.kt.txt | 4 + .../ir/irText/stubs/javaInnerClass.kt.txt | 17 ++ .../ir/irText/stubs/javaMethod.kt.txt | 4 + .../ir/irText/stubs/javaNestedClass.kt.txt | 4 + .../ir/irText/stubs/javaStaticMethod.kt.txt | 4 + .../irText/stubs/javaSyntheticProperty.kt.txt | 4 + .../stubs/jdkClassSyntheticProperty.kt.txt | 5 + .../ir/irText/stubs/kotlinInnerClass.kt.txt | 4 + .../testData/ir/irText/stubs/simple.kt.txt | 4 + .../ir/irText/types/abbreviatedTypes.kt.txt | 18 ++ .../ir/irText/types/asOnPlatformType.kt.txt | 17 ++ .../castsInsideCoroutineInference.kt.txt | 164 ++++++++++++ .../coercionToUnitInLambdaReturnValue.kt.txt | 10 + .../types/genericDelegatedDeepProperty.kt.txt | 173 ++++++++++++ .../ir/irText/types/genericFunWithStar.kt.txt | 41 +++ .../types/genericPropertyReferenceType.kt.txt | 37 +++ .../inStarProjectionInReceiverType.kt.txt | 23 ++ .../irText/types/intersectionType1_NI.kt.txt | 30 +++ .../irText/types/intersectionType1_OI.kt.txt | 30 +++ .../irText/types/intersectionType2_NI.kt.txt | 53 ++++ .../irText/types/intersectionType2_OI.kt.txt | 53 ++++ .../irText/types/intersectionType3_NI.kt.txt | 78 ++++++ .../irText/types/intersectionType3_OI.kt.txt | 78 ++++++ .../testData/ir/irText/types/kt36143.kt.txt | 4 + .../localVariableOfIntersectionType_NI.kt.txt | 44 +++ .../nullChecks/enhancedNullability.kt.txt | 36 +++ ...ullabilityInDestructuringAssignment.kt.txt | 102 +++++++ .../enhancedNullabilityInForLoop.kt.txt | 138 ++++++++++ ...ompareToCallsOnPlatformTypeReceiver.kt.txt | 24 ++ .../implicitNotNullOnPlatformType.kt.txt | 46 ++++ ...abilityAssertionOnExtensionReceiver.kt.txt | 26 ++ .../nullChecks/platformTypeReceiver.kt.txt | 8 + .../types/receiverOfIntersectionType.kt.txt | 73 +++++ .../smartCastOnFakeOverrideReceiver.kt.txt | 102 +++++++ ...artCastOnFieldReceiverOfGenericType.kt.txt | 11 + .../smartCastOnReceiverOfGenericType.kt.txt | 69 +++++ .../ir/irText/types/starProjection_OI.kt.txt | 19 ++ 365 files changed, 15516 insertions(+) create mode 100644 compiler/testData/ir/irText/classes/abstractMembers.kt.txt create mode 100644 compiler/testData/ir/irText/classes/annotationClasses.kt.txt create mode 100644 compiler/testData/ir/irText/classes/argumentReorderingInDelegatingConstructorCall.kt.txt create mode 100644 compiler/testData/ir/irText/classes/classMembers.kt.txt create mode 100644 compiler/testData/ir/irText/classes/classes.kt.txt create mode 100644 compiler/testData/ir/irText/classes/companionObject.kt.txt create mode 100644 compiler/testData/ir/irText/classes/dataClassWithArrayMembers.kt.txt create mode 100644 compiler/testData/ir/irText/classes/dataClasses.kt.txt create mode 100644 compiler/testData/ir/irText/classes/dataClassesGeneric.kt.txt create mode 100644 compiler/testData/ir/irText/classes/delegatedGenericImplementation.kt.txt create mode 100644 compiler/testData/ir/irText/classes/delegatedImplementation.kt.txt create mode 100644 compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.kt.txt create mode 100644 compiler/testData/ir/irText/classes/delegatingConstructorCallToTypeAliasConstructor.kt.txt create mode 100644 compiler/testData/ir/irText/classes/delegatingConstructorCallsInSecondaryConstructors.kt.txt create mode 100644 compiler/testData/ir/irText/classes/enum.kt.txt create mode 100644 compiler/testData/ir/irText/classes/enumClassModality.kt.txt create mode 100644 compiler/testData/ir/irText/classes/enumWithMultipleCtors.kt.txt create mode 100644 compiler/testData/ir/irText/classes/enumWithSecondaryCtor.kt.txt create mode 100644 compiler/testData/ir/irText/classes/fakeOverridesForJavaStaticMembers.kt.txt create mode 100644 compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.kt.txt create mode 100644 compiler/testData/ir/irText/classes/initBlock.kt.txt create mode 100644 compiler/testData/ir/irText/classes/initVal.kt.txt create mode 100644 compiler/testData/ir/irText/classes/initValInLambda.kt.txt create mode 100644 compiler/testData/ir/irText/classes/initVar.kt.txt create mode 100644 compiler/testData/ir/irText/classes/inlineClass.kt.txt create mode 100644 compiler/testData/ir/irText/classes/inlineClassSyntheticMethods.kt.txt create mode 100644 compiler/testData/ir/irText/classes/innerClass.kt.txt create mode 100644 compiler/testData/ir/irText/classes/innerClassWithDelegatingConstructor.kt.txt create mode 100644 compiler/testData/ir/irText/classes/kt31649.kt.txt create mode 100644 compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.kt.txt create mode 100644 compiler/testData/ir/irText/classes/localClasses.kt.txt create mode 100644 compiler/testData/ir/irText/classes/objectLiteralExpressions.kt.txt create mode 100644 compiler/testData/ir/irText/classes/objectWithInitializers.kt.txt create mode 100644 compiler/testData/ir/irText/classes/outerClassAccess.kt.txt create mode 100644 compiler/testData/ir/irText/classes/primaryConstructor.kt.txt create mode 100644 compiler/testData/ir/irText/classes/primaryConstructorWithSuperConstructorCall.kt.txt create mode 100644 compiler/testData/ir/irText/classes/qualifiedSuperCalls.kt.txt create mode 100644 compiler/testData/ir/irText/classes/sealedClasses.kt.txt create mode 100644 compiler/testData/ir/irText/classes/secondaryConstructorWithInitializersFromClassBody.kt.txt create mode 100644 compiler/testData/ir/irText/classes/secondaryConstructors.kt.txt create mode 100644 compiler/testData/ir/irText/classes/superCalls.kt.txt create mode 100644 compiler/testData/ir/irText/classes/superCallsComposed.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/annotationsInAnnotationArguments.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/annotationsWithDefaultParameterValues.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/annotationsWithVarargParameters.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/arrayInAnnotationArguments.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/classLiteralInAnnotation.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/classesWithAnnotations.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/constExpressionsInAnnotationArguments.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/constructorsWithAnnotations.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/delegateFieldWithAnnotations.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/delegatedPropertyAccessorsWithAnnotations.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/enumEntriesWithAnnotations.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/enumsInAnnotationArguments.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/fieldsWithAnnotations.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/fileAnnotations.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/functionsWithAnnotations.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/javaAnnotation.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/localDelegatedPropertiesWithAnnotations.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/multipleAnnotationsInSquareBrackets.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/primaryConstructorParameterWithAnnotations.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/propertiesWithAnnotations.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/propertyAccessorsFromClassHeaderWithAnnotations.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/propertyAccessorsWithAnnotations.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/propertySetterParameterWithAnnotations.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/receiverParameterWithAnnotations.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/spreadOperatorInAnnotationArguments.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/typeAliasesWithAnnotations.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/typeParametersWithAnnotations.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/valueParametersWithAnnotations.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/varargsInAnnotationArguments.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/variablesWithAnnotations.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/catchParameterInTopLevelProperty.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/classLevelProperties.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/constValInitializers.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/defaultArguments.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/delegatedProperties.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/deprecatedProperty.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/extensionProperties.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/fakeOverrides.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/fileWithAnnotations.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/fileWithTypeAliasesOnly.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/genericDelegatedProperty.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/interfaceProperties.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/kt27005.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/kt29833.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/kt35550.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/localClassWithOverrides.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/localDelegatedProperties.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/localVarInDoWhile.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/multiplatform/expectClassInherited.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/multiplatform/expectedEnumClass.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/multiplatform/expectedSealedClass.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/packageLevelProperties.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/parameters/class.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/parameters/constructor.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/parameters/dataClassMembers.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/parameters/defaultPropertyAccessors.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/parameters/delegatedMembers.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/parameters/fun.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/parameters/genericInnerClass.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/parameters/lambdas.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/parameters/localFun.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/parameters/propertyAccessors.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/parameters/typeParameterBeforeBound.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/parameters/typeParameterBoundedBySubclass.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/parameters/useNextParamInLambda.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/primaryCtorDefaultArguments.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/primaryCtorProperties.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/provideDelegate/differentReceivers.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/provideDelegate/local.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/provideDelegate/localDifferentReceivers.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/provideDelegate/member.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/provideDelegate/topLevel.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/typeAlias.kt.txt create mode 100644 compiler/testData/ir/irText/errors/suppressedNonPublicCall.kt.txt create mode 100644 compiler/testData/ir/irText/errors/unresolvedReference.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/argumentMappedWithError.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/arrayAccess.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/arrayAssignment.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/arrayAugmentedAssignment1.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/arrayAugmentedAssignment2.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/assignments.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/augmentedAssignment1.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/augmentedAssignment2.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/augmentedAssignmentWithExpression.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/badBreakContinue.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/bangbang.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/booleanConstsInAndAndOrOr.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/booleanOperators.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/boundCallableReferences.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/boxOk.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/breakContinue.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/breakContinueInWhen.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/callWithReorderedArguments.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/adaptedExtensionFunctions.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/adaptedWithCoercionToUnit.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/boundInlineAdaptedReference.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/boundInnerGenericConstructor.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/funWithDefaultParametersAsKCallableStar.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/genericMember.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/importedFromObject.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/kt37131.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/suspendConversion.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/typeArguments.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/unboundMemberReferenceWithAdaptedArguments.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/withAdaptationForSam.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/withAdaptedArguments.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/withVarargViewedAsArray.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/calls.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/castToTypeParameter.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/catchParameterAccess.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/chainOfSafeCalls.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/classReference.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/coercionToUnit.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/complexAugmentedAssignment.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/constructorWithOwnTypeParametersCall.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/contructorCall.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/conventionComparisons.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/destructuring1.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/destructuringWithUnderscore.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/dotQualified.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/elvis.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/enumEntryAsReceiver.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/equality.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/equals.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/extFunInvokeAsFun.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/extFunSafeInvoke.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/extensionPropertyGetterCall.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/field.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/floatingPointComparisons/comparableWithDoubleOrFloat.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/floatingPointComparisons/eqeqRhsConditionPossiblyAffectingLhs.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointCompareTo.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointEqeq.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointEquals.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointExcleq.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointLess.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableAnyAsIntToDouble.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableFloatingPointEqeq.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/floatingPointComparisons/typeParameterWithPrimitiveNumericSupertype.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/floatingPointComparisons/whenByFloatingPoint.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/for.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/forWithBreakContinue.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/forWithImplicitReceivers.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/funImportedFromObject.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/funInterface/arrayAsVarargAfterSamArgument_fi.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/funInterface/basicFunInterfaceConversion.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/funInterface/castFromAny.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/funInterface/partialSam.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/funInterface/samConversionInVarargs.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/funInterface/samConversionInVarargsMixed.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/funInterface/samConversionOnCallableReference.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/funInterface/samConversionsWithSmartCasts.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/genericConstructorCallWithTypeArguments.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/genericPropertyCall.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/genericPropertyRef.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/identity.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/ifElseIf.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/implicitCastInReturnFromConstructor.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/implicitCastOnPlatformType.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/implicitCastToNonNull.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/implicitCastToTypeParameter.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/implicitNotNullInDestructuringAssignment.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/in.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/incrementDecrement.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/interfaceThisRef.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/javaSyntheticGenericPropertyAccess.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/javaSyntheticPropertyAccess.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/jvmFieldWithIntersectionTypes.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/jvmInstanceFieldReference.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/jvmStaticFieldReference.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/kt16904.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/kt16905.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/kt23030.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/kt24804.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/kt27933.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/kt28006.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/kt28456.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/kt28456a.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/kt28456b.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/kt30020.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/kt30796.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/kt35730.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/kt36956.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/kt36963.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/kt37570.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/kt37779.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/lambdaInCAO.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/literals.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/memberTypeArguments.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/membersImportedFromObject.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/multipleThisReferences.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/nullCheckOnGenericLambdaReturn.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/nullCheckOnLambdaReturn.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/objectAsCallable.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/objectClassReference.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/objectReference.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/objectReferenceInClosureInSuperConstructorCall.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/objectReferenceInFieldInitializer.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/outerClassInstanceReference.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/primitiveComparisons.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/primitivesImplicitConversions.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/propertyReferences.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/references.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/reflectionLiterals.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/safeAssignment.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/safeCalls.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/sam/arrayAsVarargAfterSamArgument.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/sam/genericSamProjectedOut.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/sam/samByProjectedType.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/sam/samConstructors.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall_NI.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/sam/samConversionToGeneric.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/sam/samConversions.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/sam/samConversionsWithSmartCasts.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/sam/samOperators.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/setFieldWithImplicitCast.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/signedToUnsignedConversions_annotation.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/signedToUnsignedConversions_test.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/simpleOperators.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/simpleUnaryOperators.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/smartCasts.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/smartCastsWithDestructuring.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/specializedTypeAliasConstructorCall.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/stringComparisons.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/stringPlus.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/stringTemplates.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/suspendConversionOnArbitraryExpression.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/temporaryInEnumEntryInitializer.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/temporaryInInitBlock.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/thisOfGenericOuterClass.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/thisRefToObjectInNestedClassConstructorCall.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/thisReferenceBeforeClassDeclared.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/throw.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/tryCatch.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/tryCatchWithImplicitCast.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/typeAliasConstructorReference.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/typeArguments.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/typeOperators.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/typeParameterClassLiteral.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/unsignedIntegerLiterals.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/useImportedMember.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/values.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/vararg.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/varargWithImplicitCast.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/variableAsFunctionCall.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/variableAsFunctionCallWithGenerics.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/when.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/whenCoercedToUnit.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/whenElse.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/whenReturn.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/whenReturnUnit.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/whenUnusedExpression.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/whenWithSubjectVariable.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/whileDoWhile.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/BaseFirBuilder.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/FirBuilder.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/deprecated.kt.txt create mode 100644 compiler/testData/ir/irText/lambdas/anonymousFunction.kt.txt create mode 100644 compiler/testData/ir/irText/lambdas/destructuringInLambda.kt.txt create mode 100644 compiler/testData/ir/irText/lambdas/extensionLambda.kt.txt create mode 100644 compiler/testData/ir/irText/lambdas/justLambda.kt.txt create mode 100644 compiler/testData/ir/irText/lambdas/localFunction.kt.txt create mode 100644 compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.kt.txt create mode 100644 compiler/testData/ir/irText/lambdas/nonLocalReturn.kt.txt create mode 100644 compiler/testData/ir/irText/lambdas/samAdapter.kt.txt create mode 100644 compiler/testData/ir/irText/regressions/coercionInLoop.kt.txt create mode 100644 compiler/testData/ir/irText/regressions/integerCoercionToT.kt.txt create mode 100644 compiler/testData/ir/irText/regressions/kt24114.kt.txt create mode 100644 compiler/testData/ir/irText/regressions/newInference/fixationOrder1.kt.txt create mode 100644 compiler/testData/ir/irText/regressions/typeAliasCtorForGenericClass.kt.txt create mode 100644 compiler/testData/ir/irText/regressions/typeParametersInImplicitCast.kt.txt create mode 100644 compiler/testData/ir/irText/singletons/companion.kt.txt create mode 100644 compiler/testData/ir/irText/singletons/enumEntry.kt.txt create mode 100644 compiler/testData/ir/irText/singletons/object.kt.txt create mode 100644 compiler/testData/ir/irText/stubs/builtinMap.kt.txt create mode 100644 compiler/testData/ir/irText/stubs/constFromBuiltins.kt.txt create mode 100644 compiler/testData/ir/irText/stubs/genericClassInDifferentModule_m1.kt.txt create mode 100644 compiler/testData/ir/irText/stubs/genericClassInDifferentModule_m2.kt.txt create mode 100644 compiler/testData/ir/irText/stubs/javaConstructorWithTypeParameters.kt.txt create mode 100644 compiler/testData/ir/irText/stubs/javaEnum.kt.txt create mode 100644 compiler/testData/ir/irText/stubs/javaInnerClass.kt.txt create mode 100644 compiler/testData/ir/irText/stubs/javaMethod.kt.txt create mode 100644 compiler/testData/ir/irText/stubs/javaNestedClass.kt.txt create mode 100644 compiler/testData/ir/irText/stubs/javaStaticMethod.kt.txt create mode 100644 compiler/testData/ir/irText/stubs/javaSyntheticProperty.kt.txt create mode 100644 compiler/testData/ir/irText/stubs/jdkClassSyntheticProperty.kt.txt create mode 100644 compiler/testData/ir/irText/stubs/kotlinInnerClass.kt.txt create mode 100644 compiler/testData/ir/irText/stubs/simple.kt.txt create mode 100644 compiler/testData/ir/irText/types/abbreviatedTypes.kt.txt create mode 100644 compiler/testData/ir/irText/types/asOnPlatformType.kt.txt create mode 100644 compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt create mode 100644 compiler/testData/ir/irText/types/coercionToUnitInLambdaReturnValue.kt.txt create mode 100644 compiler/testData/ir/irText/types/genericDelegatedDeepProperty.kt.txt create mode 100644 compiler/testData/ir/irText/types/genericFunWithStar.kt.txt create mode 100644 compiler/testData/ir/irText/types/genericPropertyReferenceType.kt.txt create mode 100644 compiler/testData/ir/irText/types/inStarProjectionInReceiverType.kt.txt create mode 100644 compiler/testData/ir/irText/types/intersectionType1_NI.kt.txt create mode 100644 compiler/testData/ir/irText/types/intersectionType1_OI.kt.txt create mode 100644 compiler/testData/ir/irText/types/intersectionType2_NI.kt.txt create mode 100644 compiler/testData/ir/irText/types/intersectionType2_OI.kt.txt create mode 100644 compiler/testData/ir/irText/types/intersectionType3_NI.kt.txt create mode 100644 compiler/testData/ir/irText/types/intersectionType3_OI.kt.txt create mode 100644 compiler/testData/ir/irText/types/kt36143.kt.txt create mode 100644 compiler/testData/ir/irText/types/localVariableOfIntersectionType_NI.kt.txt create mode 100644 compiler/testData/ir/irText/types/nullChecks/enhancedNullability.kt.txt create mode 100644 compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInDestructuringAssignment.kt.txt create mode 100644 compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.kt.txt create mode 100644 compiler/testData/ir/irText/types/nullChecks/explicitEqualsAndCompareToCallsOnPlatformTypeReceiver.kt.txt create mode 100644 compiler/testData/ir/irText/types/nullChecks/implicitNotNullOnPlatformType.kt.txt create mode 100644 compiler/testData/ir/irText/types/nullChecks/nullabilityAssertionOnExtensionReceiver.kt.txt create mode 100644 compiler/testData/ir/irText/types/nullChecks/platformTypeReceiver.kt.txt create mode 100644 compiler/testData/ir/irText/types/receiverOfIntersectionType.kt.txt create mode 100644 compiler/testData/ir/irText/types/smartCastOnFakeOverrideReceiver.kt.txt create mode 100644 compiler/testData/ir/irText/types/smartCastOnFieldReceiverOfGenericType.kt.txt create mode 100644 compiler/testData/ir/irText/types/smartCastOnReceiverOfGenericType.kt.txt create mode 100644 compiler/testData/ir/irText/types/starProjection_OI.kt.txt diff --git a/compiler/testData/ir/irText/classes/abstractMembers.kt.txt b/compiler/testData/ir/irText/classes/abstractMembers.kt.txt new file mode 100644 index 00000000000..4ff5e02855d --- /dev/null +++ b/compiler/testData/ir/irText/classes/abstractMembers.kt.txt @@ -0,0 +1,34 @@ +abstract class AbstractClass { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + abstract fun abstractFun() + abstract val abstractVal: Int + abstract get + + abstract var abstractVar: Int + abstract get + abstract set + + + + +} + +interface Interface { + abstract fun abstractFun() + abstract val abstractVal: Int + abstract get + + abstract var abstractVar: Int + abstract get + abstract set + + + + +} + diff --git a/compiler/testData/ir/irText/classes/annotationClasses.kt.txt b/compiler/testData/ir/irText/classes/annotationClasses.kt.txt new file mode 100644 index 00000000000..bbf1dc063fe --- /dev/null +++ b/compiler/testData/ir/irText/classes/annotationClasses.kt.txt @@ -0,0 +1,44 @@ +annotation class Test1 : Annotation { + constructor(x: Int) /* primary */ + val x: Int + field = x + get + + + + +} + +annotation class Test2 : Annotation { + constructor(x: Int = 0) /* primary */ + val x: Int + field = x + get + + + + +} + +annotation class Test3 : Annotation { + constructor(x: Test1) /* primary */ + val x: Test1 + field = x + get + + + + +} + +annotation class Test4 : Annotation { + constructor(vararg xs: Int) /* primary */ + val xs: IntArray + field = xs + get + + + + +} + diff --git a/compiler/testData/ir/irText/classes/argumentReorderingInDelegatingConstructorCall.kt.txt b/compiler/testData/ir/irText/classes/argumentReorderingInDelegatingConstructorCall.kt.txt new file mode 100644 index 00000000000..2710a340fb5 --- /dev/null +++ b/compiler/testData/ir/irText/classes/argumentReorderingInDelegatingConstructorCall.kt.txt @@ -0,0 +1,54 @@ +open class Base { + constructor(x: Int, y: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = x + get + + val y: Int + field = y + get + + + + +} + +class Test1 : Base { + constructor(xx: Int, yy: Int) /* primary */ { + { //BLOCK + TODO("IrDelegatingConstructorCall") + } + /* InstanceInitializerCall */ + + } + + + + +} + +class Test2 : Base { + constructor(xx: Int, yy: Int) { + { //BLOCK + TODO("IrDelegatingConstructorCall") + } + /* InstanceInitializerCall */ + + } + + constructor(xxx: Int, yyy: Int, a: Any) { + { //BLOCK + TODO("IrDelegatingConstructorCall") + } + } + + + + +} + diff --git a/compiler/testData/ir/irText/classes/classMembers.kt.txt b/compiler/testData/ir/irText/classes/classMembers.kt.txt new file mode 100644 index 00000000000..7aee7e54609 --- /dev/null +++ b/compiler/testData/ir/irText/classes/classMembers.kt.txt @@ -0,0 +1,93 @@ +class C { + constructor(x: Int, y: Int, z: Int = 1) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val y: Int + field = y + get + + var z: Int + field = z + get + set + + constructor() { + TODO("IrDelegatingConstructorCall") + } + + val property: Int + field = 0 + get + + val propertyWithGet: Int + get(): Int { + return 42 + } + + var propertyWithGetAndSet: Int + get(): Int { + return .() + } + set(value: Int) { + .( = value) + } + + fun function() { + println(message = "1") + } + + fun Int.memberExtensionFunction() { + println(message = "2") + } + + class NestedClass { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun function() { + println(message = "3") + } + + fun Int.memberExtensionFunction() { + println(message = "4") + } + + + + + } + + interface NestedInterface { + abstract fun foo() + fun bar() { + return .foo() + } + + + + + } + + companion object Companion { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + } + + + + +} + diff --git a/compiler/testData/ir/irText/classes/classes.kt.txt b/compiler/testData/ir/irText/classes/classes.kt.txt new file mode 100644 index 00000000000..6555e18c50f --- /dev/null +++ b/compiler/testData/ir/irText/classes/classes.kt.txt @@ -0,0 +1,57 @@ +class TestClass { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +interface TestInterface { + + + +} + +object TestObject { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +annotation class TestAnnotationClass : Annotation { + constructor() /* primary */ + + + +} + +enum class TestEnumClass : Enum { + private constructor() /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): TestEnumClass /* Synthetic body for ENUM_VALUEOF */ + +} + diff --git a/compiler/testData/ir/irText/classes/companionObject.kt.txt b/compiler/testData/ir/irText/classes/companionObject.kt.txt new file mode 100644 index 00000000000..4a415351883 --- /dev/null +++ b/compiler/testData/ir/irText/classes/companionObject.kt.txt @@ -0,0 +1,48 @@ +class Test1 { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + companion object Companion { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + } + + + + +} + +class Test2 { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + companion object Named { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + } + + + + +} + diff --git a/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.kt.txt b/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.kt.txt new file mode 100644 index 00000000000..6aa615d168a --- /dev/null +++ b/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.kt.txt @@ -0,0 +1,253 @@ +data class Test1 { + constructor(stringArray: Array, charArray: CharArray, booleanArray: BooleanArray, byteArray: ByteArray, shortArray: ShortArray, intArray: IntArray, longArray: LongArray, floatArray: FloatArray, doubleArray: DoubleArray) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val stringArray: Array + field = stringArray + get + + val charArray: CharArray + field = charArray + get + + val booleanArray: BooleanArray + field = booleanArray + get + + val byteArray: ByteArray + field = byteArray + get + + val shortArray: ShortArray + field = shortArray + get + + val intArray: IntArray + field = intArray + get + + val longArray: LongArray + field = longArray + get + + val floatArray: FloatArray + field = floatArray + get + + val doubleArray: DoubleArray + field = doubleArray + get + + operator fun component1(): Array { + return #stringArray + } + + operator fun component2(): CharArray { + return #charArray + } + + operator fun component3(): BooleanArray { + return #booleanArray + } + + operator fun component4(): ByteArray { + return #byteArray + } + + operator fun component5(): ShortArray { + return #shortArray + } + + operator fun component6(): IntArray { + return #intArray + } + + operator fun component7(): LongArray { + return #longArray + } + + operator fun component8(): FloatArray { + return #floatArray + } + + operator fun component9(): DoubleArray { + return #doubleArray + } + + fun copy(stringArray: Array = #stringArray, charArray: CharArray = #charArray, booleanArray: BooleanArray = #booleanArray, byteArray: ByteArray = #byteArray, shortArray: ShortArray = #shortArray, intArray: IntArray = #intArray, longArray: LongArray = #longArray, floatArray: FloatArray = #floatArray, doubleArray: DoubleArray = #doubleArray): Test1 { + return TODO("IrConstructorCall") + } + + override fun toString(): String { + return "Test1(" + +"stringArray=" + +dataClassArrayMemberToString(arg0 = #stringArray) + +", " + +"charArray=" + +dataClassArrayMemberToString(arg0 = #charArray) + +", " + +"booleanArray=" + +dataClassArrayMemberToString(arg0 = #booleanArray) + +", " + +"byteArray=" + +dataClassArrayMemberToString(arg0 = #byteArray) + +", " + +"shortArray=" + +dataClassArrayMemberToString(arg0 = #shortArray) + +", " + +"intArray=" + +dataClassArrayMemberToString(arg0 = #intArray) + +", " + +"longArray=" + +dataClassArrayMemberToString(arg0 = #longArray) + +", " + +"floatArray=" + +dataClassArrayMemberToString(arg0 = #floatArray) + +", " + +"doubleArray=" + +dataClassArrayMemberToString(arg0 = #doubleArray) + +")" + } + + override fun hashCode(): Int { + return dataClassArrayMemberHashCode(arg0 = #stringArray).times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = #charArray)).times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = #booleanArray)).times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = #byteArray)).times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = #shortArray)).times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = #intArray)).times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = #longArray)).times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = #floatArray)).times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = #doubleArray)) + } + + override operator fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is Test1 -> return false + } + val tmp0_other_with_cast: Test1 = other as Test1 + when { + EQEQ(arg0 = #stringArray, arg1 = #stringArray).not() -> return false + } + when { + EQEQ(arg0 = #charArray, arg1 = #charArray).not() -> return false + } + when { + EQEQ(arg0 = #booleanArray, arg1 = #booleanArray).not() -> return false + } + when { + EQEQ(arg0 = #byteArray, arg1 = #byteArray).not() -> return false + } + when { + EQEQ(arg0 = #shortArray, arg1 = #shortArray).not() -> return false + } + when { + EQEQ(arg0 = #intArray, arg1 = #intArray).not() -> return false + } + when { + EQEQ(arg0 = #longArray, arg1 = #longArray).not() -> return false + } + when { + EQEQ(arg0 = #floatArray, arg1 = #floatArray).not() -> return false + } + when { + EQEQ(arg0 = #doubleArray, arg1 = #doubleArray).not() -> return false + } + return true + } + +} + +data class Test2 { + constructor(genericArray: Array) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val genericArray: Array + field = genericArray + get + + operator fun component1(): Array { + return #genericArray + } + + fun copy(genericArray: Array = #genericArray): Test2 { + return TODO("IrConstructorCall") + } + + override fun toString(): String { + return "Test2(" + +"genericArray=" + +dataClassArrayMemberToString(arg0 = #genericArray) + +")" + } + + override fun hashCode(): Int { + return dataClassArrayMemberHashCode(arg0 = #genericArray) + } + + override operator fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is Test2 -> return false + } + val tmp0_other_with_cast: Test2 = other as Test2 + when { + EQEQ(arg0 = #genericArray, arg1 = #genericArray).not() -> return false + } + return true + } + +} + +data class Test3 { + constructor(anyArrayN: Array?) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val anyArrayN: Array? + field = anyArrayN + get + + operator fun component1(): Array? { + return #anyArrayN + } + + fun copy(anyArrayN: Array? = #anyArrayN): Test3 { + return TODO("IrConstructorCall") + } + + override fun toString(): String { + return "Test3(" + +"anyArrayN=" + +dataClassArrayMemberToString(arg0 = #anyArrayN) + +")" + } + + override fun hashCode(): Int { + return when { + EQEQ(arg0 = #anyArrayN, arg1 = null) -> 0 + true -> dataClassArrayMemberHashCode(arg0 = #anyArrayN) + } + } + + override operator fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is Test3 -> return false + } + val tmp0_other_with_cast: Test3 = other as Test3 + when { + EQEQ(arg0 = #anyArrayN, arg1 = #anyArrayN).not() -> return false + } + return true + } + +} + diff --git a/compiler/testData/ir/irText/classes/dataClasses.kt.txt b/compiler/testData/ir/irText/classes/dataClasses.kt.txt new file mode 100644 index 00000000000..365ccecd75f --- /dev/null +++ b/compiler/testData/ir/irText/classes/dataClasses.kt.txt @@ -0,0 +1,217 @@ +data class Test1 { + constructor(x: Int, y: String, z: Any) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = x + get + + val y: String + field = y + get + + val z: Any + field = z + get + + operator fun component1(): Int { + return #x + } + + operator fun component2(): String { + return #y + } + + operator fun component3(): Any { + return #z + } + + fun copy(x: Int = #x, y: String = #y, z: Any = #z): Test1 { + return TODO("IrConstructorCall") + } + + override fun toString(): String { + return "Test1(" + +"x=" + +#x + +", " + +"y=" + +#y + +", " + +"z=" + +#z + +")" + } + + override fun hashCode(): Int { + return #x.hashCode().times(other = 31).plus(other = #y.hashCode()).times(other = 31).plus(other = #z.hashCode()) + } + + override operator fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is Test1 -> return false + } + val tmp0_other_with_cast: Test1 = other as Test1 + when { + EQEQ(arg0 = #x, arg1 = #x).not() -> return false + } + when { + EQEQ(arg0 = #y, arg1 = #y).not() -> return false + } + when { + EQEQ(arg0 = #z, arg1 = #z).not() -> return false + } + return true + } + +} + +data class Test2 { + constructor(x: Any?) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Any? + field = x + get + + operator fun component1(): Any? { + return #x + } + + fun copy(x: Any? = #x): Test2 { + return TODO("IrConstructorCall") + } + + override fun toString(): String { + return "Test2(" + +"x=" + +#x + +")" + } + + override fun hashCode(): Int { + return when { + EQEQ(arg0 = #x, arg1 = null) -> 0 + true -> #x.hashCode() + } + } + + override operator fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is Test2 -> return false + } + val tmp0_other_with_cast: Test2 = other as Test2 + when { + EQEQ(arg0 = #x, arg1 = #x).not() -> return false + } + return true + } + +} + +data class Test3 { + constructor(d: Double, dn: Double?, f: Float, df: Float?) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val d: Double + field = d + get + + val dn: Double? + field = dn + get + + val f: Float + field = f + get + + val df: Float? + field = df + get + + operator fun component1(): Double { + return #d + } + + operator fun component2(): Double? { + return #dn + } + + operator fun component3(): Float { + return #f + } + + operator fun component4(): Float? { + return #df + } + + fun copy(d: Double = #d, dn: Double? = #dn, f: Float = #f, df: Float? = #df): Test3 { + return TODO("IrConstructorCall") + } + + override fun toString(): String { + return "Test3(" + +"d=" + +#d + +", " + +"dn=" + +#dn + +", " + +"f=" + +#f + +", " + +"df=" + +#df + +")" + } + + override fun hashCode(): Int { + return #d.hashCode().times(other = 31).plus(other = when { + EQEQ(arg0 = #dn, arg1 = null) -> 0 + true -> #dn.hashCode() + }).times(other = 31).plus(other = #f.hashCode()).times(other = 31).plus(other = when { + EQEQ(arg0 = #df, arg1 = null) -> 0 + true -> #df.hashCode() + }) + } + + override operator fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is Test3 -> return false + } + val tmp0_other_with_cast: Test3 = other as Test3 + when { + EQEQ(arg0 = #d, arg1 = #d).not() -> return false + } + when { + EQEQ(arg0 = #dn, arg1 = #dn).not() -> return false + } + when { + EQEQ(arg0 = #f, arg1 = #f).not() -> return false + } + when { + EQEQ(arg0 = #df, arg1 = #df).not() -> return false + } + return true + } + +} + diff --git a/compiler/testData/ir/irText/classes/dataClassesGeneric.kt.txt b/compiler/testData/ir/irText/classes/dataClassesGeneric.kt.txt new file mode 100644 index 00000000000..09d3531af7e --- /dev/null +++ b/compiler/testData/ir/irText/classes/dataClassesGeneric.kt.txt @@ -0,0 +1,187 @@ +data class Test1 { + constructor(x: T) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: T + field = x + get + + operator fun component1(): T { + return #x + } + + fun copy(x: T = #x): Test1 { + return TODO("IrConstructorCall") + } + + override fun toString(): String { + return "Test1(" + +"x=" + +#x + +")" + } + + override fun hashCode(): Int { + return when { + EQEQ(arg0 = #x, arg1 = null) -> 0 + true -> #x.hashCode() + } + } + + override operator fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is Test1 -> return false + } + val tmp0_other_with_cast: Test1 = other as Test1 + when { + EQEQ(arg0 = #x, arg1 = #x).not() -> return false + } + return true + } + +} + +data class Test2 { + constructor(x: T) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: T + field = x + get + + operator fun component1(): T { + return #x + } + + fun copy(x: T = #x): Test2 { + return TODO("IrConstructorCall") + } + + override fun toString(): String { + return "Test2(" + +"x=" + +#x + +")" + } + + override fun hashCode(): Int { + return #x.hashCode() + } + + override operator fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is Test2 -> return false + } + val tmp0_other_with_cast: Test2 = other as Test2 + when { + EQEQ(arg0 = #x, arg1 = #x).not() -> return false + } + return true + } + +} + +data class Test3 { + constructor(x: List) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: List + field = x + get + + operator fun component1(): List { + return #x + } + + fun copy(x: List = #x): Test3 { + return TODO("IrConstructorCall") + } + + override fun toString(): String { + return "Test3(" + +"x=" + +#x + +")" + } + + override fun hashCode(): Int { + return #x.hashCode() + } + + override operator fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is Test3 -> return false + } + val tmp0_other_with_cast: Test3 = other as Test3 + when { + EQEQ(arg0 = #x, arg1 = #x).not() -> return false + } + return true + } + +} + +data class Test4 { + constructor(x: List) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: List + field = x + get + + operator fun component1(): List { + return #x + } + + fun copy(x: List = #x): Test4 { + return TODO("IrConstructorCall") + } + + override fun toString(): String { + return "Test4(" + +"x=" + +#x + +")" + } + + override fun hashCode(): Int { + return #x.hashCode() + } + + override operator fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is Test4 -> return false + } + val tmp0_other_with_cast: Test4 = other as Test4 + when { + EQEQ(arg0 = #x, arg1 = #x).not() -> return false + } + return true + } + +} + diff --git a/compiler/testData/ir/irText/classes/delegatedGenericImplementation.kt.txt b/compiler/testData/ir/irText/classes/delegatedGenericImplementation.kt.txt new file mode 100644 index 00000000000..ebcc4edecfa --- /dev/null +++ b/compiler/testData/ir/irText/classes/delegatedGenericImplementation.kt.txt @@ -0,0 +1,79 @@ +interface IBase { + abstract fun foo(a: A, b: B) + abstract val C.id: Map? + abstract get + + abstract var List.x: D? + abstract get + abstract set + + + + +} + +class Test1 : IBase { + constructor(i: IBase) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + private /*final field*/ val $$delegate_0: IBase = i + override fun foo(a: E, b: B) { + #$$delegate_0.foo(a = a, b = b) + } + + override val C.id: Map? + override get(): Map? { + return #$$delegate_0.($receiver = ) + } + + override var List.x: D? + override get(): D? { + return #$$delegate_0.($receiver = ) + } + override set(: D?) { + #$$delegate_0.($receiver = , = ) + } + + + + +} + +class Test2 : IBase { + constructor(j: IBase) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + var j: IBase + field = j + get + set + + private /*final field*/ val $$delegate_0: IBase = j + override fun foo(a: String, b: B) { + #$$delegate_0.foo(a = a, b = b) + } + + override val C.id: Map? + override get(): Map? { + return #$$delegate_0.($receiver = ) + } + + override var List.x: D? + override get(): D? { + return #$$delegate_0.($receiver = ) + } + override set(: D?) { + #$$delegate_0.($receiver = , = ) + } + + + + +} + diff --git a/compiler/testData/ir/irText/classes/delegatedImplementation.kt.txt b/compiler/testData/ir/irText/classes/delegatedImplementation.kt.txt new file mode 100644 index 00000000000..83accae49bc --- /dev/null +++ b/compiler/testData/ir/irText/classes/delegatedImplementation.kt.txt @@ -0,0 +1,168 @@ +interface IBase { + abstract fun foo(x: Int, s: String) + abstract fun bar(): Int + abstract fun String.qux() + + + +} + +object BaseImpl : IBase { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + override fun foo(x: Int, s: String) { + } + + override fun bar(): Int { + return 42 + } + + override fun String.qux() { + } + + + + +} + +interface IOther { + abstract val x: String + abstract get + + abstract var y: Int + abstract get + abstract set + + abstract val Byte.z1: Int + abstract get + + abstract var Byte.z2: Int + abstract get + abstract set + + + + +} + +fun otherImpl(x0: String, y0: Int): IOther { + return { //BLOCK + local class : IOther { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + override val x: String + field = x0 + override get + + override var y: Int + field = y0 + override get + override set + + override val Byte.z1: Int + override get(): Int { + return 1 + } + + override var Byte.z2: Int + override get(): Int { + return 2 + } + override set(value: Int) { + } + + + + + } + + + TODO("IrConstructorCall") + } +} + +class Test1 : IBase { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + private /*final field*/ val $$delegate_0: BaseImpl = BaseImpl + override fun bar(): Int { + return #$$delegate_0.bar() + } + + override fun foo(x: Int, s: String) { + #$$delegate_0.foo(x = x, s = s) + } + + override fun String.qux() { + #$$delegate_0.qux($receiver = ) + } + + + + +} + +class Test2 : IBase, IOther { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + private /*final field*/ val $$delegate_0: BaseImpl = BaseImpl + override fun bar(): Int { + return #$$delegate_0.bar() + } + + override fun foo(x: Int, s: String) { + #$$delegate_0.foo(x = x, s = s) + } + + override fun String.qux() { + #$$delegate_0.qux($receiver = ) + } + + private /*final field*/ val $$delegate_1: IOther = otherImpl(x0 = "", y0 = 42) + override val Byte.z1: Int + override get(): Int { + return #$$delegate_1.($receiver = ) + } + + override val x: String + override get(): String { + return #$$delegate_1.() + } + + override var Byte.z2: Int + override get(): Int { + return #$$delegate_1.($receiver = ) + } + override set(: Int) { + #$$delegate_1.($receiver = , = ) + } + + override var y: Int + override get(): Int { + return #$$delegate_1.() + } + override set(: Int) { + #$$delegate_1.( = ) + } + + + + +} + diff --git a/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.kt.txt b/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.kt.txt new file mode 100644 index 00000000000..d828aae732e --- /dev/null +++ b/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.kt.txt @@ -0,0 +1,46 @@ +interface IFooBar { + abstract fun foo() + abstract fun bar() + + + +} + +object FooBarImpl : IFooBar { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + override fun foo() { + } + + override fun bar() { + } + + + + +} + +class C : IFooBar { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + private /*final field*/ val $$delegate_0: FooBarImpl = FooBarImpl + override fun foo() { + #$$delegate_0.foo() + } + + override fun bar() { + } + + + + +} + diff --git a/compiler/testData/ir/irText/classes/delegatingConstructorCallToTypeAliasConstructor.kt.txt b/compiler/testData/ir/irText/classes/delegatingConstructorCallToTypeAliasConstructor.kt.txt new file mode 100644 index 00000000000..19e317cd18d --- /dev/null +++ b/compiler/testData/ir/irText/classes/delegatingConstructorCallToTypeAliasConstructor.kt.txt @@ -0,0 +1,42 @@ +open class Cell { + constructor(value: T) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val value: T + field = value + get + + + + +} + +typealias CT = Cell +typealias CStr = Cell +class C1 : Cell { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +class C2 : Cell { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + diff --git a/compiler/testData/ir/irText/classes/delegatingConstructorCallsInSecondaryConstructors.kt.txt b/compiler/testData/ir/irText/classes/delegatingConstructorCallsInSecondaryConstructors.kt.txt new file mode 100644 index 00000000000..42314e1dd52 --- /dev/null +++ b/compiler/testData/ir/irText/classes/delegatingConstructorCallsInSecondaryConstructors.kt.txt @@ -0,0 +1,34 @@ +open class Base { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +class Test : Base { + constructor() { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + constructor(xx: Int) { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + constructor(xx: Short) { + TODO("IrDelegatingConstructorCall") + } + + + + +} + diff --git a/compiler/testData/ir/irText/classes/enum.kt.txt b/compiler/testData/ir/irText/classes/enum.kt.txt new file mode 100644 index 00000000000..ab55bfd4ecb --- /dev/null +++ b/compiler/testData/ir/irText/classes/enum.kt.txt @@ -0,0 +1,150 @@ +enum class TestEnum1 : Enum { + private constructor() /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + TEST1 init = TODO("IrEnumConstructorCall") TEST2 init = TODO("IrEnumConstructorCall") + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): TestEnum1 /* Synthetic body for ENUM_VALUEOF */ + +} + +enum class TestEnum2 : Enum { + private constructor(x: Int) /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = x + get + + TEST1 init = TODO("IrEnumConstructorCall") TEST2 init = TODO("IrEnumConstructorCall") TEST3 init = TODO("IrEnumConstructorCall") + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): TestEnum2 /* Synthetic body for ENUM_VALUEOF */ + +} + +abstract enum class TestEnum3 : Enum { + private constructor() /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + TEST init = TODO("IrEnumConstructorCall") abstract fun foo() + + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): TestEnum3 /* Synthetic body for ENUM_VALUEOF */ + +} + +abstract enum class TestEnum4 : Enum { + private constructor(x: Int) /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = x + get + + TEST1 init = TODO("IrEnumConstructorCall") TEST2 init = TODO("IrEnumConstructorCall") abstract fun foo() + + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): TestEnum4 /* Synthetic body for ENUM_VALUEOF */ + +} + +enum class TestEnum5 : Enum { + private constructor(x: Int = 0) /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = x + get + + TEST1 init = TODO("IrEnumConstructorCall") TEST2 init = TODO("IrEnumConstructorCall") TEST3 init = TODO("IrEnumConstructorCall") + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): TestEnum5 /* Synthetic body for ENUM_VALUEOF */ + +} + +fun f(): Int { + return 1 +} + +enum class TestEnum6 : Enum { + private constructor(x: Int, y: Int) /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = x + get + + val y: Int + field = y + get + + TEST init = { //BLOCK + val tmp0_y: Int = f() + val tmp1_x: Int = f() + TODO("IrEnumConstructorCall") + } + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): TestEnum6 /* Synthetic body for ENUM_VALUEOF */ + +} + diff --git a/compiler/testData/ir/irText/classes/enumClassModality.kt.txt b/compiler/testData/ir/irText/classes/enumClassModality.kt.txt new file mode 100644 index 00000000000..c31de7f8af7 --- /dev/null +++ b/compiler/testData/ir/irText/classes/enumClassModality.kt.txt @@ -0,0 +1,159 @@ +enum class TestFinalEnum1 : Enum { + private constructor() /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + X1 init = TODO("IrEnumConstructorCall") + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): TestFinalEnum1 /* Synthetic body for ENUM_VALUEOF */ + +} + +enum class TestFinalEnum2 : Enum { + private constructor(x: Int) /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = x + get + + X1 init = TODO("IrEnumConstructorCall") + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): TestFinalEnum2 /* Synthetic body for ENUM_VALUEOF */ + +} + +enum class TestFinalEnum3 : Enum { + private constructor() /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + X1 init = TODO("IrEnumConstructorCall") fun doStuff() { + } + + + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): TestFinalEnum3 /* Synthetic body for ENUM_VALUEOF */ + +} + +open enum class TestOpenEnum1 : Enum { + private constructor() /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + X1 init = TODO("IrEnumConstructorCall") + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): TestOpenEnum1 /* Synthetic body for ENUM_VALUEOF */ + +} + +open enum class TestOpenEnum2 : Enum { + private constructor() /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + X1 init = TODO("IrEnumConstructorCall") open fun foo() { + } + + + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): TestOpenEnum2 /* Synthetic body for ENUM_VALUEOF */ + +} + +abstract enum class TestAbstractEnum1 : Enum { + private constructor() /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + X1 init = TODO("IrEnumConstructorCall") abstract fun foo() + + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): TestAbstractEnum1 /* Synthetic body for ENUM_VALUEOF */ + +} + +interface IFoo { + abstract fun foo() + + + +} + +abstract enum class TestAbstractEnum2 : Enum, IFoo { + private constructor() /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + X1 init = TODO("IrEnumConstructorCall") + + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): TestAbstractEnum2 /* Synthetic body for ENUM_VALUEOF */ + +} + diff --git a/compiler/testData/ir/irText/classes/enumWithMultipleCtors.kt.txt b/compiler/testData/ir/irText/classes/enumWithMultipleCtors.kt.txt new file mode 100644 index 00000000000..765cdea7920 --- /dev/null +++ b/compiler/testData/ir/irText/classes/enumWithMultipleCtors.kt.txt @@ -0,0 +1,54 @@ +open enum class A : Enum { + X init = TODO("IrEnumConstructorCall") Y init = TODO("IrEnumConstructorCall") Z init = TODO("IrEnumConstructorCall") val prop1: String + get + + val prop2: String + field = "const2" + get + + var prop3: String + field = "" + get + set + + private constructor(arg: String) { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + #prop1 = arg + } + + private constructor() { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + #prop1 = "default" + .( = "empty") + } + + private constructor(x: Int) { + TODO("IrDelegatingConstructorCall") + .( = "int") + } + + open fun f(): String { + return .() + +"#" + +.() + +"#" + +.() + } + + + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): A /* Synthetic body for ENUM_VALUEOF */ + +} + diff --git a/compiler/testData/ir/irText/classes/enumWithSecondaryCtor.kt.txt b/compiler/testData/ir/irText/classes/enumWithSecondaryCtor.kt.txt new file mode 100644 index 00000000000..53dbb28b14b --- /dev/null +++ b/compiler/testData/ir/irText/classes/enumWithSecondaryCtor.kt.txt @@ -0,0 +1,85 @@ +enum class Test0 : Enum { + private constructor(x: Int) /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = x + get + + ZERO init = TODO("IrEnumConstructorCall") private constructor() { + TODO("IrDelegatingConstructorCall") + } + + + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): Test0 /* Synthetic body for ENUM_VALUEOF */ + +} + +enum class Test1 : Enum { + private constructor(x: Int) /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = x + get + + ZERO init = TODO("IrEnumConstructorCall") ONE init = TODO("IrEnumConstructorCall") private constructor() { + TODO("IrDelegatingConstructorCall") + } + + + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): Test1 /* Synthetic body for ENUM_VALUEOF */ + +} + +abstract enum class Test2 : Enum { + private constructor(x: Int) /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = x + get + + ZERO init = TODO("IrEnumConstructorCall") ONE init = TODO("IrEnumConstructorCall") private constructor() { + TODO("IrDelegatingConstructorCall") + } + + abstract fun foo() + + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): Test2 /* Synthetic body for ENUM_VALUEOF */ + +} + diff --git a/compiler/testData/ir/irText/classes/fakeOverridesForJavaStaticMembers.kt.txt b/compiler/testData/ir/irText/classes/fakeOverridesForJavaStaticMembers.kt.txt new file mode 100644 index 00000000000..48d79c255f3 --- /dev/null +++ b/compiler/testData/ir/irText/classes/fakeOverridesForJavaStaticMembers.kt.txt @@ -0,0 +1,14 @@ +class Test : Base { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + + +} + diff --git a/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.kt.txt b/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.kt.txt new file mode 100644 index 00000000000..b745983c032 --- /dev/null +++ b/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.kt.txt @@ -0,0 +1,150 @@ +interface IFoo { + abstract fun foo(): String + + + +} + +class K1 : JFoo { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + +} + +class K2 : JFoo { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + override fun foo(): String { + return .foo() /*!! String */ + } + + + + +} + +class K3 : JUnrelatedFoo, IFoo { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + +} + +class K4 : JUnrelatedFoo, IFoo { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + override fun foo(): @FlexibleNullability String? { + return .foo() + } + + + + +} + +class TestJFoo : IFoo { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + private /*final field*/ val $$delegate_0: JFoo = TODO("IrConstructorCall") + override fun foo(): String { + return #$$delegate_0.foo() /*!! String */ + } + + + + +} + +class TestK1 : IFoo { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + private /*final field*/ val $$delegate_0: K1 = TODO("IrConstructorCall") + override fun foo(): String { + return #$$delegate_0.foo() /*!! String */ + } + + + + +} + +class TestK2 : IFoo { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + private /*final field*/ val $$delegate_0: K2 = TODO("IrConstructorCall") + override fun foo(): String { + return #$$delegate_0.foo() + } + + + + +} + +class TestK3 : IFoo { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + private /*final field*/ val $$delegate_0: K3 = TODO("IrConstructorCall") + override fun foo(): String { + return #$$delegate_0.foo() + } + + + + +} + +class TestK4 : IFoo { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + private /*final field*/ val $$delegate_0: K4 = TODO("IrConstructorCall") + override fun foo(): String { + return #$$delegate_0.foo() /*!! String */ + } + + + + +} + diff --git a/compiler/testData/ir/irText/classes/initBlock.kt.txt b/compiler/testData/ir/irText/classes/initBlock.kt.txt new file mode 100644 index 00000000000..56e174c6b99 --- /dev/null +++ b/compiler/testData/ir/irText/classes/initBlock.kt.txt @@ -0,0 +1,104 @@ +class Test1 { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + init { + println() + } + + + + +} + +class Test2 { + constructor(x: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = x + get + + init { + println() + } + + + + +} + +class Test3 { + init { + println() + } + + constructor() { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +class Test4 { + init { + println(message = "1") + } + + constructor() { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + init { + println(message = "2") + } + + + + +} + +class Test5 { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + init { + println(message = "1") + } + + inner class TestInner { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + init { + println(message = "2") + } + + + + + } + + + + +} + diff --git a/compiler/testData/ir/irText/classes/initVal.kt.txt b/compiler/testData/ir/irText/classes/initVal.kt.txt new file mode 100644 index 00000000000..2107ee26618 --- /dev/null +++ b/compiler/testData/ir/irText/classes/initVal.kt.txt @@ -0,0 +1,51 @@ +class TestInitValFromParameter { + constructor(x: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = x + get + + + + +} + +class TestInitValInClass { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = 0 + get + + + + +} + +class TestInitValInInitBlock { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + get + + init { + #x = 0 + } + + + + +} + diff --git a/compiler/testData/ir/irText/classes/initValInLambda.kt.txt b/compiler/testData/ir/irText/classes/initValInLambda.kt.txt new file mode 100644 index 00000000000..525feca16f4 --- /dev/null +++ b/compiler/testData/ir/irText/classes/initValInLambda.kt.txt @@ -0,0 +1,22 @@ +class TestInitValInLambdaCalledOnce { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + get + + init { + run($receiver = 1, block = local fun Int.() { + #x = 0 + } +) + } + + + + +} + diff --git a/compiler/testData/ir/irText/classes/initVar.kt.txt b/compiler/testData/ir/irText/classes/initVar.kt.txt new file mode 100644 index 00000000000..d10a3f0de4f --- /dev/null +++ b/compiler/testData/ir/irText/classes/initVar.kt.txt @@ -0,0 +1,114 @@ +class TestInitVarFromParameter { + constructor(x: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + var x: Int + field = x + get + set + + + + +} + +class TestInitVarInClass { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + var x: Int + field = 0 + get + set + + + + +} + +class TestInitVarInInitBlock { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + var x: Int + get + set + + init { + .( = 0) + } + + + + +} + +class TestInitVarWithCustomSetter { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + var x: Int + field = 0 + get + set(value: Int) { + #x = value + } + + + + +} + +class TestInitVarWithCustomSetterWithExplicitCtor { + var x: Int + get + set(value: Int) { + #x = value + } + + init { + .(value = 0) + } + + constructor() { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +class TestInitVarWithCustomSetterInCtor { + var x: Int + get + set(value: Int) { + #x = value + } + + constructor() { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + .(value = 42) + } + + + + +} + diff --git a/compiler/testData/ir/irText/classes/inlineClass.kt.txt b/compiler/testData/ir/irText/classes/inlineClass.kt.txt new file mode 100644 index 00000000000..a8872d7b16e --- /dev/null +++ b/compiler/testData/ir/irText/classes/inlineClass.kt.txt @@ -0,0 +1,35 @@ +inline class Test { + constructor(x: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = x + get + + override fun toString(): String { + return "Test(" + +"x=" + +#x + +")" + } + + override fun hashCode(): Int { + return #x.hashCode() + } + + override operator fun equals(other: Any?): Boolean { + when { + other !is Test -> return false + } + val tmp0_other_with_cast: Test = other as Test + when { + EQEQ(arg0 = #x, arg1 = #x).not() -> return false + } + return true + } + +} + diff --git a/compiler/testData/ir/irText/classes/inlineClassSyntheticMethods.kt.txt b/compiler/testData/ir/irText/classes/inlineClassSyntheticMethods.kt.txt new file mode 100644 index 00000000000..ca2844cba72 --- /dev/null +++ b/compiler/testData/ir/irText/classes/inlineClassSyntheticMethods.kt.txt @@ -0,0 +1,66 @@ +class C { + constructor(t: T) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val t: T + field = t + get + + override fun hashCode(): Int { + return .() as Int + } + + + +} + +inline class IC { + constructor(c: C) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val c: C + field = c + get + + fun foo(): Int { + return .().hashCode() + } + + override fun toString(): String { + return "IC(" + +"c=" + +#c + +")" + } + + override fun hashCode(): Int { + return #c.hashCode() + } + + override operator fun equals(other: Any?): Boolean { + when { + other !is IC -> return false + } + val tmp0_other_with_cast: IC = other as IC + when { + EQEQ(arg0 = #c, arg1 = #c).not() -> return false + } + return true + } + +} + +fun box(): String { + val ic: IC = TODO("IrConstructorCall") + when { + EQEQ(arg0 = ic.foo(), arg1 = 42).not() -> return "FAIL" + } + return "OK" +} + diff --git a/compiler/testData/ir/irText/classes/innerClass.kt.txt b/compiler/testData/ir/irText/classes/innerClass.kt.txt new file mode 100644 index 00000000000..268f89f2e3d --- /dev/null +++ b/compiler/testData/ir/irText/classes/innerClass.kt.txt @@ -0,0 +1,36 @@ +class Outer { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + open inner class TestInnerClass { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + } + + inner class DerivedInnerClass : TestInnerClass { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + } + + + + +} + diff --git a/compiler/testData/ir/irText/classes/innerClassWithDelegatingConstructor.kt.txt b/compiler/testData/ir/irText/classes/innerClassWithDelegatingConstructor.kt.txt new file mode 100644 index 00000000000..0672a360cf6 --- /dev/null +++ b/compiler/testData/ir/irText/classes/innerClassWithDelegatingConstructor.kt.txt @@ -0,0 +1,32 @@ +class Outer { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + inner class Inner { + constructor(x: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = x + get + + constructor() { + TODO("IrDelegatingConstructorCall") + } + + + + + } + + + + +} + diff --git a/compiler/testData/ir/irText/classes/kt31649.kt.txt b/compiler/testData/ir/irText/classes/kt31649.kt.txt new file mode 100644 index 00000000000..2cb80495b4c --- /dev/null +++ b/compiler/testData/ir/irText/classes/kt31649.kt.txt @@ -0,0 +1,87 @@ +data class TestData { + constructor(nn: Nothing?) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val nn: Nothing? + field = nn + get + + operator fun component1(): Nothing? { + return #nn + } + + fun copy(nn: Nothing? = #nn): TestData { + return TODO("IrConstructorCall") + } + + override fun toString(): String { + return "TestData(" + +"nn=" + +#nn + +")" + } + + override fun hashCode(): Int { + return when { + EQEQ(arg0 = #nn, arg1 = null) -> 0 + true -> #nn.hashCode() + } + } + + override operator fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is TestData -> return false + } + val tmp0_other_with_cast: TestData = other as TestData + when { + EQEQ(arg0 = #nn, arg1 = #nn).not() -> return false + } + return true + } + +} + +inline class TestInline { + constructor(nn: Nothing?) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val nn: Nothing? + field = nn + get + + override fun toString(): String { + return "TestInline(" + +"nn=" + +#nn + +")" + } + + override fun hashCode(): Int { + return when { + EQEQ(arg0 = #nn, arg1 = null) -> 0 + true -> #nn.hashCode() + } + } + + override operator fun equals(other: Any?): Boolean { + when { + other !is TestInline -> return false + } + val tmp0_other_with_cast: TestInline = other as TestInline + when { + EQEQ(arg0 = #nn, arg1 = #nn).not() -> return false + } + return true + } + +} + diff --git a/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.kt.txt b/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.kt.txt new file mode 100644 index 00000000000..4af7ccf6a7f --- /dev/null +++ b/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.kt.txt @@ -0,0 +1,110 @@ +data class A { + constructor(runA: @ExtensionFunctionType Function2 = local fun A.(it: String) { + return Unit + } +) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val runA: @ExtensionFunctionType Function2 + field = runA + get + + operator fun component1(): @ExtensionFunctionType Function2 { + return #runA + } + + fun copy(runA: @ExtensionFunctionType Function2 = #runA): A { + return TODO("IrConstructorCall") + } + + override fun toString(): String { + return "A(" + +"runA=" + +#runA + +")" + } + + override fun hashCode(): Int { + return #runA.hashCode() + } + + override operator fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is A -> return false + } + val tmp0_other_with_cast: A = other as A + when { + EQEQ(arg0 = #runA, arg1 = #runA).not() -> return false + } + return true + } + +} + +data class B { + constructor(x: Any = { //BLOCK + local class { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + } + + + TODO("IrConstructorCall") + }) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Any + field = x + get + + operator fun component1(): Any { + return #x + } + + fun copy(x: Any = #x): B { + return TODO("IrConstructorCall") + } + + override fun toString(): String { + return "B(" + +"x=" + +#x + +")" + } + + override fun hashCode(): Int { + return #x.hashCode() + } + + override operator fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is B -> return false + } + val tmp0_other_with_cast: B = other as B + when { + EQEQ(arg0 = #x, arg1 = #x).not() -> return false + } + return true + } + +} + diff --git a/compiler/testData/ir/irText/classes/localClasses.kt.txt b/compiler/testData/ir/irText/classes/localClasses.kt.txt new file mode 100644 index 00000000000..5db69d14320 --- /dev/null +++ b/compiler/testData/ir/irText/classes/localClasses.kt.txt @@ -0,0 +1,20 @@ +fun outer() { + local class LocalClass { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun foo() { + } + + + + + } + + + TODO("IrConstructorCall").foo() +} + diff --git a/compiler/testData/ir/irText/classes/objectLiteralExpressions.kt.txt b/compiler/testData/ir/irText/classes/objectLiteralExpressions.kt.txt new file mode 100644 index 00000000000..d254b1ecea7 --- /dev/null +++ b/compiler/testData/ir/irText/classes/objectLiteralExpressions.kt.txt @@ -0,0 +1,120 @@ +interface IFoo { + abstract fun foo() + + + +} + +val test1: Any + field = { //BLOCK + local class { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + } + + + TODO("IrConstructorCall") + } + get + +val test2: IFoo + field = { //BLOCK + local class : IFoo { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + override fun foo() { + println(message = "foo") + } + + + + + } + + + TODO("IrConstructorCall") + } + get + +class Outer { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + abstract inner class Inner : IFoo { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + + } + + fun test3(): Inner { + return { //BLOCK + local class : Inner { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + override fun foo() { + println(message = "foo") + } + + + + + } + + + TODO("IrConstructorCall") + } + } + + + + +} + +fun Outer.test4(): Inner { + return { //BLOCK + local class : Inner { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + override fun foo() { + println(message = "foo") + } + + + + + } + + + TODO("IrConstructorCall") + } +} + diff --git a/compiler/testData/ir/irText/classes/objectWithInitializers.kt.txt b/compiler/testData/ir/irText/classes/objectWithInitializers.kt.txt new file mode 100644 index 00000000000..4102d112929 --- /dev/null +++ b/compiler/testData/ir/irText/classes/objectWithInitializers.kt.txt @@ -0,0 +1,35 @@ +abstract class Base { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +object Test : Base { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = 1 + get + + val y: Int + get + + init { + #y = .() + } + + + + +} + diff --git a/compiler/testData/ir/irText/classes/outerClassAccess.kt.txt b/compiler/testData/ir/irText/classes/outerClassAccess.kt.txt new file mode 100644 index 00000000000..86e5f75aacf --- /dev/null +++ b/compiler/testData/ir/irText/classes/outerClassAccess.kt.txt @@ -0,0 +1,52 @@ +class Outer { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun foo() { + } + + inner class Inner { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun test() { + .foo() + } + + inner class Inner2 { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun test2() { + .test() + .foo() + } + + fun Outer.test3() { + .foo() + } + + + + + } + + + + + } + + + + +} + diff --git a/compiler/testData/ir/irText/classes/primaryConstructor.kt.txt b/compiler/testData/ir/irText/classes/primaryConstructor.kt.txt new file mode 100644 index 00000000000..6986ef5d11c --- /dev/null +++ b/compiler/testData/ir/irText/classes/primaryConstructor.kt.txt @@ -0,0 +1,63 @@ +class Test1 { + constructor(x: Int, y: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = x + get + + val y: Int + field = y + get + + + + +} + +class Test2 { + constructor(x: Int, y: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val y: Int + field = y + get + + val x: Int + field = x + get + + + + +} + +class Test3 { + constructor(x: Int, y: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val y: Int + field = y + get + + val x: Int + get + + init { + #x = x + } + + + + +} + diff --git a/compiler/testData/ir/irText/classes/primaryConstructorWithSuperConstructorCall.kt.txt b/compiler/testData/ir/irText/classes/primaryConstructorWithSuperConstructorCall.kt.txt new file mode 100644 index 00000000000..20e8d88c741 --- /dev/null +++ b/compiler/testData/ir/irText/classes/primaryConstructorWithSuperConstructorCall.kt.txt @@ -0,0 +1,60 @@ +open class Base { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +class TestImplicitPrimaryConstructor : Base { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +class TestExplicitPrimaryConstructor : Base { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +class TestWithDelegatingConstructor : Base { + constructor(x: Int, y: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = x + get + + val y: Int + field = y + get + + constructor(x: Int) { + TODO("IrDelegatingConstructorCall") + } + + + + +} + diff --git a/compiler/testData/ir/irText/classes/qualifiedSuperCalls.kt.txt b/compiler/testData/ir/irText/classes/qualifiedSuperCalls.kt.txt new file mode 100644 index 00000000000..fba2cb790c6 --- /dev/null +++ b/compiler/testData/ir/irText/classes/qualifiedSuperCalls.kt.txt @@ -0,0 +1,50 @@ +interface ILeft { + fun foo() { + } + + val bar: Int + get(): Int { + return 1 + } + + + + +} + +interface IRight { + fun foo() { + } + + val bar: Int + get(): Int { + return 2 + } + + + + +} + +class CBoth : ILeft, IRight { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + override fun foo() { + .foo() + .foo() + } + + override val bar: Int + override get(): Int { + return .().plus(other = .()) + } + + + + +} + diff --git a/compiler/testData/ir/irText/classes/sealedClasses.kt.txt b/compiler/testData/ir/irText/classes/sealedClasses.kt.txt new file mode 100644 index 00000000000..3b3f1691774 --- /dev/null +++ b/compiler/testData/ir/irText/classes/sealedClasses.kt.txt @@ -0,0 +1,60 @@ +sealed class Expr { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + class Const : Expr { + constructor(number: Double) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val number: Double + field = number + get + + + + + } + + class Sum : Expr { + constructor(e1: Expr, e2: Expr) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val e1: Expr + field = e1 + get + + val e2: Expr + field = e2 + get + + + + + } + + object NotANumber : Expr { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + } + + + + +} + diff --git a/compiler/testData/ir/irText/classes/secondaryConstructorWithInitializersFromClassBody.kt.txt b/compiler/testData/ir/irText/classes/secondaryConstructorWithInitializersFromClassBody.kt.txt new file mode 100644 index 00000000000..c2fd12e91f7 --- /dev/null +++ b/compiler/testData/ir/irText/classes/secondaryConstructorWithInitializersFromClassBody.kt.txt @@ -0,0 +1,57 @@ +open class Base { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +class TestProperty : Base { + val x: Int + field = 0 + get + + constructor() { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +class TestInitBlock : Base { + val x: Int + get + + init { + #x = 0 + } + + constructor() { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + constructor(z: Any) { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + constructor(y: Int) { + TODO("IrDelegatingConstructorCall") + } + + + + +} + diff --git a/compiler/testData/ir/irText/classes/secondaryConstructors.kt.txt b/compiler/testData/ir/irText/classes/secondaryConstructors.kt.txt new file mode 100644 index 00000000000..8799103a85a --- /dev/null +++ b/compiler/testData/ir/irText/classes/secondaryConstructors.kt.txt @@ -0,0 +1,16 @@ +class C { + constructor() { + TODO("IrDelegatingConstructorCall") + } + + constructor(x: Int) { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + diff --git a/compiler/testData/ir/irText/classes/superCalls.kt.txt b/compiler/testData/ir/irText/classes/superCalls.kt.txt new file mode 100644 index 00000000000..93db015d34e --- /dev/null +++ b/compiler/testData/ir/irText/classes/superCalls.kt.txt @@ -0,0 +1,43 @@ +open class Base { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + open fun foo() { + } + + open val bar: String + field = "" + open get + + override fun hashCode(): Int { + return .hashCode() + } + + + +} + +class Derived : Base { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + override fun foo() { + .foo() + } + + override val bar: String + override get(): String { + return .() + } + + + + +} + diff --git a/compiler/testData/ir/irText/classes/superCallsComposed.kt.txt b/compiler/testData/ir/irText/classes/superCallsComposed.kt.txt new file mode 100644 index 00000000000..975613f7844 --- /dev/null +++ b/compiler/testData/ir/irText/classes/superCallsComposed.kt.txt @@ -0,0 +1,50 @@ +open class Base { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + open fun foo() { + } + + open val bar: String + field = "" + open get + + + + +} + +interface BaseI { + abstract fun foo() + abstract val bar: String + abstract get + + + + +} + +class Derived : Base, BaseI { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + override fun foo() { + .foo() + } + + override val bar: String + override get(): String { + return .() + } + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/annotations/annotationsInAnnotationArguments.kt.txt b/compiler/testData/ir/irText/declarations/annotations/annotationsInAnnotationArguments.kt.txt new file mode 100644 index 00000000000..711c1e775ef --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/annotationsInAnnotationArguments.kt.txt @@ -0,0 +1,38 @@ +annotation class A1 : Annotation { + constructor(x: Int) /* primary */ + val x: Int + field = x + get + + + + +} + +annotation class A2 : Annotation { + constructor(a: A1) /* primary */ + val a: A1 + field = a + get + + + + +} + +annotation class AA : Annotation { + constructor(xs: Array) /* primary */ + val xs: Array + field = xs + get + + + + +} + +@A2(...) +@AA(...) +fun test() { +} + diff --git a/compiler/testData/ir/irText/declarations/annotations/annotationsWithDefaultParameterValues.kt.txt b/compiler/testData/ir/irText/declarations/annotations/annotationsWithDefaultParameterValues.kt.txt new file mode 100644 index 00000000000..81c99af6ec3 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/annotationsWithDefaultParameterValues.kt.txt @@ -0,0 +1,35 @@ +annotation class A : Annotation { + constructor(x: String = "", y: Int = 42) /* primary */ + val x: String + field = x + get + + val y: Int + field = y + get + + + + +} + +@A(...) +fun test1() { +} + +@A(...) +fun test2() { +} + +@A(...) +fun test3() { +} + +@A(...) +fun test4() { +} + +@A(...) +fun test5() { +} + diff --git a/compiler/testData/ir/irText/declarations/annotations/annotationsWithVarargParameters.kt.txt b/compiler/testData/ir/irText/declarations/annotations/annotationsWithVarargParameters.kt.txt new file mode 100644 index 00000000000..85037c6c8e0 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/annotationsWithVarargParameters.kt.txt @@ -0,0 +1,23 @@ +annotation class A : Annotation { + constructor(vararg xs: String) /* primary */ + val xs: Array + field = xs + get + + + + +} + +@A(...) +fun test1() { +} + +@A(...) +fun test2() { +} + +@A(...) +fun test3() { +} + diff --git a/compiler/testData/ir/irText/declarations/annotations/arrayInAnnotationArguments.kt.txt b/compiler/testData/ir/irText/declarations/annotations/arrayInAnnotationArguments.kt.txt new file mode 100644 index 00000000000..022c8245694 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/arrayInAnnotationArguments.kt.txt @@ -0,0 +1,32 @@ +annotation class TestAnnWithIntArray : Annotation { + constructor(x: IntArray) /* primary */ + val x: IntArray + field = x + get + + + + +} + +annotation class TestAnnWithStringArray : Annotation { + constructor(x: Array) /* primary */ + val x: Array + field = x + get + + + + +} + +@TestAnnWithIntArray(...) +@TestAnnWithStringArray(...) +fun test1() { +} + +@TestAnnWithIntArray(...) +@TestAnnWithStringArray(...) +fun test2() { +} + diff --git a/compiler/testData/ir/irText/declarations/annotations/classLiteralInAnnotation.kt.txt b/compiler/testData/ir/irText/declarations/annotations/classLiteralInAnnotation.kt.txt new file mode 100644 index 00000000000..6e6eab96d8e --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/classLiteralInAnnotation.kt.txt @@ -0,0 +1,27 @@ +annotation class A : Annotation { + constructor(klass: KClass<*>) /* primary */ + val klass: KClass<*> + field = klass + get + + + + +} + +class C { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +@A(...) +fun test1() { +} + diff --git a/compiler/testData/ir/irText/declarations/annotations/classesWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/classesWithAnnotations.kt.txt new file mode 100644 index 00000000000..d16a9469969 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/classesWithAnnotations.kt.txt @@ -0,0 +1,98 @@ +annotation class TestAnn : Annotation { + constructor(x: String) /* primary */ + val x: String + field = x + get + + + + +} + +@TestAnn(...) +class TestClass { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +@TestAnn(...) +interface TestInterface { + + + +} + +@TestAnn(...) +object TestObject { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +class Host { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + @TestAnn(...) + companion object TestCompanion { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + } + + + + +} + +@TestAnn(...) +enum class TestEnum : Enum { + private constructor() /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): TestEnum /* Synthetic body for ENUM_VALUEOF */ + +} + +@TestAnn(...) +annotation class TestAnnotation : Annotation { + constructor() /* primary */ + + + +} + diff --git a/compiler/testData/ir/irText/declarations/annotations/constExpressionsInAnnotationArguments.kt.txt b/compiler/testData/ir/irText/declarations/annotations/constExpressionsInAnnotationArguments.kt.txt new file mode 100644 index 00000000000..22b8ae751cd --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/constExpressionsInAnnotationArguments.kt.txt @@ -0,0 +1,23 @@ +const val ONE: Int + field = 1 + get + +annotation class A : Annotation { + constructor(x: Int) /* primary */ + val x: Int + field = x + get + + + + +} + +@A(...) +fun test1() { +} + +@A(...) +fun test2() { +} + diff --git a/compiler/testData/ir/irText/declarations/annotations/constructorsWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/constructorsWithAnnotations.kt.txt new file mode 100644 index 00000000000..0eb4c898228 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/constructorsWithAnnotations.kt.txt @@ -0,0 +1,29 @@ +annotation class TestAnn : Annotation { + constructor(x: Int) /* primary */ + val x: Int + field = x + get + + + + +} + +class TestClass { + @TestAnn(...) + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + @TestAnn(...) + constructor(x: Int) { + TODO("IrDelegatingConstructorCall") + } + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/annotations/delegateFieldWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/delegateFieldWithAnnotations.kt.txt new file mode 100644 index 00000000000..b8983dcc818 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/delegateFieldWithAnnotations.kt.txt @@ -0,0 +1,16 @@ +annotation class Ann : Annotation { + constructor() /* primary */ + + + +} + +val test1: Int /* by */ + field = lazy(initializer = local fun (): Int { + return 42 + } +) + get(): Int { + return getValue($receiver = #test1$delegate, thisRef = null, property = ::test1) + } + diff --git a/compiler/testData/ir/irText/declarations/annotations/delegatedPropertyAccessorsWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/delegatedPropertyAccessorsWithAnnotations.kt.txt new file mode 100644 index 00000000000..18880d0e373 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/delegatedPropertyAccessorsWithAnnotations.kt.txt @@ -0,0 +1,54 @@ +annotation class A : Annotation { + constructor(x: String) /* primary */ + val x: String + field = x + get + + + + +} + +class Cell { + constructor(value: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + var value: Int + field = value + get + set + + operator fun getValue(thisRef: Any?, kProp: Any?): Int { + return .() + } + + operator fun setValue(thisRef: Any?, kProp: Any?, newValue: Int) { + .( = newValue) + } + + + + +} + +val test1: Int /* by */ + field = TODO("IrConstructorCall") + @A(...) + get(): Int { + return #test1$delegate.getValue(thisRef = null, kProp = ::test1) + } + +var test2: Int /* by */ + field = TODO("IrConstructorCall") + @A(...) + get(): Int { + return #test2$delegate.getValue(thisRef = null, kProp = ::test2) + } + @A(...) + set(: Int) { + return #test2$delegate.setValue(thisRef = null, kProp = ::test2, newValue = ) + } + diff --git a/compiler/testData/ir/irText/declarations/annotations/enumEntriesWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/enumEntriesWithAnnotations.kt.txt new file mode 100644 index 00000000000..7b20269bb30 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/enumEntriesWithAnnotations.kt.txt @@ -0,0 +1,33 @@ +annotation class TestAnn : Annotation { + constructor(x: String) /* primary */ + val x: String + field = x + get + + + + +} + +open enum class TestEnum : Enum { + private constructor() /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + @TestAnn(...) + ENTRY1 init = TODO("IrEnumConstructorCall") @TestAnn(...) + ENTRY2 init = TODO("IrEnumConstructorCall") + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): TestEnum /* Synthetic body for ENUM_VALUEOF */ + +} + diff --git a/compiler/testData/ir/irText/declarations/annotations/enumsInAnnotationArguments.kt.txt b/compiler/testData/ir/irText/declarations/annotations/enumsInAnnotationArguments.kt.txt new file mode 100644 index 00000000000..738f36ef3cf --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/enumsInAnnotationArguments.kt.txt @@ -0,0 +1,35 @@ +enum class En : Enum { + private constructor() /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + A init = TODO("IrEnumConstructorCall") B init = TODO("IrEnumConstructorCall") C init = TODO("IrEnumConstructorCall") D init = TODO("IrEnumConstructorCall") + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): En /* Synthetic body for ENUM_VALUEOF */ + +} + +annotation class TestAnn : Annotation { + constructor(x: En) /* primary */ + val x: En + field = x + get + + + + +} + +@TestAnn(...) +fun test1() { +} + diff --git a/compiler/testData/ir/irText/declarations/annotations/fieldsWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/fieldsWithAnnotations.kt.txt new file mode 100644 index 00000000000..71c9a5e261f --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/fieldsWithAnnotations.kt.txt @@ -0,0 +1,20 @@ +annotation class TestAnn : Annotation { + constructor(x: String) /* primary */ + val x: String + field = x + get + + + + +} + +val testVal: String + field = "a val" + get + +var testVar: String + field = "a var" + get + set + diff --git a/compiler/testData/ir/irText/declarations/annotations/fileAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/fileAnnotations.kt.txt new file mode 100644 index 00000000000..6f671ccd6ea --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/fileAnnotations.kt.txt @@ -0,0 +1,15 @@ +@file:A(...) +package test + +@Target(...) +annotation class A : Annotation { + constructor(x: String) /* primary */ + val x: String + field = x + get + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/annotations/functionsWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/functionsWithAnnotations.kt.txt new file mode 100644 index 00000000000..615eedabed1 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/functionsWithAnnotations.kt.txt @@ -0,0 +1,15 @@ +annotation class TestAnn : Annotation { + constructor(x: Int) /* primary */ + val x: Int + field = x + get + + + + +} + +@TestAnn(...) +fun testSimpleFunction() { +} + diff --git a/compiler/testData/ir/irText/declarations/annotations/javaAnnotation.kt.txt b/compiler/testData/ir/irText/declarations/annotations/javaAnnotation.kt.txt new file mode 100644 index 00000000000..0adaea091db --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/javaAnnotation.kt.txt @@ -0,0 +1,12 @@ +@JavaAnn(...) +fun test1() { +} + +@JavaAnn(...) +fun test2() { +} + +@JavaAnn(...) +fun test3() { +} + diff --git a/compiler/testData/ir/irText/declarations/annotations/localDelegatedPropertiesWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/localDelegatedPropertiesWithAnnotations.kt.txt new file mode 100644 index 00000000000..ab8caeb375d --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/localDelegatedPropertiesWithAnnotations.kt.txt @@ -0,0 +1,25 @@ +annotation class A : Annotation { + constructor(x: String) /* primary */ + val x: String + field = x + get + + + + +} + +fun foo(m: Map) { + @A(...) + val test: Int + val test$delegate: Lazy = lazy(initializer = local fun (): Int { + return 42 + } +) + local get(): Int { + return getValue($receiver = test$delegate, thisRef = null, property = ::test) + } + + +} + diff --git a/compiler/testData/ir/irText/declarations/annotations/multipleAnnotationsInSquareBrackets.kt.txt b/compiler/testData/ir/irText/declarations/annotations/multipleAnnotationsInSquareBrackets.kt.txt new file mode 100644 index 00000000000..1f9fe854869 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/multipleAnnotationsInSquareBrackets.kt.txt @@ -0,0 +1,27 @@ +annotation class A1 : Annotation { + constructor() /* primary */ + + + +} + +annotation class A2 : Annotation { + constructor() /* primary */ + + + +} + +annotation class A3 : Annotation { + constructor() /* primary */ + + + +} + +@A1 +@A2 +@A3 +fun test() { +} + diff --git a/compiler/testData/ir/irText/declarations/annotations/primaryConstructorParameterWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/primaryConstructorParameterWithAnnotations.kt.txt new file mode 100644 index 00000000000..e40a2cd8d16 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/primaryConstructorParameterWithAnnotations.kt.txt @@ -0,0 +1,23 @@ +annotation class Ann : Annotation { + constructor() /* primary */ + + + +} + +class Test { + constructor(x: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = x + get + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/annotations/propertiesWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/propertiesWithAnnotations.kt.txt new file mode 100644 index 00000000000..671adf72795 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/propertiesWithAnnotations.kt.txt @@ -0,0 +1,16 @@ +annotation class TestAnn : Annotation { + constructor(x: String) /* primary */ + val x: String + field = x + get + + + + +} + +@TestAnn(...) +val testVal: String + field = "" + get + diff --git a/compiler/testData/ir/irText/declarations/annotations/propertyAccessorsFromClassHeaderWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/propertyAccessorsFromClassHeaderWithAnnotations.kt.txt new file mode 100644 index 00000000000..1b03d965163 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/propertyAccessorsFromClassHeaderWithAnnotations.kt.txt @@ -0,0 +1,35 @@ +annotation class A : Annotation { + constructor(x: String) /* primary */ + val x: String + field = x + get + + + + +} + +class C { + constructor(x: Int, y: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = x + @A(...) + get + + var y: Int + field = y + @A(...) + get + @A(...) + set + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/annotations/propertyAccessorsWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/propertyAccessorsWithAnnotations.kt.txt new file mode 100644 index 00000000000..aeeb6ff9e3b --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/propertyAccessorsWithAnnotations.kt.txt @@ -0,0 +1,38 @@ +annotation class TestAnn : Annotation { + constructor(x: String) /* primary */ + val x: String + field = x + get + + + + +} + +val test1: String + @TestAnn(...) + get(): String { + return "" + } + +var test2: String + @TestAnn(...) + get(): String { + return "" + } + @TestAnn(...) + set(value: String) { + } + +val test3: String + field = "" + @TestAnn(...) + get + +var test4: String + field = "" + @TestAnn(...) + get + @TestAnn(...) + set + diff --git a/compiler/testData/ir/irText/declarations/annotations/propertySetterParameterWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/propertySetterParameterWithAnnotations.kt.txt new file mode 100644 index 00000000000..58fe08cf983 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/propertySetterParameterWithAnnotations.kt.txt @@ -0,0 +1,29 @@ +annotation class AnnParam : Annotation { + constructor() /* primary */ + + + +} + +var p: Int + field = 0 + get + set + +class C { + constructor(p: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + var p: Int + field = p + get + set + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/annotations/receiverParameterWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/receiverParameterWithAnnotations.kt.txt new file mode 100644 index 00000000000..982aab5d8d0 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/receiverParameterWithAnnotations.kt.txt @@ -0,0 +1,37 @@ +annotation class Ann : Annotation { + constructor() /* primary */ + + + +} + +class A { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun String.f(): String { + return "" + } + + val String?.p: String + get(): String { + return "" + } + + + + +} + +fun String?.topLevelF(): String { + return "" +} + +val String.topLevelP: String + get(): String { + return "" + } + diff --git a/compiler/testData/ir/irText/declarations/annotations/spreadOperatorInAnnotationArguments.kt.txt b/compiler/testData/ir/irText/declarations/annotations/spreadOperatorInAnnotationArguments.kt.txt new file mode 100644 index 00000000000..fe14e8913cc --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/spreadOperatorInAnnotationArguments.kt.txt @@ -0,0 +1,15 @@ +annotation class A : Annotation { + constructor(vararg xs: String) /* primary */ + val xs: Array + field = xs + get + + + + +} + +@A(...) +fun test() { +} + diff --git a/compiler/testData/ir/irText/declarations/annotations/typeAliasesWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/typeAliasesWithAnnotations.kt.txt new file mode 100644 index 00000000000..64585d31b17 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/typeAliasesWithAnnotations.kt.txt @@ -0,0 +1,14 @@ +@Target(...) +annotation class TestAnn : Annotation { + constructor(x: String) /* primary */ + val x: String + field = x + get + + + + +} + +@TestAnn(...) +typealias TestTypeAlias = String diff --git a/compiler/testData/ir/irText/declarations/annotations/typeParametersWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/typeParametersWithAnnotations.kt.txt new file mode 100644 index 00000000000..4ac7ec179e9 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/typeParametersWithAnnotations.kt.txt @@ -0,0 +1,11 @@ +@Target(...) +annotation class Anno : Annotation { + constructor() /* primary */ + + + +} + +fun <@Anno T : Any?> foo() { +} + diff --git a/compiler/testData/ir/irText/declarations/annotations/valueParametersWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/valueParametersWithAnnotations.kt.txt new file mode 100644 index 00000000000..6485b01a174 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/valueParametersWithAnnotations.kt.txt @@ -0,0 +1,30 @@ +annotation class TestAnn : Annotation { + constructor(x: String) /* primary */ + val x: String + field = x + get + + + + +} + +fun testFun(x: Int) { +} + +class TestClassConstructor1 { + constructor(x: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val xx: Int + field = x + get + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/annotations/varargsInAnnotationArguments.kt.txt b/compiler/testData/ir/irText/declarations/annotations/varargsInAnnotationArguments.kt.txt new file mode 100644 index 00000000000..942b42a11a7 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/varargsInAnnotationArguments.kt.txt @@ -0,0 +1,45 @@ +annotation class A1 : Annotation { + constructor(vararg xs: Int) /* primary */ + val xs: IntArray + field = xs + get + + + + +} + +annotation class A2 : Annotation { + constructor(vararg xs: String) /* primary */ + val xs: Array + field = xs + get + + + + +} + +annotation class AA : Annotation { + constructor(vararg xs: A1) /* primary */ + val xs: Array + field = xs + get + + + + +} + +@A1(...) +@A2(...) +@AA(...) +fun test1() { +} + +@A1(...) +@A2(...) +@AA(...) +fun test2() { +} + diff --git a/compiler/testData/ir/irText/declarations/annotations/variablesWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/variablesWithAnnotations.kt.txt new file mode 100644 index 00000000000..b9795f116f8 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/variablesWithAnnotations.kt.txt @@ -0,0 +1,18 @@ +annotation class TestAnn : Annotation { + constructor(x: String) /* primary */ + val x: String + field = x + get + + + + +} + +fun foo() { + @TestAnn(...) + val testVal: String = "testVal" + @TestAnn(...) + var testVar: String = "testVar" +} + diff --git a/compiler/testData/ir/irText/declarations/catchParameterInTopLevelProperty.kt.txt b/compiler/testData/ir/irText/declarations/catchParameterInTopLevelProperty.kt.txt new file mode 100644 index 00000000000..81a302db6ff --- /dev/null +++ b/compiler/testData/ir/irText/declarations/catchParameterInTopLevelProperty.kt.txt @@ -0,0 +1,8 @@ +val test: Unit + field = try { //BLOCK + } + catch (...) { //BLOCK + } + + get + diff --git a/compiler/testData/ir/irText/declarations/classLevelProperties.kt.txt b/compiler/testData/ir/irText/declarations/classLevelProperties.kt.txt new file mode 100644 index 00000000000..61768233b4d --- /dev/null +++ b/compiler/testData/ir/irText/declarations/classLevelProperties.kt.txt @@ -0,0 +1,60 @@ +class C { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val test1: Int + field = 0 + get + + val test2: Int + get(): Int { + return 0 + } + + var test3: Int + field = 0 + get + set + + var test4: Int + field = 1 + get + set(value: Int) { + #test4 = value + } + + var test5: Int + field = 1 + get + private set + + val test6: Int + field = 1 + get + + val test7: Int /* by */ + field = lazy(initializer = local fun (): Int { + return 42 + } +) + get(): Int { + return getValue($receiver = #test7$delegate, thisRef = , property = ::test7) + } + + var test8: Int /* by */ + field = hashMapOf() + get(): Int { + return getValue($receiver = #test8$delegate, thisRef = , property = ::test8) + } + set(: Int) { + return setValue($receiver = #test8$delegate, thisRef = , property = ::test8, value = ) + } + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/constValInitializers.kt.txt b/compiler/testData/ir/irText/declarations/constValInitializers.kt.txt new file mode 100644 index 00000000000..d1caf458f2a --- /dev/null +++ b/compiler/testData/ir/irText/declarations/constValInitializers.kt.txt @@ -0,0 +1,28 @@ +const val I0: Int + field = 0 + get + +const val I1: Int + field = 1 + get + +const val I2: Int + field = 2 + get + +const val STR1: String + field = "String1" + get + +const val STR2: String + field = "String2" + get + +const val STR3: String + field = "String1String2" + get + +const val STR4: String + field = "String1String2" + get + diff --git a/compiler/testData/ir/irText/declarations/defaultArguments.kt.txt b/compiler/testData/ir/irText/declarations/defaultArguments.kt.txt new file mode 100644 index 00000000000..a2dca6a28e0 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/defaultArguments.kt.txt @@ -0,0 +1,7 @@ +fun test1(x: Int, y: Int = 0, z: String = "abc") { + local fun local(xx: Int = x, yy: Int = y, zz: String = z) { + } + + +} + diff --git a/compiler/testData/ir/irText/declarations/delegatedProperties.kt.txt b/compiler/testData/ir/irText/declarations/delegatedProperties.kt.txt new file mode 100644 index 00000000000..8adc36222ad --- /dev/null +++ b/compiler/testData/ir/irText/declarations/delegatedProperties.kt.txt @@ -0,0 +1,52 @@ +val test1: Int /* by */ + field = lazy(initializer = local fun (): Int { + return 42 + } +) + get(): Int { + return getValue($receiver = #test1$delegate, thisRef = null, property = ::test1) + } + +class C { + constructor(map: MutableMap) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val map: MutableMap + field = map + get + + val test2: Int /* by */ + field = lazy(initializer = local fun (): Int { + return 42 + } +) + get(): Int { + return getValue($receiver = #test2$delegate, thisRef = , property = ::test2) + } + + var test3: Any /* by */ + field = .() + get(): Any { + return getValue($receiver = #test3$delegate, thisRef = , property = ::test3) + } + set(: Any) { + return setValue($receiver = #test3$delegate, thisRef = , property = ::test3, value = ) + } + + + + +} + +var test4: Any /* by */ + field = hashMapOf() + get(): Any { + return getValue($receiver = #test4$delegate, thisRef = null, property = ::test4) + } + set(: Any) { + return setValue($receiver = #test4$delegate, thisRef = null, property = ::test4, value = ) + } + diff --git a/compiler/testData/ir/irText/declarations/deprecatedProperty.kt.txt b/compiler/testData/ir/irText/declarations/deprecatedProperty.kt.txt new file mode 100644 index 00000000000..af4c0bc60ad --- /dev/null +++ b/compiler/testData/ir/irText/declarations/deprecatedProperty.kt.txt @@ -0,0 +1,67 @@ +@Deprecated(...) +val testVal: Int + field = 1 + get + +@Deprecated(...) +var testVar: Int + field = 1 + get + set + +@Deprecated(...) +val testValWithExplicitDefaultGet: Int + field = 1 + get + +@Deprecated(...) +val testValWithExplicitGet: Int + get(): Int { + return 1 + } + +@Deprecated(...) +var testVarWithExplicitDefaultGet: Int + field = 1 + get + set + +@Deprecated(...) +var testVarWithExplicitDefaultSet: Int + field = 1 + get + set + +@Deprecated(...) +var testVarWithExplicitDefaultGetSet: Int + field = 1 + get + set + +@Deprecated(...) +var testVarWithExplicitGetSet: Int + get(): Int { + return 1 + } + set(v: Int) { + } + +@Deprecated(...) +lateinit var testLateinitVar: Any + get + set + +@Deprecated(...) +val Any.testExtVal: Int + get(): Int { + return 1 + } + +@Deprecated(...) +var Any.textExtVar: Int + get(): Int { + return 1 + } + set(v: Int) { + } + diff --git a/compiler/testData/ir/irText/declarations/extensionProperties.kt.txt b/compiler/testData/ir/irText/declarations/extensionProperties.kt.txt new file mode 100644 index 00000000000..89d96b22654 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/extensionProperties.kt.txt @@ -0,0 +1,36 @@ +val String.test1: Int + get(): Int { + return 42 + } + +var String.test2: Int + get(): Int { + return 42 + } + set(value: Int) { + } + +class Host { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val String.test3: Int + get(): Int { + return 42 + } + + var String.test4: Int + get(): Int { + return 42 + } + set(value: Int) { + } + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/fakeOverrides.kt.txt b/compiler/testData/ir/irText/declarations/fakeOverrides.kt.txt new file mode 100644 index 00000000000..b4b4e8be196 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/fakeOverrides.kt.txt @@ -0,0 +1,48 @@ +interface IFooStr { + abstract fun foo(x: String) + + + +} + +interface IBar { + abstract val bar: Int + abstract get + + + + +} + +abstract class CFoo { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun foo(x: T) { + } + + + + +} + +class Test1 : CFoo, IFooStr, IBar { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + override val bar: Int + field = 42 + override get + + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/fileWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/fileWithAnnotations.kt.txt new file mode 100644 index 00000000000..8d420ce8046 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/fileWithAnnotations.kt.txt @@ -0,0 +1,9 @@ +@file:JvmName(...) + +fun foo() { +} + +val bar: Int + field = 42 + get + diff --git a/compiler/testData/ir/irText/declarations/fileWithTypeAliasesOnly.kt.txt b/compiler/testData/ir/irText/declarations/fileWithTypeAliasesOnly.kt.txt new file mode 100644 index 00000000000..50f697dbc77 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/fileWithTypeAliasesOnly.kt.txt @@ -0,0 +1 @@ +typealias Bar = Function1 diff --git a/compiler/testData/ir/irText/declarations/genericDelegatedProperty.kt.txt b/compiler/testData/ir/irText/declarations/genericDelegatedProperty.kt.txt new file mode 100644 index 00000000000..e251ad487c7 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/genericDelegatedProperty.kt.txt @@ -0,0 +1,40 @@ +class C { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +object Delegate { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + operator fun getValue(thisRef: Any?, kProp: Any?): Int { + return 42 + } + + operator fun setValue(thisRef: Any?, kProp: Any?, newValue: Int) { + } + + + + +} + +var C.genericDelegatedProperty: Int /* by */ + field = Delegate + get(): Int { + return #genericDelegatedProperty$delegate.getValue(thisRef = , kProp = ::genericDelegatedProperty) + } + set(: Int) { + return #genericDelegatedProperty$delegate.setValue(thisRef = , kProp = ::genericDelegatedProperty, newValue = ) + } + diff --git a/compiler/testData/ir/irText/declarations/interfaceProperties.kt.txt b/compiler/testData/ir/irText/declarations/interfaceProperties.kt.txt new file mode 100644 index 00000000000..fb728387d4a --- /dev/null +++ b/compiler/testData/ir/irText/declarations/interfaceProperties.kt.txt @@ -0,0 +1,25 @@ +interface C { + abstract val test1: Int + abstract get + + val test2: Int + get(): Int { + return 0 + } + + abstract var test3: Int + abstract get + abstract set + + var test4: Int + get(): Int { + return 0 + } + set(value: Int) { + } + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/kt27005.kt.txt b/compiler/testData/ir/irText/declarations/kt27005.kt.txt new file mode 100644 index 00000000000..0601dd1634d --- /dev/null +++ b/compiler/testData/ir/irText/declarations/kt27005.kt.txt @@ -0,0 +1,12 @@ +suspend fun foo() { + return baz() +} + +suspend fun bar(): Any { + return baz() +} + +suspend fun baz(): T { + TODO() +} + diff --git a/compiler/testData/ir/irText/declarations/kt29833.kt.txt b/compiler/testData/ir/irText/declarations/kt29833.kt.txt new file mode 100644 index 00000000000..476db0fd560 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/kt29833.kt.txt @@ -0,0 +1,22 @@ +package interop + +object Definitions { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + const val KT_CONSTANT: String + field = "constant" + get + + val ktValue: String + field = #CONSTANT + get + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/kt35550.kt.txt b/compiler/testData/ir/irText/declarations/kt35550.kt.txt new file mode 100644 index 00000000000..2c5d4c77ac6 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/kt35550.kt.txt @@ -0,0 +1,29 @@ +interface I { + val T.id: T + get(): T { + return + } + + + + +} + +class A : I { + constructor(i: I) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + private /*final field*/ val $$delegate_0: I = i + override val T.id: T + override get(): T { + return #$$delegate_0.($receiver = ) + } + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/localClassWithOverrides.kt.txt b/compiler/testData/ir/irText/declarations/localClassWithOverrides.kt.txt new file mode 100644 index 00000000000..d30600b0bdf --- /dev/null +++ b/compiler/testData/ir/irText/declarations/localClassWithOverrides.kt.txt @@ -0,0 +1,49 @@ +fun outer() { + local abstract class ALocal { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + abstract fun afun() + abstract val aval: Int + abstract get + + abstract var avar: Int + abstract get + abstract set + + + + + } + + + local class Local : ALocal { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + override fun afun() { + } + + override val aval: Int + field = 1 + override get + + override var avar: Int + field = 2 + override get + override set + + + + + } + + +} + diff --git a/compiler/testData/ir/irText/declarations/localDelegatedProperties.kt.txt b/compiler/testData/ir/irText/declarations/localDelegatedProperties.kt.txt new file mode 100644 index 00000000000..c09352b6bbb --- /dev/null +++ b/compiler/testData/ir/irText/declarations/localDelegatedProperties.kt.txt @@ -0,0 +1,34 @@ +fun test1() { + val x: Int + val x$delegate: Lazy = lazy(initializer = local fun (): Int { + return 42 + } +) + local get(): Int { + return getValue($receiver = x$delegate, thisRef = null, property = ::x) + } + + + println(message = ()) +} + +fun test2() { + var x: Int + val x$delegate: HashMap = hashMapOf() + local get(): Int { + return getValue($receiver = x$delegate, thisRef = null, property = ::x) + } + local set(value: Int) { + return setValue($receiver = x$delegate, thisRef = null, property = ::x, value = value) + } + + + (value = 0) + { //BLOCK + val tmp0: Int = () + (value = tmp0.inc()) + tmp0 + } /*~> Unit */ + (value = ().plus(other = 1)) +} + diff --git a/compiler/testData/ir/irText/declarations/localVarInDoWhile.kt.txt b/compiler/testData/ir/irText/declarations/localVarInDoWhile.kt.txt new file mode 100644 index 00000000000..0ba20a802ad --- /dev/null +++ b/compiler/testData/ir/irText/declarations/localVarInDoWhile.kt.txt @@ -0,0 +1,8 @@ +fun foo() { + { //BLOCK + do// COMPOSITE { + val x: Int = 42 + // } while (EQEQ(arg0 = x, arg1 = 42).not()) + } +} + diff --git a/compiler/testData/ir/irText/declarations/multiplatform/expectClassInherited.kt.txt b/compiler/testData/ir/irText/declarations/multiplatform/expectClassInherited.kt.txt new file mode 100644 index 00000000000..cb047fd67b3 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/multiplatform/expectClassInherited.kt.txt @@ -0,0 +1,48 @@ +expect abstract class A { + protected expect constructor() /* primary */ + expect abstract fun foo() + + + +} + +expect open class B : A { + expect constructor(i: Int) /* primary */ + expect override fun foo() + expect open fun bar(s: String) + + + +} + +abstract class A { + protected constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + abstract fun foo() + + + +} + +open class B : A { + constructor(i: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + override fun foo() { + } + + open fun bar(s: String) { + } + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/multiplatform/expectedEnumClass.kt.txt b/compiler/testData/ir/irText/declarations/multiplatform/expectedEnumClass.kt.txt new file mode 100644 index 00000000000..c0bc3b9a218 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/multiplatform/expectedEnumClass.kt.txt @@ -0,0 +1,36 @@ +expect enum class MyEnum : Enum { + FOO + BAR + + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): MyEnum /* Synthetic body for ENUM_VALUEOF */ + +} + +enum class MyEnum : Enum { + private constructor() /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + FOO init = TODO("IrEnumConstructorCall") BAR init = TODO("IrEnumConstructorCall") BAZ init = TODO("IrEnumConstructorCall") + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): MyEnum /* Synthetic body for ENUM_VALUEOF */ + +} + diff --git a/compiler/testData/ir/irText/declarations/multiplatform/expectedSealedClass.kt.txt b/compiler/testData/ir/irText/declarations/multiplatform/expectedSealedClass.kt.txt new file mode 100644 index 00000000000..0593c6a91cd --- /dev/null +++ b/compiler/testData/ir/irText/declarations/multiplatform/expectedSealedClass.kt.txt @@ -0,0 +1,38 @@ +expect sealed class Ops { + private expect constructor() /* primary */ + + + +} + +expect class Add : Ops { + expect constructor() /* primary */ + + + +} + +sealed class Ops { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +class Add : Ops { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/packageLevelProperties.kt.txt b/compiler/testData/ir/irText/declarations/packageLevelProperties.kt.txt new file mode 100644 index 00000000000..cfb6b100bc7 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/packageLevelProperties.kt.txt @@ -0,0 +1,48 @@ +val test1: Int + field = 0 + get + +val test2: Int + get(): Int { + return 0 + } + +var test3: Int + field = 0 + get + set + +var test4: Int + field = 1 + get + set(value: Int) { + #test4 = value + } + +var test5: Int + field = 1 + get + private set + +val test6: Int + field = 1 + get + +val test7: Int /* by */ + field = lazy(initializer = local fun (): Int { + return 42 + } +) + get(): Int { + return getValue($receiver = #test7$delegate, thisRef = null, property = ::test7) + } + +var test8: Int /* by */ + field = hashMapOf() + get(): Int { + return getValue($receiver = #test8$delegate, thisRef = null, property = ::test8) + } + set(: Int) { + return setValue($receiver = #test8$delegate, thisRef = null, property = ::test8, value = ) + } + diff --git a/compiler/testData/ir/irText/declarations/parameters/class.kt.txt b/compiler/testData/ir/irText/declarations/parameters/class.kt.txt new file mode 100644 index 00000000000..e0dabfcde44 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/parameters/class.kt.txt @@ -0,0 +1,48 @@ +interface TestInterface { + interface TestNestedInterface { + + + + } + + + + +} + +class Test { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + class TestNested { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + } + + inner class TestInner { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + } + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/parameters/constructor.kt.txt b/compiler/testData/ir/irText/declarations/parameters/constructor.kt.txt new file mode 100644 index 00000000000..c6459372149 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/parameters/constructor.kt.txt @@ -0,0 +1,96 @@ +class Test1 { + constructor(x: T1, y: T2) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: T1 + field = x + get + + val y: T2 + field = y + get + + + + +} + +class Test2 { + constructor(x: Int, y: String) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val y: String + field = y + get + + inner class TestInner { + constructor(z: Z) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val z: Z + field = z + get + + constructor(z: Z, i: Int) { + TODO("IrDelegatingConstructorCall") + } + + + + + } + + + + +} + +class Test3 { + constructor(x: Int, y: String = "") /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = x + get + + val y: String + field = y + get + + + + +} + +class Test4 { + constructor(x: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = x + get + + constructor(x: Int, y: Int = 42) { + TODO("IrDelegatingConstructorCall") + } + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.kt.txt b/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.kt.txt new file mode 100644 index 00000000000..97c51aa08c6 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.kt.txt @@ -0,0 +1,63 @@ +data class Test { + constructor(x: T, y: String = "") /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: T + field = x + get + + val y: String + field = y + get + + operator fun component1(): T { + return #x + } + + operator fun component2(): String { + return #y + } + + fun copy(x: T = #x, y: String = #y): Test { + return TODO("IrConstructorCall") + } + + override fun toString(): String { + return "Test(" + +"x=" + +#x + +", " + +"y=" + +#y + +")" + } + + override fun hashCode(): Int { + return when { + EQEQ(arg0 = #x, arg1 = null) -> 0 + true -> #x.hashCode() + }.times(other = 31).plus(other = #y.hashCode()) + } + + override operator fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is Test -> return false + } + val tmp0_other_with_cast: Test = other as Test + when { + EQEQ(arg0 = #x, arg1 = #x).not() -> return false + } + when { + EQEQ(arg0 = #y, arg1 = #y).not() -> return false + } + return true + } + +} + diff --git a/compiler/testData/ir/irText/declarations/parameters/defaultPropertyAccessors.kt.txt b/compiler/testData/ir/irText/declarations/parameters/defaultPropertyAccessors.kt.txt new file mode 100644 index 00000000000..11dc09f1d13 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/parameters/defaultPropertyAccessors.kt.txt @@ -0,0 +1,51 @@ +val test1: Int + field = 42 + get + +var test2: Int + field = 42 + get + set + +class Host { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val testMember1: Int + field = 42 + get + + var testMember2: Int + field = 42 + get + set + + + + +} + +class InPrimaryCtor { + constructor(testInPrimaryCtor1: T, testInPrimaryCtor2: Int = 42) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val testInPrimaryCtor1: T + field = testInPrimaryCtor1 + get + + var testInPrimaryCtor2: Int + field = testInPrimaryCtor2 + get + set + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/parameters/delegatedMembers.kt.txt b/compiler/testData/ir/irText/declarations/parameters/delegatedMembers.kt.txt new file mode 100644 index 00000000000..b46221efc9f --- /dev/null +++ b/compiler/testData/ir/irText/declarations/parameters/delegatedMembers.kt.txt @@ -0,0 +1,37 @@ +interface IBase { + abstract fun foo(x: Int) + abstract val bar: Int + abstract get + + abstract fun qux(t: T, x: X) + + + +} + +class Test : IBase { + constructor(impl: IBase) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + private /*final field*/ val $$delegate_0: IBase = impl + override fun qux(t: TT, x: X) { + #$$delegate_0.qux(t = t, x = x) + } + + override fun foo(x: Int) { + #$$delegate_0.foo(x = x) + } + + override val bar: Int + override get(): Int { + return #$$delegate_0.() + } + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/parameters/fun.kt.txt b/compiler/testData/ir/irText/declarations/parameters/fun.kt.txt new file mode 100644 index 00000000000..b037bbb251f --- /dev/null +++ b/compiler/testData/ir/irText/declarations/parameters/fun.kt.txt @@ -0,0 +1,30 @@ +fun test1(i: Int, j: T) { +} + +fun test2(i: Int = 0, j: String = "") { +} + +fun test3(vararg args: String) { +} + +fun String.textExt1(i: Int, j: String) { +} + +class Host { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun String.testMembetExt1(i: Int, j: String) { + } + + fun String.testMembetExt2(i: Int, j: T) { + } + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/parameters/genericInnerClass.kt.txt b/compiler/testData/ir/irText/declarations/parameters/genericInnerClass.kt.txt new file mode 100644 index 00000000000..1d8f8e12210 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/parameters/genericInnerClass.kt.txt @@ -0,0 +1,27 @@ +class Outer { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + inner class Inner { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun foo(x1: T1, x2: T2) { + } + + + + + } + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/parameters/lambdas.kt.txt b/compiler/testData/ir/irText/declarations/parameters/lambdas.kt.txt new file mode 100644 index 00000000000..925e802a909 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/parameters/lambdas.kt.txt @@ -0,0 +1,27 @@ +val test1: Function1 + field = local fun (it: String): String { + return it + } + + get + +val test2: @ExtensionFunctionType Function2 + field = local fun Any.(it: Any): Int { + return it.hashCode() + } + + get + +val test3: Function2 + field = local fun (i: Int, j: Int) { + return Unit + } + + get + +val test4: Function2 + field = local fun (i: Int, j: Int) { + } + + get + diff --git a/compiler/testData/ir/irText/declarations/parameters/localFun.kt.txt b/compiler/testData/ir/irText/declarations/parameters/localFun.kt.txt new file mode 100644 index 00000000000..eb35ac3ce24 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/parameters/localFun.kt.txt @@ -0,0 +1,19 @@ +fun outer() { + local fun test1(i: Int, j: T) { + } + + + local fun test2(i: Int = 0, j: String = "") { + } + + + local fun test3(vararg args: String) { + } + + + local fun String.textExt1(i: Int, j: TT) { + } + + +} + diff --git a/compiler/testData/ir/irText/declarations/parameters/propertyAccessors.kt.txt b/compiler/testData/ir/irText/declarations/parameters/propertyAccessors.kt.txt new file mode 100644 index 00000000000..b7c7fa7e6c3 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/parameters/propertyAccessors.kt.txt @@ -0,0 +1,84 @@ +val test1: Int + get(): Int { + return 42 + } + +var test2: Int + get(): Int { + return 42 + } + set(value: Int) { + } + +val String.testExt1: Int + get(): Int { + return 42 + } + +var String.testExt2: Int + get(): Int { + return 42 + } + set(value: Int) { + } + +val T.testExt3: Int + get(): Int { + return 42 + } + +var T.testExt4: Int + get(): Int { + return 42 + } + set(value: Int) { + } + +class Host { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val testMem1: Int + get(): Int { + return 42 + } + + var testMem2: Int + get(): Int { + return 42 + } + set(value: Int) { + } + + val String.testMemExt1: Int + get(): Int { + return 42 + } + + var String.testMemExt2: Int + get(): Int { + return 42 + } + set(value: Int) { + } + + val TT.testMemExt3: Int + get(): Int { + return 42 + } + + var TT.testMemExt4: Int + get(): Int { + return 42 + } + set(value: Int) { + } + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/parameters/typeParameterBeforeBound.kt.txt b/compiler/testData/ir/irText/declarations/parameters/typeParameterBeforeBound.kt.txt new file mode 100644 index 00000000000..d4357727646 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/parameters/typeParameterBeforeBound.kt.txt @@ -0,0 +1,21 @@ +class Test1 { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +fun test2() { +} + +var Test1.test3: Unit + get() { + } + set(value: Unit) { + } + diff --git a/compiler/testData/ir/irText/declarations/parameters/typeParameterBoundedBySubclass.kt.txt b/compiler/testData/ir/irText/declarations/parameters/typeParameterBoundedBySubclass.kt.txt new file mode 100644 index 00000000000..67a57838a10 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/parameters/typeParameterBoundedBySubclass.kt.txt @@ -0,0 +1,52 @@ +abstract class Base1 { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +class Derived1 : Base1 { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +abstract class Base2 { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun foo(x: T) { + } + + + + +} + +class Derived2 : Base2 { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/parameters/useNextParamInLambda.kt.txt b/compiler/testData/ir/irText/declarations/parameters/useNextParamInLambda.kt.txt new file mode 100644 index 00000000000..8d97fb2bef8 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/parameters/useNextParamInLambda.kt.txt @@ -0,0 +1,28 @@ +fun f(f1: Function0 = local fun (): String { + return f2.invoke() +} +, f2: Function0 = local fun (): String { + return "FAIL" +} +): String { + return f1.invoke() +} + +fun box(): String { + var result: String = "fail" + try { //BLOCK + f() /*~> Unit */ + } + catch (...) { //BLOCK + result = "OK" + } + + return f(, f2 = local fun (): String { + return "O" + } +).plus(other = f(f1 = local fun (): String { + return "K" + } +)) +} + diff --git a/compiler/testData/ir/irText/declarations/primaryCtorDefaultArguments.kt.txt b/compiler/testData/ir/irText/declarations/primaryCtorDefaultArguments.kt.txt new file mode 100644 index 00000000000..3ddc35b5ccf --- /dev/null +++ b/compiler/testData/ir/irText/declarations/primaryCtorDefaultArguments.kt.txt @@ -0,0 +1,16 @@ +class Test { + constructor(x: Int = 0) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = x + get + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/primaryCtorProperties.kt.txt b/compiler/testData/ir/irText/declarations/primaryCtorProperties.kt.txt new file mode 100644 index 00000000000..0490a0fead8 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/primaryCtorProperties.kt.txt @@ -0,0 +1,21 @@ +class C { + constructor(test1: Int, test2: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val test1: Int + field = test1 + get + + var test2: Int + field = test2 + get + set + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/differentReceivers.kt.txt b/compiler/testData/ir/irText/declarations/provideDelegate/differentReceivers.kt.txt new file mode 100644 index 00000000000..1f6a03a16b7 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/provideDelegate/differentReceivers.kt.txt @@ -0,0 +1,40 @@ +class MyClass { + constructor(value: String) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val value: String + field = value + get + + + + +} + +operator fun MyClass.provideDelegate(host: Any?, p: Any): String { + return .() +} + +operator fun String.getValue(receiver: Any?, p: Any): String { + return +} + +val testO: String /* by */ + field = provideDelegate($receiver = TODO("IrConstructorCall"), host = null, p = ::testO) + get(): String { + return getValue($receiver = #testO$delegate, receiver = null, p = ::testO) + } + +val testK: String /* by */ + field = "K" + get(): String { + return getValue($receiver = #testK$delegate, receiver = null, p = ::testK) + } + +val testOK: String + field = ().plus(other = ()) + get + diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/local.kt.txt b/compiler/testData/ir/irText/declarations/provideDelegate/local.kt.txt new file mode 100644 index 00000000000..1721d1eea00 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/provideDelegate/local.kt.txt @@ -0,0 +1,50 @@ +class Delegate { + constructor(value: String) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val value: String + field = value + get + + operator fun getValue(thisRef: Any?, property: Any?): String { + return .() + } + + + + +} + +class DelegateProvider { + constructor(value: String) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val value: String + field = value + get + + operator fun provideDelegate(thisRef: Any?, property: Any?): Delegate { + return TODO("IrConstructorCall") + } + + + + +} + +fun foo() { + val testMember: String + val testMember$delegate: Delegate = TODO("IrConstructorCall").provideDelegate(thisRef = null, property = ::testMember) + local get(): String { + return testMember$delegate.getValue(thisRef = null, property = ::testMember) + } + + +} + diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/localDifferentReceivers.kt.txt b/compiler/testData/ir/irText/declarations/provideDelegate/localDifferentReceivers.kt.txt new file mode 100644 index 00000000000..4555d57fb14 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/provideDelegate/localDifferentReceivers.kt.txt @@ -0,0 +1,43 @@ +class MyClass { + constructor(value: String) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val value: String + field = value + get + + + + +} + +operator fun MyClass.provideDelegate(host: Any?, p: Any): String { + return .() +} + +operator fun String.getValue(receiver: Any?, p: Any): String { + return +} + +fun box(): String { + val testO: String + val testO$delegate: String = provideDelegate($receiver = TODO("IrConstructorCall"), host = null, p = ::testO) + local get(): String { + return getValue($receiver = testO$delegate, receiver = null, p = ::testO) + } + + + val testK: String + val testK$delegate: String = "K" + local get(): String { + return getValue($receiver = testK$delegate, receiver = null, p = ::testK) + } + + + val testOK: String = ().plus(other = ()) + return testOK +} + diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/member.kt.txt b/compiler/testData/ir/irText/declarations/provideDelegate/member.kt.txt new file mode 100644 index 00000000000..98919c32093 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/provideDelegate/member.kt.txt @@ -0,0 +1,58 @@ +class Delegate { + constructor(value: String) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val value: String + field = value + get + + operator fun getValue(thisRef: Any?, property: Any?): String { + return .() + } + + + + +} + +class DelegateProvider { + constructor(value: String) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val value: String + field = value + get + + operator fun provideDelegate(thisRef: Any?, property: Any?): Delegate { + return TODO("IrConstructorCall") + } + + + + +} + +class Host { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val testMember: String /* by */ + field = TODO("IrConstructorCall").provideDelegate(thisRef = , property = ::testMember) + get(): String { + return #testMember$delegate.getValue(thisRef = , property = ::testMember) + } + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.kt.txt b/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.kt.txt new file mode 100644 index 00000000000..27443f19648 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.kt.txt @@ -0,0 +1,46 @@ +object Host { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + class StringDelegate { + constructor(s: String) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val s: String + field = s + get + + operator fun getValue(receiver: String, p: Any): String { + return receiver.plus(other = .()) + } + + + + + } + + operator fun String.provideDelegate(host: Any?, p: Any): StringDelegate { + return TODO("IrConstructorCall") + } + + val String.plusK: String /* by */ + field = .provideDelegate($receiver = "K", host = , p = ::plusK) + get(): String { + return #plusK$delegate.getValue(receiver = , p = ::plusK) + } + + val ok: String + field = .($receiver = "O") + get + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/topLevel.kt.txt b/compiler/testData/ir/irText/declarations/provideDelegate/topLevel.kt.txt new file mode 100644 index 00000000000..e470542c0da --- /dev/null +++ b/compiler/testData/ir/irText/declarations/provideDelegate/topLevel.kt.txt @@ -0,0 +1,46 @@ +class Delegate { + constructor(value: String) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val value: String + field = value + get + + operator fun getValue(thisRef: Any?, property: Any?): String { + return .() + } + + + + +} + +class DelegateProvider { + constructor(value: String) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val value: String + field = value + get + + operator fun provideDelegate(thisRef: Any?, property: Any?): Delegate { + return TODO("IrConstructorCall") + } + + + + +} + +val testTopLevel: String /* by */ + field = TODO("IrConstructorCall").provideDelegate(thisRef = null, property = ::testTopLevel) + get(): String { + return #testTopLevel$delegate.getValue(thisRef = null, property = ::testTopLevel) + } + diff --git a/compiler/testData/ir/irText/declarations/typeAlias.kt.txt b/compiler/testData/ir/irText/declarations/typeAlias.kt.txt new file mode 100644 index 00000000000..1a0b5a5c619 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/typeAlias.kt.txt @@ -0,0 +1,20 @@ +typealias Test1 = String +fun foo() { + { //BLOCK + } +} + +class C { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + @Suppress(...) + typealias TestNested = String + + + +} + diff --git a/compiler/testData/ir/irText/errors/suppressedNonPublicCall.kt.txt b/compiler/testData/ir/irText/errors/suppressedNonPublicCall.kt.txt new file mode 100644 index 00000000000..6b5513aa06e --- /dev/null +++ b/compiler/testData/ir/irText/errors/suppressedNonPublicCall.kt.txt @@ -0,0 +1,19 @@ +class C { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + internal fun bar() { + } + + + + +} + +inline fun C.foo() { + .bar() +} + diff --git a/compiler/testData/ir/irText/errors/unresolvedReference.kt.txt b/compiler/testData/ir/irText/errors/unresolvedReference.kt.txt new file mode 100644 index 00000000000..c72f3b8a302 --- /dev/null +++ b/compiler/testData/ir/irText/errors/unresolvedReference.kt.txt @@ -0,0 +1,16 @@ +val test1: ErrorType /* ERROR */ + field = error("") /* ERROR CALL */ + get + +val test2: ErrorType /* ERROR */ + field = error("") /* ERROR CALL */ + get + +val test3: ErrorType /* ERROR */ + field = error("") /* ERROR CALL */ + get + +val test4: ErrorType /* ERROR */ + field = error("") /* ERROR EXPRESSION */ + get + diff --git a/compiler/testData/ir/irText/expressions/argumentMappedWithError.kt.txt b/compiler/testData/ir/irText/expressions/argumentMappedWithError.kt.txt new file mode 100644 index 00000000000..1f6e1b67494 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/argumentMappedWithError.kt.txt @@ -0,0 +1,12 @@ +fun Number.convert(): R { + TODO() +} + +fun foo(arg: Number) { +} + +fun main(args: Array) { + val x: Int = 0 + foo(arg = convert($receiver = x)) +} + diff --git a/compiler/testData/ir/irText/expressions/arrayAccess.kt.txt b/compiler/testData/ir/irText/expressions/arrayAccess.kt.txt new file mode 100644 index 00000000000..31fe99fc065 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/arrayAccess.kt.txt @@ -0,0 +1,12 @@ +val p: Int + field = 0 + get + +fun foo(): Int { + return 1 +} + +fun test(a: IntArray): Int { + return a.get(index = 0).plus(other = a.get(index = ())).plus(other = a.get(index = foo())) +} + diff --git a/compiler/testData/ir/irText/expressions/arrayAssignment.kt.txt b/compiler/testData/ir/irText/expressions/arrayAssignment.kt.txt new file mode 100644 index 00000000000..1908e6e16f3 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/arrayAssignment.kt.txt @@ -0,0 +1,13 @@ +fun test() { + val x: IntArray = intArrayOf(elements = [1, 2, 3]) + x.set(index = 1, value = 0) +} + +fun foo(): Int { + return 1 +} + +fun test2() { + intArrayOf(elements = [1, 2, 3]).set(index = foo(), value = 1) +} + diff --git a/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment1.kt.txt b/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment1.kt.txt new file mode 100644 index 00000000000..9d2b50ff744 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment1.kt.txt @@ -0,0 +1,51 @@ +fun foo(): IntArray { + return intArrayOf(elements = [1, 2, 3]) +} + +fun bar(): Int { + return 42 +} + +class C { + constructor(x: IntArray) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: IntArray + field = x + get + + + + +} + +fun testVariable() { + var x: IntArray = foo() + { //BLOCK + val tmp0_array: IntArray = x + val tmp1_index0: Int = 0 + tmp0_array.set(index = tmp1_index0, value = tmp0_array.get(index = tmp1_index0).plus(other = 1)) + } +} + +fun testCall() { + { //BLOCK + val tmp0_array: IntArray = foo() + val tmp1_index0: Int = bar() + tmp0_array.set(index = tmp1_index0, value = tmp0_array.get(index = tmp1_index0).times(other = 2)) + } +} + +fun testMember(c: C) { + { //BLOCK + val tmp0_array: IntArray = c.() + val tmp1_index0: Int = 0 + val tmp2: Int = tmp0_array.get(index = tmp1_index0) + tmp0_array.set(index = tmp1_index0, value = tmp2.inc()) + tmp2 + } /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment2.kt.txt b/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment2.kt.txt new file mode 100644 index 00000000000..79450c07ee4 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment2.kt.txt @@ -0,0 +1,22 @@ +interface IA { + abstract operator fun get(index: String): Int + + + +} + +interface IB { + abstract operator fun IA.set(index: String, value: Int) + + + +} + +fun IB.test(a: IA) { + { //BLOCK + val tmp0_array: IA = a + val tmp1_index0: String = "" + .set($receiver = tmp0_array, index = tmp1_index0, value = tmp0_array.get(index = tmp1_index0).plus(other = 42)) + } +} + diff --git a/compiler/testData/ir/irText/expressions/assignments.kt.txt b/compiler/testData/ir/irText/expressions/assignments.kt.txt new file mode 100644 index 00000000000..dee27ccad05 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/assignments.kt.txt @@ -0,0 +1,27 @@ +class Ref { + constructor(x: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + var x: Int + field = x + get + set + + + + +} + +fun test1() { + var x: Int = 0 + x = 1 + x = x.plus(other = 1) +} + +fun test2(r: Ref) { + r.( = 0) +} + diff --git a/compiler/testData/ir/irText/expressions/augmentedAssignment1.kt.txt b/compiler/testData/ir/irText/expressions/augmentedAssignment1.kt.txt new file mode 100644 index 00000000000..b7083314874 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/augmentedAssignment1.kt.txt @@ -0,0 +1,32 @@ +var p: Int + field = 0 + get + set + +fun testVariable() { + var x: Int = 0 + x = x.plus(other = 1) + x = x.minus(other = 2) + x = x.times(other = 3) + x = x.div(other = 4) + x = x.rem(other = 5) +} + +fun testProperty() { + { //BLOCK + ( = ().plus(other = 1)) + } + { //BLOCK + ( = ().minus(other = 2)) + } + { //BLOCK + ( = ().times(other = 3)) + } + { //BLOCK + ( = ().div(other = 4)) + } + { //BLOCK + ( = ().rem(other = 5)) + } +} + diff --git a/compiler/testData/ir/irText/expressions/augmentedAssignment2.kt.txt b/compiler/testData/ir/irText/expressions/augmentedAssignment2.kt.txt new file mode 100644 index 00000000000..7a7ef1f3ec7 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/augmentedAssignment2.kt.txt @@ -0,0 +1,58 @@ +class A { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +operator fun A.plusAssign(s: String) { +} + +operator fun A.minusAssign(s: String) { +} + +operator fun A.timesAssign(s: String) { +} + +operator fun A.divAssign(s: String) { +} + +operator fun A.remAssign(s: String) { +} + +val p: A + field = TODO("IrConstructorCall") + get + +fun testVariable() { + val a: A = TODO("IrConstructorCall") + plusAssign($receiver = a, s = "+=") + minusAssign($receiver = a, s = "-=") + timesAssign($receiver = a, s = "*=") + divAssign($receiver = a, s = "/=") + remAssign($receiver = a, s = "*=") +} + +fun testProperty() { + { //BLOCK + plusAssign($receiver = (), s = "+=") + } + { //BLOCK + minusAssign($receiver = (), s = "-=") + } + { //BLOCK + timesAssign($receiver = (), s = "*=") + } + { //BLOCK + divAssign($receiver = (), s = "/=") + } + { //BLOCK + remAssign($receiver = (), s = "%=") + } +} + diff --git a/compiler/testData/ir/irText/expressions/augmentedAssignmentWithExpression.kt.txt b/compiler/testData/ir/irText/expressions/augmentedAssignmentWithExpression.kt.txt new file mode 100644 index 00000000000..44a19d655a0 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/augmentedAssignmentWithExpression.kt.txt @@ -0,0 +1,35 @@ +class Host { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + operator fun plusAssign(x: Int) { + } + + fun test1() { + .plusAssign(x = 1) + } + + + + +} + +fun foo(): Host { + return TODO("IrConstructorCall") +} + +fun Host.test2() { + .plusAssign(x = 1) +} + +fun test3() { + foo().plusAssign(x = 1) +} + +fun test4(a: Function0) { + a.invoke().plusAssign(x = 1) +} + diff --git a/compiler/testData/ir/irText/expressions/badBreakContinue.kt.txt b/compiler/testData/ir/irText/expressions/badBreakContinue.kt.txt new file mode 100644 index 00000000000..ed3662cbd10 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/badBreakContinue.kt.txt @@ -0,0 +1,29 @@ +fun test1() { + error("") /* ERROR EXPRESSION */ + error("") /* ERROR EXPRESSION */ +} + +fun test2() { + while (true) { //BLOCK + error("") /* ERROR EXPRESSION */ + error("") /* ERROR EXPRESSION */ + } +} + +fun test3() { + while (true) { //BLOCK + val lambda: Function0 = local fun (): Nothing { + error("") /* ERROR EXPRESSION */ + error("") /* ERROR EXPRESSION */ + } + + } +} + +fun test4() { + while (error("") /* ERROR EXPRESSION */) { //BLOCK + } + while (error("") /* ERROR EXPRESSION */) { //BLOCK + } +} + diff --git a/compiler/testData/ir/irText/expressions/bangbang.kt.txt b/compiler/testData/ir/irText/expressions/bangbang.kt.txt new file mode 100644 index 00000000000..d81e5dd97e7 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/bangbang.kt.txt @@ -0,0 +1,30 @@ +fun test1(a: Any?): Any { + return CHECK_NOT_NULL(arg0 = a) +} + +fun test2(a: Any?): Int { + return CHECK_NOT_NULL(arg0 = { //BLOCK + val tmp0_safe_receiver: Any? = a + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + true -> tmp0_safe_receiver.hashCode() + } + }) +} + +fun test3(a: X): X { + return CHECK_NOT_NULL(arg0 = a) +} + +fun useString(s: String) { +} + +fun test4(a: X) { + when { + a is String? -> CHECK_NOT_NULL(arg0 = a) /*~> Unit */ + } + when { + a is String? -> useString(s = CHECK_NOT_NULL(arg0 = a) /*as String */) + } +} + diff --git a/compiler/testData/ir/irText/expressions/booleanConstsInAndAndOrOr.kt.txt b/compiler/testData/ir/irText/expressions/booleanConstsInAndAndOrOr.kt.txt new file mode 100644 index 00000000000..4b1c944a331 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/booleanConstsInAndAndOrOr.kt.txt @@ -0,0 +1,14 @@ +fun test1(b: Boolean) { + when { + b -> return Unit + true -> false + } /*~> Unit */ +} + +fun test2(b: Boolean) { + when { + b -> true + true -> return Unit + } /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/expressions/booleanOperators.kt.txt b/compiler/testData/ir/irText/expressions/booleanOperators.kt.txt new file mode 100644 index 00000000000..ea168900519 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/booleanOperators.kt.txt @@ -0,0 +1,22 @@ +fun test1(a: Boolean, b: Boolean): Boolean { + return when { + a -> b + true -> false + } +} + +fun test2(a: Boolean, b: Boolean): Boolean { + return when { + a -> true + true -> b + } +} + +fun test1x(a: Boolean, b: Boolean): Boolean { + return a.and(other = b) +} + +fun test2x(a: Boolean, b: Boolean): Boolean { + return a.or(other = b) +} + diff --git a/compiler/testData/ir/irText/expressions/boundCallableReferences.kt.txt b/compiler/testData/ir/irText/expressions/boundCallableReferences.kt.txt new file mode 100644 index 00000000000..1741503e0cf --- /dev/null +++ b/compiler/testData/ir/irText/expressions/boundCallableReferences.kt.txt @@ -0,0 +1,34 @@ +class A { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun foo() { + } + + val bar: Int + field = 0 + get + + + + +} + +fun A.qux() { +} + +val test1: KFunction0 + field = ::foo + get + +val test2: KProperty0 + field = ::bar + get + +val test3: KFunction0 + field = ::qux + get + diff --git a/compiler/testData/ir/irText/expressions/boxOk.kt.txt b/compiler/testData/ir/irText/expressions/boxOk.kt.txt new file mode 100644 index 00000000000..2ac23663c71 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/boxOk.kt.txt @@ -0,0 +1,4 @@ +fun box(): String { + return "OK" +} + diff --git a/compiler/testData/ir/irText/expressions/breakContinue.kt.txt b/compiler/testData/ir/irText/expressions/breakContinue.kt.txt new file mode 100644 index 00000000000..4969dd48d79 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/breakContinue.kt.txt @@ -0,0 +1,51 @@ +fun test1() { + while (true) { //BLOCK + break + } + { //BLOCK + do// COMPOSITE { + break + // } while (true) + } + while (true) { //BLOCK + continue + } + { //BLOCK + do// COMPOSITE { + continue + // } while (true) + } +} + +fun test2() { + while (true) { //BLOCK + while (true) { //BLOCK + break + break + } + break + } + while (true) { //BLOCK + while (true) { //BLOCK + continue + continue + } + continue + } +} + +fun test3() { + while (true) { //BLOCK + while (true) { //BLOCK + break + } + break + } + while (true) { //BLOCK + while (true) { //BLOCK + continue + } + continue + } +} + diff --git a/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.kt.txt b/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.kt.txt new file mode 100644 index 00000000000..5db7499dcae --- /dev/null +++ b/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.kt.txt @@ -0,0 +1,83 @@ +fun test1(c: Boolean?) { + while (true) { //BLOCK + while ({ //BLOCK + val tmp0_elvis_lhs: Boolean? = c + when { + EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> break + true -> tmp0_elvis_lhs + } + }) + } +} + +fun test2(c: Boolean?) { + while (true) { //BLOCK + while ({ //BLOCK + val tmp0_elvis_lhs: Boolean? = c + when { + EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> continue + true -> tmp0_elvis_lhs + } + }) + } +} + +fun test3(ss: List?) { + while (true) { //BLOCK + { //BLOCK + val tmp1_iterator: Iterator = { //BLOCK + val tmp0_elvis_lhs: List? = ss + when { + EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> continue + true -> tmp0_elvis_lhs + } + }.iterator() + while (tmp1_iterator.hasNext()) { //BLOCK + val s: String = tmp1_iterator.next() + } + } + } +} + +fun test4(ss: List?) { + while (true) { //BLOCK + { //BLOCK + val tmp1_iterator: Iterator = { //BLOCK + val tmp0_elvis_lhs: List? = ss + when { + EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> break + true -> tmp0_elvis_lhs + } + }.iterator() + while (tmp1_iterator.hasNext()) { //BLOCK + val s: String = tmp1_iterator.next() + } + } + } +} + +fun test5() { + var i: Int = 0 + while (true) { //BLOCK + { //BLOCK + i = i.inc() + i + } /*~> Unit */ + var j: Int = 0 + { //BLOCK + do// COMPOSITE { + { //BLOCK + j = j.inc() + j + } /*~> Unit */ + // } while (when { + greaterOrEqual(arg0 = j, arg1 = 3) -> false + true -> break + }) + } + when { + EQEQ(arg0 = i, arg1 = 3) -> break + } + } +} + diff --git a/compiler/testData/ir/irText/expressions/breakContinueInWhen.kt.txt b/compiler/testData/ir/irText/expressions/breakContinueInWhen.kt.txt new file mode 100644 index 00000000000..4a82137af47 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/breakContinueInWhen.kt.txt @@ -0,0 +1,82 @@ +fun testBreakFor() { + val xs: IntArray = TODO("IrConstructorCall") + var k: Int = 0 + { //BLOCK + val tmp0_iterator: IntIterator = xs.iterator() + while (tmp0_iterator.hasNext()) { //BLOCK + val x: Int = tmp0_iterator.next() + { //BLOCK + when { + greater(arg0 = k, arg1 = 2) -> break + } + } + } + } +} + +fun testBreakWhile() { + var k: Int = 0 + while (less(arg0 = k, arg1 = 10)) { //BLOCK + when { + greater(arg0 = k, arg1 = 2) -> break + } + } +} + +fun testBreakDoWhile() { + var k: Int = 0 + { //BLOCK + do// COMPOSITE { + when { + greater(arg0 = k, arg1 = 2) -> break + } + // } while (less(arg0 = k, arg1 = 10)) + } +} + +fun testContinueFor() { + val xs: IntArray = TODO("IrConstructorCall") + var k: Int = 0 + { //BLOCK + val tmp0_iterator: IntIterator = xs.iterator() + while (tmp0_iterator.hasNext()) { //BLOCK + val x: Int = tmp0_iterator.next() + { //BLOCK + when { + greater(arg0 = k, arg1 = 2) -> continue + } + } + } + } +} + +fun testContinueWhile() { + var k: Int = 0 + while (less(arg0 = k, arg1 = 10)) { //BLOCK + when { + greater(arg0 = k, arg1 = 2) -> continue + } + } +} + +fun testContinueDoWhile() { + var k: Int = 0 + var s: String = "" + { //BLOCK + do// COMPOSITE { + { //BLOCK + k = k.inc() + k + } /*~> Unit */ + when { + greater(arg0 = k, arg1 = 2) -> continue + } + s = s.plus(other = k + +";") + // } while (less(arg0 = k, arg1 = 10)) + } + when { + EQEQ(arg0 = s, arg1 = "1;2;").not() -> throw TODO("IrConstructorCall") + } +} + diff --git a/compiler/testData/ir/irText/expressions/callWithReorderedArguments.kt.txt b/compiler/testData/ir/irText/expressions/callWithReorderedArguments.kt.txt new file mode 100644 index 00000000000..4919fc6ef7b --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callWithReorderedArguments.kt.txt @@ -0,0 +1,32 @@ +fun foo(a: Int, b: Int) { +} + +fun noReorder1(): Int { + return 1 +} + +fun noReorder2(): Int { + return 2 +} + +fun reordered1(): Int { + return 1 +} + +fun reordered2(): Int { + return 2 +} + +fun test() { + foo(a = noReorder1(), b = noReorder2()) + { //BLOCK + val tmp0_b: Int = reordered1() + val tmp1_a: Int = reordered2() + foo(a = tmp1_a, b = tmp0_b) + } + { //BLOCK + val tmp2_a: Int = reordered2() + foo(a = tmp2_a, b = 1) + } +} + diff --git a/compiler/testData/ir/irText/expressions/callableReferences/adaptedExtensionFunctions.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/adaptedExtensionFunctions.kt.txt new file mode 100644 index 00000000000..b27a9d1f0c7 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/adaptedExtensionFunctions.kt.txt @@ -0,0 +1,45 @@ +fun use(f: @ExtensionFunctionType Function2) { +} + +class C { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +fun C.extensionVararg(i: Int, vararg s: String) { +} + +fun C.extensionDefault(i: Int, s: String = "") { +} + +fun C.extensionBoth(i: Int, s: String = "", vararg t: String) { +} + +fun testExtensionVararg() { + use(f = local fun extensionVararg(p0: C, p1: Int) { + extensionVararg($receiver = p0, i = p1) + } +) +} + +fun testExtensionDefault() { + use(f = local fun extensionDefault(p0: C, p1: Int) { + extensionDefault($receiver = p0, i = p1) + } +) +} + +fun testExtensionBoth() { + use(f = local fun extensionBoth(p0: C, p1: Int) { + extensionBoth($receiver = p0, i = p1) + } +) +} + diff --git a/compiler/testData/ir/irText/expressions/callableReferences/adaptedWithCoercionToUnit.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/adaptedWithCoercionToUnit.kt.txt new file mode 100644 index 00000000000..e8737a2c15d --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/adaptedWithCoercionToUnit.kt.txt @@ -0,0 +1,46 @@ +fun useUnit0(fn: Function0) { +} + +fun useUnit1(fn: Function1) { +} + +fun fn0(): Int { + return 1 +} + +fun fn1(x: Int): Int { + return 1 +} + +fun fnv(vararg xs: Int): Int { + return 1 +} + +fun test0() { + return useUnit0(fn = local fun fn0() { + fn0() /*~> Unit */ + } +) +} + +fun test1() { + return useUnit1(fn = local fun fn1(p0: Int) { + fn1(x = p0) /*~> Unit */ + } +) +} + +fun testV0() { + return useUnit0(fn = local fun fnv() { + fnv() /*~> Unit */ + } +) +} + +fun testV1() { + return useUnit1(fn = local fun fnv(p0: Int) { + fnv(xs = [p0]) /*~> Unit */ + } +) +} + diff --git a/compiler/testData/ir/irText/expressions/callableReferences/boundInlineAdaptedReference.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/boundInlineAdaptedReference.kt.txt new file mode 100644 index 00000000000..e1e655aeec1 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/boundInlineAdaptedReference.kt.txt @@ -0,0 +1,20 @@ +package test + +inline fun foo(x: Function0) { +} + +fun String.id(s: String = , vararg xs: Int): String { + return s +} + +fun test() { + foo(x = { //BLOCK + local fun String.id() { + id($receiver = receiver, ) /*~> Unit */ + } + + + ::id + }) +} + diff --git a/compiler/testData/ir/irText/expressions/callableReferences/boundInnerGenericConstructor.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/boundInnerGenericConstructor.kt.txt new file mode 100644 index 00000000000..d3e0c0d349b --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/boundInnerGenericConstructor.kt.txt @@ -0,0 +1,44 @@ +package test + +class Foo { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + inner class Inner

+ + + +} + +data class P { + constructor(x: Int, y: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = x + get + + val y: Int + field = y + get + + operator fun component1(): Int { + return #x + } + + operator fun component2(): Int { + return #y + } + + fun copy(x: Int = #x, y: Int = #y): P { + return TODO("IrConstructorCall") + } + + override fun toString(): String { + return "P(" + +"x=" + +#x + +", " + +"y=" + +#y + +")" + } + + override fun hashCode(): Int { + return #x.hashCode().times(other = 31).plus(other = #y.hashCode()) + } + + override operator fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is P -> return false + } + val tmp0_other_with_cast: P = other as P + when { + EQEQ(arg0 = #x, arg1 = #x).not() -> return false + } + when { + EQEQ(arg0 = #y, arg1 = #y).not() -> return false + } + return true + } + +} + diff --git a/compiler/testData/ir/irText/types/nullChecks/explicitEqualsAndCompareToCallsOnPlatformTypeReceiver.kt.txt b/compiler/testData/ir/irText/types/nullChecks/explicitEqualsAndCompareToCallsOnPlatformTypeReceiver.kt.txt new file mode 100644 index 00000000000..a81b1bde5ee --- /dev/null +++ b/compiler/testData/ir/irText/types/nullChecks/explicitEqualsAndCompareToCallsOnPlatformTypeReceiver.kt.txt @@ -0,0 +1,24 @@ +fun JavaClass.testPlatformEqualsPlatform(): Boolean { + return .null0() /*!! Double */.equals(other = .null0()) +} + +fun JavaClass.testPlatformEqualsKotlin(): Boolean { + return .null0() /*!! Double */.equals(other = 0.0D) +} + +fun JavaClass.testKotlinEqualsPlatform(): Boolean { + return 0.0D.equals(other = .null0()) +} + +fun JavaClass.testPlatformCompareToPlatform(): Int { + return .null0() /*!! Double */.compareTo(other = .null0() /*!! Double */) +} + +fun JavaClass.testPlatformCompareToKotlin(): Int { + return .null0() /*!! Double */.compareTo(other = 0.0D) +} + +fun JavaClass.testKotlinCompareToPlatform(): Int { + return 0.0D.compareTo(other = .null0() /*!! Double */) +} + diff --git a/compiler/testData/ir/irText/types/nullChecks/implicitNotNullOnPlatformType.kt.txt b/compiler/testData/ir/irText/types/nullChecks/implicitNotNullOnPlatformType.kt.txt new file mode 100644 index 00000000000..c99a6d62535 --- /dev/null +++ b/compiler/testData/ir/irText/types/nullChecks/implicitNotNullOnPlatformType.kt.txt @@ -0,0 +1,46 @@ +fun f(s: String) { +} + +class MySet : Set { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + override val size: Int + override get(): Int { + TODO() + } + + override operator fun contains(element: String): Boolean { + TODO() + } + + override fun containsAll(elements: Collection): Boolean { + TODO() + } + + override fun isEmpty(): Boolean { + TODO() + } + + override operator fun iterator(): Iterator { + TODO() + } + + + + +} + +fun test() { + f(s = s() /*!! String */) + f(s = #STRING /*!! String */) +} + +fun testContains(m: MySet) { + m.contains(element = #STRING /*!! String */) /*~> Unit */ + m.contains(element = "abc") /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/types/nullChecks/nullabilityAssertionOnExtensionReceiver.kt.txt b/compiler/testData/ir/irText/types/nullChecks/nullabilityAssertionOnExtensionReceiver.kt.txt new file mode 100644 index 00000000000..4e77b4e03f0 --- /dev/null +++ b/compiler/testData/ir/irText/types/nullChecks/nullabilityAssertionOnExtensionReceiver.kt.txt @@ -0,0 +1,26 @@ +fun String.extension() { +} + +class C { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun String.memberExtension() { + } + + + + +} + +fun testExt() { + extension($receiver = s() /*!! String */) +} + +fun C.testMemberExt() { + .memberExtension($receiver = s() /*!! String */) +} + diff --git a/compiler/testData/ir/irText/types/nullChecks/platformTypeReceiver.kt.txt b/compiler/testData/ir/irText/types/nullChecks/platformTypeReceiver.kt.txt new file mode 100644 index 00000000000..f27bf404707 --- /dev/null +++ b/compiler/testData/ir/irText/types/nullChecks/platformTypeReceiver.kt.txt @@ -0,0 +1,8 @@ +fun test1(): Boolean { + return #BOOL_NULL /*!! Boolean */.equals(other = null) +} + +fun test2(): Boolean { + return boolNull() /*!! Boolean */.equals(other = null) +} + diff --git a/compiler/testData/ir/irText/types/receiverOfIntersectionType.kt.txt b/compiler/testData/ir/irText/types/receiverOfIntersectionType.kt.txt new file mode 100644 index 00000000000..4254ac59ad9 --- /dev/null +++ b/compiler/testData/ir/irText/types/receiverOfIntersectionType.kt.txt @@ -0,0 +1,73 @@ +interface K { + + + +} + +interface I : K { + abstract fun ff() + + + +} + +interface J : K { + + + +} + +class A : I, J { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + override fun ff() { + } + + + + +} + +class B : I, J { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + override fun ff() { + } + + + + +} + +fun testIntersection(a: A, b: B) { + val v: K = when { + true -> a + true -> b + } + v /*as I */.ff() +} + +fun testFlexible1() { + val v: @FlexibleNullability K? = when { + true -> a() + true -> b() + } + v /*!! K */ /*as I */.ff() +} + +fun testFlexible2(a: A, b: B) { + val v: @FlexibleNullability K? = when { + true -> id<@FlexibleNullability A?>(x = a) + true -> id<@FlexibleNullability B?>(x = b) + } + v /*!! K */ /*as I */.ff() +} + diff --git a/compiler/testData/ir/irText/types/smartCastOnFakeOverrideReceiver.kt.txt b/compiler/testData/ir/irText/types/smartCastOnFakeOverrideReceiver.kt.txt new file mode 100644 index 00000000000..471272e1d2d --- /dev/null +++ b/compiler/testData/ir/irText/types/smartCastOnFakeOverrideReceiver.kt.txt @@ -0,0 +1,102 @@ +open class A { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun f(): Int { + return 1 + } + + val aVal: Int + field = 42 + get + + fun testA1(x: Any): Int? { + return when { + x is B -> x /*as B */.f() + true -> null + } + } + + fun testA2(x: Any): Int? { + return when { + x is B -> x /*as B */.() + true -> null + } + } + + + + +} + +class B : A { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun testB1(x: Any): Int? { + return when { + x is B -> x /*as B */.f() + true -> null + } + } + + fun testB2(x: Any): Int? { + return when { + x is B -> x /*as B */.() + true -> null + } + } + + + + + + + +} + +open class GA { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun f(): Int { + return 1 + } + + val aVal: Int + field = 42 + get + + + + +} + +class GB : GA { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun testGB1(a: Any) { + a as GB /*~> Unit */ + a /*as GB<*, *> */.f() /*~> Unit */ + a /*as GB<*, *> */.() /*~> Unit */ + } + + + + + +} + diff --git a/compiler/testData/ir/irText/types/smartCastOnFieldReceiverOfGenericType.kt.txt b/compiler/testData/ir/irText/types/smartCastOnFieldReceiverOfGenericType.kt.txt new file mode 100644 index 00000000000..bffe9e72a4c --- /dev/null +++ b/compiler/testData/ir/irText/types/smartCastOnFieldReceiverOfGenericType.kt.txt @@ -0,0 +1,11 @@ +fun testSetField(a: Any, b: Any) { + a as JCell /*~> Unit */ + b as String /*~> Unit */ + #value = b /*as String */ +} + +fun testGetField(a: Any): String { + a as JCell /*~> Unit */ + return #value /*!! String */ +} + diff --git a/compiler/testData/ir/irText/types/smartCastOnReceiverOfGenericType.kt.txt b/compiler/testData/ir/irText/types/smartCastOnReceiverOfGenericType.kt.txt new file mode 100644 index 00000000000..248bec9ca42 --- /dev/null +++ b/compiler/testData/ir/irText/types/smartCastOnReceiverOfGenericType.kt.txt @@ -0,0 +1,69 @@ +fun testFunction(a: Any, b: Any) { + a as MutableList /*~> Unit */ + b as String /*~> Unit */ + a /*as MutableList */.add(element = b /*as String */) /*~> Unit */ +} + +fun testProperty(a: Any, b: Any) { + a as Cell /*~> Unit */ + b as String /*~> Unit */ + a /*as Cell */.( = b /*as String */) +} + +fun testInnerClass(a: Any, b: Any, c: Any) { + a as Inner /*~> Unit */ + b as Int /*~> Unit */ + c as String /*~> Unit */ + a /*as Inner */.use(x1 = b /*as Int */, x2 = c /*as String */) +} + +fun testNonSubstitutedTypeParameter(a: Any, b: Any) { + a as MutableList> /*~> Unit */ + b as List /*~> Unit */ + a /*as MutableList> */.add(element = b /*as List */) /*~> Unit */ +} + +class Cell { + constructor(value: T) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + var value: T + field = value + get + set + + + + +} + +class Outer { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + inner class Inner { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun use(x1: T1, x2: T2) { + } + + + + + } + + + + +} + diff --git a/compiler/testData/ir/irText/types/starProjection_OI.kt.txt b/compiler/testData/ir/irText/types/starProjection_OI.kt.txt new file mode 100644 index 00000000000..9b36f3fef33 --- /dev/null +++ b/compiler/testData/ir/irText/types/starProjection_OI.kt.txt @@ -0,0 +1,19 @@ +interface Continuation { + + + +} + +abstract class C { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + abstract fun dispatchResumeWithException(exception: Throwable, continuation: Continuation<*>): Boolean + + + +} +

{ + constructor(a: T, b: P) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val a: T + field = a + get + + val b: P + field = b + get + + + + + } + + + + +} + +inline fun foo(a: A, b: B, x: Function2>): Inner { + return x.invoke(p1 = a, p2 = b) +} + +fun box(): String { + val z: Foo = TODO("IrConstructorCall") + val foo: Inner = foo(a = "O", b = "K", x = ::) + return foo.().plus(other = foo.()) +} + diff --git a/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.kt.txt new file mode 100644 index 00000000000..05d9093bfdb --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.kt.txt @@ -0,0 +1,117 @@ +fun interface IFoo { + abstract fun foo(i: Int) + + + +} + +fun interface IFoo2 : IFoo { + + + + +} + +object A { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +object B { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +operator fun A.get(i: IFoo): Int { + return 1 +} + +operator fun A.set(i: IFoo, newValue: Int) { +} + +operator fun B.get(i: IFoo): Int { + return 1 +} + +operator fun B.set(i: IFoo2, newValue: Int) { +} + +fun withVararg(vararg xs: Int): Int { + return 42 +} + +fun test1() { + { //BLOCK + val tmp0_array: A = A + val tmp2_sam: IFoo = local fun withVararg(p0: Int) { + withVararg(xs = [p0]) /*~> Unit */ + } + /*-> IFoo */ + set($receiver = tmp0_array, i = tmp2_sam, newValue = get($receiver = tmp0_array, i = tmp2_sam).plus(other = 1)) + } +} + +fun test2() { + { //BLOCK + val tmp0_array: B = B + val tmp2_sam: IFoo2 = local fun withVararg(p0: Int) { + withVararg(xs = [p0]) /*~> Unit */ + } + /*-> IFoo2 */ + set($receiver = tmp0_array, i = tmp2_sam, newValue = get($receiver = tmp0_array, i = tmp2_sam).plus(other = 1)) + } +} + +fun test3(fn: Function1) { + { //BLOCK + val tmp0_array: A = A + val tmp2_sam: IFoo = fn /*-> IFoo */ + set($receiver = tmp0_array, i = tmp2_sam, newValue = get($receiver = tmp0_array, i = tmp2_sam).plus(other = 1)) + } +} + +fun test4(fn: Function1) { + when { + fn is IFoo -> { //BLOCK + { //BLOCK + val tmp0_array: A = A + val tmp1_index0: Function1 = fn + set($receiver = tmp0_array, i = tmp1_index0 /*as IFoo */, newValue = get($receiver = tmp0_array, i = tmp1_index0 /*as IFoo */).plus(other = 1)) + } + } + } +} + +fun test5(a: Any) { + a as Function1 /*~> Unit */ + { //BLOCK + val tmp0_array: A = A + val tmp2_sam: IFoo = a /*as Function1<@ParameterName(...) Int, Unit> */ /*-> IFoo */ + set($receiver = tmp0_array, i = tmp2_sam, newValue = get($receiver = tmp0_array, i = tmp2_sam).plus(other = 1)) + } +} + +fun test6(a: Any) { + a as Function1 /*~> Unit */ + a as IFoo /*~> Unit */ + { //BLOCK + val tmp0_array: A = A + val tmp1_index0: Any = a + set($receiver = tmp0_array, i = tmp1_index0 /*as IFoo */, newValue = get($receiver = tmp0_array, i = tmp1_index0 /*as IFoo */).plus(other = 1)) + } +} + diff --git a/compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.kt.txt new file mode 100644 index 00000000000..dd0c80c1529 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.kt.txt @@ -0,0 +1,70 @@ +fun use(fn: Function1): Any { + return fn.invoke(p1 = 42) +} + +class C { + constructor(vararg xs: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +class Outer { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + inner class Inner { + constructor(vararg xs: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + } + + + + +} + +fun testConstructor(): Any { + return use(fn = local fun (p0: Int): C { + return TODO("IrConstructorCall") + } +) +} + +fun testInnerClassConstructor(outer: Outer): Any { + return use(fn = { //BLOCK + local fun Outer.(p0: Int): Inner { + return TODO("IrConstructorCall") + } + + + :: + }) +} + +fun testInnerClassConstructorCapturingOuter(): Any { + return use(fn = { //BLOCK + val tmp0_receiver: Outer = TODO("IrConstructorCall") + local fun Outer.(p0: Int): Inner { + return TODO("IrConstructorCall") + } + + + :: + }) +} + diff --git a/compiler/testData/ir/irText/expressions/callableReferences/funWithDefaultParametersAsKCallableStar.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/funWithDefaultParametersAsKCallableStar.kt.txt new file mode 100644 index 00000000000..3ce6d92060e --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/funWithDefaultParametersAsKCallableStar.kt.txt @@ -0,0 +1,47 @@ +fun defaultsOnly(x: String = ""): Int { + return 1 +} + +fun regularAndDefaults(x1: String, x2: String = ""): Int { + return 1 +} + +fun varargs(vararg xs: String): Int { + return 1 +} + +class C { + constructor(x: String = "") /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: String + field = x + get + + + + +} + +fun useKCallableStar(fn: KCallable<*>) { +} + +fun testDefaultsOnlyStar() { + useKCallableStar(fn = ::defaultsOnly) +} + +fun testRegularAndDefaultsStar() { + useKCallableStar(fn = ::regularAndDefaults) +} + +fun testVarargsStar() { + useKCallableStar(fn = ::varargs) +} + +fun testCtorStar() { + useKCallableStar(fn = ::) +} + diff --git a/compiler/testData/ir/irText/expressions/callableReferences/genericMember.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/genericMember.kt.txt new file mode 100644 index 00000000000..4ed9992e164 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/genericMember.kt.txt @@ -0,0 +1,27 @@ +class A { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun foo() { + } + + val bar: Int + field = 42 + get + + + + +} + +val test1: KFunction1, Unit> + field = ::foo + get + +val test2: KProperty1, Int> + field = ::bar + get + diff --git a/compiler/testData/ir/irText/expressions/callableReferences/importedFromObject.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/importedFromObject.kt.txt new file mode 100644 index 00000000000..239e7d250a0 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/importedFromObject.kt.txt @@ -0,0 +1,38 @@ +package test + +object Foo { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val a: String + field = "" + get + + fun foo(): String { + return "" + } + + + + +} + +val test1: KProperty0 + field = ::a + get + +val test1a: KProperty0 + field = ::a + get + +val test2: KFunction0 + field = ::foo + get + +val test2a: KFunction0 + field = ::foo + get + diff --git a/compiler/testData/ir/irText/expressions/callableReferences/kt37131.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/kt37131.kt.txt new file mode 100644 index 00000000000..4acb5f7853b --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/kt37131.kt.txt @@ -0,0 +1,38 @@ +fun foo(x: String = ""): String { + return x +} + +class C { + constructor(x: String = "") /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: String + field = x + get + + + + +} + +fun use(fn: Function0): Any { + return fn.invoke() +} + +fun testFn(): Any { + return use(fn = local fun foo(): String { + return foo() + } +) +} + +fun testCtor(): Any { + return use(fn = local fun (): C { + return TODO("IrConstructorCall") + } +) +} + diff --git a/compiler/testData/ir/irText/expressions/callableReferences/suspendConversion.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/suspendConversion.kt.txt new file mode 100644 index 00000000000..89ba234d95b --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/suspendConversion.kt.txt @@ -0,0 +1,105 @@ +fun useSuspend(fn: SuspendFunction0) { +} + +fun useSuspendInt(fn: SuspendFunction1) { +} + +suspend fun foo0() { +} + +fun foo1() { +} + +fun fooInt(x: Int) { +} + +fun foo2(vararg xs: Int) { +} + +fun foo3(): Int { + return 42 +} + +fun foo4(i: Int = 42) { +} + +class C { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun bar() { + } + + + + +} + +fun testLambda() { + useSuspend(fn = local suspend fun () { + foo1() + } +) +} + +fun testNoCoversion() { + useSuspend(fn = ::foo0) +} + +fun testSuspendPlain() { + useSuspend(fn = local suspend fun foo1() { + foo1() + } +) +} + +fun testSuspendWithArgs() { + useSuspendInt(fn = local suspend fun fooInt(p0: Int) { + fooInt(x = p0) + } +) +} + +fun testWithVararg() { + useSuspend(fn = local suspend fun foo2() { + foo2() + } +) +} + +fun testWithVarargMapped() { + useSuspendInt(fn = local suspend fun foo2(p0: Int) { + foo2(xs = [p0]) + } +) +} + +fun testWithCoercionToUnit() { + useSuspend(fn = local suspend fun foo3() { + foo3() /*~> Unit */ + } +) +} + +fun testWithDefaults() { + useSuspend(fn = local suspend fun foo4() { + foo4() + } +) +} + +fun testWithBoundReceiver() { + useSuspend(fn = { //BLOCK + val tmp0_receiver: C = TODO("IrConstructorCall") + local suspend fun C.bar() { + receiver.bar() + } + + + ::bar + }) +} + diff --git a/compiler/testData/ir/irText/expressions/callableReferences/typeArguments.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/typeArguments.kt.txt new file mode 100644 index 00000000000..9dd004801f2 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/typeArguments.kt.txt @@ -0,0 +1,33 @@ +object Host { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + inline fun objectMember(x: T) { + } + + + + +} + +inline fun topLevel1(x: T) { +} + +inline fun topLevel2(x: List) { +} + +val test1: Function1 + field = ::topLevel1 + get + +val test2: Function1, Unit> + field = ::topLevel2 + get + +val test3: Function1 + field = ::objectMember + get + diff --git a/compiler/testData/ir/irText/expressions/callableReferences/unboundMemberReferenceWithAdaptedArguments.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/unboundMemberReferenceWithAdaptedArguments.kt.txt new file mode 100644 index 00000000000..7cfb59d2b7c --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/unboundMemberReferenceWithAdaptedArguments.kt.txt @@ -0,0 +1,67 @@ +fun use1(fn: Function2) { +} + +fun use2(fn: Function1) { +} + +open class A { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + open fun foo(vararg xs: Int): Int { + return 1 + } + + + + +} + +object Obj : A { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + override fun foo(vararg xs: Int): Int { + return 1 + } + + + + +} + +fun testUnbound() { + use1(fn = local fun foo(p0: A, p1: Int) { + p0.foo(xs = [p1]) /*~> Unit */ + } +) +} + +fun testBound(a: A) { + use2(fn = { //BLOCK + local fun A.foo(p0: Int) { + receiver.foo(xs = [p0]) /*~> Unit */ + } + + + ::foo + }) +} + +fun testObject() { + use2(fn = { //BLOCK + local fun Obj.foo(p0: Int) { + receiver.foo(xs = [p0]) /*~> Unit */ + } + + + ::foo + }) +} + diff --git a/compiler/testData/ir/irText/expressions/callableReferences/withAdaptationForSam.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/withAdaptationForSam.kt.txt new file mode 100644 index 00000000000..aca3d60d7cd --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/withAdaptationForSam.kt.txt @@ -0,0 +1,21 @@ +fun interface IFoo { + abstract fun foo(i: Int) + + + +} + +fun useFoo(foo: IFoo) { +} + +fun withVararg(vararg xs: Int): Int { + return 42 +} + +fun test() { + useFoo(foo = local fun withVararg(p0: Int) { + withVararg(xs = [p0]) /*~> Unit */ + } + /*-> IFoo */) +} + diff --git a/compiler/testData/ir/irText/expressions/callableReferences/withAdaptedArguments.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/withAdaptedArguments.kt.txt new file mode 100644 index 00000000000..6638a71bbd2 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/withAdaptedArguments.kt.txt @@ -0,0 +1,85 @@ +fun use(fn: Function1): String { + return fn.invoke(p1 = 1) +} + +fun use0(fn: Function0): String { + return fn.invoke() +} + +fun coerceToUnit(fn: Function1) { +} + +fun fnWithDefault(a: Int, b: Int = 42): String { + return "abc" +} + +fun fnWithDefaults(a: Int = 1, b: Int = 2): String { + return "" +} + +fun fnWithVarargs(vararg xs: Int): String { + return "abc" +} + +object Host { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun importedObjectMemberWithVarargs(vararg xs: Int): String { + return "abc" + } + + + + +} + +fun testDefault(): String { + return use(fn = local fun fnWithDefault(p0: Int): String { + return fnWithDefault(a = p0) + } +) +} + +fun testVararg(): String { + return use(fn = local fun fnWithVarargs(p0: Int): String { + return fnWithVarargs(xs = [p0]) + } +) +} + +fun testCoercionToUnit() { + return coerceToUnit(fn = local fun fnWithDefault(p0: Int) { + fnWithDefault(a = p0) /*~> Unit */ + } +) +} + +fun testImportedObjectMember(): String { + return use(fn = { //BLOCK + local fun importedObjectMemberWithVarargs(p0: Int): String { + return importedObjectMemberWithVarargs(xs = [p0]) + } + + + ::importedObjectMemberWithVarargs + }) +} + +fun testDefault0(): String { + return use0(fn = local fun fnWithDefaults(): String { + return fnWithDefaults() + } +) +} + +fun testVararg0(): String { + return use0(fn = local fun fnWithVarargs(): String { + return fnWithVarargs() + } +) +} + diff --git a/compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.kt.txt new file mode 100644 index 00000000000..a1c811febbe --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.kt.txt @@ -0,0 +1,79 @@ +fun use(fn: Function1) { + fn.invoke(p1 = 1) +} + +class Host { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun withVararg(vararg xs: Int): String { + return "" + } + + fun testImplicitThis() { + use(fn = { //BLOCK + local fun Host.withVararg(p0: Int) { + receiver.withVararg(xs = [p0]) /*~> Unit */ + } + + + ::withVararg + }) + } + + fun testBoundReceiverLocalVal() { + val h: Host = TODO("IrConstructorCall") + use(fn = { //BLOCK + local fun Host.withVararg(p0: Int) { + receiver.withVararg(xs = [p0]) /*~> Unit */ + } + + + ::withVararg + }) + } + + fun testBoundReceiverLocalVar() { + var h: Host = TODO("IrConstructorCall") + use(fn = { //BLOCK + val tmp0_receiver: Host = h + local fun Host.withVararg(p0: Int) { + receiver.withVararg(xs = [p0]) /*~> Unit */ + } + + + ::withVararg + }) + } + + fun testBoundReceiverParameter(h: Host) { + use(fn = { //BLOCK + local fun Host.withVararg(p0: Int) { + receiver.withVararg(xs = [p0]) /*~> Unit */ + } + + + ::withVararg + }) + } + + fun testBoundReceiverExpression() { + use(fn = { //BLOCK + val tmp0_receiver: Host = TODO("IrConstructorCall") + local fun Host.withVararg(p0: Int) { + receiver.withVararg(xs = [p0]) /*~> Unit */ + } + + + ::withVararg + }) + } + + + + +} + diff --git a/compiler/testData/ir/irText/expressions/callableReferences/withVarargViewedAsArray.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/withVarargViewedAsArray.kt.txt new file mode 100644 index 00000000000..7933bb1475f --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/withVarargViewedAsArray.kt.txt @@ -0,0 +1,53 @@ +fun sum(vararg args: Int): Int { + var result: Int = 0 + { //BLOCK + val tmp0_iterator: IntIterator = args.iterator() + while (tmp0_iterator.hasNext()) { //BLOCK + val arg: Int = tmp0_iterator.next() + result = result.plus(other = arg) + } + } + return result +} + +fun nsum(vararg args: Number): Int { + return sum(args = [*TODO("IrConstructorCall")]) +} + +fun zap(vararg b: String, k: Int = 42) { +} + +fun usePlainArgs(fn: Function2) { +} + +fun usePrimitiveArray(fn: Function1) { +} + +fun useArray(fn: Function1, Int>) { +} + +fun useStringArray(fn: Function1, Unit>) { +} + +fun testPlainArgs() { + usePlainArgs(fn = local fun sum(p0: Int, p1: Int): Int { + return sum(args = [p0, p1]) + } +) +} + +fun testPrimitiveArrayAsVararg() { + usePrimitiveArray(fn = ::sum) +} + +fun testArrayAsVararg() { + useArray(fn = ::nsum) +} + +fun testArrayAndDefaults() { + useStringArray(fn = local fun zap(p0: Array) { + zap(b = [*p0]) + } +) +} + diff --git a/compiler/testData/ir/irText/expressions/calls.kt.txt b/compiler/testData/ir/irText/expressions/calls.kt.txt new file mode 100644 index 00000000000..660fedd9984 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/calls.kt.txt @@ -0,0 +1,24 @@ +fun foo(x: Int, y: Int): Int { + return x +} + +fun bar(x: Int): Int { + return foo(x = x, y = 1) +} + +fun qux(x: Int): Int { + return foo(x = foo(x = x, y = x), y = x) +} + +fun Int.ext1(): Int { + return +} + +fun Int.ext2(x: Int): Int { + return foo(x = , y = x) +} + +fun Int.ext3(x: Int): Int { + return foo(x = ext1($receiver = ), y = x) +} + diff --git a/compiler/testData/ir/irText/expressions/castToTypeParameter.kt.txt b/compiler/testData/ir/irText/expressions/castToTypeParameter.kt.txt new file mode 100644 index 00000000000..8d5ceedc488 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/castToTypeParameter.kt.txt @@ -0,0 +1,51 @@ +fun castFun(x: Any): T { + return x as T +} + +fun Any.castExtFun(): T { + return as T +} + +val T.castExtVal: T + get(): T { + return as T + } + +class Host { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun castMemberFun(x: Any): T { + return x as T + } + + fun castGenericMemberFun(x: Any): TF { + return x as TF + } + + fun Any.castMemberExtFun(): T { + return as T + } + + fun Any.castGenericMemberExtFun(): TF { + return as TF + } + + val Any.castMemberExtVal: T + get(): T { + return as T + } + + val TV.castGenericMemberExtVal: TV + get(): TV { + return as TV + } + + + + +} + diff --git a/compiler/testData/ir/irText/expressions/catchParameterAccess.kt.txt b/compiler/testData/ir/irText/expressions/catchParameterAccess.kt.txt new file mode 100644 index 00000000000..5782f8d74c3 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/catchParameterAccess.kt.txt @@ -0,0 +1,10 @@ +fun test(f: Function0) { + return try { //BLOCK + f.invoke() + } + catch (...) { //BLOCK + throw e + } + +} + diff --git a/compiler/testData/ir/irText/expressions/chainOfSafeCalls.kt.txt b/compiler/testData/ir/irText/expressions/chainOfSafeCalls.kt.txt new file mode 100644 index 00000000000..b90840074d2 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/chainOfSafeCalls.kt.txt @@ -0,0 +1,48 @@ +class C { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun foo(): C { + return + } + + fun bar(): C? { + return + } + + + + +} + +fun test(nc: C?): C? { + return { //BLOCK + val tmp3_safe_receiver: C? = { //BLOCK + val tmp2_safe_receiver: C? = { //BLOCK + val tmp1_safe_receiver: C? = { //BLOCK + val tmp0_safe_receiver: C? = nc + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + true -> tmp0_safe_receiver.foo() + } + } + when { + EQEQ(arg0 = tmp1_safe_receiver, arg1 = null) -> null + true -> tmp1_safe_receiver.bar() + } + } + when { + EQEQ(arg0 = tmp2_safe_receiver, arg1 = null) -> null + true -> tmp2_safe_receiver.foo() + } + } + when { + EQEQ(arg0 = tmp3_safe_receiver, arg1 = null) -> null + true -> tmp3_safe_receiver.foo() + } + } +} + diff --git a/compiler/testData/ir/irText/expressions/classReference.kt.txt b/compiler/testData/ir/irText/expressions/classReference.kt.txt new file mode 100644 index 00000000000..cbbc7eb3ecb --- /dev/null +++ b/compiler/testData/ir/irText/expressions/classReference.kt.txt @@ -0,0 +1,19 @@ +class A { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +fun test() { + A::class /*~> Unit */ + TODO("IrConstructorCall")::class /*~> Unit */ + ($receiver = A::class) /*~> Unit */ + ($receiver = TODO("IrConstructorCall")::class) /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/expressions/coercionToUnit.kt.txt b/compiler/testData/ir/irText/expressions/coercionToUnit.kt.txt new file mode 100644 index 00000000000..286dd825a11 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/coercionToUnit.kt.txt @@ -0,0 +1,28 @@ +val test1: Function0 + field = local fun () { + 42 /*~> Unit */ + } + + get + +fun test2(mc: MutableCollection) { + mc.add(element = "") /*~> Unit */ +} + +fun test3() { + { //BLOCK + val tmp0_safe_receiver: @FlexibleNullability PrintStream? = #out + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + true -> tmp0_safe_receiver /*!! PrintStream */.println(p0 = "Hello,") + } + } /*~> Unit */ + { //BLOCK + val tmp1_safe_receiver: @FlexibleNullability PrintStream? = #out + when { + EQEQ(arg0 = tmp1_safe_receiver, arg1 = null) -> null + true -> tmp1_safe_receiver /*!! PrintStream */.println(p0 = "world!") + } + } /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.kt.txt b/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.kt.txt new file mode 100644 index 00000000000..905bb2523ee --- /dev/null +++ b/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.kt.txt @@ -0,0 +1,133 @@ +object X1 { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + var x1: Int + field = 0 + get + set + + object X2 { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + var x2: Int + field = 0 + get + set + + object X3 { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + var x3: Int + field = 0 + get + set + + + + + } + + + + + } + + + + +} + +fun test1(a: IntArray) { + var i: Int = 0 + { //BLOCK + val tmp1_array: IntArray = a + val tmp2_index0: Int = { //BLOCK + val tmp0: Int = i + i = tmp0.inc() + tmp0 + } + val tmp3: Int = tmp1_array.get(index = tmp2_index0) + tmp1_array.set(index = tmp2_index0, value = tmp3.inc()) + tmp3 + } /*~> Unit */ +} + +fun test2() { + { //BLOCK + val tmp0_this: X1 = X1 + { //BLOCK + val tmp1: Int = tmp0_this.() + tmp0_this.( = tmp1.inc()) + tmp1 + } + } /*~> Unit */ + { //BLOCK + val tmp2_this: X2 = X2 + { //BLOCK + val tmp3: Int = tmp2_this.() + tmp2_this.( = tmp3.inc()) + tmp3 + } + } /*~> Unit */ + { //BLOCK + val tmp4_this: X3 = X3 + { //BLOCK + val tmp5: Int = tmp4_this.() + tmp4_this.( = tmp5.inc()) + tmp5 + } + } /*~> Unit */ +} + +class B { + constructor(s: Int = 0) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + var s: Int + field = s + get + set + + + + +} + +object Host { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + operator fun B.plusAssign(b: B) { + { //BLOCK + val tmp0_this: B = + tmp0_this.( = tmp0_this.().plus(other = b.())) + } + } + + + + +} + +fun Host.test3(v: B) { + .plusAssign($receiver = v, b = TODO("IrConstructorCall")) +} + diff --git a/compiler/testData/ir/irText/expressions/constructorWithOwnTypeParametersCall.kt.txt b/compiler/testData/ir/irText/expressions/constructorWithOwnTypeParametersCall.kt.txt new file mode 100644 index 00000000000..196d9d50448 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/constructorWithOwnTypeParametersCall.kt.txt @@ -0,0 +1,32 @@ +fun testKotlin(): K2 { + return TODO("IrConstructorCall") +} + +fun testJava(): J2 { + return TODO("IrConstructorCall") +} + +class K1 { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + inner class K2 { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + } + + + + +} + diff --git a/compiler/testData/ir/irText/expressions/contructorCall.kt.txt b/compiler/testData/ir/irText/expressions/contructorCall.kt.txt new file mode 100644 index 00000000000..cbc8e47516b --- /dev/null +++ b/compiler/testData/ir/irText/expressions/contructorCall.kt.txt @@ -0,0 +1,16 @@ +class A { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +val test: A + field = TODO("IrConstructorCall") + get + diff --git a/compiler/testData/ir/irText/expressions/conventionComparisons.kt.txt b/compiler/testData/ir/irText/expressions/conventionComparisons.kt.txt new file mode 100644 index 00000000000..aa20ef1e64b --- /dev/null +++ b/compiler/testData/ir/irText/expressions/conventionComparisons.kt.txt @@ -0,0 +1,29 @@ +interface IA { + + + +} + +interface IB { + abstract operator fun IA.compareTo(other: IA): Int + + + +} + +fun IB.test1(a1: IA, a2: IA): Boolean { + return greater(arg0 = .compareTo($receiver = a1, other = a2), arg1 = 0) +} + +fun IB.test2(a1: IA, a2: IA): Boolean { + return greaterOrEqual(arg0 = .compareTo($receiver = a1, other = a2), arg1 = 0) +} + +fun IB.test3(a1: IA, a2: IA): Boolean { + return less(arg0 = .compareTo($receiver = a1, other = a2), arg1 = 0) +} + +fun IB.test4(a1: IA, a2: IA): Boolean { + return lessOrEqual(arg0 = .compareTo($receiver = a1, other = a2), arg1 = 0) +} + diff --git a/compiler/testData/ir/irText/expressions/destructuring1.kt.txt b/compiler/testData/ir/irText/expressions/destructuring1.kt.txt new file mode 100644 index 00000000000..8e2163433d8 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/destructuring1.kt.txt @@ -0,0 +1,40 @@ +object A { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +object B { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + operator fun A.component1(): Int { + return 1 + } + + operator fun A.component2(): Int { + return 2 + } + + + + +} + +fun B.test() { + // COMPOSITE { + val tmp0_container: A = A + val x: Int = .component1($receiver = tmp0_container) + val y: Int = .component2($receiver = tmp0_container) + // } +} + diff --git a/compiler/testData/ir/irText/expressions/destructuringWithUnderscore.kt.txt b/compiler/testData/ir/irText/expressions/destructuringWithUnderscore.kt.txt new file mode 100644 index 00000000000..43cd12bc9e7 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/destructuringWithUnderscore.kt.txt @@ -0,0 +1,44 @@ +object A { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +object B { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + operator fun A.component1(): Int { + return 1 + } + + operator fun A.component2(): Int { + return 2 + } + + operator fun A.component3(): Int { + return 3 + } + + + + +} + +fun B.test() { + // COMPOSITE { + val tmp0_container: A = A + val x: Int = .component1($receiver = tmp0_container) + val z: Int = .component3($receiver = tmp0_container) + // } +} + diff --git a/compiler/testData/ir/irText/expressions/dotQualified.kt.txt b/compiler/testData/ir/irText/expressions/dotQualified.kt.txt new file mode 100644 index 00000000000..5302517c8b7 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/dotQualified.kt.txt @@ -0,0 +1,14 @@ +fun length(s: String): Int { + return s.() +} + +fun lengthN(s: String?): Int? { + return { //BLOCK + val tmp0_safe_receiver: String? = s + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + true -> tmp0_safe_receiver.() + } + } +} + diff --git a/compiler/testData/ir/irText/expressions/elvis.kt.txt b/compiler/testData/ir/irText/expressions/elvis.kt.txt new file mode 100644 index 00000000000..ab1ac410e8a --- /dev/null +++ b/compiler/testData/ir/irText/expressions/elvis.kt.txt @@ -0,0 +1,64 @@ +val p: Any? + field = null + get + +fun foo(): Any? { + return null +} + +fun test1(a: Any?, b: Any): Any { + return { //BLOCK + val tmp0_elvis_lhs: Any? = a + when { + EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> b + true -> tmp0_elvis_lhs + } + } +} + +fun test2(a: String?, b: Any): Any { + return { //BLOCK + val tmp0_elvis_lhs: String? = a + when { + EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> b + true -> tmp0_elvis_lhs + } + } +} + +fun test3(a: Any?, b: Any?): String { + when { + b !is String -> return "" + } + when { + a !is String? -> return "" + } + return { //BLOCK + val tmp0_elvis_lhs: Any? = a + when { + EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> b /*as String */ + true -> tmp0_elvis_lhs /*as String */ + } + } +} + +fun test4(x: Any): Any { + return { //BLOCK + val tmp0_elvis_lhs: Any? = () + when { + EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> x + true -> tmp0_elvis_lhs + } + } +} + +fun test5(x: Any): Any { + return { //BLOCK + val tmp0_elvis_lhs: Any? = foo() + when { + EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> x + true -> tmp0_elvis_lhs + } + } +} + diff --git a/compiler/testData/ir/irText/expressions/enumEntryAsReceiver.kt.txt b/compiler/testData/ir/irText/expressions/enumEntryAsReceiver.kt.txt new file mode 100644 index 00000000000..8882593ebcd --- /dev/null +++ b/compiler/testData/ir/irText/expressions/enumEntryAsReceiver.kt.txt @@ -0,0 +1,27 @@ +abstract enum class X : Enum { + private constructor() /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + B init = TODO("IrEnumConstructorCall") abstract val value: Function0 + abstract get + + + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): X /* Synthetic body for ENUM_VALUEOF */ + +} + +fun box(): String { + return X.().invoke() +} + diff --git a/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.kt.txt b/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.kt.txt new file mode 100644 index 00000000000..61a32c983ab --- /dev/null +++ b/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.kt.txt @@ -0,0 +1,20 @@ +open enum class MyEnum : Enum { + private constructor() /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + Z init = TODO("IrEnumConstructorCall") + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): MyEnum /* Synthetic body for ENUM_VALUEOF */ + +} + diff --git a/compiler/testData/ir/irText/expressions/equality.kt.txt b/compiler/testData/ir/irText/expressions/equality.kt.txt new file mode 100644 index 00000000000..f07911ec9f9 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/equality.kt.txt @@ -0,0 +1,12 @@ +fun test1(a: Int, b: Int): Boolean { + return EQEQ(arg0 = a, arg1 = b) +} + +fun test2(a: Int, b: Int): Boolean { + return EQEQ(arg0 = a, arg1 = b).not() +} + +fun test3(a: Any?, b: Any?): Boolean { + return EQEQ(arg0 = a, arg1 = b) +} + diff --git a/compiler/testData/ir/irText/expressions/equals.kt.txt b/compiler/testData/ir/irText/expressions/equals.kt.txt new file mode 100644 index 00000000000..ede412500df --- /dev/null +++ b/compiler/testData/ir/irText/expressions/equals.kt.txt @@ -0,0 +1,16 @@ +fun testEqeq(a: Int, b: Int): Boolean { + return EQEQ(arg0 = a, arg1 = b) +} + +fun testEquals(a: Int, b: Int): Boolean { + return a.equals(other = b) +} + +fun testJEqeqNull(): Boolean { + return EQEQ(arg0 = #INT_NULL, arg1 = null) +} + +fun testJEqualsNull(): Boolean { + return #INT_NULL /*!! Int */.equals(other = null) +} + diff --git a/compiler/testData/ir/irText/expressions/extFunInvokeAsFun.kt.txt b/compiler/testData/ir/irText/expressions/extFunInvokeAsFun.kt.txt new file mode 100644 index 00000000000..9f2f7f30034 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/extFunInvokeAsFun.kt.txt @@ -0,0 +1,8 @@ +fun with1(receiver: Any?, block: @ExtensionFunctionType Function1) { + return block.invoke(p1 = receiver) +} + +fun with2(receiver: Any?, block: @ExtensionFunctionType Function1) { + return block.invoke(p1 = receiver) +} + diff --git a/compiler/testData/ir/irText/expressions/extFunSafeInvoke.kt.txt b/compiler/testData/ir/irText/expressions/extFunSafeInvoke.kt.txt new file mode 100644 index 00000000000..c2766260f48 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/extFunSafeInvoke.kt.txt @@ -0,0 +1,10 @@ +fun test(receiver: Any?, fn: @ExtensionFunctionType Function3): Unit? { + return { //BLOCK + val tmp0_safe_receiver: Any? = receiver + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + true -> fn.invoke(p1 = tmp0_safe_receiver, p2 = 42, p3 = "Hello") + } + } +} + diff --git a/compiler/testData/ir/irText/expressions/extensionPropertyGetterCall.kt.txt b/compiler/testData/ir/irText/expressions/extensionPropertyGetterCall.kt.txt new file mode 100644 index 00000000000..45536fe0b0d --- /dev/null +++ b/compiler/testData/ir/irText/expressions/extensionPropertyGetterCall.kt.txt @@ -0,0 +1,9 @@ +val String.okext: String + get(): String { + return "OK" + } + +fun String.test5(): String { + return ($receiver = ) +} + diff --git a/compiler/testData/ir/irText/expressions/field.kt.txt b/compiler/testData/ir/irText/expressions/field.kt.txt new file mode 100644 index 00000000000..ee5b89c04ff --- /dev/null +++ b/compiler/testData/ir/irText/expressions/field.kt.txt @@ -0,0 +1,14 @@ +var testSimple: Int + field = 0 + get + set(value: Int) { + #testSimple = value + } + +var testAugmented: Int + field = 0 + get + set(value: Int) { + #testAugmented = #testAugmented.plus(other = value) + } + diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/comparableWithDoubleOrFloat.kt.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/comparableWithDoubleOrFloat.kt.txt new file mode 100644 index 00000000000..8fa59fd4c0e --- /dev/null +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/comparableWithDoubleOrFloat.kt.txt @@ -0,0 +1,20 @@ +fun testD(x: Comparable, y: Comparable): Boolean { + return when { + when { + x is Double -> y is Double + true -> false + } -> less(arg0 = x /*as Double */, arg1 = y /*as Double */) + true -> false + } +} + +fun testF(x: Comparable, y: Comparable): Boolean { + return when { + when { + x is Float -> y is Float + true -> false + } -> less(arg0 = x /*as Float */, arg1 = y /*as Float */) + true -> false + } +} + diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/eqeqRhsConditionPossiblyAffectingLhs.kt.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/eqeqRhsConditionPossiblyAffectingLhs.kt.txt new file mode 100644 index 00000000000..f137776502b --- /dev/null +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/eqeqRhsConditionPossiblyAffectingLhs.kt.txt @@ -0,0 +1,7 @@ +fun test(x: Any): Boolean { + return EQEQ(arg0 = x, arg1 = when { + x !is Double -> CHECK_NOT_NULL(arg0 = null) + true -> x /*as Double */ + }) +} + diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointCompareTo.kt.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointCompareTo.kt.txt new file mode 100644 index 00000000000..7ae48f901bc --- /dev/null +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointCompareTo.kt.txt @@ -0,0 +1,80 @@ +fun test1d(x: Double, y: Double): Int { + return x.compareTo(other = y) +} + +fun test2d(x: Double, y: Any): Boolean { + return when { + y is Double -> EQEQ(arg0 = x.compareTo(other = y /*as Double */), arg1 = 0) + true -> false + } +} + +fun test3d(x: Any, y: Any): Boolean { + return when { + when { + x is Double -> y is Double + true -> false + } -> EQEQ(arg0 = x /*as Double */.compareTo(other = y /*as Double */), arg1 = 0) + true -> false + } +} + +fun test1f(x: Float, y: Float): Int { + return x.compareTo(other = y) +} + +fun test2f(x: Float, y: Any): Boolean { + return when { + y is Float -> EQEQ(arg0 = x.compareTo(other = y /*as Float */), arg1 = 0) + true -> false + } +} + +fun test3f(x: Any, y: Any): Boolean { + return when { + when { + x is Float -> y is Float + true -> false + } -> EQEQ(arg0 = x /*as Float */.compareTo(other = y /*as Float */), arg1 = 0) + true -> false + } +} + +fun testFD(x: Any, y: Any): Boolean { + return when { + when { + x is Float -> y is Double + true -> false + } -> EQEQ(arg0 = x /*as Float */.compareTo(other = y /*as Double */), arg1 = 0) + true -> false + } +} + +fun testDF(x: Any, y: Any): Boolean { + return when { + when { + x is Double -> y is Float + true -> false + } -> EQEQ(arg0 = x /*as Double */.compareTo(other = y /*as Float */), arg1 = 0) + true -> false + } +} + +fun Float.test1fr(x: Float): Int { + return .compareTo(other = x) +} + +fun Float.test2fr(x: Any): Boolean { + return when { + x is Float -> EQEQ(arg0 = .compareTo(other = x /*as Float */), arg1 = 0) + true -> false + } +} + +fun Float.test3fr(x: Any): Boolean { + return when { + x is Double -> EQEQ(arg0 = .compareTo(other = x /*as Double */), arg1 = 0) + true -> false + } +} + diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointEqeq.kt.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointEqeq.kt.txt new file mode 100644 index 00000000000..492e74a474b --- /dev/null +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointEqeq.kt.txt @@ -0,0 +1,86 @@ +fun test1d(x: Double, y: Double): Boolean { + return ieee754equals(arg0 = x, arg1 = y) +} + +fun test2d(x: Double, y: Double?): Boolean { + return ieee754equals(arg0 = x, arg1 = y) +} + +fun test3d(x: Double, y: Any): Boolean { + return EQEQ(arg0 = x, arg1 = y) +} + +fun test4d(x: Double, y: Number): Boolean { + return EQEQ(arg0 = x, arg1 = y) +} + +fun test5d(x: Double, y: Any): Boolean { + return when { + y is Double -> ieee754equals(arg0 = x, arg1 = y /*as Double */) + true -> false + } +} + +fun test6d(x: Any, y: Any): Boolean { + return when { + when { + x is Double -> y is Double + true -> false + } -> ieee754equals(arg0 = x /*as Double */, arg1 = y /*as Double */) + true -> false + } +} + +fun test1f(x: Float, y: Float): Boolean { + return ieee754equals(arg0 = x, arg1 = y) +} + +fun test2f(x: Float, y: Float?): Boolean { + return ieee754equals(arg0 = x, arg1 = y) +} + +fun test3f(x: Float, y: Any): Boolean { + return EQEQ(arg0 = x, arg1 = y) +} + +fun test4f(x: Float, y: Number): Boolean { + return EQEQ(arg0 = x, arg1 = y) +} + +fun test5f(x: Float, y: Any): Boolean { + return when { + y is Float -> ieee754equals(arg0 = x, arg1 = y /*as Float */) + true -> false + } +} + +fun test6f(x: Any, y: Any): Boolean { + return when { + when { + x is Float -> y is Float + true -> false + } -> ieee754equals(arg0 = x /*as Float */, arg1 = y /*as Float */) + true -> false + } +} + +fun testFD(x: Any, y: Any): Boolean { + return when { + when { + x is Float -> y is Double + true -> false + } -> ieee754equals(arg0 = x /*as Float */.toDouble(), arg1 = y /*as Double */) + true -> false + } +} + +fun testDF(x: Any, y: Any): Boolean { + return when { + when { + x is Double -> y is Float + true -> false + } -> ieee754equals(arg0 = x /*as Double */, arg1 = y /*as Float */.toDouble()) + true -> false + } +} + diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointEquals.kt.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointEquals.kt.txt new file mode 100644 index 00000000000..9564dd41ed4 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointEquals.kt.txt @@ -0,0 +1,116 @@ +fun test1d(x: Double, y: Double): Boolean { + return x.equals(other = y) +} + +fun test2d(x: Double, y: Double?): Boolean { + return x.equals(other = y) +} + +fun test3d(x: Double, y: Any): Boolean { + return x.equals(other = y) +} + +fun test4d(x: Double, y: Number): Boolean { + return x.equals(other = y) +} + +fun test5d(x: Double, y: Any): Boolean { + return when { + y is Double -> x.equals(other = y) + true -> false + } +} + +fun test6d(x: Any, y: Any): Boolean { + return when { + when { + x is Double -> y is Double + true -> false + } -> x.equals(other = y) + true -> false + } +} + +fun test1f(x: Float, y: Float): Boolean { + return x.equals(other = y) +} + +fun test2f(x: Float, y: Float?): Boolean { + return x.equals(other = y) +} + +fun test3f(x: Float, y: Any): Boolean { + return x.equals(other = y) +} + +fun test4f(x: Float, y: Number): Boolean { + return x.equals(other = y) +} + +fun test5f(x: Float, y: Any): Boolean { + return when { + y is Float -> x.equals(other = y) + true -> false + } +} + +fun test6f(x: Any, y: Any): Boolean { + return when { + when { + x is Float -> y is Float + true -> false + } -> x.equals(other = y) + true -> false + } +} + +fun testFD(x: Any, y: Any): Boolean { + return when { + when { + x is Float -> y is Double + true -> false + } -> x.equals(other = y) + true -> false + } +} + +fun testDF(x: Any, y: Any): Boolean { + return when { + when { + x is Double -> y is Float + true -> false + } -> x.equals(other = y) + true -> false + } +} + +fun Float.test1fr(x: Float): Boolean { + return .equals(other = x) +} + +fun Float.test2fr(x: Float?): Boolean { + return .equals(other = x) +} + +fun Float.test3fr(x: Any): Boolean { + return .equals(other = x) +} + +fun Float.test4fr(x: Number): Boolean { + return .equals(other = x) +} + +fun Float.test5fr(x: Any): Boolean { + return when { + x is Float -> .equals(other = x) + true -> false + } +} + +fun Float.test6fr(x: Any): Boolean { + return when { + x is Double -> .equals(other = x) + true -> false + } +} + diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointExcleq.kt.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointExcleq.kt.txt new file mode 100644 index 00000000000..6cda9b7081f --- /dev/null +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointExcleq.kt.txt @@ -0,0 +1,86 @@ +fun test1d(x: Double, y: Double): Boolean { + return ieee754equals(arg0 = x, arg1 = y).not() +} + +fun test2d(x: Double, y: Double?): Boolean { + return ieee754equals(arg0 = x, arg1 = y).not() +} + +fun test3d(x: Double, y: Any): Boolean { + return EQEQ(arg0 = x, arg1 = y).not() +} + +fun test4d(x: Double, y: Number): Boolean { + return EQEQ(arg0 = x, arg1 = y).not() +} + +fun test5d(x: Double, y: Any): Boolean { + return when { + y is Double -> ieee754equals(arg0 = x, arg1 = y /*as Double */).not() + true -> false + } +} + +fun test6d(x: Any, y: Any): Boolean { + return when { + when { + x is Double -> y is Double + true -> false + } -> ieee754equals(arg0 = x /*as Double */, arg1 = y /*as Double */).not() + true -> false + } +} + +fun test1f(x: Float, y: Float): Boolean { + return ieee754equals(arg0 = x, arg1 = y).not() +} + +fun test2f(x: Float, y: Float?): Boolean { + return ieee754equals(arg0 = x, arg1 = y).not() +} + +fun test3f(x: Float, y: Any): Boolean { + return EQEQ(arg0 = x, arg1 = y).not() +} + +fun test4f(x: Float, y: Number): Boolean { + return EQEQ(arg0 = x, arg1 = y).not() +} + +fun test5f(x: Float, y: Any): Boolean { + return when { + y is Float -> ieee754equals(arg0 = x, arg1 = y /*as Float */).not() + true -> false + } +} + +fun test6f(x: Any, y: Any): Boolean { + return when { + when { + x is Float -> y is Float + true -> false + } -> ieee754equals(arg0 = x /*as Float */, arg1 = y /*as Float */).not() + true -> false + } +} + +fun testFD(x: Any, y: Any): Boolean { + return when { + when { + x is Float -> y is Double + true -> false + } -> ieee754equals(arg0 = x /*as Float */.toDouble(), arg1 = y /*as Double */).not() + true -> false + } +} + +fun testDF(x: Any, y: Any): Boolean { + return when { + when { + x is Double -> y is Float + true -> false + } -> ieee754equals(arg0 = x /*as Double */, arg1 = y /*as Float */.toDouble()).not() + true -> false + } +} + diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointLess.kt.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointLess.kt.txt new file mode 100644 index 00000000000..b070fa875d4 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointLess.kt.txt @@ -0,0 +1,62 @@ +fun test1d(x: Double, y: Double): Boolean { + return less(arg0 = x, arg1 = y) +} + +fun test2d(x: Double, y: Any): Boolean { + return when { + y is Double -> less(arg0 = x, arg1 = y /*as Double */) + true -> false + } +} + +fun test3d(x: Any, y: Any): Boolean { + return when { + when { + x is Double -> y is Double + true -> false + } -> less(arg0 = x /*as Double */, arg1 = y /*as Double */) + true -> false + } +} + +fun test1f(x: Float, y: Float): Boolean { + return less(arg0 = x, arg1 = y) +} + +fun test2f(x: Float, y: Any): Boolean { + return when { + y is Float -> less(arg0 = x, arg1 = y /*as Float */) + true -> false + } +} + +fun test3f(x: Any, y: Any): Boolean { + return when { + when { + x is Float -> y is Float + true -> false + } -> less(arg0 = x /*as Float */, arg1 = y /*as Float */) + true -> false + } +} + +fun testFD(x: Any, y: Any): Boolean { + return when { + when { + x is Float -> y is Double + true -> false + } -> less(arg0 = x /*as Float */.toDouble(), arg1 = y /*as Double */) + true -> false + } +} + +fun testDF(x: Any, y: Any): Boolean { + return when { + when { + x is Double -> y is Float + true -> false + } -> less(arg0 = x /*as Double */, arg1 = y /*as Float */.toDouble()) + true -> false + } +} + diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableAnyAsIntToDouble.kt.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableAnyAsIntToDouble.kt.txt new file mode 100644 index 00000000000..a12320e1b87 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableAnyAsIntToDouble.kt.txt @@ -0,0 +1,13 @@ +fun test(x: Any?, y: Double): Boolean { + return when { + x is Int -> less(arg0 = { //BLOCK + val tmp0_safe_receiver: Any? = x + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + true -> tmp0_safe_receiver /*as Int */.toDouble() + } + }, arg1 = y) + true -> false + } +} + diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableFloatingPointEqeq.kt.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableFloatingPointEqeq.kt.txt new file mode 100644 index 00000000000..2a66efd6bc5 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableFloatingPointEqeq.kt.txt @@ -0,0 +1,46 @@ +fun testDD(x: Double?, y: Double?): Boolean { + return ieee754equals(arg0 = x, arg1 = y) +} + +fun testDF(x: Double?, y: Any?): Boolean { + return when { + y is Float? -> ieee754equals(arg0 = x, arg1 = { //BLOCK + val tmp0_safe_receiver: Any? = y + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + true -> tmp0_safe_receiver /*as Float */.toDouble() + } + }) + true -> false + } +} + +fun testDI(x: Double?, y: Any?): Boolean { + return when { + y is Int? -> ieee754equals(arg0 = x, arg1 = { //BLOCK + val tmp0_safe_receiver: Any? = y + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + true -> tmp0_safe_receiver /*as Int */.toDouble() + } + }) + true -> false + } +} + +fun testDI2(x: Any?, y: Any?): Boolean { + return when { + when { + x is Int? -> y is Double + true -> false + } -> ieee754equals(arg0 = { //BLOCK + val tmp0_safe_receiver: Any? = x + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + true -> tmp0_safe_receiver /*as Int */.toDouble() + } + }, arg1 = y /*as Double? */) + true -> false + } +} + diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/typeParameterWithPrimitiveNumericSupertype.kt.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/typeParameterWithPrimitiveNumericSupertype.kt.txt new file mode 100644 index 00000000000..59edd1194bb --- /dev/null +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/typeParameterWithPrimitiveNumericSupertype.kt.txt @@ -0,0 +1,68 @@ +fun test0(x: Any, y: T): Boolean { + return when { + x is Int -> EQEQ(arg0 = x, arg1 = y) + true -> false + } +} + +fun test1(x: Any, y: T): Boolean { + return when { + x is Float -> ieee754equals(arg0 = x /*as Float */, arg1 = y) + true -> false + } +} + +fun test2(x: Any, y: T): Boolean { + return when { + x is Float -> ieee754equals(arg0 = x /*as Float */.toDouble(), arg1 = y) + true -> false + } +} + +fun test3(x: Any, y: T): Boolean { + return when { + x is Int -> ieee754equals(arg0 = x /*as Int */.toFloat(), arg1 = y) + true -> false + } +} + +fun test4(x: Any, y: T): Boolean { + return when { + x is Int -> ieee754equals(arg0 = x /*as Int */.toFloat(), arg1 = y) + true -> false + } +} + +fun test5(x: Any, y: R): Boolean { + return when { + x is Int -> ieee754equals(arg0 = x /*as Int */.toFloat(), arg1 = y) + true -> false + } +} + +fun test6(x: Any, y: T): Boolean { + return when { + x is Int -> EQEQ(arg0 = x, arg1 = y) + true -> false + } +} + +class F { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun testCapturedType(x: T, y: Any): Boolean { + return when { + y is Double -> ieee754equals(arg0 = x.toDouble(), arg1 = y /*as Double */) + true -> false + } + } + + + + +} + diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/whenByFloatingPoint.kt.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/whenByFloatingPoint.kt.txt new file mode 100644 index 00000000000..b44336eeca2 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/whenByFloatingPoint.kt.txt @@ -0,0 +1,80 @@ +fun testSimple(x: Double): Int { + return { //BLOCK + val tmp0_subject: Double = x + when { + ieee754equals(arg0 = tmp0_subject, arg1 = 0.0D) -> 0 + true -> 1 + } + } +} + +fun testSmartCastInWhenSubject(x: Any): Int { + when { + x !is Double -> return -1 + } + return { //BLOCK + val tmp0_subject: Any = x + when { + ieee754equals(arg0 = tmp0_subject /*as Double */, arg1 = 0.0D) -> 0 + true -> 1 + } + } +} + +fun testSmartCastInWhenCondition(x: Double, y: Any): Int { + when { + y !is Double -> return -1 + } + return { //BLOCK + val tmp0_subject: Double = x + when { + ieee754equals(arg0 = tmp0_subject, arg1 = y /*as Double */) -> 0 + true -> 1 + } + } +} + +fun testSmartCastInWhenConditionInBranch(x: Any): Int { + return { //BLOCK + val tmp0_subject: Any = x + when { + tmp0_subject is Double.not() -> -1 + ieee754equals(arg0 = tmp0_subject /*as Double */, arg1 = 0.0D) -> 0 + true -> 1 + } + } +} + +fun testSmartCastToDifferentTypes(x: Any, y: Any): Int { + when { + x !is Double -> return -1 + } + when { + y !is Float -> return -1 + } + return { //BLOCK + val tmp0_subject: Any = x + when { + ieee754equals(arg0 = tmp0_subject /*as Double */, arg1 = y /*as Float */.toDouble()) -> 0 + true -> 1 + } + } +} + +fun foo(x: Double): Double { + return x +} + +fun testWithPrematureExitInConditionSubexpression(x: Any): Int { + return { //BLOCK + val tmp0_subject: Any = x + when { + EQEQ(arg0 = tmp0_subject, arg1 = foo(x = when { + x !is Double -> return 42 + true -> x /*as Double */ + })) -> 0 + true -> 1 + } + } +} + diff --git a/compiler/testData/ir/irText/expressions/for.kt.txt b/compiler/testData/ir/irText/expressions/for.kt.txt new file mode 100644 index 00000000000..a1ab4dfddbe --- /dev/null +++ b/compiler/testData/ir/irText/expressions/for.kt.txt @@ -0,0 +1,45 @@ +fun testEmpty(ss: List) { + { //BLOCK + val tmp0_iterator: Iterator = ss.iterator() + while (tmp0_iterator.hasNext()) { //BLOCK + val s: String = tmp0_iterator.next() + } + } +} + +fun testIterable(ss: List) { + { //BLOCK + val tmp0_iterator: Iterator = ss.iterator() + while (tmp0_iterator.hasNext()) { //BLOCK + val s: String = tmp0_iterator.next() + { //BLOCK + println(message = s) + } + } + } +} + +fun testDestructuring(pp: List>) { + { //BLOCK + val tmp0_iterator: Iterator> = pp.iterator() + while (tmp0_iterator.hasNext()) { //BLOCK + val tmp1_loop_parameter: Pair = tmp0_iterator.next() + val i: Int = tmp1_loop_parameter.component1() + val s: String = tmp1_loop_parameter.component2() + { //BLOCK + println(message = i) + println(message = s) + } + } + } +} + +fun testRange() { + { //BLOCK + val tmp0_iterator: IntIterator = 1.rangeTo(other = 10).iterator() + while (tmp0_iterator.hasNext()) { //BLOCK + val i: Int = tmp0_iterator.next() + } + } +} + diff --git a/compiler/testData/ir/irText/expressions/forWithBreakContinue.kt.txt b/compiler/testData/ir/irText/expressions/forWithBreakContinue.kt.txt new file mode 100644 index 00000000000..361ffee9399 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/forWithBreakContinue.kt.txt @@ -0,0 +1,70 @@ +fun testForBreak1(ss: List) { + { //BLOCK + val tmp0_iterator: Iterator = ss.iterator() + while (tmp0_iterator.hasNext()) { //BLOCK + val s: String = tmp0_iterator.next() + { //BLOCK + break + } + } + } +} + +fun testForBreak2(ss: List) { + { //BLOCK + val tmp0_iterator: Iterator = ss.iterator() + while (tmp0_iterator.hasNext()) { //BLOCK + val s1: String = tmp0_iterator.next() + { //BLOCK + { //BLOCK + val tmp1_iterator: Iterator = ss.iterator() + while (tmp1_iterator.hasNext()) { //BLOCK + val s2: String = tmp1_iterator.next() + { //BLOCK + break + break + break + } + } + } + break + } + } + } +} + +fun testForContinue1(ss: List) { + { //BLOCK + val tmp0_iterator: Iterator = ss.iterator() + while (tmp0_iterator.hasNext()) { //BLOCK + val s: String = tmp0_iterator.next() + { //BLOCK + continue + } + } + } +} + +fun testForContinue2(ss: List) { + { //BLOCK + val tmp0_iterator: Iterator = ss.iterator() + while (tmp0_iterator.hasNext()) { //BLOCK + val s1: String = tmp0_iterator.next() + { //BLOCK + { //BLOCK + val tmp1_iterator: Iterator = ss.iterator() + while (tmp1_iterator.hasNext()) { //BLOCK + val s2: String = tmp1_iterator.next() + { //BLOCK + continue + continue + continue + } + } + } + continue + } + } + } +} + diff --git a/compiler/testData/ir/irText/expressions/forWithImplicitReceivers.kt.txt b/compiler/testData/ir/irText/expressions/forWithImplicitReceivers.kt.txt new file mode 100644 index 00000000000..7cb41718f38 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/forWithImplicitReceivers.kt.txt @@ -0,0 +1,66 @@ +object FiveTimes { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +class IntCell { + constructor(value: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + var value: Int + field = value + get + set + + + + +} + +interface IReceiver { + operator fun FiveTimes.iterator(): IntCell { + return TODO("IrConstructorCall") + } + + operator fun IntCell.hasNext(): Boolean { + return greater(arg0 = .(), arg1 = 0) + } + + operator fun IntCell.next(): Int { + return { //BLOCK + val tmp0_this: IntCell = + { //BLOCK + val tmp1: Int = tmp0_this.() + tmp0_this.( = tmp1.dec()) + tmp1 + } + } + } + + + + +} + +fun IReceiver.test() { + { //BLOCK + val tmp0_iterator: IntCell = .iterator($receiver = FiveTimes) + while (.hasNext($receiver = tmp0_iterator)) { //BLOCK + val i: Int = .next($receiver = tmp0_iterator) + { //BLOCK + println(message = i) + } + } + } +} + diff --git a/compiler/testData/ir/irText/expressions/funImportedFromObject.kt.txt b/compiler/testData/ir/irText/expressions/funImportedFromObject.kt.txt new file mode 100644 index 00000000000..7208c4f9bc6 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/funImportedFromObject.kt.txt @@ -0,0 +1,22 @@ +package test + +object Host { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + inline fun foo(): String { + return "OK" + } + + + + +} + +fun test(): String { + return Host.foo() +} + diff --git a/compiler/testData/ir/irText/expressions/funInterface/arrayAsVarargAfterSamArgument_fi.kt.txt b/compiler/testData/ir/irText/expressions/funInterface/arrayAsVarargAfterSamArgument_fi.kt.txt new file mode 100644 index 00000000000..4aaa2ddab5d --- /dev/null +++ b/compiler/testData/ir/irText/expressions/funInterface/arrayAsVarargAfterSamArgument_fi.kt.txt @@ -0,0 +1,58 @@ +fun interface IRunnable { + abstract fun run() + + + +} + +fun foo1(r: IRunnable, vararg s: String) { +} + +fun foo2(r1: IRunnable, r2: IRunnable, vararg s: String) { +} + +fun test(fn: Function0, r: IRunnable, s: String, arr: Array) { + foo1(r = local fun () { + return Unit + } + /*-> IRunnable */, s = [s]) + foo1(r = local fun () { + return Unit + } + /*-> IRunnable */, s = [*arr]) + foo1(r = fn /*-> IRunnable */, s = [s]) + foo1(r = fn /*-> IRunnable */, s = [*arr]) + foo1(r = r, s = [s]) + foo1(r = r, s = [*arr]) + foo2(r1 = local fun () { + return Unit + } + /*-> IRunnable */, r2 = local fun () { + return Unit + } + /*-> IRunnable */, s = [s]) + foo2(r1 = local fun () { + return Unit + } + /*-> IRunnable */, r2 = local fun () { + return Unit + } + /*-> IRunnable */, s = [*arr]) + foo2(r1 = fn /*-> IRunnable */, r2 = local fun () { + return Unit + } + /*-> IRunnable */, s = [s]) + foo2(r1 = fn /*-> IRunnable */, r2 = local fun () { + return Unit + } + /*-> IRunnable */, s = [*arr]) + foo2(r1 = r, r2 = local fun () { + return Unit + } + /*-> IRunnable */, s = [s]) + foo2(r1 = r, r2 = local fun () { + return Unit + } + /*-> IRunnable */, s = [*arr]) +} + diff --git a/compiler/testData/ir/irText/expressions/funInterface/basicFunInterfaceConversion.kt.txt b/compiler/testData/ir/irText/expressions/funInterface/basicFunInterfaceConversion.kt.txt new file mode 100644 index 00000000000..d97ac04a4e5 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/funInterface/basicFunInterfaceConversion.kt.txt @@ -0,0 +1,18 @@ +fun interface Foo { + abstract fun invoke(): String + + + +} + +fun foo(f: Foo): String { + return f.invoke() +} + +fun test(): String { + return foo(f = local fun (): String { + return "OK" + } + /*-> Foo */) +} + diff --git a/compiler/testData/ir/irText/expressions/funInterface/castFromAny.kt.txt b/compiler/testData/ir/irText/expressions/funInterface/castFromAny.kt.txt new file mode 100644 index 00000000000..316d45be194 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/funInterface/castFromAny.kt.txt @@ -0,0 +1,12 @@ +fun interface KRunnable { + abstract fun invoke() + + + +} + +fun test(a: Any?) { + a as Function0 /*~> Unit */ + a /*as Function0 */ /*-> KRunnable */.invoke() +} + diff --git a/compiler/testData/ir/irText/expressions/funInterface/partialSam.kt.txt b/compiler/testData/ir/irText/expressions/funInterface/partialSam.kt.txt new file mode 100644 index 00000000000..cca51d2739b --- /dev/null +++ b/compiler/testData/ir/irText/expressions/funInterface/partialSam.kt.txt @@ -0,0 +1,80 @@ +fun interface Fn { + abstract fun run(s: String, i: Int, t: T): R + + + +} + +class J { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun runConversion(f1: Fn, f2: Fn): Int { + return f1.run(s = "Bar", i = 1, t = f2.run(s = "Foo", i = 42, t = 239)) + } + + + + +} + +val fsi: Fn + field = { //BLOCK + local class : Fn { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + override fun run(s: String, i: Int, t: String): Int { + return 1 + } + + + + + } + + + TODO("IrConstructorCall") + } + get + +val fis: Fn + field = { //BLOCK + local class : Fn { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + override fun run(s: String, i: Int, t: Int): String { + return "" + } + + + + + } + + + TODO("IrConstructorCall") + } + get + +fun test(j: J) { + j.runConversion(f1 = (), f2 = local fun (s: String, i: Int, ti: Int): String { + return "" + } + /*-> Fn */) /*~> Unit */ + j.runConversion(f1 = local fun (s: String, i: Int, ts: String): Int { + return 1 + } + /*-> Fn */, f2 = ()) /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/expressions/funInterface/samConversionInVarargs.kt.txt b/compiler/testData/ir/irText/expressions/funInterface/samConversionInVarargs.kt.txt new file mode 100644 index 00000000000..236c0c99fe2 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/funInterface/samConversionInVarargs.kt.txt @@ -0,0 +1,41 @@ +fun interface IFoo { + abstract fun foo(i: Int) + + + +} + +fun useVararg(vararg foos: IFoo) { +} + +fun testLambda() { + useVararg(foos = [ local fun (it: Int) { + return Unit + } + /*-> IFoo */]) +} + +fun testSeveralLambdas() { + useVararg(foos = [ local fun (it: Int) { + return Unit + } + /*-> IFoo */, local fun (it: Int) { + return Unit + } + /*-> IFoo */, local fun (it: Int) { + return Unit + } + /*-> IFoo */]) +} + +fun withVarargOfInt(vararg xs: Int): String { + return "" +} + +fun testAdaptedCR() { + useVararg(foos = [ local fun withVarargOfInt(p0: Int) { + withVarargOfInt(xs = [p0]) /*~> Unit */ + } + /*-> IFoo */]) +} + diff --git a/compiler/testData/ir/irText/expressions/funInterface/samConversionInVarargsMixed.kt.txt b/compiler/testData/ir/irText/expressions/funInterface/samConversionInVarargsMixed.kt.txt new file mode 100644 index 00000000000..2f043ee06e3 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/funInterface/samConversionInVarargsMixed.kt.txt @@ -0,0 +1,21 @@ +fun interface MyRunnable { + abstract fun run() + + + +} + +fun test(a: Any, r: MyRunnable) { + when { + a is MyRunnable -> { //BLOCK + foo(rs = [ local fun () { + return Unit + } + /*-> MyRunnable */, r, a /*as MyRunnable */]) + } + } +} + +fun foo(vararg rs: MyRunnable) { +} + diff --git a/compiler/testData/ir/irText/expressions/funInterface/samConversionOnCallableReference.kt.txt b/compiler/testData/ir/irText/expressions/funInterface/samConversionOnCallableReference.kt.txt new file mode 100644 index 00000000000..9b71c6464c9 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/funInterface/samConversionOnCallableReference.kt.txt @@ -0,0 +1,39 @@ +fun interface KRunnable { + abstract fun run() + + + +} + +fun foo0() { +} + +fun foo1(vararg xs: Int): Int { + return 1 +} + +fun use(r: KRunnable) { +} + +fun testSamConstructor(): KRunnable { + return ::foo0 /*-> KRunnable */ +} + +fun testSamCosntructorOnAdapted(): KRunnable { + return local fun foo1() { + foo1() /*~> Unit */ + } + /*-> KRunnable */ +} + +fun testSamConversion() { + use(r = ::foo0 /*-> KRunnable */) +} + +fun testSamConversionOnAdapted() { + use(r = local fun foo1() { + foo1() /*~> Unit */ + } + /*-> KRunnable */) +} + diff --git a/compiler/testData/ir/irText/expressions/funInterface/samConversionsWithSmartCasts.kt.txt b/compiler/testData/ir/irText/expressions/funInterface/samConversionsWithSmartCasts.kt.txt new file mode 100644 index 00000000000..a08314e70c3 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/funInterface/samConversionsWithSmartCasts.kt.txt @@ -0,0 +1,80 @@ +fun interface KRunnable { + abstract fun run() + + + +} + +fun id(x: T): T { + return x +} + +fun run1(r: KRunnable) { +} + +fun run2(r1: KRunnable, r2: KRunnable) { +} + +fun test0(a: T) where T : KRunnable, T : Function0 { + run1(r = a) +} + +fun test1(a: Function0) { + when { + a is KRunnable -> { //BLOCK + run1(r = a /*as KRunnable */) + } + } +} + +fun test2(a: KRunnable) { + a as Function0 /*~> Unit */ + run1(r = a) +} + +fun test3(a: Function0) { + when { + a is KRunnable -> { //BLOCK + run2(r1 = a /*as KRunnable */, r2 = a /*as KRunnable */) + } + } +} + +fun test4(a: Function0, b: Function0) { + when { + a is KRunnable -> { //BLOCK + run2(r1 = a /*as KRunnable */, r2 = b /*-> KRunnable */) + } + } +} + +fun test5(a: Any) { + when { + a is KRunnable -> { //BLOCK + run1(r = a /*as KRunnable */) + } + } +} + +fun test5x(a: Any) { + when { + a is KRunnable -> { //BLOCK + a as Function0 /*~> Unit */ + run1(r = a /*as KRunnable */) + } + } +} + +fun test6(a: Any) { + a as Function0 /*~> Unit */ + run1(r = a /*as Function0 */ /*-> KRunnable */) +} + +fun test8(a: Function0) { + run1(r = id>(x = a) /*-> KRunnable */) +} + +fun test9() { + run1(r = ::test9 /*-> KRunnable */) +} + diff --git a/compiler/testData/ir/irText/expressions/genericConstructorCallWithTypeArguments.kt.txt b/compiler/testData/ir/irText/expressions/genericConstructorCallWithTypeArguments.kt.txt new file mode 100644 index 00000000000..de733a79f3d --- /dev/null +++ b/compiler/testData/ir/irText/expressions/genericConstructorCallWithTypeArguments.kt.txt @@ -0,0 +1,24 @@ +fun testSimple(): Box { + return TODO("IrConstructorCall") +} + +inline fun testArray(n: Int, crossinline block: Function0): Array { + return TODO("IrConstructorCall") +} + +class Box { + constructor(value: T) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val value: T + field = value + get + + + + +} + diff --git a/compiler/testData/ir/irText/expressions/genericPropertyCall.kt.txt b/compiler/testData/ir/irText/expressions/genericPropertyCall.kt.txt new file mode 100644 index 00000000000..7902ef55981 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/genericPropertyCall.kt.txt @@ -0,0 +1,9 @@ +val T.id: T + get(): T { + return + } + +val test: String + field = ($receiver = "abc") + get + diff --git a/compiler/testData/ir/irText/expressions/genericPropertyRef.kt.txt b/compiler/testData/ir/irText/expressions/genericPropertyRef.kt.txt new file mode 100644 index 00000000000..7f609db12b1 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/genericPropertyRef.kt.txt @@ -0,0 +1,77 @@ +class Value { + constructor(value: T = null as T, text: String? = null) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + var value: T + field = value + get + set + + var text: String? + field = text + get + set + + + + +} + +val Value.additionalText: Int /* by */ + field = TODO("IrConstructorCall") + get(): Int { + return #additionalText$delegate.getValue(t = , p = ::additionalText) + } + +val Value.additionalValue: Int /* by */ + field = TODO("IrConstructorCall") + get(): Int { + return #additionalValue$delegate.getValue(t = , p = ::additionalValue) + } + +class DVal { + constructor(kmember: Any) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val kmember: Any + field = kmember + get + + operator fun getValue(t: Any?, p: Any): Int { + return 42 + } + + + + +} + +var recivier: Any? + field = "fail" + get + set + +var value2: Any? + field = "fail2" + get + set + +var T.bar: T + get(): T { + return + } + set(value: T) { + ( = ) + ( = value) + } + +val barRef: KMutableProperty1 + field = ::bar + get + diff --git a/compiler/testData/ir/irText/expressions/identity.kt.txt b/compiler/testData/ir/irText/expressions/identity.kt.txt new file mode 100644 index 00000000000..e756c6d2c06 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/identity.kt.txt @@ -0,0 +1,12 @@ +fun test1(a: Int, b: Int): Boolean { + return EQEQEQ(arg0 = a, arg1 = b) +} + +fun test2(a: Int, b: Int): Boolean { + return EQEQEQ(arg0 = a, arg1 = b).not() +} + +fun test3(a: Any?, b: Any?): Boolean { + return EQEQEQ(arg0 = a, arg1 = b) +} + diff --git a/compiler/testData/ir/irText/expressions/ifElseIf.kt.txt b/compiler/testData/ir/irText/expressions/ifElseIf.kt.txt new file mode 100644 index 00000000000..04dca45f626 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/ifElseIf.kt.txt @@ -0,0 +1,40 @@ +fun test(i: Int): Int { + return when { + greater(arg0 = i, arg1 = 0) -> 1 + less(arg0 = i, arg1 = 0) -> -1 + true -> 0 + } +} + +fun testEmptyBranches1(flag: Boolean) { + when { + flag -> { //BLOCK + } + true -> true /*~> Unit */ + } + when { + flag -> true /*~> Unit */ + } +} + +fun testEmptyBranches2(flag: Boolean) { + when { + flag -> { //BLOCK + } + true -> true /*~> Unit */ + } + when { + flag -> true /*~> Unit */ + true -> { //BLOCK + } + } +} + +fun testEmptyBranches3(flag: Boolean) { + when { + flag -> { //BLOCK + } + true -> true /*~> Unit */ + } +} + diff --git a/compiler/testData/ir/irText/expressions/implicitCastInReturnFromConstructor.kt.txt b/compiler/testData/ir/irText/expressions/implicitCastInReturnFromConstructor.kt.txt new file mode 100644 index 00000000000..72cc93ab5f6 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/implicitCastInReturnFromConstructor.kt.txt @@ -0,0 +1,19 @@ +class C { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + constructor(x: Any?) { + TODO("IrDelegatingConstructorCall") + when { + x is Unit -> return x /*~> Unit */ + } + } + + + + +} + diff --git a/compiler/testData/ir/irText/expressions/implicitCastOnPlatformType.kt.txt b/compiler/testData/ir/irText/expressions/implicitCastOnPlatformType.kt.txt new file mode 100644 index 00000000000..ca9ae90b00f --- /dev/null +++ b/compiler/testData/ir/irText/expressions/implicitCastOnPlatformType.kt.txt @@ -0,0 +1,4 @@ +fun test(): String { + return getProperty(p0 = "test") /*!! String */ +} + diff --git a/compiler/testData/ir/irText/expressions/implicitCastToNonNull.kt.txt b/compiler/testData/ir/irText/expressions/implicitCastToNonNull.kt.txt new file mode 100644 index 00000000000..157fc95f689 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/implicitCastToNonNull.kt.txt @@ -0,0 +1,34 @@ +fun test1(x: String?): Int { + return when { + EQEQ(arg0 = x, arg1 = null) -> 0 + true -> x.() + } +} + +fun test2(x: T): Int { + return when { + EQEQ(arg0 = x, arg1 = null) -> 0 + true -> x.() + } +} + +inline fun test3(x: Any): Int { + return when { + x !is T -> 0 + true -> x /*as CharSequence */.() + } +} + +inline fun test4(x: Any?): Int { + return when { + x !is T -> 0 + true -> x /*as CharSequence */.() + } +} + +fun test5(x: T, fn: Function1) { + when { + EQEQ(arg0 = x, arg1 = null).not() -> fn.invoke(p1 = x) + } +} + diff --git a/compiler/testData/ir/irText/expressions/implicitCastToTypeParameter.kt.txt b/compiler/testData/ir/irText/expressions/implicitCastToTypeParameter.kt.txt new file mode 100644 index 00000000000..d0bccb88e35 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/implicitCastToTypeParameter.kt.txt @@ -0,0 +1,41 @@ +inline fun Any.test1(): T? { + return when { + is T -> /*as T */ + true -> null + } +} + +interface Foo { + + + +} + +val Foo.asT: T? + inline get(): T? { + return when { + is T -> /*as T */ + true -> null + } + } + +class Bar { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun test(arg: Any) { + arg as T /*~> Unit */ + .useT(t = arg /*as T */) + } + + fun useT(t: T) { + } + + + + +} + diff --git a/compiler/testData/ir/irText/expressions/implicitNotNullInDestructuringAssignment.kt.txt b/compiler/testData/ir/irText/expressions/implicitNotNullInDestructuringAssignment.kt.txt new file mode 100644 index 00000000000..b10b98aae22 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/implicitNotNullInDestructuringAssignment.kt.txt @@ -0,0 +1,16 @@ +operator fun J?.component1(): Int { + return 1 +} + +private operator fun J.component2(): Int { + return 2 +} + +fun test() { + // COMPOSITE { + val tmp0_container: @FlexibleNullability J? = j() + val a: Int = component1($receiver = tmp0_container) + val b: Int = component2($receiver = tmp0_container /*!! J */) + // } +} + diff --git a/compiler/testData/ir/irText/expressions/in.kt.txt b/compiler/testData/ir/irText/expressions/in.kt.txt new file mode 100644 index 00000000000..2a0919283e2 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/in.kt.txt @@ -0,0 +1,16 @@ +fun test1(a: Any, x: Collection): Boolean { + return x.contains(element = a) +} + +fun test2(a: Any, x: Collection): Boolean { + return x.contains(element = a).not() +} + +fun test3(a: T, x: Collection): Boolean { + return x.contains(element = a) +} + +fun test4(a: T, x: Collection): Boolean { + return x.contains(element = a).not() +} + diff --git a/compiler/testData/ir/irText/expressions/incrementDecrement.kt.txt b/compiler/testData/ir/irText/expressions/incrementDecrement.kt.txt new file mode 100644 index 00000000000..37c658b7a50 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/incrementDecrement.kt.txt @@ -0,0 +1,98 @@ +var p: Int + field = 0 + get + set + +val arr: IntArray + field = intArrayOf(elements = [1, 2, 3]) + get + +fun testVarPrefix() { + var x: Int = 0 + val x1: Int = { //BLOCK + x = x.inc() + x + } + val x2: Int = { //BLOCK + x = x.dec() + x + } +} + +fun testVarPostfix() { + var x: Int = 0 + val x1: Int = { //BLOCK + val tmp0: Int = x + x = tmp0.inc() + tmp0 + } + val x2: Int = { //BLOCK + val tmp1: Int = x + x = tmp1.dec() + tmp1 + } +} + +fun testPropPrefix() { + val p1: Int = { //BLOCK + { //BLOCK + ( = ().inc()) + () + } + } + val p2: Int = { //BLOCK + { //BLOCK + ( = ().dec()) + () + } + } +} + +fun testPropPostfix() { + val p1: Int = { //BLOCK + { //BLOCK + val tmp0: Int = () + ( = tmp0.inc()) + tmp0 + } + } + val p2: Int = { //BLOCK + { //BLOCK + ( = ().dec()) + () + } + } +} + +fun testArrayPrefix() { + val a1: Int = { //BLOCK + val tmp0_array: IntArray = () + val tmp1_index0: Int = 0 + tmp0_array.set(index = tmp1_index0, value = tmp0_array.get(index = tmp1_index0).inc()) + tmp0_array.get(index = tmp1_index0) + } + val a2: Int = { //BLOCK + val tmp2_array: IntArray = () + val tmp3_index0: Int = 0 + tmp2_array.set(index = tmp3_index0, value = tmp2_array.get(index = tmp3_index0).dec()) + tmp2_array.get(index = tmp3_index0) + } +} + +fun testArrayPostfix() { + val a1: Int = { //BLOCK + val tmp0_array: IntArray = () + val tmp1_index0: Int = 0 + val tmp2: Int = tmp0_array.get(index = tmp1_index0) + tmp0_array.set(index = tmp1_index0, value = tmp2.inc()) + tmp2 + } + val a2: Int = { //BLOCK + val tmp3_array: IntArray = () + val tmp4_index0: Int = 0 + val tmp5: Int = tmp3_array.get(index = tmp4_index0) + tmp3_array.set(index = tmp4_index0, value = tmp5.dec()) + tmp5 + } +} + diff --git a/compiler/testData/ir/irText/expressions/interfaceThisRef.kt.txt b/compiler/testData/ir/irText/expressions/interfaceThisRef.kt.txt new file mode 100644 index 00000000000..1537efb3157 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/interfaceThisRef.kt.txt @@ -0,0 +1,11 @@ +interface IFoo { + abstract fun foo() + fun bar() { + .foo() + } + + + + +} + diff --git a/compiler/testData/ir/irText/expressions/javaSyntheticGenericPropertyAccess.kt.txt b/compiler/testData/ir/irText/expressions/javaSyntheticGenericPropertyAccess.kt.txt new file mode 100644 index 00000000000..98c77cbdc76 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/javaSyntheticGenericPropertyAccess.kt.txt @@ -0,0 +1,17 @@ +fun test(j: J) { + j.getFoo() /*~> Unit */ + j.setFoo(x = 1) + { //BLOCK + val tmp0_receiver: J = j + { //BLOCK + val tmp1: Int = tmp0_receiver.getFoo() + tmp0_receiver.setFoo(x = tmp1.inc()) + tmp1 + } + } /*~> Unit */ + { //BLOCK + val tmp2_receiver: J = j + tmp2_receiver.setFoo(x = tmp2_receiver.getFoo().plus(other = 1)) + } +} + diff --git a/compiler/testData/ir/irText/expressions/javaSyntheticPropertyAccess.kt.txt b/compiler/testData/ir/irText/expressions/javaSyntheticPropertyAccess.kt.txt new file mode 100644 index 00000000000..5ba46d3caee --- /dev/null +++ b/compiler/testData/ir/irText/expressions/javaSyntheticPropertyAccess.kt.txt @@ -0,0 +1,17 @@ +fun test(j: J) { + j.getFoo() /*~> Unit */ + j.setFoo(x = 1) + { //BLOCK + val tmp0_receiver: J = j + { //BLOCK + val tmp1: Int = tmp0_receiver.getFoo() + tmp0_receiver.setFoo(x = tmp1.inc()) + tmp1 + } + } /*~> Unit */ + { //BLOCK + val tmp2_receiver: J = j + tmp2_receiver.setFoo(x = tmp2_receiver.getFoo().plus(other = 1)) + } +} + diff --git a/compiler/testData/ir/irText/expressions/jvmFieldWithIntersectionTypes.kt.txt b/compiler/testData/ir/irText/expressions/jvmFieldWithIntersectionTypes.kt.txt new file mode 100644 index 00000000000..4e9fd5ade2a --- /dev/null +++ b/compiler/testData/ir/irText/expressions/jvmFieldWithIntersectionTypes.kt.txt @@ -0,0 +1,85 @@ +interface IFoo { + + + +} + +class Derived1 : JFieldOwner, IFoo { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +class Derived2 : JFieldOwner, IFoo { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +open class Mid : JFieldOwner { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +class DerivedThroughMid1 : Mid, IFoo { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +class DerivedThroughMid2 : Mid, IFoo { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +fun test(b: Boolean) { + val d1: Derived1 = TODO("IrConstructorCall") + val d2: Derived2 = TODO("IrConstructorCall") + val k: Any = when { + b -> d1 + true -> d2 + } + #f = 42 + #f /*~> Unit */ + val md1: DerivedThroughMid1 = TODO("IrConstructorCall") + val md2: DerivedThroughMid2 = TODO("IrConstructorCall") + val mk: Any = when { + b -> md1 + true -> md2 + } + #f = 44 + #f /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/expressions/jvmInstanceFieldReference.kt.txt b/compiler/testData/ir/irText/expressions/jvmInstanceFieldReference.kt.txt new file mode 100644 index 00000000000..31e26fb0fdb --- /dev/null +++ b/compiler/testData/ir/irText/expressions/jvmInstanceFieldReference.kt.txt @@ -0,0 +1,24 @@ +class Derived : Base { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + init { + #value = 0 + } + + fun getValue(): Int { + return #value + } + + fun setValue(value: Int) { + #value = value + } + + + + +} + diff --git a/compiler/testData/ir/irText/expressions/jvmStaticFieldReference.kt.txt b/compiler/testData/ir/irText/expressions/jvmStaticFieldReference.kt.txt new file mode 100644 index 00000000000..4ccf6c4bd1f --- /dev/null +++ b/compiler/testData/ir/irText/expressions/jvmStaticFieldReference.kt.txt @@ -0,0 +1,38 @@ +fun testFun() { + #out /*!! PrintStream */.println(p0 = "testFun") +} + +var testProp: Any + get(): Any { + #out /*!! PrintStream */.println(p0 = "testProp/get") + return 42 + } + set(value: Any) { + #out /*!! PrintStream */.println(p0 = "testProp/set") + } + +class TestClass { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val test: Int + field = when { + true -> { //BLOCK + #out /*!! PrintStream */.println(p0 = "TestClass/test") + 42 + } + } + get + + init { + #out /*!! PrintStream */.println(p0 = "TestClass/init") + } + + + + +} + diff --git a/compiler/testData/ir/irText/expressions/kt16904.kt.txt b/compiler/testData/ir/irText/expressions/kt16904.kt.txt new file mode 100644 index 00000000000..f3b9ea81a45 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/kt16904.kt.txt @@ -0,0 +1,72 @@ +abstract class A { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: B + field = TODO("IrConstructorCall") + get + + var y: Int + field = 0 + get + set + + + + +} + +class B { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + operator fun plusAssign(x: Int) { + } + + + + +} + +class Test1 : A { + constructor() { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + { //BLOCK + val tmp0_this: Test1 = + tmp0_this.().plusAssign(x = 42) + } + { //BLOCK + val tmp1_this: Test1 = + tmp1_this.( = tmp1_this.().plus(other = 42)) + } + } + + + + +} + +class Test2 : J { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + init { + #field = 42 + } + + + + +} + diff --git a/compiler/testData/ir/irText/expressions/kt16905.kt.txt b/compiler/testData/ir/irText/expressions/kt16905.kt.txt new file mode 100644 index 00000000000..99a9519206c --- /dev/null +++ b/compiler/testData/ir/irText/expressions/kt16905.kt.txt @@ -0,0 +1,53 @@ +class Outer { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + open inner class Inner { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + } + + inner class InnerDerived0 : Inner { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + } + + inner class InnerDerived1 : Inner { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + } + + + + +} + +typealias OI = Inner +fun test(): Inner { + return TODO("IrConstructorCall") +} + diff --git a/compiler/testData/ir/irText/expressions/kt23030.kt.txt b/compiler/testData/ir/irText/expressions/kt23030.kt.txt new file mode 100644 index 00000000000..a82a6196c34 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/kt23030.kt.txt @@ -0,0 +1,58 @@ +operator fun Int.compareTo(c: Char): Int { + return 0 +} + +fun testOverloadedCompareToCall(x: Int, y: Char): Boolean { + return less(arg0 = compareTo($receiver = x, c = y), arg1 = 0) +} + +fun testOverloadedCompareToCallWithSmartCast(x: Any, y: Any): Boolean { + return when { + when { + x is Int -> y is Char + true -> false + } -> less(arg0 = compareTo($receiver = x /*as Int */, c = y /*as Char */), arg1 = 0) + true -> false + } +} + +fun testEqualsWithSmartCast(x: Any, y: Any): Boolean { + return when { + when { + x is Int -> y is Char + true -> false + } -> EQEQ(arg0 = x, arg1 = y) + true -> false + } +} + +class C { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + operator fun Int.compareTo(c: Char): Int { + return 0 + } + + fun testMemberExtensionCompareToCall(x: Int, y: Char): Boolean { + return less(arg0 = .compareTo($receiver = x, c = y), arg1 = 0) + } + + fun testMemberExtensionCompareToCallWithSmartCast(x: Any, y: Any): Boolean { + return when { + when { + x is Int -> y is Char + true -> false + } -> less(arg0 = .compareTo($receiver = x /*as Int */, c = y /*as Char */), arg1 = 0) + true -> false + } + } + + + + +} + diff --git a/compiler/testData/ir/irText/expressions/kt24804.kt.txt b/compiler/testData/ir/irText/expressions/kt24804.kt.txt new file mode 100644 index 00000000000..55eef83097a --- /dev/null +++ b/compiler/testData/ir/irText/expressions/kt24804.kt.txt @@ -0,0 +1,27 @@ +inline fun foo(): Boolean { + return false +} + +fun run(x: Boolean, y: Boolean): String { + var z: Int = 10 + { //BLOCK + do// COMPOSITE { + z = z.plus(other = 1) + when { + greater(arg0 = z, arg1 = 100) -> return "NOT_OK" + } + when { + x -> continue + } + when { + y -> continue + } + // } while (foo()) + } + return "OK" +} + +fun box(): String { + return run(x = true, y = true) +} + diff --git a/compiler/testData/ir/irText/expressions/kt27933.kt.txt b/compiler/testData/ir/irText/expressions/kt27933.kt.txt new file mode 100644 index 00000000000..93a84bbe326 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/kt27933.kt.txt @@ -0,0 +1,13 @@ +fun box(): String { + var r: String = "" + when { + EQEQ(arg0 = r, arg1 = "").not() -> { //BLOCK + } + true -> r = r.plus(other = "O") + } + when { + EQEQ(arg0 = r, arg1 = "O") -> r = r.plus(other = "K") + } + return r +} + diff --git a/compiler/testData/ir/irText/expressions/kt28006.kt.txt b/compiler/testData/ir/irText/expressions/kt28006.kt.txt new file mode 100644 index 00000000000..9e923701440 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/kt28006.kt.txt @@ -0,0 +1,40 @@ +val test1: String + field = "🤗" + get + +val test2: String + field = "🤗🤗" + get + +const val testConst1: String + field = "🤗" + get + +const val testConst2: String + field = "🤗🤗" + get + +const val testConst3: String + field = "🤗🤗🤗" + get + +const val testConst4: String + field = "🤗🤗🤗🤗" + get + +fun test1(x: Int): String { + return "🤗" + +x +} + +fun test2(x: Int): String { + return x + +"🤗" +} + +fun test3(x: Int): String { + return x + +"🤗" + +x +} + diff --git a/compiler/testData/ir/irText/expressions/kt28456.kt.txt b/compiler/testData/ir/irText/expressions/kt28456.kt.txt new file mode 100644 index 00000000000..610133346bd --- /dev/null +++ b/compiler/testData/ir/irText/expressions/kt28456.kt.txt @@ -0,0 +1,43 @@ +class A { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +operator fun A.get(vararg xs: Int): Int { + return 0 +} + +operator fun A.set(i: Int, j: Int, v: Int) { +} + +fun testSimpleAssignment(a: A) { + set($receiver = a, i = 1, j = 2, v = 0) +} + +fun testPostfixIncrement(a: A): Int { + return { //BLOCK + val tmp0_array: A = a + val tmp1_index0: Int = 1 + val tmp2_index1: Int = 2 + val tmp3: Int = get($receiver = tmp0_array, xs = [tmp1_index0, tmp2_index1]) + set($receiver = tmp0_array, i = tmp1_index0, j = tmp2_index1, v = tmp3.inc()) + tmp3 + } +} + +fun testCompoundAssignment(a: A) { + { //BLOCK + val tmp0_array: A = a + val tmp1_index0: Int = 1 + val tmp2_index1: Int = 2 + set($receiver = tmp0_array, i = tmp1_index0, j = tmp2_index1, v = get($receiver = tmp0_array, xs = [tmp1_index0, tmp2_index1]).plus(other = 10)) + } +} + diff --git a/compiler/testData/ir/irText/expressions/kt28456a.kt.txt b/compiler/testData/ir/irText/expressions/kt28456a.kt.txt new file mode 100644 index 00000000000..e1d3a1342c9 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/kt28456a.kt.txt @@ -0,0 +1,19 @@ +class A { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +operator fun A.set(vararg i: Int, v: Int) { +} + +fun testSimpleAssignment(a: A) { + set($receiver = a, i = [1, 2, 3], v = 0) +} + diff --git a/compiler/testData/ir/irText/expressions/kt28456b.kt.txt b/compiler/testData/ir/irText/expressions/kt28456b.kt.txt new file mode 100644 index 00000000000..07efb170f58 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/kt28456b.kt.txt @@ -0,0 +1,41 @@ +class A { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +operator fun A.get(i: Int, a: Int = 1, b: Int = 2, c: Int = 3, d: Int = 4): Int { + return 0 +} + +operator fun A.set(i: Int, j: Int = 42, v: Int) { +} + +fun testSimpleAssignment(a: A) { + set($receiver = a, i = 1, v = 0) +} + +fun testPostfixIncrement(a: A): Int { + return { //BLOCK + val tmp0_array: A = a + val tmp1_index0: Int = 1 + val tmp2: Int = get($receiver = tmp0_array, i = tmp1_index0) + set($receiver = tmp0_array, i = tmp1_index0, v = tmp2.inc()) + tmp2 + } +} + +fun testCompoundAssignment(a: A) { + { //BLOCK + val tmp0_array: A = a + val tmp1_index0: Int = 1 + set($receiver = tmp0_array, i = tmp1_index0, v = get($receiver = tmp0_array, i = tmp1_index0).plus(other = 10)) + } +} + diff --git a/compiler/testData/ir/irText/expressions/kt30020.kt.txt b/compiler/testData/ir/irText/expressions/kt30020.kt.txt new file mode 100644 index 00000000000..4b7723bab37 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/kt30020.kt.txt @@ -0,0 +1,90 @@ +interface X { + abstract val xs: MutableList + abstract get + + abstract fun f(): MutableList + + + +} + +fun test(x: X, nx: X?) { + { //BLOCK + val tmp0_this: X = x + plusAssign($receiver = tmp0_this.(), element = 1) + } + plusAssign($receiver = x.f(), element = 2) + plusAssign($receiver = x.() as MutableList, element = 3) + plusAssign($receiver = x.f() as MutableList, element = 4) + plusAssign($receiver = CHECK_NOT_NULL>(arg0 = { //BLOCK + val tmp1_safe_receiver: X? = nx + when { + EQEQ(arg0 = tmp1_safe_receiver, arg1 = null) -> null + true -> tmp1_safe_receiver.() + } + }), element = 5) + plusAssign($receiver = CHECK_NOT_NULL>(arg0 = { //BLOCK + val tmp2_safe_receiver: X? = nx + when { + EQEQ(arg0 = tmp2_safe_receiver, arg1 = null) -> null + true -> tmp2_safe_receiver.f() + } + }), element = 6) +} + +fun MutableList.testExtensionReceiver() { + plusAssign($receiver = , element = 100) +} + +abstract class AML : MutableList { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun testExplicitThis() { + plusAssign($receiver = , element = 200) + } + + inner class Inner { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun testOuterThis() { + plusAssign($receiver = , element = 300) + } + + + + + } + + + + + + + + + + + + + + + + + + + + + + + + +} + diff --git a/compiler/testData/ir/irText/expressions/kt30796.kt.txt b/compiler/testData/ir/irText/expressions/kt30796.kt.txt new file mode 100644 index 00000000000..9af83d46b08 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/kt30796.kt.txt @@ -0,0 +1,86 @@ +fun magic(): T { + throw TODO("IrConstructorCall") +} + +fun test(value: T, value2: T) { + val x1: Any = { //BLOCK + val tmp0_elvis_lhs: T = value + when { + EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> 42 + true -> tmp0_elvis_lhs + } + } + val x2: Any = { //BLOCK + val tmp2_elvis_lhs: T = value + when { + EQEQ(arg0 = tmp2_elvis_lhs, arg1 = null) -> { //BLOCK + val tmp1_elvis_lhs: T = value2 + when { + EQEQ(arg0 = tmp1_elvis_lhs, arg1 = null) -> 42 + true -> tmp1_elvis_lhs + } + } + true -> tmp2_elvis_lhs + } + } + val x3: Any = { //BLOCK + val tmp4_elvis_lhs: T = { //BLOCK + val tmp3_elvis_lhs: T = value + when { + EQEQ(arg0 = tmp3_elvis_lhs, arg1 = null) -> value2 + true -> tmp3_elvis_lhs + } + } + when { + EQEQ(arg0 = tmp4_elvis_lhs, arg1 = null) -> 42 + true -> tmp4_elvis_lhs + } + } + val x4: Any = { //BLOCK + val tmp6_elvis_lhs: T = { //BLOCK + val tmp5_elvis_lhs: T = value + when { + EQEQ(arg0 = tmp5_elvis_lhs, arg1 = null) -> value2 + true -> tmp5_elvis_lhs + } + } + when { + EQEQ(arg0 = tmp6_elvis_lhs, arg1 = null) -> 42 + true -> tmp6_elvis_lhs + } + } + val x5: Any = { //BLOCK + val tmp7_elvis_lhs: Any? = magic() + when { + EQEQ(arg0 = tmp7_elvis_lhs, arg1 = null) -> 42 + true -> tmp7_elvis_lhs + } + } + val x6: Any = { //BLOCK + val tmp9_elvis_lhs: Any? = { //BLOCK + val tmp8_elvis_lhs: T = value + when { + EQEQ(arg0 = tmp8_elvis_lhs, arg1 = null) -> magic() + true -> tmp8_elvis_lhs + } + } + when { + EQEQ(arg0 = tmp9_elvis_lhs, arg1 = null) -> 42 + true -> tmp9_elvis_lhs + } + } + val x7: Any = { //BLOCK + val tmp11_elvis_lhs: Any? = { //BLOCK + val tmp10_elvis_lhs: Any? = magic() + when { + EQEQ(arg0 = tmp10_elvis_lhs, arg1 = null) -> value + true -> tmp10_elvis_lhs + } + } + when { + EQEQ(arg0 = tmp11_elvis_lhs, arg1 = null) -> 42 + true -> tmp11_elvis_lhs + } + } +} + diff --git a/compiler/testData/ir/irText/expressions/kt35730.kt.txt b/compiler/testData/ir/irText/expressions/kt35730.kt.txt new file mode 100644 index 00000000000..612643b1a73 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/kt35730.kt.txt @@ -0,0 +1,27 @@ +interface Base { + fun foo() { + } + + + + +} + +object Derived : Base { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + +} + +fun test() { + Derived.foo() + Derived.foo() +} + diff --git a/compiler/testData/ir/irText/expressions/kt36956.kt.txt b/compiler/testData/ir/irText/expressions/kt36956.kt.txt new file mode 100644 index 00000000000..83ffb5581e1 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/kt36956.kt.txt @@ -0,0 +1,37 @@ +class A { + constructor(value: T) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + private val value: T + field = value + private get + + operator fun get(i: Int): T { + return .() + } + + operator fun set(i: Int, v: T) { + } + + + + +} + +val aFloat: A + field = TODO("IrConstructorCall") + get + +val aInt: Float + field = { //BLOCK + val tmp0_array: A = () + val tmp1_index0: Int = 1 + val tmp2: Float = tmp0_array.get(i = tmp1_index0) + tmp0_array.set(i = tmp1_index0, v = tmp2.dec()) + tmp2 + } + get + diff --git a/compiler/testData/ir/irText/expressions/kt36963.kt.txt b/compiler/testData/ir/irText/expressions/kt36963.kt.txt new file mode 100644 index 00000000000..3e01d5be37d --- /dev/null +++ b/compiler/testData/ir/irText/expressions/kt36963.kt.txt @@ -0,0 +1,7 @@ +fun foo() { +} + +fun test(): ErrorType /* ERROR */ { + return CHECK_NOT_NULL>(arg0 = ::foo) +} + diff --git a/compiler/testData/ir/irText/expressions/kt37570.kt.txt b/compiler/testData/ir/irText/expressions/kt37570.kt.txt new file mode 100644 index 00000000000..1fa6d962f43 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/kt37570.kt.txt @@ -0,0 +1,26 @@ +fun a(): String { + return "string" +} + +class A { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val b: String + get + + init { + apply($receiver = a(), block = local fun String.() { + #b = + } +) /*~> Unit */ + } + + + + +} + diff --git a/compiler/testData/ir/irText/expressions/kt37779.kt.txt b/compiler/testData/ir/irText/expressions/kt37779.kt.txt new file mode 100644 index 00000000000..d19ebdb93db --- /dev/null +++ b/compiler/testData/ir/irText/expressions/kt37779.kt.txt @@ -0,0 +1,11 @@ +fun foo(vararg s: String) { +} + +fun test1() { + foo(s = [*arrayOf(elements = ["", "OK"])]) +} + +fun test2(ss: Array) { + foo(s = [*ss]) +} + diff --git a/compiler/testData/ir/irText/expressions/lambdaInCAO.kt.txt b/compiler/testData/ir/irText/expressions/lambdaInCAO.kt.txt new file mode 100644 index 00000000000..b86ae164b7f --- /dev/null +++ b/compiler/testData/ir/irText/expressions/lambdaInCAO.kt.txt @@ -0,0 +1,41 @@ +operator fun Any.plusAssign(lambda: Function0) { +} + +operator fun Any.get(index: Function0): Int { + return 42 +} + +operator fun Any.set(index: Function0, value: Int) { +} + +fun test1(a: Any) { + plusAssign($receiver = a, lambda = local fun () { + return Unit + } +) +} + +fun test2(a: Any) { + { //BLOCK + val tmp0_array: Any = a + val tmp1_index0: Function0 = local fun () { + return Unit + } + + set($receiver = tmp0_array, index = tmp1_index0, value = get($receiver = tmp0_array, index = tmp1_index0).plus(other = 42)) + } +} + +fun test3(a: Any) { + { //BLOCK + val tmp0_array: Any = a + val tmp1_index0: Function0 = local fun () { + return Unit + } + + val tmp2: Int = get($receiver = tmp0_array, index = tmp1_index0) + set($receiver = tmp0_array, index = tmp1_index0, value = tmp2.inc()) + tmp2 + } /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/expressions/literals.kt.txt b/compiler/testData/ir/irText/expressions/literals.kt.txt new file mode 100644 index 00000000000..45e61a98908 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/literals.kt.txt @@ -0,0 +1,68 @@ +val test1: Int + field = 1 + get + +val test2: Int + field = -1 + get + +val test3: Boolean + field = true + get + +val test4: Boolean + field = false + get + +val test5: String + field = "abc" + get + +val test6: Nothing? + field = null + get + +val test7: Long + field = 1L + get + +val test8: Long + field = -1L + get + +val test9: Double + field = 1.0D + get + +val test10: Double + field = -1.0D + get + +val test11: Float + field = 1.0F + get + +val test12: Float + field = -1.0F + get + +val test13: Char + field = 'a' + get + +val testB: Byte + field = 1B + get + +val testS: Short + field = 1S + get + +val testI: Int + field = 1 + get + +val testL: Long + field = 1L + get + diff --git a/compiler/testData/ir/irText/expressions/memberTypeArguments.kt.txt b/compiler/testData/ir/irText/expressions/memberTypeArguments.kt.txt new file mode 100644 index 00000000000..4102378e6ae --- /dev/null +++ b/compiler/testData/ir/irText/expressions/memberTypeArguments.kt.txt @@ -0,0 +1,20 @@ +class GenericClass { + constructor(value: T) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val value: T + field = value + get + + fun withNewValue(newValue: T): GenericClass { + return TODO("IrConstructorCall") + } + + + + +} + diff --git a/compiler/testData/ir/irText/expressions/membersImportedFromObject.kt.txt b/compiler/testData/ir/irText/expressions/membersImportedFromObject.kt.txt new file mode 100644 index 00000000000..f9d9c9de7d7 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/membersImportedFromObject.kt.txt @@ -0,0 +1,45 @@ +object A { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun foo(): Int { + return 1 + } + + fun Int.fooExt(): Int { + return 2 + } + + val bar: Int + field = 42 + get + + val Int.barExt: Int + get(): Int { + return 43 + } + + + + +} + +val test1: Int + field = A.foo() + get + +val test2: Int + field = A.() + get + +val test3: Int + field = A.fooExt($receiver = 1) + get + +val test4: Int + field = A.($receiver = 1) + get + diff --git a/compiler/testData/ir/irText/expressions/multipleThisReferences.kt.txt b/compiler/testData/ir/irText/expressions/multipleThisReferences.kt.txt new file mode 100644 index 00000000000..a931c661a06 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/multipleThisReferences.kt.txt @@ -0,0 +1,67 @@ +class Outer { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + open inner class Inner { + constructor(x: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = x + get + + + + + } + + + + +} + +class Host { + constructor(y: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val y: Int + field = y + get + + fun Outer.test(): Inner { + return { //BLOCK + local class : Inner { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val xx: Int + field = .().plus(other = .()) + get + + + + + } + + + TODO("IrConstructorCall") + } + } + + + + +} + diff --git a/compiler/testData/ir/irText/expressions/nullCheckOnGenericLambdaReturn.kt.txt b/compiler/testData/ir/irText/expressions/nullCheckOnGenericLambdaReturn.kt.txt new file mode 100644 index 00000000000..5aaa42f70a7 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/nullCheckOnGenericLambdaReturn.kt.txt @@ -0,0 +1,48 @@ +fun checkAny(fn: Function0): Any { + return fn.invoke() +} + +fun checkAnyN(fn: Function0): Any? { + return fn.invoke() +} + +fun checkT(fn: Function0): T { + return fn.invoke() +} + +fun checkTAny(fn: Function0): T { + return fn.invoke() +} + +fun id(x: T): T { + return x +} + +fun test1(): @FlexibleNullability String? { + return checkT<@FlexibleNullability String?>(fn = local fun (): @FlexibleNullability String? { + return foo() + } +) +} + +fun test2(): String { + return checkT(fn = local fun (): String? { + return nnFoo() + } +) /*!! String */ +} + +fun test3(): @FlexibleNullability String? { + return checkTAny<@FlexibleNullability String?>(fn = local fun (): @FlexibleNullability String? { + return foo() + } +) +} + +fun test4(): String { + return checkTAny(fn = local fun (): String? { + return nnFoo() + } +) /*!! String */ +} + diff --git a/compiler/testData/ir/irText/expressions/nullCheckOnLambdaReturn.kt.txt b/compiler/testData/ir/irText/expressions/nullCheckOnLambdaReturn.kt.txt new file mode 100644 index 00000000000..d2fd6166b45 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/nullCheckOnLambdaReturn.kt.txt @@ -0,0 +1,54 @@ +fun checkAny(fn: Function0): Any { + return fn.invoke() +} + +fun checkAnyN(fn: Function0): Any? { + return fn.invoke() +} + +fun id(x: T): T { + return x +} + +fun test1(): Any { + return checkAny(fn = local fun (): Any { + return foo() /*!! String */ + } +) +} + +val test2: Function0 + field = local fun (): @FlexibleNullability String? { + return foo() /*!! String */ + } + + get + +val test3: Function0 + field = local fun (): @FlexibleNullability String? { + return foo() + } + as Function0 + get + +val test4: Function0 + field = id>(x = local fun (): @FlexibleNullability String? { + return foo() + } +) + get + +fun test5(): Any? { + return checkAnyN(fn = local fun (): Any? { + return foo() + } +) +} + +fun test6(): Any? { + return checkAnyN(fn = local fun (): Any? { + return nnFoo() + } +) +} + diff --git a/compiler/testData/ir/irText/expressions/objectAsCallable.kt.txt b/compiler/testData/ir/irText/expressions/objectAsCallable.kt.txt new file mode 100644 index 00000000000..2b1164076df --- /dev/null +++ b/compiler/testData/ir/irText/expressions/objectAsCallable.kt.txt @@ -0,0 +1,48 @@ +object A { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +enum class En : Enum { + private constructor() /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + X init = TODO("IrEnumConstructorCall") + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): En /* Synthetic body for ENUM_VALUEOF */ + +} + +operator fun A.invoke(i: Int): Int { + return i +} + +operator fun En.invoke(i: Int): Int { + return i +} + +val test1: Int + field = invoke($receiver = A, i = 42) + get + +val test2: Int + field = invoke($receiver = En, i = 42) + get + diff --git a/compiler/testData/ir/irText/expressions/objectClassReference.kt.txt b/compiler/testData/ir/irText/expressions/objectClassReference.kt.txt new file mode 100644 index 00000000000..9430fd8dc6d --- /dev/null +++ b/compiler/testData/ir/irText/expressions/objectClassReference.kt.txt @@ -0,0 +1,17 @@ +object A { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +fun test() { + A::class /*~> Unit */ + ($receiver = A::class) /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/expressions/objectReference.kt.txt b/compiler/testData/ir/irText/expressions/objectReference.kt.txt new file mode 100644 index 00000000000..ea15cb71400 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/objectReference.kt.txt @@ -0,0 +1,103 @@ +object Z { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + var counter: Int + field = 0 + get + set + + fun foo() { + } + + fun bar() { + .( = 1) + .foo() + Z.( = 1) + Z.foo() + } + + class Nested { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + init { + Z.( = 1) + Z.foo() + Z.( = 1) + Z.foo() + } + + fun test() { + Z.( = 1) + Z.foo() + Z.( = 1) + Z.foo() + } + + + + + } + + val aLambda: Function0 + field = local fun () { + Z.( = 1) + Z.foo() + Z.( = 1) + Z.foo() + } + + get + + val anObject: Any + field = { //BLOCK + local class { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + init { + Z.( = 1) + Z.foo() + Z.( = 1) + Z.foo() + } + + fun test() { + Z.( = 1) + Z.foo() + Z.( = 1) + Z.foo() + } + + + + + } + + + TODO("IrConstructorCall") + } + get + + + + +} + +fun Z.test() { + .( = 1) + .foo() + Z.( = 1) + Z.foo() +} + diff --git a/compiler/testData/ir/irText/expressions/objectReferenceInClosureInSuperConstructorCall.kt.txt b/compiler/testData/ir/irText/expressions/objectReferenceInClosureInSuperConstructorCall.kt.txt new file mode 100644 index 00000000000..652cd8c32c9 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/objectReferenceInClosureInSuperConstructorCall.kt.txt @@ -0,0 +1,28 @@ +abstract class Base { + constructor(lambda: Function0) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val lambda: Function0 + field = lambda + get + + + + +} + +object Test : Base { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + diff --git a/compiler/testData/ir/irText/expressions/objectReferenceInFieldInitializer.kt.txt b/compiler/testData/ir/irText/expressions/objectReferenceInFieldInitializer.kt.txt new file mode 100644 index 00000000000..2bc62bb9d23 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/objectReferenceInFieldInitializer.kt.txt @@ -0,0 +1,25 @@ +object A { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + private val a: String + field = "$" + private get + + private val b: String + field = "1234" + +.() + private get + + private val c: Int + field = 10000 + private get + + + + +} + diff --git a/compiler/testData/ir/irText/expressions/outerClassInstanceReference.kt.txt b/compiler/testData/ir/irText/expressions/outerClassInstanceReference.kt.txt new file mode 100644 index 00000000000..c27264b8e7c --- /dev/null +++ b/compiler/testData/ir/irText/expressions/outerClassInstanceReference.kt.txt @@ -0,0 +1,31 @@ +class Outer { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun outer() { + } + + inner class Inner { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun inner() { + return .outer() + } + + + + + } + + + + +} + diff --git a/compiler/testData/ir/irText/expressions/primitiveComparisons.kt.txt b/compiler/testData/ir/irText/expressions/primitiveComparisons.kt.txt new file mode 100644 index 00000000000..86a72670df2 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/primitiveComparisons.kt.txt @@ -0,0 +1,96 @@ +fun btest1(a: Byte, b: Byte): Boolean { + return greater(arg0 = a.toInt(), arg1 = b.toInt()) +} + +fun btest2(a: Byte, b: Byte): Boolean { + return less(arg0 = a.toInt(), arg1 = b.toInt()) +} + +fun btest3(a: Byte, b: Byte): Boolean { + return greaterOrEqual(arg0 = a.toInt(), arg1 = b.toInt()) +} + +fun btest4(a: Byte, b: Byte): Boolean { + return lessOrEqual(arg0 = a.toInt(), arg1 = b.toInt()) +} + +fun stest1(a: Short, b: Short): Boolean { + return greater(arg0 = a.toInt(), arg1 = b.toInt()) +} + +fun stest2(a: Short, b: Short): Boolean { + return less(arg0 = a.toInt(), arg1 = b.toInt()) +} + +fun stest3(a: Short, b: Short): Boolean { + return greaterOrEqual(arg0 = a.toInt(), arg1 = b.toInt()) +} + +fun stest4(a: Short, b: Short): Boolean { + return lessOrEqual(arg0 = a.toInt(), arg1 = b.toInt()) +} + +fun itest1(a: Int, b: Int): Boolean { + return greater(arg0 = a, arg1 = b) +} + +fun itest2(a: Int, b: Int): Boolean { + return less(arg0 = a, arg1 = b) +} + +fun itest3(a: Int, b: Int): Boolean { + return greaterOrEqual(arg0 = a, arg1 = b) +} + +fun itest4(a: Int, b: Int): Boolean { + return lessOrEqual(arg0 = a, arg1 = b) +} + +fun ltest1(a: Long, b: Long): Boolean { + return greater(arg0 = a, arg1 = b) +} + +fun ltest2(a: Long, b: Long): Boolean { + return less(arg0 = a, arg1 = b) +} + +fun ltest3(a: Long, b: Long): Boolean { + return greaterOrEqual(arg0 = a, arg1 = b) +} + +fun ltest4(a: Long, b: Long): Boolean { + return lessOrEqual(arg0 = a, arg1 = b) +} + +fun ftest1(a: Float, b: Float): Boolean { + return greater(arg0 = a, arg1 = b) +} + +fun ftest2(a: Float, b: Float): Boolean { + return less(arg0 = a, arg1 = b) +} + +fun ftest3(a: Float, b: Float): Boolean { + return greaterOrEqual(arg0 = a, arg1 = b) +} + +fun ftest4(a: Float, b: Float): Boolean { + return lessOrEqual(arg0 = a, arg1 = b) +} + +fun dtest1(a: Double, b: Double): Boolean { + return greater(arg0 = a, arg1 = b) +} + +fun dtest2(a: Double, b: Double): Boolean { + return less(arg0 = a, arg1 = b) +} + +fun dtest3(a: Double, b: Double): Boolean { + return greaterOrEqual(arg0 = a, arg1 = b) +} + +fun dtest4(a: Double, b: Double): Boolean { + return lessOrEqual(arg0 = a, arg1 = b) +} + diff --git a/compiler/testData/ir/irText/expressions/primitivesImplicitConversions.kt.txt b/compiler/testData/ir/irText/expressions/primitivesImplicitConversions.kt.txt new file mode 100644 index 00000000000..997fb638841 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/primitivesImplicitConversions.kt.txt @@ -0,0 +1,53 @@ +val test1: Long + field = 42L + get + +val test2: Short + field = 42S + get + +val test3: Byte + field = 42B + get + +val test4: Long + field = 42.unaryMinus().toLong() + get + +val test5: Short + field = 42.unaryMinus().toShort() + get + +val test6: Byte + field = 42.unaryMinus().toByte() + get + +fun test() { + val test1: Int? = 42 + val test2: Long = 42L + val test3: Long? = 42L + val test4: Long? = -1L + val test5: Long? = 1.unaryMinus().toLong() + val test6: Short? = 1.unaryMinus().toShort() + val test7: Byte? = 1.unaryMinus().toByte() +} + +fun testImplicitArguments(x: Long = 1.unaryMinus().toLong()) { +} + +class TestImplicitArguments { + constructor(x: Long = 1.unaryMinus().toLong()) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Long + field = x + get + + + + +} + diff --git a/compiler/testData/ir/irText/expressions/propertyReferences.kt.txt b/compiler/testData/ir/irText/expressions/propertyReferences.kt.txt new file mode 100644 index 00000000000..5ceb572b2cf --- /dev/null +++ b/compiler/testData/ir/irText/expressions/propertyReferences.kt.txt @@ -0,0 +1,138 @@ +object Delegate { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + operator fun getValue(thisRef: Any?, kProp: Any): Int { + return 1 + } + + operator fun setValue(thisRef: Any?, kProp: Any, value: Int) { + } + + + + +} + +open class C { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + var varWithPrivateSet: Int + field = 1 + get + private set + + var varWithProtectedSet: Int + field = 1 + get + protected set + + + + +} + +val valWithBackingField: Int + field = 1 + get + +val test_valWithBackingField: KProperty0 + field = ::valWithBackingField + get + +var varWithBackingField: Int + field = 1 + get + set + +val test_varWithBackingField: KMutableProperty0 + field = ::varWithBackingField + get + +var varWithBackingFieldAndAccessors: Int + field = 1 + get(): Int { + return #varWithBackingFieldAndAccessors + } + set(value: Int) { + #varWithBackingFieldAndAccessors = value + } + +val test_varWithBackingFieldAndAccessors: KMutableProperty0 + field = ::varWithBackingFieldAndAccessors + get + +val valWithAccessors: Int + get(): Int { + return 1 + } + +val test_valWithAccessors: KProperty0 + field = ::valWithAccessors + get + +var varWithAccessors: Int + get(): Int { + return 1 + } + set(value: Int) { + } + +val test_varWithAccessors: KMutableProperty0 + field = ::varWithAccessors + get + +val delegatedVal: Int /* by */ + field = Delegate + get(): Int { + return #delegatedVal$delegate.getValue(thisRef = null, kProp = ::delegatedVal) + } + +val test_delegatedVal: KProperty0 + field = ::delegatedVal + get + +var delegatedVar: Int /* by */ + field = Delegate + get(): Int { + return #delegatedVar$delegate.getValue(thisRef = null, kProp = ::delegatedVar) + } + set(: Int) { + return #delegatedVar$delegate.setValue(thisRef = null, kProp = ::delegatedVar, value = ) + } + +val test_delegatedVar: KMutableProperty0 + field = ::delegatedVar + get + +val constVal: Int + field = 1 + get + +val test_constVal: KProperty0 + field = ::constVal + get + +val test_J_CONST: KProperty0 + field = ::CONST + get + +val test_J_nonConst: KMutableProperty0 + field = ::nonConst + get + +val test_varWithPrivateSet: KProperty1 + field = ::varWithPrivateSet + get + +val test_varWithProtectedSet: KProperty1 + field = ::varWithProtectedSet + get + diff --git a/compiler/testData/ir/irText/expressions/references.kt.txt b/compiler/testData/ir/irText/expressions/references.kt.txt new file mode 100644 index 00000000000..b7271694093 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/references.kt.txt @@ -0,0 +1,39 @@ +val ok: String + field = "OK" + get + +val ok2: String + field = () + get + +val ok3: String + get(): String { + return "OK" + } + +fun test1(): String { + return () +} + +fun test2(x: String): String { + return x +} + +fun test3(): String { + val x: String = "OK" + return x +} + +fun test4(): String { + return () +} + +val String.okext: String + get(): String { + return "OK" + } + +fun String.test5(): String { + return ($receiver = ) +} + diff --git a/compiler/testData/ir/irText/expressions/reflectionLiterals.kt.txt b/compiler/testData/ir/irText/expressions/reflectionLiterals.kt.txt new file mode 100644 index 00000000000..0d7c07ce188 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/reflectionLiterals.kt.txt @@ -0,0 +1,46 @@ +class A { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun foo() { + } + + + + +} + +fun bar() { +} + +val qux: Int + field = 1 + get + +val test1: KClass + field = A::class + get + +val test2: KClass + field = ()::class + get + +val test3: KFunction1 + field = ::foo + get + +val test4: KFunction0 + field = :: + get + +val test5: KFunction0 + field = ::foo + get + +val test6: KFunction0 + field = ::bar + get + diff --git a/compiler/testData/ir/irText/expressions/safeAssignment.kt.txt b/compiler/testData/ir/irText/expressions/safeAssignment.kt.txt new file mode 100644 index 00000000000..d6b7db03636 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/safeAssignment.kt.txt @@ -0,0 +1,27 @@ +class C { + constructor(x: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + var x: Int + field = x + get + set + + + + +} + +fun test(nc: C?) { + { //BLOCK + val tmp0_safe_receiver: C? = nc + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null /*~> Unit */ + true -> tmp0_safe_receiver.( = 42) + } + } +} + diff --git a/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.kt.txt b/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.kt.txt new file mode 100644 index 00000000000..325d9e64596 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.kt.txt @@ -0,0 +1,71 @@ +package test + +class C { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +var C?.p: Int + get(): Int { + return 42 + } + set(value: Int) { + } + +operator fun Int?.inc(): Int? { + return { //BLOCK + val tmp0_safe_receiver: Int? = + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + true -> tmp0_safe_receiver.inc() + } + } +} + +operator fun Int?.get(index: Int): Int { + return 42 +} + +operator fun Int?.set(index: Int, value: Int) { +} + +fun testProperty(nc: C?) { + { //BLOCK + val tmp0_safe_receiver: C? = nc + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + true -> { //BLOCK + val tmp1_receiver: C? = tmp0_safe_receiver + { //BLOCK + val tmp2: Int = ($receiver = tmp1_receiver) + ($receiver = tmp1_receiver, value = inc($receiver = tmp2)) + tmp2 + } + } + } + } /*~> Unit */ +} + +fun testArrayAccess(nc: C?) { + { //BLOCK + val tmp1_array: Int? = { //BLOCK + val tmp0_safe_receiver: C? = nc + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + true -> ($receiver = tmp0_safe_receiver) + } + } + val tmp2_index0: Int = 0 + val tmp3: Int = get($receiver = tmp1_array, index = tmp2_index0) + set($receiver = tmp1_array, index = tmp2_index0, value = tmp3.inc()) + tmp3 + } /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/expressions/safeCalls.kt.txt b/compiler/testData/ir/irText/expressions/safeCalls.kt.txt new file mode 100644 index 00000000000..01a40661271 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/safeCalls.kt.txt @@ -0,0 +1,91 @@ +class Ref { + constructor(value: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + var value: Int + field = value + get + set + + + + +} + +interface IHost { + fun String.extLength(): Int { + return .() + } + + + + +} + +fun test1(x: String?): Int? { + return { //BLOCK + val tmp0_safe_receiver: String? = x + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + true -> tmp0_safe_receiver.() + } + } +} + +fun test2(x: String?): Int? { + return { //BLOCK + val tmp0_safe_receiver: String? = x + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + true -> tmp0_safe_receiver.hashCode() + } + } +} + +fun test3(x: String?, y: Any?): Boolean? { + return { //BLOCK + val tmp0_safe_receiver: String? = x + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + true -> tmp0_safe_receiver.equals(other = y) + } + } +} + +fun test4(x: Ref?) { + { //BLOCK + val tmp0_safe_receiver: Ref? = x + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null /*~> Unit */ + true -> tmp0_safe_receiver.( = 0) + } + } +} + +fun IHost.test5(s: String?): Int? { + return { //BLOCK + val tmp0_safe_receiver: String? = s + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + true -> .extLength($receiver = tmp0_safe_receiver) + } + } +} + +fun Int.foo(): Int { + return 239 +} + +fun box() { + { //BLOCK + val tmp0_safe_receiver: Int = 42 + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + true -> foo($receiver = tmp0_safe_receiver) + } + } /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/expressions/sam/arrayAsVarargAfterSamArgument.kt.txt b/compiler/testData/ir/irText/expressions/sam/arrayAsVarargAfterSamArgument.kt.txt new file mode 100644 index 00000000000..226510ea91a --- /dev/null +++ b/compiler/testData/ir/irText/expressions/sam/arrayAsVarargAfterSamArgument.kt.txt @@ -0,0 +1,45 @@ +fun test(fn: Function0, r: Runnable, arr: Array) { + foo1(r = local fun () { + return Unit + } + /*-> @FlexibleNullability Runnable? */, strs = arr) /*~> Unit */ + foo1(r = local fun () { + return Unit + } + /*-> @FlexibleNullability Runnable? */, strs = [*arr]) /*~> Unit */ + foo1(r = fn /*-> @FlexibleNullability Runnable? */, strs = arr) /*~> Unit */ + foo1(r = fn /*-> @FlexibleNullability Runnable? */, strs = [*arr]) /*~> Unit */ + foo1(r = r, strs = [""]) /*~> Unit */ + foo1(r = fn /*-> @FlexibleNullability Runnable? */, strs = arr) /*~> Unit */ + foo1(r = fn /*-> @FlexibleNullability Runnable? */, strs = [*arr]) /*~> Unit */ + foo1(r = r, strs = [*arr]) /*~> Unit */ + val i1: Test = TODO("IrConstructorCall") + val i2: Test = TODO("IrConstructorCall") + val i3: Test = TODO("IrConstructorCall") + val i4: Test = TODO("IrConstructorCall") + val i5: Test = TODO("IrConstructorCall") + val i6: Test = TODO("IrConstructorCall") + i1.foo2(r1 = local fun () { + return Unit + } + /*-> @FlexibleNullability Runnable? */, r2 = local fun () { + return Unit + } + /*-> @FlexibleNullability Runnable? */, strs = arr) /*~> Unit */ + i1.foo2(r1 = r, r2 = local fun () { + return Unit + } + /*-> @FlexibleNullability Runnable? */, strs = [""]) /*~> Unit */ + i1.foo2(r1 = local fun () { + return Unit + } + /*-> @FlexibleNullability Runnable? */, r2 = local fun () { + return Unit + } + /*-> @FlexibleNullability Runnable? */, strs = [*arr]) /*~> Unit */ + i1.foo2(r1 = r, r2 = local fun () { + return Unit + } + /*-> @FlexibleNullability Runnable? */, strs = [*arr]) /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/expressions/sam/genericSamProjectedOut.kt.txt b/compiler/testData/ir/irText/expressions/sam/genericSamProjectedOut.kt.txt new file mode 100644 index 00000000000..86d7ed9b968 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/sam/genericSamProjectedOut.kt.txt @@ -0,0 +1,15 @@ +fun test(a: SomeJavaClass) { + a.someFunction(hello = local fun (it: @FlexibleNullability String?) { + return Unit + } + /*-> @FlexibleNullability Hello? */) + a.plus(hello = local fun (it: @FlexibleNullability String?) { + return Unit + } + /*-> @FlexibleNullability Hello? */) + a.get(hello = local fun (it: @FlexibleNullability String?) { + return Unit + } + /*-> @FlexibleNullability Hello? */) +} + diff --git a/compiler/testData/ir/irText/expressions/sam/samByProjectedType.kt.txt b/compiler/testData/ir/irText/expressions/sam/samByProjectedType.kt.txt new file mode 100644 index 00000000000..ae78644935d --- /dev/null +++ b/compiler/testData/ir/irText/expressions/sam/samByProjectedType.kt.txt @@ -0,0 +1,7 @@ +fun test1() { + bar(j = local fun (x: Any): @FlexibleNullability Any? { + return x + } + /*-> @FlexibleNullability J<@FlexibleNullability Any?>? */) +} + diff --git a/compiler/testData/ir/irText/expressions/sam/samConstructors.kt.txt b/compiler/testData/ir/irText/expressions/sam/samConstructors.kt.txt new file mode 100644 index 00000000000..100df56b438 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/sam/samConstructors.kt.txt @@ -0,0 +1,25 @@ +fun test1(): Runnable { + return local fun () { + return Unit + } + /*-> Runnable */ +} + +fun test2(a: Function0): Runnable { + return a /*-> Runnable */ +} + +fun foo() { +} + +fun test3(): Runnable { + return ::foo /*-> Runnable */ +} + +fun test4(): Comparator { + return local fun (a: @FlexibleNullability Int?, b: @FlexibleNullability Int?): Int { + return a /*!! Int */.minus(other = b /*!! Int */) + } + /*-> Comparator */ +} + diff --git a/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall.kt.txt b/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall.kt.txt new file mode 100644 index 00000000000..a9f824ba338 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall.kt.txt @@ -0,0 +1,9 @@ +fun test1(f: Function1): C<@FlexibleNullability String?> { + return TODO("IrConstructorCall") +} + +fun test2(x: Any) { + x as Function1 /*~> Unit */ + TODO("IrConstructorCall") /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall_NI.kt.txt b/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall_NI.kt.txt new file mode 100644 index 00000000000..4043b3ac501 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall_NI.kt.txt @@ -0,0 +1,49 @@ +fun test3(f1: Function1, f2: Function1): D<@FlexibleNullability Int?, @FlexibleNullability String?> { + return TODO("IrConstructorCall") +} + +class Outer { + constructor(j11: J) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val j11: J + field = j11 + get + + inner class Inner { + constructor(j12: J) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val j12: J + field = j12 + get + + + + + } + + + + +} + +fun test4(f: Function1, g: Function1): Inner<@FlexibleNullability Any?, @FlexibleNullability String?> { + return TODO("IrConstructorCall") +} + +fun testGenericJavaCtor1(f: Function1): G<@FlexibleNullability String?> { + return TODO("IrConstructorCall") +} + +fun testGenericJavaCtor2(x: Any) { + x as Function1 /*~> Unit */ + TODO("IrConstructorCall") /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/expressions/sam/samConversionToGeneric.kt.txt b/compiler/testData/ir/irText/expressions/sam/samConversionToGeneric.kt.txt new file mode 100644 index 00000000000..6da8d3ea5da --- /dev/null +++ b/compiler/testData/ir/irText/expressions/sam/samConversionToGeneric.kt.txt @@ -0,0 +1,52 @@ +fun test1(): J { + return local fun (x: @FlexibleNullability String?): @FlexibleNullability String? { + return x + } + /*-> J */ +} + +fun test2(): J<@FlexibleNullability String?> { + return local fun (x: String): @FlexibleNullability String? { + return x + } + /*-> J<@FlexibleNullability String?> */ +} + +fun test3() { + return bar<@FlexibleNullability String?>(j = local fun (x: String): @FlexibleNullability String? { + return x + } + /*-> @FlexibleNullability J<@FlexibleNullability String?>? */) +} + +fun test4(a: Any) { + a as J /*~> Unit */ + bar<@FlexibleNullability String?>(j = a /*as J<@FlexibleNullability String?> */) +} + +fun test5(a: Any) { + a as Function1 /*~> Unit */ + bar<@FlexibleNullability String?>(j = a /*as Function1<@ParameterName(...) @FlexibleNullability String?, @FlexibleNullability String?> */ /*-> @FlexibleNullability J<@FlexibleNullability String?>? */) +} + +fun test6(a: Function1) { + bar(j = a /*-> @FlexibleNullability J? */) +} + +fun test7(a: Any) { + a as Function1 /*~> Unit */ + bar(j = a /*as Function1<@ParameterName(...) T?, T?> */ /*-> @FlexibleNullability J? */) +} + +fun test8(efn: @ExtensionFunctionType Function1): J<@FlexibleNullability String?> { + return efn /*-> J<@FlexibleNullability String?> */ +} + +fun test9(efn: @ExtensionFunctionType Function1) { + bar<@FlexibleNullability String?>(j = efn /*-> @FlexibleNullability J<@FlexibleNullability String?>? */) +} + +fun test10(fn: Function1) { + bar2x<@FlexibleNullability Int?>(j2x = fn /*-> @FlexibleNullability J2X<@FlexibleNullability Int?>? */) +} + diff --git a/compiler/testData/ir/irText/expressions/sam/samConversions.kt.txt b/compiler/testData/ir/irText/expressions/sam/samConversions.kt.txt new file mode 100644 index 00000000000..c73f33c98a1 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/sam/samConversions.kt.txt @@ -0,0 +1,30 @@ +fun J.test0(a: Runnable) { + runStatic(r = a) + .runIt(r = a) +} + +fun test1() { + runStatic(r = local fun () { + test1() + } + /*-> @FlexibleNullability Runnable? */) +} + +fun J.test2() { + .runIt(r = local fun () { + test1() + } + /*-> @FlexibleNullability Runnable? */) +} + +fun J.test3(a: Function0) { + .run2(r1 = a /*-> @FlexibleNullability Runnable? */, r2 = a /*-> @FlexibleNullability Runnable? */) +} + +fun J.test4(a: Function0, b: Function0, flag: Boolean) { + .runIt(r = when { + flag -> a + true -> b + } /*-> @FlexibleNullability Runnable? */) +} + diff --git a/compiler/testData/ir/irText/expressions/sam/samConversionsWithSmartCasts.kt.txt b/compiler/testData/ir/irText/expressions/sam/samConversionsWithSmartCasts.kt.txt new file mode 100644 index 00000000000..cc591c082b1 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/sam/samConversionsWithSmartCasts.kt.txt @@ -0,0 +1,67 @@ +fun test1(a: Function0) { + when { + a is Runnable -> { //BLOCK + runStatic(r = a /*as Runnable */) + } + } +} + +fun test2(a: Function0) { + when { + a is Runnable -> { //BLOCK + TODO("IrConstructorCall").run1(r = a /*as Runnable */) + } + } +} + +fun test3(a: Function0) { + when { + a is Runnable -> { //BLOCK + TODO("IrConstructorCall").run2(r1 = a /*as Runnable */, r2 = a /*as Runnable */) + } + } +} + +fun test4(a: Function0, b: Function0) { + when { + a is Runnable -> { //BLOCK + TODO("IrConstructorCall").run2(r1 = a /*-> @FlexibleNullability Runnable? */, r2 = b /*-> @FlexibleNullability Runnable? */) + } + } +} + +fun test5(a: Any) { + when { + a is Runnable -> { //BLOCK + TODO("IrConstructorCall").run1(r = a /*as Runnable */) + } + } +} + +fun test5x(a: Any) { + when { + a is Runnable -> { //BLOCK + a as Function0 /*~> Unit */ + TODO("IrConstructorCall").run1(r = a /*as Runnable */) + } + } +} + +fun test6(a: Any) { + a as Function0 /*~> Unit */ + TODO("IrConstructorCall").run1(r = a /*as Function0 */ /*-> @FlexibleNullability Runnable? */) +} + +fun test7(a: Function1) { + a as Function0 /*~> Unit */ + TODO("IrConstructorCall").run1(r = a /*as Function0 */ /*-> @FlexibleNullability Runnable? */) +} + +fun test8(a: Function0) { + TODO("IrConstructorCall").run1(r = id<@FlexibleNullability Function0?>(x = a) /*!! Function0 */ /*-> @FlexibleNullability Runnable? */) +} + +fun test9() { + TODO("IrConstructorCall").run1(r = ::test9 /*-> @FlexibleNullability Runnable? */) +} + diff --git a/compiler/testData/ir/irText/expressions/sam/samOperators.kt.txt b/compiler/testData/ir/irText/expressions/sam/samOperators.kt.txt new file mode 100644 index 00000000000..311a011a2d0 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/sam/samOperators.kt.txt @@ -0,0 +1,18 @@ +fun f() { +} + +fun J.test1() { + .get(k = ::f /*-> @FlexibleNullability Runnable? */) + .get(k = ::f /*-> @FlexibleNullability Runnable? */, m = ::f /*-> @FlexibleNullability Runnable? */) +} + +fun J.test2() { + .set(k = ::f /*-> @FlexibleNullability Runnable? */, v = ::f /*-> @FlexibleNullability Runnable? */) + .set(k = ::f /*-> @FlexibleNullability Runnable? */, m = ::f /*-> @FlexibleNullability Runnable? */, v = ::f /*-> @FlexibleNullability Runnable? */) +} + +fun J.test3() { + .plusAssign(i = ::f /*-> @FlexibleNullability Runnable? */) + .minusAssign(i = ::f /*-> @FlexibleNullability Runnable? */) +} + diff --git a/compiler/testData/ir/irText/expressions/setFieldWithImplicitCast.kt.txt b/compiler/testData/ir/irText/expressions/setFieldWithImplicitCast.kt.txt new file mode 100644 index 00000000000..8cd1a219d9f --- /dev/null +++ b/compiler/testData/ir/irText/expressions/setFieldWithImplicitCast.kt.txt @@ -0,0 +1,20 @@ +class Derived : Base { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun setValue(v: Any) { + when { + v is String -> { //BLOCK + #value = v /*as String */ + } + } + } + + + + +} + diff --git a/compiler/testData/ir/irText/expressions/signedToUnsignedConversions_annotation.kt.txt b/compiler/testData/ir/irText/expressions/signedToUnsignedConversions_annotation.kt.txt new file mode 100644 index 00000000000..7593e9e50a4 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/signedToUnsignedConversions_annotation.kt.txt @@ -0,0 +1,9 @@ +package kotlin.internal + +annotation class ImplicitIntegerCoercion : Annotation { + constructor() /* primary */ + + + +} + diff --git a/compiler/testData/ir/irText/expressions/signedToUnsignedConversions_test.kt.txt b/compiler/testData/ir/irText/expressions/signedToUnsignedConversions_test.kt.txt new file mode 100644 index 00000000000..23f17f68081 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/signedToUnsignedConversions_test.kt.txt @@ -0,0 +1,58 @@ +@ImplicitIntegerCoercion +const val IMPLICIT_INT: Int + field = 255 + get + +@ImplicitIntegerCoercion +const val EXPLICIT_INT: Int + field = 255 + get + +@ImplicitIntegerCoercion +const val LONG_CONST: Long + field = 255L + get + +@ImplicitIntegerCoercion +val NON_CONST: Int + field = 255 + get + +@ImplicitIntegerCoercion +const val BIGGER_THAN_UBYTE: Int + field = 256 + get + +@ImplicitIntegerCoercion +const val UINT_CONST: UInt + field = 42 + get + +fun takeUByte(u: UByte) { +} + +fun takeUShort(u: UShort) { +} + +fun takeUInt(u: UInt) { +} + +fun takeULong(u: ULong) { +} + +fun takeUBytes(vararg u: UByte) { +} + +fun takeLong(l: Long) { +} + +fun test() { + takeUByte(u = toUByte($receiver = ())) + takeUByte(u = toUByte($receiver = ())) + takeUShort(u = toUShort($receiver = ())) + takeUShort(u = toUShort($receiver = ())) + takeUInt(u = toUInt($receiver = ())) + takeULong(u = toULong($receiver = ())) + takeUBytes(u = [toUByte($receiver = ()), toUByte($receiver = ()), 42B]) +} + diff --git a/compiler/testData/ir/irText/expressions/simpleOperators.kt.txt b/compiler/testData/ir/irText/expressions/simpleOperators.kt.txt new file mode 100644 index 00000000000..9e80cfff977 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/simpleOperators.kt.txt @@ -0,0 +1,44 @@ +fun test1(a: Int, b: Int): Int { + return a.plus(other = b) +} + +fun test2(a: Int, b: Int): Int { + return a.minus(other = b) +} + +fun test3(a: Int, b: Int): Int { + return a.times(other = b) +} + +fun test4(a: Int, b: Int): Int { + return a.div(other = b) +} + +fun test5(a: Int, b: Int): Int { + return a.rem(other = b) +} + +fun test6(a: Int, b: Int): IntRange { + return a.rangeTo(other = b) +} + +fun test1x(a: Int, b: Int): Int { + return a.plus(other = b) +} + +fun test2x(a: Int, b: Int): Int { + return a.minus(other = b) +} + +fun test3x(a: Int, b: Int): Int { + return a.times(other = b) +} + +fun test4x(a: Int, b: Int): Int { + return a.div(other = b) +} + +fun test5x(a: Int, b: Int): Int { + return a.rem(other = b) +} + diff --git a/compiler/testData/ir/irText/expressions/simpleUnaryOperators.kt.txt b/compiler/testData/ir/irText/expressions/simpleUnaryOperators.kt.txt new file mode 100644 index 00000000000..c2b7bca047d --- /dev/null +++ b/compiler/testData/ir/irText/expressions/simpleUnaryOperators.kt.txt @@ -0,0 +1,24 @@ +fun test1(x: Int): Int { + return x.unaryMinus() +} + +fun test2(): Int { + return -42 +} + +fun test3(x: Int): Int { + return x.unaryPlus() +} + +fun test4(): Int { + return 42 +} + +fun test5(x: Boolean): Boolean { + return x.not() +} + +fun test6(): Boolean { + return false +} + diff --git a/compiler/testData/ir/irText/expressions/smartCasts.kt.txt b/compiler/testData/ir/irText/expressions/smartCasts.kt.txt new file mode 100644 index 00000000000..9de2088812f --- /dev/null +++ b/compiler/testData/ir/irText/expressions/smartCasts.kt.txt @@ -0,0 +1,38 @@ +fun expectsString(s: String) { +} + +fun expectsInt(i: Int) { +} + +fun overloaded(s: String): String { + return s +} + +fun overloaded(x: Any): Any { + return x +} + +fun test1(x: Any) { + when { + x !is String -> return Unit + } + println(message = x /*as String */.()) + expectsString(s = x /*as String */) + expectsInt(i = x /*as String */.()) + expectsString(s = overloaded(s = x /*as String */)) +} + +fun test2(x: Any): String { + when { + x !is String -> return "" + } + return overloaded(s = x /*as String */) +} + +fun test3(x: Any): String { + when { + x !is String -> return "" + } + return x /*as String */ +} + diff --git a/compiler/testData/ir/irText/expressions/smartCastsWithDestructuring.kt.txt b/compiler/testData/ir/irText/expressions/smartCastsWithDestructuring.kt.txt new file mode 100644 index 00000000000..87c413436c0 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/smartCastsWithDestructuring.kt.txt @@ -0,0 +1,31 @@ +interface I1 { + + + +} + +interface I2 { + + + +} + +operator fun I1.component1(): Int { + return 1 +} + +operator fun I2.component2(): String { + return "" +} + +fun test(x: I1) { + when { + x !is I2 -> return Unit + } + // COMPOSITE { + val tmp0_container: I1 = x + val c1: Int = component1($receiver = tmp0_container) + val c2: String = component2($receiver = tmp0_container /*as I2 */) + // } +} + diff --git a/compiler/testData/ir/irText/expressions/specializedTypeAliasConstructorCall.kt.txt b/compiler/testData/ir/irText/expressions/specializedTypeAliasConstructorCall.kt.txt new file mode 100644 index 00000000000..21bb6a5cf5e --- /dev/null +++ b/compiler/testData/ir/irText/expressions/specializedTypeAliasConstructorCall.kt.txt @@ -0,0 +1,21 @@ +class Cell { + constructor(value: T) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val value: T + field = value + get + + + + +} + +typealias IntAlias = Cell +fun test(): Cell { + return TODO("IrConstructorCall") +} + diff --git a/compiler/testData/ir/irText/expressions/stringComparisons.kt.txt b/compiler/testData/ir/irText/expressions/stringComparisons.kt.txt new file mode 100644 index 00000000000..6096c5b759b --- /dev/null +++ b/compiler/testData/ir/irText/expressions/stringComparisons.kt.txt @@ -0,0 +1,16 @@ +fun test1(a: String, b: String): Boolean { + return greater(arg0 = a.compareTo(other = b), arg1 = 0) +} + +fun test2(a: String, b: String): Boolean { + return less(arg0 = a.compareTo(other = b), arg1 = 0) +} + +fun test3(a: String, b: String): Boolean { + return greaterOrEqual(arg0 = a.compareTo(other = b), arg1 = 0) +} + +fun test4(a: String, b: String): Boolean { + return lessOrEqual(arg0 = a.compareTo(other = b), arg1 = 0) +} + diff --git a/compiler/testData/ir/irText/expressions/stringPlus.kt.txt b/compiler/testData/ir/irText/expressions/stringPlus.kt.txt new file mode 100644 index 00000000000..fbdd34bca55 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/stringPlus.kt.txt @@ -0,0 +1,12 @@ +fun test1(a: String, b: Any): String { + return a.plus(other = b) +} + +fun test2(a: String, b: Int): String { + return a.plus(other = "+").plus(other = b) +} + +fun test3(a: String, b: Int): String { + return a.plus(other = "+").plus(other = b.plus(other = 1)).plus(other = a) +} + diff --git a/compiler/testData/ir/irText/expressions/stringTemplates.kt.txt b/compiler/testData/ir/irText/expressions/stringTemplates.kt.txt new file mode 100644 index 00000000000..e8e47b4168a --- /dev/null +++ b/compiler/testData/ir/irText/expressions/stringTemplates.kt.txt @@ -0,0 +1,48 @@ +fun foo(): String { + return "" +} + +val x: Int + field = 42 + get + +val test1: String + field = "" + get + +val test2: String + field = "abc" + get + +val test3: String + field = "" + get + +val test4: String + field = "abc" + get + +val test5: String + field = " +abc +" + get + +val test6: String + field = () + +" " + +foo() + get + +val test7: String + field = () + get + +val test8: String + field = foo() + get + +val test9: String + field = () + get + diff --git a/compiler/testData/ir/irText/expressions/suspendConversionOnArbitraryExpression.kt.txt b/compiler/testData/ir/irText/expressions/suspendConversionOnArbitraryExpression.kt.txt new file mode 100644 index 00000000000..b70dd223235 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/suspendConversionOnArbitraryExpression.kt.txt @@ -0,0 +1,177 @@ +fun useSuspend(sfn: SuspendFunction0) { +} + +fun useSuspendExt(sfn: @ExtensionFunctionType SuspendFunction1) { +} + +fun useSuspendArg(sfn: SuspendFunction1) { +} + +fun useSuspendArgT(sfn: SuspendFunction1) { +} + +fun useSuspendExtT(sfn: @ExtensionFunctionType SuspendFunction1) { +} + +fun produceFun(): Function0 { + return local fun () { + return Unit + } + +} + +fun testSimple(fn: Function0) { + useSuspend(sfn = { //BLOCK + local suspend fun suspendConversion0() { + fn.invoke() + } + + }) +} + +fun testSimpleNonVal() { + useSuspend(sfn = { //BLOCK + val tmp0: Function0 = produceFun() + local suspend fun suspendConversion1() { + tmp0.invoke() + } + + }) +} + +fun testExtAsExt(fn: @ExtensionFunctionType Function1) { + useSuspendExt(sfn = { //BLOCK + local suspend fun suspendConversion0(p0: Int) { + fn.invoke(p1 = p0) + } + + }) +} + +fun testExtAsSimple(fn: @ExtensionFunctionType Function1) { + useSuspendArg(sfn = { //BLOCK + local suspend fun suspendConversion0(p0: Int) { + fn.invoke(p1 = p0) + } + + }) +} + +fun testSimpleAsExt(fn: Function1) { + useSuspendExt(sfn = { //BLOCK + local suspend fun suspendConversion0(p0: Int) { + fn.invoke(p1 = p0) + } + + }) +} + +fun testSimpleAsSimpleT(fn: Function1) { + useSuspendArgT(sfn = { //BLOCK + local suspend fun suspendConversion0(p0: Int) { + fn.invoke(p1 = p0) + } + + }) +} + +fun testSimpleAsExtT(fn: Function1) { + useSuspendExtT(sfn = { //BLOCK + local suspend fun suspendConversion0(p0: Int) { + fn.invoke(p1 = p0) + } + + }) +} + +fun testExtAsSimpleT(fn: @ExtensionFunctionType Function1) { + useSuspendArgT(sfn = { //BLOCK + local suspend fun suspendConversion0(p0: Int) { + fn.invoke(p1 = p0) + } + + }) +} + +fun testExtAsExtT(fn: @ExtensionFunctionType Function1) { + useSuspendExtT(sfn = { //BLOCK + local suspend fun suspendConversion0(p0: Int) { + fn.invoke(p1 = p0) + } + + }) +} + +fun testSimpleSAsSimpleT(fn: Function1) { + useSuspendArgT(sfn = { //BLOCK + local suspend fun suspendConversion0(p0: S) { + fn.invoke(p1 = p0) + } + + }) +} + +fun testSimpleSAsExtT(fn: Function1) { + useSuspendExtT(sfn = { //BLOCK + local suspend fun suspendConversion0(p0: S) { + fn.invoke(p1 = p0) + } + + }) +} + +fun testExtSAsSimpleT(fn: @ExtensionFunctionType Function1) { + useSuspendArgT(sfn = { //BLOCK + local suspend fun suspendConversion0(p0: S) { + fn.invoke(p1 = p0) + } + + }) +} + +fun testExtSAsExtT(fn: @ExtensionFunctionType Function1) { + useSuspendExtT(sfn = { //BLOCK + local suspend fun suspendConversion0(p0: S) { + fn.invoke(p1 = p0) + } + + }) +} + +fun testSmartCastWithSuspendConversion(a: Any) { + a as Function0 /*~> Unit */ + useSuspend(sfn = { //BLOCK + local suspend fun suspendConversion0() { + a /*as Function0 */.invoke() + } + + }) +} + +fun testSmartCastOnVarWithSuspendConversion(a: Any) { + var b: Any = a + b as Function0 /*~> Unit */ + useSuspend(sfn = { //BLOCK + val tmp0: Function0 = b /*as Function0 */ + local suspend fun suspendConversion1() { + tmp0.invoke() + } + + }) +} + +fun testSmartCastVsSuspendConversion(a: Function0) { + a as SuspendFunction0 /*~> Unit */ + useSuspend(sfn = a /*as SuspendFunction0 */) +} + +fun testSmartCastOnVarVsSuspendConversion(a: Function0) { + var b: Function0 = a + b as SuspendFunction0 /*~> Unit */ + useSuspend(sfn = b /*as SuspendFunction0 */) +} + +fun testIntersectionVsSuspendConversion(x: T) where T : Function0, T : SuspendFunction0 { + useSuspend(sfn = x) +} + diff --git a/compiler/testData/ir/irText/expressions/temporaryInEnumEntryInitializer.kt.txt b/compiler/testData/ir/irText/expressions/temporaryInEnumEntryInitializer.kt.txt new file mode 100644 index 00000000000..b04530ede70 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/temporaryInEnumEntryInitializer.kt.txt @@ -0,0 +1,28 @@ +val n: Any? + field = null + get + +enum class En : Enum { + private constructor(x: String?) /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: String? + field = x + get + + ENTRY init = TODO("IrEnumConstructorCall") + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): En /* Synthetic body for ENUM_VALUEOF */ + +} + diff --git a/compiler/testData/ir/irText/expressions/temporaryInInitBlock.kt.txt b/compiler/testData/ir/irText/expressions/temporaryInInitBlock.kt.txt new file mode 100644 index 00000000000..9247da77c6c --- /dev/null +++ b/compiler/testData/ir/irText/expressions/temporaryInInitBlock.kt.txt @@ -0,0 +1,25 @@ +class C { + constructor(x: Any?) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val s: String? + get + + init { + #s = { //BLOCK + val tmp0_safe_receiver: Any? = x + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + true -> tmp0_safe_receiver.toString() + } + } + } + + + + +} + diff --git a/compiler/testData/ir/irText/expressions/thisOfGenericOuterClass.kt.txt b/compiler/testData/ir/irText/expressions/thisOfGenericOuterClass.kt.txt new file mode 100644 index 00000000000..5aa5c99dbef --- /dev/null +++ b/compiler/testData/ir/irText/expressions/thisOfGenericOuterClass.kt.txt @@ -0,0 +1,55 @@ +class Outer { + constructor(x: T) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: T + field = x + get + + open inner class Inner { + constructor(y: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val y: Int + field = y + get + + + + + } + + + + +} + +fun Outer.test(): Inner { + return { //BLOCK + local class : Inner { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val xx: Int + field = .().plus(other = .()) + get + + + + + } + + + TODO("IrConstructorCall") + } +} + diff --git a/compiler/testData/ir/irText/expressions/thisRefToObjectInNestedClassConstructorCall.kt.txt b/compiler/testData/ir/irText/expressions/thisRefToObjectInNestedClassConstructorCall.kt.txt new file mode 100644 index 00000000000..bd5b304ba62 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/thisRefToObjectInNestedClassConstructorCall.kt.txt @@ -0,0 +1,52 @@ +open class Base { + constructor(x: Any) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Any + field = x + get + + + + +} + +object Host { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + class Derived1 : Base { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + } + + class Derived2 : Base { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + } + + + + +} + diff --git a/compiler/testData/ir/irText/expressions/thisReferenceBeforeClassDeclared.kt.txt b/compiler/testData/ir/irText/expressions/thisReferenceBeforeClassDeclared.kt.txt new file mode 100644 index 00000000000..160498490c3 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/thisReferenceBeforeClassDeclared.kt.txt @@ -0,0 +1,63 @@ +fun WithCompanion.test() { + val test1: = { //BLOCK + local class : WithCompanion { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + } + + + TODO("IrConstructorCall") + } + val test2: = { //BLOCK + local class : WithCompanion { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + } + + + TODO("IrConstructorCall") + } +} + +open class WithCompanion { + constructor(a: Companion) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + companion object Companion { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun foo(): Companion { + return + } + + + + + } + + + + +} + diff --git a/compiler/testData/ir/irText/expressions/throw.kt.txt b/compiler/testData/ir/irText/expressions/throw.kt.txt new file mode 100644 index 00000000000..ab082bfb927 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/throw.kt.txt @@ -0,0 +1,12 @@ +fun test1() { + throw TODO("IrConstructorCall") +} + +fun testImplicitCast(a: Any) { + when { + a is Throwable -> { //BLOCK + throw a /*as Throwable */ + } + } +} + diff --git a/compiler/testData/ir/irText/expressions/tryCatch.kt.txt b/compiler/testData/ir/irText/expressions/tryCatch.kt.txt new file mode 100644 index 00000000000..20dc663e17b --- /dev/null +++ b/compiler/testData/ir/irText/expressions/tryCatch.kt.txt @@ -0,0 +1,27 @@ +fun test1() { + try { //BLOCK + println() + } + catch (...) { //BLOCK + println() + } + finally { //BLOCK + println() + } +} + +fun test2(): Int { + return try { //BLOCK + println() + 42 + } + catch (...) { //BLOCK + println() + 24 + } + finally { //BLOCK + println() + 555 /*~> Unit */ + } +} + diff --git a/compiler/testData/ir/irText/expressions/tryCatchWithImplicitCast.kt.txt b/compiler/testData/ir/irText/expressions/tryCatchWithImplicitCast.kt.txt new file mode 100644 index 00000000000..f629a1d3fc9 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/tryCatchWithImplicitCast.kt.txt @@ -0,0 +1,13 @@ +fun testImplicitCast(a: Any) { + when { + a !is String -> return Unit + } + val t: String = try { //BLOCK + a + } /*as String */ + catch (...) { //BLOCK + "" + } + +} + diff --git a/compiler/testData/ir/irText/expressions/typeAliasConstructorReference.kt.txt b/compiler/testData/ir/irText/expressions/typeAliasConstructorReference.kt.txt new file mode 100644 index 00000000000..e8914501210 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/typeAliasConstructorReference.kt.txt @@ -0,0 +1,46 @@ +class C { + constructor(x: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +typealias CA = C +object Host { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + class Nested { + constructor(x: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + } + + + + +} + +typealias NA = Nested +val test1: Function1 + field = :: + get + +val test2: Function1 + field = :: + get + diff --git a/compiler/testData/ir/irText/expressions/typeArguments.kt.txt b/compiler/testData/ir/irText/expressions/typeArguments.kt.txt new file mode 100644 index 00000000000..93a36d84fdf --- /dev/null +++ b/compiler/testData/ir/irText/expressions/typeArguments.kt.txt @@ -0,0 +1,7 @@ +fun test1(x: Any): Boolean { + return when { + x is Array<*> -> isArrayOf($receiver = x /*as Array<*> */) + true -> false + } +} + diff --git a/compiler/testData/ir/irText/expressions/typeOperators.kt.txt b/compiler/testData/ir/irText/expressions/typeOperators.kt.txt new file mode 100644 index 00000000000..bd40e188054 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/typeOperators.kt.txt @@ -0,0 +1,22 @@ +interface IThing { + + + +} + +fun test1(x: Any): Boolean { + return x is IThing +} + +fun test2(x: Any): Boolean { + return x !is IThing +} + +fun test3(x: Any): IThing { + return x as IThing +} + +fun test4(x: Any): IThing? { + return x as? IThing +} + diff --git a/compiler/testData/ir/irText/expressions/typeParameterClassLiteral.kt.txt b/compiler/testData/ir/irText/expressions/typeParameterClassLiteral.kt.txt new file mode 100644 index 00000000000..e07c6b9bd7e --- /dev/null +++ b/compiler/testData/ir/irText/expressions/typeParameterClassLiteral.kt.txt @@ -0,0 +1,38 @@ +inline fun classRefFun(): KClass { + return T::class +} + +inline fun Any.classRefExtFun(): KClass { + return T::class +} + +val T.classRefExtVal: KClass + inline get(): KClass { + return T::class + } + +class Host { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + inline fun classRefGenericMemberFun(): KClass { + return TF::class + } + + inline fun Any.classRefGenericMemberExtFun(): KClass { + return TF::class + } + + val TV.classRefGenericMemberExtVal: KClass + inline get(): KClass { + return TV::class + } + + + + +} + diff --git a/compiler/testData/ir/irText/expressions/unsignedIntegerLiterals.kt.txt b/compiler/testData/ir/irText/expressions/unsignedIntegerLiterals.kt.txt new file mode 100644 index 00000000000..63a971bead9 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/unsignedIntegerLiterals.kt.txt @@ -0,0 +1,40 @@ +val testSimpleUIntLiteral: UInt + field = 1 + get + +val testSimpleUIntLiteralWithOverflow: UInt + field = -1 + get + +val testUByteWithExpectedType: UByte + field = 1B + get + +val testUShortWithExpectedType: UShort + field = 1S + get + +val testUIntWithExpectedType: UInt + field = 1 + get + +val testULongWithExpectedType: ULong + field = 1L + get + +val testToUByte: UByte + field = toUByte($receiver = 1) + get + +val testToUShort: UShort + field = toUShort($receiver = 1) + get + +val testToUInt: UInt + field = toUInt($receiver = 1) + get + +val testToULong: ULong + field = toULong($receiver = 1) + get + diff --git a/compiler/testData/ir/irText/expressions/useImportedMember.kt.txt b/compiler/testData/ir/irText/expressions/useImportedMember.kt.txt new file mode 100644 index 00000000000..6278864c86a --- /dev/null +++ b/compiler/testData/ir/irText/expressions/useImportedMember.kt.txt @@ -0,0 +1,114 @@ +interface I { + fun T.fromInterface(): T { + return + } + + fun genericFromSuper(g: G): G { + return g + } + + + + +} + +open class BaseClass { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val T.fromClass: T + get(): T { + return + } + + + + +} + +object C : BaseClass, I { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun f(s: Int): Int { + return 1 + } + + fun f(s: String): Int { + return 2 + } + + fun Boolean.f(): Int { + return 3 + } + + var p: Int + field = 4 + get + set + + val Int.ext: Int + get(): Int { + return 6 + } + + fun g1(t: T): T { + return t + } + + val T.g2: T + get(): T { + return + } + + + + + + +} + +fun box(): String { + when { + EQEQ(arg0 = C.f(s = 1), arg1 = 1).not() -> return "1" + } + when { + EQEQ(arg0 = C.f(s = "s"), arg1 = 2).not() -> return "2" + } + when { + EQEQ(arg0 = C.f($receiver = true), arg1 = 3).not() -> return "3" + } + when { + EQEQ(arg0 = C.(), arg1 = 4).not() -> return "4" + } + C.( = 5) + when { + EQEQ(arg0 = C.(), arg1 = 5).not() -> return "5" + } + when { + EQEQ(arg0 = C.($receiver = 5), arg1 = 6).not() -> return "6" + } + when { + EQEQ(arg0 = C.g1(t = "7"), arg1 = "7").not() -> return "7" + } + when { + EQEQ(arg0 = C.($receiver = "8"), arg1 = "8").not() -> return "8" + } + when { + EQEQ(arg0 = C.fromInterface($receiver = 9), arg1 = 9).not() -> return "9" + } + when { + EQEQ(arg0 = C.($receiver = "10"), arg1 = "10").not() -> return "10" + } + when { + EQEQ(arg0 = C.genericFromSuper(g = "11"), arg1 = "11").not() -> return "11" + } + return "OK" +} + diff --git a/compiler/testData/ir/irText/expressions/values.kt.txt b/compiler/testData/ir/irText/expressions/values.kt.txt new file mode 100644 index 00000000000..6eb95edb4fa --- /dev/null +++ b/compiler/testData/ir/irText/expressions/values.kt.txt @@ -0,0 +1,76 @@ +enum class Enum : Enum { + private constructor() /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + A init = TODO("IrEnumConstructorCall") + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): Enum /* Synthetic body for ENUM_VALUEOF */ + +} + +object A { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +val a: Int + field = 0 + get + +class Z { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + companion object Companion { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + } + + + + +} + +fun test1(): Enum { + return Enum +} + +fun test2(): A { + return A +} + +fun test3(): Int { + return () +} + +fun test4(): Companion { + return Companion +} + diff --git a/compiler/testData/ir/irText/expressions/vararg.kt.txt b/compiler/testData/ir/irText/expressions/vararg.kt.txt new file mode 100644 index 00000000000..8b80161b75d --- /dev/null +++ b/compiler/testData/ir/irText/expressions/vararg.kt.txt @@ -0,0 +1,12 @@ +val test1: Array + field = arrayOf() + get + +val test2: Array + field = arrayOf(elements = ["1", "2", "3"]) + get + +val test3: Array + field = arrayOf(elements = ["0", *(), *(), "4"]) + get + diff --git a/compiler/testData/ir/irText/expressions/varargWithImplicitCast.kt.txt b/compiler/testData/ir/irText/expressions/varargWithImplicitCast.kt.txt new file mode 100644 index 00000000000..0890435cbdd --- /dev/null +++ b/compiler/testData/ir/irText/expressions/varargWithImplicitCast.kt.txt @@ -0,0 +1,14 @@ +fun testScalar(a: Any): IntArray { + when { + a !is Int -> return intArrayOf() + } + return intArrayOf(elements = [a /*as Int */]) +} + +fun testSpread(a: Any): IntArray { + when { + a !is IntArray -> return intArrayOf() + } + return intArrayOf(elements = [*a /*as IntArray */]) +} + diff --git a/compiler/testData/ir/irText/expressions/variableAsFunctionCall.kt.txt b/compiler/testData/ir/irText/expressions/variableAsFunctionCall.kt.txt new file mode 100644 index 00000000000..6ee5073ed4e --- /dev/null +++ b/compiler/testData/ir/irText/expressions/variableAsFunctionCall.kt.txt @@ -0,0 +1,35 @@ +fun String.k(): Function0 { + return local fun (): String { + return + } + +} + +fun test1(f: Function0) { + return f.invoke() +} + +fun test2(f: @ExtensionFunctionType Function1) { + return f.invoke(p1 = "hello") +} + +fun test3(): String { + return k($receiver = "hello").invoke() +} + +fun test4(ns: String?): String? { + return { //BLOCK + val tmp1_safe_receiver: Function0? = { //BLOCK + val tmp0_safe_receiver: String? = ns + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + true -> k($receiver = tmp0_safe_receiver) + } + } + when { + EQEQ(arg0 = tmp1_safe_receiver, arg1 = null) -> null + true -> tmp1_safe_receiver.invoke() + } + } +} + diff --git a/compiler/testData/ir/irText/expressions/variableAsFunctionCallWithGenerics.kt.txt b/compiler/testData/ir/irText/expressions/variableAsFunctionCallWithGenerics.kt.txt new file mode 100644 index 00000000000..06742e65472 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/variableAsFunctionCallWithGenerics.kt.txt @@ -0,0 +1,24 @@ +val T.gk: Function0 + get(): Function0 { + return local fun (): T { + return + } + + } + +fun testGeneric1(x: String): String { + return ($receiver = x).invoke() +} + +val T.kt26531Val: Function0 + get(): Function0 { + return local fun (): T { + return + } + + } + +fun kt26531(): Int { + return ($receiver = 7).invoke() +} + diff --git a/compiler/testData/ir/irText/expressions/when.kt.txt b/compiler/testData/ir/irText/expressions/when.kt.txt new file mode 100644 index 00000000000..d1d46871060 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/when.kt.txt @@ -0,0 +1,67 @@ +object A { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +fun testWithSubject(x: Any?): String { + return { //BLOCK + val tmp0_subject: Any? = x + when { + EQEQ(arg0 = tmp0_subject, arg1 = null) -> "null" + EQEQ(arg0 = tmp0_subject, arg1 = A) -> "A" + tmp0_subject is String -> "String" + tmp0_subject is Number.not() -> "!Number" + contains($receiver = setOf(), element = tmp0_subject /*as Number */) -> "nothingness?" + true -> "something" + } + } +} + +fun test(x: Any?): String { + return when { + EQEQ(arg0 = x, arg1 = null) -> "null" + EQEQ(arg0 = x, arg1 = A) -> "A" + x is String -> "String" + x !is Number -> "!Number" + contains($receiver = setOf(), element = x /*as Number */) -> "nothingness?" + true -> "something" + } +} + +fun testComma(x: Int): String { + return { //BLOCK + val tmp0_subject: Int = x + when { + when { + when { + when { + EQEQ(arg0 = tmp0_subject, arg1 = 1) -> true + true -> EQEQ(arg0 = tmp0_subject, arg1 = 2) + } -> true + true -> EQEQ(arg0 = tmp0_subject, arg1 = 3) + } -> true + true -> EQEQ(arg0 = tmp0_subject, arg1 = 4) + } -> "1234" + when { + when { + EQEQ(arg0 = tmp0_subject, arg1 = 5) -> true + true -> EQEQ(arg0 = tmp0_subject, arg1 = 6) + } -> true + true -> EQEQ(arg0 = tmp0_subject, arg1 = 7) + } -> "567" + when { + EQEQ(arg0 = tmp0_subject, arg1 = 8) -> true + true -> EQEQ(arg0 = tmp0_subject, arg1 = 9) + } -> "89" + true -> "?" + } + } +} + diff --git a/compiler/testData/ir/irText/expressions/whenCoercedToUnit.kt.txt b/compiler/testData/ir/irText/expressions/whenCoercedToUnit.kt.txt new file mode 100644 index 00000000000..f43dc7c7d66 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/whenCoercedToUnit.kt.txt @@ -0,0 +1,9 @@ +fun foo(x: Int) { + { //BLOCK + val tmp0_subject: Int = x + when { + EQEQ(arg0 = tmp0_subject, arg1 = 0) -> 0 /*~> Unit */ + } + } +} + diff --git a/compiler/testData/ir/irText/expressions/whenElse.kt.txt b/compiler/testData/ir/irText/expressions/whenElse.kt.txt new file mode 100644 index 00000000000..75b6657e3a1 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/whenElse.kt.txt @@ -0,0 +1,6 @@ +fun test(): Int { + return when { + true -> 42 + } +} + diff --git a/compiler/testData/ir/irText/expressions/whenReturn.kt.txt b/compiler/testData/ir/irText/expressions/whenReturn.kt.txt new file mode 100644 index 00000000000..0a6b0fd9593 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/whenReturn.kt.txt @@ -0,0 +1,14 @@ +fun toString(grade: String): String { + { //BLOCK + val tmp0_subject: String = grade + when { + EQEQ(arg0 = tmp0_subject, arg1 = "A") -> return "Excellent" + EQEQ(arg0 = tmp0_subject, arg1 = "B") -> return "Good" + EQEQ(arg0 = tmp0_subject, arg1 = "C") -> return "Mediocre" + EQEQ(arg0 = tmp0_subject, arg1 = "D") -> return "Fair" + true -> return "Failure" + } + } + return "???" +} + diff --git a/compiler/testData/ir/irText/expressions/whenReturnUnit.kt.txt b/compiler/testData/ir/irText/expressions/whenReturnUnit.kt.txt new file mode 100644 index 00000000000..cf685aacbea --- /dev/null +++ b/compiler/testData/ir/irText/expressions/whenReturnUnit.kt.txt @@ -0,0 +1,16 @@ +fun run(block: Function0) { +} + +fun branch(x: Int) { + return run(block = local fun () { + { //BLOCK + val tmp0_subject: Int = x + when { + EQEQ(arg0 = tmp0_subject, arg1 = 1) -> TODO(reason = "1") + EQEQ(arg0 = tmp0_subject, arg1 = 2) -> TODO(reason = "2") + } + } + } +) +} + diff --git a/compiler/testData/ir/irText/expressions/whenUnusedExpression.kt.txt b/compiler/testData/ir/irText/expressions/whenUnusedExpression.kt.txt new file mode 100644 index 00000000000..48b6c1f32c2 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/whenUnusedExpression.kt.txt @@ -0,0 +1,15 @@ +fun test(b: Boolean, i: Int) { + when { + b -> { //BLOCK + { //BLOCK + val tmp0_subject: Int = i + when { + EQEQ(arg0 = tmp0_subject, arg1 = 0) -> 1 /*~> Unit */ + true -> null /*~> Unit */ + } + } + } + true -> null /*~> Unit */ + } +} + diff --git a/compiler/testData/ir/irText/expressions/whenWithSubjectVariable.kt.txt b/compiler/testData/ir/irText/expressions/whenWithSubjectVariable.kt.txt new file mode 100644 index 00000000000..276726d19f6 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/whenWithSubjectVariable.kt.txt @@ -0,0 +1,18 @@ +fun foo(): Any { + return 1 +} + +fun test(): Int { + return { //BLOCK + val y: Any = foo() + when { + EQEQ(arg0 = y, arg1 = 42) -> 1 + y is String -> y /*as String */.() + y is Int.not() -> 2 + 0.rangeTo(other = 10).contains(value = y /*as Int */) -> 3 + 10.rangeTo(other = 20).contains(value = y /*as Int */).not() -> 4 + true -> -1 + } + } +} + diff --git a/compiler/testData/ir/irText/expressions/whileDoWhile.kt.txt b/compiler/testData/ir/irText/expressions/whileDoWhile.kt.txt new file mode 100644 index 00000000000..ffe8dac5c36 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/whileDoWhile.kt.txt @@ -0,0 +1,50 @@ +fun test() { + var x: Int = 0 + while (less(arg0 = x, arg1 = 0)) + while (less(arg0 = x, arg1 = 5)) { //BLOCK + val tmp0: Int = x + x = tmp0.inc() + tmp0 + } /*~> Unit */ + while (less(arg0 = x, arg1 = 10)) { //BLOCK + { //BLOCK + val tmp1: Int = x + x = tmp1.inc() + tmp1 + } /*~> Unit */ + } + { //BLOCK + do while (less(arg0 = x, arg1 = 0)) + } + { //BLOCK + do{ //BLOCK + val tmp2: Int = x + x = tmp2.inc() + tmp2 + } /*~> Unit */ while (less(arg0 = x, arg1 = 15)) + } + { //BLOCK + do// COMPOSITE { + { //BLOCK + val tmp3: Int = x + x = tmp3.inc() + tmp3 + } /*~> Unit */ + // } while (less(arg0 = x, arg1 = 20)) + } +} + +fun testSmartcastInCondition() { + val a: Any? = null + when { + a is Boolean -> { //BLOCK + while (a /*as Boolean */) { //BLOCK + } + { //BLOCK + do// COMPOSITE { + // } while (a /*as Boolean */) + } + } + } +} + diff --git a/compiler/testData/ir/irText/firProblems/BaseFirBuilder.kt.txt b/compiler/testData/ir/irText/firProblems/BaseFirBuilder.kt.txt new file mode 100644 index 00000000000..e2f748eba3c --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/BaseFirBuilder.kt.txt @@ -0,0 +1,16 @@ +abstract class BaseFirBuilder { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + inline fun withCapturedTypeParameters(block: Function0): T { + return block.invoke() + } + + + + +} + diff --git a/compiler/testData/ir/irText/firProblems/FirBuilder.kt.txt b/compiler/testData/ir/irText/firProblems/FirBuilder.kt.txt new file mode 100644 index 00000000000..c635a2d1a3e --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/FirBuilder.kt.txt @@ -0,0 +1,26 @@ +open class BaseConverter : BaseFirBuilder { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + +} + +class DeclarationsConverter : BaseConverter { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + +} + diff --git a/compiler/testData/ir/irText/firProblems/deprecated.kt.txt b/compiler/testData/ir/irText/firProblems/deprecated.kt.txt new file mode 100644 index 00000000000..eae1d38ae00 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/deprecated.kt.txt @@ -0,0 +1,14 @@ +fun create(): String { + return "OK" +} + +@Deprecated(...) +fun create(s: String): String { + return create() +} + +@Deprecated(...) +fun create(b: Boolean): String { + return create() +} + diff --git a/compiler/testData/ir/irText/lambdas/anonymousFunction.kt.txt b/compiler/testData/ir/irText/lambdas/anonymousFunction.kt.txt new file mode 100644 index 00000000000..14c11affbd6 --- /dev/null +++ b/compiler/testData/ir/irText/lambdas/anonymousFunction.kt.txt @@ -0,0 +1,7 @@ +val anonymous: Function0 + field = local fun () { + println() + } + + get + diff --git a/compiler/testData/ir/irText/lambdas/destructuringInLambda.kt.txt b/compiler/testData/ir/irText/lambdas/destructuringInLambda.kt.txt new file mode 100644 index 00000000000..ad8b381ab8d --- /dev/null +++ b/compiler/testData/ir/irText/lambdas/destructuringInLambda.kt.txt @@ -0,0 +1,69 @@ +data class A { + constructor(x: Int, y: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = x + get + + val y: Int + field = y + get + + operator fun component1(): Int { + return #x + } + + operator fun component2(): Int { + return #y + } + + fun copy(x: Int = #x, y: Int = #y): A { + return TODO("IrConstructorCall") + } + + override fun toString(): String { + return "A(" + +"x=" + +#x + +", " + +"y=" + +#y + +")" + } + + override fun hashCode(): Int { + return #x.hashCode().times(other = 31).plus(other = #y.hashCode()) + } + + override operator fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is A -> return false + } + val tmp0_other_with_cast: A = other as A + when { + EQEQ(arg0 = #x, arg1 = #x).not() -> return false + } + when { + EQEQ(arg0 = #y, arg1 = #y).not() -> return false + } + return true + } + +} + +var fn: Function1 + field = local fun (: A): Int { + val y: Int = .component2() + return 42.plus(other = y) + } + + get + set + diff --git a/compiler/testData/ir/irText/lambdas/extensionLambda.kt.txt b/compiler/testData/ir/irText/lambdas/extensionLambda.kt.txt new file mode 100644 index 00000000000..36d8b533ba2 --- /dev/null +++ b/compiler/testData/ir/irText/lambdas/extensionLambda.kt.txt @@ -0,0 +1,7 @@ +fun test1(): Int { + return run($receiver = "42", block = local fun String.(): Int { + return .() + } +) +} + diff --git a/compiler/testData/ir/irText/lambdas/justLambda.kt.txt b/compiler/testData/ir/irText/lambdas/justLambda.kt.txt new file mode 100644 index 00000000000..a5e160af1e9 --- /dev/null +++ b/compiler/testData/ir/irText/lambdas/justLambda.kt.txt @@ -0,0 +1,14 @@ +val test1: Function0 + field = local fun (): Int { + return 42 + } + + get + +val test2: Function0 + field = local fun () { + return Unit + } + + get + diff --git a/compiler/testData/ir/irText/lambdas/localFunction.kt.txt b/compiler/testData/ir/irText/lambdas/localFunction.kt.txt new file mode 100644 index 00000000000..f65d2beb7d1 --- /dev/null +++ b/compiler/testData/ir/irText/lambdas/localFunction.kt.txt @@ -0,0 +1,14 @@ +fun outer() { + var x: Int = 0 + local fun local() { + { //BLOCK + val tmp0: Int = x + x = tmp0.inc() + tmp0 + } /*~> Unit */ + } + + + local() +} + diff --git a/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.kt.txt b/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.kt.txt new file mode 100644 index 00000000000..1a1e33cdc4e --- /dev/null +++ b/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.kt.txt @@ -0,0 +1,58 @@ +object A { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +object B { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +interface IFoo { + val A.foo: B + get(): B { + return B + } + + + + +} + +interface IInvoke { + operator fun B.invoke(): Int { + return 42 + } + + + + +} + +fun test(fooImpl: IFoo, invokeImpl: IInvoke) { + with(receiver = A, block = local fun A.(): Int { + return with(receiver = fooImpl, block = local fun IFoo.(): Int { + return with(receiver = invokeImpl, block = local fun IInvoke.(): Int { + return .invoke($receiver = .($receiver = )) + } +) + } +) + } +) /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/lambdas/nonLocalReturn.kt.txt b/compiler/testData/ir/irText/lambdas/nonLocalReturn.kt.txt new file mode 100644 index 00000000000..04737ae5225 --- /dev/null +++ b/compiler/testData/ir/irText/lambdas/nonLocalReturn.kt.txt @@ -0,0 +1,51 @@ +fun test0() { + run(block = local fun (): Nothing { + return Unit + } +) +} + +fun test1() { + run(block = local fun () { + return Unit + } +) +} + +fun test2() { + run(block = local fun () { + return Unit + } +) +} + +fun test3() { + run(block = local fun () { + run(block = local fun (): Nothing { + return Unit + } +) + } +) +} + +fun testLrmFoo1(ints: List) { + forEach($receiver = ints, action = local fun (it: Int) { + when { + EQEQ(arg0 = it, arg1 = 0) -> return Unit + } + print(message = it) + } +) +} + +fun testLrmFoo2(ints: List) { + forEach($receiver = ints, action = local fun (it: Int) { + when { + EQEQ(arg0 = it, arg1 = 0) -> return Unit + } + print(message = it) + } +) +} + diff --git a/compiler/testData/ir/irText/lambdas/samAdapter.kt.txt b/compiler/testData/ir/irText/lambdas/samAdapter.kt.txt new file mode 100644 index 00000000000..fa3fe129201 --- /dev/null +++ b/compiler/testData/ir/irText/lambdas/samAdapter.kt.txt @@ -0,0 +1,8 @@ +fun test1() { + val hello: Runnable = local fun () { + println(message = "Hello, world!") + } + /*-> Runnable */ + hello.run() +} + diff --git a/compiler/testData/ir/irText/regressions/coercionInLoop.kt.txt b/compiler/testData/ir/irText/regressions/coercionInLoop.kt.txt new file mode 100644 index 00000000000..c748f81b178 --- /dev/null +++ b/compiler/testData/ir/irText/regressions/coercionInLoop.kt.txt @@ -0,0 +1,18 @@ +fun box(): String { + val a: DoubleArray = TODO("IrConstructorCall") + val x: DoubleIterator = a.iterator() + var i: Int = 0 + while (x.hasNext()) { //BLOCK + when { + ieee754equals(arg0 = a.get(index = i), arg1 = x.next()).not() -> return "Fail " + +i + } + { //BLOCK + val tmp0: Int = i + i = tmp0.inc() + tmp0 + } /*~> Unit */ + } + return "OK" +} + diff --git a/compiler/testData/ir/irText/regressions/integerCoercionToT.kt.txt b/compiler/testData/ir/irText/regressions/integerCoercionToT.kt.txt new file mode 100644 index 00000000000..3d8515b7bad --- /dev/null +++ b/compiler/testData/ir/irText/regressions/integerCoercionToT.kt.txt @@ -0,0 +1,50 @@ +interface CPointed { + + + +} + +inline fun CPointed.reinterpret(): T { + TODO() +} + +class CInt32VarX : CPointed { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +typealias CInt32Var = CInt32VarX +var CInt32VarX.value: T_INT + get(): T_INT { + TODO() + } + set(value: T_INT) { + } + +class IdType : CPointed { + constructor(value: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val value: Int + field = value + get + + + + +} + +fun foo(value: IdType, cv: CInt32VarX) { + ($receiver = cv, value = value.()) +} + diff --git a/compiler/testData/ir/irText/regressions/kt24114.kt.txt b/compiler/testData/ir/irText/regressions/kt24114.kt.txt new file mode 100644 index 00000000000..53addefba7f --- /dev/null +++ b/compiler/testData/ir/irText/regressions/kt24114.kt.txt @@ -0,0 +1,44 @@ +fun one(): Int { + return 1 +} + +fun two(): Int { + return 2 +} + +fun test1(): Int { + while (true) { //BLOCK + { //BLOCK + val tmp0_subject: Int = one() + when { + EQEQ(arg0 = tmp0_subject, arg1 = 1) -> { //BLOCK + { //BLOCK + val tmp1_subject: Int = two() + when { + EQEQ(arg0 = tmp1_subject, arg1 = 2) -> return 2 + } + } + } + true -> return 3 + } + } + } +} + +fun test2(): Int { + while (true) { //BLOCK + { //BLOCK + val tmp0_subject: Int = one() + when { + EQEQ(arg0 = tmp0_subject, arg1 = 1) -> { //BLOCK + val tmp1_subject: Int = two() + when { + EQEQ(arg0 = tmp1_subject, arg1 = 2) -> return 2 + } + } + true -> return 3 + } + } + } +} + diff --git a/compiler/testData/ir/irText/regressions/newInference/fixationOrder1.kt.txt b/compiler/testData/ir/irText/regressions/newInference/fixationOrder1.kt.txt new file mode 100644 index 00000000000..541186a002a --- /dev/null +++ b/compiler/testData/ir/irText/regressions/newInference/fixationOrder1.kt.txt @@ -0,0 +1,23 @@ +fun foo(): Function1 { + TODO() +} + +interface Inv2 { + + + +} + +fun check(x: T, y: R, f: Function1): Inv2 { + TODO() +} + +fun test(): Inv2 { + return check(x = "", y = 1, f = foo()) +} + +fun box(): String { + val x: Inv2 = test() + return "OK" +} + diff --git a/compiler/testData/ir/irText/regressions/typeAliasCtorForGenericClass.kt.txt b/compiler/testData/ir/irText/regressions/typeAliasCtorForGenericClass.kt.txt new file mode 100644 index 00000000000..024fd5d302a --- /dev/null +++ b/compiler/testData/ir/irText/regressions/typeAliasCtorForGenericClass.kt.txt @@ -0,0 +1,23 @@ +class A { + constructor(q: Q) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val q: Q + field = q + get + + + + +} + +typealias B = A +typealias B2 = A> +fun bar() { + val b: A = TODO("IrConstructorCall") + val b2: A> = TODO("IrConstructorCall") +} + diff --git a/compiler/testData/ir/irText/regressions/typeParametersInImplicitCast.kt.txt b/compiler/testData/ir/irText/regressions/typeParametersInImplicitCast.kt.txt new file mode 100644 index 00000000000..886ee3f0599 --- /dev/null +++ b/compiler/testData/ir/irText/regressions/typeParametersInImplicitCast.kt.txt @@ -0,0 +1,7 @@ +fun problematic(lss: List>): List { + return flatMap, T?>($receiver = lss, transform = local fun (it: List): List? { + return id(v = it) /*!! List */ + } +) +} + diff --git a/compiler/testData/ir/irText/singletons/companion.kt.txt b/compiler/testData/ir/irText/singletons/companion.kt.txt new file mode 100644 index 00000000000..3b548757f67 --- /dev/null +++ b/compiler/testData/ir/irText/singletons/companion.kt.txt @@ -0,0 +1,31 @@ +class Z { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun test2() { + Companion.test() + } + + companion object Companion { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun test() { + } + + + + + } + + + + +} + diff --git a/compiler/testData/ir/irText/singletons/enumEntry.kt.txt b/compiler/testData/ir/irText/singletons/enumEntry.kt.txt new file mode 100644 index 00000000000..30252f8a6a6 --- /dev/null +++ b/compiler/testData/ir/irText/singletons/enumEntry.kt.txt @@ -0,0 +1,20 @@ +open enum class Z : Enum { + private constructor() /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + ENTRY init = TODO("IrEnumConstructorCall") + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): Z /* Synthetic body for ENUM_VALUEOF */ + +} + diff --git a/compiler/testData/ir/irText/singletons/object.kt.txt b/compiler/testData/ir/irText/singletons/object.kt.txt new file mode 100644 index 00000000000..2048f181764 --- /dev/null +++ b/compiler/testData/ir/irText/singletons/object.kt.txt @@ -0,0 +1,31 @@ +object Z { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun test() { + } + + class A { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun test2() { + Z.test() + } + + + + + } + + + + +} + diff --git a/compiler/testData/ir/irText/stubs/builtinMap.kt.txt b/compiler/testData/ir/irText/stubs/builtinMap.kt.txt new file mode 100644 index 00000000000..24e6bbe40b2 --- /dev/null +++ b/compiler/testData/ir/irText/stubs/builtinMap.kt.txt @@ -0,0 +1,10 @@ +fun Map.plus(pair: Pair): Map { + return when { + .isEmpty() -> mapOf(pair = pair) + true -> apply>($receiver = TODO("IrConstructorCall"), block = local fun LinkedHashMap.() { + .put(key = pair.(), value = pair.()) /*~> Unit */ + } +) + } +} + diff --git a/compiler/testData/ir/irText/stubs/constFromBuiltins.kt.txt b/compiler/testData/ir/irText/stubs/constFromBuiltins.kt.txt new file mode 100644 index 00000000000..93fc677192d --- /dev/null +++ b/compiler/testData/ir/irText/stubs/constFromBuiltins.kt.txt @@ -0,0 +1,4 @@ +val test: Int + field = Companion.() + get + diff --git a/compiler/testData/ir/irText/stubs/genericClassInDifferentModule_m1.kt.txt b/compiler/testData/ir/irText/stubs/genericClassInDifferentModule_m1.kt.txt new file mode 100644 index 00000000000..ccaa54f2166 --- /dev/null +++ b/compiler/testData/ir/irText/stubs/genericClassInDifferentModule_m1.kt.txt @@ -0,0 +1,25 @@ +abstract class Base { + constructor(x: T) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: T + field = x + get + + abstract fun foo(y: Y): T + abstract var bar: T + abstract get + abstract set + + abstract var Z.exn: T + abstract get + abstract set + + + + +} + diff --git a/compiler/testData/ir/irText/stubs/genericClassInDifferentModule_m2.kt.txt b/compiler/testData/ir/irText/stubs/genericClassInDifferentModule_m2.kt.txt new file mode 100644 index 00000000000..e53327404d9 --- /dev/null +++ b/compiler/testData/ir/irText/stubs/genericClassInDifferentModule_m2.kt.txt @@ -0,0 +1,28 @@ +class Derived1 : Base { + constructor(x: T) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + override fun foo(y: Y): T { + return .() + } + + override var bar: T + field = x + override get + override set + + override var Z.exn: T + override get(): T { + return .() + } + override set(value: T) { + } + + + + +} + diff --git a/compiler/testData/ir/irText/stubs/javaConstructorWithTypeParameters.kt.txt b/compiler/testData/ir/irText/stubs/javaConstructorWithTypeParameters.kt.txt new file mode 100644 index 00000000000..9e547cac5c6 --- /dev/null +++ b/compiler/testData/ir/irText/stubs/javaConstructorWithTypeParameters.kt.txt @@ -0,0 +1,16 @@ +fun test1(): J1 { + return TODO("IrConstructorCall") +} + +fun test2(): J1 { + return TODO("IrConstructorCall") +} + +fun test3(j1: J1): J2 { + return TODO("IrConstructorCall") +} + +fun test4(j1: J1): J2 { + return TODO("IrConstructorCall") +} + diff --git a/compiler/testData/ir/irText/stubs/javaEnum.kt.txt b/compiler/testData/ir/irText/stubs/javaEnum.kt.txt new file mode 100644 index 00000000000..b208fba4cc9 --- /dev/null +++ b/compiler/testData/ir/irText/stubs/javaEnum.kt.txt @@ -0,0 +1,4 @@ +val test: JEnum + field = JEnum + get + diff --git a/compiler/testData/ir/irText/stubs/javaInnerClass.kt.txt b/compiler/testData/ir/irText/stubs/javaInnerClass.kt.txt new file mode 100644 index 00000000000..c516dc6d2c3 --- /dev/null +++ b/compiler/testData/ir/irText/stubs/javaInnerClass.kt.txt @@ -0,0 +1,17 @@ +class Test1 : J { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val test: JInner + field = TODO("IrConstructorCall") + get + + + + + +} + diff --git a/compiler/testData/ir/irText/stubs/javaMethod.kt.txt b/compiler/testData/ir/irText/stubs/javaMethod.kt.txt new file mode 100644 index 00000000000..1c840c120a9 --- /dev/null +++ b/compiler/testData/ir/irText/stubs/javaMethod.kt.txt @@ -0,0 +1,4 @@ +fun test(j: J) { + return j.bar() +} + diff --git a/compiler/testData/ir/irText/stubs/javaNestedClass.kt.txt b/compiler/testData/ir/irText/stubs/javaNestedClass.kt.txt new file mode 100644 index 00000000000..082b99ef617 --- /dev/null +++ b/compiler/testData/ir/irText/stubs/javaNestedClass.kt.txt @@ -0,0 +1,4 @@ +fun test(jj: JJ) { + return jj.foo() +} + diff --git a/compiler/testData/ir/irText/stubs/javaStaticMethod.kt.txt b/compiler/testData/ir/irText/stubs/javaStaticMethod.kt.txt new file mode 100644 index 00000000000..7b1dbb41f68 --- /dev/null +++ b/compiler/testData/ir/irText/stubs/javaStaticMethod.kt.txt @@ -0,0 +1,4 @@ +fun test() { + return bar() +} + diff --git a/compiler/testData/ir/irText/stubs/javaSyntheticProperty.kt.txt b/compiler/testData/ir/irText/stubs/javaSyntheticProperty.kt.txt new file mode 100644 index 00000000000..fd847fac41e --- /dev/null +++ b/compiler/testData/ir/irText/stubs/javaSyntheticProperty.kt.txt @@ -0,0 +1,4 @@ +val test: @FlexibleNullability String? + field = TODO("IrConstructorCall").getFoo() + get + diff --git a/compiler/testData/ir/irText/stubs/jdkClassSyntheticProperty.kt.txt b/compiler/testData/ir/irText/stubs/jdkClassSyntheticProperty.kt.txt new file mode 100644 index 00000000000..6c39f9962d8 --- /dev/null +++ b/compiler/testData/ir/irText/stubs/jdkClassSyntheticProperty.kt.txt @@ -0,0 +1,5 @@ +val Class<*>.test: @FlexibleNullability Array? + get(): @FlexibleNullability Array? { + return .getDeclaredFields<@FlexibleNullability Any?>() + } + diff --git a/compiler/testData/ir/irText/stubs/kotlinInnerClass.kt.txt b/compiler/testData/ir/irText/stubs/kotlinInnerClass.kt.txt new file mode 100644 index 00000000000..9b09175f86f --- /dev/null +++ b/compiler/testData/ir/irText/stubs/kotlinInnerClass.kt.txt @@ -0,0 +1,4 @@ +fun test(inner: Inner) { + return inner.foo() +} + diff --git a/compiler/testData/ir/irText/stubs/simple.kt.txt b/compiler/testData/ir/irText/stubs/simple.kt.txt new file mode 100644 index 00000000000..136cd737001 --- /dev/null +++ b/compiler/testData/ir/irText/stubs/simple.kt.txt @@ -0,0 +1,4 @@ +val test: Int + field = 2.plus(other = 2) + get + diff --git a/compiler/testData/ir/irText/types/abbreviatedTypes.kt.txt b/compiler/testData/ir/irText/types/abbreviatedTypes.kt.txt new file mode 100644 index 00000000000..8aaac2081fa --- /dev/null +++ b/compiler/testData/ir/irText/types/abbreviatedTypes.kt.txt @@ -0,0 +1,18 @@ +typealias I = Int +typealias L = List +fun test1(x: List): List { + return x +} + +fun test2(x: List>): List> { + return x +} + +fun test3(x: List>): List> { + return x +} + +fun test4(x: List>): List> { + return x +} + diff --git a/compiler/testData/ir/irText/types/asOnPlatformType.kt.txt b/compiler/testData/ir/irText/types/asOnPlatformType.kt.txt new file mode 100644 index 00000000000..bf2a6d538a2 --- /dev/null +++ b/compiler/testData/ir/irText/types/asOnPlatformType.kt.txt @@ -0,0 +1,17 @@ +fun test() { + val nullStr: @FlexibleNullability String? = nullString() + val nonnullStr: @FlexibleNullability String? = nonnullString() + foo<@FlexibleNullability String?>($receiver = nullStr) /*~> Unit */ + foo<@FlexibleNullability String?>($receiver = nonnullStr) /*~> Unit */ + fooN<@FlexibleNullability String?>($receiver = nullStr) /*~> Unit */ + fooN<@FlexibleNullability String?>($receiver = nonnullStr) /*~> Unit */ +} + +inline fun T.foo(): T { + return as T +} + +inline fun T.fooN(): T? { + return as T? +} + diff --git a/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt b/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt new file mode 100644 index 00000000000..41a3a294579 --- /dev/null +++ b/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt @@ -0,0 +1,164 @@ +@OptIn(...) +fun scopedFlow(block: @ExtensionFunctionType SuspendFunction2, Unit>): Flow { + return flow(block = local suspend fun FlowCollector.() { + val collector: FlowCollector = + flowScope(block = local suspend fun CoroutineScope.() { + block.invoke(p1 = , p2 = collector) + } +) + } +) +} + +fun Flow.onCompletion(action: @ExtensionFunctionType SuspendFunction2, @ParameterName(...) Throwable?, Unit>): Flow { + return unsafeFlow(block = local suspend fun FlowCollector.() { + val safeCollector: SafeCollector = TODO("IrConstructorCall") + invokeSafely($receiver = safeCollector, action = action) + } +) +} + +suspend fun FlowCollector.invokeSafely(action: @ExtensionFunctionType SuspendFunction2, @ParameterName(...) Throwable?, Unit>) { +} + +@OptIn(...) +inline fun unsafeFlow(crossinline block: @ExtensionFunctionType SuspendFunction1, Unit>): Flow { + TODO() +} + +@Deprecated(...) +fun Flow.onCompletion(action: SuspendFunction1<@ParameterName(...) Throwable?, Unit>): Flow { + return onCompletion($receiver = , action = local suspend fun FlowCollector.(it: Throwable?) { + action.invoke(p1 = it) + } +) +} + +private fun CoroutineScope.asFairChannel(flow: Flow<*>): ReceiveChannel { + return produce($receiver = , block = local suspend fun ProducerScope.() { + val channel: ChannelCoroutine = .() as ChannelCoroutine + collect($receiver = flow, action = local suspend fun (value: Any?) { + return channel.sendFair(element = { //BLOCK + val tmp0_elvis_lhs: Any? = value + when { + EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> TODO("IrConstructorCall") + true -> tmp0_elvis_lhs + } + }) + } +) + } +) +} + +private fun CoroutineScope.asChannel(flow: Flow<*>): ReceiveChannel { + return produce($receiver = , block = local suspend fun ProducerScope.() { + collect($receiver = flow, action = local suspend fun (value: Any?) { + return .().send(e = { //BLOCK + val tmp0_elvis_lhs: Any? = value + when { + EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> TODO("IrConstructorCall") + true -> tmp0_elvis_lhs + } + }) + } +) + } +) +} + +class SafeCollector : FlowCollector { + constructor(collector: FlowCollector) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + internal val collector: FlowCollector + field = collector + internal get + + override suspend fun emit(value: T) { + } + + + + +} + +@OptIn(...) +fun flow(block: @ExtensionFunctionType SuspendFunction1, Unit>): Flow { + TODO() +} + +@OptIn(...) +suspend fun flowScope(block: @ExtensionFunctionType SuspendFunction1): R { + TODO() +} + +suspend inline fun Flow.collect(crossinline action: SuspendFunction1<@ParameterName(...) T, Unit>) { +} + +open class ChannelCoroutine { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + suspend fun sendFair(element: E) { + } + + + + +} + +interface CoroutineScope { + + + +} + +interface Flow { + abstract suspend fun collect(collector: FlowCollector) + + + +} + +interface FlowCollector { + abstract suspend fun emit(value: T) + + + +} + +interface ReceiveChannel { + + + +} + +@OptIn(...) +fun CoroutineScope.produce(block: @ExtensionFunctionType SuspendFunction1, Unit>): ReceiveChannel { + TODO() +} + +interface ProducerScope : CoroutineScope, SendChannel { + abstract val channel: SendChannel + abstract get + + + + + +} + +interface SendChannel { + abstract suspend fun send(e: E) + + + +} + diff --git a/compiler/testData/ir/irText/types/coercionToUnitInLambdaReturnValue.kt.txt b/compiler/testData/ir/irText/types/coercionToUnitInLambdaReturnValue.kt.txt new file mode 100644 index 00000000000..54f08eb9099 --- /dev/null +++ b/compiler/testData/ir/irText/types/coercionToUnitInLambdaReturnValue.kt.txt @@ -0,0 +1,10 @@ +fun use(fn: Function0) { +} + +fun test() { + use(fn = local fun () { + 42 /*~> Unit */ + } +) +} + diff --git a/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.kt.txt b/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.kt.txt new file mode 100644 index 00000000000..90607b21952 --- /dev/null +++ b/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.kt.txt @@ -0,0 +1,173 @@ +class Value> { + constructor(value1: T, value2: IT) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + var value1: T + field = value1 + get + set + + val value2: IT + field = value2 + get + + + + +} + +interface IDelegate1 { + abstract operator fun getValue(t: T1, p: KProperty<*>): R1 + + + +} + +interface IDelegate2 { + abstract operator fun getValue(t: T2, p: KProperty<*>): R2 + + + +} + +interface IR { + abstract fun foo(): R + + + +} + +class CR : IR { + constructor(r: R) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val r: R + field = r + get + + override fun foo(): R { + return .() + } + + + + +} + +class P { + constructor(p1: P1, p2: P2) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val p1: P1 + field = p1 + get + + val p2: P2 + field = p2 + get + + + + +} + +val Value>.additionalText: P /* by */ + field = { //BLOCK + local class : IDelegate1>, P> { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun qux11(t: F11T): F11T { + return t + } + + fun > qux12(t: F12T): Any? { + return t.foo() /*as Any? */ + } + + private val Value>.deepO: Any? /* by */ + field = { //BLOCK + local class : IDelegate1>, Any?> { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + override operator fun getValue(t: Value>, p: KProperty<*>): Any? { + return t.() /*as Any? */ + } + + fun qux21(t: F21T): F21T { + return t + } + + fun > qux22(t: F22T): Any? { + return t.foo() /*as Any? */ + } + + + + + } + + + TODO("IrConstructorCall") + } + private get(): Any? { + return #deepO$delegate.getValue(t = , p = ::deepO) /*as Any? */ + } + + private val Value>.deepK: Any? /* by */ + field = { //BLOCK + local class : IDelegate1>, Any?> { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + override operator fun getValue(t: Value>, p: KProperty<*>): Any? { + return t.().foo() /*as Any? */ + } + + + + + } + + + TODO("IrConstructorCall") + } + private get(): Any? { + return #deepK$delegate.getValue(t = , p = ::deepK) /*as Any? */ + } + + override operator fun getValue(t: Value>, p: KProperty<*>): P { + return TODO("IrConstructorCall") + } + + + + + } + + + TODO("IrConstructorCall") + } + get(): P { + return #additionalText$delegate.getValue(t = , p = ::additionalText) + } + diff --git a/compiler/testData/ir/irText/types/genericFunWithStar.kt.txt b/compiler/testData/ir/irText/types/genericFunWithStar.kt.txt new file mode 100644 index 00000000000..74f305daa01 --- /dev/null +++ b/compiler/testData/ir/irText/types/genericFunWithStar.kt.txt @@ -0,0 +1,41 @@ +interface IBase { + + + +} + +interface IFoo : IBase { + + + +} + +interface IBar : IBase { + + + +} + +interface I where G : IFoo, G : IBar { + + + +} + +abstract class Box : IFoo, IBar where T : IFoo, T : IBar { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + abstract fun foo(tSerializer: I): I> where F : IFoo, F : IBar + fun bar(vararg serializers: I<*>): I<*> { + return .foo(tSerializer = serializers.get(index = 0)) + } + + + + +} + diff --git a/compiler/testData/ir/irText/types/genericPropertyReferenceType.kt.txt b/compiler/testData/ir/irText/types/genericPropertyReferenceType.kt.txt new file mode 100644 index 00000000000..055b8579fd4 --- /dev/null +++ b/compiler/testData/ir/irText/types/genericPropertyReferenceType.kt.txt @@ -0,0 +1,37 @@ +class C { + constructor(x: T) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + var x: T + field = x + get + set + + + + +} + +var C.y: T + get(): T { + return .() + } + set(v: T) { + .( = v) + } + +fun use(p: KMutableProperty) { +} + +fun test1() { + use(p = ::y) +} + +fun test2(a: Any) { + a as C /*~> Unit */ + use(p = ::y) +} + diff --git a/compiler/testData/ir/irText/types/inStarProjectionInReceiverType.kt.txt b/compiler/testData/ir/irText/types/inStarProjectionInReceiverType.kt.txt new file mode 100644 index 00000000000..ff7854095ab --- /dev/null +++ b/compiler/testData/ir/irText/types/inStarProjectionInReceiverType.kt.txt @@ -0,0 +1,23 @@ +interface Foo { + abstract val x: Int + abstract get + + abstract fun foo(x: T) + + + +} + +fun Foo<*>.testReceiver(): Int { + return .() +} + +fun Foo<*>.testSmartCastOnExtensionReceiver() { + as Foo /*~> Unit */ + /*as Foo */.foo(x = "string") +} + +fun testValueParameter(vp: Foo<*>): Int { + return vp.() +} + diff --git a/compiler/testData/ir/irText/types/intersectionType1_NI.kt.txt b/compiler/testData/ir/irText/types/intersectionType1_NI.kt.txt new file mode 100644 index 00000000000..08efc161190 --- /dev/null +++ b/compiler/testData/ir/irText/types/intersectionType1_NI.kt.txt @@ -0,0 +1,30 @@ +class In { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +fun select(x: S, y: S): S { + return x +} + +fun foo(a: Array>, b: Array>): Boolean { + return ofType($receiver = select>>(x = a, y = b).get(index = 0), y = true) +} + +inline fun In.ofType(y: Any?): Boolean { + return y is K +} + +fun test() { + val a1: Array> = arrayOf>(elements = [TODO("IrConstructorCall")]) + val a2: Array> = arrayOf>(elements = [TODO("IrConstructorCall")]) + foo(a = a1, b = a2) /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/types/intersectionType1_OI.kt.txt b/compiler/testData/ir/irText/types/intersectionType1_OI.kt.txt new file mode 100644 index 00000000000..68a9dff7d40 --- /dev/null +++ b/compiler/testData/ir/irText/types/intersectionType1_OI.kt.txt @@ -0,0 +1,30 @@ +class In { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +fun select(x: S, y: S): S { + return x +} + +fun foo(a: Array>, b: Array>): Boolean { + return ofType($receiver = select>>(x = a, y = b).get(index = 0), y = true) +} + +inline fun In.ofType(y: Any?): Boolean { + return y is K +} + +fun test() { + val a1: Array> = arrayOf>(elements = [TODO("IrConstructorCall")]) + val a2: Array> = arrayOf>(elements = [TODO("IrConstructorCall")]) + foo(a = a1, b = a2) /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/types/intersectionType2_NI.kt.txt b/compiler/testData/ir/irText/types/intersectionType2_NI.kt.txt new file mode 100644 index 00000000000..36ffdc3287b --- /dev/null +++ b/compiler/testData/ir/irText/types/intersectionType2_NI.kt.txt @@ -0,0 +1,53 @@ +interface A { + + + +} + +interface Foo { + + + +} + +open class B : Foo, A { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +open class C : Foo, A { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +fun run(fn: Function0): T { + return fn.invoke() +} + +fun foo(): Any { + return run(fn = local fun (): Any { + val mm: B = TODO("IrConstructorCall") + val nn: C = TODO("IrConstructorCall") + val c: Any = when { + true -> mm + true -> nn + } + return c + } +) +} + diff --git a/compiler/testData/ir/irText/types/intersectionType2_OI.kt.txt b/compiler/testData/ir/irText/types/intersectionType2_OI.kt.txt new file mode 100644 index 00000000000..36ffdc3287b --- /dev/null +++ b/compiler/testData/ir/irText/types/intersectionType2_OI.kt.txt @@ -0,0 +1,53 @@ +interface A { + + + +} + +interface Foo { + + + +} + +open class B : Foo, A { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +open class C : Foo, A { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +fun run(fn: Function0): T { + return fn.invoke() +} + +fun foo(): Any { + return run(fn = local fun (): Any { + val mm: B = TODO("IrConstructorCall") + val nn: C = TODO("IrConstructorCall") + val c: Any = when { + true -> mm + true -> nn + } + return c + } +) +} + diff --git a/compiler/testData/ir/irText/types/intersectionType3_NI.kt.txt b/compiler/testData/ir/irText/types/intersectionType3_NI.kt.txt new file mode 100644 index 00000000000..32f1d493de0 --- /dev/null +++ b/compiler/testData/ir/irText/types/intersectionType3_NI.kt.txt @@ -0,0 +1,78 @@ +interface In { + + + +} + +inline fun In.isT(): Boolean { + return is T +} + +inline fun In.asT() { + as T /*~> Unit */ +} + +fun sel(x: S, y: S): S { + return x +} + +interface A { + + + +} + +interface B { + + + +} + +interface A1 : A { + + + +} + +interface A2 : A { + + + +} + +interface Z1 : A, B { + + + +} + +interface Z2 : A, B { + + + +} + +fun testInIs1(x: In, y: In): Boolean { + return isT($receiver = sel>(x = x, y = y)) +} + +fun testInIs2(x: In, y: In): Boolean { + return isT($receiver = sel>(x = x, y = y)) +} + +fun testInIs3(x: In, y: In): Boolean { + return isT($receiver = sel>(x = x, y = y)) +} + +fun testInAs1(x: In, y: In) { + return asT($receiver = sel>(x = x, y = y)) +} + +fun testInAs2(x: In, y: In) { + return asT($receiver = sel>(x = x, y = y)) +} + +fun testInAs3(x: In, y: In) { + return asT($receiver = sel>(x = x, y = y)) +} + diff --git a/compiler/testData/ir/irText/types/intersectionType3_OI.kt.txt b/compiler/testData/ir/irText/types/intersectionType3_OI.kt.txt new file mode 100644 index 00000000000..6ea3d70446a --- /dev/null +++ b/compiler/testData/ir/irText/types/intersectionType3_OI.kt.txt @@ -0,0 +1,78 @@ +interface In { + + + +} + +inline fun In.isT(): Boolean { + return is T +} + +inline fun In.asT() { + as T /*~> Unit */ +} + +fun sel(x: S, y: S): S { + return x +} + +interface A { + + + +} + +interface B { + + + +} + +interface A1 : A { + + + +} + +interface A2 : A { + + + +} + +interface Z1 : A, B { + + + +} + +interface Z2 : A, B { + + + +} + +fun testInIs1(x: In, y: In): Boolean { + return isT($receiver = sel>(x = x, y = y)) +} + +fun testInIs2(x: In, y: In): Boolean { + return isT($receiver = sel>(x = x, y = y)) +} + +fun testInIs3(x: In, y: In): Boolean { + return isT($receiver = sel>(x = x, y = y)) +} + +fun testInAs1(x: In, y: In) { + return asT($receiver = sel>(x = x, y = y)) +} + +fun testInAs2(x: In, y: In) { + return asT($receiver = sel>(x = x, y = y)) +} + +fun testInAs3(x: In, y: In) { + return asT($receiver = sel>(x = x, y = y)) +} + diff --git a/compiler/testData/ir/irText/types/kt36143.kt.txt b/compiler/testData/ir/irText/types/kt36143.kt.txt new file mode 100644 index 00000000000..c182da4f6fc --- /dev/null +++ b/compiler/testData/ir/irText/types/kt36143.kt.txt @@ -0,0 +1,4 @@ +fun Array.test(): Int { + return .() +} + diff --git a/compiler/testData/ir/irText/types/localVariableOfIntersectionType_NI.kt.txt b/compiler/testData/ir/irText/types/localVariableOfIntersectionType_NI.kt.txt new file mode 100644 index 00000000000..7c5f4680669 --- /dev/null +++ b/compiler/testData/ir/irText/types/localVariableOfIntersectionType_NI.kt.txt @@ -0,0 +1,44 @@ +interface In { + + + +} + +interface Inv { + abstract val t: T + abstract get + + + + +} + +interface Z { + abstract fun create(x: In, y: In): Inv + + + +} + +interface IA { + abstract fun foo() + + + +} + +interface IB { + abstract fun bar() + + + +} + +fun test(a: In, b: In, z: Z) { + z.create(x = a, y = b).() /*as IA */.foo() + z.create(x = a, y = b).() /*as IB */.bar() + val t: Any = z.create(x = a, y = b).() + t /*as IA */.foo() + t /*as IB */.bar() +} + diff --git a/compiler/testData/ir/irText/types/nullChecks/enhancedNullability.kt.txt b/compiler/testData/ir/irText/types/nullChecks/enhancedNullability.kt.txt new file mode 100644 index 00000000000..ba76c34a25e --- /dev/null +++ b/compiler/testData/ir/irText/types/nullChecks/enhancedNullability.kt.txt @@ -0,0 +1,36 @@ +fun use(s: String) { +} + +fun testUse() { + use(s = notNullString() /*!! String */) +} + +fun testLocalVal() { + val local: String = notNullString() /*!! String */ +} + +fun testReturnValue(): String { + return notNullString() /*!! String */ +} + +val testGlobalVal: String + field = notNullString() /*!! String */ + get + +val testGlobalValGetter: String + get(): String { + return notNullString() /*!! String */ + } + +fun testJUse() { + use(s = nullString()) + use(s = notNullString()) +} + +fun testLocalVarUse() { + val ns: @FlexibleNullability String? = nullString() + use(s = ns) + val nns: String = notNullString() /*!! String */ + use(s = nns) +} + diff --git a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInDestructuringAssignment.kt.txt b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInDestructuringAssignment.kt.txt new file mode 100644 index 00000000000..415a84ae4a2 --- /dev/null +++ b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInDestructuringAssignment.kt.txt @@ -0,0 +1,102 @@ +fun use(x: Any, y: Any) { +} + +class P { + constructor(x: Int, y: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = x + get + + val y: Int + field = y + get + + operator fun component1(): Int { + return .() + } + + operator fun component2(): Int { + return .() + } + + + + +} + +class Q { + constructor(x: T1, y: T2) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: T1 + field = x + get + + val y: T2 + field = y + get + + operator fun component1(): T1 { + return .() + } + + operator fun component2(): T2 { + return .() + } + + + + +} + +fun test1() { + // COMPOSITE { + val tmp0_container: P? = notNullP() + val x: Int = tmp0_container /*!! P */.component1() + val y: Int = tmp0_container /*!! P */.component2() + // } + use(x = x, y = y) +} + +fun test2() { + // COMPOSITE { + val tmp0_container: @FlexibleNullability Q<@NotNull(...) String?, @NotNull(...) String?>? = notNullComponents() + val x: @NotNull(...) String? = tmp0_container /*!! Q<@NotNull(...) String?, @NotNull(...) String?> */.component1() + val y: @NotNull(...) String? = tmp0_container /*!! Q<@NotNull(...) String?, @NotNull(...) String?> */.component2() + // } + use(x = x /*!! @NotNull(...) String */, y = y /*!! @NotNull(...) String */) +} + +fun test2Desugared() { + val tmp: @FlexibleNullability Q<@NotNull(...) String?, @NotNull(...) String?>? = notNullComponents() + val x: @NotNull(...) String = tmp /*!! Q<@NotNull(...) String?, @NotNull(...) String?> */.component1() /*!! @NotNull(...) String */ + val y: @NotNull(...) String = tmp /*!! Q<@NotNull(...) String?, @NotNull(...) String?> */.component2() /*!! @NotNull(...) String */ + use(x = x, y = y) +} + +fun test3() { + // COMPOSITE { + val tmp0_container: Q<@NotNull(...) String?, @NotNull(...) String?>? = notNullQAndComponents() + val x: @NotNull(...) String? = tmp0_container /*!! Q<@NotNull(...) String?, @NotNull(...) String?> */.component1() + val y: @NotNull(...) String? = tmp0_container /*!! Q<@NotNull(...) String?, @NotNull(...) String?> */.component2() + // } + use(x = x /*!! @NotNull(...) String */, y = y /*!! @NotNull(...) String */) +} + +fun test4() { + // COMPOSITE { + val tmp0_container: IndexedValue<@NotNull(...) P?> = first>($receiver = withIndex<@NotNull(...) P?>($receiver = listOfNotNull() /*!! List<@NotNull(...) P?> */)) + val x: Int = tmp0_container.component1() + val y: @NotNull(...) P? = tmp0_container.component2() + // } + use(x = x, y = y /*!! @NotNull(...) P */) +} + diff --git a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.kt.txt b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.kt.txt new file mode 100644 index 00000000000..eb8bed36719 --- /dev/null +++ b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.kt.txt @@ -0,0 +1,138 @@ +fun use(s: P) { +} + +fun testForInListUnused() { + { //BLOCK + val tmp0_iterator: MutableIterator<@NotNull(...) P?> = listOfNotNull() /*!! List<@NotNull(...) P?> */ /*as MutableList<*> */.iterator() + while (tmp0_iterator.hasNext()) { //BLOCK + val x: @NotNull(...) P? = tmp0_iterator.next() + { //BLOCK + } + } + } +} + +fun testForInListDestructured() { + { //BLOCK + val tmp0_iterator: MutableIterator<@NotNull(...) P?> = listOfNotNull() /*!! List<@NotNull(...) P?> */ /*as MutableList<*> */.iterator() + while (tmp0_iterator.hasNext()) { //BLOCK + val tmp1_loop_parameter: @NotNull(...) P? = tmp0_iterator.next() + val x: Int = tmp1_loop_parameter /*!! @NotNull(...) P */.component1() + val y: Int = tmp1_loop_parameter /*!! @NotNull(...) P */.component2() + { //BLOCK + } + } + } +} + +fun testDesugaredForInList() { + val iterator: MutableIterator<@NotNull(...) P?> = listOfNotNull() /*!! List<@NotNull(...) P?> */ /*as MutableList<*> */.iterator() + while (iterator.hasNext()) { //BLOCK + val x: @NotNull(...) P = iterator.next() /*!! @NotNull(...) P */ + } +} + +fun testForInArrayUnused(j: J) { + { //BLOCK + val tmp0_iterator: Iterator = j.arrayOfNotNull() /*!! Array */ /*as Array */.iterator() + while (tmp0_iterator.hasNext()) { //BLOCK + val x: P? = tmp0_iterator.next() + { //BLOCK + } + } + } +} + +fun testForInListUse() { + { //BLOCK + val tmp0_iterator: MutableIterator<@NotNull(...) P?> = listOfNotNull() /*!! List<@NotNull(...) P?> */ /*as MutableList<*> */.iterator() + while (tmp0_iterator.hasNext()) { //BLOCK + val x: @NotNull(...) P? = tmp0_iterator.next() + { //BLOCK + use(s = x /*!! @NotNull(...) P */) + use(s = x) + } + } + } +} + +fun testForInArrayUse(j: J) { + { //BLOCK + val tmp0_iterator: Iterator = j.arrayOfNotNull() /*!! Array */ /*as Array */.iterator() + while (tmp0_iterator.hasNext()) { //BLOCK + val x: P? = tmp0_iterator.next() + { //BLOCK + use(s = x /*!! P */) + use(s = x) + } + } + } +} + +interface K { + abstract fun arrayOfNotNull(): Array