Lunderberg commented on a change in pull request #10099:
URL: https://github.com/apache/tvm/pull/10099#discussion_r798653970
##########
File path: python/tvm/script/parser.py
##########
@@ -1138,6 +1141,29 @@ def transform_TypeTuple(self, node):
"""
return [self.transform(value) for value in node.values]
+ def transform_TypeApply(self, node):
+ """Visitor for Type[Type] expressions.
+
+ Mostly used for ``T.Ptr`` expressions.
+ """
+ func = self.transform(node.func_name)
+
+ if not isinstance(func, ty.TypeGeneric):
+ self.report_error(f"Expected a type but found
{type(func).__name__}", node.span)
+
+ param_types = []
Review comment:
I had looked at the `transform_TypeTuple` implementation, and I don't
think it's directly applicable. It assumes that there is a
`synr.ast.TypeTuple` node, with types in `node.values`, and doesn't have a way
to accept a list of types directly or to access the `node.params` of a
`TypeApply` node. The `TVMScriptParser.parse_arg_list` is the closest I found
to the desired functionality, but it requires the node to be an intrinsic,
scope handler, or special statement, and doesn't have a case for type
annotations.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]