Skip to content

Commit

Permalink
add TODO comment about union-of-all-defs
Browse files Browse the repository at this point in the history
  • Loading branch information
carljm committed Jun 1, 2024
1 parent b01cbe3 commit 18a64d8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions crates/red_knot/src/types/infer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ pub fn infer_symbol_public_type(db: &dyn SemanticDb, symbol: GlobalSymbolId) ->
return Ok(ty);
}

// The public type of a symbol is the union of all of its definitions. This is the most
// cautious/sound approach, though it can lead to a broader-than-desired type in a case like
// `x = 1; x = str(x)`, where the first definition of `x` can never be visible. TODO prune
// definitions that we can prove can't be visible.
let tys = defs
.iter()
.map(|def| infer_definition_type(db, symbol, def.clone()))
Expand Down

0 comments on commit 18a64d8

Please sign in to comment.