New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Making QDots in IdQualified resolvable #10174
Conversation
PR checklist:
If you're unsure about any of this, please see: |
@@ -124,7 +124,7 @@ let rec map_qualified_name (env : env) (x : CST.qualified_name) : | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need a test plan that actually shows something, some code that one can -dump_ast
and see that now those annotations are getting resolved.
@@ -581,7 +581,7 @@ and qualified_info = { | |||
|
|||
and qualifier = | |||
(* Java/C++/Rust *) | |||
| QDots of (ident * type_arguments option) list | |||
| QDots of (ident * type_arguments option) list * id_info |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No strong opinion, but I do wonder if it wouldn't be simpler and more general to just have NameAttr
take an expr
. We have another ticket/request for supporting sym-prop for attributes. The idents in the QDots
are accompanied by type_arguments
which to me suggests that they are not meant to encode expressions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes maybe the issue here is how we currently encode app.get as a qualified name when really it's a DotAccess
One issue is that in Python it's not super clear when you see foo.bar.z
whether bar is a module, or a field.
So probably we should go more general and use DotAccess here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we can have an ExprAttr of ...
or encode it via OtherAttribute.
@aryx do you have an opinion on this one? |
looking |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's fix how we translate Python instead. Let's not use QDots for
what is really a DotAccess.
@@ -581,7 +581,7 @@ and qualified_info = { | |||
|
|||
and qualifier = | |||
(* Java/C++/Rust *) | |||
| QDots of (ident * type_arguments option) list | |||
| QDots of (ident * type_arguments option) list * id_info |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes maybe the issue here is how we currently encode app.get as a qualified name when really it's a DotAccess
One issue is that in Python it's not super clear when you see foo.bar.z
whether bar is a module, or a field.
So probably we should go more general and use DotAccess here.
@@ -581,7 +581,7 @@ and qualified_info = { | |||
|
|||
and qualifier = | |||
(* Java/C++/Rust *) | |||
| QDots of (ident * type_arguments option) list | |||
| QDots of (ident * type_arguments option) list * id_info |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we can have an ExprAttr of ...
or encode it via OtherAttribute.
superseded by #10221 |
test plan:
make test
QDots
inIdQualified
need to be resolvable if we want to use ametavariable-type
filter with the method annotation in Python, as shown in the example below:@app.get("/items/<item_id>")
is translated in AST as:QDots
is a list ofident
so we can't infer the type.