better error diagnostics

This commit is contained in:
Stepan Koltsov
2011-12-01 18:16:15 +04:00
parent 52c1e9a950
commit e3cf374f31
2 changed files with 10 additions and 0 deletions
@@ -343,6 +343,11 @@ public class TypeUtils {
private static void fillInDeepSubstitutor(@NotNull JetType context, @NotNull TypeSubstitutor substitutor, @NotNull Map<TypeConstructor, TypeProjection> substitution, @Nullable Multimap<TypeConstructor, TypeProjection> fullSubstitution) {
List<TypeParameterDescriptor> parameters = context.getConstructor().getParameters();
List<TypeProjection> arguments = context.getArguments();
if (parameters.size() != arguments.size()) {
throw new IllegalStateException();
}
for (int i = 0; i < arguments.size(); i++) {
TypeProjection argument = arguments.get(i);
TypeParameterDescriptor typeParameterDescriptor = parameters.get(i);
@@ -266,6 +266,11 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
return false;
}
// do not crash on error types
if (ErrorUtils.isErrorType(actualType) || ErrorUtils.isErrorType(targetType)) {
return false;
}
{
Multimap<TypeConstructor, TypeProjection> typeSubstitutionMap =
TypeUtils.buildDeepSubstitutionMultimap(targetType);