[FIR-TEST] Add coroutines diagnostic tests from old FE to FIR test suite
This commit is contained in:
+881
-1
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.fir;
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
import org.jetbrains.kotlin.test.TargetBackend;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
@@ -30,7 +31,7 @@ public class FirOldFrontendDiagnosticsTestWithStdlibGenerated extends AbstractFi
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInTestsWithStdLib() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true, "coroutines");
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("ArrayOfNothing.kt")
|
||||
@@ -1592,6 +1593,885 @@ public class FirOldFrontendDiagnosticsTestWithStdlibGenerated extends AbstractFi
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/coroutines")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Coroutines extends AbstractFirOldFrontendDiagnosticsTestWithStdlib {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception {
|
||||
KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.ANY, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInCoroutines() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/coroutines"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("allowNullOperatorsForResult_1_3.kt")
|
||||
public void testAllowNullOperatorsForResult_1_3() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/allowNullOperatorsForResult_1_3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("allowNullOperatorsForResult_1_4.kt")
|
||||
public void testAllowNullOperatorsForResult_1_4() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/allowNullOperatorsForResult_1_4.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("allowResultInReturnTypeWithFlag.kt")
|
||||
public void testAllowResultInReturnTypeWithFlag() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/allowResultInReturnTypeWithFlag.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("allowResultInReturnType_1_3.kt")
|
||||
public void testAllowResultInReturnType_1_3() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/allowResultInReturnType_1_3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("allowResultInReturnType_1_4.kt")
|
||||
public void testAllowResultInReturnType_1_4() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/allowResultInReturnType_1_4.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("basicBuildListBuildMap.kt")
|
||||
public void testBasicBuildListBuildMap() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/basicBuildListBuildMap.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("callableReferences.kt")
|
||||
public void testCallableReferences() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReferences.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("coroutineContext.kt")
|
||||
public void testCoroutineContext() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/coroutineContext.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("coroutinesDisabled.kt")
|
||||
public void testCoroutinesDisabled() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/coroutinesDisabled.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("coroutinesEnabledWithWarning.kt")
|
||||
public void testCoroutinesEnabledWithWarning() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/coroutinesEnabledWithWarning.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("illegalSuspendCalls.kt")
|
||||
public void testIllegalSuspendCalls() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/illegalSuspendCalls.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("illegalSuspendCallsForDelegated.kt")
|
||||
public void testIllegalSuspendCallsForDelegated() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/illegalSuspendCallsForDelegated.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("irrelevantSuspendDeclarations.kt")
|
||||
public void testIrrelevantSuspendDeclarations() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/irrelevantSuspendDeclarations.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kSuspendFunctionAsSupertype.kt")
|
||||
public void testKSuspendFunctionAsSupertype() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/kSuspendFunctionAsSupertype.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt18292.kt")
|
||||
public void testKt18292() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/kt18292.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt28658.kt")
|
||||
public void testKt28658() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/kt28658.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt36947.kt")
|
||||
public void testKt36947() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/kt36947.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt37309.kt")
|
||||
public void testKt37309() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/kt37309.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt38179.kt")
|
||||
public void testKt38179() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/kt38179.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("lambdaExpectedType.kt")
|
||||
public void testLambdaExpectedType() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/lambdaExpectedType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("mixingSuspendability.kt")
|
||||
public void testMixingSuspendability() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/mixingSuspendability.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("modifierFormForNonBuiltInSuspend.kt")
|
||||
public void testModifierFormForNonBuiltInSuspend() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/modifierFormForNonBuiltInSuspend.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("modifierFormForNonBuiltInSuspendWithAnyParameter.kt")
|
||||
public void testModifierFormForNonBuiltInSuspendWithAnyParameter() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/modifierFormForNonBuiltInSuspendWithAnyParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noDefaultCoroutineImports.kt")
|
||||
public void testNoDefaultCoroutineImports_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/noDefaultCoroutineImports.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("nonLocalSuspension.kt")
|
||||
public void testNonLocalSuspension() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/nonLocalSuspension.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nonModifierFormForBuiltIn.kt")
|
||||
public void testNonModifierFormForBuiltIn() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/nonModifierFormForBuiltIn.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nonModifierFormForBuiltInRenameOnImport.kt")
|
||||
public void testNonModifierFormForBuiltInRenameOnImport() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/nonModifierFormForBuiltInRenameOnImport.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("operators.kt")
|
||||
public void testOperators() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/operators.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("returnLabelForBuiltInSuspend.kt")
|
||||
public void testReturnLabelForBuiltInSuspend() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/returnLabelForBuiltInSuspend.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("suspendApplicability.kt")
|
||||
public void testSuspendApplicability_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendApplicability.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("suspendConflictsWithNoSuspend.kt")
|
||||
public void testSuspendConflictsWithNoSuspend() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendConflictsWithNoSuspend.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("suspendCoroutineOrReturn.kt")
|
||||
public void testSuspendCoroutineOrReturn() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendCoroutineOrReturn.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("suspendCoroutineOrReturn_1_2.kt")
|
||||
public void testSuspendCoroutineOrReturn_1_2() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendCoroutineOrReturn_1_2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("suspendCoroutineUnavailableWithNewAPI.kt")
|
||||
public void testSuspendCoroutineUnavailableWithNewAPI() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendCoroutineUnavailableWithNewAPI.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("suspendCoroutineUnavailableWithOldAPI.kt")
|
||||
public void testSuspendCoroutineUnavailableWithOldAPI() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendCoroutineUnavailableWithOldAPI.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("suspendCovarianJavaOverride.kt")
|
||||
public void testSuspendCovarianJavaOverride_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendCovarianJavaOverride.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("suspendDestructuring.kt")
|
||||
public void testSuspendDestructuring() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendDestructuring.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("suspendExternalFunctions.kt")
|
||||
public void testSuspendExternalFunctions() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendExternalFunctions.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("suspendFunctionN.kt")
|
||||
public void testSuspendFunctionN() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctionN.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("suspendFunctions.kt")
|
||||
public void testSuspendFunctions_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctions.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("suspendJavaImplementationFromDifferentClass.kt")
|
||||
public void testSuspendJavaImplementationFromDifferentClass_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendJavaImplementationFromDifferentClass.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("suspendJavaOverrides.kt")
|
||||
public void testSuspendJavaOverrides_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendJavaOverrides.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("suspendLambda.kt")
|
||||
public void testSuspendLambda_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendLambda.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("suspendOverridability.kt")
|
||||
public void testSuspendOverridability() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendOverridability.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("suspendTest.kt")
|
||||
public void testSuspendTest() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendTest.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("suspensionPointInMonitor.kt")
|
||||
public void testSuspensionPointInMonitor() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspensionPointInMonitor.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("suspensionPointInMonitorNewInf.kt")
|
||||
public void testSuspensionPointInMonitorNewInf() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspensionPointInMonitorNewInf.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("suspesionInDefaultValue.kt")
|
||||
public void testSuspesionInDefaultValue() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspesionInDefaultValue.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("tryCatchLambda.kt")
|
||||
public void testTryCatchLambda() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/tryCatchLambda.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unsupported.kt")
|
||||
public void testUnsupported() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/unsupported.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("usageOfResultTypeInReturnType.kt")
|
||||
public void testUsageOfResultTypeInReturnType() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/usageOfResultTypeInReturnType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("usageOfResultTypeInReturnType_1_4.kt")
|
||||
public void testUsageOfResultTypeInReturnType_1_4() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/usageOfResultTypeInReturnType_1_4.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("usageOfResultTypeWithNullableOperators.kt")
|
||||
public void testUsageOfResultTypeWithNullableOperators() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/usageOfResultTypeWithNullableOperators.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class CallableReference extends AbstractFirOldFrontendDiagnosticsTestWithStdlib {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception {
|
||||
KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.ANY, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInCallableReference() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("bigArity.kt")
|
||||
public void testBigArity() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/bigArity.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("callableReferenceOnUnresolvedLHS.kt")
|
||||
public void testCallableReferenceOnUnresolvedLHS() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/callableReferenceOnUnresolvedLHS.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("property.kt")
|
||||
public void testProperty_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/property.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("suspendConversionForCallableReferences.kt")
|
||||
public void testSuspendConversionForCallableReferences() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/suspendConversionForCallableReferences.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Inference extends AbstractFirOldFrontendDiagnosticsTestWithStdlib {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInInference() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("applyInsideCoroutine.kt")
|
||||
public void testApplyInsideCoroutine() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/applyInsideCoroutine.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("builderInferenceForMaterializeWithExpectedType.kt")
|
||||
public void testBuilderInferenceForMaterializeWithExpectedType() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/builderInferenceForMaterializeWithExpectedType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("callableReferenceToASuspendFunction.kt")
|
||||
public void testCallableReferenceToASuspendFunction() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/callableReferenceToASuspendFunction.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("chainCallWithExtensionExplicitTypes.kt")
|
||||
public void testChainCallWithExtensionExplicitTypes() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/chainCallWithExtensionExplicitTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("coroutineInferenceWithCapturedTypeVariable.kt")
|
||||
public void testCoroutineInferenceWithCapturedTypeVariable() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/coroutineInferenceWithCapturedTypeVariable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("correctMember.kt")
|
||||
public void testCorrectMember() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/correctMember.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("doubleColonExpressionToClassWithParameters.kt")
|
||||
public void testDoubleColonExpressionToClassWithParameters() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/doubleColonExpressionToClassWithParameters.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("elvisOperatorAgainstFlexibleType.kt")
|
||||
public void testElvisOperatorAgainstFlexibleType() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/elvisOperatorAgainstFlexibleType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("extensionPriority.kt")
|
||||
public void testExtensionPriority() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/extensionPriority.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("extensionSuspend.kt")
|
||||
public void testExtensionSuspend() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/extensionSuspend.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("extensionWithNonValuableConstraints.kt")
|
||||
public void testExtensionWithNonValuableConstraints() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/extensionWithNonValuableConstraints.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("extensionsWithNonValuableConstraintsGenericBase.kt")
|
||||
public void testExtensionsWithNonValuableConstraintsGenericBase() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/extensionsWithNonValuableConstraintsGenericBase.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("extensionsWithNonValuableConstraints_1_2.kt")
|
||||
public void testExtensionsWithNonValuableConstraints_1_2() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/extensionsWithNonValuableConstraints_1_2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("incorrectCalls.kt")
|
||||
public void testIncorrectCalls() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/incorrectCalls.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inferCoroutineTypeInOldVersion.kt")
|
||||
public void testInferCoroutineTypeInOldVersion() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/inferCoroutineTypeInOldVersion.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inferenceFromMethodInsideLocalVariable.kt")
|
||||
public void testInferenceFromMethodInsideLocalVariable() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/inferenceFromMethodInsideLocalVariable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt15516.kt")
|
||||
public void testKt15516() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt15516.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt32097.kt")
|
||||
public void testKt32097() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt32097.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt32203.kt")
|
||||
public void testKt32203() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt32203.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt32271.kt")
|
||||
public void testKt32271() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt32271.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt33542.kt")
|
||||
public void testKt33542() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt33542.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt35306.kt")
|
||||
public void testKt35306() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt35306.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt35684.kt")
|
||||
public void testKt35684() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt35684.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt36202.kt")
|
||||
public void testKt36202() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt36202.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt36220.kt")
|
||||
public void testKt36220() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt36220.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt38420.kt")
|
||||
public void testKt38420() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt38420.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt38667.kt")
|
||||
public void testKt38667() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt38667.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nestedLambdaInferenceWithListMap.kt")
|
||||
public void testNestedLambdaInferenceWithListMap() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/nestedLambdaInferenceWithListMap.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nestedSuspendCallInsideLambda.kt")
|
||||
public void testNestedSuspendCallInsideLambda() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/nestedSuspendCallInsideLambda.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("plusAssignInCoroutineContext.kt")
|
||||
public void testPlusAssignInCoroutineContext() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/plusAssignInCoroutineContext.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("plusAssignWithLambda.kt")
|
||||
public void testPlusAssignWithLambda() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/plusAssignWithLambda.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("plusAssignWithLambda2.kt")
|
||||
public void testPlusAssignWithLambda2() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/plusAssignWithLambda2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("qualifiedResolvedExpressionInsideBuilderInference.kt")
|
||||
public void testQualifiedResolvedExpressionInsideBuilderInference() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/qualifiedResolvedExpressionInsideBuilderInference.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("recursiveGenerators.kt")
|
||||
public void testRecursiveGenerators() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/recursiveGenerators.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("recursiveGenerators2.kt")
|
||||
public void testRecursiveGenerators2() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/recursiveGenerators2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("resolveUsualCallWithBuilderInference.kt")
|
||||
public void testResolveUsualCallWithBuilderInference() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/resolveUsualCallWithBuilderInference.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("returnTypeInference.kt")
|
||||
public void testReturnTypeInference() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/returnTypeInference.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("returnTypeInference2.kt")
|
||||
public void testReturnTypeInference2() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/returnTypeInference2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("severalCandidatesWithDifferentVisibility.kt")
|
||||
public void testSeveralCandidatesWithDifferentVisibility() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/severalCandidatesWithDifferentVisibility.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleGenerator.kt")
|
||||
public void testSimpleGenerator() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/simpleGenerator.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("suspendCallsWithErrors.kt")
|
||||
public void testSuspendCallsWithErrors() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/suspendCallsWithErrors.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("suspendCallsWrongUpperBound.kt")
|
||||
public void testSuspendCallsWrongUpperBound() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/suspendCallsWrongUpperBound.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("twoReceiversInScope.kt")
|
||||
public void testTwoReceiversInScope() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/twoReceiversInScope.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeFromReceiver.kt")
|
||||
public void testTypeFromReceiver() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/typeFromReceiver.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("useInferenceInformationFromExtension.kt")
|
||||
public void testUseInferenceInformationFromExtension() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/useInferenceInformationFromExtension.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("variableCallInsideBuilderFunction.kt")
|
||||
public void testVariableCallInsideBuilderFunction() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/variableCallInsideBuilderFunction.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("variableOfAFunctionTypeCall.kt")
|
||||
public void testVariableOfAFunctionTypeCall() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/variableOfAFunctionTypeCall.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("withParameter.kt")
|
||||
public void testWithParameter() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/withParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("withUninferredParameter.kt")
|
||||
public void testWithUninferredParameter() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/withUninferredParameter.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class InlineCrossinline extends AbstractFirOldFrontendDiagnosticsTestWithStdlib {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception {
|
||||
KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.ANY, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInInlineCrossinline() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("inlineOrdinaryOfCrossinlineOrdinary.kt")
|
||||
public void testInlineOrdinaryOfCrossinlineOrdinary_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfCrossinlineOrdinary.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineOrdinaryOfCrossinlineSuspend.kt")
|
||||
public void testInlineOrdinaryOfCrossinlineSuspend_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfCrossinlineSuspend.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineOrdinaryOfNoinlineOrdinary.kt")
|
||||
public void testInlineOrdinaryOfNoinlineOrdinary_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfNoinlineOrdinary.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineOrdinaryOfNoinlineSuspend.kt")
|
||||
public void testInlineOrdinaryOfNoinlineSuspend_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfNoinlineSuspend.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineOrdinaryOfOrdinary.kt")
|
||||
public void testInlineOrdinaryOfOrdinary_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfOrdinary.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineOrdinaryOfSuspend.kt")
|
||||
public void testInlineOrdinaryOfSuspend_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfSuspend.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineSuspendOfCrossinlineOrdinary.kt")
|
||||
public void testInlineSuspendOfCrossinlineOrdinary_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfCrossinlineOrdinary.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineSuspendOfCrossinlineSuspend.kt")
|
||||
public void testInlineSuspendOfCrossinlineSuspend_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfCrossinlineSuspend.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineSuspendOfNoinlineOrdinary.kt")
|
||||
public void testInlineSuspendOfNoinlineOrdinary_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfNoinlineOrdinary.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineSuspendOfNoinlineSuspend.kt")
|
||||
public void testInlineSuspendOfNoinlineSuspend_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfNoinlineSuspend.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineSuspendOfOrdinary.kt")
|
||||
public void testInlineSuspendOfOrdinary_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfOrdinary.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineSuspendOfSuspend.kt")
|
||||
public void testInlineSuspendOfSuspend_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfSuspend.kt", "kotlin.coroutines");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/coroutines/release")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Release extends AbstractFirOldFrontendDiagnosticsTestWithStdlib {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInRelease() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/coroutines/release"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("coroutineContext.kt")
|
||||
public void testCoroutineContext() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/release/coroutineContext.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("languageVersionIsNotEqualToApiVersion.kt")
|
||||
public void testLanguageVersionIsNotEqualToApiVersion() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/release/languageVersionIsNotEqualToApiVersion.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("suspend.kt")
|
||||
public void testSuspend() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/release/suspend.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class RestrictSuspension extends AbstractFirOldFrontendDiagnosticsTestWithStdlib {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception {
|
||||
KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.ANY, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInRestrictSuspension() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("allMembersAllowed.kt")
|
||||
public void testAllMembersAllowed_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/allMembersAllowed.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("extensions.kt")
|
||||
public void testExtensions_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/extensions.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("memberExtension.kt")
|
||||
public void testMemberExtension_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/memberExtension.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("notRelatedFun.kt")
|
||||
public void testNotRelatedFun_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/notRelatedFun.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("outerYield_1_2.kt")
|
||||
public void testOuterYield_1_2() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/outerYield_1_2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("outerYield_1_3.kt")
|
||||
public void testOuterYield_1_3() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/outerYield_1_3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("sameInstance.kt")
|
||||
public void testSameInstance_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/sameInstance.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleForbidden.kt")
|
||||
public void testSimpleForbidden_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/simpleForbidden.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("wrongEnclosingFunction.kt")
|
||||
public void testWrongEnclosingFunction_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/wrongEnclosingFunction.kt", "kotlin.coroutines");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctionType")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class SuspendFunctionType extends AbstractFirOldFrontendDiagnosticsTestWithStdlib {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInSuspendFunctionType() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctionType"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("functionVsSuspendFunction.kt")
|
||||
public void testFunctionVsSuspendFunction() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctionType/functionVsSuspendFunction.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inference1.kt")
|
||||
public void testInference1() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctionType/inference1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inference2.kt")
|
||||
public void testInference2() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctionType/inference2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inference3.kt")
|
||||
public void testInference3() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctionType/inference3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inference4.kt")
|
||||
public void testInference4() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctionType/inference4.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inline.kt")
|
||||
public void testInline() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctionType/inline.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("invoke.kt")
|
||||
public void testInvoke() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctionType/invoke.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("lambdaInOverriddenValInitializer.kt")
|
||||
public void testLambdaInOverriddenValInitializer() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctionType/lambdaInOverriddenValInitializer.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("lambdaInValInitializer.kt")
|
||||
public void testLambdaInValInitializer() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctionType/lambdaInValInitializer.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("modifierApplicability.kt")
|
||||
public void testModifierApplicability() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctionType/modifierApplicability.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noInvokeForSuspendFunction.kt")
|
||||
public void testNoInvokeForSuspendFunction() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctionType/noInvokeForSuspendFunction.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noValueParameters.kt")
|
||||
public void testNoValueParameters() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctionType/noValueParameters.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nullableSuspendFunction.kt")
|
||||
public void testNullableSuspendFunction() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctionType/nullableSuspendFunction.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("suspendFunctionN.kt")
|
||||
public void testSuspendFunctionN() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctionType/suspendFunctionN.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class TailCalls extends AbstractFirOldFrontendDiagnosticsTestWithStdlib {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception {
|
||||
KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.ANY, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInTailCalls() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("forbidden.kt")
|
||||
public void testForbidden_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls/forbidden.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("localFunctions.kt")
|
||||
public void testLocalFunctions() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls/localFunctions.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nothingTypedSuspendFunction_1_2.kt")
|
||||
public void testNothingTypedSuspendFunction_1_2() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls/nothingTypedSuspendFunction_1_2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nothingTypedSuspendFunction_1_3.kt")
|
||||
public void testNothingTypedSuspendFunction_1_3() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls/nothingTypedSuspendFunction_1_3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("recursive.kt")
|
||||
public void testRecursive() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls/recursive.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("tryCatch.kt")
|
||||
public void testTryCatch_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls/tryCatch.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("valid.kt")
|
||||
public void testValid_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls/valid.kt", "kotlin.coroutines");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/deprecated")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
// !LANGUAGE: -AllowNullOperatorsForResult
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION
|
||||
|
||||
fun test(r: Result<Int>?) {
|
||||
r ?: 0
|
||||
r?.isFailure
|
||||
}
|
||||
Vendored
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !LANGUAGE: +AllowNullOperatorsForResult
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION
|
||||
|
||||
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
// !ALLOW_RESULT_RETURN_TYPE
|
||||
// !LANGUAGE: -AllowNullOperatorsForResult
|
||||
|
||||
fun result(): Result<Int> = TODO()
|
||||
val resultP: Result<Int> = result()
|
||||
|
||||
fun f(r1: Result<Int>?) {
|
||||
r1 ?: 0
|
||||
}
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
// !LANGUAGE: +InlineClasses -AllowResultInReturnType
|
||||
|
||||
fun result(): Result<Int> = TODO()
|
||||
val resultP: Result<Int> = result()
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !LANGUAGE: +InlineClasses +AllowResultInReturnType
|
||||
|
||||
fun result(): Result<Int> = TODO()
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
|
||||
|
||||
@OptIn(ExperimentalStdlibApi::class)
|
||||
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// !LANGUAGE: -FunctionTypesWithBigArity
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// SKIP_TXT
|
||||
|
||||
class A {
|
||||
suspend fun foo(
|
||||
p00: Long = 1, p01: A = A(), p02: A = A(), p03: A = A(), p04: A = A(), p05: A = A(), p06: A = A(), p07: A = A(), p08: A = A(), p09: A = A(),
|
||||
p10: A = A(), p11: A = A(), p12: A = A(), p13: A = A(), p14: A = A(), p15: A = A(), p16: A = A(), p17: A = A(), p18: A = A(), p19: A = A(),
|
||||
p20: A = A(), p21: A = A(), p22: A = A(), p23: A = A(), p24: A = A(), p25: A = A(), p26: A = A(), p27: A = A(), p28: A = A(), p29: String
|
||||
): String {
|
||||
return p29
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun expectsLambdaWithBigArity(c: suspend (Long, Long, Long, Long, Long, Long, Long, Long, Long, Long,
|
||||
Long, Long, Long, Long, Long, Long, Long, Long, Long, Long,
|
||||
Long, Long, Long, Long, Long, Long, Long, Long, Long, String) -> String): String {
|
||||
return c.invoke(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, "OK")
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
|
||||
interface Inv
|
||||
class Impl : Inv
|
||||
|
||||
class Scope<InterfaceT, ImplementationT : InterfaceT>(private val implClass: j.Class<ImplementationT>) {
|
||||
fun foo(c: Collection<InterfaceT>) {
|
||||
val hm = c.asSequence()
|
||||
.<!INAPPLICABLE_CANDIDATE!>filter<!>(<!UNRESOLVED_REFERENCE!>implClass::isInstance<!>)
|
||||
.<!INAPPLICABLE_CANDIDATE!>map<!>(<!UNRESOLVED_REFERENCE!>implClass::cast<!>)
|
||||
.<!AMBIGUITY!>toSet<!>()
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// SKIP_TXT
|
||||
// COMMON_COROUTINES_TEST
|
||||
|
||||
import COROUTINES_PACKAGE.coroutineContext
|
||||
|
||||
val c = ::coroutineContext
|
||||
|
||||
fun test() {
|
||||
c()
|
||||
}
|
||||
|
||||
suspend fun test2() {
|
||||
c()
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
inline fun go1(f: () -> String) = f()
|
||||
inline suspend fun go2(f: () -> String) = f()
|
||||
|
||||
fun builder(c: suspend () -> Unit) {}
|
||||
|
||||
suspend fun String.id(): String = this
|
||||
|
||||
fun box() {
|
||||
val x = "f"
|
||||
builder {
|
||||
<!INAPPLICABLE_CANDIDATE!>go1<!>(x::id)
|
||||
<!INAPPLICABLE_CANDIDATE!>go2<!>(x::id)
|
||||
}
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !LANGUAGE: +ReleaseCoroutines
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
|
||||
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// SKIP_TXT
|
||||
|
||||
import kotlin.coroutines.*
|
||||
|
||||
fun ordinal() {
|
||||
kotlin.coroutines.coroutineContext
|
||||
coroutineContext
|
||||
}
|
||||
|
||||
suspend fun named() {
|
||||
kotlin.coroutines.coroutineContext
|
||||
coroutineContext
|
||||
}
|
||||
|
||||
class A {
|
||||
val coroutineContextNew = kotlin.coroutines.coroutineContext
|
||||
val context = coroutineContext
|
||||
}
|
||||
|
||||
class Controller {
|
||||
fun ordinal() {
|
||||
kotlin.coroutines.coroutineContext
|
||||
coroutineContext
|
||||
}
|
||||
|
||||
suspend fun named() {
|
||||
kotlin.coroutines.coroutineContext
|
||||
coroutineContext
|
||||
}
|
||||
|
||||
suspend fun severalArgs(s: String, a: Any) {
|
||||
kotlin.coroutines.coroutineContext
|
||||
coroutineContext
|
||||
}
|
||||
}
|
||||
|
||||
fun builder(c: () -> CoroutineContext) = {}
|
||||
fun builderSuspend(c: suspend () -> CoroutineContext) = {}
|
||||
|
||||
fun builderSeveralArgs(c: (Int, Int, Int) -> CoroutineContext) = {}
|
||||
fun builderSuspendSeveralArgs(c: suspend (Int, Int, Int) -> CoroutineContext) = {}
|
||||
|
||||
fun test() {
|
||||
builder { kotlin.coroutines.coroutineContext }
|
||||
builder { coroutineContext }
|
||||
builderSuspend { kotlin.coroutines.coroutineContext }
|
||||
builderSuspend { coroutineContext }
|
||||
builderSeveralArgs { _, _, _ -> kotlin.coroutines.coroutineContext }
|
||||
builderSeveralArgs { _, _, _ -> coroutineContext }
|
||||
builderSuspendSeveralArgs { _, _, _ -> kotlin.coroutines.coroutineContext }
|
||||
builderSuspendSeveralArgs { _, _, _ -> coroutineContext }
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !LANGUAGE: -Coroutines -ReleaseCoroutines
|
||||
|
||||
suspend fun suspendHere(): String = "OK"
|
||||
|
||||
fun builder(c: suspend () -> Unit) {
|
||||
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
var result = ""
|
||||
|
||||
builder {
|
||||
suspendHere()
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !LANGUAGE: warn:Coroutines -ReleaseCoroutines
|
||||
|
||||
suspend fun suspendHere(): String = "OK"
|
||||
|
||||
fun builder(c: suspend () -> Unit) {
|
||||
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
var result = ""
|
||||
|
||||
builder {
|
||||
suspendHere()
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
import Host.bar
|
||||
|
||||
object Host {
|
||||
suspend fun bar() {}
|
||||
}
|
||||
|
||||
suspend fun foo() {}
|
||||
|
||||
fun noSuspend() {
|
||||
foo()
|
||||
bar()
|
||||
}
|
||||
|
||||
class A {
|
||||
init {
|
||||
foo()
|
||||
bar()
|
||||
}
|
||||
}
|
||||
|
||||
val x = foo()
|
||||
val y = bar()
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
fun bar(d: Delegate): String {
|
||||
val x: String by d
|
||||
return x
|
||||
}
|
||||
|
||||
class Delegate {
|
||||
suspend operator fun getValue(thisRef: Any?, property: Any?): String = ""
|
||||
}
|
||||
Vendored
+37
@@ -0,0 +1,37 @@
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_ANONYMOUS_PARAMETER -UNUSED_VARIABLE
|
||||
// !WITH_NEW_INFERENCE
|
||||
// !WITH_NEW_INFERENCE
|
||||
// NI_EXPECTED_FILE
|
||||
|
||||
class Controller<T> {
|
||||
suspend fun yield(t: T) {}
|
||||
}
|
||||
|
||||
fun <S> generate(g: suspend Controller<S>.() -> Unit): S = TODO()
|
||||
|
||||
val test1 = generate {
|
||||
apply {
|
||||
<!INAPPLICABLE_CANDIDATE!>yield<!>(4)
|
||||
}
|
||||
}
|
||||
|
||||
val test2 = generate {
|
||||
<!INAPPLICABLE_CANDIDATE!>yield<!>(B)
|
||||
apply {
|
||||
<!INAPPLICABLE_CANDIDATE!>yield<!>(C)
|
||||
}
|
||||
}
|
||||
|
||||
val test3 = generate {
|
||||
this.let {
|
||||
<!INAPPLICABLE_CANDIDATE!>yield<!>(B)
|
||||
}
|
||||
|
||||
apply {
|
||||
<!INAPPLICABLE_CANDIDATE!>yield<!>(C)
|
||||
}
|
||||
}
|
||||
|
||||
interface A
|
||||
object B : A
|
||||
object C : A
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !LANGUAGE: +NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
|
||||
|
||||
import kotlin.reflect.KSuspendFunction0
|
||||
import kotlin.reflect.KSuspendFunction1
|
||||
import kotlin.reflect.KFunction0
|
||||
import kotlin.reflect.KFunction1
|
||||
|
||||
fun test0(serialize: KSuspendFunction0<Unit>) {}
|
||||
fun test1(serialize: KSuspendFunction1<Int, Unit>) {}
|
||||
|
||||
suspend fun foo() {}
|
||||
suspend fun bar(x: Int) {}
|
||||
|
||||
fun test() {
|
||||
test0(::foo)
|
||||
<!INAPPLICABLE_CANDIDATE!>test1<!>(::foo)
|
||||
|
||||
<!INAPPLICABLE_CANDIDATE!>test0<!>(::bar)
|
||||
test1(::bar)
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !LANGUAGE: +NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
|
||||
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
|
||||
|
||||
import kotlin.experimental.ExperimentalTypeInference
|
||||
|
||||
suspend fun main() {
|
||||
iFlow { <!INAPPLICABLE_CANDIDATE!>emit<!>(1) }
|
||||
}
|
||||
|
||||
|
||||
@OptIn(ExperimentalTypeInference::class)
|
||||
fun <K> iFlow(@BuilderInference block: suspend iFlowCollector<in K>.() -> Unit): iFlow<K> = TODO()
|
||||
|
||||
interface iFlowCollector<S> {
|
||||
suspend fun emit(value: S)
|
||||
}
|
||||
|
||||
interface iFlow<out V>
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
@file:OptIn(ExperimentalTypeInference::class)
|
||||
|
||||
import kotlin.experimental.ExperimentalTypeInference
|
||||
|
||||
interface Controller<T> {
|
||||
suspend fun yield(t: T) {}
|
||||
|
||||
fun justString(): String = ""
|
||||
|
||||
fun <Z> generidFun(t: Z) = t
|
||||
}
|
||||
|
||||
fun <S> generate(@BuilderInference g: suspend Controller<S>.() -> Unit): S = TODO()
|
||||
|
||||
val test1 = generate {
|
||||
<!INAPPLICABLE_CANDIDATE!>yield<!>(justString())
|
||||
}
|
||||
|
||||
val test2 = generate {
|
||||
<!INAPPLICABLE_CANDIDATE!>yield<!>(generidFun(2))
|
||||
}
|
||||
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER -UNUSED_EXPRESSION
|
||||
|
||||
@file:OptIn(ExperimentalTypeInference::class)
|
||||
|
||||
package a.b
|
||||
|
||||
import kotlin.experimental.ExperimentalTypeInference
|
||||
|
||||
class BatchInfo1(val batchSize: Int)
|
||||
class BatchInfo2<T>(val data: T)
|
||||
|
||||
object Obj
|
||||
|
||||
fun test1() {
|
||||
val a: Sequence<String> = sequence {
|
||||
val x = BatchInfo1::class
|
||||
val y = a.b.BatchInfo1::class
|
||||
val z = Obj::class
|
||||
|
||||
val x1 = BatchInfo1::batchSize
|
||||
val y1 = a.b.BatchInfo1::class
|
||||
}
|
||||
}
|
||||
|
||||
interface Scope<T> {
|
||||
fun yield(t: T) {}
|
||||
}
|
||||
|
||||
fun <S> generate(@BuilderInference g: Scope<S>.() -> Unit): S = TODO()
|
||||
|
||||
val test2 = generate {
|
||||
{ <!INAPPLICABLE_CANDIDATE!>yield<!>("foo") }::class
|
||||
}
|
||||
|
||||
val test3 = generate {
|
||||
({ <!INAPPLICABLE_CANDIDATE!>yield<!>("foo") })::class
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !LANGUAGE: +NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER
|
||||
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
@file:OptIn(ExperimentalTypeInference::class)
|
||||
|
||||
import kotlin.experimental.ExperimentalTypeInference
|
||||
|
||||
class GenericController<T> {
|
||||
suspend fun yield(t: T) {}
|
||||
}
|
||||
|
||||
@BuilderInference
|
||||
suspend fun <K> GenericController<K>.yieldAll(s: Collection<K>) {}
|
||||
|
||||
fun <S> generate(@BuilderInference g: suspend GenericController<S>.() -> Unit): S = TODO()
|
||||
|
||||
val test1 = generate {
|
||||
<!INAPPLICABLE_CANDIDATE!>yield<!>(4)
|
||||
<!INAPPLICABLE_CANDIDATE!>yieldAll<!>(setOf(4, 5))
|
||||
}
|
||||
|
||||
val test2 = generate {
|
||||
<!INAPPLICABLE_CANDIDATE!>yieldAll<!>(setOf(B))
|
||||
}
|
||||
|
||||
val test3 = generate {
|
||||
<!INAPPLICABLE_CANDIDATE!>yieldAll<!>(setOf(B, C))
|
||||
}
|
||||
|
||||
val test4 = generate {
|
||||
<!INAPPLICABLE_CANDIDATE!>yieldAll<!>(setOf(B))
|
||||
|
||||
<!INAPPLICABLE_CANDIDATE!>yield<!>(C)
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Utils
|
||||
fun <X> setOf(vararg x: X): Set<X> = TODO()
|
||||
|
||||
interface A
|
||||
object B : A
|
||||
object C : A
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
|
||||
// !WITH_NEW_INFERENCE
|
||||
// NI_EXPECTED_FILE
|
||||
|
||||
@file:OptIn(ExperimentalTypeInference::class)
|
||||
|
||||
import kotlin.experimental.ExperimentalTypeInference
|
||||
|
||||
interface Base
|
||||
|
||||
interface Controller<T> : Base {
|
||||
suspend fun yield(t: T) {}
|
||||
}
|
||||
|
||||
fun <S> generate(@BuilderInference g: suspend Controller<S>.() -> Unit): S = TODO()
|
||||
|
||||
fun Base.baseExtension() {}
|
||||
fun Controller<out Any?>.outNullableAnyExtension() {}
|
||||
fun Controller<out Any>.outAnyExtension() {}
|
||||
fun Controller<Any?>.invNullableAnyExtension() {}
|
||||
fun <S> Controller<S>.genericExtension() {}
|
||||
|
||||
@BuilderInference
|
||||
fun Controller<String>.safeExtension() {}
|
||||
|
||||
val test1 = generate {
|
||||
<!INAPPLICABLE_CANDIDATE!>yield<!>("foo")
|
||||
baseExtension()
|
||||
}
|
||||
|
||||
val test2 = generate {
|
||||
baseExtension()
|
||||
}
|
||||
|
||||
val test3 = generate {
|
||||
<!INAPPLICABLE_CANDIDATE!>yield<!>(42)
|
||||
outNullableAnyExtension()
|
||||
}
|
||||
|
||||
val test4 = generate {
|
||||
outNullableAnyExtension()
|
||||
}
|
||||
|
||||
val test5 = generate {
|
||||
<!INAPPLICABLE_CANDIDATE!>yield<!>(42)
|
||||
outAnyExtension()
|
||||
}
|
||||
|
||||
val test6 = generate {
|
||||
<!INAPPLICABLE_CANDIDATE!>yield<!>("bar")
|
||||
<!INAPPLICABLE_CANDIDATE!>invNullableAnyExtension<!>()
|
||||
}
|
||||
|
||||
val test7 = generate {
|
||||
<!INAPPLICABLE_CANDIDATE!>yield<!>("baz")
|
||||
<!INAPPLICABLE_CANDIDATE!>genericExtension<!><Int>()
|
||||
}
|
||||
|
||||
val test8 = generate {
|
||||
<!INAPPLICABLE_CANDIDATE!>safeExtension<!>()
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
|
||||
// !WITH_NEW_INFERENCE
|
||||
// NI_EXPECTED_FILE
|
||||
|
||||
@file:OptIn(ExperimentalTypeInference::class)
|
||||
|
||||
import kotlin.experimental.ExperimentalTypeInference
|
||||
|
||||
interface Base<K>
|
||||
|
||||
interface Controller<T> : Base<T> {
|
||||
suspend fun yield(t: T) {}
|
||||
}
|
||||
|
||||
interface SpecificController<T> : Base<String> {
|
||||
suspend fun yield(t: T) {}
|
||||
}
|
||||
|
||||
fun <S> generate(@BuilderInference g: suspend Controller<S>.() -> Unit): S = TODO()
|
||||
fun <S> generateSpecific(@BuilderInference g: suspend SpecificController<S>.() -> Unit): S = TODO()
|
||||
|
||||
fun Base<*>.starBase() {}
|
||||
fun Base<String>.stringBase() {}
|
||||
|
||||
val test1 = generate {
|
||||
starBase()
|
||||
<!INAPPLICABLE_CANDIDATE!>yield<!>("foo")
|
||||
}
|
||||
|
||||
val test2 = generate {
|
||||
starBase()
|
||||
}
|
||||
|
||||
val test3 = generate {
|
||||
<!INAPPLICABLE_CANDIDATE!>yield<!>("bar")
|
||||
<!INAPPLICABLE_CANDIDATE!>stringBase<!>()
|
||||
}
|
||||
|
||||
val test4 = generateSpecific {
|
||||
<!INAPPLICABLE_CANDIDATE!>yield<!>(42)
|
||||
starBase()
|
||||
}
|
||||
|
||||
val test5 = generateSpecific {
|
||||
<!INAPPLICABLE_CANDIDATE!>yield<!>(42)
|
||||
stringBase()
|
||||
}
|
||||
|
||||
val test6 = generateSpecific {
|
||||
stringBase()
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// !LANGUAGE: -ExperimentalBuilderInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
interface Base
|
||||
|
||||
interface Controller<T> : Base {
|
||||
suspend fun yield(t: T) {}
|
||||
}
|
||||
|
||||
fun <S> generate(g: suspend Controller<S>.() -> Unit): S = TODO()
|
||||
|
||||
suspend fun Base.baseExtension() {}
|
||||
|
||||
val test1 = generate {
|
||||
<!INAPPLICABLE_CANDIDATE!>yield<!>("foo")
|
||||
baseExtension()
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
// !WITH_NEW_INFERENCE
|
||||
|
||||
@file:OptIn(ExperimentalTypeInference::class)
|
||||
|
||||
import kotlin.experimental.ExperimentalTypeInference
|
||||
|
||||
class GenericController<T> {
|
||||
suspend fun yield(t: T) {}
|
||||
fun notYield(t: T) {}
|
||||
|
||||
suspend fun yieldBarReturnType(t: T) = t
|
||||
fun barReturnType(): T = TODO()
|
||||
}
|
||||
|
||||
fun <S> generate(@BuilderInference g: suspend GenericController<S>.() -> Unit): List<S> = TODO()
|
||||
|
||||
val test1 = generate {
|
||||
<!INAPPLICABLE_CANDIDATE!>yield<!>(3)
|
||||
}
|
||||
|
||||
val test2 = generate {
|
||||
<!INAPPLICABLE_CANDIDATE!>yield<!>(3)
|
||||
<!INAPPLICABLE_CANDIDATE!>notYield<!>(3)
|
||||
}
|
||||
|
||||
val test3 = generate {
|
||||
<!INAPPLICABLE_CANDIDATE!>yield<!>(3)
|
||||
<!INAPPLICABLE_CANDIDATE!>yieldBarReturnType<!>(3)
|
||||
}
|
||||
|
||||
val test4 = generate {
|
||||
<!INAPPLICABLE_CANDIDATE!>yield<!>(3)
|
||||
barReturnType()
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
// !LANGUAGE: -ExperimentalBuilderInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !WITH_NEW_INFERENCE
|
||||
|
||||
class Builder<T> {
|
||||
suspend fun add(t: T) {}
|
||||
}
|
||||
|
||||
fun <S> build(g: suspend Builder<S>.() -> Unit): List<S> = TODO()
|
||||
fun <S> wrongBuild(g: Builder<S>.() -> Unit): List<S> = TODO()
|
||||
|
||||
fun <S> Builder<S>.extensionAdd(s: S) {}
|
||||
|
||||
suspend fun <S> Builder<S>.safeExtensionAdd(s: S) {}
|
||||
|
||||
val member = build {
|
||||
<!INAPPLICABLE_CANDIDATE!>add<!>(42)
|
||||
}
|
||||
|
||||
val memberWithoutAnn = wrongBuild {
|
||||
<!INAPPLICABLE_CANDIDATE!>add<!>(42)
|
||||
}
|
||||
|
||||
val extension = build {
|
||||
<!INAPPLICABLE_CANDIDATE!>extensionAdd<!>("foo")
|
||||
}
|
||||
|
||||
val safeExtension = build {
|
||||
<!INAPPLICABLE_CANDIDATE!>safeExtensionAdd<!>("foo")
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
|
||||
|
||||
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
// SKIP_TXT
|
||||
class StateMachine<Q> internal constructor() {
|
||||
fun getInputStub(): Q = null as Q
|
||||
}
|
||||
|
||||
fun <T> stateMachine(block: suspend StateMachine<T>.() -> Unit): StateMachine<T> {
|
||||
return StateMachine<T>()
|
||||
}
|
||||
|
||||
class Problem<F>(){
|
||||
fun getInputStub(): F = null as F
|
||||
|
||||
fun createStateMachine(): StateMachine<F> = stateMachine {
|
||||
val letter = getInputStub()
|
||||
if (letter is Any)
|
||||
println("yes")
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER
|
||||
|
||||
suspend fun <T> threadSafeSuspendCallback(startAsync: (CompletionLambda<T>) -> CancellationLambda): T = TODO()
|
||||
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
|
||||
// !LANGUAGE: +NewInference
|
||||
|
||||
import kotlin.experimental.ExperimentalTypeInference
|
||||
|
||||
interface In<in E> {
|
||||
fun send(element: E)
|
||||
}
|
||||
|
||||
class InImpl<E> : In<E> {
|
||||
override fun send(element: E) {}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalTypeInference::class)
|
||||
public fun <T> builder(@BuilderInference block: In<T>.() -> Unit) {
|
||||
InImpl<T>().block()
|
||||
}
|
||||
|
||||
suspend fun yield() {}
|
||||
|
||||
fun test() {
|
||||
builder {
|
||||
send(run {
|
||||
yield() // No error but `yield` is not inside "suspension" context actually
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !LANGUAGE: +NewInference
|
||||
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// ISSUE: KT-35684
|
||||
|
||||
import kotlin.experimental.ExperimentalTypeInference
|
||||
|
||||
fun test_1() {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing")!>sequence {
|
||||
<!INAPPLICABLE_CANDIDATE!>yield<!>(<!DEBUG_INFO_EXPRESSION_TYPE("Inv<kotlin.Any?>")!>materialize()<!>)
|
||||
<!INAPPLICABLE_CANDIDATE!>yield<!>(materialize<Int>())
|
||||
}<!>
|
||||
}
|
||||
|
||||
fun test_2() {
|
||||
sequence {
|
||||
<!INAPPLICABLE_CANDIDATE!>yield<!>(materialize())
|
||||
}
|
||||
}
|
||||
|
||||
fun test_3() {
|
||||
sequence {
|
||||
<!INAPPLICABLE_CANDIDATE!>yield<!>(materialize<Int>())
|
||||
materialize()
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalTypeInference::class)
|
||||
fun <U> sequence(@BuilderInference block: suspend Inv<U>.() -> Unit): U = null!!
|
||||
|
||||
interface Inv<T> {
|
||||
fun yield(element: T)
|
||||
}
|
||||
|
||||
fun <K> materialize(): Inv<K> = TODO()
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !WITH_NEW_INFERENCE
|
||||
|
||||
import kotlin.experimental.ExperimentalTypeInference
|
||||
|
||||
class TypeDefinition<KotlinType : Any> {
|
||||
fun parse(parser: (serializedValue: String) -> KotlinType?): Unit = TODO()
|
||||
fun serialize(parser: (value: KotlinType) -> Any?): Unit = TODO()
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalTypeInference::class)
|
||||
fun <KotlinType : Any> defineType(@BuilderInference definition: TypeDefinition<KotlinType>.() -> Unit): Unit = TODO()
|
||||
|
||||
fun main() {
|
||||
defineType {
|
||||
parse { it.toInt() }
|
||||
serialize { it.toString() }
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
|
||||
|
||||
@OptIn(ExperimentalStdlibApi::class)
|
||||
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_EXPRESSION
|
||||
|
||||
import kotlin.experimental.ExperimentalTypeInference
|
||||
|
||||
abstract class AnimationVector
|
||||
class AnimationVector1D : AnimationVector()
|
||||
interface PropKey<T, V : AnimationVector>
|
||||
class IntPropKey : PropKey<Int, AnimationVector1D>
|
||||
abstract class AnimationBuilder<T>
|
||||
abstract class DurationBasedAnimationBuilder<T> : AnimationBuilder<T>()
|
||||
class TweenBuilder<T> : DurationBasedAnimationBuilder<T>()
|
||||
class TransitionSpec<S> {
|
||||
fun <T> tween(init: TweenBuilder<T>.() -> Unit): DurationBasedAnimationBuilder<T> = TweenBuilder<T>().apply(init)
|
||||
infix fun <T, V : AnimationVector> PropKey<T, V>.using(builder: AnimationBuilder<T>) {}
|
||||
}
|
||||
class TransitionDefinition<T> {
|
||||
fun transition(fromState: T? = null, toState: T? = null, init: TransitionSpec<T>.() -> Unit) {}
|
||||
}
|
||||
@OptIn(ExperimentalTypeInference::class)
|
||||
fun <T> transitionDefinition(@BuilderInference init: TransitionDefinition<T>.() -> Unit) = TransitionDefinition<T>().apply(init)
|
||||
|
||||
fun main() {
|
||||
val intProp = IntPropKey()
|
||||
val defn = transitionDefinition {
|
||||
transition(1, 2) {
|
||||
intProp using tween {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("TransitionDefinition<kotlin.Any?>")!>defn<!>
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !LANGUAGE: +NewInference
|
||||
|
||||
val configurations4 = listOf(
|
||||
|
||||
Vendored
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !WITH_NEW_INFERENCE
|
||||
|
||||
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
// !DIAGNOSTICS: -UNCHECKED_CAST -EXPERIMENTAL_API_USAGE_ERROR -UNUSED_PARAMETER
|
||||
|
||||
class Bar
|
||||
|
||||
fun <T> materialize() = null as T
|
||||
|
||||
interface FlowCollector<in T> {
|
||||
suspend fun emit(value: T)
|
||||
}
|
||||
|
||||
interface Flow<T>
|
||||
|
||||
public fun <T> flow(@BuilderInference block: suspend FlowCollector<T>.() -> Unit) = materialize<Flow<T>>()
|
||||
|
||||
fun foo(total: Int, next: Int) = 10
|
||||
fun foo(total: Int, next: Float) = 10
|
||||
fun foo(total: Float, next: Int) = 10
|
||||
|
||||
fun call(x: String) {}
|
||||
|
||||
suspend fun foo(x: Int) = flow {
|
||||
var y = 1
|
||||
y += if (x > 2) 1 else 2
|
||||
|
||||
var newValue = 1
|
||||
newValue += listOf<Int>().asSequence().fold(0) { total, next ->
|
||||
<!INAPPLICABLE_CANDIDATE!>call<!>(11)
|
||||
total + next
|
||||
}
|
||||
newValue += listOf<Int>().asSequence().fold(0, fun(total, next): Int { return total + next })
|
||||
newValue += listOf<Int>().asSequence().fold(0, fun(total, next) = total + next)
|
||||
newValue += listOf<Int>().asSequence().fold(0, ::foo)
|
||||
|
||||
emit(materialize<Bar>())
|
||||
|
||||
newValue += listOf<Int>().asSequence().fold(0) { total, next -> total + next }
|
||||
}
|
||||
Vendored
+42
@@ -0,0 +1,42 @@
|
||||
// !DIAGNOSTICS: -UNUSED_ANONYMOUS_PARAMETER -UNUSED_PARAMETER
|
||||
|
||||
fun foo(total: Int, next: Int) = 10
|
||||
fun foo(total: Int, next: Float) = 10
|
||||
fun foo(total: Float, next: Int) = 10
|
||||
|
||||
fun call(x: String) {}
|
||||
|
||||
fun foo(x: Float, y: Float) = {
|
||||
var newValue = 1
|
||||
newValue += listOf<Int>().asSequence().fold(0) { total, next ->
|
||||
<!INAPPLICABLE_CANDIDATE!>call<!>(11)
|
||||
total + next
|
||||
}
|
||||
newValue += listOf<Int>().asSequence().fold(0, fun(total, next): Int { return total + next })
|
||||
newValue += listOf<Int>().asSequence().fold(0, fun(total, next) = total + next)
|
||||
newValue += listOf<Int>().asSequence().fold(0, ::foo)
|
||||
}
|
||||
|
||||
class A {
|
||||
operator fun plus(x: Int) = A()
|
||||
operator fun plusAssign(x: Float) {}
|
||||
}
|
||||
|
||||
fun <T> id(x: T) = x
|
||||
|
||||
fun foo2() = {
|
||||
var x = A()
|
||||
<!INAPPLICABLE_CANDIDATE!>x += { "" }<!>
|
||||
var y = A()
|
||||
y += 1
|
||||
}
|
||||
|
||||
class B {
|
||||
operator fun plus(x: () -> String) = A()
|
||||
operator fun plusAssign(x: () -> Int) {}
|
||||
}
|
||||
|
||||
fun foo3(x: B) = {
|
||||
<!VARIABLE_EXPECTED!>x<!> += { "" }
|
||||
<!VARIABLE_EXPECTED!>x<!> += id { "" }
|
||||
}
|
||||
Vendored
+20
@@ -0,0 +1,20 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_ANONYMOUS_PARAMETER
|
||||
|
||||
open class A
|
||||
|
||||
operator fun <T> T.plus(x: (T) -> Int) = A()
|
||||
operator fun <T> T.plusAssign(x: (Int) -> T) {}
|
||||
|
||||
fun foo(total: Int) = 10
|
||||
fun foo(total: Float) = 10
|
||||
fun foo(total: String) = 10
|
||||
|
||||
fun <T> id(x: T) = x
|
||||
|
||||
fun main() {
|
||||
var newValue = A()
|
||||
<!INAPPLICABLE_CANDIDATE!>newValue += id { total -> A() }<!>
|
||||
<!INAPPLICABLE_CANDIDATE!>newValue += id(fun(total) = A())<!>
|
||||
<!INAPPLICABLE_CANDIDATE!>newValue += id(fun(total): A { return A() })<!>
|
||||
<!ASSIGN_OPERATOR_AMBIGUITY!>newValue += id(::foo)<!>
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
import kotlin.experimental.ExperimentalTypeInference
|
||||
|
||||
fun test() {
|
||||
flow {
|
||||
<!INAPPLICABLE_CANDIDATE!>emit<!>(42)
|
||||
kotlin.coroutines.coroutineContext
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalTypeInference::class)
|
||||
fun <T> flow(@BuilderInference block: suspend FlowCollector<T>.() -> Unit): Flow<T> = TODO()
|
||||
|
||||
interface Flow<out T>
|
||||
|
||||
interface FlowCollector<in T> {
|
||||
suspend fun emit(value: T)
|
||||
}
|
||||
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
@file:OptIn(ExperimentalTypeInference::class)
|
||||
|
||||
import kotlin.experimental.ExperimentalTypeInference
|
||||
|
||||
class GenericController<T> {
|
||||
suspend fun yield(t: T) {}
|
||||
}
|
||||
|
||||
fun <S> generate(@BuilderInference g: suspend GenericController<S>.() -> Unit): List<S> = TODO()
|
||||
|
||||
val test1 = generate {
|
||||
<!INAPPLICABLE_CANDIDATE!>yield<!>(generate {
|
||||
yield(generate {
|
||||
yield(generate {
|
||||
yield(3)
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
// !WITH_NEW_INFERENCE
|
||||
// NI_EXPECTED_FILE
|
||||
|
||||
@file:OptIn(ExperimentalTypeInference::class)
|
||||
|
||||
import kotlin.experimental.ExperimentalTypeInference
|
||||
|
||||
class GenericController<T> {
|
||||
suspend fun yield(t: T) {}
|
||||
}
|
||||
|
||||
fun <S> generate(@BuilderInference g: suspend GenericController<S>.() -> Unit): List<S> = TODO()
|
||||
|
||||
@BuilderInference
|
||||
suspend fun <S> GenericController<List<S>>.yieldGenerate(g: suspend GenericController<S>.() -> Unit): Unit = TODO()
|
||||
|
||||
val test1 = generate {
|
||||
// TODO: KT-15185
|
||||
<!INAPPLICABLE_CANDIDATE!>yieldGenerate<!> {
|
||||
<!INAPPLICABLE_CANDIDATE!>yield<!>(4)
|
||||
}
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !WITH_NEW_INFERENCE
|
||||
// FILE: annotation.kt
|
||||
|
||||
package kotlin
|
||||
|
||||
annotation class BuilderInference
|
||||
|
||||
// FILE: test.kt
|
||||
|
||||
class Builder<T> {
|
||||
fun add(t: T) {}
|
||||
}
|
||||
|
||||
fun <S> build(@BuilderInference g: Builder<S>.() -> Unit): List<S> = TODO()
|
||||
fun <S> wrongBuild(g: Builder<S>.() -> Unit): List<S> = TODO()
|
||||
|
||||
fun <S> Builder<S>.extensionAdd(s: S) {}
|
||||
|
||||
@BuilderInference
|
||||
fun <S> Builder<S>.safeExtensionAdd(s: S) {}
|
||||
|
||||
val member = build {
|
||||
<!INAPPLICABLE_CANDIDATE!>add<!>(42)
|
||||
}
|
||||
|
||||
val memberWithoutAnn = wrongBuild {
|
||||
<!INAPPLICABLE_CANDIDATE!>add<!>(42)
|
||||
}
|
||||
|
||||
val extension = build {
|
||||
<!INAPPLICABLE_CANDIDATE!>extensionAdd<!>("foo")
|
||||
}
|
||||
|
||||
val safeExtension = build {
|
||||
<!INAPPLICABLE_CANDIDATE!>safeExtensionAdd<!>("foo")
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
class Controller
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
@file:OptIn(ExperimentalTypeInference::class)
|
||||
|
||||
import kotlin.experimental.ExperimentalTypeInference
|
||||
|
||||
class GenericController<T> {
|
||||
suspend fun yield(t: T) {}
|
||||
suspend fun yieldSet(t: Set<T>) {}
|
||||
suspend fun yieldVararg(vararg t: T) {}
|
||||
}
|
||||
|
||||
fun <S> generate(@BuilderInference g: suspend GenericController<S>.() -> Unit): S = TODO()
|
||||
|
||||
val test1 = generate {
|
||||
<!INAPPLICABLE_CANDIDATE!>yield<!>(4)
|
||||
}
|
||||
|
||||
val test2 = generate {
|
||||
<!INAPPLICABLE_CANDIDATE!>yieldSet<!>(setOf(1, 2, 3))
|
||||
}
|
||||
|
||||
val test3 = generate {
|
||||
<!INAPPLICABLE_CANDIDATE!>yieldVararg<!>(1, 2, 3)
|
||||
}
|
||||
|
||||
val test4 = generate {
|
||||
<!INAPPLICABLE_CANDIDATE!>yieldVararg<!>(1, 2, "")
|
||||
}
|
||||
|
||||
|
||||
// Util function
|
||||
fun <X> setOf(vararg x: X): Set<X> = TODO()
|
||||
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !WITH_NEW_INFERENCE
|
||||
// NI_EXPECTED_FILE
|
||||
|
||||
@file:OptIn(ExperimentalTypeInference::class)
|
||||
|
||||
import kotlin.experimental.ExperimentalTypeInference
|
||||
|
||||
class Controller<T> {
|
||||
suspend fun yield(t: T) {}
|
||||
}
|
||||
|
||||
fun <S> generate(@BuilderInference g: suspend Controller<S>.() -> Unit): S = TODO()
|
||||
|
||||
class A
|
||||
|
||||
val test1 = generate {
|
||||
<!INAPPLICABLE_CANDIDATE!>yield<!>(A)
|
||||
}
|
||||
|
||||
val test2: Int = generate {
|
||||
<!INAPPLICABLE_CANDIDATE!>yield<!>(A())
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !WITH_NEW_INFERENCE
|
||||
// NI_EXPECTED_FILE
|
||||
|
||||
class Controller<T : Number> {
|
||||
suspend fun yield(t: T) {}
|
||||
}
|
||||
|
||||
fun <S : Number> generate(g: suspend Controller<S>.() -> Unit): S = TODO()
|
||||
|
||||
val test = generate {
|
||||
<!INAPPLICABLE_CANDIDATE!>yield<!>("foo")
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
@file:OptIn(ExperimentalTypeInference::class)
|
||||
|
||||
import kotlin.experimental.ExperimentalTypeInference
|
||||
|
||||
class GenericController<T>
|
||||
|
||||
fun <S> generate(@BuilderInference g: suspend GenericController<S>.() -> Unit): List<S> = TODO()
|
||||
|
||||
@BuilderInference
|
||||
suspend fun GenericController<List<String>>.test() {}
|
||||
|
||||
val test1 = generate {
|
||||
<!INAPPLICABLE_CANDIDATE!>test<!>()
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !WITH_NEW_INFERENCE
|
||||
|
||||
// FILE: annotation.kt
|
||||
|
||||
package kotlin
|
||||
|
||||
annotation class BuilderInference
|
||||
|
||||
// FILE: test.kt
|
||||
|
||||
class GenericController<T> {
|
||||
suspend fun yield(t: T) {}
|
||||
}
|
||||
|
||||
suspend fun <S> GenericController<S>.extensionYield(s: S) {}
|
||||
|
||||
@BuilderInference
|
||||
suspend fun <S> GenericController<S>.safeExtensionYield(s: S) {}
|
||||
|
||||
fun <S> generate(@BuilderInference g: suspend GenericController<S>.() -> Unit): List<S> = TODO()
|
||||
|
||||
val normal = generate {
|
||||
<!INAPPLICABLE_CANDIDATE!>yield<!>(42)
|
||||
}
|
||||
|
||||
val extension = generate {
|
||||
<!INAPPLICABLE_CANDIDATE!>extensionYield<!>("foo")
|
||||
}
|
||||
|
||||
val safeExtension = generate {
|
||||
<!INAPPLICABLE_CANDIDATE!>safeExtensionYield<!>("foo")
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !LANGUAGE: +NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
|
||||
|
||||
Vendored
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
|
||||
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_ANONYMOUS_PARAMETER -UNUSED_VARIABLE
|
||||
// !WITH_NEW_INFERENCE
|
||||
// NI_EXPECTED_FILE
|
||||
|
||||
class GenericController<T> {
|
||||
suspend fun yield(t: T) {}
|
||||
}
|
||||
|
||||
fun <S> generate(g: suspend GenericController<S>.(S) -> Unit): S = TODO()
|
||||
|
||||
val test1 = generate {
|
||||
<!INAPPLICABLE_CANDIDATE!>yield<!>(4)
|
||||
}
|
||||
|
||||
val test2 = generate<Int> {
|
||||
yield(4)
|
||||
}
|
||||
|
||||
val test3 = generate { bar: Int ->
|
||||
yield(4)
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
// COMMON_COROUTINES_TEST
|
||||
// WITH_COROUTINES
|
||||
// SKIP_TXT
|
||||
import COROUTINES_PACKAGE.*
|
||||
import COROUTINES_PACKAGE.intrinsics.*
|
||||
import helpers.*
|
||||
|
||||
// Function is NOT suspend
|
||||
// parameter is crossinline
|
||||
// parameter is NOT suspend
|
||||
// Block is allowed to be called inside the body of owner inline function
|
||||
// Block is allowed to be called from nested classes/lambdas (as common crossinlines)
|
||||
// It is NOT possible to call startCoroutine on the parameter
|
||||
// suspend calls NOT possible inside lambda matching to the parameter
|
||||
|
||||
inline fun test(crossinline c: () -> Unit) {
|
||||
c()
|
||||
val o = object: Runnable {
|
||||
override fun run() {
|
||||
c()
|
||||
}
|
||||
}
|
||||
val l = { c() }
|
||||
c.<!UNRESOLVED_REFERENCE!>startCoroutine<!>(EmptyContinuation)
|
||||
}
|
||||
|
||||
suspend fun calculate() = "OK"
|
||||
|
||||
fun box() {
|
||||
test {
|
||||
calculate()
|
||||
}
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER -NOTHING_TO_INLINE
|
||||
// COMMON_COROUTINES_TEST
|
||||
// SKIP_TXT
|
||||
// WITH_COROUTINES
|
||||
import COROUTINES_PACKAGE.*
|
||||
import COROUTINES_PACKAGE.intrinsics.*
|
||||
import helpers.*
|
||||
|
||||
interface SuspendRunnable {
|
||||
suspend fun run()
|
||||
}
|
||||
|
||||
// Function is NOT suspend
|
||||
// parameter is crossinline
|
||||
// parameter is suspend
|
||||
// Block is NOT allowed to be called inside the body of owner inline function
|
||||
// Block is allowed to be called from nested classes/lambdas (as common crossinlines)
|
||||
// It is NOT possible to call startCoroutine on the parameter
|
||||
// suspend calls possible inside lambda matching to the parameter
|
||||
|
||||
inline fun test(crossinline c: suspend () -> Unit) {
|
||||
c()
|
||||
val o = object : SuspendRunnable {
|
||||
override suspend fun run() {
|
||||
c()
|
||||
}
|
||||
}
|
||||
val l: suspend () -> Unit = { c() }
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
}
|
||||
|
||||
suspend fun calculate() = "OK"
|
||||
|
||||
fun box() {
|
||||
test {
|
||||
calculate()
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE -NOTHING_TO_INLINE
|
||||
// COMMON_COROUTINES_TEST
|
||||
// SKIP_TXT
|
||||
// WITH_COROUTINES
|
||||
import COROUTINES_PACKAGE.*
|
||||
import COROUTINES_PACKAGE.intrinsics.*
|
||||
import helpers.*
|
||||
|
||||
// Function is NOT suspend
|
||||
// parameter is noinline
|
||||
// parameter is NOT suspend
|
||||
// Block is allowed to be called inside the body of owner inline function
|
||||
// Block is allowed to be called from nested classes/lambdas (as common crossinlines)
|
||||
// It is NOT possible to call startCoroutine on the parameter
|
||||
// suspend calls NOT possible inside lambda matching to the parameter
|
||||
inline fun test(noinline c: () -> Unit) {
|
||||
c()
|
||||
val o = object: Runnable {
|
||||
override fun run() {
|
||||
c()
|
||||
}
|
||||
}
|
||||
val l = { c() }
|
||||
c.<!UNRESOLVED_REFERENCE!>startCoroutine<!>(EmptyContinuation)
|
||||
}
|
||||
|
||||
suspend fun calculate() = "OK"
|
||||
|
||||
fun box() {
|
||||
test {
|
||||
calculate()
|
||||
}
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER -NOTHING_TO_INLINE
|
||||
// COMMON_COROUTINES_TEST
|
||||
// SKIP_TXT
|
||||
// WITH_COROUTINES
|
||||
import COROUTINES_PACKAGE.*
|
||||
import COROUTINES_PACKAGE.intrinsics.*
|
||||
import helpers.*
|
||||
|
||||
interface SuspendRunnable {
|
||||
suspend fun run()
|
||||
}
|
||||
|
||||
// Function is NOT suspend
|
||||
// parameter is noinline
|
||||
// parameter is suspend
|
||||
// Block is NOT allowed to be called inside the body of owner inline function
|
||||
// Block is allowed to be called from nested classes/lambdas (as common crossinlines)
|
||||
// It is possible to call startCoroutine on the parameter
|
||||
// suspend calls possible inside lambda matching to the parameter
|
||||
|
||||
inline fun test(noinline c: suspend () -> Unit) {
|
||||
c()
|
||||
val o = object : SuspendRunnable {
|
||||
override suspend fun run() {
|
||||
c()
|
||||
}
|
||||
}
|
||||
val l: suspend () -> Unit = { c() }
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
}
|
||||
|
||||
suspend fun calculate() = "OK"
|
||||
|
||||
fun box() {
|
||||
test {
|
||||
calculate()
|
||||
}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
// COMMON_COROUTINES_TEST
|
||||
// SKIP_TXT
|
||||
// WITH_COROUTINES
|
||||
import COROUTINES_PACKAGE.*
|
||||
import COROUTINES_PACKAGE.intrinsics.*
|
||||
import helpers.*
|
||||
|
||||
// Function is NOT suspend
|
||||
// parameter is inline
|
||||
// parameter is NOT suspend
|
||||
// Block is allowed to be called inside the body of owner inline function
|
||||
// Block is NOT allowed to be called from nested classes/lambdas (as common crossinlines)
|
||||
// It is NOT possible to call startCoroutine on the parameter
|
||||
// suspend calls possible inside lambda matching to the parameter
|
||||
|
||||
inline fun test(c: () -> Unit) {
|
||||
c()
|
||||
val o = object : Runnable {
|
||||
override fun run() {
|
||||
c()
|
||||
}
|
||||
}
|
||||
val l = { c() }
|
||||
c.<!UNRESOLVED_REFERENCE!>startCoroutine<!>(EmptyContinuation)
|
||||
}
|
||||
|
||||
fun builder(c: suspend () -> Unit) {
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
}
|
||||
|
||||
suspend fun calculate() = "OK"
|
||||
|
||||
fun box() {
|
||||
builder {
|
||||
test {
|
||||
calculate()
|
||||
}
|
||||
}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE -NOTHING_TO_INLINE -UNUSED_PARAMETER
|
||||
// COMMON_COROUTINES_TEST
|
||||
// SKIP_TXT
|
||||
// WITH_COROUTINES
|
||||
import COROUTINES_PACKAGE.*
|
||||
import COROUTINES_PACKAGE.intrinsics.*
|
||||
import helpers.*
|
||||
|
||||
interface SuspendRunnable {
|
||||
suspend fun run()
|
||||
}
|
||||
|
||||
// Function is NOT suspend
|
||||
// parameter is inline
|
||||
// parameter is suspend
|
||||
// Block is NOT allowed to be called inside the body of owner inline function
|
||||
// Block is NOT allowed to be called from nested classes/lambdas (as common crossinlines)
|
||||
// It is NOT possible to call startCoroutine on the parameter
|
||||
// suspend calls possible inside lambda matching to the parameter
|
||||
|
||||
inline fun test(c: suspend () -> Unit) {
|
||||
c()
|
||||
val o = object: SuspendRunnable {
|
||||
override suspend fun run() {
|
||||
c()
|
||||
}
|
||||
}
|
||||
val l: suspend () -> Unit = { c() }
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
}
|
||||
|
||||
fun builder(c: suspend () -> Unit) {}
|
||||
|
||||
suspend fun calculate() = "OK"
|
||||
|
||||
fun box() {
|
||||
test {
|
||||
calculate()
|
||||
}
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
// COMMON_COROUTINES_TEST
|
||||
// SKIP_TXT
|
||||
// WITH_COROUTINES
|
||||
import COROUTINES_PACKAGE.*
|
||||
import COROUTINES_PACKAGE.intrinsics.*
|
||||
import helpers.*
|
||||
|
||||
// Function is suspend
|
||||
// parameter is crossinline
|
||||
// parameter is NOT suspend
|
||||
// Block is allowed to be called inside the body of owner inline function
|
||||
// Block is allowed to be called from nested classes/lambdas (as common crossinlines)
|
||||
// It is NOT possible to call startCoroutine on the parameter
|
||||
// suspend calls NOT possible inside lambda matching to the parameter
|
||||
suspend inline fun test(crossinline c: () -> Unit) {
|
||||
c()
|
||||
val o = object : Runnable {
|
||||
override fun run() {
|
||||
c()
|
||||
}
|
||||
}
|
||||
val l = { c() }
|
||||
c.<!UNRESOLVED_REFERENCE!>startCoroutine<!>(EmptyContinuation)
|
||||
}
|
||||
|
||||
fun builder(c: suspend () -> Unit) {
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
}
|
||||
|
||||
suspend fun calculate() = "OK"
|
||||
|
||||
fun box() {
|
||||
builder {
|
||||
test {
|
||||
calculate()
|
||||
}
|
||||
}
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER -NOTHING_TO_INLINE
|
||||
// COMMON_COROUTINES_TEST
|
||||
// SKIP_TXT
|
||||
// WITH_COROUTINES
|
||||
import COROUTINES_PACKAGE.*
|
||||
import COROUTINES_PACKAGE.intrinsics.*
|
||||
import helpers.*
|
||||
|
||||
interface SuspendRunnable {
|
||||
suspend fun run()
|
||||
}
|
||||
|
||||
// Function is suspend
|
||||
// parameter is crossinline
|
||||
// parameter is suspend
|
||||
// Block is allowed to be called inside the body of owner inline function
|
||||
// Block is allowed to be called from nested classes/lambdas (as common crossinlines)
|
||||
// It is NOT possible to call startCoroutine on the parameter
|
||||
// suspend calls possible inside lambda matching to the parameter
|
||||
suspend inline fun test(crossinline c: suspend () -> Unit) {
|
||||
c()
|
||||
val o = object : SuspendRunnable {
|
||||
override suspend fun run() {
|
||||
c()
|
||||
}
|
||||
}
|
||||
val l: suspend () -> Unit = { c() }
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
}
|
||||
|
||||
fun builder(c: suspend () -> Unit) {}
|
||||
|
||||
suspend fun calculate() = "OK"
|
||||
|
||||
fun box() {
|
||||
builder {
|
||||
test {
|
||||
calculate()
|
||||
}
|
||||
}
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE -NOTHING_TO_INLINE
|
||||
// COMMON_COROUTINES_TEST
|
||||
// SKIP_TXT
|
||||
// WITH_COROUTINES
|
||||
import COROUTINES_PACKAGE.*
|
||||
import COROUTINES_PACKAGE.intrinsics.*
|
||||
import helpers.*
|
||||
|
||||
// Function is suspend
|
||||
// parameter is noinline
|
||||
// parameter is NOT suspend
|
||||
// Block is allowed to be called inside the body of owner inline function
|
||||
// Block is allowed to be called from nested classes/lambdas (as common crossinlines)
|
||||
// It is NOT possible to call startCoroutine on the parameter
|
||||
// suspend calls NOT possible inside lambda matching to the parameter
|
||||
suspend inline fun test(noinline c: () -> Unit) {
|
||||
c()
|
||||
val o = object : Runnable {
|
||||
override fun run() {
|
||||
c()
|
||||
}
|
||||
}
|
||||
val l = { c() }
|
||||
c.<!UNRESOLVED_REFERENCE!>startCoroutine<!>(EmptyContinuation)
|
||||
}
|
||||
|
||||
fun builder(c: suspend () -> Unit) {
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
}
|
||||
|
||||
suspend fun calculate() = "OK"
|
||||
|
||||
fun box() {
|
||||
builder {
|
||||
test {
|
||||
calculate()
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE -NOTHING_TO_INLINE -UNUSED_PARAMETER
|
||||
// COMMON_COROUTINES_TEST
|
||||
// SKIP_TXT
|
||||
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER
|
||||
// COMMON_COROUTINES_TEST
|
||||
// SKIP_TXT
|
||||
// WITH_COROUTINES
|
||||
import COROUTINES_PACKAGE.*
|
||||
import COROUTINES_PACKAGE.intrinsics.*
|
||||
import helpers.*
|
||||
|
||||
// Function is suspend
|
||||
// parameter is inline
|
||||
// parameter is NOT suspend
|
||||
// Block is allowed to be called inside the body of owner inline function
|
||||
// Block is NOT allowed to be called from nested classes/lambdas (as common crossinlines)
|
||||
// It is NOT possible to call startCoroutine on the parameter
|
||||
// suspend calls possible inside lambda matching to the parameter
|
||||
suspend inline fun test(c: () -> Unit) {
|
||||
c()
|
||||
val o = object: Runnable {
|
||||
override fun run() {
|
||||
c()
|
||||
}
|
||||
}
|
||||
val l = { c() }
|
||||
c.<!UNRESOLVED_REFERENCE!>startCoroutine<!>(EmptyContinuation)
|
||||
}
|
||||
|
||||
suspend fun calculate() = "OK"
|
||||
|
||||
fun builder(c: suspend () -> Unit) {}
|
||||
|
||||
fun box() {
|
||||
builder {
|
||||
test {
|
||||
calculate()
|
||||
}
|
||||
}
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER -NOTHING_TO_INLINE
|
||||
// COMMON_COROUTINES_TEST
|
||||
// SKIP_TXT
|
||||
// WITH_COROUTINES
|
||||
import COROUTINES_PACKAGE.*
|
||||
import COROUTINES_PACKAGE.intrinsics.*
|
||||
import helpers.*
|
||||
|
||||
interface SuspendRunnable {
|
||||
suspend fun run()
|
||||
}
|
||||
|
||||
// Function is suspend
|
||||
// parameter is inline
|
||||
// parameter is suspend
|
||||
// Block is allowed to be called inside the body of owner inline function
|
||||
// Block is NOT allowed to be called from nested classes/lambdas (as common crossinlines)
|
||||
// It is NOT possible to call startCoroutine on the parameter
|
||||
// suspend calls possible inside lambda matching to the parameter
|
||||
suspend inline fun test(c: suspend () -> Unit) {
|
||||
c()
|
||||
val o = object: SuspendRunnable {
|
||||
override suspend fun run() {
|
||||
c()
|
||||
}
|
||||
}
|
||||
val l: suspend () -> Unit = { c() }
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
}
|
||||
|
||||
fun builder(c: suspend () -> Unit) {
|
||||
}
|
||||
|
||||
suspend fun calculate() = "OK"
|
||||
|
||||
fun box() {
|
||||
builder {
|
||||
test {
|
||||
calculate()
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !CHECK_TYPE
|
||||
class Controller {
|
||||
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
// SKIP_TXT
|
||||
|
||||
import kotlin.reflect.*
|
||||
|
||||
class A: KSuspendFunction0<Unit> {}
|
||||
@@ -0,0 +1,19 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
// SKIP_TXT
|
||||
// WITH_RUNTIME
|
||||
|
||||
import kotlin.coroutines.*
|
||||
|
||||
interface Job : CoroutineContext.Element {}
|
||||
interface Deferred<out T> : Job {
|
||||
suspend fun await(): T
|
||||
}
|
||||
fun <T> async(block: suspend () -> T): Deferred<T> = TODO()
|
||||
|
||||
suspend fun fib(n: Long) =
|
||||
async {
|
||||
when {
|
||||
n < 2 -> n
|
||||
else -> fib(n - 1).<!UNRESOLVED_REFERENCE!>await<!>() <!AMBIGUITY!>+<!> fib(n - 2).<!UNRESOLVED_REFERENCE!>await<!>()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
import kotlin.experimental.ExperimentalTypeInference
|
||||
|
||||
fun test1() {
|
||||
sequence {
|
||||
val a: Array<Int> = arrayOf(1, 2, 3)
|
||||
val b = arrayOf(1, 2, 3)
|
||||
}
|
||||
}
|
||||
|
||||
fun test2() = sequence { arrayOf(1, 2, 3) }
|
||||
|
||||
|
||||
class Foo<T>
|
||||
|
||||
fun <T> f1(f: Foo<T>.() -> Unit) {}
|
||||
|
||||
@OptIn(ExperimentalTypeInference::class)
|
||||
fun <T> f2(@BuilderInference f: Foo<T>.() -> Unit) {
|
||||
}
|
||||
|
||||
fun test3() {
|
||||
f1 {
|
||||
val a: Array<Int> = arrayOf(1, 2, 3)
|
||||
}
|
||||
|
||||
f2 {
|
||||
val a: Array<Int> = arrayOf(1, 2, 3)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
val foo = iterator {
|
||||
<!INAPPLICABLE_CANDIDATE!>yield<!>(0)
|
||||
val nullable: String? = null
|
||||
nullable.<!INAPPLICABLE_CANDIDATE!>length<!>
|
||||
nullable.<!INAPPLICABLE_CANDIDATE!>get<!>(2)
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
|
||||
import kotlin.experimental.ExperimentalTypeInference
|
||||
|
||||
@OptIn(ExperimentalTypeInference::class)
|
||||
fun <E> myBuildList(@BuilderInference builderAction: MutableList<E>.() -> Unit) {
|
||||
ArrayList<E>().builderAction()
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalStdlibApi::class)
|
||||
fun main() {
|
||||
val newList1 = myBuildList {
|
||||
<!INAPPLICABLE_CANDIDATE!>addAll<!>(
|
||||
listOf(1).map { <!INAPPLICABLE_CANDIDATE!>Foo<!>(null) }
|
||||
)
|
||||
}
|
||||
|
||||
val newList2 = buildList {
|
||||
<!INAPPLICABLE_CANDIDATE!>addAll<!>(listOf(1,2,3).map{ <!INAPPLICABLE_CANDIDATE!>Foo<!>(null) })
|
||||
}
|
||||
}
|
||||
|
||||
class Foo(val notNullProp: String)
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// FULL_JDK
|
||||
|
||||
import java.util.*
|
||||
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
// !LANGUAGE: -SuspendConversion
|
||||
// !WITH_NEW_INFERENCE
|
||||
// !CHECK_TYPE
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_VARIABLE
|
||||
|
||||
fun builder(c: suspend () -> Int) = 1
|
||||
fun <T> genericBuilder(c: suspend () -> T): T = null!!
|
||||
fun unitBuilder(c: suspend () -> Unit) = 1
|
||||
fun emptyBuilder(c: suspend () -> Unit) = 1
|
||||
|
||||
fun <T> manyArgumentsBuilder(
|
||||
c1: suspend () -> Unit,
|
||||
c2: suspend () -> T,
|
||||
c3: suspend () -> Int
|
||||
):T = null!!
|
||||
|
||||
fun severalParamsInLambda(c: suspend (String, Int) -> Unit) {}
|
||||
|
||||
fun foo() {
|
||||
builder({ 1 })
|
||||
builder { 1 }
|
||||
|
||||
val x = { 1 }
|
||||
<!INAPPLICABLE_CANDIDATE!>builder<!>(x)
|
||||
builder({1} as (suspend () -> Int))
|
||||
|
||||
var i: Int = 1
|
||||
i = genericBuilder({ 1 })
|
||||
i = genericBuilder { 1 }
|
||||
genericBuilder { 1 }
|
||||
genericBuilder<Int> { 1 }
|
||||
genericBuilder<Int> { "" }
|
||||
|
||||
val y = { 1 }
|
||||
<!INAPPLICABLE_CANDIDATE!>genericBuilder<!>(y)
|
||||
|
||||
unitBuilder {}
|
||||
unitBuilder { 1 }
|
||||
unitBuilder({})
|
||||
unitBuilder({ 1 })
|
||||
|
||||
manyArgumentsBuilder({}, { "" }) { 1 }
|
||||
|
||||
val s: String = manyArgumentsBuilder({}, { "" }) { 1 }
|
||||
|
||||
manyArgumentsBuilder<String>({}, { "" }, { 1 })
|
||||
manyArgumentsBuilder<String>({}, { 1 }, { 2 })
|
||||
|
||||
severalParamsInLambda { x, y ->
|
||||
x checkType { _<String>() }
|
||||
y checkType { _<Int>() }
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
interface AsyncVal { suspend fun getVal(): Int = 1}
|
||||
interface SyncVal { fun getVal(): Int = 1 }
|
||||
|
||||
class MixSuspend : AsyncVal, SyncVal {
|
||||
|
||||
}
|
||||
Vendored
+76
@@ -0,0 +1,76 @@
|
||||
// !LANGUAGE: +ReleaseCoroutines
|
||||
// SKIP_TXT
|
||||
|
||||
fun <R> suspend(block: suspend () -> R): suspend () -> R = block
|
||||
|
||||
class A {
|
||||
infix fun <R> suspend(block: suspend () -> R): suspend () -> R = block
|
||||
}
|
||||
|
||||
@Target(AnnotationTarget.EXPRESSION)
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
annotation class Ann
|
||||
|
||||
fun bar() {
|
||||
suspend {
|
||||
println()
|
||||
}
|
||||
|
||||
@Ann suspend {
|
||||
println()
|
||||
}
|
||||
|
||||
suspend @Ann {
|
||||
println()
|
||||
}
|
||||
|
||||
suspend() {
|
||||
println()
|
||||
}
|
||||
|
||||
suspend({ println() })
|
||||
|
||||
suspend<Unit> {
|
||||
println()
|
||||
}
|
||||
|
||||
val w: (suspend () -> Int) -> Any? = ::suspend
|
||||
|
||||
A().suspend {
|
||||
println()
|
||||
}
|
||||
|
||||
A().suspend() {
|
||||
println()
|
||||
}
|
||||
|
||||
A().suspend({ println() })
|
||||
|
||||
A().suspend<Unit> {
|
||||
println()
|
||||
}
|
||||
|
||||
with(A()) {
|
||||
suspend {
|
||||
println()
|
||||
}
|
||||
|
||||
suspend() {
|
||||
println()
|
||||
}
|
||||
|
||||
suspend({ println() })
|
||||
|
||||
suspend<Unit> {
|
||||
println()
|
||||
}
|
||||
}
|
||||
|
||||
A() suspend {
|
||||
println()
|
||||
}
|
||||
|
||||
A() suspend ({
|
||||
println()
|
||||
})
|
||||
}
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
// !LANGUAGE: +ReleaseCoroutines
|
||||
// SKIP_TXT
|
||||
|
||||
fun <R> suspend(block: R) = block
|
||||
|
||||
class A {
|
||||
infix fun <R> suspend(block: R) = block
|
||||
}
|
||||
|
||||
@Target(AnnotationTarget.EXPRESSION)
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
annotation class Ann
|
||||
|
||||
fun bar() {
|
||||
suspend {
|
||||
println()
|
||||
}
|
||||
|
||||
@Ann suspend {
|
||||
println()
|
||||
}
|
||||
|
||||
suspend @Ann {
|
||||
println()
|
||||
}
|
||||
|
||||
suspend() {
|
||||
println()
|
||||
}
|
||||
|
||||
suspend({ println() })
|
||||
|
||||
suspend<suspend () -> Unit> {
|
||||
println()
|
||||
}
|
||||
|
||||
suspend<Nothing?>(null)
|
||||
|
||||
val w: (Any?) -> Any? = ::suspend
|
||||
|
||||
A().suspend {
|
||||
println()
|
||||
}
|
||||
|
||||
A().suspend() {
|
||||
println()
|
||||
}
|
||||
|
||||
A().suspend({ println() })
|
||||
|
||||
A().suspend<suspend () -> Unit> {
|
||||
println()
|
||||
}
|
||||
|
||||
A().suspend<Nothing?>(null)
|
||||
|
||||
with(A()) {
|
||||
suspend {
|
||||
println()
|
||||
}
|
||||
|
||||
suspend() {
|
||||
println()
|
||||
}
|
||||
|
||||
suspend({ println() })
|
||||
|
||||
suspend<suspend () -> Unit> {
|
||||
println()
|
||||
}
|
||||
|
||||
suspend<Nothing?>(null)
|
||||
}
|
||||
|
||||
A() suspend {
|
||||
println()
|
||||
}
|
||||
|
||||
A() suspend ({
|
||||
println()
|
||||
})
|
||||
|
||||
A() suspend ""
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// FILE: 1.kt
|
||||
// COMMON_COROUTINES_TEST
|
||||
|
||||
fun test(c: Continuation<Unit>) {}
|
||||
|
||||
// FILE: 2.kt
|
||||
import COROUTINES_PACKAGE.*
|
||||
|
||||
fun test2(c: Continuation<Unit>) {}
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
import Host.suspendFromObject
|
||||
|
||||
suspend fun suspendHere() = 1
|
||||
suspend fun <T> another(a: T) = 1
|
||||
|
||||
object Host {
|
||||
suspend fun suspendFromObject() = 1
|
||||
}
|
||||
|
||||
fun <T> builder(c: suspend () -> Unit) { }
|
||||
|
||||
inline fun run(x: () -> Unit) {}
|
||||
|
||||
inline fun runCross(crossinline x: () -> Unit) {}
|
||||
|
||||
fun noinline(x: () -> Unit) {}
|
||||
|
||||
fun foo() {
|
||||
var result = 1
|
||||
builder<String> {
|
||||
suspendHere()
|
||||
suspendFromObject()
|
||||
|
||||
another("")
|
||||
another(1)
|
||||
|
||||
result += suspendHere()
|
||||
result += suspendFromObject()
|
||||
|
||||
run {
|
||||
result += suspendHere()
|
||||
result += suspendFromObject()
|
||||
|
||||
run {
|
||||
suspendHere()
|
||||
suspendFromObject()
|
||||
}
|
||||
}
|
||||
|
||||
runCross {
|
||||
result += suspendHere()
|
||||
result += suspendFromObject()
|
||||
runCross {
|
||||
suspendHere()
|
||||
suspendFromObject()
|
||||
}
|
||||
}
|
||||
|
||||
noinline {
|
||||
result += suspendHere()
|
||||
result += suspendFromObject()
|
||||
noinline {
|
||||
suspendHere()
|
||||
suspendFromObject()
|
||||
}
|
||||
}
|
||||
|
||||
class A {
|
||||
fun bar() {
|
||||
suspendHere()
|
||||
suspendFromObject()
|
||||
}
|
||||
}
|
||||
|
||||
object : Any() {
|
||||
fun baz() {
|
||||
suspendHere()
|
||||
suspendFromObject()
|
||||
}
|
||||
}
|
||||
|
||||
builder<Int> {
|
||||
suspendHere()
|
||||
suspendFromObject()
|
||||
|
||||
another(1)
|
||||
another("")
|
||||
}
|
||||
}
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
// !LANGUAGE: +ReleaseCoroutines
|
||||
// SKIP_TXT
|
||||
|
||||
fun bar() {
|
||||
suspend {
|
||||
println()
|
||||
}
|
||||
|
||||
@Ann suspend {
|
||||
println()
|
||||
}
|
||||
|
||||
suspend @Ann {
|
||||
println()
|
||||
}
|
||||
|
||||
kotlin.suspend {
|
||||
|
||||
}
|
||||
|
||||
suspend() {
|
||||
println()
|
||||
}
|
||||
|
||||
suspend({ println() })
|
||||
|
||||
suspend<Unit> {
|
||||
println()
|
||||
}
|
||||
|
||||
val w: (suspend () -> Int) -> Any? = ::suspend
|
||||
}
|
||||
|
||||
@Target(AnnotationTarget.EXPRESSION)
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
annotation class Ann
|
||||
|
||||
fun main(suspend: WLambdaInvoke) {
|
||||
|
||||
suspend {}
|
||||
}
|
||||
|
||||
class WLambdaInvoke {
|
||||
operator fun invoke(l: () -> Unit) {}
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
// !LANGUAGE: +ReleaseCoroutines
|
||||
// SKIP_TXT
|
||||
|
||||
import kotlin.suspend as suspendLambda
|
||||
|
||||
fun bar() {
|
||||
suspend {
|
||||
println()
|
||||
}
|
||||
|
||||
kotlin.suspend {
|
||||
|
||||
}
|
||||
|
||||
suspendLambda {
|
||||
println()
|
||||
}
|
||||
|
||||
suspendLambda() {
|
||||
println()
|
||||
}
|
||||
|
||||
suspendLambda({ println() })
|
||||
|
||||
suspendLambda<Unit> {
|
||||
println()
|
||||
}
|
||||
|
||||
val w: (suspend () -> Int) -> Any? = ::suspendLambda
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// SKIP_TXT
|
||||
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class A {
|
||||
suspend operator fun get(x: Int) = 1
|
||||
suspend operator fun set(x: Int, v: String) {}
|
||||
|
||||
operator suspend fun contains(y: String): Boolean = true
|
||||
|
||||
suspend operator fun unaryPlus() = this
|
||||
suspend operator fun unaryMinus() = this
|
||||
suspend operator fun not() = this
|
||||
suspend operator fun inc() = this
|
||||
suspend operator fun dec() = this
|
||||
|
||||
suspend operator fun plus(a: A) = a
|
||||
suspend operator fun minus(a: A) = a
|
||||
suspend operator fun times(a: A) = a
|
||||
suspend operator fun div(a: A) = a
|
||||
suspend operator fun rem(a: A) = a
|
||||
suspend operator fun rangeTo(a: A) = a
|
||||
|
||||
suspend operator fun invoke(a: A) = a
|
||||
|
||||
suspend operator fun compareTo(a: A) = hashCode().compareTo(a.hashCode())
|
||||
|
||||
suspend operator fun iterator() = this
|
||||
suspend operator fun hasNext() = false
|
||||
suspend operator fun next() = this
|
||||
|
||||
suspend operator fun contains(b: A) = this == b
|
||||
suspend operator fun get(a: A) = a
|
||||
suspend operator fun equals(a: A) = a === this
|
||||
suspend operator fun set(a: A, b: A) {}
|
||||
|
||||
suspend operator fun provideDelegate(a: A, p: KProperty<*>) = a
|
||||
suspend operator fun getValue(a: A, p: KProperty<*>) = a
|
||||
suspend operator fun setValue(a: A, p: KProperty<*>, b: A) {}
|
||||
}
|
||||
|
||||
class B
|
||||
suspend operator fun B.get(x: Int) =1
|
||||
suspend operator fun B.set(x: Int, v: String) {}
|
||||
|
||||
operator suspend fun B.contains(y: String): Boolean = true
|
||||
|
||||
class C {
|
||||
suspend fun get(x: Int) = 1
|
||||
suspend fun set(x: Int, v: String) {}
|
||||
|
||||
suspend fun contains(y: String): Boolean = true
|
||||
}
|
||||
|
||||
class D
|
||||
suspend fun D.get(x: Int) =1
|
||||
suspend fun D.set(x: Int, v: String) {}
|
||||
|
||||
suspend fun D.contains(y: String): Boolean = true
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// !LANGUAGE: +ReleaseCoroutines
|
||||
// SKIP_TXT
|
||||
|
||||
import kotlin.coroutines.experimental.coroutineContext
|
||||
|
||||
suspend fun test() {
|
||||
coroutineContext
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
// !API_VERSION: 1.2
|
||||
// !DIAGNOSTICS: -PRE_RELEASE_CLASS, -UNUSED_PARAMETER
|
||||
// !LANGUAGE: +ReleaseCoroutines
|
||||
// !WITH_NEW_INFERENCE
|
||||
// SKIP_TXT
|
||||
|
||||
suspend fun dummy() {}
|
||||
|
||||
// TODO: Forbid
|
||||
fun builder(c: suspend () -> Unit) {}
|
||||
|
||||
suspend fun test1() {
|
||||
kotlin.coroutines.coroutineContext
|
||||
|
||||
kotlin.coroutines.experimental.coroutineContext
|
||||
|
||||
suspend {}()
|
||||
|
||||
dummy()
|
||||
|
||||
val c: suspend () -> Unit = {}
|
||||
c()
|
||||
|
||||
builder {}
|
||||
}
|
||||
|
||||
fun test2() {
|
||||
kotlin.coroutines.experimental.buildSequence<Int> {
|
||||
yield(1)
|
||||
}
|
||||
kotlin.sequences.buildSequence<Int> {
|
||||
yield(1)
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun test3(): Unit = kotlin.coroutines.experimental.suspendCoroutine { _ -> Unit }
|
||||
|
||||
suspend fun test4(): Unit = kotlin.coroutines.suspendCoroutine { _ -> Unit }
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !LANGUAGE: +ReleaseCoroutines
|
||||
// SKIP_TXT
|
||||
|
||||
|
||||
Vendored
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -SUSPENSION_CALL_MUST_BE_USED_AS_RETURN_VALUE
|
||||
// COMMON_COROUTINES_TEST
|
||||
|
||||
|
||||
Vendored
+130
@@ -0,0 +1,130 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -SUSPENSION_CALL_MUST_BE_USED_AS_RETURN_VALUE
|
||||
// COMMON_COROUTINES_TEST
|
||||
|
||||
interface SuperInterface
|
||||
|
||||
@COROUTINES_PACKAGE.RestrictsSuspension
|
||||
open class RestrictedController : SuperInterface
|
||||
|
||||
class SubClass : RestrictedController()
|
||||
|
||||
suspend fun Any?.extAny() {}
|
||||
suspend fun SuperInterface.extSuper() {}
|
||||
suspend fun RestrictedController.ext() {}
|
||||
suspend fun SubClass.extSub() {}
|
||||
|
||||
class A {
|
||||
suspend fun Any?.memExtAny() {}
|
||||
suspend fun SuperInterface.memExtSuper() {}
|
||||
suspend fun RestrictedController.memExt() {}
|
||||
suspend fun SubClass.memExtSub() {}
|
||||
}
|
||||
|
||||
|
||||
fun generate1(f: suspend SuperInterface.() -> Unit) {}
|
||||
fun generate2(f: suspend RestrictedController.() -> Unit) {}
|
||||
fun generate3(f: suspend SubClass.() -> Unit) {}
|
||||
|
||||
fun A.test() {
|
||||
generate1 {
|
||||
extAny()
|
||||
memExtAny()
|
||||
extSuper()
|
||||
memExtSuper()
|
||||
with(A()) {
|
||||
extAny()
|
||||
memExtAny()
|
||||
extSuper()
|
||||
memExtSuper()
|
||||
}
|
||||
}
|
||||
generate2 {
|
||||
extAny()
|
||||
memExtAny()
|
||||
extSuper()
|
||||
memExtSuper()
|
||||
|
||||
ext()
|
||||
memExt()
|
||||
with(A()) {
|
||||
extAny()
|
||||
memExtAny()
|
||||
extSuper()
|
||||
memExtSuper()
|
||||
ext()
|
||||
memExt()
|
||||
}
|
||||
}
|
||||
generate3 {
|
||||
extAny()
|
||||
memExtAny()
|
||||
extSuper()
|
||||
memExtSuper()
|
||||
|
||||
ext()
|
||||
memExt()
|
||||
extSub()
|
||||
memExtSub()
|
||||
with(A()) {
|
||||
extAny()
|
||||
memExtAny()
|
||||
extSuper()
|
||||
memExtSuper()
|
||||
ext()
|
||||
memExt()
|
||||
extSub()
|
||||
memExtSub()
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun SuperInterface.fun1() {
|
||||
extAny()
|
||||
memExtAny()
|
||||
extSuper()
|
||||
memExtSuper()
|
||||
with(A()) {
|
||||
extAny()
|
||||
memExtAny()
|
||||
extSuper()
|
||||
memExtSuper()
|
||||
}
|
||||
}
|
||||
suspend fun RestrictedController.fun2() {
|
||||
extAny()
|
||||
memExtAny()
|
||||
extSuper()
|
||||
memExtSuper()
|
||||
|
||||
ext()
|
||||
memExt()
|
||||
with(A()) {
|
||||
extAny()
|
||||
memExtAny()
|
||||
extSuper()
|
||||
memExtSuper()
|
||||
ext()
|
||||
memExt()
|
||||
}
|
||||
}
|
||||
suspend fun SubClass.fun3() {
|
||||
extAny()
|
||||
memExtAny()
|
||||
extSuper()
|
||||
memExtSuper()
|
||||
|
||||
ext()
|
||||
memExt()
|
||||
extSub()
|
||||
memExtSub()
|
||||
with(A()) {
|
||||
extAny()
|
||||
memExtAny()
|
||||
extSuper()
|
||||
memExtSuper()
|
||||
ext()
|
||||
memExt()
|
||||
extSub()
|
||||
memExtSub()
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+62
@@ -0,0 +1,62 @@
|
||||
// COMMON_COROUTINES_TEST
|
||||
// SKIP_TXT
|
||||
@COROUTINES_PACKAGE.RestrictsSuspension
|
||||
class RestrictedController {
|
||||
suspend fun member() {
|
||||
ext()
|
||||
member()
|
||||
memberExt()
|
||||
}
|
||||
|
||||
suspend fun RestrictedController.memberExt() {
|
||||
ext()
|
||||
member()
|
||||
memberExt()
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun RestrictedController.ext() {
|
||||
ext()
|
||||
member()
|
||||
memberExt()
|
||||
}
|
||||
|
||||
fun generate(c: suspend RestrictedController.() -> Unit) {}
|
||||
|
||||
fun runBlocking(x: suspend () -> Unit) {}
|
||||
|
||||
fun test() {
|
||||
generate a@{
|
||||
ext()
|
||||
member()
|
||||
memberExt()
|
||||
|
||||
this@a.ext()
|
||||
this@a.member()
|
||||
this@a.memberExt()
|
||||
|
||||
generate b@{
|
||||
ext()
|
||||
member()
|
||||
memberExt()
|
||||
|
||||
this@a.ext()
|
||||
this@a.member()
|
||||
this@a.memberExt()
|
||||
|
||||
this@b.ext()
|
||||
this@b.member()
|
||||
this@b.memberExt()
|
||||
}
|
||||
|
||||
runBlocking {
|
||||
ext()
|
||||
member()
|
||||
memberExt()
|
||||
|
||||
this@a.ext()
|
||||
this@a.member()
|
||||
this@a.memberExt()
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user