{"record":{"id":"27df831ca446875e","repo":"facebook/flow","slug":"skipping-arrow-function","errorCode":null,"errorMessage":"Skipping_arrow_function","messagePattern":"Skipping_arrow_function","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"rust_port/crates/flow_codemods/src/annotate_exports.rs","lineNumber":977,"sourceCode":"                    match &inner.annot {\n                        types::AnnotationOrHint::Missing(ploc) => Some(ploc),\n                        _ => None,\n                    }\n                }\n                _ => None,\n            }\n        } else {\n            None\n        };\n        let rloc = match &expr.return_ {\n            ast::function::ReturnAnnot::Missing(rloc) => Some(rloc),\n            _ => None,\n        };\n        match (ploc, rloc) {\n            (Some(ploc), Some(rloc)) if ploc == rloc => {\n                if self.sig_verification_loc_tys.contains_key(rloc) {\n                    self.mapper.wont_annotate_locs.insert(rloc.clone());\n                    self.mapper.acc.warn(\n                        loc,\n                        &flow_services_code_action::insert_type_utils::warning::Kind::SkippingArrowFunction,\n                    );\n                }\n                expr.clone()\n            }\n            _ => self.map_function_(loc, expr),\n        }\n    }\n\n    fn map_program(&mut self, prog: &'ast ast::Program<Loc, Loc>) -> ast::Program<Loc, Loc> {\n        let (total_errors_, sig_verification_loc_tys_) =\n            signature_verification::collect_annotations(\n                self.cctx,\n                self.default_any,\n                self.max_type_size,\n                prog,\n            );","sourceCodeStart":959,"sourceCodeEnd":995,"githubUrl":"https://github.com/facebook/flow/blob/f88ac94bcf6992f5d5a158854d94613ebb92c6e6/rust_port/crates/flow_codemods/src/annotate_exports.rs#L959-L995","documentation":"This is not a panic but a user-facing warning kind (Kind::SkippingArrowFunction) emitted by the annotate-exports codemod. In map_arrow_function (rust_port/crates/flow_codemods/src/annotate_exports.rs:945-985), when a single-parameter arrow function has both its parameter annotation and return annotation missing at the same loc, and that loc is tracked in sig_verification_loc_tys (types recovered from signature verification rather than local inference), the codemod declines to write an annotation: it records the loc in wont_annotate_locs, warns, and returns the function unchanged instead of mapping it via map_function_.","triggerScenarios":"Running annotate-exports over code containing a single-param arrow like (x) => f(x) with no annotations, where the shared loc's type came from signature verification (e.g. libdef or signature-checked types) rather than local inference. Multi-param arrows, arrows with any annotation, or locs not in sig_verification_loc_tys go through map_function_ and are annotated normally.","commonSituations":"Codemodding modules whose types are pinned by libdefs or cross-module signature checks; exported arrow callbacks that engineers expected to gain types; batch codemod runs where these locs show up as 'not annotated' in the summary.","solutions":["Treat the warning as advisory: annotate the arrow function manually so the param/return locs no longer coincide","Give the arrow more than one parameter, a rest param, or any annotation so it routes through map_function_ instead of the skip branch","Re-run inference/codemod once the signature-verified types resolve locally so the loc leaves sig_verification_loc_tys","If you build tooling over the codemod, collect SkippingArrowFunction warnings and present the locs to users as a 'not annotated' list"],"exampleFix":"// before: skipped with a SkippingArrowFunction warning\nexport const apply = (x) => transform(x);\n\n// after: explicit annotations let the codemod and readers proceed\nexport const apply = (x: Input): Output => transform(x);","handlingStrategy":"fallback","validationCode":null,"typeGuard":"// Detect the skipped shape before running the codemod (single missing annot loc shared by param and return)\nfn arrow_will_be_skipped(f: &ast::function::Function<Loc, Loc>, sig_locs: &HashMap<Loc, Type>) -> bool {\n    let ploc = single_missing_param_annot_loc(f);\n    let rloc = missing_return_annot_loc(f);\n    matches!((ploc, rloc), (Some(p), Some(r)) if p == r && sig_locs.contains_key(&r))\n}","tryCatchPattern":null,"preventionTips":["Write exported arrows with explicit param or return annotations so locs never coincide","Review SkippingArrowFunction warnings after each annotate-exports run and annotate those locs manually","Do not treat the warning as failure — the codemod intentionally leaves such functions untouched"],"tags":["codemod","annotate-exports","arrow-function","warning","skipped-annotation"],"backgroundTag":"codemod-skip-warning","analyzedSha":"f88ac94bcf6992f5d5a158854d94613ebb92c6e6","analyzedAt":"2026-08-20T10:41:37.992Z","contentChangedAt":"2026-08-20T10:41:37.992Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}