mirror of https://github.com/astral-sh/ruff
regression test
This commit is contained in:
parent
949684677f
commit
695f2723d4
|
|
@ -880,6 +880,49 @@ from mypackage import funcmod
|
|||
x = funcmod(1)
|
||||
```
|
||||
|
||||
## A Tale of Two Modules
|
||||
|
||||
`from typing import TYPE_CHECKING` has side-effects???
|
||||
|
||||
### In Stub
|
||||
|
||||
`mypackage/__init__.py`:
|
||||
|
||||
```py
|
||||
from .conflicted.b import x
|
||||
```
|
||||
|
||||
`mypackage/conflicted/__init__.py`:
|
||||
|
||||
`mypackage/conflicted/other1/__init__.py`:
|
||||
|
||||
```py
|
||||
x: int = 1
|
||||
```
|
||||
|
||||
`mypackage/conflicted/b/__init__.py`:
|
||||
|
||||
```py
|
||||
x: int = 1
|
||||
```
|
||||
|
||||
`mypackage/conflicted/b/c/__init__.py`:
|
||||
|
||||
```py
|
||||
y: int = 2
|
||||
```
|
||||
|
||||
`main.py`:
|
||||
|
||||
```py
|
||||
from typing import TYPE_CHECKING
|
||||
from mypackage.conflicted.other1 import x as x1
|
||||
import mypackage.conflicted.b.c
|
||||
|
||||
# error: [possibly-missing-attribute]
|
||||
reveal_type(mypackage.conflicted.b.c.y) # revealed: Unknown
|
||||
```
|
||||
|
||||
## Re-export Nameclash Problems In Functions
|
||||
|
||||
`from` imports in an `__init__.py` at file scope should be visible to functions defined in the file:
|
||||
|
|
|
|||
|
|
@ -12322,7 +12322,8 @@ impl<'db> ModuleLiteralType<'db> {
|
|||
let place_and_qualifiers = self
|
||||
.module(db)
|
||||
.file(db)
|
||||
.map(|file| {
|
||||
.map(|file| imported_symbol(db, file, name, None))
|
||||
/*.map(|file| {
|
||||
imported_symbol(db, file, name, None).map_type(|ty| {
|
||||
if let Some(importing) = self.importing_file(db)
|
||||
&& let Type::ModuleLiteral(module) = ty
|
||||
|
|
@ -12332,7 +12333,7 @@ impl<'db> ModuleLiteralType<'db> {
|
|||
ty
|
||||
}
|
||||
})
|
||||
})
|
||||
})*/
|
||||
.unwrap_or_default();
|
||||
|
||||
if !place_and_qualifiers.is_undefined() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue