changed type parameter name to special
when resolve special construction as a call
This commit is contained in:
+5
-5
@@ -68,7 +68,7 @@ public class ControlStructureTypingUtils {
|
|||||||
@Nullable MutableDataFlowInfoForArguments dataFlowInfoForArguments
|
@Nullable MutableDataFlowInfoForArguments dataFlowInfoForArguments
|
||||||
) {
|
) {
|
||||||
SimpleFunctionDescriptorImpl function = createFunctionDescriptorForSpecialConstruction(
|
SimpleFunctionDescriptorImpl function = createFunctionDescriptorForSpecialConstruction(
|
||||||
"<SPECIAL-FUNCTION-FOR-" + constructionName.toUpperCase() + "-RESOLVE>", argumentNames, isArgumentNullable);
|
constructionName.toUpperCase(), argumentNames, isArgumentNullable);
|
||||||
JetReferenceExpression reference = JetPsiFactory.createSimpleName(
|
JetReferenceExpression reference = JetPsiFactory.createSimpleName(
|
||||||
context.expressionTypingServices.getProject(), "fake" + constructionName + "Call");
|
context.expressionTypingServices.getProject(), "fake" + constructionName + "Call");
|
||||||
TracingStrategy tracing = createTracingForSpecialConstruction(call, constructionName);
|
TracingStrategy tracing = createTracingForSpecialConstruction(call, constructionName);
|
||||||
@@ -81,21 +81,21 @@ public class ControlStructureTypingUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static SimpleFunctionDescriptorImpl createFunctionDescriptorForSpecialConstruction(
|
private static SimpleFunctionDescriptorImpl createFunctionDescriptorForSpecialConstruction(
|
||||||
@NotNull String name,
|
@NotNull String constructionName,
|
||||||
@NotNull List<String> argumentNames,
|
@NotNull List<String> argumentNames,
|
||||||
@NotNull List<Boolean> isArgumentNullable
|
@NotNull List<Boolean> isArgumentNullable
|
||||||
) {
|
) {
|
||||||
assert argumentNames.size() == isArgumentNullable.size();
|
assert argumentNames.size() == isArgumentNullable.size();
|
||||||
|
|
||||||
List<AnnotationDescriptor> noAnnotations = Collections.emptyList();
|
List<AnnotationDescriptor> noAnnotations = Collections.emptyList();
|
||||||
Name specialFunctionName = Name.identifierNoValidate(name);
|
Name specialFunctionName = Name.identifierNoValidate("<SPECIAL-FUNCTION-FOR-" + constructionName + "-RESOLVE>");
|
||||||
|
|
||||||
SimpleFunctionDescriptorImpl function = new SimpleFunctionDescriptorImpl(
|
SimpleFunctionDescriptorImpl function = new SimpleFunctionDescriptorImpl(
|
||||||
ErrorUtils.getErrorModule(),//todo hack to avoid returning true in 'isError(DeclarationDescriptor)'
|
ErrorUtils.getErrorModule(),//todo hack to avoid returning true in 'isError(DeclarationDescriptor)'
|
||||||
noAnnotations, specialFunctionName, CallableMemberDescriptor.Kind.DECLARATION);
|
noAnnotations, specialFunctionName, CallableMemberDescriptor.Kind.DECLARATION);
|
||||||
|
|
||||||
TypeParameterDescriptor typeParameter = TypeParameterDescriptorImpl.createWithDefaultBound(
|
TypeParameterDescriptor typeParameter = TypeParameterDescriptorImpl.createWithDefaultBound(
|
||||||
function, noAnnotations, false, Variance.INVARIANT, Name.identifier("T"), 0);
|
function, noAnnotations, false, Variance.INVARIANT, Name.identifierNoValidate("<TYPE-PARAMETER-FOR-" + constructionName + "-RESOLVE>"), 0);
|
||||||
|
|
||||||
JetType type = new JetTypeImpl(typeParameter.getTypeConstructor(), JetScope.EMPTY);
|
JetType type = new JetTypeImpl(typeParameter.getTypeConstructor(), JetScope.EMPTY);
|
||||||
JetType nullableType = new JetTypeImpl(
|
JetType nullableType = new JetTypeImpl(
|
||||||
@@ -338,7 +338,7 @@ public class ControlStructureTypingUtils {
|
|||||||
if (constraintSystem.hasErrorInConstrainingTypes()) {
|
if (constraintSystem.hasErrorInConstrainingTypes()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (constraintSystem.hasOnlyExpectedTypeMismatch()) {
|
if (constraintSystem.hasOnlyExpectedTypeMismatch() || constraintSystem.hasConflictingConstraints()) {
|
||||||
JetExpression expression = call.getCalleeExpression();
|
JetExpression expression = call.getCalleeExpression();
|
||||||
if (expression != null) {
|
if (expression != null) {
|
||||||
expression.accept(checkTypeVisitor, new CheckTypeContext(trace, data.expectedType));
|
expression.accept(checkTypeVisitor, new CheckTypeContext(trace, data.expectedType));
|
||||||
|
|||||||
Reference in New Issue
Block a user