isNothing() made static
This commit is contained in:
@@ -118,7 +118,7 @@ public class CommonSupertypes {
|
||||
JetType type = iterator.next();
|
||||
assert type != null;
|
||||
assert !TypesPackage.isFlexible(type) : "Flexible type " + type + " passed to commonSuperTypeForInflexible";
|
||||
if (KotlinBuiltIns.getInstance().isNothingOrNullableNothing(type)) {
|
||||
if (KotlinBuiltIns.isNothingOrNullableNothing(type)) {
|
||||
iterator.remove();
|
||||
}
|
||||
if (type.isError()) {
|
||||
|
||||
@@ -169,7 +169,7 @@ public class TypeSubstitutor {
|
||||
);
|
||||
}
|
||||
|
||||
if (KotlinBuiltIns.getInstance().isNothing(type) || type.isError()) return originalProjection;
|
||||
if (KotlinBuiltIns.isNothing(type) || type.isError()) return originalProjection;
|
||||
|
||||
TypeProjection replacement = substitution.get(type.getConstructor());
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@ public class TypeUtils {
|
||||
boolean nothingTypePresent = false;
|
||||
List<JetType> nullabilityStripped = new ArrayList<JetType>(types.size());
|
||||
for (JetType type : types) {
|
||||
nothingTypePresent |= KotlinBuiltIns.getInstance().isNothingOrNullableNothing(type);
|
||||
nothingTypePresent |= KotlinBuiltIns.isNothingOrNullableNothing(type);
|
||||
allNullable &= type.isNullable();
|
||||
nullabilityStripped.add(makeNotNullable(type));
|
||||
}
|
||||
|
||||
+1
-1
@@ -194,7 +194,7 @@ public class TypeCheckingProcedure {
|
||||
}
|
||||
subtype = TypeUtils.makeNotNullable(subtype);
|
||||
supertype = TypeUtils.makeNotNullable(supertype);
|
||||
if (KotlinBuiltIns.getInstance().isNothingOrNullableNothing(subtype)) {
|
||||
if (KotlinBuiltIns.isNothingOrNullableNothing(subtype)) {
|
||||
return true;
|
||||
}
|
||||
@Nullable JetType closestSupertype = findCorrespondingSupertype(subtype, supertype, constraints);
|
||||
|
||||
@@ -835,18 +835,19 @@ public class KotlinBuiltIns {
|
||||
return FQ_NAMES.any.equals(DescriptorUtils.getFqName(descriptor));
|
||||
}
|
||||
|
||||
public boolean isNothing(@NotNull JetType type) {
|
||||
public static boolean isNothing(@NotNull JetType type) {
|
||||
return isNothingOrNullableNothing(type)
|
||||
&& !type.isNullable();
|
||||
}
|
||||
|
||||
public boolean isNullableNothing(@NotNull JetType type) {
|
||||
public static boolean isNullableNothing(@NotNull JetType type) {
|
||||
return isNothingOrNullableNothing(type)
|
||||
&& type.isNullable();
|
||||
}
|
||||
|
||||
public boolean isNothingOrNullableNothing(@NotNull JetType type) {
|
||||
return type.getConstructor() == getNothing().getTypeConstructor();
|
||||
public static boolean isNothingOrNullableNothing(@NotNull JetType type) {
|
||||
ClassifierDescriptor descriptor = type.getConstructor().getDeclarationDescriptor();
|
||||
return descriptor != null && FQ_NAMES.nothing.equals(DescriptorUtils.getFqName(descriptor));
|
||||
}
|
||||
|
||||
public boolean isAnyOrNullableAny(@NotNull JetType type) {
|
||||
|
||||
Reference in New Issue
Block a user