no error scope in good type
propagate error types in several sites
This commit is contained in:
+1
-1
@@ -142,7 +142,7 @@ public abstract class JetTypeJetSignatureReader extends JetSignatureExceptionsAd
|
||||
classDescriptor.getTypeConstructor(),
|
||||
nullable,
|
||||
typeArguments,
|
||||
ErrorUtils.getErrorScope());
|
||||
classDescriptor.getMemberScope(typeArguments));
|
||||
done(jetType);
|
||||
}
|
||||
|
||||
|
||||
@@ -100,13 +100,7 @@ public class TypeResolver {
|
||||
int expectedArgumentCount = parameters.size();
|
||||
int actualArgumentCount = arguments.size();
|
||||
if (ErrorUtils.isError(typeConstructor)) {
|
||||
result[0] = new JetTypeImpl(
|
||||
annotations,
|
||||
typeConstructor,
|
||||
nullable,
|
||||
arguments, // TODO : review
|
||||
classDescriptor.getMemberScope(Collections.<TypeProjection>emptyList())
|
||||
);
|
||||
result[0] = ErrorUtils.createErrorType("??");
|
||||
}
|
||||
else {
|
||||
if (actualArgumentCount != expectedArgumentCount) {
|
||||
|
||||
@@ -15,7 +15,13 @@ import java.util.*;
|
||||
public class ErrorUtils {
|
||||
|
||||
private static final ModuleDescriptor ERROR_MODULE = new ModuleDescriptor("<ERROR MODULE>");
|
||||
private static final JetScope ERROR_SCOPE = new JetScope() {
|
||||
|
||||
|
||||
private static final JetScope ERROR_SCOPE = new ErrorScope();
|
||||
|
||||
public static class ErrorScope implements JetScope {
|
||||
|
||||
private ErrorScope() {}
|
||||
|
||||
@Override
|
||||
public ClassifierDescriptor getClassifier(@NotNull String name) {
|
||||
@@ -82,7 +88,7 @@ public class ErrorUtils {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
private static final ClassDescriptorImpl ERROR_CLASS = new ClassDescriptorImpl(ERROR_MODULE, Collections.<AnnotationDescriptor>emptyList(), "<ERROR CLASS>") {
|
||||
@NotNull
|
||||
|
||||
@@ -23,6 +23,11 @@ public final class JetTypeImpl extends AnnotatedImpl implements JetType {
|
||||
|
||||
public JetTypeImpl(List<AnnotationDescriptor> annotations, TypeConstructor constructor, boolean nullable, @NotNull List<TypeProjection> arguments, JetScope memberScope) {
|
||||
super(annotations);
|
||||
|
||||
if (memberScope instanceof ErrorUtils.ErrorScope) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
this.constructor = constructor;
|
||||
this.nullable = nullable;
|
||||
this.arguments = arguments;
|
||||
|
||||
@@ -100,6 +100,9 @@ public class TypeUtils {
|
||||
if (type.isNullable() == nullable) {
|
||||
return type;
|
||||
}
|
||||
if (ErrorUtils.isErrorType(type)) {
|
||||
return type;
|
||||
}
|
||||
return new JetTypeImpl(type.getAnnotations(), type.getConstructor(), nullable, type.getArguments(), type.getMemberScope());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user