Skip to content

Commit a433fe2

Browse files
committed
Diagnose unsupported hoisted function patterns
Signed-off-by: Christoph Knittel <ck@cca.io>
1 parent 3c50e90 commit a433fe2

3 files changed

Lines changed: 17 additions & 1 deletion

File tree

‎compiler/ml/translcore.ml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,9 @@ let mark_js_hoisted_pattern ~allow_js_hoist attrs pat lam =
619619
else
620620
Location.prerr_warning loc
621621
(Warnings.Misplaced_attribute hoisted_function_attr_name)
622-
| _ -> ())
622+
| _ ->
623+
Location.prerr_warning loc
624+
(Warnings.Misplaced_attribute hoisted_function_attr_name))
623625
| _ ->
624626
Location.prerr_warning loc
625627
(Warnings.Misplaced_attribute hoisted_function_attr_name))
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
Warning number 53
3+
/.../fixtures/hoisted_function_unsupported_pattern.res:2:3-22
4+
5+
1 │ module Nested = {
6+
2 │ @res.hoistedFunction
7+
3 │ let f as g = () => "ok"
8+
4 │ }
9+
10+
the @res.hoistedFunction attribute cannot appear in this context
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module Nested = {
2+
@res.hoistedFunction
3+
let f as g = () => "ok"
4+
}

0 commit comments

Comments
 (0)