Lunderberg commented on a change in pull request #10099:
URL: https://github.com/apache/tvm/pull/10099#discussion_r798630222
##########
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):
Review comment:
From my understanding, the `TypeApply` ast node would also be used for
`T.Tuple[type1,type2]` type annotations. While I couldn't find any usage of
`T.Tuple` type annotations, `GenericTupleType` exists in `tvm.script.tir.ty`
and would also use `TypeApply` in the synr ast. I've added a check for
`hasattr(func, __getitem__)`, since that expresses the intent that this is a
type that can accept type arguments, and would work for both `T.Ptr` and
`T.Tuple`.
--
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]