Detect runtime-evaluated base classes defined in the current file (#8572)

Closes https://github.com/astral-sh/ruff/issues/8250.

Closes https://github.com/astral-sh/ruff/issues/5486.
This commit is contained in:
Charlie Marsh 2023-11-08 19:38:06 -08:00 committed by GitHub
parent 4760af3dcb
commit 722687ad72
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 103 additions and 0 deletions

View file

@ -686,6 +686,16 @@ impl<'a> SemanticModel<'a> {
Some(resolved)
}
BindingKind::Builtin => Some(smallvec!["", head.id.as_str()]),
BindingKind::ClassDefinition(_) | BindingKind::FunctionDefinition(_) => {
let value_path = collect_call_path(value)?;
let resolved: CallPath = self
.module_path?
.iter()
.map(String::as_str)
.chain(value_path)
.collect();
Some(resolved)
}
_ => None,
}
}