mirror of https://github.com/mtshiba/pylyzer
feat: support `typing.Any`
This commit is contained in:
parent
ec539b013f
commit
d650569de6
|
|
@ -124,8 +124,9 @@ pylyzer converts Python ASTs to Erg ASTs and passes them to Erg's type checker.
|
|||
* [x] `Optional`
|
||||
* [x] `Literal`
|
||||
* [x] `Callable`
|
||||
* [ ] `TypedDict`
|
||||
* [x] `Any`
|
||||
* [x] `TypeVar`
|
||||
* [ ] `TypedDict`
|
||||
* [ ] `ClassVar`
|
||||
* [ ] `Generic`
|
||||
* [ ] `Protocol`
|
||||
|
|
|
|||
|
|
@ -1077,6 +1077,12 @@ impl ASTConverter {
|
|||
py_ast::Expr::Attribute(attr) => {
|
||||
let namespace = Box::new(self.convert_expr(*attr.value));
|
||||
let t = self.convert_ident(attr.attr.to_string(), attr_name_loc(&namespace));
|
||||
if namespace
|
||||
.get_name()
|
||||
.is_some_and(|n| n == "typing" && t.inspect() == "Any")
|
||||
{
|
||||
return TypeSpec::PreDeclTy(PreDeclTypeSpec::Mono(t));
|
||||
}
|
||||
let predecl = PreDeclTypeSpec::Attr { namespace, t };
|
||||
TypeSpec::PreDeclTy(predecl)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue