FE: Fix null assertion error when left is CollectionLiteral
#KT-49961 fixed
This commit is contained in:
committed by
Victor Petukhov
parent
bd299ed12c
commit
eb1d7110ec
@@ -224,6 +224,10 @@ public class ArgumentTypeResolver {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean isCollectionLiteralArgument(@NotNull KtExpression expression) {
|
||||
return expression instanceof KtCollectionLiteralExpression;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public KotlinTypeInfo getArgumentTypeInfo(
|
||||
@Nullable KtExpression expression,
|
||||
|
||||
+2
-1
@@ -1303,7 +1303,8 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
|
||||
KotlinTypeInfo leftTypeInfo = BindingContextUtils.getRecordedTypeInfo(left, context.trace.getBindingContext());
|
||||
boolean isLeftFunctionLiteral = ArgumentTypeResolver.isFunctionLiteralArgument(left, context);
|
||||
boolean isLeftCallableReference = ArgumentTypeResolver.isCallableReferenceArgument(left, context);
|
||||
if (leftTypeInfo == null && (isLeftFunctionLiteral || isLeftCallableReference)) {
|
||||
boolean isLeftCollectionLiteral = ArgumentTypeResolver.isCollectionLiteralArgument(left);
|
||||
if (leftTypeInfo == null && (isLeftFunctionLiteral || isLeftCallableReference || isLeftCollectionLiteral)) {
|
||||
return TypeInfoFactoryKt.noTypeInfo(context);
|
||||
}
|
||||
assert leftTypeInfo != null : "Left expression was not processed: " + expression;
|
||||
|
||||
Reference in New Issue
Block a user