fix attempt to create JetTypeImpl with ErrorScope

ErrorScope is created here if any typeParameterDescriptor upper bounds scope is ErrorScope
This commit is contained in:
Stepan Koltsov
2012-01-25 21:28:46 +04:00
parent f6019018d1
commit 3a09f69f9b
@@ -80,13 +80,18 @@ public class TypeResolver {
trace.record(BindingContext.REFERENCE_TARGET, referenceExpression, typeParameterDescriptor); trace.record(BindingContext.REFERENCE_TARGET, referenceExpression, typeParameterDescriptor);
JetScope scopeForTypeParameter = getScopeForTypeParameter(typeParameterDescriptor);
if (scopeForTypeParameter instanceof ErrorUtils.ErrorScope) {
result[0] = ErrorUtils.createErrorType("?");
} else {
result[0] = new JetTypeImpl( result[0] = new JetTypeImpl(
annotations, annotations,
typeParameterDescriptor.getTypeConstructor(), typeParameterDescriptor.getTypeConstructor(),
nullable || TypeUtils.hasNullableLowerBound(typeParameterDescriptor), nullable || TypeUtils.hasNullableLowerBound(typeParameterDescriptor),
Collections.<TypeProjection>emptyList(), Collections.<TypeProjection>emptyList(),
getScopeForTypeParameter(typeParameterDescriptor) scopeForTypeParameter
); );
}
resolveTypeProjections(scope, ErrorUtils.createErrorType("No type").getConstructor(), type.getTypeArguments()); resolveTypeProjections(scope, ErrorUtils.createErrorType("No type").getConstructor(), type.getTypeArguments());
} }