From 1999af0a342f30fa973f57d63ef9795c74bc8a00 Mon Sep 17 00:00:00 2001 From: Cristiano Calcagno Date: Mon, 16 Dec 2024 08:30:33 +0100 Subject: [PATCH] Remove difference on termination analysis tests. --- analysis/reanalyze/src/Arnold.ml | 2 +- .../termination/expected/termination.txt | 59 ++++++++++++------- 2 files changed, 38 insertions(+), 23 deletions(-) diff --git a/analysis/reanalyze/src/Arnold.ml b/analysis/reanalyze/src/Arnold.ml index f9598cd0dc..e4dd423e2f 100644 --- a/analysis/reanalyze/src/Arnold.ml +++ b/analysis/reanalyze/src/Arnold.ml @@ -545,7 +545,7 @@ module FindFunctionsCalled = struct let findCallees (expression : Typedtree.expression) = let isFunction = match expression.exp_desc with - | Texp_function _ -> true + | Texp_function {arity = None} -> true | _ -> false in let callees = ref StringSet.empty in diff --git a/tests/analysis_tests/tests-reanalyze/termination/expected/termination.txt b/tests/analysis_tests/tests-reanalyze/termination/expected/termination.txt index 5852d6ee99..63e15f8134 100644 --- a/tests/analysis_tests/tests-reanalyze/termination/expected/termination.txt +++ b/tests/analysis_tests/tests-reanalyze/termination/expected/termination.txt @@ -70,16 +70,15 @@ Termination Analysis for butSecondArgumentIsAlwaysEvaluated Function Table - 1 parseExpression: [_ || _]; [+Parser.next; parseExpression; parseExpression; _ || parseInt] - 2 parseInt: [_ || _]; +Parser.next; _ - 3 parseList: parseList$loop - 4 parseList$loop: [_ || f; parseList$loop; _] - 5 parseListExpression: _ - 6 parseListExpression2: parseExpression; parseList - 7 parseListInt: parseList - 8 parseListIntTailRecursive: parseListIntTailRecursive$loop - 9 parseListIntTailRecursive$loop: [_ || parseInt; parseListIntTailRecursive$loop] - 10 parseListListInt: parseList + 1 parseExpression: [_ || _]; [+Parser.next; parseExpression; parseExpression; _ || _] + 2 parseList: parseList$loop + 3 parseList$loop: [_ || f; parseList$loop; _] + 4 parseListExpression: _ + 5 parseListExpression2: parseExpression; parseList + 6 parseListInt: _ + 7 parseListIntTailRecursive: parseListIntTailRecursive$loop + 8 parseListIntTailRecursive$loop: [_ || parseListIntTailRecursive$loop] + 9 parseListListInt: parseList Termination Analysis for parseListInt @@ -112,13 +111,10 @@ Function Table 1 alwaysReturnNone: [+Parser.next; alwaysReturnNone || None] - 2 parseIntO: [+Parser.next; Some || None] - 3 parseIntOWrapper: parseIntO - 4 parseListIntO: parseListO - 5 parseListO: parseListO$loop - 6 parseListO$loop: [+Parser.next; _ || switch f {some: parseListO$loop, none: _}] - 7 testAlwaysReturnNone: alwaysReturnNone - 8 thisMakesNoProgress: None; [_ || +Parser.next; Some] + 2 parseIntOWrapper: _ + 3 parseListIntO: _ + 4 testAlwaysReturnNone: alwaysReturnNone + 5 thisMakesNoProgress: None; [_ || +Parser.next; Some] Termination Analysis for parseListIntO @@ -153,10 +149,10 @@ Termination Analysis Stats Files:1 Recursive Blocks:21 - Functions:49 - Infinite Loops:10 - Hygiene Errors:2 - Cache Hits:7/30 + Functions:45 + Infinite Loops:12 + Hygiene Errors:3 + Cache Hits:4/21 Error Termination @@ -211,6 +207,10 @@ TestCyberTruck.res:217:32-73 Call must have named argument f + Error Hygiene + TestCyberTruck.res:198:29-53 + Named argument f must be passed a recursive function + Error Termination TestCyberTruck.res:180:15-21 Possible infinite loop when calling parseList$loop which is parseList$loop @@ -219,6 +219,21 @@ 2 parseList (TestCyberTruck.res 201) 1 parseListListInt (TestCyberTruck.res 201) + Error Termination + TestCyberTruck.res:180:15-21 + Possible infinite loop when calling parseList$loop which is parseList$loop + CallStack: + 3 parseList$loop (TestCyberTruck.res 183) + 2 parseList (TestCyberTruck.res 220) + 1 parseListExpression2 (TestCyberTruck.res 220) + + Error Termination + TestCyberTruck.res:228:7-38 + Possible infinite loop when calling parseListIntTailRecursive$loop + CallStack: + 2 parseListIntTailRecursive$loop (TestCyberTruck.res 230) + 1 parseListIntTailRecursive (TestCyberTruck.res 223) + Error Termination TestCyberTruck.res:238:31-49 Possible infinite loop when calling loopAfterProgress @@ -231,4 +246,4 @@ CallStack: 1 countRendersCompiled (TestCyberTruck.res 283) - Analysis reported 12 issues (Error Hygiene:2, Error Termination:10) + Analysis reported 15 issues (Error Hygiene:3, Error Termination:12)