IR, descriptors: remove (Ir)ExternalOverridabilityCondition.Result.CONFLICT
No existing external overridability condition reports a conflict anyway, and there's no support for it in the IR case.
This commit is contained in:
committed by
Space Team
parent
c63f31f92f
commit
9b5c331c8e
+1
-4
@@ -10,7 +10,6 @@ import org.jetbrains.kotlin.ir.declarations.IrOverridableMember
|
|||||||
interface IrExternalOverridabilityCondition {
|
interface IrExternalOverridabilityCondition {
|
||||||
enum class Result {
|
enum class Result {
|
||||||
OVERRIDABLE,
|
OVERRIDABLE,
|
||||||
CONFLICT,
|
|
||||||
INCOMPATIBLE,
|
INCOMPATIBLE,
|
||||||
UNKNOWN
|
UNKNOWN
|
||||||
}
|
}
|
||||||
@@ -26,8 +25,6 @@ interface IrExternalOverridabilityCondition {
|
|||||||
*
|
*
|
||||||
* - [Result.OVERRIDABLE] means that it is definitely overridable, and neither the general override checking algorithm, nor other
|
* - [Result.OVERRIDABLE] means that it is definitely overridable, and neither the general override checking algorithm, nor other
|
||||||
* external overridability conditions can refute that.
|
* external overridability conditions can refute that.
|
||||||
* - [Result.CONFLICT] means that it is an error to have both declarations available in the same class, so the compiler should report
|
|
||||||
* an error.
|
|
||||||
* - [Result.INCOMPATIBLE] means that it is not overridable, but it's OK to have both declarations available in the same class because
|
* - [Result.INCOMPATIBLE] means that it is not overridable, but it's OK to have both declarations available in the same class because
|
||||||
* they don't cause a conflict.
|
* they don't cause a conflict.
|
||||||
* - [Result.UNKNOWN] means that this overridability condition cannot claim anything about the overridability, and the final result
|
* - [Result.UNKNOWN] means that this overridability condition cannot claim anything about the overridability, and the final result
|
||||||
@@ -42,7 +39,7 @@ interface IrExternalOverridabilityCondition {
|
|||||||
* Specifies what values can be returned by [isOverridable]. Used as an optimization to reorder overridability conditions to prevent
|
* Specifies what values can be returned by [isOverridable]. Used as an optimization to reorder overridability conditions to prevent
|
||||||
* redundant calculations.
|
* redundant calculations.
|
||||||
*
|
*
|
||||||
* - [Contract.CONFLICTS_ONLY] means that [isOverridable] can return [Result.CONFLICT], [Result.INCOMPATIBLE] or [Result.UNKNOWN].
|
* - [Contract.CONFLICTS_ONLY] means that [isOverridable] can return [Result.INCOMPATIBLE] or [Result.UNKNOWN].
|
||||||
* - [Contract.SUCCESS_ONLY] means that [isOverridable] can return [Result.OVERRIDABLE] or [Result.UNKNOWN].
|
* - [Contract.SUCCESS_ONLY] means that [isOverridable] can return [Result.OVERRIDABLE] or [Result.UNKNOWN].
|
||||||
* - [Contract.BOTH] means that [isOverridable] can return any result.
|
* - [Contract.BOTH] means that [isOverridable] can return any result.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -158,7 +158,6 @@ class IrOverrideChecker(
|
|||||||
externalCondition.isOverridable(superMember, subMember)
|
externalCondition.isOverridable(superMember, subMember)
|
||||||
when (result) {
|
when (result) {
|
||||||
OVERRIDABLE -> wasSuccess = true
|
OVERRIDABLE -> wasSuccess = true
|
||||||
CONFLICT -> return conflict("External condition failed")
|
|
||||||
INCOMPATIBLE -> return incompatible("External condition")
|
INCOMPATIBLE -> return incompatible("External condition")
|
||||||
UNKNOWN -> {}
|
UNKNOWN -> {}
|
||||||
}
|
}
|
||||||
@@ -173,7 +172,6 @@ class IrOverrideChecker(
|
|||||||
val result =
|
val result =
|
||||||
externalCondition.isOverridable(superMember, subMember)
|
externalCondition.isOverridable(superMember, subMember)
|
||||||
when (result) {
|
when (result) {
|
||||||
CONFLICT -> return conflict("External condition failed")
|
|
||||||
INCOMPATIBLE -> return incompatible("External condition")
|
INCOMPATIBLE -> return incompatible("External condition")
|
||||||
OVERRIDABLE -> error(
|
OVERRIDABLE -> error(
|
||||||
"Contract violation in ${externalCondition.javaClass} condition. It's not supposed to end with success"
|
"Contract violation in ${externalCondition.javaClass} condition. It's not supposed to end with success"
|
||||||
|
|||||||
+1
-1
@@ -23,7 +23,7 @@ import org.jetbrains.kotlin.descriptors.ClassDescriptor;
|
|||||||
|
|
||||||
public interface ExternalOverridabilityCondition {
|
public interface ExternalOverridabilityCondition {
|
||||||
enum Result {
|
enum Result {
|
||||||
OVERRIDABLE, CONFLICT, INCOMPATIBLE, UNKNOWN
|
OVERRIDABLE, INCOMPATIBLE, UNKNOWN
|
||||||
}
|
}
|
||||||
|
|
||||||
enum Contract {
|
enum Contract {
|
||||||
|
|||||||
@@ -258,8 +258,6 @@ public class OverridingUtil {
|
|||||||
case OVERRIDABLE:
|
case OVERRIDABLE:
|
||||||
wasSuccess = true;
|
wasSuccess = true;
|
||||||
break;
|
break;
|
||||||
case CONFLICT:
|
|
||||||
return OverrideCompatibilityInfo.conflict("External condition failed");
|
|
||||||
case INCOMPATIBLE:
|
case INCOMPATIBLE:
|
||||||
return OverrideCompatibilityInfo.incompatible("External condition");
|
return OverrideCompatibilityInfo.incompatible("External condition");
|
||||||
case UNKNOWN:
|
case UNKNOWN:
|
||||||
@@ -280,8 +278,6 @@ public class OverridingUtil {
|
|||||||
ExternalOverridabilityCondition.Result result =
|
ExternalOverridabilityCondition.Result result =
|
||||||
externalCondition.isOverridable(superDescriptor, subDescriptor, subClassDescriptor);
|
externalCondition.isOverridable(superDescriptor, subDescriptor, subClassDescriptor);
|
||||||
switch (result) {
|
switch (result) {
|
||||||
case CONFLICT:
|
|
||||||
return OverrideCompatibilityInfo.conflict("External condition failed");
|
|
||||||
case INCOMPATIBLE:
|
case INCOMPATIBLE:
|
||||||
return OverrideCompatibilityInfo.incompatible("External condition");
|
return OverrideCompatibilityInfo.incompatible("External condition");
|
||||||
case OVERRIDABLE:
|
case OVERRIDABLE:
|
||||||
|
|||||||
Reference in New Issue
Block a user