Support named arguments in their own position
^KT-7745 In Proggress
This commit is contained in:
+38
@@ -14143,6 +14143,44 @@ public class FirDiagnosticsSmokeTestGenerated extends AbstractFirDiagnosticsSmok
|
||||
public void testNamedArgumentsInOverrides() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/namedArguments/namedArgumentsInOverrides.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class MixedNamedPosition extends AbstractFirDiagnosticsSmokeTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInMixedNamedPosition() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
@TestMetadata("defaults.kt")
|
||||
public void testDefaults() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/defaults.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("disabledFeature.kt")
|
||||
public void testDisabledFeature() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/disabledFeature.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("oldInference.kt")
|
||||
public void testOldInference() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/oldInference.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple.kt")
|
||||
public void testSimple() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/simple.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("varargs.kt")
|
||||
public void testVarargs() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/varargs.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/nullabilityAndSmartCasts")
|
||||
|
||||
+25
-10
@@ -16,6 +16,8 @@
|
||||
|
||||
package org.jetbrains.kotlin.resolve.calls.components
|
||||
|
||||
import org.jetbrains.kotlin.config.LanguageFeature
|
||||
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
||||
import org.jetbrains.kotlin.descriptors.CallableDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
|
||||
@@ -23,7 +25,12 @@ import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.resolve.calls.model.*
|
||||
import java.util.*
|
||||
|
||||
class ArgumentsToParametersMapper {
|
||||
class ArgumentsToParametersMapper(
|
||||
languageVersionSettings: LanguageVersionSettings
|
||||
) {
|
||||
|
||||
private val allowMixedNamedAndPositionArguments =
|
||||
languageVersionSettings.supportsFeature(LanguageFeature.MixedNamedArgumentsInTheirOwnPosition)
|
||||
|
||||
data class ArgumentMapping(
|
||||
// This map should be ordered by arguments as written, e.g.:
|
||||
@@ -48,7 +55,7 @@ class ArgumentsToParametersMapper {
|
||||
if (argumentsInParenthesis.isEmpty() && externalArgument == null && descriptor.valueParameters.isEmpty()) {
|
||||
return EmptyArgumentMapping
|
||||
} else {
|
||||
val processor = CallArgumentProcessor(descriptor)
|
||||
val processor = CallArgumentProcessor(descriptor, allowMixedNamedAndPositionArguments)
|
||||
processor.processArgumentsInParenthesis(argumentsInParenthesis)
|
||||
|
||||
if (externalArgument != null) {
|
||||
@@ -60,7 +67,10 @@ class ArgumentsToParametersMapper {
|
||||
}
|
||||
}
|
||||
|
||||
private class CallArgumentProcessor(val descriptor: CallableDescriptor) {
|
||||
private class CallArgumentProcessor(
|
||||
val descriptor: CallableDescriptor,
|
||||
val allowMixedNamedAndPositionArguments: Boolean
|
||||
) {
|
||||
val result: MutableMap<ValueParameterDescriptor, ResolvedCallArgument> = LinkedHashMap()
|
||||
private var state = State.POSITION_ARGUMENTS
|
||||
|
||||
@@ -70,7 +80,7 @@ class ArgumentsToParametersMapper {
|
||||
private var nameToParameter: Map<Name, ValueParameterDescriptor>? = null
|
||||
private var varargArguments: MutableList<KotlinCallArgument>? = null
|
||||
|
||||
private var currentParameterIndex = 0
|
||||
private var currentPositionedParameterIndex = 0
|
||||
|
||||
private fun addDiagnostic(diagnostic: KotlinCallDiagnostic) {
|
||||
if (diagnostics == null) {
|
||||
@@ -98,30 +108,30 @@ class ArgumentsToParametersMapper {
|
||||
private enum class State {
|
||||
POSITION_ARGUMENTS,
|
||||
VARARG_POSITION,
|
||||
NAMED_ARGUMENT
|
||||
NAMED_ONLY_ARGUMENTS
|
||||
}
|
||||
|
||||
private fun completeVarargPositionArguments() {
|
||||
assert(state == State.VARARG_POSITION) { "Incorrect state: $state" }
|
||||
val parameter = parameters[currentParameterIndex]
|
||||
val parameter = parameters[currentPositionedParameterIndex]
|
||||
result.put(parameter.original, ResolvedCallArgument.VarargArgument(varargArguments!!))
|
||||
}
|
||||
|
||||
// return true, if it was mapped to vararg parameter
|
||||
private fun processPositionArgument(argument: KotlinCallArgument): Boolean {
|
||||
if (state == State.NAMED_ARGUMENT) {
|
||||
if (state == State.NAMED_ONLY_ARGUMENTS) {
|
||||
addDiagnostic(MixingNamedAndPositionArguments(argument))
|
||||
return false
|
||||
}
|
||||
|
||||
val parameter = parameters.getOrNull(currentParameterIndex)
|
||||
val parameter = parameters.getOrNull(currentPositionedParameterIndex)
|
||||
if (parameter == null) {
|
||||
addDiagnostic(TooManyArguments(argument, descriptor))
|
||||
return false
|
||||
}
|
||||
|
||||
if (!parameter.isVararg) {
|
||||
currentParameterIndex++
|
||||
currentPositionedParameterIndex++
|
||||
|
||||
result.put(parameter.original, ResolvedCallArgument.SimpleArgument(argument))
|
||||
return false
|
||||
@@ -148,6 +158,11 @@ class ArgumentsToParametersMapper {
|
||||
}
|
||||
|
||||
result[parameter.original] = ResolvedCallArgument.SimpleArgument(argument)
|
||||
|
||||
if (allowMixedNamedAndPositionArguments && parameters.getOrNull(currentPositionedParameterIndex)?.original == parameter.original) {
|
||||
state = State.POSITION_ARGUMENTS
|
||||
currentPositionedParameterIndex++
|
||||
}
|
||||
}
|
||||
|
||||
private fun ValueParameterDescriptor.getOverriddenParameterWithOtherName() = overriddenDescriptors.firstOrNull {
|
||||
@@ -197,7 +212,7 @@ class ArgumentsToParametersMapper {
|
||||
if (state == State.VARARG_POSITION) {
|
||||
completeVarargPositionArguments()
|
||||
}
|
||||
state = State.NAMED_ARGUMENT
|
||||
state = State.NAMED_ONLY_ARGUMENTS
|
||||
|
||||
processNamedArgument(argument, argumentName)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
// !LANGUAGE: +NewInference +MixedNamedArgumentsInTheirOwnPosition
|
||||
|
||||
fun foo(
|
||||
p1: Int = 1,
|
||||
p2: String = "2",
|
||||
p3: Double = 3.0,
|
||||
p4: Char = '4'
|
||||
) = "$p1 $p2 ${p3.toInt()} $p4"
|
||||
|
||||
fun box(): String {
|
||||
if (foo(p1 = 1, "2", 3.0) != "1 2 3 4") return "fail 1"
|
||||
if (foo(1, p2 = "2", 3.0) != "1 2 3 4") return "fail 2"
|
||||
if (foo(1, "2", p3 = 3.0) != "1 2 3 4") return "fail 3"
|
||||
|
||||
if (foo(p1 = 1) != "1 2 3 4") return "fail 4"
|
||||
if (foo(1, p2 = "2") != "1 2 3 4") return "fail 5"
|
||||
|
||||
if (foo(p1 = 1, p2 = "2", 3.0) != "1 2 3 4") return "fail 6"
|
||||
|
||||
if (foo(1, p2 = "2") != "1 2 3 4") return "fail 7"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// !LANGUAGE: +NewInference +MixedNamedArgumentsInTheirOwnPosition
|
||||
|
||||
fun foo(
|
||||
p1: Int,
|
||||
p2: String,
|
||||
p3: Double
|
||||
) = "$p1 $p2 ${p3.toInt()}"
|
||||
|
||||
fun box(): String {
|
||||
if (foo(p1 = 1, "2", 3.0) != "1 2 3") return "fail 1"
|
||||
if (foo(1, "2", p3 = 3.0) != "1 2 3") return "fail 2"
|
||||
if (foo(p1 = 1, p2 = "2", 3.0) != "1 2 3") return "fail 3"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
// !LANGUAGE: +NewInference +MixedNamedArgumentsInTheirOwnPosition
|
||||
|
||||
fun foo1(
|
||||
vararg p1: Int,
|
||||
p2: String,
|
||||
p3: Double
|
||||
) = "${p1[0]} ${p1[1]} $p2 ${p3.toInt()}"
|
||||
|
||||
fun foo2(
|
||||
p1: Int,
|
||||
vararg p2: String,
|
||||
p3: Double
|
||||
) = "$p1 ${p2[0]} ${p2[1]} ${p3.toInt()}"
|
||||
|
||||
fun foo3(
|
||||
p1: Int,
|
||||
p2: String,
|
||||
vararg p3: Double
|
||||
) = "$p1 $p2 ${p3[0].toInt()} ${p3[1].toInt()}"
|
||||
|
||||
fun box(): String {
|
||||
if (foo1(p1 = *intArrayOf(1, 2), "3", p3 = 4.0) != "1 2 3 4") return "fail 2"
|
||||
|
||||
if (foo2(p1 = 1, "2", "3", p3 = 4.0) != "1 2 3 4") return "fail 3"
|
||||
if (foo2(1, p2 = *arrayOf("2", "3"), 4.0) != "1 2 3 4") return "fail 4"
|
||||
|
||||
if (foo3(p1 = 1, "2", 3.0, 4.0) != "1 2 3 4") return "fail 5"
|
||||
if (foo3(p1 = 1, "2", p3 = *doubleArrayOf(3.0, 4.0)) != "1 2 3 4") return "fail 6"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
// !LANGUAGE: +NewInference +MixedNamedArgumentsInTheirOwnPosition
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// SKIP_TXT
|
||||
|
||||
fun foo(
|
||||
p1: Int = 1,
|
||||
p2: String = "",
|
||||
p3: Double = 3.0,
|
||||
p4: Char = '4'
|
||||
) {}
|
||||
|
||||
fun main() {
|
||||
foo(p1 = 1, "2", 3.0)
|
||||
foo(1, p2 = "2", 3.0)
|
||||
foo(1, "2", p3 = 3.0)
|
||||
|
||||
foo(p1 = 1)
|
||||
foo(1, p2 = "2")
|
||||
|
||||
foo(p1 = 1, p2 = "2", 3.0)
|
||||
|
||||
foo()
|
||||
foo(1, p2 = "")
|
||||
foo(p3 = 4.0, <!MIXING_NAMED_AND_POSITIONED_ARGUMENTS!>'4'<!>)
|
||||
|
||||
foo(1, p3 = 2.0, <!MIXING_NAMED_AND_POSITIONED_ARGUMENTS!>""<!>)
|
||||
foo(1, p3 = 2.0, <!MIXING_NAMED_AND_POSITIONED_ARGUMENTS!>3.0<!>)
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// !LANGUAGE: +NewInference -MixedNamedArgumentsInTheirOwnPosition
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// SKIP_TXT
|
||||
|
||||
fun foo(
|
||||
p1: Int,
|
||||
p2: String,
|
||||
p3: Double
|
||||
) {}
|
||||
|
||||
fun main() {
|
||||
foo(p1 = 1, <!MIXING_NAMED_AND_POSITIONED_ARGUMENTS!>"2"<!>, <!MIXING_NAMED_AND_POSITIONED_ARGUMENTS!>3.0<!><!NO_VALUE_FOR_PARAMETER, NO_VALUE_FOR_PARAMETER!>)<!>
|
||||
foo(1, p2 = "2", <!MIXING_NAMED_AND_POSITIONED_ARGUMENTS!>3.0<!><!NO_VALUE_FOR_PARAMETER!>)<!>
|
||||
foo(1, "2", p3 = 3.0)
|
||||
|
||||
foo(p1 = 1, p2 = "2", <!MIXING_NAMED_AND_POSITIONED_ARGUMENTS!>3.0<!><!NO_VALUE_FOR_PARAMETER!>)<!>
|
||||
|
||||
foo(1, p3 = 2.0, <!MIXING_NAMED_AND_POSITIONED_ARGUMENTS!>""<!><!NO_VALUE_FOR_PARAMETER!>)<!>
|
||||
foo(1, p3 = 2.0, <!MIXING_NAMED_AND_POSITIONED_ARGUMENTS!>3.0<!><!NO_VALUE_FOR_PARAMETER!>)<!>
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// !LANGUAGE: -NewInference +MixedNamedArgumentsInTheirOwnPosition
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// SKIP_TXT
|
||||
|
||||
fun foo(
|
||||
p1: Int,
|
||||
p2: String,
|
||||
p3: Double
|
||||
) {}
|
||||
|
||||
fun main() {
|
||||
foo(p1 = 1, <!MIXING_NAMED_AND_POSITIONED_ARGUMENTS!>"2"<!>, <!MIXING_NAMED_AND_POSITIONED_ARGUMENTS!>3.0<!><!NO_VALUE_FOR_PARAMETER, NO_VALUE_FOR_PARAMETER!>)<!>
|
||||
foo(1, p2 = "2", <!MIXING_NAMED_AND_POSITIONED_ARGUMENTS!>3.0<!><!NO_VALUE_FOR_PARAMETER!>)<!>
|
||||
foo(1, "2", p3 = 3.0)
|
||||
|
||||
foo(p1 = 1, p2 = "2", <!MIXING_NAMED_AND_POSITIONED_ARGUMENTS!>3.0<!><!NO_VALUE_FOR_PARAMETER!>)<!>
|
||||
|
||||
foo(1, p3 = 2.0, <!MIXING_NAMED_AND_POSITIONED_ARGUMENTS!>""<!><!NO_VALUE_FOR_PARAMETER!>)<!>
|
||||
foo(1, p3 = 2.0, <!MIXING_NAMED_AND_POSITIONED_ARGUMENTS!>3.0<!><!NO_VALUE_FOR_PARAMETER!>)<!>
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// !LANGUAGE: +NewInference +MixedNamedArgumentsInTheirOwnPosition
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// SKIP_TXT
|
||||
|
||||
fun foo(
|
||||
p1: Int,
|
||||
p2: String,
|
||||
p3: Double
|
||||
) {}
|
||||
|
||||
fun main() {
|
||||
foo(p1 = 1, "2", 3.0)
|
||||
foo(1, p2 = "2", 3.0)
|
||||
foo(1, "2", p3 = 3.0)
|
||||
|
||||
foo(p1 = 1, p2 = "2", 3.0)
|
||||
|
||||
foo(1, p3 = 2.0, <!MIXING_NAMED_AND_POSITIONED_ARGUMENTS!>""<!><!NO_VALUE_FOR_PARAMETER!>)<!>
|
||||
foo(1, p3 = 2.0, <!MIXING_NAMED_AND_POSITIONED_ARGUMENTS!>3.0<!><!NO_VALUE_FOR_PARAMETER!>)<!>
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
// !LANGUAGE: +NewInference +MixedNamedArgumentsInTheirOwnPosition
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// SKIP_TXT
|
||||
|
||||
fun foo1(
|
||||
vararg p1: Int,
|
||||
p2: String,
|
||||
p3: Double
|
||||
) {}
|
||||
|
||||
fun foo2(
|
||||
p1: Int,
|
||||
vararg p2: String,
|
||||
p3: Double
|
||||
) {}
|
||||
|
||||
fun foo3(
|
||||
p1: Int,
|
||||
p2: String,
|
||||
vararg p3: Double
|
||||
) {}
|
||||
|
||||
fun foo4(
|
||||
p1: Int,
|
||||
vararg p2: String,
|
||||
p3: Double,
|
||||
p4: Int
|
||||
) {}
|
||||
|
||||
fun main() {
|
||||
foo1(1, 2, p2 = "3", <!MIXING_NAMED_AND_POSITIONED_ARGUMENTS!>4.0<!><!NO_VALUE_FOR_PARAMETER!>)<!>
|
||||
foo1(p1 = *intArrayOf(1, 2), "3", p3 = 4.0)
|
||||
|
||||
foo1(p2 = "3", <!MIXING_NAMED_AND_POSITIONED_ARGUMENTS!>4.0<!><!NO_VALUE_FOR_PARAMETER!>)<!>
|
||||
|
||||
foo2(p1 = 1, "2", "3", p3 = 4.0)
|
||||
foo2(1, p2 = *arrayOf("2", "3"), 4.0)
|
||||
foo2(1, p3 = 3.0)
|
||||
|
||||
foo3(p1 = 1, "2", 3.0, 4.0)
|
||||
foo3(p1 = 1, "2", p3 = *doubleArrayOf(3.0, 4.0))
|
||||
|
||||
foo4(p1 = 1, "2", "3", p3 = 4.0, <!MIXING_NAMED_AND_POSITIONED_ARGUMENTS!>5<!><!NO_VALUE_FOR_PARAMETER!>)<!>
|
||||
foo4(1, "2", "3", p3 = 4.0, <!MIXING_NAMED_AND_POSITIONED_ARGUMENTS!>5<!><!NO_VALUE_FOR_PARAMETER!>)<!>
|
||||
foo4(1, p3 = 4.0, <!MIXING_NAMED_AND_POSITIONED_ARGUMENTS!>5<!><!NO_VALUE_FOR_PARAMETER!>)<!>
|
||||
|
||||
foo1(1, 2, p3 = 3.0, <!MIXING_NAMED_AND_POSITIONED_ARGUMENTS!>"4"<!><!NO_VALUE_FOR_PARAMETER!>)<!>
|
||||
foo1(1, 2, p3 = 3.0, p2 = "4")
|
||||
foo1(*intArrayOf(1, 2), p3 = 3.0, p2 = "4")
|
||||
|
||||
foo2(1, p3 = 2.0, <!MIXING_NAMED_AND_POSITIONED_ARGUMENTS!>"4"<!>)
|
||||
foo2(1, p3 = 2.0, <!MIXING_NAMED_AND_POSITIONED_ARGUMENTS!>*arrayOf("3", "4")<!>)
|
||||
foo2(1, p3 = 2.0, p2 = *arrayOf("3", "4"))
|
||||
|
||||
foo3(1, p3 = *doubleArrayOf(2.0, 3.0), <!MIXING_NAMED_AND_POSITIONED_ARGUMENTS!>"4"<!><!NO_VALUE_FOR_PARAMETER!>)<!>
|
||||
foo3(1, p3 = *doubleArrayOf(2.0, 3.0), p2 = "4")
|
||||
}
|
||||
@@ -14150,6 +14150,44 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
||||
public void testNamedArgumentsInOverrides() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/namedArguments/namedArgumentsInOverrides.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class MixedNamedPosition extends AbstractDiagnosticsTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInMixedNamedPosition() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition"), Pattern.compile("^(.*)\\.kts?$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
@TestMetadata("defaults.kt")
|
||||
public void testDefaults() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/defaults.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("disabledFeature.kt")
|
||||
public void testDisabledFeature() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/disabledFeature.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("oldInference.kt")
|
||||
public void testOldInference() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/oldInference.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple.kt")
|
||||
public void testSimple() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/simple.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("varargs.kt")
|
||||
public void testVarargs() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/varargs.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/nullabilityAndSmartCasts")
|
||||
|
||||
Generated
+38
@@ -14145,6 +14145,44 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
|
||||
public void testNamedArgumentsInOverrides() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/namedArguments/namedArgumentsInOverrides.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class MixedNamedPosition extends AbstractDiagnosticsUsingJavacTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInMixedNamedPosition() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
@TestMetadata("defaults.kt")
|
||||
public void testDefaults() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/defaults.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("disabledFeature.kt")
|
||||
public void testDisabledFeature() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/disabledFeature.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("oldInference.kt")
|
||||
public void testOldInference() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/oldInference.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple.kt")
|
||||
public void testSimple() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/simple.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("varargs.kt")
|
||||
public void testVarargs() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/varargs.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/nullabilityAndSmartCasts")
|
||||
|
||||
+28
@@ -15761,6 +15761,34 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/mixedNamedPosition")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class MixedNamedPosition extends AbstractBlackBoxCodegenTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInMixedNamedPosition() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/mixedNamedPosition"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("defaults.kt")
|
||||
public void testDefaults() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/mixedNamedPosition/defaults.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple.kt")
|
||||
public void testSimple() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/mixedNamedPosition/simple.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("varargs.kt")
|
||||
public void testVarargs() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/mixedNamedPosition/varargs.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/multiDecl")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
+28
@@ -15761,6 +15761,34 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/mixedNamedPosition")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class MixedNamedPosition extends AbstractLightAnalysisModeTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInMixedNamedPosition() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/mixedNamedPosition"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("defaults.kt")
|
||||
public void testDefaults() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/mixedNamedPosition/defaults.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple.kt")
|
||||
public void testSimple() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/mixedNamedPosition/simple.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("varargs.kt")
|
||||
public void testVarargs() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/mixedNamedPosition/varargs.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/multiDecl")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
+28
@@ -14646,6 +14646,34 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/mixedNamedPosition")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class MixedNamedPosition extends AbstractIrBlackBoxCodegenTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInMixedNamedPosition() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/mixedNamedPosition"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("defaults.kt")
|
||||
public void testDefaults() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/mixedNamedPosition/defaults.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple.kt")
|
||||
public void testSimple() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/mixedNamedPosition/simple.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("varargs.kt")
|
||||
public void testVarargs() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/mixedNamedPosition/varargs.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/multiDecl")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
@@ -107,6 +107,7 @@ enum class LanguageFeature(
|
||||
NonParenthesizedAnnotationsOnFunctionalTypes(KOTLIN_1_4),
|
||||
UseGetterNameForPropertyAnnotationsMethodOnJvm(KOTLIN_1_4),
|
||||
AllowBreakAndContinueInsideWhen(KOTLIN_1_4),
|
||||
MixedNamedArgumentsInTheirOwnPosition(KOTLIN_1_4),
|
||||
|
||||
ProperVisibilityForCompanionObjectInstanceField(sinceVersion = null, kind = BUG_FIX),
|
||||
// Temporarily disabled, see KT-27084/KT-22379
|
||||
|
||||
Generated
+28
@@ -11951,6 +11951,34 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/mixedNamedPosition")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class MixedNamedPosition extends AbstractIrJsCodegenBoxTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInMixedNamedPosition() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/mixedNamedPosition"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("defaults.kt")
|
||||
public void testDefaults() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/mixedNamedPosition/defaults.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple.kt")
|
||||
public void testSimple() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/mixedNamedPosition/simple.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("varargs.kt")
|
||||
public void testVarargs() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/mixedNamedPosition/varargs.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/multiDecl")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
+28
@@ -13106,6 +13106,34 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/mixedNamedPosition")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class MixedNamedPosition extends AbstractJsCodegenBoxTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInMixedNamedPosition() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/mixedNamedPosition"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS, true);
|
||||
}
|
||||
|
||||
@TestMetadata("defaults.kt")
|
||||
public void testDefaults() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/mixedNamedPosition/defaults.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple.kt")
|
||||
public void testSimple() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/mixedNamedPosition/simple.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("varargs.kt")
|
||||
public void testVarargs() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/mixedNamedPosition/varargs.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/multiDecl")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
Reference in New Issue
Block a user