[FIR] Add regression tests for number of issues fixed in K2
List of issues: KT-4113, KT-6822, KT-7389, KT-17817, KT-20223 KT-21463, KT-24503, KT-24737, KT-24779, KT-24901 KT-27261, KT-28668, KT-30497, KT-30756, KT-36958 KT-37365, KT-37490, KT-38288, KT-41038, KT-41721 KT-42136, KT-42169, KT-42449, KT-42715, KT-43553 KT-43603, KT-43846, KT-43936, KT-46288, KT-46301 KT-47373, KT-47484, KT-47490, KT-47495, KT-47750 KT-47815, KT-47870, KT-48975, KT-49024, KT-49045 KT-50134, KT-50160, KT-50550, KT-51045, KT-51143 KT-51796, KT-52262, KT-52424, KT-52860, KT-52934 KT-53086, KT-53494, KT-53671, KT-53752, KT-53819 KT-54478, KT-54518, KT-54931, KT-54990, KT-55138 KT-55379, KT-55555, KT-56243
This commit is contained in:
committed by
Space Team
parent
8ae5213155
commit
aef9b129d2
+356
@@ -536,6 +536,12 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/reifiedTypeOverload.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("returnFromDelegatedConstuctor.kt")
|
||||
public void testReturnFromDelegatedConstuctor() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/returnFromDelegatedConstuctor.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("sealedClass.kt")
|
||||
public void testSealedClass() throws Exception {
|
||||
@@ -719,6 +725,18 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolve/annotations"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt43936.kt")
|
||||
public void testKt43936() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/annotations/kt43936.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt54478.kt")
|
||||
public void testKt54478() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/annotations/kt54478.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt55286.kt")
|
||||
public void testKt55286() throws Exception {
|
||||
@@ -879,6 +897,12 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/arguments/noParameterForName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nullForDifferentProjections.kt")
|
||||
public void testNullForDifferentProjections() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/arguments/nullForDifferentProjections.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("operatorsOverLiterals.kt")
|
||||
public void testOperatorsOverLiterals() throws Exception {
|
||||
@@ -999,6 +1023,12 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/callResolution/arraySetWithPlusAssign.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("chooseOverloadByShapeOfLambda.kt")
|
||||
public void testChooseOverloadByShapeOfLambda() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/callResolution/chooseOverloadByShapeOfLambda.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("companionInvoke.kt")
|
||||
public void testCompanionInvoke() throws Exception {
|
||||
@@ -1083,6 +1113,12 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/callResolution/overloadsWithGenericAndGenericLambda.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("referenceToNestedClass.kt")
|
||||
public void testReferenceToNestedClass() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/callResolution/referenceToNestedClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("safeCallOnTypeAlias.kt")
|
||||
public void testSafeCallOnTypeAlias() throws Exception {
|
||||
@@ -1095,6 +1131,12 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/callResolution/superAny.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("suspendCOnversionForReceiver.kt")
|
||||
public void testSuspendCOnversionForReceiver() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/callResolution/suspendCOnversionForReceiver.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("syntheticPropertiesWrongImplicitReceiver.kt")
|
||||
public void testSyntheticPropertiesWrongImplicitReceiver() throws Exception {
|
||||
@@ -1135,6 +1177,12 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/cfa/initializationInTry.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53819.kt")
|
||||
public void testKt53819() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/cfa/kt53819.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("reassignOfNonLocalProperty_initializedProperties.kt")
|
||||
public void testReassignOfNonLocalProperty_initializedProperties() throws Exception {
|
||||
@@ -1265,6 +1313,12 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/cfg/lambdaAsReturnOfLambda.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("lambdaInIfInTry.kt")
|
||||
public void testLambdaInIfInTry() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/cfg/lambdaInIfInTry.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("lambdaReturningObject.kt")
|
||||
public void testLambdaReturningObject() throws Exception {
|
||||
@@ -1359,11 +1413,77 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolve/checkers"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("complexConflictingProjections.kt")
|
||||
public void testComplexConflictingProjections() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/checkers/complexConflictingProjections.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("importAnnotationWithRequiresOptIn.kt")
|
||||
public void testImportAnnotationWithRequiresOptIn() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/checkers/importAnnotationWithRequiresOptIn.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("internalImplicitInvokeFromInlineFun.kt")
|
||||
public void testInternalImplicitInvokeFromInlineFun() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/checkers/internalImplicitInvokeFromInlineFun.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("internalSuperCallFromInlineFun.kt")
|
||||
public void testInternalSuperCallFromInlineFun() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/checkers/internalSuperCallFromInlineFun.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("invalidLhsOfClassLiteral.kt")
|
||||
public void testInvalidLhsOfClassLiteral() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/checkers/invalidLhsOfClassLiteral.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("notUselessCast_1.kt")
|
||||
public void testNotUselessCast_1() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/checkers/notUselessCast_1.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("notUselessCast_2.kt")
|
||||
public void testNotUselessCast_2() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/checkers/notUselessCast_2.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("notUselessCast_3.kt")
|
||||
public void testNotUselessCast_3() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/checkers/notUselessCast_3.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("recursiveDependencyBetweenReturnTypeAndSupertype.kt")
|
||||
public void testRecursiveDependencyBetweenReturnTypeAndSupertype() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/checkers/recursiveDependencyBetweenReturnTypeAndSupertype.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("redundantNullCheckOnAsCast.kt")
|
||||
public void testRedundantNullCheckOnAsCast() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/checkers/redundantNullCheckOnAsCast.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("unsuccessfullCastToStartProjectedType.kt")
|
||||
public void testUnsuccessfullCastToStartProjectedType() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/checkers/unsuccessfullCastToStartProjectedType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("uselessCastLeadsToRecursiveProblem.kt")
|
||||
public void testUselessCastLeadsToRecursiveProblem() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/checkers/uselessCastLeadsToRecursiveProblem.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@@ -1443,6 +1563,12 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/contracts/contractFromOtherModule_samePackage.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("contractOnInfixFunction.kt")
|
||||
public void testContractOnInfixFunction() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/contracts/contractOnInfixFunction.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("disabledFeature.kt")
|
||||
public void testDisabledFeature() throws Exception {
|
||||
@@ -1454,6 +1580,12 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
|
||||
public void testGenericContract() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/contracts/genericContract.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inPlaceAfterVararg.kt")
|
||||
public void testInPlaceAfterVararg() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/contracts/inPlaceAfterVararg.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@@ -1910,6 +2042,12 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotatedBranch.kt")
|
||||
public void testAnnotatedBranch() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive/annotatedBranch.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("exhaustiveWhenAndDNNType.kt")
|
||||
public void testExhaustiveWhenAndDNNType() throws Exception {
|
||||
@@ -1958,6 +2096,12 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive/exhaustiveness_sealedSubClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("exhaustiveness_smartcastedBoolean.kt")
|
||||
public void testExhaustiveness_smartcastedBoolean() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive/exhaustiveness_smartcastedBoolean.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nestedIfInLambda.kt")
|
||||
public void testNestedIfInLambda() throws Exception {
|
||||
@@ -1969,6 +2113,18 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
|
||||
public void testNonExhaustiveWhenWithCoercionToUnit() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive/nonExhaustiveWhenWithCoercionToUnit.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("sameBranchMultipleConditions.kt")
|
||||
public void testSameBranchMultipleConditions() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive/sameBranchMultipleConditions.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("smartcastToExhaustiveInterface.kt")
|
||||
public void testSmartcastToExhaustiveInterface() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive/smartcastToExhaustiveInterface.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3117,6 +3273,12 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/inference/intersectionTypesInConstraints.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("javaCollector.kt")
|
||||
public void testJavaCollector() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/inference/javaCollector.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt40131.kt")
|
||||
public void testKt40131() throws Exception {
|
||||
@@ -3129,6 +3291,24 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/inference/kt41989.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53494.kt")
|
||||
public void testKt53494() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/inference/kt53494.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt54990.kt")
|
||||
public void testKt54990() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/inference/kt54990.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt55555.kt")
|
||||
public void testKt55555() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/inference/kt55555.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("lambdaAsReturnStatementOfLambda.kt")
|
||||
public void testLambdaAsReturnStatementOfLambda() throws Exception {
|
||||
@@ -3183,6 +3363,18 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/inference/receiverWithCapturedType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("recursiveSelfTypes.kt")
|
||||
public void testRecursiveSelfTypes() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/inference/recursiveSelfTypes.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("selfTypeFromJava.kt")
|
||||
public void testSelfTypeFromJava() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/inference/selfTypeFromJava.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("simpleCapturedTypes.kt")
|
||||
public void testSimpleCapturedTypes() throws Exception {
|
||||
@@ -3200,6 +3392,22 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
|
||||
public void testUnitUpperBound() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/inference/unitUpperBound.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/inference/builderInference")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class BuilderInference {
|
||||
@Test
|
||||
public void testAllFilesPresentInBuilderInference() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolve/inference/builderInference"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ifInBuildMap.kt")
|
||||
public void testIfInBuildMap() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/inference/builderInference/ifInBuildMap.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@@ -3459,6 +3667,12 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolve/problems"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("classLiteralWithExclExcl.kt")
|
||||
public void testClassLiteralWithExclExcl() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/problems/classLiteralWithExclExcl.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("compilerPhase.kt")
|
||||
public void testCompilerPhase() throws Exception {
|
||||
@@ -3537,6 +3751,12 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/problems/innerClassHierarchy.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("invalidCode.kt")
|
||||
public void testInvalidCode() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/problems/invalidCode.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("javaClassWithEmptyAnnotationName.kt")
|
||||
public void testJavaClassWithEmptyAnnotationName() throws Exception {
|
||||
@@ -3602,6 +3822,12 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
|
||||
public void testTransform() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/problems/transform.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeArgumentsOnThis.kt")
|
||||
public void testTypeArgumentsOnThis() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/problems/typeArgumentsOnThis.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@@ -3613,6 +3839,12 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolve/properties"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("assignToStarProjectedType.kt")
|
||||
public void testAssignToStarProjectedType() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/properties/assignToStarProjectedType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("getterWithEarlyReturn.kt")
|
||||
public void testGetterWithEarlyReturn() throws Exception {
|
||||
@@ -3705,6 +3937,18 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolve/references"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ambigousParenthesizedReference.kt")
|
||||
public void testAmbigousParenthesizedReference() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/references/ambigousParenthesizedReference.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("incorrectReferenceOnInnerClassMember.kt")
|
||||
public void testIncorrectReferenceOnInnerClassMember() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/references/incorrectReferenceOnInnerClassMember.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("integerLiteralInLhs.kt")
|
||||
public void testIntegerLiteralInLhs() throws Exception {
|
||||
@@ -3729,6 +3973,12 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/references/referenceToField.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("referenceToSyntheticJavaPropertyWithProjection.kt")
|
||||
public void testReferenceToSyntheticJavaPropertyWithProjection() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/references/referenceToSyntheticJavaPropertyWithProjection.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("simple.kt")
|
||||
public void testSimple() throws Exception {
|
||||
@@ -3740,6 +3990,12 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
|
||||
public void testSuperMember() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/references/superMember.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("unresovledReferenceInFinally.kt")
|
||||
public void testUnresovledReferenceInFinally() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/references/unresovledReferenceInFinally.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@@ -3821,6 +4077,12 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/samConversions/notSamBecauseOfSupertype.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nothingVararg.kt")
|
||||
public void testNothingVararg() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/samConversions/nothingVararg.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("runnable.kt")
|
||||
public void testRunnable() throws Exception {
|
||||
@@ -3979,6 +4241,12 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/casts.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("contractSafeCall.kt")
|
||||
public void testContractSafeCall() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/contractSafeCall.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("equalsAndIdentity.kt")
|
||||
public void testEqualsAndIdentity() throws Exception {
|
||||
@@ -4063,6 +4331,12 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/smartcastInByClause.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("smartcastOnFunctionalType.kt")
|
||||
public void testSmartcastOnFunctionalType() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/smartcastOnFunctionalType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("smartcastOnImplicitReceiverOfCallableReference.kt")
|
||||
public void testSmartcastOnImplicitReceiverOfCallableReference() throws Exception {
|
||||
@@ -4075,6 +4349,12 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/smartcastToNothing.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("smartcastToStarProjectedType.kt")
|
||||
public void testSmartcastToStarProjectedType() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/smartcastToStarProjectedType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("smartcastToTypeParameter.kt")
|
||||
public void testSmartcastToTypeParameter() throws Exception {
|
||||
@@ -4093,12 +4373,24 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/smartcastsFromEquals_sameModule.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeOfLambdaWithSmartcast.kt")
|
||||
public void testTypeOfLambdaWithSmartcast() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/typeOfLambdaWithSmartcast.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("unstableSmartcastAndAmbiguity.kt")
|
||||
public void testUnstableSmartcastAndAmbiguity() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/unstableSmartcastAndAmbiguity.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("valCapturedInLambda.kt")
|
||||
public void testValCapturedInLambda() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/valCapturedInLambda.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@@ -4142,6 +4434,18 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("assignToBoundSmartcastedVariable.kt")
|
||||
public void testAssignToBoundSmartcastedVariable() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/assignToBoundSmartcastedVariable.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("boundSmartcastWithProjection.kt")
|
||||
public void testBoundSmartcastWithProjection() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/boundSmartcastWithProjection.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("boundSmartcasts.kt")
|
||||
public void testBoundSmartcasts() throws Exception {
|
||||
@@ -4176,12 +4480,24 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("earlyReturnInNonExhaustiveWhen.kt")
|
||||
public void testEarlyReturnInNonExhaustiveWhen() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures/earlyReturnInNonExhaustiveWhen.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("elvis.kt")
|
||||
public void testElvis() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures/elvis.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("returnFromWhen.kt")
|
||||
public void testReturnFromWhen() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures/returnFromWhen.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("returns.kt")
|
||||
public void testReturns() throws Exception {
|
||||
@@ -4256,6 +4572,12 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/loops/dataFlowInfoFromWhileCondition.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("elvisAtTheEndOfLoop.kt")
|
||||
public void testElvisAtTheEndOfLoop() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/loops/elvisAtTheEndOfLoop.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("endlessLoops.kt")
|
||||
public void testEndlessLoops() throws Exception {
|
||||
@@ -4277,6 +4599,12 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
|
||||
public void testInvoke() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/problems/invoke.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("noSmartcastToNullableNothing.kt")
|
||||
public void testNoSmartcastToNullableNothing() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/problems/noSmartcastToNullableNothing.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@@ -4476,6 +4804,28 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/typeParameters")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class TypeParameters {
|
||||
@Test
|
||||
public void testAllFilesPresentInTypeParameters() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolve/typeParameters"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt38288.kt")
|
||||
public void testKt38288() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/typeParameters/kt38288.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("starProjectionForMultipleBounds.kt")
|
||||
public void testStarProjectionForMultipleBounds() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/typeParameters/starProjectionForMultipleBounds.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/types")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@@ -4631,6 +4981,12 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/visibility/privateAliasInSamePackage.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("protectedAnnotationClassFromJava.kt")
|
||||
public void testProtectedAnnotationClassFromJava() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/visibility/protectedAnnotationClassFromJava.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("protectedInCompanion.kt")
|
||||
public void testProtectedInCompanion() throws Exception {
|
||||
|
||||
+6
@@ -12194,6 +12194,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
|
||||
runTest("compiler/testData/diagnostics/tests/generics/anonymousObjectSupertypeWithTypeParameterFromFunction.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("approximationOfInProjection.kt")
|
||||
public void testApproximationOfInProjection() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/generics/approximationOfInProjection.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("argumentsForT.kt")
|
||||
public void testArgumentsForT() throws Exception {
|
||||
|
||||
+306
@@ -454,6 +454,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/reifiedTypeOverload.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("returnFromDelegatedConstuctor.kt")
|
||||
public void testReturnFromDelegatedConstuctor() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/returnFromDelegatedConstuctor.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("sealedClass.kt")
|
||||
public void testSealedClass() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/sealedClass.kt");
|
||||
@@ -611,6 +616,16 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolve/annotations"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("kt43936.kt")
|
||||
public void testKt43936() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/annotations/kt43936.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt54478.kt")
|
||||
public void testKt54478() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/annotations/kt54478.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt55286.kt")
|
||||
public void testKt55286() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/annotations/kt55286.kt");
|
||||
@@ -749,6 +764,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/arguments/noParameterForName.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nullForDifferentProjections.kt")
|
||||
public void testNullForDifferentProjections() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/arguments/nullForDifferentProjections.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("operatorsOverLiterals.kt")
|
||||
public void testOperatorsOverLiterals() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/arguments/operatorsOverLiterals.kt");
|
||||
@@ -863,6 +883,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/callResolution/arraySetWithPlusAssign.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("chooseOverloadByShapeOfLambda.kt")
|
||||
public void testChooseOverloadByShapeOfLambda() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/callResolution/chooseOverloadByShapeOfLambda.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("companionInvoke.kt")
|
||||
public void testCompanionInvoke() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/callResolution/companionInvoke.kt");
|
||||
@@ -933,6 +958,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/callResolution/overloadsWithGenericAndGenericLambda.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("referenceToNestedClass.kt")
|
||||
public void testReferenceToNestedClass() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/callResolution/referenceToNestedClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("safeCallOnTypeAlias.kt")
|
||||
public void testSafeCallOnTypeAlias() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/callResolution/safeCallOnTypeAlias.kt");
|
||||
@@ -943,6 +973,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/callResolution/superAny.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("suspendCOnversionForReceiver.kt")
|
||||
public void testSuspendCOnversionForReceiver() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/callResolution/suspendCOnversionForReceiver.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("syntheticPropertiesWrongImplicitReceiver.kt")
|
||||
public void testSyntheticPropertiesWrongImplicitReceiver() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/callResolution/syntheticPropertiesWrongImplicitReceiver.kt");
|
||||
@@ -981,6 +1016,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/cfa/initializationInTry.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt53819.kt")
|
||||
public void testKt53819() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/cfa/kt53819.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("reassignOfNonLocalProperty_initializedProperties.kt")
|
||||
public void testReassignOfNonLocalProperty_initializedProperties() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/cfa/reassignOfNonLocalProperty_initializedProperties.kt");
|
||||
@@ -1094,6 +1134,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/cfg/lambdaAsReturnOfLambda.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("lambdaInIfInTry.kt")
|
||||
public void testLambdaInIfInTry() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/cfg/lambdaInIfInTry.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("lambdaReturningObject.kt")
|
||||
public void testLambdaReturningObject() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/cfg/lambdaReturningObject.kt");
|
||||
@@ -1177,10 +1222,65 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolve/checkers"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("complexConflictingProjections.kt")
|
||||
public void testComplexConflictingProjections() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/checkers/complexConflictingProjections.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("importAnnotationWithRequiresOptIn.kt")
|
||||
public void testImportAnnotationWithRequiresOptIn() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/checkers/importAnnotationWithRequiresOptIn.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("internalImplicitInvokeFromInlineFun.kt")
|
||||
public void testInternalImplicitInvokeFromInlineFun() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/checkers/internalImplicitInvokeFromInlineFun.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("internalSuperCallFromInlineFun.kt")
|
||||
public void testInternalSuperCallFromInlineFun() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/checkers/internalSuperCallFromInlineFun.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("invalidLhsOfClassLiteral.kt")
|
||||
public void testInvalidLhsOfClassLiteral() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/checkers/invalidLhsOfClassLiteral.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("notUselessCast_1.kt")
|
||||
public void testNotUselessCast_1() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/checkers/notUselessCast_1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("notUselessCast_2.kt")
|
||||
public void testNotUselessCast_2() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/checkers/notUselessCast_2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("notUselessCast_3.kt")
|
||||
public void testNotUselessCast_3() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/checkers/notUselessCast_3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("recursiveDependencyBetweenReturnTypeAndSupertype.kt")
|
||||
public void testRecursiveDependencyBetweenReturnTypeAndSupertype() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/checkers/recursiveDependencyBetweenReturnTypeAndSupertype.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("redundantNullCheckOnAsCast.kt")
|
||||
public void testRedundantNullCheckOnAsCast() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/checkers/redundantNullCheckOnAsCast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unsuccessfullCastToStartProjectedType.kt")
|
||||
public void testUnsuccessfullCastToStartProjectedType() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/checkers/unsuccessfullCastToStartProjectedType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("uselessCastLeadsToRecursiveProblem.kt")
|
||||
public void testUselessCastLeadsToRecursiveProblem() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/checkers/uselessCastLeadsToRecursiveProblem.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/constVal")
|
||||
@@ -1261,6 +1361,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/contracts/contractFromOtherModule_samePackage.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("contractOnInfixFunction.kt")
|
||||
public void testContractOnInfixFunction() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/contracts/contractOnInfixFunction.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("disabledFeature.kt")
|
||||
public void testDisabledFeature() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/contracts/disabledFeature.kt");
|
||||
@@ -1270,6 +1375,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
public void testGenericContract() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/contracts/genericContract.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inPlaceAfterVararg.kt")
|
||||
public void testInPlaceAfterVararg() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/contracts/inPlaceAfterVararg.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/delegates")
|
||||
@@ -1678,6 +1788,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("annotatedBranch.kt")
|
||||
public void testAnnotatedBranch() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive/annotatedBranch.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("exhaustiveWhenAndDNNType.kt")
|
||||
public void testExhaustiveWhenAndDNNType() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive/exhaustiveWhenAndDNNType.kt");
|
||||
@@ -1718,6 +1833,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive/exhaustiveness_sealedSubClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("exhaustiveness_smartcastedBoolean.kt")
|
||||
public void testExhaustiveness_smartcastedBoolean() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive/exhaustiveness_smartcastedBoolean.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nestedIfInLambda.kt")
|
||||
public void testNestedIfInLambda() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive/nestedIfInLambda.kt");
|
||||
@@ -1727,6 +1847,16 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
public void testNonExhaustiveWhenWithCoercionToUnit() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive/nonExhaustiveWhenWithCoercionToUnit.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("sameBranchMultipleConditions.kt")
|
||||
public void testSameBranchMultipleConditions() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive/sameBranchMultipleConditions.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("smartcastToExhaustiveInterface.kt")
|
||||
public void testSmartcastToExhaustiveInterface() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive/smartcastToExhaustiveInterface.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2740,6 +2870,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/inference/intersectionTypesInConstraints.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollector.kt")
|
||||
public void testJavaCollector() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/inference/javaCollector.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt40131.kt")
|
||||
public void testKt40131() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/inference/kt40131.kt");
|
||||
@@ -2750,6 +2885,21 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/inference/kt41989.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt53494.kt")
|
||||
public void testKt53494() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/inference/kt53494.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt54990.kt")
|
||||
public void testKt54990() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/inference/kt54990.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt55555.kt")
|
||||
public void testKt55555() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/inference/kt55555.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("lambdaAsReturnStatementOfLambda.kt")
|
||||
public void testLambdaAsReturnStatementOfLambda() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/inference/lambdaAsReturnStatementOfLambda.kt");
|
||||
@@ -2795,6 +2945,16 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/inference/receiverWithCapturedType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("recursiveSelfTypes.kt")
|
||||
public void testRecursiveSelfTypes() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/inference/recursiveSelfTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("selfTypeFromJava.kt")
|
||||
public void testSelfTypeFromJava() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/inference/selfTypeFromJava.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleCapturedTypes.kt")
|
||||
public void testSimpleCapturedTypes() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/inference/simpleCapturedTypes.kt");
|
||||
@@ -2809,6 +2969,24 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
public void testUnitUpperBound() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/inference/unitUpperBound.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/inference/builderInference")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class BuilderInference extends AbstractLazyBodyIsNotTouchedTilContractsPhaseTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInBuilderInference() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolve/inference/builderInference"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("ifInBuildMap.kt")
|
||||
public void testIfInBuildMap() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/inference/builderInference/ifInBuildMap.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/inlineClasses")
|
||||
@@ -3053,6 +3231,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolve/problems"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("classLiteralWithExclExcl.kt")
|
||||
public void testClassLiteralWithExclExcl() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/problems/classLiteralWithExclExcl.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compilerPhase.kt")
|
||||
public void testCompilerPhase() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/problems/compilerPhase.kt");
|
||||
@@ -3118,6 +3301,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/problems/innerClassHierarchy.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("invalidCode.kt")
|
||||
public void testInvalidCode() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/problems/invalidCode.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaClassWithEmptyAnnotationName.kt")
|
||||
public void testJavaClassWithEmptyAnnotationName() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/problems/javaClassWithEmptyAnnotationName.kt");
|
||||
@@ -3172,6 +3360,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
public void testTransform() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/problems/transform.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeArgumentsOnThis.kt")
|
||||
public void testTypeArgumentsOnThis() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/problems/typeArgumentsOnThis.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/properties")
|
||||
@@ -3186,6 +3379,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolve/properties"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("assignToStarProjectedType.kt")
|
||||
public void testAssignToStarProjectedType() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/properties/assignToStarProjectedType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("getterWithEarlyReturn.kt")
|
||||
public void testGetterWithEarlyReturn() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/properties/getterWithEarlyReturn.kt");
|
||||
@@ -3272,6 +3470,16 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolve/references"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("ambigousParenthesizedReference.kt")
|
||||
public void testAmbigousParenthesizedReference() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/references/ambigousParenthesizedReference.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("incorrectReferenceOnInnerClassMember.kt")
|
||||
public void testIncorrectReferenceOnInnerClassMember() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/references/incorrectReferenceOnInnerClassMember.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("integerLiteralInLhs.kt")
|
||||
public void testIntegerLiteralInLhs() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/references/integerLiteralInLhs.kt");
|
||||
@@ -3292,6 +3500,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/references/referenceToField.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("referenceToSyntheticJavaPropertyWithProjection.kt")
|
||||
public void testReferenceToSyntheticJavaPropertyWithProjection() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/references/referenceToSyntheticJavaPropertyWithProjection.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple.kt")
|
||||
public void testSimple() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/references/simple.kt");
|
||||
@@ -3301,6 +3514,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
public void testSuperMember() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/references/superMember.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unresovledReferenceInFinally.kt")
|
||||
public void testUnresovledReferenceInFinally() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/references/unresovledReferenceInFinally.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/samConstructors")
|
||||
@@ -3378,6 +3596,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/samConversions/notSamBecauseOfSupertype.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nothingVararg.kt")
|
||||
public void testNothingVararg() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/samConversions/nothingVararg.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("runnable.kt")
|
||||
public void testRunnable() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/samConversions/runnable.kt");
|
||||
@@ -3519,6 +3742,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/casts.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("contractSafeCall.kt")
|
||||
public void testContractSafeCall() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/contractSafeCall.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("equalsAndIdentity.kt")
|
||||
public void testEqualsAndIdentity() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/equalsAndIdentity.kt");
|
||||
@@ -3589,6 +3817,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/smartcastInByClause.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("smartcastOnFunctionalType.kt")
|
||||
public void testSmartcastOnFunctionalType() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/smartcastOnFunctionalType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("smartcastOnImplicitReceiverOfCallableReference.kt")
|
||||
public void testSmartcastOnImplicitReceiverOfCallableReference() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/smartcastOnImplicitReceiverOfCallableReference.kt");
|
||||
@@ -3599,6 +3832,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/smartcastToNothing.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("smartcastToStarProjectedType.kt")
|
||||
public void testSmartcastToStarProjectedType() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/smartcastToStarProjectedType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("smartcastToTypeParameter.kt")
|
||||
public void testSmartcastToTypeParameter() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/smartcastToTypeParameter.kt");
|
||||
@@ -3614,11 +3852,21 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/smartcastsFromEquals_sameModule.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeOfLambdaWithSmartcast.kt")
|
||||
public void testTypeOfLambdaWithSmartcast() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/typeOfLambdaWithSmartcast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unstableSmartcastAndAmbiguity.kt")
|
||||
public void testUnstableSmartcastAndAmbiguity() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/unstableSmartcastAndAmbiguity.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("valCapturedInLambda.kt")
|
||||
public void testValCapturedInLambda() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/valCapturedInLambda.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
@@ -3664,6 +3912,16 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("assignToBoundSmartcastedVariable.kt")
|
||||
public void testAssignToBoundSmartcastedVariable() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/assignToBoundSmartcastedVariable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("boundSmartcastWithProjection.kt")
|
||||
public void testBoundSmartcastWithProjection() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/boundSmartcastWithProjection.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("boundSmartcasts.kt")
|
||||
public void testBoundSmartcasts() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/boundSmartcasts.kt");
|
||||
@@ -3697,11 +3955,21 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("earlyReturnInNonExhaustiveWhen.kt")
|
||||
public void testEarlyReturnInNonExhaustiveWhen() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures/earlyReturnInNonExhaustiveWhen.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("elvis.kt")
|
||||
public void testElvis() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures/elvis.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("returnFromWhen.kt")
|
||||
public void testReturnFromWhen() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures/returnFromWhen.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("returns.kt")
|
||||
public void testReturns() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures/returns.kt");
|
||||
@@ -3773,6 +4041,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/loops/dataFlowInfoFromWhileCondition.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("elvisAtTheEndOfLoop.kt")
|
||||
public void testElvisAtTheEndOfLoop() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/loops/elvisAtTheEndOfLoop.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("endlessLoops.kt")
|
||||
public void testEndlessLoops() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/loops/endlessLoops.kt");
|
||||
@@ -3795,6 +4068,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
public void testInvoke() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/problems/invoke.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noSmartcastToNullableNothing.kt")
|
||||
public void testNoSmartcastToNullableNothing() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/problems/noSmartcastToNullableNothing.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/smartcasts/receivers")
|
||||
@@ -3994,6 +4272,29 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/typeParameters")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class TypeParameters extends AbstractLazyBodyIsNotTouchedTilContractsPhaseTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInTypeParameters() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolve/typeParameters"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("kt38288.kt")
|
||||
public void testKt38288() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/typeParameters/kt38288.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("starProjectionForMultipleBounds.kt")
|
||||
public void testStarProjectionForMultipleBounds() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/typeParameters/starProjectionForMultipleBounds.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/types")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
@@ -4137,6 +4438,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/visibility/privateAliasInSamePackage.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("protectedAnnotationClassFromJava.kt")
|
||||
public void testProtectedAnnotationClassFromJava() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/visibility/protectedAnnotationClassFromJava.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("protectedInCompanion.kt")
|
||||
public void testProtectedInCompanion() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/visibility/protectedInCompanion.kt");
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
FILE: kt43936.kt
|
||||
public abstract interface Operation<T> : R|kotlin/Any| {
|
||||
}
|
||||
public final class FooOperation : R|Operation<FooOperation.Boom>| {
|
||||
public constructor(foo: R|kotlin/String|): R|FooOperation| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final val foo: R|kotlin/String| = R|<local>/foo|
|
||||
public get(): R|kotlin/String|
|
||||
|
||||
@R|kotlin/Suppress|(names = vararg(String(test))) public final class Boom : R|kotlin/Any| {
|
||||
public constructor(bar: R|kotlin/String|): R|FooOperation.Boom| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final val bar: R|kotlin/String| = R|<local>/bar|
|
||||
public get(): R|kotlin/String|
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// ISSUE: KT-43936
|
||||
// WITH_STDLIB
|
||||
|
||||
import FooOperation.*
|
||||
|
||||
interface Operation<T>
|
||||
|
||||
class FooOperation(val foo: String) : Operation<Boom> {
|
||||
|
||||
@Suppress("test")
|
||||
class Boom(val bar: String)
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
FILE: kt54478.kt
|
||||
@FILE:R|kotlin/Suppress|(names = vararg(String(INVISIBLE_REFERENCE), String(INVISIBLE_MEMBER)))
|
||||
public final fun <T : R|kotlin/Any|> test(block: R|kotlin/Any.() -> T|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun <T : R|kotlin/Any|> test(block: R|@NoInfer T|): R|kotlin/Unit| {
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// ISSUE: KT-54478
|
||||
|
||||
@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
|
||||
|
||||
import kotlin.internal.NoInfer
|
||||
|
||||
fun <T : Any> test(block: Any.() -> T) {}
|
||||
fun <T : Any> test(block: @NoInfer T) {}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
FILE: nullForDifferentProjections.kt
|
||||
public abstract interface SomeFace<T> : R|kotlin/Any| {
|
||||
}
|
||||
public final class SomeGene<T> : R|kotlin/Any| {
|
||||
public constructor<T>(): R|SomeGene<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final fun setFace(face: R|SomeFace<T>?|): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
public final fun setString(string: R|kotlin/String?|): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
}
|
||||
public final fun nullTypeArg(invP: R|SomeGene<kotlin/Any>|, inP: R|SomeGene<in kotlin/Any>|, outP: R|SomeGene<out kotlin/Any>|): R|kotlin/Unit| {
|
||||
R|<local>/invP|.R|SubstitutionOverride</SomeGene.setFace: R|kotlin/Unit|>|(Null(null))
|
||||
R|<local>/invP|.R|SubstitutionOverride</SomeGene.setString: R|kotlin/Unit|>|(Null(null))
|
||||
R|<local>/inP|.R|SubstitutionOverride</SomeGene.setFace: R|kotlin/Unit|>|(Null(null))
|
||||
R|<local>/inP|.R|SubstitutionOverride</SomeGene.setString: R|kotlin/Unit|>|(Null(null))
|
||||
R|<local>/outP|.R|SubstitutionOverride</SomeGene.setFace: R|kotlin/Unit|>|(Null(null))
|
||||
R|<local>/outP|.R|SubstitutionOverride</SomeGene.setString: R|kotlin/Unit|>|(Null(null))
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// ISSUE: KT-37490
|
||||
|
||||
interface SomeFace<T>
|
||||
|
||||
class SomeGene<T> {
|
||||
fun setFace(face: SomeFace<T>?) {}
|
||||
fun setString(string: String?) {}
|
||||
}
|
||||
|
||||
fun nullTypeArg(invP: SomeGene<Any>, inP: SomeGene<in Any>, outP: SomeGene<out Any>) {
|
||||
invP.setFace(null)
|
||||
invP.setString(null)
|
||||
inP.setFace(null)
|
||||
inP.setString(null)
|
||||
outP.setFace(null)
|
||||
outP.setString(null)
|
||||
}
|
||||
Vendored
+32
@@ -0,0 +1,32 @@
|
||||
FILE: chooseOverloadByShapeOfLambda.kt
|
||||
public final fun foo(x: R|(@R|kotlin/ParameterName|(name = String(a)) kotlin/Int) -> kotlin/Unit|): R|kotlin/Int| {
|
||||
^foo Int(1)
|
||||
}
|
||||
public final fun foo(x: R|(@R|kotlin/ParameterName|(name = String(a)) kotlin/Int, @R|kotlin/ParameterName|(name = String(b)) kotlin/String) -> kotlin/Unit|): R|kotlin/String| {
|
||||
^foo String()
|
||||
}
|
||||
public final fun takeInt(x: R|kotlin/Int|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun takeString(x: R|kotlin/String|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun test_1(): R|kotlin/Unit| {
|
||||
lval res: R|kotlin/Int| = R|/foo|(<L> = foo@fun <anonymous>(x: R|@R|kotlin/ParameterName|(name = String(a)) kotlin/Int|): R|kotlin/Unit| <inline=NoInline> {
|
||||
^@foo Unit
|
||||
}
|
||||
)
|
||||
R|/takeInt|(R|<local>/res|)
|
||||
}
|
||||
public final fun test_2(): R|kotlin/Unit| {
|
||||
lval res: R|kotlin/String| = R|/foo|(<L> = foo@fun <anonymous>(x: R|@R|kotlin/ParameterName|(name = String(a)) kotlin/Int|, y: R|@R|kotlin/ParameterName|(name = String(b)) kotlin/String|): R|kotlin/Unit| <inline=NoInline> {
|
||||
^@foo Unit
|
||||
}
|
||||
)
|
||||
R|/takeString|(R|<local>/res|)
|
||||
}
|
||||
public final fun test_3(): R|kotlin/Unit| {
|
||||
lval res: R|kotlin/Int| = R|/foo|(<L> = foo@fun <anonymous>(it: R|@R|kotlin/ParameterName|(name = String(a)) kotlin/Int|): R|kotlin/Unit| <inline=NoInline> {
|
||||
^@foo Unit
|
||||
}
|
||||
)
|
||||
R|/takeInt|(R|<local>/res|)
|
||||
}
|
||||
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
// ISSUE: KT-42715
|
||||
|
||||
fun foo(x: (a: Int) -> Unit): Int = 1 // (1)
|
||||
fun foo(x: (a: Int, b: String) -> Unit): String = "" // (2)
|
||||
|
||||
fun takeInt(x: Int) {}
|
||||
fun takeString(x: String) {}
|
||||
|
||||
fun test_1() {
|
||||
val res = foo { x -> } // (1)
|
||||
takeInt(res)
|
||||
}
|
||||
|
||||
fun test_2() {
|
||||
val res = foo { x, y -> } // (2)
|
||||
takeString(res)
|
||||
}
|
||||
|
||||
fun test_3() {
|
||||
val res = foo {} // (1)
|
||||
takeInt(res)
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
FILE: referenceToNestedClass.kt
|
||||
public final class Param : R|kotlin/Any| {
|
||||
public constructor(): R|Param| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public open class Base : R|kotlin/Any| {
|
||||
public constructor(param: R|Param|): R|Base| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final val param: R|Param| = R|<local>/param|
|
||||
public get(): R|Param|
|
||||
|
||||
}
|
||||
public final class Outer : R|Base| {
|
||||
public constructor(param: R|Param|): R|Outer| {
|
||||
super<R|Base|>(R|<local>/param|)
|
||||
}
|
||||
|
||||
public final class Nested : R|Base| {
|
||||
public constructor(param: R|Param|): R|Outer.Nested| {
|
||||
super<R|Base|>(R|<local>/param|)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
public final fun funWithCtor(ctor: R|kotlin/reflect/KFunction1<Param, Base>|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun main(): R|kotlin/Unit| {
|
||||
R|/funWithCtor|(::R|/Outer.Outer|)
|
||||
R|/funWithCtor|(::R|/Outer.Nested.Nested|)
|
||||
R|/funWithCtor|(Q|Outer|::R|/Outer.Nested.Nested|)
|
||||
R|/funWithCtor|(Q|Outer|::R|/Outer.Nested.Nested|::R|SubstitutionOverride<kotlin/reflect/KFunction1.invoke: R|Outer.Nested|>|)
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
// ISSUE: KT-41038
|
||||
|
||||
import kotlin.reflect.*
|
||||
import Outer.Nested
|
||||
|
||||
class Param
|
||||
|
||||
open class Base(val param: Param)
|
||||
|
||||
class Outer(param: Param) : Base(param) {
|
||||
class Nested(param: Param) : Base(param)
|
||||
}
|
||||
|
||||
fun funWithCtor(ctor: KFunction1<Param, Base>) {}
|
||||
|
||||
fun main() {
|
||||
funWithCtor(::Outer)
|
||||
funWithCtor(::Nested)
|
||||
funWithCtor(Outer::Nested)
|
||||
funWithCtor(Outer::Nested::invoke)
|
||||
}
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
FILE: suspendCOnversionForReceiver.kt
|
||||
public final fun R|suspend () -> kotlin/Unit|.extensionFunc(): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun parameterFunc(func: R|suspend () -> kotlin/Unit|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun testFunc(): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun main(): R|kotlin/Unit| {
|
||||
R|/parameterFunc|(::R|/testFunc|)
|
||||
::R|/testFunc|.R|/extensionFunc|()
|
||||
}
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
// ISSUE: KT-46288
|
||||
|
||||
fun (suspend () -> Unit).extensionFunc() {}
|
||||
fun parameterFunc(func: suspend () -> Unit) {}
|
||||
fun testFunc() {}
|
||||
|
||||
fun main() {
|
||||
parameterFunc(::testFunc)
|
||||
(::testFunc).extensionFunc()
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
FILE: kt53819.kt
|
||||
public final fun bar(): R|kotlin/Unit| {
|
||||
local final class Foo : R|kotlin/Any| {
|
||||
private final var _x: R|kotlin/Int|
|
||||
private get(): R|kotlin/Int|
|
||||
private set(value: R|kotlin/Int|): R|kotlin/Unit|
|
||||
|
||||
public constructor(x: R|kotlin/Int|): R|Foo| {
|
||||
super<R|kotlin/Any|>()
|
||||
this@R|/Foo|.R|<local>/_x| = R|<local>/x|
|
||||
}
|
||||
|
||||
public final val x: R|kotlin/Int|
|
||||
public get(): R|kotlin/Int| {
|
||||
^ this@R|/Foo|.R|<local>/_x|
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// ISSUE: KT-53819
|
||||
fun bar() {
|
||||
class Foo {
|
||||
private var _x: Int
|
||||
|
||||
constructor(x: Int) {
|
||||
this._x = x
|
||||
}
|
||||
|
||||
val x: Int
|
||||
get() = _x
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
FILE: lambdaInIfInTry.kt
|
||||
public final suspend fun <R> suspendRun(block: R|suspend () -> R|): R|R| {
|
||||
^suspendRun Null(null)!!
|
||||
}
|
||||
public final suspend fun test(): R|kotlin/Unit| {
|
||||
lvar e: R|kotlin/Throwable?| = Null(null)
|
||||
try {
|
||||
R|/suspendRun|<R|kotlin/Unit|>(<L> = suspendRun@fun <anonymous>(): R|kotlin/Unit| <inline=NoInline> {
|
||||
when () {
|
||||
Boolean(true) -> {
|
||||
^test Unit
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
)
|
||||
}
|
||||
finally {
|
||||
when () {
|
||||
!=(R|<local>/e|, Null(null)) -> {
|
||||
throw R|<local>/e|
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// ISSUE: KT-52934
|
||||
|
||||
suspend fun <R> suspendRun(block: suspend () -> R): R = null!!
|
||||
|
||||
suspend fun test() {
|
||||
var e: Throwable? = null
|
||||
try {
|
||||
suspendRun {
|
||||
if (true) {
|
||||
<!RETURN_NOT_ALLOWED!>return<!>
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
if (e != null) {
|
||||
throw e
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+40
@@ -0,0 +1,40 @@
|
||||
FILE: complexConflictingProjections.kt
|
||||
public final class Foo : R|kotlin/Any| {
|
||||
public constructor(): R|Foo| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final class Bar<T1 : R|Foo|, out T2> : R|kotlin/Any| {
|
||||
public constructor<T1 : R|Foo|, out T2>(): R|Bar<T1, T2>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final class Baz<T1, T2 : R|Bar<Foo, out T2>|> : R|kotlin/Any| {
|
||||
public constructor<T1, T2 : R|Bar<Foo, out T2>|>(): R|Baz<T1, T2>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final class Qux<T1, T2 : R|Baz<T2, Bar<Foo, T2>>|> : R|kotlin/Any| {
|
||||
public constructor<T1, T2 : R|Baz<T2, Bar<Foo, T2>>|>(f: R|T2|): R|Qux<T1, T2>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final var f: R|T2| = R|<local>/f|
|
||||
public get(): R|T2|
|
||||
public set(value: R|T2|): R|kotlin/Unit|
|
||||
|
||||
}
|
||||
public final class Quux<T> : R|kotlin/Any| {
|
||||
public constructor<T>(): R|Quux<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
lval x: R|Qux<in T, Baz<T, Bar<Foo, in T>>>| = Null(null)!!
|
||||
R|<local>/x|.R|SubstitutionOverride</Qux.f: R|CapturedType(out Baz<T, out ERROR CLASS: Inconsistent type: Bar<Foo, in T> (1 parameter has declared variance: out, but argument variance is in)>)|>| = Null(null)!!
|
||||
}
|
||||
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// ISSUE: KT-49024
|
||||
|
||||
class Foo
|
||||
class Bar<T1: <!FINAL_UPPER_BOUND!>Foo<!>, out T2>
|
||||
class Baz<T1, T2: Bar<Foo, out T2>>
|
||||
class Qux<T1, T2: Baz<T2, <!UPPER_BOUND_VIOLATED!>Bar<Foo, T2><!>>>(var f: T2)
|
||||
|
||||
class Quux<T> {
|
||||
fun test(): Unit {
|
||||
val x: Qux<in T, <!UPPER_BOUND_VIOLATED!>Baz<T, <!UPPER_BOUND_VIOLATED!>Bar<Foo, <!CONFLICTING_PROJECTION!>in<!> T><!>><!>> = null!!
|
||||
x.f = null!!
|
||||
}
|
||||
}
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
FILE: a.kt
|
||||
@R|kotlin/RequiresOptIn|() public final annotation class MyOptIn : R|kotlin/Annotation| {
|
||||
public constructor(): R|MyOptIn| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
FILE: b.kt
|
||||
package vvv
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// ISSUE: KT-53671
|
||||
|
||||
// FILE: a.kt
|
||||
@RequiresOptIn
|
||||
annotation class MyOptIn
|
||||
|
||||
// FILE: b.kt
|
||||
package vvv
|
||||
|
||||
import MyOptIn // OPT_IN_MARKER_CAN_ONLY_BE_USED_AS_ANNOTATION_OR_ARGUMENT_IN_OPT_IN
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
FILE: internalImplicitInvokeFromInlineFun.kt
|
||||
public final class Test : R|kotlin/Any| {
|
||||
public constructor(): R|Test| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
internal final operator fun invoke(): R|Test| {
|
||||
^invoke this@R|/Test|
|
||||
}
|
||||
|
||||
}
|
||||
public final inline fun testFunction(): R|Test| {
|
||||
^testFunction R|/Test.Test|().R|/Test.invoke|()
|
||||
}
|
||||
public final inline fun testOperator(): R|Test| {
|
||||
^testOperator R|/Test.Test|().R|/Test.invoke|()
|
||||
}
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
// ISSUE: KT-20223
|
||||
|
||||
class Test {
|
||||
internal operator fun invoke() = this
|
||||
}
|
||||
|
||||
<!NOTHING_TO_INLINE!>inline<!> fun testFunction() = Test().<!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>invoke<!>()
|
||||
<!NOTHING_TO_INLINE!>inline<!> fun testOperator() = <!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>Test()<!>()
|
||||
Vendored
+26
@@ -0,0 +1,26 @@
|
||||
FILE: internalSuperCallFromInlineFun.kt
|
||||
public abstract class C : R|kotlin/Any| {
|
||||
public constructor(): R|C| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
internal final fun foo(x: R|kotlin/String|): R|kotlin/String| {
|
||||
^foo R|<local>/x|
|
||||
}
|
||||
|
||||
public abstract fun bar(): R|kotlin/String|
|
||||
|
||||
}
|
||||
public final inline fun baz(crossinline block: R|() -> kotlin/String|): R|C| {
|
||||
^baz object : R|C| {
|
||||
private constructor(): R|<anonymous>| {
|
||||
super<R|C|>()
|
||||
}
|
||||
|
||||
public open override fun bar(): R|kotlin/String| {
|
||||
^bar this@R|/<anonymous>|.R|/C.foo|(R|<local>/block|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/String|>|())
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// ISSUE: KT-54518
|
||||
|
||||
abstract class C {
|
||||
internal fun foo(x: String) = x
|
||||
|
||||
abstract fun bar(): String
|
||||
}
|
||||
|
||||
inline fun baz(crossinline block: () -> String) = object : C() {
|
||||
override fun bar() = <!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>foo<!>(block())
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
FILE: invalidLhsOfClassLiteral.kt
|
||||
public final fun main(args: R|kotlin/Array<kotlin/String>|): R|kotlin/Unit| {
|
||||
<getClass>(<Unresolved name: foo>#().<Unresolved name: Wrapper>#<*>)
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// ISSUE: KT-17817
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
<!UNRESOLVED_REFERENCE!>foo<!>().Wrapper<<!PROJECTION_ON_NON_CLASS_TYPE_ARGUMENT!>*<!>>::class // no errors
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
FILE: notUselessCast_1.kt
|
||||
public open class Base : R|kotlin/Any| {
|
||||
public constructor(): R|Base| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final class Derived : R|Base| {
|
||||
public constructor(): R|Derived| {
|
||||
super<R|Base|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final fun test_0(d: R|Derived|): R|kotlin/Unit| {
|
||||
local final fun take(d: R|Derived|): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
R|<local>/take|((R|<local>/d| as R|Derived|))
|
||||
}
|
||||
public final fun test_1(): R|kotlin/Unit| {
|
||||
lval list: R|kotlin/collections/MutableList<Base>| = R|kotlin/collections/listOf|<R|kotlin/Any|>().R|kotlin/collections/map|<R|kotlin/Any|, R|Base|>(<L> = map@fun <anonymous>(it: R|kotlin/Any|): R|Base| <inline=Inline, kind=UNKNOWN> {
|
||||
^ (R|/Derived.Derived|() as R|Base|)
|
||||
}
|
||||
).R|kotlin/collections/toMutableList|<R|Base|>()
|
||||
R|<local>/list|.R|SubstitutionOverride<kotlin/collections/MutableList.add: R|kotlin/Boolean|>|(R|/Base.Base|())
|
||||
}
|
||||
public final fun test_2(): R|kotlin/Unit| {
|
||||
lval list: R|kotlin/collections/MutableList<Derived>| = R|kotlin/collections/listOf|<R|kotlin/Any|>().R|kotlin/collections/map|<R|kotlin/Any|, R|Derived|>(<L> = map@fun <anonymous>(it: R|kotlin/Any|): R|Derived| <inline=Inline, kind=UNKNOWN> {
|
||||
^ R|/Derived.Derived|()
|
||||
}
|
||||
).R|kotlin/collections/toMutableList|<R|Derived|>()
|
||||
R|<local>/list|.R|SubstitutionOverride<kotlin/collections/MutableList.add: R|kotlin/Boolean|><Inapplicable(INAPPLICABLE): kotlin/collections/MutableList.add>#|(R|/Base.Base|())
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
// ISSUE: KT-42136
|
||||
// WITH_STDLIB
|
||||
|
||||
open class Base
|
||||
class Derived : Base()
|
||||
|
||||
fun test_0(d: Derived) {
|
||||
fun take(d: Derived) {}
|
||||
take(d <!USELESS_CAST!>as Derived<!>) // should be USELESS_CAST
|
||||
}
|
||||
|
||||
fun test_1() {
|
||||
val list = listOf<Any>().map { Derived() as Base }.toMutableList() // should be no USELESS_CAST
|
||||
list.add(Base())
|
||||
}
|
||||
|
||||
fun test_2() {
|
||||
val list = listOf<Any>().map { Derived() }.toMutableList()
|
||||
list.add(<!ARGUMENT_TYPE_MISMATCH!>Base()<!>) // should be an error
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
FILE: notUselessCast_2.kt
|
||||
public final data class Foo : R|kotlin/Any| {
|
||||
public constructor(foo: R|kotlin/String|): R|Foo| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final val foo: R|kotlin/String| = R|<local>/foo|
|
||||
public get(): R|kotlin/String|
|
||||
|
||||
public final operator fun component1(): R|kotlin/String|
|
||||
|
||||
public final fun copy(foo: R|kotlin/String| = this@R|/Foo|.R|/Foo.foo|): R|Foo|
|
||||
|
||||
}
|
||||
public final class Bar : R|kotlin/Any| {
|
||||
public constructor(bar: R|kotlin/String|): R|Bar| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final val bar: R|kotlin/String| = R|<local>/bar|
|
||||
public get(): R|kotlin/String|
|
||||
|
||||
}
|
||||
public final fun R|Bar|.toFoo(): R|Foo| {
|
||||
^toFoo R|/Foo.Foo|(this@R|/toFoo|.R|/Bar.bar|)
|
||||
}
|
||||
public final class Wrapper<T> : R|kotlin/Any| {
|
||||
public constructor<T>(wrapped: R|T|): R|Wrapper<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final val wrapped: R|T| = R|<local>/wrapped|
|
||||
public get(): R|T|
|
||||
|
||||
public final fun <A> map(f: R|(T) -> A|): R|Wrapper<A>| {
|
||||
^map R|/Wrapper.Wrapper|<R|A|>(R|<local>/f|.R|SubstitutionOverride<kotlin/Function1.invoke: R|A|>|(this@R|/Wrapper|.R|/Wrapper.wrapped|))
|
||||
}
|
||||
|
||||
public final fun swapWrappedValue(f: R|(T) -> Wrapper<T>|): R|Wrapper<T>| {
|
||||
^swapWrappedValue R|<local>/f|.R|SubstitutionOverride<kotlin/Function1.invoke: R|Wrapper<T>|>|(this@R|/Wrapper|.R|/Wrapper.wrapped|)
|
||||
}
|
||||
|
||||
}
|
||||
public final fun test_1(): R|Wrapper<Foo?>| {
|
||||
^test_1 R|/Wrapper.Wrapper|<R|Bar|>(R|/Bar.Bar|(String(bar))).R|SubstitutionOverride</Wrapper.map: R|Wrapper<A>|>|<R|Foo?|>(<L> = map@fun <anonymous>(it: R|Bar|): R|Foo?| <inline=NoInline> {
|
||||
^ (R|<local>/it|.R|/toFoo|() as R|Foo?|)
|
||||
}
|
||||
).R|SubstitutionOverride</Wrapper.swapWrappedValue: R|Wrapper<Foo?>|>|(<L> = swapWrappedValue@fun <anonymous>(it: R|Foo?|): R|Wrapper<Foo?>| <inline=NoInline> {
|
||||
^ R|/Wrapper.Wrapper|<R|Foo?|>(Null(null))
|
||||
}
|
||||
)
|
||||
}
|
||||
public final fun test_2(): R|Wrapper<Foo?>| {
|
||||
^test_2 R|/Wrapper.Wrapper|<R|Bar|>(R|/Bar.Bar|(String(bar))).R|SubstitutionOverride</Wrapper.map: R|Wrapper<A>|>|<R|Foo|>(<L> = map@fun <anonymous>(it: R|Bar|): R|Foo| <inline=NoInline> {
|
||||
^ R|<local>/it|.R|/toFoo|()
|
||||
}
|
||||
).R|SubstitutionOverride</Wrapper.swapWrappedValue: R|Wrapper<Foo>|><CS errors: /Wrapper.swapWrappedValue>#|(<L> = swapWrappedValue@fun <anonymous>(it: R|Foo|): R|Wrapper<Foo>| <inline=NoInline> {
|
||||
^ R|/Wrapper.Wrapper<CS errors: /Wrapper.Wrapper>#|<R|Foo|>(Null(null))
|
||||
}
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
// ISSUE: KT-49045
|
||||
|
||||
data class Foo(val foo: String)
|
||||
class Bar(val bar: String)
|
||||
|
||||
fun Bar.toFoo() = Foo(bar)
|
||||
|
||||
class Wrapper<T>(val wrapped: T) {
|
||||
fun <A> map(f: (T) -> A): Wrapper<A> = Wrapper(f(wrapped))
|
||||
fun swapWrappedValue(f: (T) -> Wrapper<T>): Wrapper<T> = f(wrapped)
|
||||
}
|
||||
|
||||
fun test_1(): Wrapper<Foo?> {
|
||||
return Wrapper(Bar("bar"))
|
||||
.map { it.toFoo() as Foo? }
|
||||
.swapWrappedValue { Wrapper(null) }
|
||||
}
|
||||
|
||||
fun test_2(): Wrapper<Foo?> {
|
||||
return <!RETURN_TYPE_MISMATCH!>Wrapper(Bar("bar"))
|
||||
.map { it.toFoo() }
|
||||
.swapWrappedValue { <!TYPE_MISMATCH, TYPE_MISMATCH!>Wrapper(null)<!> }<!>
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
FILE: notUselessCast_3.kt
|
||||
public sealed interface Square : R|kotlin/Any| {
|
||||
}
|
||||
public final object MARKED : R|Square| {
|
||||
private constructor(): R|MARKED| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final object UNMARKED : R|Square| {
|
||||
private constructor(): R|UNMARKED| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final fun test_1(): R|kotlin/Unit| {
|
||||
lval lines: R|kotlin/collections/List<kotlin/String>| = R|kotlin/collections/listOf|<R|kotlin/String|>()
|
||||
lval cards: R|kotlin/collections/List<kotlin/collections/List<kotlin/collections/MutableList<Square>>>| = R|<local>/lines|.R|kotlin/collections/windowed|<R|kotlin/String|>(Int(6)).R|kotlin/collections/map|<R|kotlin/collections/List<kotlin/String>|, R|kotlin/collections/List<kotlin/collections/MutableList<Square>>|>(<L> = map@fun <anonymous>(card: R|kotlin/collections/List<kotlin/String>|): R|kotlin/collections/List<kotlin/collections/MutableList<Square>>| <inline=Inline, kind=UNKNOWN> {
|
||||
^ R|<local>/card|.R|kotlin/collections/map|<R|kotlin/String|, R|kotlin/collections/MutableList<Square>|>(<L> = map@fun <anonymous>(line: R|kotlin/String|): R|kotlin/collections/MutableList<Square>| <inline=Inline, kind=UNKNOWN> {
|
||||
^ R|<local>/line|.R|kotlin/text/map|<R|Square|>(<L> = map@fun <anonymous>(it: R|kotlin/Char|): R|Square| <inline=Inline, kind=UNKNOWN> {
|
||||
^ (Q|UNMARKED| as R|Square|)
|
||||
}
|
||||
).R|kotlin/collections/toMutableList|<R|Square|>()
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
R|<local>/cards|.R|SubstitutionOverride<kotlin/collections/List.get: R|kotlin/collections/List<kotlin/collections/MutableList<Square>>|>|(Int(0)).R|SubstitutionOverride<kotlin/collections/List.get: R|kotlin/collections/MutableList<Square>|>|(Int(0)).R|SubstitutionOverride<kotlin/collections/MutableList.set: R|Square|>|(Int(0), Q|MARKED|)
|
||||
}
|
||||
public final fun test_2(): R|kotlin/Unit| {
|
||||
lval lines: R|kotlin/collections/List<kotlin/String>| = R|kotlin/collections/listOf|<R|kotlin/String|>()
|
||||
lval cards: R|kotlin/collections/List<kotlin/collections/List<kotlin/collections/MutableList<UNMARKED>>>| = R|<local>/lines|.R|kotlin/collections/windowed|<R|kotlin/String|>(Int(6)).R|kotlin/collections/map|<R|kotlin/collections/List<kotlin/String>|, R|kotlin/collections/List<kotlin/collections/MutableList<UNMARKED>>|>(<L> = map@fun <anonymous>(card: R|kotlin/collections/List<kotlin/String>|): R|kotlin/collections/List<kotlin/collections/MutableList<UNMARKED>>| <inline=Inline, kind=UNKNOWN> {
|
||||
^ R|<local>/card|.R|kotlin/collections/map|<R|kotlin/String|, R|kotlin/collections/MutableList<UNMARKED>|>(<L> = map@fun <anonymous>(line: R|kotlin/String|): R|kotlin/collections/MutableList<UNMARKED>| <inline=Inline, kind=UNKNOWN> {
|
||||
^ R|<local>/line|.R|kotlin/text/map|<R|UNMARKED|>(<L> = map@fun <anonymous>(it: R|kotlin/Char|): R|UNMARKED| <inline=Inline, kind=UNKNOWN> {
|
||||
^ Q|UNMARKED|
|
||||
}
|
||||
).R|kotlin/collections/toMutableList|<R|UNMARKED|>()
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
R|<local>/cards|.R|SubstitutionOverride<kotlin/collections/List.get: R|kotlin/collections/List<kotlin/collections/MutableList<UNMARKED>>|>|(Int(0)).R|SubstitutionOverride<kotlin/collections/List.get: R|kotlin/collections/MutableList<UNMARKED>|>|(Int(0)).R|SubstitutionOverride<kotlin/collections/MutableList.set: R|UNMARKED|><Inapplicable(INAPPLICABLE): kotlin/collections/MutableList.set>#|(Int(0), Q|MARKED|)
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
// ISSUE: KT-50160
|
||||
// WITH_STDLIB
|
||||
|
||||
sealed interface Square
|
||||
object MARKED : Square
|
||||
object UNMARKED : Square
|
||||
|
||||
fun test_1() {
|
||||
val lines: List<String> = listOf()
|
||||
val cards = lines.windowed(6)
|
||||
.map { card ->
|
||||
card.map { line: String ->
|
||||
line.map { UNMARKED as Square }
|
||||
.toMutableList()
|
||||
}
|
||||
}
|
||||
cards[0][0][0] = MARKED
|
||||
}
|
||||
|
||||
fun test_2() {
|
||||
val lines: List<String> = listOf()
|
||||
val cards = lines.windowed(6)
|
||||
.map { card ->
|
||||
card.map { line: String ->
|
||||
line.map { UNMARKED }
|
||||
.toMutableList()
|
||||
}
|
||||
}
|
||||
cards[0][0][0] = <!ARGUMENT_TYPE_MISMATCH!>MARKED<!>
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
FILE: recursiveDependencyBetweenReturnTypeAndSupertype.kt
|
||||
public abstract interface A : R|Test| {
|
||||
}
|
||||
public open class Test : R|kotlin/Any| {
|
||||
public constructor(): R|Test| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final fun <T> result(): R|A| {
|
||||
^result object : R|A| {
|
||||
private constructor(): R|<anonymous><T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// ISSUE: KT-47815
|
||||
|
||||
interface A : <!INTERFACE_WITH_SUPERCLASS!>Test<!>
|
||||
|
||||
open class Test {
|
||||
fun <T> result() = object : A { }
|
||||
}
|
||||
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
FILE: unsuccessfullCastToStartProjectedType.kt
|
||||
public open class Foo<T> : R|kotlin/Any| {
|
||||
public constructor<T>(): R|Foo<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final class Foo1<A> : R|Foo<kotlin/Int>| {
|
||||
public constructor<A>(): R|Foo1<A>| {
|
||||
super<R|Foo<kotlin/Int>|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final class Foo2 : R|Foo<kotlin/Int>| {
|
||||
public constructor(): R|Foo2| {
|
||||
super<R|Foo<kotlin/Int>|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final fun process(foo: R|Foo<kotlin/Long>|): R|kotlin/Unit| {
|
||||
(R|<local>/foo| as R|Foo1<*>|)
|
||||
}
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
// ISSUE: KT-42169
|
||||
|
||||
open class Foo<T>
|
||||
class Foo1<A> : Foo<Int>()
|
||||
class Foo2 : Foo<Int>()
|
||||
|
||||
fun process(foo: Foo<Long>) {
|
||||
foo <!CAST_NEVER_SUCCEEDS!>as<!> Foo1<*>
|
||||
}
|
||||
Vendored
+53
@@ -0,0 +1,53 @@
|
||||
FILE: uselessCastLeadsToRecursiveProblem.kt
|
||||
public abstract interface A : R|kotlin/Any| {
|
||||
}
|
||||
public final class B : R|A| {
|
||||
public constructor(): R|B| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public open class C : R|A| {
|
||||
public constructor(): R|C| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final val <T : R|C|> R|kotlin/reflect/KClass<T>|.extProp1: R|kotlin/String|
|
||||
public get(): R|kotlin/String| {
|
||||
^ String(I'm C)
|
||||
}
|
||||
public final val R|A|.extProp1: R|kotlin/String|
|
||||
public get(): R|kotlin/String| {
|
||||
^ when (this@R|/extProp1|) {
|
||||
($subj$ is R|B|) -> {
|
||||
String(I'm B)
|
||||
}
|
||||
($subj$ is R|C|) -> {
|
||||
<getClass>((this@R|/extProp1| as R|C|)).R|/extProp1|<R|CapturedType(out C)|>
|
||||
}
|
||||
else -> {
|
||||
String(I don't know who I am..)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public final val <T : R|C|> R|kotlin/reflect/KClass<T>|.extProp2: R|kotlin/String|
|
||||
public get(): R|kotlin/String| {
|
||||
^ String(I'm C)
|
||||
}
|
||||
public final val R|A|.extProp2: R|kotlin/String|
|
||||
public get(): R|kotlin/String| {
|
||||
^ when (this@R|/extProp2|) {
|
||||
($subj$ is R|B|) -> {
|
||||
String(I'm B)
|
||||
}
|
||||
($subj$ is R|C|) -> {
|
||||
<getClass>(this@R|/extProp2|).R|/extProp2|<R|CapturedType(out C)|>
|
||||
}
|
||||
else -> {
|
||||
String(I don't know who I am..)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Vendored
+27
@@ -0,0 +1,27 @@
|
||||
// ISSUE: KT-43603
|
||||
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
interface A
|
||||
class B : A
|
||||
open class C : A
|
||||
|
||||
val <T : C> KClass<T>.extProp1
|
||||
get() = "I'm C"
|
||||
|
||||
val A.extProp1
|
||||
get() = when (this) {
|
||||
is B -> "I'm B"
|
||||
is C -> (this <!USELESS_CAST!>as C<!>)::class.extProp1
|
||||
else -> "I don't know who I am.."
|
||||
}
|
||||
|
||||
val <T : C> KClass<T>.extProp2
|
||||
get() = "I'm C"
|
||||
|
||||
val A.extProp2
|
||||
get() = when (this) {
|
||||
is B -> "I'm B"
|
||||
is C -> this::class.extProp2
|
||||
else -> "I don't know who I am.."
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
FILE: contractOnInfixFunction.kt
|
||||
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final infix fun R|kotlin/Boolean|.takeRight(cond: R|kotlin/Boolean|): R|kotlin/Boolean|
|
||||
[R|Contract description]
|
||||
<
|
||||
Returns(TRUE) -> cond
|
||||
>
|
||||
{
|
||||
{
|
||||
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
|
||||
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returns|(Boolean(true)).R|kotlin/contracts/SimpleEffect.implies|(R|<local>/cond|)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
^takeRight R|<local>/cond|
|
||||
}
|
||||
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final infix fun R|kotlin/Boolean?|.ensureLeft(x: R|kotlin/Any|): R|kotlin/Boolean|
|
||||
[R|Contract description]
|
||||
<
|
||||
Returns(TRUE) -> this != null
|
||||
>
|
||||
{
|
||||
{
|
||||
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
|
||||
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returns|(Boolean(true)).R|kotlin/contracts/SimpleEffect.implies|(!=(this@R|/ensureLeft|, Null(null)))
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
^ensureLeft !=(this@R|/ensureLeft|, Null(null))
|
||||
}
|
||||
public final fun test_1(b: R|kotlin/Boolean|, x: R|kotlin/Any|): R|kotlin/Unit| {
|
||||
when () {
|
||||
R|<local>/b|.R|/takeRight|((R|<local>/x| is R|kotlin/String|)) -> {
|
||||
R|<local>/x|.R|kotlin/String.length|
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public final fun test_2(b: R|kotlin/Boolean?|, x: R|kotlin/Any|): R|kotlin/Unit| {
|
||||
when () {
|
||||
R|<local>/b|.R|/ensureLeft|((R|<local>/x| is R|kotlin/String|)) -> {
|
||||
R|<local>/b|.R|kotlin/Boolean.not|()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
// ISSUE: KT-27261
|
||||
// WITH_STDLIB
|
||||
|
||||
import kotlin.contracts.*
|
||||
|
||||
@OptIn(ExperimentalContracts::class)
|
||||
infix fun Boolean.takeRight(cond: Boolean): Boolean {
|
||||
contract { returns(true) implies cond }
|
||||
return cond
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalContracts::class)
|
||||
infix fun Boolean?.ensureLeft(x: Any): Boolean {
|
||||
contract { returns(true) implies (this@ensureLeft != null) }
|
||||
return this != null
|
||||
}
|
||||
|
||||
fun test_1(b: Boolean, x: Any) {
|
||||
if (b takeRight (x is String)) {
|
||||
x.length
|
||||
}
|
||||
}
|
||||
|
||||
fun test_2(b: Boolean?, x: Any) {
|
||||
if (b ensureLeft (x is String)) {
|
||||
b.not()
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
FILE: inPlaceAfterVararg.kt
|
||||
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final fun example(vararg strings: R|kotlin/Array<out kotlin/String>|, block: R|() -> kotlin/Unit|): R|kotlin/Unit|
|
||||
[R|Contract description]
|
||||
<
|
||||
CallsInPlace(block, EXACTLY_ONCE)
|
||||
>
|
||||
{
|
||||
{
|
||||
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
|
||||
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.callsInPlace|<R|kotlin/Unit|>(R|<local>/block|, Q|kotlin/contracts/InvocationKind|.R|kotlin/contracts/InvocationKind.EXACTLY_ONCE|)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
R|<local>/block|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()
|
||||
}
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
lval x: R|kotlin/String|
|
||||
R|/example|(vararg(String()), <L> = example@fun <anonymous>(): R|kotlin/Unit| <inline=NoInline, kind=EXACTLY_ONCE> {
|
||||
R|<local>/x| = String()
|
||||
}
|
||||
)
|
||||
R|<local>/x|.R|kotlin/String.length|
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
// WITH_STDLIB
|
||||
// ISSUE: KT-30497
|
||||
import kotlin.contracts.ExperimentalContracts
|
||||
import kotlin.contracts.InvocationKind
|
||||
import kotlin.contracts.contract
|
||||
|
||||
@OptIn(ExperimentalContracts::class)
|
||||
fun example(vararg strings: String, block: () -> Unit) {
|
||||
contract {
|
||||
callsInPlace(block, InvocationKind.EXACTLY_ONCE)
|
||||
}
|
||||
block()
|
||||
}
|
||||
|
||||
fun test() {
|
||||
val x: String
|
||||
example("") {
|
||||
x = ""
|
||||
}
|
||||
x.length
|
||||
}
|
||||
Vendored
+29
@@ -0,0 +1,29 @@
|
||||
FILE: annotatedBranch.kt
|
||||
public final enum class SomeEnum : R|kotlin/Enum<SomeEnum>| {
|
||||
private constructor(): R|SomeEnum| {
|
||||
super<R|kotlin/Enum<SomeEnum>|>()
|
||||
}
|
||||
|
||||
public final static enum entry A: R|SomeEnum|
|
||||
public final static enum entry B: R|SomeEnum|
|
||||
public final static fun values(): R|kotlin/Array<SomeEnum>| {
|
||||
}
|
||||
|
||||
public final static fun valueOf(value: R|kotlin/String|): R|SomeEnum| {
|
||||
}
|
||||
|
||||
public final static val entries: R|kotlin/enums/EnumEntries<SomeEnum>|
|
||||
public get(): R|kotlin/enums/EnumEntries<SomeEnum>|
|
||||
|
||||
}
|
||||
public final fun test(x: R|SomeEnum|): R|kotlin/Unit| {
|
||||
when (R|<local>/x|) {
|
||||
==($subj$, Q|SomeEnum|.R|/SomeEnum.A|) -> {
|
||||
Int(1)
|
||||
}
|
||||
==($subj$, @R|kotlin/Suppress|(names = vararg(String(deprecation))) Q|SomeEnum|.R|/SomeEnum.B|) -> {
|
||||
Int(2)
|
||||
}
|
||||
}
|
||||
.R|kotlin/Int.inc|()
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// ISSUE: KT-50550
|
||||
|
||||
enum class SomeEnum { A, B}
|
||||
|
||||
fun test(x: SomeEnum) {
|
||||
when (x) {
|
||||
SomeEnum.A -> 1
|
||||
@Suppress("deprecation")
|
||||
SomeEnum.B -> 2
|
||||
}.inc()
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
FILE: exhaustiveness_smartcastedBoolean.kt
|
||||
public final fun test_1(b: R|kotlin/Any|): R|kotlin/Unit| {
|
||||
R|kotlin/require|((R|<local>/b| is R|kotlin/Boolean|))
|
||||
lval x: R|kotlin/Unit| = when (R|<local>/b|) {
|
||||
==($subj$, Boolean(true)) -> {
|
||||
Int(1)
|
||||
}
|
||||
}
|
||||
|
||||
lval y: R|kotlin/Int| = when (R|<local>/b|) {
|
||||
==($subj$, Boolean(true)) -> {
|
||||
Int(1)
|
||||
}
|
||||
==($subj$, Boolean(false)) -> {
|
||||
Int(2)
|
||||
}
|
||||
}
|
||||
|
||||
lval z: R|kotlin/Int| = when (R|<local>/b|) {
|
||||
==($subj$, Boolean(true)) -> {
|
||||
Int(1)
|
||||
}
|
||||
else -> {
|
||||
Int(2)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public final fun test_2(b: R|kotlin/Any?|): R|kotlin/Unit| {
|
||||
R|kotlin/require|((R|<local>/b| is R|kotlin/Boolean?|))
|
||||
lval x: R|kotlin/Unit| = when (R|<local>/b|) {
|
||||
==($subj$, Boolean(true)) -> {
|
||||
Int(1)
|
||||
}
|
||||
==($subj$, Boolean(false)) -> {
|
||||
Int(2)
|
||||
}
|
||||
}
|
||||
|
||||
lval y: R|kotlin/Int| = when (R|<local>/b|) {
|
||||
==($subj$, Boolean(true)) -> {
|
||||
Int(1)
|
||||
}
|
||||
==($subj$, Boolean(false)) -> {
|
||||
Int(2)
|
||||
}
|
||||
==($subj$, Null(null)) -> {
|
||||
Int(3)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
// WITH_STDLIB
|
||||
// ISSUE: KT-55379
|
||||
|
||||
fun test_1(b: Any) {
|
||||
require(b is Boolean)
|
||||
val x = <!NO_ELSE_IN_WHEN!>when<!> (b) {
|
||||
true -> 1
|
||||
}
|
||||
val y = when (b) {
|
||||
true -> 1
|
||||
false -> 2
|
||||
}
|
||||
val z = when (b) {
|
||||
true -> 1
|
||||
else -> 2
|
||||
}
|
||||
}
|
||||
|
||||
fun test_2(b: Any?) {
|
||||
require(b is Boolean?)
|
||||
val x = <!NO_ELSE_IN_WHEN!>when<!> (b) {
|
||||
true -> 1
|
||||
false -> 2
|
||||
}
|
||||
val y = when (b) {
|
||||
true -> 1
|
||||
false -> 2
|
||||
null -> 3
|
||||
}
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
FILE: sameBranchMultipleConditions.kt
|
||||
public sealed interface A : R|kotlin/Any| {
|
||||
}
|
||||
public sealed interface B : R|kotlin/Any| {
|
||||
}
|
||||
public final data class X : R|A|, R|B| {
|
||||
public constructor(something: R|kotlin/String|): R|X| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final val something: R|kotlin/String| = R|<local>/something|
|
||||
public get(): R|kotlin/String|
|
||||
|
||||
public final operator fun component1(): R|kotlin/String|
|
||||
|
||||
public final fun copy(something: R|kotlin/String| = this@R|/X|.R|/X.something|): R|X|
|
||||
|
||||
}
|
||||
public final data class Y : R|A|, R|B| {
|
||||
public constructor(something: R|kotlin/String|): R|Y| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final val something: R|kotlin/String| = R|<local>/something|
|
||||
public get(): R|kotlin/String|
|
||||
|
||||
public final operator fun component1(): R|kotlin/String|
|
||||
|
||||
public final fun copy(something: R|kotlin/String| = this@R|/Y|.R|/Y.something|): R|Y|
|
||||
|
||||
}
|
||||
public final fun ok(a: R|A|): R|B| {
|
||||
^ok when (R|<local>/a|) {
|
||||
($subj$ is R|X|) -> {
|
||||
R|<local>/a|
|
||||
}
|
||||
($subj$ is R|Y|) -> {
|
||||
R|<local>/a|
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public final fun problem(a: R|A|): R|B| {
|
||||
^problem when (R|<local>/a|) {
|
||||
($subj$ is R|X|) || ($subj$ is R|Y|) -> {
|
||||
R|<local>/a|
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive/sameBranchMultipleConditions.kt
Vendored
+20
@@ -0,0 +1,20 @@
|
||||
// ISSUE: KT-46301
|
||||
|
||||
sealed interface A
|
||||
sealed interface B
|
||||
|
||||
data class X(val something: String): A, B
|
||||
data class Y(val something: String): A, B
|
||||
|
||||
fun ok(a: A): B {
|
||||
return when (a) {
|
||||
is X -> a
|
||||
is Y -> a
|
||||
}
|
||||
}
|
||||
|
||||
fun problem(a: A): B {
|
||||
return when (a) {
|
||||
is X, is Y -> a
|
||||
}
|
||||
}
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
FILE: smartcastToExhaustiveInterface.kt
|
||||
public sealed interface I1 : R|kotlin/Any| {
|
||||
public abstract interface B : R|I1| {
|
||||
}
|
||||
|
||||
public abstract interface C : R|I1| {
|
||||
}
|
||||
|
||||
}
|
||||
public sealed interface I2 : R|kotlin/Any| {
|
||||
public abstract interface B : R|I2| {
|
||||
}
|
||||
|
||||
public abstract interface C : R|I2| {
|
||||
}
|
||||
|
||||
}
|
||||
public final fun test_1(x: R|I1|): R|kotlin/Unit| {
|
||||
lval a: R|kotlin/Int| = when (R|<local>/x|) {
|
||||
($subj$ is R|I1.B|) -> {
|
||||
Int(1)
|
||||
}
|
||||
($subj$ is R|I1.C|) -> {
|
||||
Int(1)
|
||||
}
|
||||
}
|
||||
|
||||
R|kotlin/require|((R|<local>/x| is R|I2|))
|
||||
lval b: R|kotlin/Int| = when (R|<local>/x|) {
|
||||
($subj$ is R|I1.B|) -> {
|
||||
Int(1)
|
||||
}
|
||||
($subj$ is R|I1.C|) -> {
|
||||
Int(1)
|
||||
}
|
||||
}
|
||||
|
||||
lval c: R|kotlin/Int| = when (R|<local>/x|) {
|
||||
($subj$ is R|I2.B|) -> {
|
||||
Int(1)
|
||||
}
|
||||
($subj$ is R|I2.C|) -> {
|
||||
Int(1)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public final fun test_2(x: R|kotlin/Any|): R|kotlin/Unit| {
|
||||
R|kotlin/require|((R|<local>/x| is R|I1|))
|
||||
lval a: R|kotlin/Int| = when (R|<local>/x|) {
|
||||
($subj$ is R|I1.B|) -> {
|
||||
Int(1)
|
||||
}
|
||||
($subj$ is R|I1.C|) -> {
|
||||
Int(1)
|
||||
}
|
||||
}
|
||||
|
||||
R|kotlin/require|((R|<local>/x| is R|I2|))
|
||||
lval b: R|kotlin/Int| = when (R|<local>/x|) {
|
||||
($subj$ is R|I1.B|) -> {
|
||||
Int(1)
|
||||
}
|
||||
($subj$ is R|I1.C|) -> {
|
||||
Int(1)
|
||||
}
|
||||
}
|
||||
|
||||
lval c: R|kotlin/Int| = when (R|<local>/x|) {
|
||||
($subj$ is R|I2.B|) -> {
|
||||
Int(1)
|
||||
}
|
||||
($subj$ is R|I2.C|) -> {
|
||||
Int(1)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
// WITH_STDLIB
|
||||
// ISSUE: KT-47750
|
||||
|
||||
sealed interface I1 {
|
||||
interface B : I1
|
||||
interface C : I1
|
||||
}
|
||||
|
||||
sealed interface I2 {
|
||||
interface B : I2
|
||||
interface C : I2
|
||||
}
|
||||
|
||||
fun test_1(x: I1) {
|
||||
val a = when (x) {
|
||||
is I1.B -> 1
|
||||
is I1.C -> 1
|
||||
}
|
||||
require(x is I2)
|
||||
val b = when (x) {
|
||||
is I1.B -> 1
|
||||
is I1.C -> 1
|
||||
}
|
||||
|
||||
val c = when (x) {
|
||||
is I2.B -> 1
|
||||
is I2.C -> 1
|
||||
}
|
||||
}
|
||||
|
||||
fun test_2(x: Any) {
|
||||
require(x is I1)
|
||||
val a = when (x) {
|
||||
is I1.B -> 1
|
||||
is I1.C -> 1
|
||||
}
|
||||
require(x is I2)
|
||||
val b = when (x) {
|
||||
is I1.B -> 1
|
||||
is I1.C -> 1
|
||||
}
|
||||
val c = when (x) {
|
||||
is I2.B -> 1
|
||||
is I2.C -> 1
|
||||
}
|
||||
}
|
||||
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
FILE: ifInBuildMap.kt
|
||||
public final fun main(): R|kotlin/Unit| {
|
||||
R|kotlin/collections/buildMap|<R|kotlin/String|, R|kotlin/String|>(<L> = buildMap@fun R|kotlin/collections/MutableMap<kotlin/String, kotlin/String>|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=EXACTLY_ONCE> {
|
||||
when () {
|
||||
Boolean(true) -> {
|
||||
R|kotlin/io/println|(String(test))
|
||||
}
|
||||
else -> {
|
||||
this@R|special/anonymous|.R|SubstitutionOverride<kotlin/collections/MutableMap.put: R|Stub (chain inference): TypeVariable(V)?|>|(String(foo), String(bar))
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
)
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// WITH_STDLIB
|
||||
// ISSUE: KT-51143
|
||||
|
||||
fun main() {
|
||||
buildMap {
|
||||
if (true) {
|
||||
println("test")
|
||||
} else {
|
||||
put("foo", "bar")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
FILE: javaCollector.kt
|
||||
public final fun foo(): R|kotlin/Unit| {
|
||||
R|kotlin/collections/listOf|<R|kotlin/String|>(String()).R|SubstitutionOverride<kotlin/collections/List.stream: R|@EnhancedNullability java/util/stream/Stream<@EnhancedNullability kotlin/String>|>|().R|SubstitutionOverride<java/util/stream/Stream.collect: R|ft<R & Any, R?>|>|<R|ft<kotlin/collections/MutableMap<@EnhancedNullability kotlin/String!, kotlin/Int!>, kotlin/collections/Map<@EnhancedNullability kotlin/String!, kotlin/Int!>?>|, R|ft<CapturedType(*), CapturedType(*)?>|>(Q|java/util/stream/Collectors|.R|java/util/stream/Collectors.groupingBy|<R|@EnhancedNullability kotlin/String!|, R|@EnhancedNullability kotlin/String!|, R|ft<CapturedType(*), CapturedType(*)?>|, R|kotlin/Int!|>(groupingBy@fun <anonymous>(it: R|@EnhancedNullability kotlin/String!|): R|@EnhancedNullability kotlin/String!| <inline=NoInline> {
|
||||
^ R|<local>/it|
|
||||
}
|
||||
, Q|java/util/stream/Collectors|.R|java/util/stream/Collectors.collectingAndThen|<R|kotlin/String!|, R|ft<CapturedType(*), CapturedType(*)?>|, R|kotlin/Long!|, R|kotlin/Int!|>(Q|java/util/stream/Collectors|.R|java/util/stream/Collectors.counting|<R|kotlin/String|>(), Q|kotlin/Long|::R|kotlin/Long.toInt|)))
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// ISSUE: KT-50134
|
||||
// WITH_STDLIB
|
||||
// FULL_JDK
|
||||
|
||||
import java.util.stream.Collectors
|
||||
|
||||
fun foo(){
|
||||
listOf("").stream().collect(
|
||||
Collectors.groupingBy(
|
||||
{ it },
|
||||
Collectors.collectingAndThen(
|
||||
Collectors.counting<String>(),
|
||||
Long::toInt
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
FILE: kt53494.kt
|
||||
public open class C<out T> : R|kotlin/Any| {
|
||||
public constructor<out T>(): R|C<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final data class Wrapped<out T> : R|C<T>| {
|
||||
public constructor<out T>(value: R|T|): R|Wrapped<T>| {
|
||||
super<R|C<T>|>()
|
||||
}
|
||||
|
||||
public final val value: R|T| = R|<local>/value|
|
||||
public get(): R|T|
|
||||
|
||||
public final operator fun component1(): R|T|
|
||||
|
||||
public final fun copy(value: R|T| = this@R|/Wrapped|.R|/Wrapped.value|): R|Wrapped<T>|
|
||||
|
||||
}
|
||||
public final object Default : R|C<kotlin/Nothing>| {
|
||||
private constructor(): R|Default| {
|
||||
super<R|C<kotlin/Nothing>|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final inline fun <reified T> test_1(t: R|T?|): R|C<T>| {
|
||||
when () {
|
||||
!=(R|<local>/t|, Null(null)) -> {
|
||||
^test_1 R|/Wrapped.Wrapped|<R|T? & Any|>(R|<local>/t|)
|
||||
}
|
||||
}
|
||||
|
||||
^test_1 when () {
|
||||
(R|<local>/t| is R|T|) -> {
|
||||
R|/Wrapped.Wrapped|<R|it(kotlin/Nothing? & T)|>(R|<local>/t|)
|
||||
}
|
||||
else -> {
|
||||
Q|Default|
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public final inline fun <reified T> test_2(t: R|T?|): R|C<T>| {
|
||||
^test_2 when () {
|
||||
!=(R|<local>/t|, Null(null)) -> {
|
||||
R|/Wrapped.Wrapped|<R|T? & Any|>(R|<local>/t|)
|
||||
}
|
||||
(R|<local>/t| is R|T|) -> {
|
||||
R|/Wrapped.Wrapped|<R|it(kotlin/Nothing? & T)|>(R|<local>/t|)
|
||||
}
|
||||
else -> {
|
||||
Q|Default|
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// ISSUE: KT-53494
|
||||
|
||||
open class C<out T>
|
||||
data class Wrapped<out T>(val value: T) : C<T>()
|
||||
object Default : C<Nothing>()
|
||||
|
||||
inline fun <reified T> test_1(t: T?): C<T> {
|
||||
if (t != null) return Wrapped(t)
|
||||
return if (t is T) Wrapped(t) else Default
|
||||
}
|
||||
|
||||
inline fun <reified T> test_2(t: T?): C<T> {
|
||||
return if (t != null) Wrapped(t) else if (t is T) Wrapped(t) else Default
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
FILE: kt54990.kt
|
||||
public final class A<T1, T2 : R|B<T1, kotlin/Double>|> : R|kotlin/Any| {
|
||||
public constructor<T1, T2 : R|B<T1, kotlin/Double>|>(): R|A<T1, T2>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final class B<T1, T2> : R|kotlin/Any| {
|
||||
public constructor<T1, T2>(): R|B<T1, T2>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final class C<L> : R|kotlin/Any| {
|
||||
public constructor<L>(x: R|A<out L, out B<L, kotlin/Double>>|): R|C<L>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final val x: R|A<out L, out B<L, kotlin/Double>>| = R|<local>/x|
|
||||
public get(): R|A<out L, out B<L, kotlin/Double>>|
|
||||
|
||||
}
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
lval x: R|A<out kotlin/Any, out B<kotlin/Any, kotlin/Double>>| = R|/A.A|<R|kotlin/Any|, R|B<kotlin/Any, kotlin/Double>|>()
|
||||
R|/C.C|<R|kotlin/Any|>(R|<local>/x|)
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// ISSUE: KT-54990
|
||||
|
||||
class A<T1, T2: B<T1, Double>>
|
||||
class B<T1, T2>
|
||||
class C<L>(val x: A<out L, out B<L, Double>>)
|
||||
|
||||
fun test() {
|
||||
val x: A<out Any, out B<Any, Double>> = A()
|
||||
C<Any>(x)
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
FILE: kt55555.kt
|
||||
private abstract interface Foo : R|kotlin/Any| {
|
||||
}
|
||||
private final class Bar<T : R|Foo|, L : R|kotlin/collections/List<T>|> : R|kotlin/Any| {
|
||||
public constructor<T : R|Foo|, L : R|kotlin/collections/List<T>|>(): R|Bar<T, L>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
private final fun <T : R|Foo|> bar(t: R|T|): R|Bar<T, *>| {
|
||||
^bar Null(null)!!
|
||||
}
|
||||
private final fun <T : R|Foo|> foo(t: R|T|): R|T| {
|
||||
lval map: R|Bar<T, *>| = when () {
|
||||
(R|<local>/t| is R|Bar<*, *>|) -> {
|
||||
(R|<local>/t| as R|Bar<T, *>|)
|
||||
}
|
||||
else -> {
|
||||
R|/bar|<R|T|>(R|<local>/t|)
|
||||
}
|
||||
}
|
||||
|
||||
^foo R|<local>/t|
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// ISSUE: KT-55555
|
||||
|
||||
private interface Foo
|
||||
|
||||
private class Bar<T : Foo, L : List<T>>
|
||||
|
||||
private fun <T : Foo> bar(t: T): Bar<T, *> = null!!
|
||||
|
||||
private fun <T : Foo> foo(t: T): T {
|
||||
val map =
|
||||
if (t is Bar<*, *>) t <!UNCHECKED_CAST!>as Bar<T, *><!>
|
||||
else bar(t)
|
||||
return t
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
FILE: recursiveSelfTypes.kt
|
||||
public abstract class Child<R : R|Recursive<R>|> : R|Parent<ChildParameter<*>, R>| {
|
||||
public constructor<R : R|Recursive<R>|>(): R|Child<R>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final fun getParent(): R|Child<R>| {
|
||||
^getParent (this@R|/Child|.R|SubstitutionOverride</Child.self: R|Parent<ChildParameter<*>, R>|>|() as R|Child<R>|)
|
||||
}
|
||||
|
||||
}
|
||||
public abstract interface Parent<P : R|Parameter|, R : R|Recursive<R>|> : R|kotlin/Any| {
|
||||
public abstract fun self(): R|Parent<P, R>|
|
||||
|
||||
}
|
||||
public abstract interface Parameter : R|kotlin/Any| {
|
||||
}
|
||||
public final class ChildParameter<R : R|Recursive<R>|> : R|Parameter| {
|
||||
public constructor<R : R|Recursive<R>|>(): R|ChildParameter<R>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public abstract interface Recursive<R : R|Recursive<R>|> : R|kotlin/Any| {
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// ISSUE: KT-52860
|
||||
|
||||
abstract class Child<R : Recursive<R>> : Parent<ChildParameter<*>, R> {
|
||||
fun getParent(): Child<R> = self() as Child<R>
|
||||
}
|
||||
|
||||
interface Parent<P : Parameter, R : Recursive<R>> {
|
||||
fun self(): Parent<P, R>
|
||||
}
|
||||
|
||||
interface Parameter
|
||||
|
||||
class ChildParameter<R : Recursive<R>> : Parameter
|
||||
|
||||
interface Recursive<R : Recursive<R>>
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
FILE: main.kt
|
||||
public final fun main(): R|kotlin/Unit| {
|
||||
lval a: R|ft<Java<*, kotlin/String!>, Java<*, kotlin/String!>?>| = Q|Java|.R|/Java.factory|<R|kotlin/String!|>(String())
|
||||
lval b: R|ft<Java<*, kotlin/String!>, Java<*, kotlin/String!>?>| = R|<local>/a|.R|SubstitutionOverride</Java.produceSelf: R|ft<CapturedType(*) & Any, CapturedType(*)?>|>|()
|
||||
R|<local>/b|.R|SubstitutionOverride</Java.consumeElement: R|kotlin/Unit|>|(String(testing))
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// ISSUE: KT-48975
|
||||
|
||||
// FILE: Java.java
|
||||
public class Java<SELF extends Java<SELF, ELEMENT>, ELEMENT> {
|
||||
public static <E> Java<?, E> factory(E actual) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public SELF produceSelf() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void consumeElement(ELEMENT values) {}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
fun main() {
|
||||
val a = Java.factory("")
|
||||
val b = a.produceSelf()
|
||||
b.consumeElement("testing")
|
||||
}
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
FILE: classLiteralWithExclExcl.kt
|
||||
public final class B<T> : R|kotlin/Any| {
|
||||
public constructor<T>(): R|B<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final val any2: R|kotlin/reflect/KClass<ERROR CLASS: Unresolved name: invoke>| = <getClass>(Q|B|!!.<Unresolved name: invoke>#<<ERROR TYPE REF: Symbol not found for T>>)
|
||||
public get(): R|kotlin/reflect/KClass<ERROR CLASS: Unresolved name: invoke>|
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
// ISSUE: KT-47373
|
||||
|
||||
class B<T>
|
||||
val any2 = <!UNRESOLVED_REFERENCE!><!NO_COMPANION_OBJECT!>B<!>!!<!><<!UNRESOLVED_REFERENCE!>T<!>>::class
|
||||
@@ -0,0 +1,73 @@
|
||||
FILE: a.kt
|
||||
package a
|
||||
|
||||
@R|kotlin/Suppress|() <DANGLING MODIFIER: Top level declaration expected>FILE: b.kt
|
||||
package b
|
||||
|
||||
public abstract interface I : R|kotlin/Any| {
|
||||
public open fun <T> f(): <ERROR TYPE REF: Qualified expression with unexpected selector> {
|
||||
^f <ERROR TYPE REF: Qualified expression with unexpected selector>ERROR_EXPR(The expression cannot be a selector (occur after a dot))String()
|
||||
}
|
||||
|
||||
public final class C : R|b/I| {
|
||||
public constructor(): R|b/I.C| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
FILE: c.kt
|
||||
package c
|
||||
|
||||
public abstract interface I : R|kotlin/Any| {
|
||||
public open fun <T : R|kotlin/String|> f(x: R|T?|): R|T| {
|
||||
^f R|<local>/x| ?: String(OK).<Unresolved name: strip>#()?.{ $subj$.<Unresolved name: substringBeforeLast>#(Char(61334), R|c/C.C|().R|c/I.f<Inapplicable(INAPPLICABLE): c/I.f>#|<R|kotlin/Long|>(Int(-62))) }!!
|
||||
}
|
||||
|
||||
}
|
||||
public final class C : R|c/I| {
|
||||
public constructor(): R|c/C| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final fun box(): R|kotlin/String| {
|
||||
^box R|c/C.C|().R|c/I.f|<R|kotlin/String|>(Null(null))
|
||||
}
|
||||
FILE: d.kt
|
||||
package d
|
||||
|
||||
public abstract interface I : R|kotlin/Any| {
|
||||
public open fun <T> f(): <ERROR TYPE REF: cycle> {
|
||||
^f R|d/I.C.C<Inapplicable(INAPPLICABLE_ARGUMENTS_MAPPING_ERROR): d/I.C.C>#|(ERROR_EXPR(Argument is absent)).R|d/I.f<Inapplicable(INAPPLICABLE_ARGUMENTS_MAPPING_ERROR): d/I.f>#|<<ERROR TYPE REF: Cannot infer argument for type parameter T>>(ERROR_EXPR(No right operand))
|
||||
}
|
||||
|
||||
public final class C : R|d/I| {
|
||||
public constructor(): R|d/I.C| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
FILE: e.kt
|
||||
package e
|
||||
|
||||
public final class A<E> : R|kotlin/Any| {
|
||||
public constructor<E>(): R|e/A<E>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final var bar: <ERROR TYPE REF: Expression 'bar' of type 'ERROR CLASS: cycle' cannot be invoked as a function> = R|e/A.EmptyContinuation.EmptyContinuation<Inapplicable(INAPPLICABLE_ARGUMENTS_MAPPING_ERROR): e/A.EmptyContinuation.EmptyContinuation>#|(ERROR_EXPR(Argument is absent)).<Expression 'bar' of type 'ERROR CLASS: cycle' cannot be invoked as a function>#(ERROR_EXPR(No right operand))
|
||||
public get(): <ERROR TYPE REF: Expression 'bar' of type 'ERROR CLASS: cycle' cannot be invoked as a function>
|
||||
public set(value: <ERROR TYPE REF: Expression 'bar' of type 'ERROR CLASS: cycle' cannot be invoked as a function>): R|kotlin/Unit|
|
||||
|
||||
public final class EmptyContinuation : R|e/A<ERROR CLASS: Unwrapped type is null>| {
|
||||
public constructor(): R|e/A.EmptyContinuation| {
|
||||
super<R|e/A<ERROR CLASS: Unwrapped type is null>|>()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
// ISSUE: KT-47484, KT-47495
|
||||
|
||||
// FILE: a.kt
|
||||
package a
|
||||
|
||||
@
|
||||
<!SYNTAX!>:<!>Suppress(<!NAMED_PARAMETER_NOT_FOUND!>receiver<!> = <!UNRESOLVED_REFERENCE!>iterator<!><!SYNTAX, SYNTAX!><!>
|
||||
|
||||
// FILE: b.kt
|
||||
package b
|
||||
|
||||
interface I {
|
||||
fun <T
|
||||
> f<!SYNTAX!><!> = "".
|
||||
(<!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>C().<!FUNCTION_CALL_EXPECTED!>f<!><!><!SYNTAX!><!>
|
||||
class C : I<!SYNTAX!><!>
|
||||
|
||||
// FILE: c.kt
|
||||
package c
|
||||
|
||||
import kotlin.<!UNRESOLVED_IMPORT!>properties<!>.*
|
||||
import kotlin.reflect.*
|
||||
import kotlin.<!UNRESOLVED_IMPORT!>math<!>.*
|
||||
interface I {
|
||||
fun <T : <!FINAL_UPPER_BOUND!>String<!>> f(x: T?) = x ?: "OK".<!UNRESOLVED_REFERENCE!>strip<!>()?.substringBeforeLast('', <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>C().f<<!UPPER_BOUND_VIOLATED!>Long<!>>(<!ARGUMENT_TYPE_MISMATCH!>-62<!>)<!>)!!
|
||||
}
|
||||
|
||||
class C : I
|
||||
|
||||
fun box() = C().f<String>(null)
|
||||
|
||||
// FILE: d.kt
|
||||
package d
|
||||
|
||||
interface I {
|
||||
fun <T
|
||||
> f<!SYNTAX!><!> = <!TOO_MANY_ARGUMENTS!>C<!>(
|
||||
<!SYNTAX!><!SYNTAX!><!>.<!><!TOO_MANY_ARGUMENTS!>f<!><!SYNTAX!><!>
|
||||
class C : I<!SYNTAX!><!>
|
||||
|
||||
// FILE: e.kt
|
||||
package e
|
||||
|
||||
class A<E<!SYNTAX!><!>
|
||||
{
|
||||
|
||||
var bar = <!TOO_MANY_ARGUMENTS!>EmptyContinuation<!>(
|
||||
<!SYNTAX!><!SYNTAX!><!>.<!><!FUNCTION_EXPECTED!>bar<!><!SYNTAX!><!>
|
||||
|
||||
class EmptyContinuation : A<<!SYNTAX, SYNTAX!><!>
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
FILE: typeArgumentsOnThis.kt
|
||||
public final fun x(): R|kotlin/Unit| {
|
||||
this#.<Unresolved name: invoke>#<<ERROR TYPE REF: Symbol not found for X>>::<Unresolved reference: y>#
|
||||
}
|
||||
public final val a: <ERROR TYPE REF: Unresolved reference: y> = this#.<Unresolved name: invoke>#<<ERROR TYPE REF: Symbol not found for X>>::<Unresolved reference: y>#
|
||||
public get(): <ERROR TYPE REF: Unresolved reference: y>
|
||||
@@ -0,0 +1,7 @@
|
||||
// ISSUE: KT-24737
|
||||
|
||||
fun x(){
|
||||
<!NO_THIS, UNRESOLVED_REFERENCE!>this<!><<!UNRESOLVED_REFERENCE!>X<!>>::y
|
||||
}
|
||||
|
||||
val a = <!NO_THIS, UNRESOLVED_REFERENCE!>this<!><<!UNRESOLVED_REFERENCE!>X<!>>::y
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
FILE: assignToStarProjectedType.kt
|
||||
public final class Inv<T> : R|kotlin/Any| {
|
||||
public constructor<T>(): R|Inv<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final fun <T> invOf(): R|Inv<T>| {
|
||||
^invOf R|/Inv.Inv|<R|T|>()
|
||||
}
|
||||
public abstract class Base<T> : R|kotlin/Any| {
|
||||
public constructor<T>(): R|Base<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final var foo: R|Inv<T>?| = R|/invOf|<R|T|>()
|
||||
public get(): R|Inv<T>?|
|
||||
public set(value: R|Inv<T>?|): R|kotlin/Unit|
|
||||
|
||||
}
|
||||
public final class Bar : R|Base<kotlin/String>| {
|
||||
public constructor(): R|Bar| {
|
||||
super<R|Base<kotlin/String>|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final fun test_1(): R|kotlin/Unit| {
|
||||
lval x: R|Bar| = R|/Bar.Bar|()
|
||||
R|<local>/x|.R|SubstitutionOverride</Bar.foo: R|Inv<kotlin/String>?|>| = R|/invOf|<R|kotlin/String|>()
|
||||
R|<local>/x|.R|SubstitutionOverride</Bar.foo: R|Inv<kotlin/String>?|>| = Null(null)
|
||||
}
|
||||
public final fun test_2(x: R|Base<*>|): R|kotlin/Unit| {
|
||||
R|<local>/x|.R|SubstitutionOverride</Base.foo: R|Inv<CapturedType(*)>?|>| = R|/invOf<CS errors: /invOf>#|<<ERROR TYPE REF: Cannot infer argument for type parameter T>>()
|
||||
R|<local>/x|.R|SubstitutionOverride</Base.foo: R|Inv<CapturedType(*)>?|>| = Null(null)
|
||||
}
|
||||
public final fun test_3(x: R|kotlin/Any|): R|kotlin/Unit| {
|
||||
when () {
|
||||
(R|<local>/x| is R|Base<*>|) -> {
|
||||
R|<local>/x|.R|SubstitutionOverride</Base.foo: R|Inv<CapturedType(*)>?|>| = R|/invOf<CS errors: /invOf>#|<<ERROR TYPE REF: Cannot infer argument for type parameter T>>()
|
||||
R|<local>/x|.R|SubstitutionOverride</Base.foo: R|Inv<CapturedType(*)>?|>| = Null(null)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
// ISSUE: KT-51045
|
||||
|
||||
class Inv<T>
|
||||
fun <T> invOf(): Inv<T> = Inv()
|
||||
|
||||
abstract class Base<T> {
|
||||
final var foo: Inv<T>? = invOf()
|
||||
}
|
||||
|
||||
class Bar : Base<String>()
|
||||
|
||||
fun test_1() {
|
||||
val x = Bar()
|
||||
x.foo = invOf()
|
||||
x.foo = null
|
||||
}
|
||||
|
||||
fun test_2(x: Base<*>) {
|
||||
x.foo = <!ASSIGNMENT_TYPE_MISMATCH!>invOf()<!>
|
||||
x.foo = null
|
||||
}
|
||||
|
||||
fun test_3(x: Any) {
|
||||
if (x is Base<*>) {
|
||||
x.foo = <!ASSIGNMENT_TYPE_MISMATCH!>invOf()<!>
|
||||
x.foo = null
|
||||
}
|
||||
}
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
FILE: ambigousParenthesizedReference.kt
|
||||
public final fun consume(x: R|kotlin/Any?|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun box(): R|kotlin/Unit| {
|
||||
^box R|/consume|(Q|kotlin/Int|::<Ambiguity: plus, [kotlin/Int.plus, kotlin/Int.plus, kotlin/Int.plus, kotlin/Int.plus, kotlin/Int.plus, kotlin/Int.plus]>#)
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// ISSUE: KT-36958
|
||||
|
||||
fun consume(x: Any?) {}
|
||||
|
||||
fun box() = consume((Int::<!OVERLOAD_RESOLUTION_AMBIGUITY!>plus<!>))
|
||||
compiler/fir/analysis-tests/testData/resolve/references/incorrectReferenceOnInnerClassMember.fir.txt
Vendored
+23
@@ -0,0 +1,23 @@
|
||||
FILE: incorrectReferenceOnInnerClassMember.kt
|
||||
package foo
|
||||
|
||||
public final class Outer<T> : R|kotlin/Any| {
|
||||
public constructor<T>(): R|foo/Outer<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final inner class Inner<T> : R|kotlin/Any| {
|
||||
public foo/Outer<T>.constructor(): R|foo/Outer.Inner<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final fun method(): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
Q|foo/Outer|.<Resolution to classifier>#(Int(42))
|
||||
Q|foo/Outer|.<Resolution to classifier>#(Int(42))::<Unresolved reference: method>#
|
||||
}
|
||||
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
// ISSUE: KT-37365
|
||||
|
||||
package foo
|
||||
|
||||
class Outer<T> {
|
||||
inner class Inner {
|
||||
fun method() {}
|
||||
}
|
||||
}
|
||||
|
||||
fun test() {
|
||||
foo.Outer<Int>.<!RESOLUTION_TO_CLASSIFIER!>Inner<!>(42)
|
||||
foo.Outer<Int>.<!RESOLUTION_TO_CLASSIFIER!>Inner<!>(42)::<!UNRESOLVED_REFERENCE!>method<!>
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
FILE: main.kt
|
||||
public final class KotlinInv<T> : R|kotlin/Any| {
|
||||
public constructor<T>(): R|KotlinInv<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final val stringVal: R|kotlin/String| = String()
|
||||
public get(): R|kotlin/String|
|
||||
|
||||
}
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
Q|JavaInv|::R|/JavaInv.stringVal|
|
||||
Q|KotlinInv|::R|SubstitutionOverride</KotlinInv.stringVal: R|kotlin/String|>|
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// ISSUE: KT-56243
|
||||
|
||||
// FILE: JavaInv.java
|
||||
public class JavaInv<T> {
|
||||
public String getStringVal() { return "OK"; }
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
class KotlinInv<T> {
|
||||
val stringVal: String = ""
|
||||
}
|
||||
|
||||
fun test() {
|
||||
JavaInv<out Number>::stringVal
|
||||
KotlinInv<out Number>::stringVal
|
||||
}
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
FILE: unresovledReferenceInFinally.kt
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
String(1234).R|kotlin/apply|<R|kotlin/String|>(<L> = apply@fun R|kotlin/String|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=EXACTLY_ONCE> {
|
||||
try {
|
||||
}
|
||||
finally {
|
||||
::<Unresolved reference: fu1>#
|
||||
}
|
||||
|
||||
}
|
||||
)
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// ISSUE: KT-47490
|
||||
|
||||
fun test() {
|
||||
"1234".apply {
|
||||
try {
|
||||
} finally {
|
||||
::<!UNRESOLVED_REFERENCE!>fu1<!>
|
||||
}
|
||||
}
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
FILE: returnFromDelegatedConstuctor.kt
|
||||
public final data class StringPair : R|kotlin/Any| {
|
||||
public constructor(a: R|kotlin/String|, b: R|kotlin/String|): R|StringPair| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final val a: R|kotlin/String| = R|<local>/a|
|
||||
public get(): R|kotlin/String|
|
||||
|
||||
public final val b: R|kotlin/String| = R|<local>/b|
|
||||
public get(): R|kotlin/String|
|
||||
|
||||
public constructor(): R|StringPair| {
|
||||
this<R|StringPair|>(^ Unit, ^ Unit)
|
||||
}
|
||||
|
||||
public final operator fun component1(): R|kotlin/String|
|
||||
|
||||
public final operator fun component2(): R|kotlin/String|
|
||||
|
||||
public final fun copy(a: R|kotlin/String| = this@R|/StringPair|.R|/StringPair.a|, b: R|kotlin/String| = this@R|/StringPair|.R|/StringPair.b|): R|StringPair|
|
||||
|
||||
}
|
||||
public abstract class Abs : R|kotlin/Any| {
|
||||
public constructor(a: R|kotlin/String|): R|Abs| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final val a: R|kotlin/String| = R|<local>/a|
|
||||
public get(): R|kotlin/String|
|
||||
|
||||
}
|
||||
public final class Smth : R|Abs| {
|
||||
public constructor(): R|Smth| {
|
||||
super<R|Abs|>(^ Unit)
|
||||
}
|
||||
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// ISSUE: KT-24503
|
||||
data class StringPair(val a: String, val b: String) {
|
||||
constructor() : this(<!RETURN_NOT_ALLOWED!>return<!>, <!RETURN_NOT_ALLOWED!>return<!>)
|
||||
}
|
||||
|
||||
abstract class Abs(val a: String)
|
||||
|
||||
class Smth : Abs {
|
||||
constructor() : super(<!RETURN_NOT_ALLOWED!>return<!>)
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
FILE: main.kt
|
||||
public final fun test(x: R|A<*>|): R|kotlin/Unit| {
|
||||
R|<local>/x|.R|SubstitutionOverride</A.call: R|kotlin/Unit|>|(vararg(call@fun <anonymous>(y: R|kotlin/Any?|): R|kotlin/Unit| <inline=Unknown> {
|
||||
Q|kotlin/Unit|
|
||||
}
|
||||
))
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// ISSUE: KT-41721
|
||||
|
||||
// FILE: SAM.java
|
||||
public interface SAM<T> {
|
||||
void apply(T x);
|
||||
}
|
||||
|
||||
// FILE: A.java
|
||||
public class A<T> {
|
||||
public void call(SAM<T>... block) { block[0].apply(null); }
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
fun test(x: A<*>) {
|
||||
x.call({ y: Any? -> Unit })
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
FILE: assignToBoundSmartcastedVariable.kt
|
||||
public abstract interface A : R|kotlin/Any| {
|
||||
}
|
||||
public abstract interface B : R|kotlin/Any| {
|
||||
public abstract fun fooB(x: R|kotlin/Int|): R|kotlin/String|
|
||||
|
||||
}
|
||||
public final class Foo : R|kotlin/Any| {
|
||||
public constructor(): R|Foo| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final fun test(ab: R|A|): R|kotlin/Unit| {
|
||||
when () {
|
||||
(R|<local>/ab| is R|B|) -> {
|
||||
lvar z: R|it(B & A)| = R|/id|<R|it(B & A)|>(R|<local>/ab|)
|
||||
R|<local>/z| = R|/Foo.Foo<CS errors: /Foo.Foo>#|()
|
||||
R|<local>/z|.R|/B.fooB|(Int(1))
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// ISSUE: KT-53752
|
||||
// INFERENCE_HELPERS
|
||||
|
||||
interface A
|
||||
interface B {
|
||||
fun fooB(x: Int): String
|
||||
}
|
||||
|
||||
class Foo
|
||||
|
||||
fun test(ab: A) {
|
||||
if (ab is B) {
|
||||
var z = id(ab) // materialize smartcast
|
||||
z = <!ASSIGNMENT_TYPE_MISMATCH!>Foo()<!> // unsafe assignment
|
||||
z.fooB(1)
|
||||
}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
FILE: boundSmartcastWithProjection.kt
|
||||
public final class Inv<T> : R|kotlin/Any| {
|
||||
public constructor<T>(data: R|T|): R|Inv<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final val data: R|T| = R|<local>/data|
|
||||
public get(): R|T|
|
||||
|
||||
}
|
||||
public final fun test1(x: R|Inv<out kotlin/String?>|): R|kotlin/Unit| {
|
||||
lval y: R|kotlin/String?| = R|<local>/x|.R|SubstitutionOverride</Inv.data: R|CapturedType(out kotlin/String?)|>|
|
||||
when (R|<local>/y|) {
|
||||
($subj$ is R|kotlin/String|) -> {
|
||||
R|<local>/x|.R|SubstitutionOverride</Inv.data: R|CapturedType(out kotlin/String?)|>|.R|kotlin/String.length|
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public final fun test2(x: R|Inv<out kotlin/Any?>|): R|kotlin/Unit| {
|
||||
lval y: R|kotlin/Any?| = R|<local>/x|.R|SubstitutionOverride</Inv.data: R|CapturedType(out kotlin/Any?)|>|
|
||||
when (R|<local>/y|) {
|
||||
($subj$ is R|kotlin/String|) -> {
|
||||
R|<local>/x|.R|SubstitutionOverride</Inv.data: R|CapturedType(out kotlin/Any?)|>|.R|kotlin/String.length|
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// ISSUE: KT-24779
|
||||
|
||||
class Inv<T>(val data: T)
|
||||
|
||||
fun test1(x: Inv<out String?>) {
|
||||
val y = x.data
|
||||
when (y) {
|
||||
is String -> x.data.length // Smart cast: x.data is String
|
||||
}
|
||||
}
|
||||
|
||||
fun test2(x: Inv<out Any?>) {
|
||||
val y = x.data
|
||||
when (y) {
|
||||
is String -> x.data.length // No smart cast, UNRESOLVED_REFERENCE: length
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
FILE: contractSafeCall.kt
|
||||
public final fun test(list: R|kotlin/collections/List<kotlin/Any>?|): R|kotlin/Unit| {
|
||||
when () {
|
||||
==(R|<local>/list|?.{ $subj$.R|kotlin/collections/isNullOrEmpty|<R|kotlin/Any|>() }, Boolean(true)) -> {
|
||||
^test Unit
|
||||
}
|
||||
}
|
||||
|
||||
R|<local>/list|.R|SubstitutionOverride<kotlin/collections/List.size: R|kotlin/Int|><Inapplicable(UNSAFE_CALL): kotlin/collections/List.size>#|
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// ISSUE: KT-51796
|
||||
// WITH_STDLIB
|
||||
|
||||
fun test(list: List<Any>?) {
|
||||
if (list?.isNullOrEmpty() == true) {
|
||||
return
|
||||
}
|
||||
list<!UNSAFE_CALL!>.<!>size // should be unsafe call
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
FILE: earlyReturnInNonExhaustiveWhen.kt
|
||||
public final fun foo(str: R|kotlin/String?|): R|kotlin/Int| {
|
||||
when () {
|
||||
==(R|<local>/str|, Null(null)) -> {
|
||||
^foo Int(-1)
|
||||
}
|
||||
}
|
||||
|
||||
when () {
|
||||
==(R|<local>/str|.R|kotlin/String.length|, Int(123)) -> {
|
||||
^foo Int(123)
|
||||
}
|
||||
}
|
||||
|
||||
^foo Int(321)
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// ISSUE: KT-24901
|
||||
|
||||
fun foo(str: String?): Int {
|
||||
when {
|
||||
str == null -> return -1
|
||||
}
|
||||
if (str.length == 123)
|
||||
return 123
|
||||
return 321
|
||||
}
|
||||
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
FILE: returnFromWhen.kt
|
||||
public final fun test_1(name: R|kotlin/String?|): R|kotlin/Unit| {
|
||||
when (R|<local>/name|) {
|
||||
==($subj$, Null(null)) -> {
|
||||
^test_1 Unit
|
||||
}
|
||||
}
|
||||
|
||||
R|<local>/name|.R|kotlin/String.length|
|
||||
}
|
||||
public final fun test_2(name: R|kotlin/String?|): R|kotlin/Unit| {
|
||||
when (lval s: R|kotlin/String?| = R|<local>/name|) {
|
||||
==($subj$, Null(null)) -> {
|
||||
^test_2 Unit
|
||||
}
|
||||
}
|
||||
|
||||
R|<local>/name|.R|kotlin/String.length|
|
||||
}
|
||||
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
// ISSUE: KT-52262
|
||||
|
||||
fun test_1(name: String?) {
|
||||
when (name) {
|
||||
null -> return
|
||||
}
|
||||
name.length
|
||||
}
|
||||
|
||||
fun test_2(name: String?) {
|
||||
when (val s = name) {
|
||||
null -> return
|
||||
}
|
||||
name.length
|
||||
}
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
FILE: elvisAtTheEndOfLoop.kt
|
||||
public final fun condition(): R|kotlin/Boolean| {
|
||||
^condition Boolean(true)
|
||||
}
|
||||
public final fun test_1(x: R|kotlin/String?|): R|kotlin/Unit| {
|
||||
do {
|
||||
R|<local>/x| ?: ^test_1 Unit
|
||||
}
|
||||
while(R|/condition|())
|
||||
R|<local>/x|.R|kotlin/String.length|
|
||||
}
|
||||
public final fun test_2(x: R|kotlin/String?|): R|kotlin/Unit| {
|
||||
do {
|
||||
R|<local>/x| ?: R|<local>/x|!!
|
||||
}
|
||||
while(R|/condition|())
|
||||
R|<local>/x|.R|kotlin/String.length|
|
||||
}
|
||||
public final fun test_3(): R|kotlin/Unit| {
|
||||
lvar a: R|kotlin/String?| = Null(null)
|
||||
while(R|/condition|()) {
|
||||
R|<local>/a| ?: ^test_3 Unit
|
||||
}
|
||||
|
||||
R|<local>/a|.R|kotlin/String.length<Inapplicable(UNSAFE_CALL): kotlin/String.length>#|
|
||||
}
|
||||
public final fun test_4(): R|kotlin/Unit| {
|
||||
lvar a: R|kotlin/String?| = Null(null)
|
||||
while(Boolean(true)) {
|
||||
R|<local>/a| ?: ^test_4 Unit
|
||||
}
|
||||
|
||||
R|<local>/a|.R|kotlin/String.length<Inapplicable(UNSAFE_CALL): kotlin/String.length>#|
|
||||
}
|
||||
public final fun test_5(x: R|kotlin/String?|): R|kotlin/Unit| {
|
||||
do {
|
||||
R|<local>/x| ?: ^test_5 Unit
|
||||
Q|kotlin/Unit|
|
||||
}
|
||||
while(R|/condition|())
|
||||
R|<local>/x|.R|kotlin/String.length|
|
||||
}
|
||||
public final fun test_6(x: R|kotlin/String?|): R|kotlin/Unit| {
|
||||
do {
|
||||
R|<local>/x| ?: R|<local>/x|!!
|
||||
Q|kotlin/Unit|
|
||||
}
|
||||
while(R|/condition|())
|
||||
R|<local>/x|.R|kotlin/String.length|
|
||||
}
|
||||
public final fun test_7(): R|kotlin/Unit| {
|
||||
lvar a: R|kotlin/String?| = Null(null)
|
||||
while(R|/condition|()) {
|
||||
R|<local>/a| ?: ^test_7 Unit
|
||||
R|<local>/a|
|
||||
}
|
||||
|
||||
R|<local>/a|.R|kotlin/String.length<Inapplicable(UNSAFE_CALL): kotlin/String.length>#|
|
||||
}
|
||||
public final fun test_8(): R|kotlin/Unit| {
|
||||
lvar a: R|kotlin/String?| = Null(null)
|
||||
while(Boolean(true)) {
|
||||
R|<local>/a| ?: ^test_8 Unit
|
||||
R|<local>/a|
|
||||
}
|
||||
|
||||
R|<local>/a|.R|kotlin/String.length<Inapplicable(UNSAFE_CALL): kotlin/String.length>#|
|
||||
}
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
// ISSUE: KT-30756
|
||||
|
||||
fun condition(): Boolean = true
|
||||
|
||||
fun test_1(x: String?) {
|
||||
do {
|
||||
x ?: return
|
||||
} while(condition())
|
||||
|
||||
x.length
|
||||
}
|
||||
|
||||
fun test_2(x: String?) {
|
||||
do {
|
||||
x ?: x!!
|
||||
} while(condition())
|
||||
|
||||
x.length
|
||||
}
|
||||
|
||||
fun test_3() {
|
||||
var a: String? = null
|
||||
|
||||
while (condition()) {
|
||||
a ?: return
|
||||
}
|
||||
|
||||
a<!UNSAFE_CALL!>.<!>length
|
||||
}
|
||||
|
||||
fun test_4() {
|
||||
var a: String? = null
|
||||
|
||||
while (true) {
|
||||
a ?: return
|
||||
}
|
||||
|
||||
a<!UNSAFE_CALL!>.<!>length
|
||||
}
|
||||
|
||||
fun test_5(x: String?) {
|
||||
do {
|
||||
x ?: return
|
||||
Unit
|
||||
} while(condition())
|
||||
|
||||
x.length
|
||||
}
|
||||
|
||||
fun test_6(x: String?) {
|
||||
do {
|
||||
x ?: x!!
|
||||
Unit
|
||||
} while(condition())
|
||||
|
||||
x.length
|
||||
}
|
||||
|
||||
fun test_7() {
|
||||
var a: String? = null
|
||||
|
||||
while (condition()) {
|
||||
a ?: return
|
||||
a
|
||||
}
|
||||
|
||||
a<!UNSAFE_CALL!>.<!>length
|
||||
}
|
||||
|
||||
fun test_8() {
|
||||
var a: String? = null
|
||||
|
||||
while (true) {
|
||||
a ?: return
|
||||
a
|
||||
}
|
||||
|
||||
a<!UNSAFE_CALL!>.<!>length
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
FILE: noSmartcastToNullableNothing.kt
|
||||
public abstract interface A : R|kotlin/Any| {
|
||||
}
|
||||
public final fun foo(testFun: R|((kotlin/Int) -> kotlin/Unit)?|, anyInterface: R|A?|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun test(x: R|kotlin/Int?|): R|kotlin/Unit| {
|
||||
R|/foo<Inapplicable(INAPPLICABLE): /foo>#|(when () {
|
||||
!=(R|<local>/x|, Null(null)) -> {
|
||||
foo@fun <anonymous>(it: R|kotlin/Int|): R|kotlin/Unit| <inline=Unknown> {
|
||||
Int(0)
|
||||
}
|
||||
|
||||
}
|
||||
else -> {
|
||||
Null(null)
|
||||
}
|
||||
}
|
||||
, R|<local>/x|)
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user