@@ -239714,26 +239714,41 @@ let rec moduleTypeCheckAnnotation ~checkAnnotation
239714239714 ->
239715239715 false
239716239716
239717+ and moduleTypeDeclarationCheckAnnotation ~checkAnnotation
239718+ ({ mtd_type; mtd_attributes; mtd_loc = loc } :
239719+ Typedtree.module_type_declaration) =
239720+ mtd_attributes |> checkAnnotation ~loc
239721+ ||
239722+ match mtd_type with
239723+ | None -> false
239724+ | Some module_type ->
239725+ module_type |> moduleTypeCheckAnnotation ~checkAnnotation
239726+
239717239727and moduleDeclarationCheckAnnotation ~checkAnnotation
239718239728 ({ md_attributes; md_type; md_loc = loc } : Typedtree.module_declaration) =
239719239729 md_attributes |> checkAnnotation ~loc
239720239730 || md_type |> moduleTypeCheckAnnotation ~checkAnnotation
239721239731
239722239732and signatureItemCheckAnnotation ~checkAnnotation
239723239733 (signatureItem : Typedtree.signature_item) =
239724- match signatureItem with
239725- | { Typedtree.sig_desc = Typedtree. Tsig_type (_, typeDeclarations) } ->
239734+ match signatureItem.sig_desc with
239735+ | Tsig_type (_, typeDeclarations) ->
239726239736 typeDeclarations
239727239737 |> List.exists
239728239738 (fun ({ typ_attributes; typ_loc = loc } : Typedtree.type_declaration)
239729239739 -> typ_attributes |> checkAnnotation ~loc)
239730- | { sig_desc = Tsig_value { val_attributes; val_loc = loc } } ->
239740+ | Tsig_value { val_attributes; val_loc = loc } ->
239731239741 val_attributes |> checkAnnotation ~loc
239732- | { sig_desc = Tsig_module moduleDeclaration } ->
239742+ | Tsig_module moduleDeclaration ->
239733239743 moduleDeclaration |> moduleDeclarationCheckAnnotation ~checkAnnotation
239734- | { sig_desc = Tsig_attribute attribute; sig_loc = loc } ->
239735- [ attribute ] |> checkAnnotation ~loc
239736- | _ -> false
239744+ | Tsig_attribute attribute ->
239745+ [ attribute ] |> checkAnnotation ~loc:signatureItem.sig_loc
239746+ | Tsig_modtype moduleTypeDeclaration ->
239747+ moduleTypeDeclaration
239748+ |> moduleTypeDeclarationCheckAnnotation ~checkAnnotation
239749+ | Tsig_typext _ | Tsig_exception _ | Tsig_recmodule _ | Tsig_open _
239750+ | Tsig_include _ | Tsig_class _ | Tsig_class_type _ ->
239751+ false
239737239752
239738239753and signatureCheckAnnotation ~checkAnnotation (signature : Typedtree.signature)
239739239754 =
@@ -239742,28 +239757,35 @@ and signatureCheckAnnotation ~checkAnnotation (signature : Typedtree.signature)
239742239757
239743239758let rec structureItemCheckAnnotation ~checkAnnotation
239744239759 (structureItem : Typedtree.structure_item) =
239745- match structureItem with
239746- | { Typedtree.str_desc = Typedtree. Tstr_type (_, typeDeclarations) } ->
239760+ match structureItem.str_desc with
239761+ | Tstr_type (_, typeDeclarations) ->
239747239762 typeDeclarations
239748239763 |> List.exists
239749239764 (fun ({ typ_attributes; typ_loc = loc } : Typedtree.type_declaration)
239750239765 -> typ_attributes |> checkAnnotation ~loc)
239751- | { str_desc = Tstr_value (_loc, valueBindings) } ->
239766+ | Tstr_value (_loc, valueBindings) ->
239752239767 valueBindings
239753239768 |> List.exists
239754239769 (fun ({ vb_attributes; vb_loc = loc } : Typedtree.value_binding) ->
239755239770 vb_attributes |> checkAnnotation ~loc)
239756- | { str_desc = Tstr_primitive { val_attributes; val_loc = loc } } ->
239771+ | Tstr_primitive { val_attributes; val_loc = loc } ->
239757239772 val_attributes |> checkAnnotation ~loc
239758- | { str_desc = Tstr_module moduleBinding } ->
239773+ | Tstr_module moduleBinding ->
239759239774 moduleBinding |> moduleBindingCheckAnnotation ~checkAnnotation
239760- | { str_desc = Tstr_recmodule moduleBindings } ->
239775+ | Tstr_recmodule moduleBindings ->
239761239776 moduleBindings
239762239777 |> List.exists (moduleBindingCheckAnnotation ~checkAnnotation)
239763- | { str_desc = Tstr_include { incl_attributes; incl_mod; incl_loc = loc } } ->
239778+ | Tstr_include { incl_attributes; incl_mod; incl_loc = loc } ->
239764239779 incl_attributes |> checkAnnotation ~loc
239765239780 || incl_mod |> moduleExprCheckAnnotation ~checkAnnotation
239766- | _ -> false
239781+ | Tstr_modtype moduleTypeDeclaration ->
239782+ moduleTypeDeclaration
239783+ |> moduleTypeDeclarationCheckAnnotation ~checkAnnotation
239784+ | Tstr_attribute attribute ->
239785+ [ attribute ] |> checkAnnotation ~loc:structureItem.str_loc
239786+ | Tstr_eval _ | Tstr_typext _ | Tstr_exception _ | Tstr_open _ | Tstr_class _
239787+ | Tstr_class_type _ ->
239788+ false
239767239789
239768239790and moduleExprCheckAnnotation ~checkAnnotation
239769239791 (moduleExpr : Typedtree.module_expr) =
0 commit comments