|
@@ -147,24 +147,6 @@ MatchRecognizePatternWrapper(const TExprNode::TPtr& input, TExprNode::TPtr& outp
|
|
|
return IGraphTransformer::TStatus::Ok;
|
|
|
}
|
|
|
|
|
|
-namespace {
|
|
|
-
|
|
|
-bool IsBoolLikeType(const TTypeAnnotationNode* node) {
|
|
|
- switch (node->GetKind()) {
|
|
|
- case ETypeAnnotationKind::Null:
|
|
|
- return true;
|
|
|
- case ETypeAnnotationKind::Data:
|
|
|
- return node->Cast<TDataExprType>()->GetSlot() == EDataSlot::Bool;
|
|
|
- case ETypeAnnotationKind::Optional: {
|
|
|
- const auto nested = node->Cast<TOptionalExprType>()->GetItemType();
|
|
|
- return (nested->GetKind() == ETypeAnnotationKind::Data) and (nested->Cast<TDataExprType>()->GetSlot() == EDataSlot::Bool);
|
|
|
- }
|
|
|
- default:
|
|
|
- return false;
|
|
|
- }
|
|
|
-}
|
|
|
-} //namespace
|
|
|
-
|
|
|
IGraphTransformer::TStatus
|
|
|
MatchRecognizeDefinesWrapper(const TExprNode::TPtr& input, TExprNode::TPtr& output,
|
|
|
TContext &ctx) {
|
|
@@ -204,7 +186,7 @@ MatchRecognizeDefinesWrapper(const TExprNode::TPtr& input, TExprNode::TPtr& outp
|
|
|
return IGraphTransformer::TStatus::Error;
|
|
|
}
|
|
|
if (auto type = lambda->GetTypeAnn()) {
|
|
|
- if (IsBoolLikeType(type)) {
|
|
|
+ if (IsBoolLike(*type)) {
|
|
|
items.push_back(ctx.Expr.MakeType<TItemExprType>(names->ChildRef(i)->Content(), type));
|
|
|
} else {
|
|
|
ctx.Expr.AddError(TIssue(ctx.Expr.GetPosition(lambda->Pos()), "DEFINE expression must be a predicate"));
|