From 439ffc1f1594c3277b551de9f116b6b7733c5ded Mon Sep 17 00:00:00 2001 From: David Peter Date: Wed, 1 Oct 2025 16:26:57 +0200 Subject: [PATCH] Review comments --- .../resources/mdtest/import/dunder_all.md | 1 + crates/ty_python_semantic/src/place.rs | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/crates/ty_python_semantic/resources/mdtest/import/dunder_all.md b/crates/ty_python_semantic/resources/mdtest/import/dunder_all.md index 4f80e390bb..2dc3bf4839 100644 --- a/crates/ty_python_semantic/resources/mdtest/import/dunder_all.md +++ b/crates/ty_python_semantic/resources/mdtest/import/dunder_all.md @@ -783,6 +783,7 @@ class A: ... ```py from subexporter import * +# TODO: we could potentially infer `list[str] | tuple[str, ...]` here reveal_type(__all__) # revealed: list[Unknown | str] __all__.append("B") diff --git a/crates/ty_python_semantic/src/place.rs b/crates/ty_python_semantic/src/place.rs index 23f7db0396..bf3388de61 100644 --- a/crates/ty_python_semantic/src/place.rs +++ b/crates/ty_python_semantic/src/place.rs @@ -829,11 +829,11 @@ fn place_by_id<'db>( // mutation to type check correctly, and for code that uses the global, it accurately // reflects the lack of knowledge about the type. // - // External modifications (or modifications through `global` statements) that would - // require a wider type are relatively rare. From a practical perspective, we can - // therefore achieve a better user experience by trusting the inferred type. Users - // who need the external mutation to work can always annotate the global with the - // wider type. And everyone else benefits from more precise type inference. + // However, external modifications (or modifications through `global` statements) that + // would require a wider type are relatively rare. From a practical perspective, we can + // therefore achieve a better user experience by trusting the inferred type. Users who + // need the external mutation to work can always annotate the global with the wider + // type. And everyone else benefits from more precise type inference. let is_module_global = scope.node(db).scope_kind().is_module(); // If the visibility of the scope is private (like for a function scope), we also do