[FE 1.0] Remove CONSTRAINT_SYSTEM_FOR_OVERLOAD_RESOLUTION analysis flag

The constraint system for the old type inference is going to be removed.
Also, `CONSTRAINT_SYSTEM_FOR_OVERLOAD_RESOLUTION` isn't used in the production
This commit is contained in:
Victor Petukhov
2022-06-09 11:06:12 +02:00
committed by teamcity
parent 8227c4b603
commit 8500ee08a8
23 changed files with 1 additions and 287 deletions
@@ -26519,24 +26519,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
runTest("compiler/testData/diagnostics/tests/resolve/overloadConflicts/kt31670.kt");
}
@Test
@TestMetadata("kt31670_compat.kt")
public void testKt31670_compat() throws Exception {
runTest("compiler/testData/diagnostics/tests/resolve/overloadConflicts/kt31670_compat.kt");
}
@Test
@TestMetadata("kt31758.kt")
public void testKt31758() throws Exception {
runTest("compiler/testData/diagnostics/tests/resolve/overloadConflicts/kt31758.kt");
}
@Test
@TestMetadata("kt31758_compat.kt")
public void testKt31758_compat() throws Exception {
runTest("compiler/testData/diagnostics/tests/resolve/overloadConflicts/kt31758_compat.kt");
}
@Test
@TestMetadata("kt37692.kt")
public void testKt37692() throws Exception {
@@ -26561,12 +26549,6 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
runTest("compiler/testData/diagnostics/tests/resolve/overloadConflicts/overloadResolutionOnNullableContravariantParameter.kt");
}
@Test
@TestMetadata("overloadResolutionOnNullableContravariantParameter_compat.kt")
public void testOverloadResolutionOnNullableContravariantParameter_compat() throws Exception {
runTest("compiler/testData/diagnostics/tests/resolve/overloadConflicts/overloadResolutionOnNullableContravariantParameter_compat.kt");
}
@Test
@TestMetadata("varargWithMoreSpecificSignature.kt")
public void testVarargWithMoreSpecificSignature() throws Exception {
@@ -33,9 +33,6 @@ object AnalysisFlags {
@JvmStatic
val explicitApiMode by AnalysisFlag.Delegates.ApiModeDisabledByDefault
@JvmStatic
val constraintSystemForOverloadResolution by AnalysisFlag.Delegates.ConstraintSystemForOverloadResolution
@JvmStatic
val ideMode by AnalysisFlag.Delegates.Boolean
@@ -26519,24 +26519,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
runTest("compiler/testData/diagnostics/tests/resolve/overloadConflicts/kt31670.kt");
}
@Test
@TestMetadata("kt31670_compat.kt")
public void testKt31670_compat() throws Exception {
runTest("compiler/testData/diagnostics/tests/resolve/overloadConflicts/kt31670_compat.kt");
}
@Test
@TestMetadata("kt31758.kt")
public void testKt31758() throws Exception {
runTest("compiler/testData/diagnostics/tests/resolve/overloadConflicts/kt31758.kt");
}
@Test
@TestMetadata("kt31758_compat.kt")
public void testKt31758_compat() throws Exception {
runTest("compiler/testData/diagnostics/tests/resolve/overloadConflicts/kt31758_compat.kt");
}
@Test
@TestMetadata("kt37692.kt")
public void testKt37692() throws Exception {
@@ -26561,12 +26549,6 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
runTest("compiler/testData/diagnostics/tests/resolve/overloadConflicts/overloadResolutionOnNullableContravariantParameter.kt");
}
@Test
@TestMetadata("overloadResolutionOnNullableContravariantParameter_compat.kt")
public void testOverloadResolutionOnNullableContravariantParameter_compat() throws Exception {
runTest("compiler/testData/diagnostics/tests/resolve/overloadConflicts/overloadResolutionOnNullableContravariantParameter_compat.kt");
}
@Test
@TestMetadata("varargWithMoreSpecificSignature.kt")
public void testVarargWithMoreSpecificSignature() throws Exception {
@@ -26519,24 +26519,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
runTest("compiler/testData/diagnostics/tests/resolve/overloadConflicts/kt31670.kt");
}
@Test
@TestMetadata("kt31670_compat.kt")
public void testKt31670_compat() throws Exception {
runTest("compiler/testData/diagnostics/tests/resolve/overloadConflicts/kt31670_compat.kt");
}
@Test
@TestMetadata("kt31758.kt")
public void testKt31758() throws Exception {
runTest("compiler/testData/diagnostics/tests/resolve/overloadConflicts/kt31758.kt");
}
@Test
@TestMetadata("kt31758_compat.kt")
public void testKt31758_compat() throws Exception {
runTest("compiler/testData/diagnostics/tests/resolve/overloadConflicts/kt31758_compat.kt");
}
@Test
@TestMetadata("kt37692.kt")
public void testKt37692() throws Exception {
@@ -26561,12 +26549,6 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
runTest("compiler/testData/diagnostics/tests/resolve/overloadConflicts/overloadResolutionOnNullableContravariantParameter.kt");
}
@Test
@TestMetadata("overloadResolutionOnNullableContravariantParameter_compat.kt")
public void testOverloadResolutionOnNullableContravariantParameter_compat() throws Exception {
runTest("compiler/testData/diagnostics/tests/resolve/overloadConflicts/overloadResolutionOnNullableContravariantParameter_compat.kt");
}
@Test
@TestMetadata("varargWithMoreSpecificSignature.kt")
public void testVarargWithMoreSpecificSignature() throws Exception {
@@ -104,10 +104,5 @@ class KotlinResolutionStatelessCallbacksImpl(
override fun createConstraintSystemForOverloadResolution(
constraintInjector: ConstraintInjector, builtIns: KotlinBuiltIns
): SimpleConstraintSystem {
return if (languageVersionSettings.getFlag(AnalysisFlags.constraintSystemForOverloadResolution).forNewInference())
SimpleConstraintSystemImpl(constraintInjector, builtIns, kotlinTypeRefiner, languageVersionSettings)
else
ConstraintSystemBuilderImpl.forSpecificity()
}
): SimpleConstraintSystem = SimpleConstraintSystemImpl(constraintInjector, builtIns, kotlinTypeRefiner, languageVersionSettings)
}
@@ -78,7 +78,6 @@ import org.jetbrains.kotlin.types.expressions.unqualifiedSuper.UnqualifiedSuperK
import org.jetbrains.kotlin.types.typeUtil.TypeUtilsKt;
import org.jetbrains.kotlin.util.OperatorNameConventions;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
@@ -65,7 +65,6 @@ class LanguageVersionSettingsBuilder {
val analysisFlags = listOfNotNull(
analysisFlag(AnalysisFlags.optIn, directives[LanguageSettingsDirectives.OPT_IN].takeIf { it.isNotEmpty() }),
analysisFlag(AnalysisFlags.ignoreDataFlowInAssert, trueOrNull(LanguageSettingsDirectives.IGNORE_DATA_FLOW_IN_ASSERT in directives)),
analysisFlag(AnalysisFlags.constraintSystemForOverloadResolution, directives.singleOrZeroValue(LanguageSettingsDirectives.CONSTRAINT_SYSTEM_FOR_OVERLOAD_RESOLUTION)),
analysisFlag(AnalysisFlags.allowResultReturnType, trueOrNull(LanguageSettingsDirectives.ALLOW_RESULT_RETURN_TYPE in directives)),
analysisFlag(AnalysisFlags.explicitApiMode, directives.singleOrZeroValue(LanguageSettingsDirectives.EXPLICIT_API_MODE)),
analysisFlag(AnalysisFlags.allowKotlinPackage, trueOrNull(LanguageSettingsDirectives.ALLOW_KOTLIN_PACKAGE in directives)),
@@ -33,10 +33,6 @@ object LanguageSettingsDirectives : SimpleDirectivesContainer() {
description = "Enables corresponding analysis flag (AnalysisFlags.ignoreDataFlowInAssert)"
)
val CONSTRAINT_SYSTEM_FOR_OVERLOAD_RESOLUTION by enumDirective<ConstraintSystemForOverloadResolutionMode>(
description = "Configures corresponding analysis flag (AnalysisFlags.constraintSystemForOverloadResolution)",
)
val ALLOW_RESULT_RETURN_TYPE by directive(
description = "Allow using Result in return type position"
)
@@ -1,5 +1,4 @@
// FIR_IDENTICAL
// !CONSTRAINT_SYSTEM_FOR_OVERLOAD_RESOLUTION: CONSTRAINT_SYSTEM_FOR_NEW_INFERENCE
open class A<T>(val value: T)
class B<T>(value: T) : A<T>(value)
@@ -1,15 +0,0 @@
// !CONSTRAINT_SYSTEM_FOR_OVERLOAD_RESOLUTION: CONSTRAINT_SYSTEM_FOR_OLD_INFERENCE
open class A<T>(val value: T)
class B<T>(value: T) : A<T>(value)
fun <T> A<T>.foo(block: (T?) -> Unit) {
block(value)
}
fun <T> B<T>.foo(block: (T) -> Unit) {
block(value)
}
fun main() {
B("string").<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo<!> { }
}
@@ -1,15 +0,0 @@
// !CONSTRAINT_SYSTEM_FOR_OVERLOAD_RESOLUTION: CONSTRAINT_SYSTEM_FOR_OLD_INFERENCE
open class A<T>(val value: T)
class B<T>(value: T) : A<T>(value)
fun <T> A<T>.foo(block: (T?) -> Unit) {
block(value)
}
fun <T> B<T>.foo(block: (T) -> Unit) {
block(value)
}
fun main() {
B("string").foo { }
}
@@ -1,21 +0,0 @@
package
public fun main(): kotlin.Unit
public fun </*0*/ T> A<T>.foo(/*0*/ block: (T?) -> kotlin.Unit): kotlin.Unit
public fun </*0*/ T> B<T>.foo(/*0*/ block: (T) -> kotlin.Unit): kotlin.Unit
public open class A</*0*/ T> {
public constructor A</*0*/ T>(/*0*/ value: T)
public final val value: 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 final class B</*0*/ T> : A<T> {
public constructor B</*0*/ T>(/*0*/ value: T)
public final override /*1*/ /*fake_override*/ val value: 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
}
@@ -1,5 +1,4 @@
// FIR_IDENTICAL
// !CONSTRAINT_SYSTEM_FOR_OVERLOAD_RESOLUTION: CONSTRAINT_SYSTEM_FOR_NEW_INFERENCE
// !DIAGNOSTICS: -UNUSED_PARAMETER
// FILE: a.kt
@@ -1,25 +0,0 @@
// !CONSTRAINT_SYSTEM_FOR_OVERLOAD_RESOLUTION: CONSTRAINT_SYSTEM_FOR_OLD_INFERENCE
// !DIAGNOSTICS: -UNUSED_PARAMETER
// FILE: a.kt
package a
enum class A { A1 }
fun <T : Enum<T>> foo(arg: T.() -> Unit) = 1
// FILE: b.kt
package b
fun <T : Any> foo(arg: T.() -> Unit) = 2
// FILE: test.kt
import a.*
import b.*
fun test() {
<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo<!><A> { }
}
@@ -1,25 +0,0 @@
// !CONSTRAINT_SYSTEM_FOR_OVERLOAD_RESOLUTION: CONSTRAINT_SYSTEM_FOR_OLD_INFERENCE
// !DIAGNOSTICS: -UNUSED_PARAMETER
// FILE: a.kt
package a
enum class A { A1 }
fun <T : Enum<T>> foo(arg: T.() -> Unit) = 1
// FILE: b.kt
package b
fun <T : Any> foo(arg: T.() -> Unit) = 2
// FILE: test.kt
import a.*
import b.*
fun test() {
foo<A> { }
}
@@ -1,30 +0,0 @@
package
public fun test(): kotlin.Unit
package a {
public fun </*0*/ T : kotlin.Enum<T>> foo(/*0*/ arg: T.() -> kotlin.Unit): kotlin.Int
public final enum class A : kotlin.Enum<a.A> {
enum entry A1
private constructor A()
@kotlin.internal.IntrinsicConstEvaluation public final override /*1*/ /*fake_override*/ val name: kotlin.String
public final override /*1*/ /*fake_override*/ val ordinal: kotlin.Int
protected final override /*1*/ /*fake_override*/ fun clone(): kotlin.Any
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: a.A): kotlin.Int
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
protected/*protected and package*/ final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun finalize(): kotlin.Unit
public final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun getDeclaringClass(): java.lang.Class<a.A!>!
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
// Static members
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): a.A
public final /*synthesized*/ fun values(): kotlin.Array<a.A>
}
}
package b {
public fun </*0*/ T : kotlin.Any> foo(/*0*/ arg: T.() -> kotlin.Unit): kotlin.Int
}
@@ -1,5 +1,4 @@
// FIR_IDENTICAL
// !CONSTRAINT_SYSTEM_FOR_OVERLOAD_RESOLUTION: CONSTRAINT_SYSTEM_FOR_NEW_INFERENCE
// !DIAGNOSTICS: -UNUSED_PARAMETER
// FILE: a.kt
@@ -1,23 +0,0 @@
// !CONSTRAINT_SYSTEM_FOR_OVERLOAD_RESOLUTION: CONSTRAINT_SYSTEM_FOR_OLD_INFERENCE
// !DIAGNOSTICS: -UNUSED_PARAMETER
// FILE: a.kt
package a
fun <T> foo(block: (T?) -> Unit) {}
// FILE: b.kt
package b
fun <K> foo(block: (K) -> Unit) {}
// FILE: test.kt
import a.*
import b.*
fun main() {
foo<String> { }
}
@@ -1,23 +0,0 @@
// !CONSTRAINT_SYSTEM_FOR_OVERLOAD_RESOLUTION: CONSTRAINT_SYSTEM_FOR_OLD_INFERENCE
// !DIAGNOSTICS: -UNUSED_PARAMETER
// FILE: a.kt
package a
fun <T> foo(block: (T?) -> Unit) {}
// FILE: b.kt
package b
fun <K> foo(block: (K) -> Unit) {}
// FILE: test.kt
import a.*
import b.*
fun main() {
<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo<!><String> { }
}
@@ -1,11 +0,0 @@
package
public fun main(): kotlin.Unit
package a {
public fun </*0*/ T> foo(/*0*/ block: (T?) -> kotlin.Unit): kotlin.Unit
}
package b {
public fun </*0*/ K> foo(/*0*/ block: (K) -> kotlin.Unit): kotlin.Unit
}
@@ -26531,24 +26531,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/resolve/overloadConflicts/kt31670.kt");
}
@Test
@TestMetadata("kt31670_compat.kt")
public void testKt31670_compat() throws Exception {
runTest("compiler/testData/diagnostics/tests/resolve/overloadConflicts/kt31670_compat.kt");
}
@Test
@TestMetadata("kt31758.kt")
public void testKt31758() throws Exception {
runTest("compiler/testData/diagnostics/tests/resolve/overloadConflicts/kt31758.kt");
}
@Test
@TestMetadata("kt31758_compat.kt")
public void testKt31758_compat() throws Exception {
runTest("compiler/testData/diagnostics/tests/resolve/overloadConflicts/kt31758_compat.kt");
}
@Test
@TestMetadata("kt37692.kt")
public void testKt37692() throws Exception {
@@ -26573,12 +26561,6 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/resolve/overloadConflicts/overloadResolutionOnNullableContravariantParameter.kt");
}
@Test
@TestMetadata("overloadResolutionOnNullableContravariantParameter_compat.kt")
public void testOverloadResolutionOnNullableContravariantParameter_compat() throws Exception {
runTest("compiler/testData/diagnostics/tests/resolve/overloadConflicts/overloadResolutionOnNullableContravariantParameter_compat.kt");
}
@Test
@TestMetadata("varargWithMoreSpecificSignature.kt")
public void testVarargWithMoreSpecificSignature() throws Exception {
@@ -23,7 +23,6 @@ const val SKIP_METADATA_VERSION_CHECK = "SKIP_METADATA_VERSION_CHECK"
const val ALLOW_RESULT_RETURN_TYPE = "ALLOW_RESULT_RETURN_TYPE"
const val INHERIT_MULTIFILE_PARTS = "INHERIT_MULTIFILE_PARTS"
const val SANITIZE_PARENTHESES = "SANITIZE_PARENTHESES"
const val CONSTRAINT_SYSTEM_FOR_OVERLOAD_RESOLUTION = "CONSTRAINT_SYSTEM_FOR_OVERLOAD_RESOLUTION"
const val ENABLE_JVM_PREVIEW = "ENABLE_JVM_PREVIEW"
data class CompilerTestLanguageVersionSettings(
@@ -67,9 +66,6 @@ fun parseLanguageVersionSettings(directives: Directives): CompilerTestLanguageVe
analysisFlag(JvmAnalysisFlags.inheritMultifileParts, if (INHERIT_MULTIFILE_PARTS in directives) true else null),
analysisFlag(JvmAnalysisFlags.sanitizeParentheses, if (SANITIZE_PARENTHESES in directives) true else null),
analysisFlag(JvmAnalysisFlags.enableJvmPreview, if (ENABLE_JVM_PREVIEW in directives) true else null),
analysisFlag(AnalysisFlags.constraintSystemForOverloadResolution, directives[CONSTRAINT_SYSTEM_FOR_OVERLOAD_RESOLUTION]?.let {
ConstraintSystemForOverloadResolutionMode.valueOf(it)
}),
analysisFlag(AnalysisFlags.explicitApiVersion, if (apiVersionString != null) true else null)
)
@@ -36,10 +36,5 @@ class AnalysisFlag<out T> internal constructor(
object ListOfStrings {
operator fun provideDelegate(instance: Any?, property: KProperty<*>) = Delegate(property.name, emptyList<String>())
}
object ConstraintSystemForOverloadResolution {
operator fun provideDelegate(instance: Any?, property: KProperty<*>) =
Delegate(property.name, ConstraintSystemForOverloadResolutionMode.CONSTRAINT_SYSTEM_FOR_NEW_INFERENCE)
}
}
}