Skip to content

Commit cb40add

Browse files
authored
Merge pull request #448 from hjotha/submit/qualified-function-call-regression-tests
test: cover qualified function calls with three segments
2 parents 7866c18 + 710eaf9 commit cb40add

2 files changed

Lines changed: 35 additions & 4 deletions

File tree

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
-- ============================================================================
2+
-- Regression: Qualified function calls in microflow expressions
3+
-- ============================================================================
4+
--
5+
-- Symptom:
6+
-- Qualified function/microflow-style calls used as IF conditions failed to
7+
-- parse when the expression callee was not a built-in function name.
8+
--
9+
-- After fix:
10+
-- The expression grammar accepts qualified names as function call targets,
11+
-- including three-segment names emitted by describe for rule-like split
12+
-- conditions.
13+
--
14+
-- Usage:
15+
-- mxcli check mdl-examples/bug-tests/qualified-function-call-expression.mdl
16+
-- ============================================================================
17+
18+
create module SyntheticQualifiedCall;
19+
20+
create microflow SyntheticQualifiedCall.MF_QualifiedCall (
21+
$S: string
22+
)
23+
returns boolean as $Result
24+
begin
25+
if SyntheticRules.Strings.IsNotEmpty(String = $S) then
26+
return true;
27+
else
28+
return false;
29+
end if;
30+
end;
31+
/

mdl/visitor/visitor_qualified_call_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ import (
1515
// failed to parse with `mismatched input '(' expecting THEN`, blocking the
1616
// roundtrip for microflows whose ExclusiveSplit uses a RuleSplitCondition.
1717
func TestQualifiedCallInIfCondition(t *testing.T) {
18-
input := `CREATE OR MODIFY MICROFLOW MxAdmin.Test ($S: String) returns Boolean
18+
input := `CREATE OR MODIFY MICROFLOW SyntheticQualifiedCall.Test ($S: String) returns Boolean
1919
BEGIN
20-
IF ControlCenterCommons.IsNotEmptyString(String = $S) THEN
20+
IF SyntheticRules.Strings.IsNotEmpty(String = $S) THEN
2121
RETURN true;
2222
ELSE
2323
RETURN false;
@@ -45,8 +45,8 @@ END`
4545
if !ok {
4646
t.Fatalf("expected FunctionCallExpr as if-condition, got %T", ifStmt.Condition)
4747
}
48-
if call.Name != "ControlCenterCommons.IsNotEmptyString" {
49-
t.Errorf("call name = %q, want %q", call.Name, "ControlCenterCommons.IsNotEmptyString")
48+
if call.Name != "SyntheticRules.Strings.IsNotEmpty" {
49+
t.Errorf("call name = %q, want %q", call.Name, "SyntheticRules.Strings.IsNotEmpty")
5050
}
5151
if len(call.Arguments) != 1 {
5252
t.Fatalf("expected 1 argument, got %d", len(call.Arguments))

0 commit comments

Comments
 (0)