Minor. Improved usability of CustomTypeVariable API
This commit is contained in:
+2
-2
@@ -423,8 +423,8 @@ public class ConstraintSystemImpl implements ConstraintSystem {
|
||||
// Foo >: T!
|
||||
// both Foo and Foo? transform to Foo! here
|
||||
if (TypesPackage.isFlexible(parameterType)) {
|
||||
CustomTypeVariable typeVariable = parameterType.getCapability(CustomTypeVariable.class);
|
||||
if (typeVariable != null && typeVariable.getIsTypeVariable()) {
|
||||
CustomTypeVariable typeVariable = TypesPackage.getCustomTypeVariable(parameterType);
|
||||
if (typeVariable != null) {
|
||||
constrainingType = typeVariable.substitutionResult(constrainingType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,4 +46,8 @@ public trait CustomTypeVariable : TypeCapability {
|
||||
public fun substitutionResult(replacement: JetType): JetType
|
||||
}
|
||||
|
||||
public fun JetType.isCustomTypeVariable(): Boolean = this.getCapability(javaClass<CustomTypeVariable>())?.isTypeVariable ?: false
|
||||
public fun JetType.isCustomTypeVariable(): Boolean = this.getCapability(javaClass<CustomTypeVariable>())?.isTypeVariable ?: false
|
||||
public fun JetType.getCustomTypeVariable(): CustomTypeVariable? =
|
||||
this.getCapability(javaClass<CustomTypeVariable>())?.let {
|
||||
if (it.isTypeVariable) it else null
|
||||
}
|
||||
@@ -187,9 +187,8 @@ public class TypeSubstitutor {
|
||||
return TypeUtils.makeStarProjection(typeParameter);
|
||||
case NO_CONFLICT:
|
||||
JetType substitutedType;
|
||||
if (TypesPackage.isCustomTypeVariable(type)) {
|
||||
CustomTypeVariable typeVariable = type.getCapability(CustomTypeVariable.class);
|
||||
assert typeVariable != null;
|
||||
CustomTypeVariable typeVariable = TypesPackage.getCustomTypeVariable(type);
|
||||
if (typeVariable != null) {
|
||||
substitutedType = typeVariable.substitutionResult(replacement.getType());
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user