Propagate resolution results without ambiguity to constant evaluator

This allows to get rid of useless diagnostics that some value is not a constant
This commit is contained in:
Mikhail Zarechenskiy
2017-03-21 01:28:59 +03:00
parent e49b2811ec
commit 859bccb9fc
5 changed files with 15 additions and 15 deletions
@@ -1804,15 +1804,15 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
}
Call call = CallMaker.makeCallForCollectionLiteral(collectionLiteralExpression);
OverloadResolutionResults<FunctionDescriptor> functionResults = components.callResolver.resolveCallWithGivenName(
OverloadResolutionResults<FunctionDescriptor> resolutionResults = components.callResolver.resolveCallWithGivenName(
context, call, collectionLiteralExpression, collectionLiteralCallName);
if (!functionResults.isSuccess() || !functionResults.isSingleResult()) {
// TODO: report an error
// TODO: check that resolved function is from package `kotlin`, otherwise report an error
if (!resolutionResults.isSingleResult()) {
return TypeInfoFactoryKt.noTypeInfo(context);
}
context.trace.record(COLLECTION_LITERAL_CALL, collectionLiteralExpression, functionResults.getResultingCall());
return TypeInfoFactoryKt.createTypeInfo(functionResults.getResultingDescriptor().getReturnType(), context);
context.trace.record(COLLECTION_LITERAL_CALL, collectionLiteralExpression, resolutionResults.getResultingCall());
return TypeInfoFactoryKt.createTypeInfo(resolutionResults.getResultingDescriptor().getReturnType(), context);
}
}