Lunderberg commented on a change in pull request #10099:
URL: https://github.com/apache/tvm/pull/10099#discussion_r798637887



##########
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)

Review comment:
       Similar to above, I'd like to avoid breaking any usage of `T.Tuple`, if 
it exists outside of the implementation above.  I've updated the error message 
to read `"Use of type arguments requires a type that accepts type arguments 
(e.g. T.Ptr), but found {type(func).__name__} instead."` to clarify that the 
error would be in applying a type argument, not in the use of a type annotation.




-- 
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]


Reply via email to