[NI] Introduce flag to change constraint system for overload resolution
This commit doesn't change behaviour of any inference algorithm, it introduces opportunity to switch constraint system that is used for overload resolution and fix problematic cases by changing one enum entry. Due to fundamental changes, there are cases where a new inference algorithm reports overload resolution ambiguity errors (#KT-31670, #KT-31758), which is correct from its point of view. However, this is a breaking change and to really make it, we should be very confident and have enough motivation for it, therefore, we don't change behavior now in order to collect more examples (if there are any). And if we find a lot of erroneous examples, we'll be able to change the behavior quite simply
This commit is contained in:
@@ -41,5 +41,10 @@ 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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.config
|
||||
|
||||
enum class ConstraintSystemForOverloadResolutionMode {
|
||||
CONSTRAINT_SYSTEM_FOR_OLD_INFERENCE, CONSTRAINT_SYSTEM_FOR_NEW_INFERENCE;
|
||||
|
||||
fun forNewInference(): Boolean = this == CONSTRAINT_SYSTEM_FOR_NEW_INFERENCE
|
||||
}
|
||||
Reference in New Issue
Block a user