mirror of https://github.com/astral-sh/ruff
Review comments
This commit is contained in:
parent
b6e9af50f1
commit
439ffc1f15
|
|
@ -783,6 +783,7 @@ class A: ...
|
||||||
```py
|
```py
|
||||||
from subexporter import *
|
from subexporter import *
|
||||||
|
|
||||||
|
# TODO: we could potentially infer `list[str] | tuple[str, ...]` here
|
||||||
reveal_type(__all__) # revealed: list[Unknown | str]
|
reveal_type(__all__) # revealed: list[Unknown | str]
|
||||||
|
|
||||||
__all__.append("B")
|
__all__.append("B")
|
||||||
|
|
|
||||||
|
|
@ -829,11 +829,11 @@ fn place_by_id<'db>(
|
||||||
// mutation to type check correctly, and for code that uses the global, it accurately
|
// mutation to type check correctly, and for code that uses the global, it accurately
|
||||||
// reflects the lack of knowledge about the type.
|
// reflects the lack of knowledge about the type.
|
||||||
//
|
//
|
||||||
// External modifications (or modifications through `global` statements) that would
|
// However, external modifications (or modifications through `global` statements) that
|
||||||
// require a wider type are relatively rare. From a practical perspective, we can
|
// 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
|
// therefore achieve a better user experience by trusting the inferred type. Users who
|
||||||
// who need the external mutation to work can always annotate the global with the
|
// need the external mutation to work can always annotate the global with the wider
|
||||||
// wider type. And everyone else benefits from more precise type inference.
|
// type. And everyone else benefits from more precise type inference.
|
||||||
let is_module_global = scope.node(db).scope_kind().is_module();
|
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
|
// If the visibility of the scope is private (like for a function scope), we also do
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue