Skip to content

Conversation

@asukaminato0721
Copy link
Contributor

fix #1254

Added a suppression stack so binding code can execute unreachable branches without emitting type errors and exposed a helper to gate this behavior to filesystem/memory modules only, skipping builtins/__builtins__.

Updated the if binding logic to analyze statically false branches only when the new gate allows it, then discard their flow so control-flow facts stay unchanged while IDE features (like go-to-def) gain the needed Keys.

@meta-cla meta-cla bot added the cla signed label Nov 7, 2025
Comment on lines +1421 to +1553
/// Synthesize a static definition entry for `name` in the current scope if it
/// is missing. This is used when we deliberately analyze unreachable code for
/// IDE metadata; those code paths may not have been included in the up-front
/// static scan, so we add a lightweight placeholder on demand.
pub fn add_synthetic_definition(&mut self, name: &Name, range: TextRange) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels a bit complicated to me. I wonder if a better alternative would be to just keep all defs in the very beginning when they are calculated, recording their unreachable status so downstream type checking logic would avoid emitting type errors for those instead.

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.

Go-to-def fails on unreachable branches

3 participants