Skip to content

Follow re-export chains when checking call safety#8

Open
msullivan wants to merge 1 commit intofacebook:mainfrom
msullivan:re-export
Open

Follow re-export chains when checking call safety#8
msullivan wants to merge 1 commit intofacebook:mainfrom
msullivan:re-export

Conversation

@msullivan
Copy link
Copy Markdown
Contributor

Re-exported symbols (e.g. bar.Foo re-exporting foo.Foo) were not being
resolved to their original definitions during safety analysis. This
caused check_call to miss unsafe constructors/functions accessed through
re-exports, incorrectly marking them as safe.

Make the re_exports more visible to the main analysis, and resolve
them when needed.

I'm not totally happy with this approach, though, because it's would
be easy to miss new places that a reexport needs to be chased down.

I'll do a bit more thinking, but I'd be interested in architectural
suggestions from the team.

@meta-cla meta-cla Bot added the cla signed label Apr 24, 2026
Re-exported symbols (e.g. bar.Foo re-exporting foo.Foo) were not being
resolved to their original definitions during safety analysis. This
caused check_call to miss unsafe constructors/functions accessed through
re-exports, incorrectly marking them as safe.

Change re_exports from a HashSet to a HashMap that preserves the mapping
to original names, add resolve_re_export() that follows chains, and
apply it in check_call and the ImportedTypeAttr property lookup.
@martindemello
Copy link
Copy Markdown
Contributor

it might be possible to do this in the alias/bindings table, since those have access to the global Exports. our handling of name resolution is unfortunately still a bit messy, especially for cross-module aliases like reexports.

meta-codesync Bot pushed a commit that referenced this pull request Apr 28, 2026
Summary:
This is a correctness fix for transitive reexports.
#8 highlighted some issues with the
way we handle these, but only put in the top-level fix to handle function
calls; I'm going through the stack to see where else we should be handling
transitive reexports in the lower-level data structures.

Reviewed By: brittanyrey

Differential Revision: D102414882

fbshipit-source-id: 0a811e2dfa00efbff8f4df58a50983518ac80c7e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants