aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authora-romanov <Anton.Romanov@ydb.tech>2023-07-22 10:41:10 +0300
committera-romanov <Anton.Romanov@ydb.tech>2023-07-22 10:41:10 +0300
commite9f0ae38ec1b4d0d25fb84a5e40430561075ddcb (patch)
tree792bb083d9516e8c2e08dd99dc65ee5b55beb7ae
parent7ecf6c16ab762d4ed40a90ea329eebeb1b8cbca0 (diff)
downloadydb-e9f0ae38ec1b4d0d25fb84a5e40430561075ddcb.tar.gz
YQL-13180 Fix ListFromRange type ann.
-rw-r--r--ydb/library/yql/core/type_ann/type_ann_list.cpp31
1 files changed, 9 insertions, 22 deletions
diff --git a/ydb/library/yql/core/type_ann/type_ann_list.cpp b/ydb/library/yql/core/type_ann/type_ann_list.cpp
index 63f0e6cf09..a80439da5f 100644
--- a/ydb/library/yql/core/type_ann/type_ann_list.cpp
+++ b/ydb/library/yql/core/type_ann/type_ann_list.cpp
@@ -2086,21 +2086,12 @@ namespace {
{
return IGraphTransformer::TStatus::Error;
}
- const TTypeAnnotationNode* commonType = nullptr;
- const auto status = SilentInferCommonType(input->ChildRef(idx1), input->ChildRef(idx2),
- ctx.Expr, commonType);
+ auto commonType = CommonType<false>(input->Pos(), input->Child(idx1)->GetTypeAnn(), input->Child(idx2)->GetTypeAnn(), ctx.Expr);
+ if (!commonType)
+ return IGraphTransformer::TStatus::Error;
if (ETypeAnnotationKind::Optional == commonType->GetKind()) {
commonType = commonType->Cast<TOptionalExprType>()->GetItemType();
}
- if (IGraphTransformer::TStatus::Ok != status) {
- if (IGraphTransformer::TStatus::Error == status) {
- ctx.Expr.AddError(TIssue(ctx.Expr.GetPosition(input->Pos()),
- TStringBuilder() << "Uncompatible types: " <<
- *input->Child(idx1)->GetTypeAnn() << " and "<<
- *input->Child(idx2)->GetTypeAnn()));
- }
- return status;
- }
output = ctx.Expr.Builder(input->Pos())
.Callable("Nothing")
.Callable(0U, "OptionalType")
@@ -2150,17 +2141,13 @@ namespace {
return status;
}
} else {
- const auto status = SilentInferCommonType(input->ChildRef(0U), input->ChildRef(1U),
- ctx.Expr, commonType);
- if (IGraphTransformer::TStatus::Ok != status) {
- if (IGraphTransformer::TStatus::Error == status) {
- ctx.Expr.AddError(TIssue(ctx.Expr.GetPosition(input->Pos()),
- TStringBuilder() << "Uncompatible types of bounds " <<
- *input->Child(0U)->GetTypeAnn() << " and " <<
- *input->Child(1U)->GetTypeAnn()));
- }
+ commonType = CommonType<false>(input->Pos(), input->Child(0U)->GetTypeAnn(), input->Child(1U)->GetTypeAnn(), ctx.Expr);
+ if (!commonType)
+ return IGraphTransformer::TStatus::Error;
+
+ if (const auto status = TryConvertTo(input->ChildRef(0U), *commonType, ctx.Expr).Combine(TryConvertTo(input->ChildRef(1U), *commonType, ctx.Expr)); status != IGraphTransformer::TStatus::Ok)
return status;
- }
+
if (stepIsOpt && ETypeAnnotationKind::Optional != commonType->GetKind()) {
commonType = ctx.Expr.MakeType<TOptionalExprType>(commonType);
}