@@ -65,6 +65,7 @@ let rec validate_pattern env (p : Ast.expression) =
65
65
| Exact ->
66
66
validate_pattern env a.key && validate_pattern env a.value
67
67
| _ ->
68
+ L. debug Capture Verbose " Invalid map association kind (not :=) in pattern@." ;
68
69
false
69
70
in
70
71
is_none map && List. for_all ~f: validate_assoc updates
@@ -99,11 +100,12 @@ let validate_patterns env = List.for_all ~f:(validate_pattern env)
99
100
100
101
(* * Guards are expressions in general, but with restrictions and constraints. *)
101
102
102
- let is_atom (e : Ast.expression ) =
103
+ let validate_guard_call_func (e : Ast.expression ) =
103
104
match e.simple_expression with
104
105
| Literal lit -> (
105
106
match lit with Atom _ -> true | _ -> false )
106
107
| _ ->
108
+ L. debug Capture Verbose " Function in guard is not an atom@." ;
107
109
false
108
110
109
111
@@ -114,8 +116,14 @@ let validate_guard_call_module (eo : Ast.expression option) =
114
116
| Some e -> (
115
117
match e.simple_expression with
116
118
| Literal lit -> (
117
- match lit with Atom "erlang" -> true | _ -> false )
119
+ match lit with
120
+ | Atom "erlang" ->
121
+ true
122
+ | _ ->
123
+ L. debug Capture Verbose " Non-erlang module in call in a guard@." ;
124
+ false )
118
125
| _ ->
126
+ L. debug Capture Verbose " Non-atom module in call in a guard@." ;
119
127
false )
120
128
121
129
@@ -128,7 +136,7 @@ let rec validate_guard_test env (gt : Ast.expression) =
128
136
List. for_all ~f: (validate_elem env) elems
129
137
| Call {module_; function_; args} ->
130
138
validate_guard_call_module module_
131
- && is_atom function_
139
+ && validate_guard_call_func function_
132
140
&& List. for_all ~f: (validate_guard_test env) args
133
141
| Cons {head; tail} ->
134
142
validate_guard_test env head && validate_guard_test env tail
@@ -141,6 +149,7 @@ let rec validate_guard_test env (gt : Ast.expression) =
141
149
| Arrow ->
142
150
validate_guard_test env a.key && validate_guard_test env a.value
143
151
| _ ->
152
+ L. debug Capture Verbose " Invalid map association kind (not =>) in map create@." ;
144
153
false
145
154
in
146
155
(* Map update accepts '=>' and ':=' *)
@@ -220,6 +229,7 @@ let rec validate_expr env (expr : Ast.expression) =
220
229
| Arrow ->
221
230
validate_expr env a.key && validate_expr env a.value
222
231
| _ ->
232
+ L. debug Capture Verbose " Invalid map association kind (not =>) in map create@." ;
223
233
false
224
234
in
225
235
(* Map update accepts '=>' and ':=' *)
0 commit comments