Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions mdl-examples/bug-tests/qualified-function-call-expression.mdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
-- ============================================================================
-- Regression: Qualified function calls in microflow expressions
-- ============================================================================
--
-- Symptom:
-- Qualified function/microflow-style calls used as IF conditions failed to
-- parse when the expression callee was not a built-in function name.
--
-- After fix:
-- The expression grammar accepts qualified names as function call targets,
-- including three-segment names emitted by describe for rule-like split
-- conditions.
--
-- Usage:
-- mxcli check mdl-examples/bug-tests/qualified-function-call-expression.mdl
-- ============================================================================

create module SyntheticQualifiedCall;

create microflow SyntheticQualifiedCall.MF_QualifiedCall (
$S: string
)
returns boolean as $Result
begin
if SyntheticRules.Strings.IsNotEmpty(String = $S) then
return true;
else
return false;
end if;
end;
/
8 changes: 4 additions & 4 deletions mdl/visitor/visitor_qualified_call_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import (
// failed to parse with `mismatched input '(' expecting THEN`, blocking the
// roundtrip for microflows whose ExclusiveSplit uses a RuleSplitCondition.
func TestQualifiedCallInIfCondition(t *testing.T) {
input := `CREATE OR MODIFY MICROFLOW MxAdmin.Test ($S: String) returns Boolean
input := `CREATE OR MODIFY MICROFLOW SyntheticQualifiedCall.Test ($S: String) returns Boolean
BEGIN
IF ControlCenterCommons.IsNotEmptyString(String = $S) THEN
IF SyntheticRules.Strings.IsNotEmpty(String = $S) THEN
RETURN true;
ELSE
RETURN false;
Expand Down Expand Up @@ -45,8 +45,8 @@ END`
if !ok {
t.Fatalf("expected FunctionCallExpr as if-condition, got %T", ifStmt.Condition)
}
if call.Name != "ControlCenterCommons.IsNotEmptyString" {
t.Errorf("call name = %q, want %q", call.Name, "ControlCenterCommons.IsNotEmptyString")
if call.Name != "SyntheticRules.Strings.IsNotEmpty" {
t.Errorf("call name = %q, want %q", call.Name, "SyntheticRules.Strings.IsNotEmpty")
}
if len(call.Arguments) != 1 {
t.Fatalf("expected 1 argument, got %d", len(call.Arguments))
Expand Down
Loading