NamespaceType → PackageType.

This commit is contained in:
Evgeny Gerashchenko
2014-01-09 23:29:49 +04:00
parent 1f615d08c7
commit 997d3597a9
13 changed files with 40 additions and 41 deletions
@@ -299,7 +299,7 @@ public class ErrorUtils {
public static boolean containsErrorType(@Nullable JetType type) {
if (type == null) return false;
if (type instanceof NamespaceType) return false;
if (type instanceof PackageType) return false;
if (type.isError()) return true;
for (TypeProjection projection : type.getArguments()) {
if (containsErrorType(projection.getType())) return true;
@@ -25,15 +25,15 @@ import org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverValue;
import java.util.List;
/**
* This is a fake type assigned to namespace expressions. Only member lookup is
* This is a fake type assigned to package expressions. Only member lookup is
* supposed to be done on these types.
*/
public class NamespaceType implements JetType {
public class PackageType implements JetType {
private final Name name;
private final JetScope memberScope;
private final ReceiverValue receiver;
public NamespaceType(@NotNull Name name, @NotNull JetScope memberScope, @NotNull ReceiverValue receiver) {
public PackageType(@NotNull Name name, @NotNull JetScope memberScope, @NotNull ReceiverValue receiver) {
this.name = name;
this.memberScope = memberScope;
this.receiver = receiver;
@@ -62,7 +62,7 @@ public class NamespaceType implements JetType {
}
private TypeConstructor throwException() {
throw new UnsupportedOperationException("Only member lookup is allowed on a namespace type " + name);
throw new UnsupportedOperationException("Only member lookup is allowed on a package type " + name);
}
@NotNull
@@ -528,7 +528,7 @@ public class TypeUtils {
private static boolean equalsOrContainsAsArgument(@Nullable JetType type, @NotNull Set<JetType> possibleArgumentTypes) {
if (type == null) return false;
if (possibleArgumentTypes.contains(type)) return true;
if (type instanceof NamespaceType) return false;
if (type instanceof PackageType) return false;
for (TypeProjection projection : type.getArguments()) {
if (equalsOrContainsAsArgument(projection.getType(), possibleArgumentTypes)) return true;
}
@@ -905,17 +905,17 @@ public class KotlinBuiltIns {
}
public boolean isNothingOrNullableNothing(@NotNull JetType type) {
return !(type instanceof NamespaceType)
return !(type instanceof PackageType)
&& type.getConstructor() == getNothing().getTypeConstructor();
}
public boolean isAnyOrNullableAny(@NotNull JetType type) {
return !(type instanceof NamespaceType) &&
return !(type instanceof PackageType) &&
type.getConstructor() == getAny().getTypeConstructor();
}
public boolean isUnit(@NotNull JetType type) {
return !(type instanceof NamespaceType) && type.equals(getUnitType());
return !(type instanceof PackageType) && type.equals(getUnitType());
}
public boolean isData(@NotNull ClassDescriptor classDescriptor) {