From b9f4f09e971c5ad9a6de0bc1e5387ddaf2e0ca51 Mon Sep 17 00:00:00 2001 From: pkurc Date: Wed, 14 Oct 2026 13:29:52 +0200 Subject: [PATCH] fix(validation): tie closure lifetimes to `Semantic` `Semantic` is invariant over its lifetime when oxc_semantic's `jsdoc` feature is on, so the closures in `is_api_reference` must take expressions of the same lifetime as `semantic`. --- crates/oxc_angular_compiler/src/validation.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/crates/oxc_angular_compiler/src/validation.rs b/crates/oxc_angular_compiler/src/validation.rs index ae4e25b5c..1989779d6 100644 --- a/crates/oxc_angular_compiler/src/validation.rs +++ b/crates/oxc_angular_compiler/src/validation.rs @@ -115,15 +115,19 @@ fn namespace_import_of<'a>( /// in `ns.f.required`) only when `ns` resolves to a namespace import of the /// module. Any other binding — a parameter, a local, an unrelated import — /// means the call isn't one of the API's. -fn is_api_reference(callee: &Expression<'_>, api: InitializerApi, semantic: &Semantic<'_>) -> bool { +fn is_api_reference<'a>( + callee: &Expression<'a>, + api: InitializerApi, + semantic: &Semantic<'a>, +) -> bool { // `f` — its binding must be the import. - let named = |expr: &Expression<'_>| { + let named = |expr: &Expression<'a>| { let Expression::Identifier(id) = expr else { return false }; direct_import_of(id, semantic) .is_some_and(|(module, name)| module == api.1 && name == api.0) }; // `ns.f` — `ns` must be a namespace import of the module. - let namespaced = |expr: &Expression<'_>| { + let namespaced = |expr: &Expression<'a>| { let Expression::StaticMemberExpression(member) = expr else { return false }; let Expression::Identifier(ns) = &member.object else { return false }; member.property.name == api.0 && namespace_import_of(ns, semantic) == Some(api.1)