[Tests] Test samples from KEEP
This commit is contained in:
committed by
TeamCityServer
parent
b0a7be72e8
commit
d8faa9686d
+66
-6
@@ -10582,12 +10582,6 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
|
|||||||
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/ambiguityInGroup.kt");
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/ambiguityInGroup.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
@TestMetadata("dp.kt")
|
|
||||||
public void testDp() throws Exception {
|
|
||||||
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/dp.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("functionalType.kt")
|
@TestMetadata("functionalType.kt")
|
||||||
public void testFunctionalType() throws Exception {
|
public void testFunctionalType() throws Exception {
|
||||||
@@ -10735,17 +10729,83 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
|
|||||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("autoCloseScope.kt")
|
||||||
|
public void testAutoCloseScope() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/autoCloseScope.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("canvas.kt")
|
||||||
|
public void testCanvas() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/canvas.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("clickHandler.kt")
|
@TestMetadata("clickHandler.kt")
|
||||||
public void testClickHandler() throws Exception {
|
public void testClickHandler() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/clickHandler.kt");
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/clickHandler.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("compareTo.kt")
|
||||||
|
public void testCompareTo() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/compareTo.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("decimateEveryEvenThird.kt")
|
||||||
|
public void testDecimateEveryEvenThird() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/decimateEveryEvenThird.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("dp.kt")
|
||||||
|
public void testDp() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/dp.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("functionalType.kt")
|
@TestMetadata("functionalType.kt")
|
||||||
public void testFunctionalType() throws Exception {
|
public void testFunctionalType() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/functionalType.kt");
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/functionalType.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("iterableClass.kt")
|
||||||
|
public void testIterableClass() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/iterableClass.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("json.kt")
|
||||||
|
public void testJson() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/json.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("loggingContext.kt")
|
||||||
|
public void testLoggingContext() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/loggingContext.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("monoidSum.kt")
|
||||||
|
public void testMonoidSum() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/monoidSum.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("transaction.kt")
|
||||||
|
public void testTransaction() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/transaction.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("userStorage.kt")
|
||||||
|
public void testUserStorage() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/userStorage.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+66
-6
@@ -10582,12 +10582,6 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
|||||||
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/ambiguityInGroup.kt");
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/ambiguityInGroup.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
@TestMetadata("dp.kt")
|
|
||||||
public void testDp() throws Exception {
|
|
||||||
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/dp.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("functionalType.kt")
|
@TestMetadata("functionalType.kt")
|
||||||
public void testFunctionalType() throws Exception {
|
public void testFunctionalType() throws Exception {
|
||||||
@@ -10735,17 +10729,83 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
|||||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("autoCloseScope.kt")
|
||||||
|
public void testAutoCloseScope() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/autoCloseScope.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("canvas.kt")
|
||||||
|
public void testCanvas() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/canvas.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("clickHandler.kt")
|
@TestMetadata("clickHandler.kt")
|
||||||
public void testClickHandler() throws Exception {
|
public void testClickHandler() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/clickHandler.kt");
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/clickHandler.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("compareTo.kt")
|
||||||
|
public void testCompareTo() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/compareTo.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("decimateEveryEvenThird.kt")
|
||||||
|
public void testDecimateEveryEvenThird() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/decimateEveryEvenThird.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("dp.kt")
|
||||||
|
public void testDp() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/dp.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("functionalType.kt")
|
@TestMetadata("functionalType.kt")
|
||||||
public void testFunctionalType() throws Exception {
|
public void testFunctionalType() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/functionalType.kt");
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/functionalType.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("iterableClass.kt")
|
||||||
|
public void testIterableClass() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/iterableClass.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("json.kt")
|
||||||
|
public void testJson() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/json.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("loggingContext.kt")
|
||||||
|
public void testLoggingContext() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/loggingContext.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("monoidSum.kt")
|
||||||
|
public void testMonoidSum() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/monoidSum.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("transaction.kt")
|
||||||
|
public void testTransaction() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/transaction.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("userStorage.kt")
|
||||||
|
public void testUserStorage() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/userStorage.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+66
-6
@@ -10582,12 +10582,6 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
|
|||||||
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/ambiguityInGroup.kt");
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/ambiguityInGroup.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
@TestMetadata("dp.kt")
|
|
||||||
public void testDp() throws Exception {
|
|
||||||
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/dp.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("functionalType.kt")
|
@TestMetadata("functionalType.kt")
|
||||||
public void testFunctionalType() throws Exception {
|
public void testFunctionalType() throws Exception {
|
||||||
@@ -10735,17 +10729,83 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
|
|||||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("autoCloseScope.kt")
|
||||||
|
public void testAutoCloseScope() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/autoCloseScope.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("canvas.kt")
|
||||||
|
public void testCanvas() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/canvas.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("clickHandler.kt")
|
@TestMetadata("clickHandler.kt")
|
||||||
public void testClickHandler() throws Exception {
|
public void testClickHandler() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/clickHandler.kt");
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/clickHandler.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("compareTo.kt")
|
||||||
|
public void testCompareTo() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/compareTo.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("decimateEveryEvenThird.kt")
|
||||||
|
public void testDecimateEveryEvenThird() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/decimateEveryEvenThird.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("dp.kt")
|
||||||
|
public void testDp() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/dp.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("functionalType.kt")
|
@TestMetadata("functionalType.kt")
|
||||||
public void testFunctionalType() throws Exception {
|
public void testFunctionalType() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/functionalType.kt");
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/functionalType.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("iterableClass.kt")
|
||||||
|
public void testIterableClass() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/iterableClass.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("json.kt")
|
||||||
|
public void testJson() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/json.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("loggingContext.kt")
|
||||||
|
public void testLoggingContext() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/loggingContext.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("monoidSum.kt")
|
||||||
|
public void testMonoidSum() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/monoidSum.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("transaction.kt")
|
||||||
|
public void testTransaction() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/transaction.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("userStorage.kt")
|
||||||
|
public void testUserStorage() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/userStorage.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+40
-6
@@ -16163,12 +16163,6 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
|||||||
runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/contextAndExtensionSameName.kt");
|
runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/contextAndExtensionSameName.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
@TestMetadata("dp.kt")
|
|
||||||
public void testDp() throws Exception {
|
|
||||||
runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/dp.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("inferGenericPropertyType.kt")
|
@TestMetadata("inferGenericPropertyType.kt")
|
||||||
public void testInferGenericPropertyType() throws Exception {
|
public void testInferGenericPropertyType() throws Exception {
|
||||||
@@ -16210,6 +16204,46 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
|||||||
public void testThis() throws Exception {
|
public void testThis() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/this.kt");
|
runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/this.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
@TestMetadata("compiler/testData/codegen/box/extensionFunctions/contextReceivers/fromKEEP")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
public class FromKEEP {
|
||||||
|
@Test
|
||||||
|
public void testAllFilesPresentInFromKEEP() throws Exception {
|
||||||
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/extensionFunctions/contextReceivers/fromKEEP"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("canvas.kt")
|
||||||
|
public void testCanvas() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/fromKEEP/canvas.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("compareTo.kt")
|
||||||
|
public void testCompareTo() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/fromKEEP/compareTo.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("decimateEveryEvenThird.kt")
|
||||||
|
public void testDecimateEveryEvenThird() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/fromKEEP/decimateEveryEvenThird.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("dp.kt")
|
||||||
|
public void testDp() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/fromKEEP/dp.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("monoidSum.kt")
|
||||||
|
public void testMonoidSum() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/fromKEEP/monoidSum.kt");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+13
-3
@@ -273,6 +273,7 @@ class ResolvedAtomCompleter(
|
|||||||
val returnType =
|
val returnType =
|
||||||
(if (resolvedAtom?.isCoercedToUnit == true) builtIns.unitType else resolvedAtom?.returnType) ?: descriptor.returnType
|
(if (resolvedAtom?.isCoercedToUnit == true) builtIns.unitType else resolvedAtom?.returnType) ?: descriptor.returnType
|
||||||
val extensionReceiverType = resolvedAtom?.receiver ?: descriptor.extensionReceiverParameter?.type
|
val extensionReceiverType = resolvedAtom?.receiver ?: descriptor.extensionReceiverParameter?.type
|
||||||
|
val contextReceiversTypes = resolvedAtom?.contextReceivers ?: descriptor.contextReceiverParameters.map { it.type }
|
||||||
val dispatchReceiverType = descriptor.dispatchReceiverParameter?.type
|
val dispatchReceiverType = descriptor.dispatchReceiverParameter?.type
|
||||||
val valueParameterTypes = resolvedAtom?.parameters ?: descriptor.valueParameters.map { it.type }
|
val valueParameterTypes = resolvedAtom?.parameters ?: descriptor.valueParameters.map { it.type }
|
||||||
|
|
||||||
@@ -289,6 +290,14 @@ class ResolvedAtomCompleter(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val substitutedContextReceiversTypes = descriptor.contextReceiverParameters.mapIndexedNotNull { i, contextReceiver ->
|
||||||
|
contextReceiversTypes.getOrNull(i)?.substituteAndApproximate(substitutor)?.also {
|
||||||
|
if (contextReceiver is ReceiverParameterDescriptorImpl && contextReceiver.type.shouldBeUpdated()) {
|
||||||
|
contextReceiver.setOutType(it.approximatedType)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
val dispatchReceiverFromDescriptor = descriptor.dispatchReceiverParameter
|
val dispatchReceiverFromDescriptor = descriptor.dispatchReceiverParameter
|
||||||
dispatchReceiverType?.substituteAndApproximate(substitutor)?.also {
|
dispatchReceiverType?.substituteAndApproximate(substitutor)?.also {
|
||||||
if (dispatchReceiverFromDescriptor is ReceiverParameterDescriptorImpl && dispatchReceiverFromDescriptor.type.shouldBeUpdated()) {
|
if (dispatchReceiverFromDescriptor is ReceiverParameterDescriptorImpl && dispatchReceiverFromDescriptor.type.shouldBeUpdated()) {
|
||||||
@@ -304,7 +313,7 @@ class ResolvedAtomCompleter(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return FunctionLiteralTypes(substitutedReturnType, substitutedValueParameterTypes, substitutedReceiverType)
|
return FunctionLiteralTypes(substitutedReturnType, substitutedValueParameterTypes, substitutedReceiverType, substitutedContextReceiversTypes)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun completeLambda(resolvedAtom: ResolvedLambdaAtom) {
|
private fun completeLambda(resolvedAtom: ResolvedLambdaAtom) {
|
||||||
@@ -334,7 +343,7 @@ class ResolvedAtomCompleter(
|
|||||||
builtIns,
|
builtIns,
|
||||||
existingLambdaType.annotations,
|
existingLambdaType.annotations,
|
||||||
substitutedLambdaTypes.receiverType?.substitutedType,
|
substitutedLambdaTypes.receiverType?.substitutedType,
|
||||||
emptyList(),
|
substitutedLambdaTypes.contextReceiverTypes.map { it.substitutedType },
|
||||||
substitutedLambdaTypes.parameterTypes.map { it.substitutedType },
|
substitutedLambdaTypes.parameterTypes.map { it.substitutedType },
|
||||||
null, // parameter names transforms to special annotations, so they are already taken from parameter types
|
null, // parameter names transforms to special annotations, so they are already taken from parameter types
|
||||||
substitutedLambdaTypes.returnType.substitutedType,
|
substitutedLambdaTypes.returnType.substitutedType,
|
||||||
@@ -641,7 +650,8 @@ class ResolvedAtomCompleter(
|
|||||||
class FunctionLiteralTypes(
|
class FunctionLiteralTypes(
|
||||||
val returnType: ProcessedType,
|
val returnType: ProcessedType,
|
||||||
val parameterTypes: List<ProcessedType>,
|
val parameterTypes: List<ProcessedType>,
|
||||||
val receiverType: ProcessedType?
|
val receiverType: ProcessedType?,
|
||||||
|
val contextReceiverTypes: List<ProcessedType>
|
||||||
) {
|
) {
|
||||||
class ProcessedType(val substitutedType: KotlinType, val approximatedType: KotlinType)
|
class ProcessedType(val substitutedType: KotlinType, val approximatedType: KotlinType)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -150,6 +150,7 @@ class ResolvedLambdaAtom(
|
|||||||
override val atom: LambdaKotlinCallArgument,
|
override val atom: LambdaKotlinCallArgument,
|
||||||
val isSuspend: Boolean,
|
val isSuspend: Boolean,
|
||||||
val receiver: UnwrappedType?,
|
val receiver: UnwrappedType?,
|
||||||
|
val contextReceivers: List<UnwrappedType>,
|
||||||
val parameters: List<UnwrappedType>,
|
val parameters: List<UnwrappedType>,
|
||||||
val returnType: UnwrappedType,
|
val returnType: UnwrappedType,
|
||||||
val typeVariableForLambdaReturnType: TypeVariableForLambdaReturnType?,
|
val typeVariableForLambdaReturnType: TypeVariableForLambdaReturnType?,
|
||||||
|
|||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
// TARGET_BACKEND: JVM_IR
|
||||||
|
// IGNORE_BACKEND_FIR: JVM_IR
|
||||||
|
|
||||||
|
interface Canvas {
|
||||||
|
val suffix: String
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Shape {
|
||||||
|
context(Canvas)
|
||||||
|
fun draw(): String
|
||||||
|
}
|
||||||
|
|
||||||
|
class Circle : Shape {
|
||||||
|
context(Canvas)
|
||||||
|
override fun draw() = "OK" + suffix
|
||||||
|
}
|
||||||
|
|
||||||
|
object MyCanvas : Canvas {
|
||||||
|
override val suffix = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box() = with(MyCanvas) { Circle().draw() }
|
||||||
+19
@@ -0,0 +1,19 @@
|
|||||||
|
// TARGET_BACKEND: JVM_IR
|
||||||
|
// IGNORE_BACKEND_FIR: JVM_IR
|
||||||
|
|
||||||
|
data class Pair<A, B>(val first: A, val second: B)
|
||||||
|
|
||||||
|
context(Comparator<T>)
|
||||||
|
infix operator fun <T> T.compareTo(other: T) = compare(this, other)
|
||||||
|
|
||||||
|
context(Comparator<T>)
|
||||||
|
val <T> Pair<T, T>.min get() = if (first < second) first else second
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val comparator = Comparator<String> { a, b ->
|
||||||
|
if (a == null || b == null) 0 else a.length.compareTo(b.length)
|
||||||
|
}
|
||||||
|
return with(comparator) {
|
||||||
|
Pair("OK", "fail").min
|
||||||
|
}
|
||||||
|
}
|
||||||
compiler/testData/codegen/box/extensionFunctions/contextReceivers/fromKEEP/decimateEveryEvenThird.kt
Vendored
+17
@@ -0,0 +1,17 @@
|
|||||||
|
// TARGET_BACKEND: JVM_IR
|
||||||
|
// IGNORE_BACKEND_FIR: JVM_IR
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
|
fun List<Int>.decimateEveryEvenThird() = sequence {
|
||||||
|
var counter = 1
|
||||||
|
for (e in this@List) {
|
||||||
|
if (e % 2 == 0 && counter % 3 == 0) {
|
||||||
|
yield(e)
|
||||||
|
}
|
||||||
|
counter += 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box() = with(listOf(0, 1, 2).decimateEveryEvenThird()) {
|
||||||
|
if (toList() == listOf(2)) "OK" else "fail"
|
||||||
|
}
|
||||||
+31
@@ -0,0 +1,31 @@
|
|||||||
|
// TARGET_BACKEND: JVM_IR
|
||||||
|
// IGNORE_BACKEND_FIR: JVM_IR
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
|
interface Semigroup<T> {
|
||||||
|
infix fun T.combine(other: T): T
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Monoid<T> : Semigroup<T> {
|
||||||
|
val unit: T
|
||||||
|
}
|
||||||
|
object IntMonoid : Monoid<Int> {
|
||||||
|
override fun Int.combine(other: Int): Int = this + other
|
||||||
|
override val unit: Int = 0
|
||||||
|
}
|
||||||
|
object StringMonoid : Monoid<String> {
|
||||||
|
override fun String.combine(other: String): String = this + other
|
||||||
|
override val unit: String = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
context(Monoid<T>)
|
||||||
|
fun <T> List<T>.sum(): T = fold(unit) { acc, e -> acc.combine(e) }
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
with(IntMonoid) {
|
||||||
|
listOf(1, 2, 3).sum()
|
||||||
|
}
|
||||||
|
return with(StringMonoid) {
|
||||||
|
listOf("O", "K").sum()
|
||||||
|
}
|
||||||
|
}
|
||||||
+33
@@ -0,0 +1,33 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
|
class File(name: String)
|
||||||
|
interface InputStream
|
||||||
|
|
||||||
|
interface AutoCloseScope {
|
||||||
|
fun defer(closeBlock: () -> Unit)
|
||||||
|
fun close()
|
||||||
|
}
|
||||||
|
class AutoCloseScopeImpl : AutoCloseScope {
|
||||||
|
override fun defer(closeBlock: () -> Unit) = TODO()
|
||||||
|
override fun close() = TODO()
|
||||||
|
}
|
||||||
|
|
||||||
|
context(AutoCloseScope)
|
||||||
|
fun File.open(): InputStream = TODO()
|
||||||
|
|
||||||
|
fun withAutoClose(block: context(AutoCloseScope) () -> Unit) {
|
||||||
|
val scope = AutoCloseScopeImpl() // Not shown here
|
||||||
|
try {
|
||||||
|
with(scope) { block() }
|
||||||
|
} finally {
|
||||||
|
scope.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test() {
|
||||||
|
withAutoClose {
|
||||||
|
val input = File("input.txt").open()
|
||||||
|
val config = File("config.txt").open()
|
||||||
|
// Work
|
||||||
|
// All files are closed at the end
|
||||||
|
}
|
||||||
|
}
|
||||||
Vendored
+35
@@ -0,0 +1,35 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public fun test(): kotlin.Unit
|
||||||
|
public fun withAutoClose(/*0*/ block: @kotlin.ContextFunctionTypeParams(count = 1) () -> kotlin.Unit): kotlin.Unit
|
||||||
|
public fun File.open(): InputStream
|
||||||
|
|
||||||
|
public interface AutoCloseScope {
|
||||||
|
public abstract fun close(): kotlin.Unit
|
||||||
|
public abstract fun defer(/*0*/ closeBlock: () -> kotlin.Unit): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class AutoCloseScopeImpl : AutoCloseScope {
|
||||||
|
public constructor AutoCloseScopeImpl()
|
||||||
|
public open override /*1*/ fun close(): kotlin.Nothing
|
||||||
|
public open override /*1*/ fun defer(/*0*/ closeBlock: () -> kotlin.Unit): kotlin.Nothing
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class File {
|
||||||
|
public constructor File(/*0*/ name: kotlin.String)
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface InputStream {
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
+17
@@ -0,0 +1,17 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
|
|
||||||
|
interface Canvas
|
||||||
|
|
||||||
|
interface Shape {
|
||||||
|
context(Canvas)
|
||||||
|
fun draw(): Unit
|
||||||
|
}
|
||||||
|
|
||||||
|
class Circle : Shape {
|
||||||
|
context(Canvas)
|
||||||
|
override fun draw() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
object MyCanvas : Canvas
|
||||||
|
|
||||||
|
fun test() = with(MyCanvas) { Circle().draw() }
|
||||||
+31
@@ -0,0 +1,31 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public fun test(): kotlin.Unit
|
||||||
|
|
||||||
|
public interface Canvas {
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class Circle : Shape {
|
||||||
|
public constructor Circle()
|
||||||
|
public open override /*1*/ fun draw(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public object MyCanvas : Canvas {
|
||||||
|
private constructor MyCanvas()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface Shape {
|
||||||
|
public abstract fun draw(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
data class Pair<A, B>(val first: A, val second: B)
|
||||||
|
|
||||||
|
context(Comparator<T>)
|
||||||
|
infix <!INAPPLICABLE_OPERATOR_MODIFIER!>operator<!> fun <T> T.compareTo(other: T) = <!UNRESOLVED_REFERENCE!>compare<!>(this, other)
|
||||||
|
|
||||||
|
context(Comparator<T>)
|
||||||
|
val <T> Pair<T, T>.max get() = if (first > second) first else second
|
||||||
|
|
||||||
|
fun test() {
|
||||||
|
val comparator = Comparator<String> { a, b ->
|
||||||
|
if (a == null || b == null) 0 else a.length.compareTo(b.length)
|
||||||
|
}
|
||||||
|
with(comparator) {
|
||||||
|
Pair("OK", "fail").max
|
||||||
|
}
|
||||||
|
}
|
||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
data class Pair<A, B>(val first: A, val second: B)
|
||||||
|
|
||||||
|
context(Comparator<T>)
|
||||||
|
infix operator fun <T> T.compareTo(other: T) = compare(this, other)
|
||||||
|
|
||||||
|
context(Comparator<T>)
|
||||||
|
val <T> Pair<T, T>.max get() = if (first > second) first else second
|
||||||
|
|
||||||
|
fun test() {
|
||||||
|
val comparator = Comparator<String> { a, b ->
|
||||||
|
if (a == null || b == null) 0 else a.length.compareTo(b.length)
|
||||||
|
}
|
||||||
|
with(comparator) {
|
||||||
|
Pair("OK", "fail").max
|
||||||
|
}
|
||||||
|
}
|
||||||
+17
@@ -0,0 +1,17 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public val </*0*/ T> Pair<T, T>.max: T
|
||||||
|
public fun test(): kotlin.Unit
|
||||||
|
public infix operator fun </*0*/ T> T.compareTo(/*0*/ other: T): kotlin.Int
|
||||||
|
|
||||||
|
public final data class Pair</*0*/ A, /*1*/ B> {
|
||||||
|
public constructor Pair</*0*/ A, /*1*/ B>(/*0*/ first: A, /*1*/ second: B)
|
||||||
|
public final val first: A
|
||||||
|
public final val second: B
|
||||||
|
public final operator /*synthesized*/ fun component1(): A
|
||||||
|
public final operator /*synthesized*/ fun component2(): B
|
||||||
|
public final /*synthesized*/ fun copy(/*0*/ first: A = ..., /*1*/ second: B = ...): Pair<A, B>
|
||||||
|
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
|
fun List<Int>.decimateEveryEvenThird() = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>sequence<!> {
|
||||||
|
var counter = 1
|
||||||
|
for (e in <!ITERATOR_AMBIGUITY!>this<!UNRESOLVED_LABEL!>@List<!><!>) {
|
||||||
|
if (e <!NONE_APPLICABLE!>%<!> 2 == 0 && counter % 3 == 0) {
|
||||||
|
yield(e)
|
||||||
|
}
|
||||||
|
counter += 1
|
||||||
|
}
|
||||||
|
}
|
||||||
Vendored
+11
@@ -0,0 +1,11 @@
|
|||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
|
fun List<Int>.decimateEveryEvenThird() = sequence {
|
||||||
|
var counter = 1
|
||||||
|
for (e in this@List) {
|
||||||
|
if (e % 2 == 0 && counter % 3 == 0) {
|
||||||
|
yield(e)
|
||||||
|
}
|
||||||
|
counter += 1
|
||||||
|
}
|
||||||
|
}
|
||||||
Vendored
+3
@@ -0,0 +1,3 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public fun kotlin.collections.List<kotlin.Int>.decimateEveryEvenThird(): kotlin.sequences.Sequence<kotlin.Int>
|
||||||
Vendored
+16
@@ -0,0 +1,16 @@
|
|||||||
|
typealias IterableClass<C, T> = (C) -> Iterator<T>
|
||||||
|
|
||||||
|
context(IterableClass<C, T>)
|
||||||
|
fun <C, T> C.iterator(any: Any?): Iterator<T> = this<!UNRESOLVED_LABEL!>@IterableClass<!>.invoke(this)
|
||||||
|
|
||||||
|
fun <T> listOf(vararg items: T): List<T> = null!!
|
||||||
|
|
||||||
|
fun test() {
|
||||||
|
val f: IterableClass<List<Int>, Int> = {
|
||||||
|
it.listIterator()
|
||||||
|
}
|
||||||
|
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>with<!>(f) {
|
||||||
|
listOf(1, 2, 3).iterator(null)
|
||||||
|
}
|
||||||
|
listOf(1, 2, 3).<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>iterator<!>(null)
|
||||||
|
}
|
||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
typealias IterableClass<C, T> = (C) -> Iterator<T>
|
||||||
|
|
||||||
|
context(IterableClass<C, T>)
|
||||||
|
fun <C, T> C.iterator(any: Any?): Iterator<T> = this@IterableClass.invoke(this)
|
||||||
|
|
||||||
|
fun <T> listOf(vararg items: T): List<T> = null!!
|
||||||
|
|
||||||
|
fun test() {
|
||||||
|
val f: IterableClass<List<Int>, Int> = {
|
||||||
|
it.listIterator()
|
||||||
|
}
|
||||||
|
with(f) {
|
||||||
|
listOf(1, 2, 3).iterator(null)
|
||||||
|
}
|
||||||
|
listOf(1, 2, 3).<!NO_CONTEXT_RECEIVER!><!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>iterator<!>(null)<!>
|
||||||
|
}
|
||||||
+6
@@ -0,0 +1,6 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public fun </*0*/ T> listOf(/*0*/ vararg items: T /*kotlin.Array<out T>*/): kotlin.collections.List<T>
|
||||||
|
public fun test(): kotlin.Unit
|
||||||
|
public fun </*0*/ C, /*1*/ T> C.iterator(/*0*/ any: kotlin.Any?): kotlin.collections.Iterator<T>
|
||||||
|
public typealias IterableClass</*0*/ C, /*1*/ T> = (C) -> kotlin.collections.Iterator<T>
|
||||||
+24
@@ -0,0 +1,24 @@
|
|||||||
|
class JSONObject {
|
||||||
|
fun build(): JSONObject = TODO()
|
||||||
|
|
||||||
|
fun put(key: String, any: Any): Unit = TODO()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun json(build: JSONObject.() -> Unit) = JSONObject().apply { build() }
|
||||||
|
|
||||||
|
context(JSONObject)
|
||||||
|
infix fun String.by(build: JSONObject.() -> Unit) = <!UNRESOLVED_REFERENCE!>put<!>(this, JSONObject().build())
|
||||||
|
|
||||||
|
context(JSONObject)
|
||||||
|
infix fun String.by(value: Any) = <!UNRESOLVED_REFERENCE!>put<!>(this, value)
|
||||||
|
|
||||||
|
fun test() {
|
||||||
|
val json = json {
|
||||||
|
"name" by "Kotlin"
|
||||||
|
"age" by 10
|
||||||
|
"creator" by {
|
||||||
|
"name" by "JetBrains"
|
||||||
|
"age" by "21"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+24
@@ -0,0 +1,24 @@
|
|||||||
|
class JSONObject {
|
||||||
|
fun build(): JSONObject = TODO()
|
||||||
|
|
||||||
|
fun put(key: String, any: Any): Unit = TODO()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun json(build: JSONObject.() -> Unit) = JSONObject().apply { build() }
|
||||||
|
|
||||||
|
context(JSONObject)
|
||||||
|
infix fun String.by(build: JSONObject.() -> Unit) = put(this, JSONObject().build())
|
||||||
|
|
||||||
|
context(JSONObject)
|
||||||
|
infix fun String.by(value: Any) = put(this, value)
|
||||||
|
|
||||||
|
fun test() {
|
||||||
|
val json = json {
|
||||||
|
"name" by "Kotlin"
|
||||||
|
"age" by 10
|
||||||
|
"creator" by {
|
||||||
|
"name" by "JetBrains"
|
||||||
|
"age" by "21"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+15
@@ -0,0 +1,15 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public fun json(/*0*/ build: JSONObject.() -> kotlin.Unit): JSONObject
|
||||||
|
public fun test(): kotlin.Unit
|
||||||
|
public infix fun kotlin.String.by(/*0*/ build: JSONObject.() -> kotlin.Unit): kotlin.Unit
|
||||||
|
public infix fun kotlin.String.by(/*0*/ value: kotlin.Any): kotlin.Unit
|
||||||
|
|
||||||
|
public final class JSONObject {
|
||||||
|
public constructor JSONObject()
|
||||||
|
public final fun build(): JSONObject
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public final fun put(/*0*/ key: kotlin.String, /*1*/ any: kotlin.Any): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
Vendored
+12
@@ -0,0 +1,12 @@
|
|||||||
|
interface Params
|
||||||
|
interface Logger {
|
||||||
|
fun info(message: String)
|
||||||
|
}
|
||||||
|
interface LoggingContext {
|
||||||
|
val log: Logger // this context provides reference to logger
|
||||||
|
}
|
||||||
|
|
||||||
|
context(LoggingContext)
|
||||||
|
fun performSomeBusinessOperation(withParams: Params) {
|
||||||
|
<!UNRESOLVED_REFERENCE!>log<!>.info("Operation has started")
|
||||||
|
}
|
||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
interface Params
|
||||||
|
interface Logger {
|
||||||
|
fun info(message: String)
|
||||||
|
}
|
||||||
|
interface LoggingContext {
|
||||||
|
val log: Logger // this context provides reference to logger
|
||||||
|
}
|
||||||
|
|
||||||
|
context(LoggingContext)
|
||||||
|
fun performSomeBusinessOperation(withParams: Params) {
|
||||||
|
log.info("Operation has started")
|
||||||
|
}
|
||||||
Vendored
+23
@@ -0,0 +1,23 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public fun performSomeBusinessOperation(/*0*/ withParams: Params): kotlin.Unit
|
||||||
|
|
||||||
|
public interface Logger {
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public abstract fun info(/*0*/ message: kotlin.String): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface LoggingContext {
|
||||||
|
public abstract val log: Logger
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface Params {
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
+32
@@ -0,0 +1,32 @@
|
|||||||
|
interface Semigroup<T> {
|
||||||
|
infix fun T.combine(other: T): T
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Monoid<T> : Semigroup<T> {
|
||||||
|
val unit: T
|
||||||
|
}
|
||||||
|
object IntMonoid : Monoid<Int> {
|
||||||
|
override fun Int.combine(other: Int): Int = this + other
|
||||||
|
override val unit: Int = 0
|
||||||
|
}
|
||||||
|
object StringMonoid : Monoid<String> {
|
||||||
|
override fun String.combine(other: String): String = this + other
|
||||||
|
override val unit: String = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
public inline fun <T, R> Iterable<T>.fold(initial: R, operation: (acc: R, T) -> R): R = TODO()
|
||||||
|
|
||||||
|
context(Monoid<T>)
|
||||||
|
fun <T> List<T>.sum(): T = fold(<!ARGUMENT_TYPE_MISMATCH, UNRESOLVED_REFERENCE!>unit<!>) { acc, e -> acc.<!UNRESOLVED_REFERENCE!>combine<!>(e) }
|
||||||
|
|
||||||
|
fun <T> listOf(vararg items: T): List<T> = null!!
|
||||||
|
|
||||||
|
fun test() {
|
||||||
|
with(IntMonoid) {
|
||||||
|
listOf(1, 2, 3).sum()
|
||||||
|
}
|
||||||
|
with(StringMonoid) {
|
||||||
|
listOf(1, 2, 3).sum()
|
||||||
|
listOf("1", "2", "3").sum()
|
||||||
|
}
|
||||||
|
}
|
||||||
+32
@@ -0,0 +1,32 @@
|
|||||||
|
interface Semigroup<T> {
|
||||||
|
infix fun T.combine(other: T): T
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Monoid<T> : Semigroup<T> {
|
||||||
|
val unit: T
|
||||||
|
}
|
||||||
|
object IntMonoid : Monoid<Int> {
|
||||||
|
override fun Int.combine(other: Int): Int = this + other
|
||||||
|
override val unit: Int = 0
|
||||||
|
}
|
||||||
|
object StringMonoid : Monoid<String> {
|
||||||
|
override fun String.combine(other: String): String = this + other
|
||||||
|
override val unit: String = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
public inline fun <T, R> Iterable<T>.fold(initial: R, operation: (acc: R, T) -> R): R = TODO()
|
||||||
|
|
||||||
|
context(Monoid<T>)
|
||||||
|
fun <T> List<T>.sum(): T = fold(unit) { acc, e -> acc.combine(e) }
|
||||||
|
|
||||||
|
fun <T> listOf(vararg items: T): List<T> = null!!
|
||||||
|
|
||||||
|
fun test() {
|
||||||
|
with(IntMonoid) {
|
||||||
|
listOf(1, 2, 3).sum()
|
||||||
|
}
|
||||||
|
with(StringMonoid) {
|
||||||
|
listOf(1, 2, 3).<!NO_CONTEXT_RECEIVER!>sum()<!>
|
||||||
|
listOf("1", "2", "3").sum()
|
||||||
|
}
|
||||||
|
}
|
||||||
+39
@@ -0,0 +1,39 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public fun </*0*/ T> listOf(/*0*/ vararg items: T /*kotlin.Array<out T>*/): kotlin.collections.List<T>
|
||||||
|
public fun test(): kotlin.Unit
|
||||||
|
public inline fun </*0*/ T, /*1*/ R> kotlin.collections.Iterable<T>.fold(/*0*/ initial: R, /*1*/ operation: (acc: R, T) -> R): R
|
||||||
|
public fun </*0*/ T> kotlin.collections.List<T>.sum(): T
|
||||||
|
|
||||||
|
public object IntMonoid : Monoid<kotlin.Int> {
|
||||||
|
private constructor IntMonoid()
|
||||||
|
public open override /*1*/ val unit: kotlin.Int = 0
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
public open override /*1*/ fun kotlin.Int.combine(/*0*/ other: kotlin.Int): kotlin.Int
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface Monoid</*0*/ T> : Semigroup<T> {
|
||||||
|
public abstract val unit: T
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
public abstract override /*1*/ /*fake_override*/ fun T.combine(/*0*/ other: T): T
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface Semigroup</*0*/ T> {
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
public abstract infix fun T.combine(/*0*/ other: T): T
|
||||||
|
}
|
||||||
|
|
||||||
|
public object StringMonoid : Monoid<kotlin.String> {
|
||||||
|
private constructor StringMonoid()
|
||||||
|
public open override /*1*/ val unit: kotlin.String = ""
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
public open override /*1*/ fun kotlin.String.combine(/*0*/ other: kotlin.String): kotlin.String
|
||||||
|
}
|
||||||
Vendored
+14
@@ -0,0 +1,14 @@
|
|||||||
|
class Session(var lastAccess: Any?)
|
||||||
|
interface Transaction {
|
||||||
|
fun loadSession(): Session
|
||||||
|
fun storeSession(session: Session)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun now(): Any? = null
|
||||||
|
|
||||||
|
context(Transaction)
|
||||||
|
fun updateUserSession() {
|
||||||
|
val session = <!UNRESOLVED_REFERENCE!>loadSession<!>()
|
||||||
|
session.<!UNRESOLVED_REFERENCE!>lastAccess<!> = now()
|
||||||
|
<!UNRESOLVED_REFERENCE!>storeSession<!>(session)
|
||||||
|
}
|
||||||
+14
@@ -0,0 +1,14 @@
|
|||||||
|
class Session(var lastAccess: Any?)
|
||||||
|
interface Transaction {
|
||||||
|
fun loadSession(): Session
|
||||||
|
fun storeSession(session: Session)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun now(): Any? = null
|
||||||
|
|
||||||
|
context(Transaction)
|
||||||
|
fun updateUserSession() {
|
||||||
|
val session = loadSession()
|
||||||
|
session.lastAccess = now()
|
||||||
|
storeSession(session)
|
||||||
|
}
|
||||||
+20
@@ -0,0 +1,20 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public fun now(): kotlin.Any?
|
||||||
|
public fun updateUserSession(): kotlin.Unit
|
||||||
|
|
||||||
|
public final class Session {
|
||||||
|
public constructor Session(/*0*/ lastAccess: kotlin.Any?)
|
||||||
|
public final var lastAccess: kotlin.Any?
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface Transaction {
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public abstract fun loadSession(): Session
|
||||||
|
public abstract fun storeSession(/*0*/ session: Session): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
Vendored
+15
@@ -0,0 +1,15 @@
|
|||||||
|
class Storage<T> {
|
||||||
|
inner class Info
|
||||||
|
|
||||||
|
fun info(name: String) = Info()
|
||||||
|
}
|
||||||
|
class User
|
||||||
|
class Logger {
|
||||||
|
fun info(message: String) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
context(Logger, Storage<User>)
|
||||||
|
fun userInfo(name: String): Storage<User>.Info? {
|
||||||
|
this<!UNRESOLVED_LABEL!>@Logger<!>.info("Retrieving info about $name")
|
||||||
|
return this<!UNRESOLVED_LABEL!>@Storage<!>.info(name)
|
||||||
|
}
|
||||||
+15
@@ -0,0 +1,15 @@
|
|||||||
|
class Storage<T> {
|
||||||
|
inner class Info
|
||||||
|
|
||||||
|
fun info(name: String) = Info()
|
||||||
|
}
|
||||||
|
class User
|
||||||
|
class Logger {
|
||||||
|
fun info(message: String) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
context(Logger, Storage<User>)
|
||||||
|
fun userInfo(name: String): Storage<User>.Info? {
|
||||||
|
this@Logger.info("Retrieving info about $name")
|
||||||
|
return this@Storage.info(name)
|
||||||
|
}
|
||||||
+33
@@ -0,0 +1,33 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public fun userInfo(/*0*/ name: kotlin.String): Storage<User>.Info?
|
||||||
|
|
||||||
|
public final class Logger {
|
||||||
|
public constructor Logger()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public final fun info(/*0*/ message: kotlin.String): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class Storage</*0*/ T> {
|
||||||
|
public constructor Storage</*0*/ T>()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public final fun info(/*0*/ name: kotlin.String): Storage<T>.Info
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
|
public final inner class Info /*captured type parameters: /*0*/ T*/ {
|
||||||
|
public constructor Info()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class User {
|
||||||
|
public constructor User()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
Generated
+66
-6
@@ -10588,12 +10588,6 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
|||||||
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/ambiguityInGroup.kt");
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/ambiguityInGroup.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
@TestMetadata("dp.kt")
|
|
||||||
public void testDp() throws Exception {
|
|
||||||
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/dp.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("functionalType.kt")
|
@TestMetadata("functionalType.kt")
|
||||||
public void testFunctionalType() throws Exception {
|
public void testFunctionalType() throws Exception {
|
||||||
@@ -10741,17 +10735,83 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
|||||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("autoCloseScope.kt")
|
||||||
|
public void testAutoCloseScope() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/autoCloseScope.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("canvas.kt")
|
||||||
|
public void testCanvas() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/canvas.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("clickHandler.kt")
|
@TestMetadata("clickHandler.kt")
|
||||||
public void testClickHandler() throws Exception {
|
public void testClickHandler() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/clickHandler.kt");
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/clickHandler.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("compareTo.kt")
|
||||||
|
public void testCompareTo() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/compareTo.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("decimateEveryEvenThird.kt")
|
||||||
|
public void testDecimateEveryEvenThird() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/decimateEveryEvenThird.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("dp.kt")
|
||||||
|
public void testDp() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/dp.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("functionalType.kt")
|
@TestMetadata("functionalType.kt")
|
||||||
public void testFunctionalType() throws Exception {
|
public void testFunctionalType() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/functionalType.kt");
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/functionalType.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("iterableClass.kt")
|
||||||
|
public void testIterableClass() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/iterableClass.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("json.kt")
|
||||||
|
public void testJson() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/json.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("loggingContext.kt")
|
||||||
|
public void testLoggingContext() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/loggingContext.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("monoidSum.kt")
|
||||||
|
public void testMonoidSum() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/monoidSum.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("transaction.kt")
|
||||||
|
public void testTransaction() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/transaction.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("userStorage.kt")
|
||||||
|
public void testUserStorage() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/userStorage.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+10
@@ -16048,6 +16048,16 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
public void testAllFilesPresentInContextReceivers() throws Exception {
|
public void testAllFilesPresentInContextReceivers() throws Exception {
|
||||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/extensionFunctions/contextReceivers"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/extensionFunctions/contextReceivers"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
@TestMetadata("compiler/testData/codegen/box/extensionFunctions/contextReceivers/fromKEEP")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
public class FromKEEP {
|
||||||
|
@Test
|
||||||
|
public void testAllFilesPresentInFromKEEP() throws Exception {
|
||||||
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/extensionFunctions/contextReceivers/fromKEEP"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+40
-6
@@ -16163,12 +16163,6 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/contextAndExtensionSameName.kt");
|
runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/contextAndExtensionSameName.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
@TestMetadata("dp.kt")
|
|
||||||
public void testDp() throws Exception {
|
|
||||||
runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/dp.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("inferGenericPropertyType.kt")
|
@TestMetadata("inferGenericPropertyType.kt")
|
||||||
public void testInferGenericPropertyType() throws Exception {
|
public void testInferGenericPropertyType() throws Exception {
|
||||||
@@ -16210,6 +16204,46 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
public void testThis() throws Exception {
|
public void testThis() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/this.kt");
|
runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/this.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
@TestMetadata("compiler/testData/codegen/box/extensionFunctions/contextReceivers/fromKEEP")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
public class FromKEEP {
|
||||||
|
@Test
|
||||||
|
public void testAllFilesPresentInFromKEEP() throws Exception {
|
||||||
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/extensionFunctions/contextReceivers/fromKEEP"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("canvas.kt")
|
||||||
|
public void testCanvas() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/fromKEEP/canvas.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("compareTo.kt")
|
||||||
|
public void testCompareTo() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/fromKEEP/compareTo.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("decimateEveryEvenThird.kt")
|
||||||
|
public void testDecimateEveryEvenThird() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/fromKEEP/decimateEveryEvenThird.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("dp.kt")
|
||||||
|
public void testDp() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/fromKEEP/dp.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("monoidSum.kt")
|
||||||
|
public void testMonoidSum() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/fromKEEP/monoidSum.kt");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+13
@@ -13217,6 +13217,19 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
public void testAllFilesPresentInContextReceivers() throws Exception {
|
public void testAllFilesPresentInContextReceivers() throws Exception {
|
||||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/extensionFunctions/contextReceivers"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/extensionFunctions/contextReceivers"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("compiler/testData/codegen/box/extensionFunctions/contextReceivers/fromKEEP")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
|
public static class FromKEEP extends AbstractLightAnalysisModeTest {
|
||||||
|
private void runTest(String testDataFilePath) throws Exception {
|
||||||
|
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testAllFilesPresentInFromKEEP() throws Exception {
|
||||||
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/extensionFunctions/contextReceivers/fromKEEP"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Generated
+13
@@ -14804,6 +14804,19 @@ public class VisualizerBlackBoxTestGenerated extends AbstractVisualizerBlackBoxT
|
|||||||
public void testAllFilesPresentInContextReceivers() throws Exception {
|
public void testAllFilesPresentInContextReceivers() throws Exception {
|
||||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/extensionFunctions/contextReceivers"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true);
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/extensionFunctions/contextReceivers"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("compiler/testData/codegen/box/extensionFunctions/contextReceivers/fromKEEP")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
|
public static class FromKEEP extends AbstractIrJsCodegenBoxES6Test {
|
||||||
|
private void runTest(String testDataFilePath) throws Exception {
|
||||||
|
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testAllFilesPresentInFromKEEP() throws Exception {
|
||||||
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/extensionFunctions/contextReceivers/fromKEEP"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+16
-12
@@ -12267,14 +12267,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
@TestMetadata("compiler/testData/codegen/box/extensionClasses")
|
@TestMetadata("compiler/testData/codegen/box/extensionClasses")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
@RunWith(JUnit3RunnerWithInners.class)
|
public class ExtensionClasses {
|
||||||
public static class ExtensionClasses extends AbstractJsCodegenBoxTest {
|
@Test
|
||||||
private void runTest(String testDataFilePath) throws Exception {
|
|
||||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testAllFilesPresentInExtensionClasses() throws Exception {
|
public void testAllFilesPresentInExtensionClasses() throws Exception {
|
||||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/extensionClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true);
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/extensionClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true);
|
||||||
}
|
}
|
||||||
@@ -12457,17 +12454,24 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
|||||||
runTest("compiler/testData/codegen/box/extensionFunctions/whenFail.kt");
|
runTest("compiler/testData/codegen/box/extensionFunctions/whenFail.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
@TestMetadata("compiler/testData/codegen/box/extensionFunctions/contextReceivers")
|
@TestMetadata("compiler/testData/codegen/box/extensionFunctions/contextReceivers")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
@RunWith(JUnit3RunnerWithInners.class)
|
public class ContextReceivers {
|
||||||
public static class ContextReceivers extends AbstractJsCodegenBoxTest {
|
@Test
|
||||||
private void runTest(String testDataFilePath) throws Exception {
|
|
||||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testAllFilesPresentInContextReceivers() throws Exception {
|
public void testAllFilesPresentInContextReceivers() throws Exception {
|
||||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/extensionFunctions/contextReceivers"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true);
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/extensionFunctions/contextReceivers"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
@TestMetadata("compiler/testData/codegen/box/extensionFunctions/contextReceivers/fromKEEP")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
public class FromKEEP {
|
||||||
|
@Test
|
||||||
|
public void testAllFilesPresentInFromKEEP() throws Exception {
|
||||||
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/extensionFunctions/contextReceivers/fromKEEP"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+13
@@ -12511,6 +12511,19 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
|||||||
public void testAllFilesPresentInContextReceivers() throws Exception {
|
public void testAllFilesPresentInContextReceivers() throws Exception {
|
||||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/extensionFunctions/contextReceivers"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/extensionFunctions/contextReceivers"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("compiler/testData/codegen/box/extensionFunctions/contextReceivers/fromKEEP")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
|
public static class FromKEEP extends AbstractIrJsCodegenBoxTest {
|
||||||
|
private void runTest(String testDataFilePath) throws Exception {
|
||||||
|
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testAllFilesPresentInFromKEEP() throws Exception {
|
||||||
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/extensionFunctions/contextReceivers/fromKEEP"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+13
@@ -10384,6 +10384,19 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
|
|||||||
public void testAllFilesPresentInContextReceivers() throws Exception {
|
public void testAllFilesPresentInContextReceivers() throws Exception {
|
||||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/extensionFunctions/contextReceivers"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true);
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/extensionFunctions/contextReceivers"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("compiler/testData/codegen/box/extensionFunctions/contextReceivers/fromKEEP")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
|
public static class FromKEEP extends AbstractIrCodegenBoxWasmTest {
|
||||||
|
private void runTest(String testDataFilePath) throws Exception {
|
||||||
|
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testAllFilesPresentInFromKEEP() throws Exception {
|
||||||
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/extensionFunctions/contextReceivers/fromKEEP"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user