diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ControlStructureTypingUtils.java b/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ControlStructureTypingUtils.java index a0aca7746cc..b86ed94ec5a 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ControlStructureTypingUtils.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ControlStructureTypingUtils.java @@ -68,7 +68,7 @@ public class ControlStructureTypingUtils { @Nullable MutableDataFlowInfoForArguments dataFlowInfoForArguments ) { SimpleFunctionDescriptorImpl function = createFunctionDescriptorForSpecialConstruction( - "", argumentNames, isArgumentNullable); + constructionName.toUpperCase(), argumentNames, isArgumentNullable); JetReferenceExpression reference = JetPsiFactory.createSimpleName( context.expressionTypingServices.getProject(), "fake" + constructionName + "Call"); TracingStrategy tracing = createTracingForSpecialConstruction(call, constructionName); @@ -81,21 +81,21 @@ public class ControlStructureTypingUtils { } private static SimpleFunctionDescriptorImpl createFunctionDescriptorForSpecialConstruction( - @NotNull String name, + @NotNull String constructionName, @NotNull List argumentNames, @NotNull List isArgumentNullable ) { assert argumentNames.size() == isArgumentNullable.size(); List noAnnotations = Collections.emptyList(); - Name specialFunctionName = Name.identifierNoValidate(name); + Name specialFunctionName = Name.identifierNoValidate(""); SimpleFunctionDescriptorImpl function = new SimpleFunctionDescriptorImpl( ErrorUtils.getErrorModule(),//todo hack to avoid returning true in 'isError(DeclarationDescriptor)' noAnnotations, specialFunctionName, CallableMemberDescriptor.Kind.DECLARATION); TypeParameterDescriptor typeParameter = TypeParameterDescriptorImpl.createWithDefaultBound( - function, noAnnotations, false, Variance.INVARIANT, Name.identifier("T"), 0); + function, noAnnotations, false, Variance.INVARIANT, Name.identifierNoValidate(""), 0); JetType type = new JetTypeImpl(typeParameter.getTypeConstructor(), JetScope.EMPTY); JetType nullableType = new JetTypeImpl( @@ -338,7 +338,7 @@ public class ControlStructureTypingUtils { if (constraintSystem.hasErrorInConstrainingTypes()) { return; } - if (constraintSystem.hasOnlyExpectedTypeMismatch()) { + if (constraintSystem.hasOnlyExpectedTypeMismatch() || constraintSystem.hasConflictingConstraints()) { JetExpression expression = call.getCalleeExpression(); if (expression != null) { expression.accept(checkTypeVisitor, new CheckTypeContext(trace, data.expectedType));