Skip to content

Commit

Permalink
[flow] relax recursively_resolvable check
Browse files Browse the repository at this point in the history
Summary:
In upcoming changes we will be attaching hints to identifiers to help determine whether we need to generalize types or not (see D66659579 for definitions).

This change would cause some new [definition-cycle] and [recursive-definition] errors, due to `recursively_resolvable` considering, since expression when `chain` is `true` as non-resolvable.

I can't think of a reason why this should be the case, so this diff changes `recursively_resolvable` on `ExpressionDef` to descend into expressions even if there is a hint and when `chain` is `true`. The latter is typically the case when we have a `Member` expression. `expression_resolvable` handles the case of `Member`, so this should also be okay.

Changelog: [internal]

Reviewed By: SamChou19815

Differential Revision: D69557697

fbshipit-source-id: 3853e611240c6d63a0d6701f0f116a09e1c2b8c5
  • Loading branch information
panagosg7 authored and facebook-github-bot committed Mar 5, 2025
1 parent a2c50b2 commit 972b44a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/analysis/env_builder/name_def_ordering.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1244,7 +1244,8 @@ struct
in
function
| Binding bind -> bind_loop bind
| ExpressionDef { hints = []; expr; chain = false; _ } -> expression_resolvable expr
| ExpressionDef { hints = []; expr; chain = _; cond_context = _ } ->
expression_resolvable expr
| GeneratorNext _
| TypeAlias _
| OpaqueType _
Expand Down

0 comments on commit 972b44a

Please sign in to comment.