Handle generic parameter types as return types of builtins in DocBuilder#1046
Handle generic parameter types as return types of builtins in DocBuilder#1046BCSharp merged 5 commits intoIronLanguages:masterfrom
Conversation
|
Why do we need to prevent Edit: Ok, the failure is not related to the COM type itself, but it still seems like we could guard against calling |
Actually, this is what I had implemented first, but then got thinking that perhaps it would be a bad idea to have such types floating around in the Python space. After all, they are not "real" types, should not be instantiated, each one is unique, despite having the same name/CLR type, may not belong to any namespace (when "declared" by a method), etc. But I am not quite sure about that, so if you think it would be OK, I can put that support back in. |
|
I haven't tried to get my hands on a PythonType of a generic parameter type to see what you could do with it. I expect not much? Not sure what the disadvantage of having such types would be. It seems like having Note that while the comment said it may return |
3ab36fb to
8248fde
Compare
| type = type.GetElementType(); | ||
| } | ||
|
|
||
| if (type.IsGenericParameter) { |
There was a problem hiding this comment.
Do we still need this check? I guess it's fine since prevents the PythonType from being created.
There was a problem hiding this comment.
Yes, it is a fast track now, still useful. Generic parameter types have trivial names.
Fixes:
The documentation on
PythonType.GetPythonType(Type type)says it may returnnullif no type is available. So this is what it does now. However, this code path (chiefly thoughDynamicHelpers.GetPythonTypeFromType) is used in a lot of places that do not check for null. From nullability annotation point of view, it would be good to keep the return type ofGetPythonTypeFromTypenon-nullable, but how to handle errors?ArgumentException?