Lunderberg commented on a change in pull request #10099:
URL: https://github.com/apache/tvm/pull/10099#discussion_r798645648
##########
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 = []
+ for param in node.params:
+ param_type = self.transform(param)
+ if not isinstance(param_type, ty.TypeGeneric):
Review comment:
It doesn't, no. The parameters of `TypeApply` typically aren't
`GenericPtrType`. For example, `T.Ptr[T.int32]`, the `T.int32` parameter is a
`ConcreteType`.
At some point, I may see if there's support for renaming `ty.TypeGeneric` to
`ty.Type`. As it is, `ty.ConcreteType` is a subclass of `ty.TypeGeneric`,
which doesn't make very much sense to me as there since it require any generic
parameters in the user-supplied tvmscript.
--
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]