private IPythonType CreateListType(string typeName, BuiltinTypeId typeId, IReadOnlyList <IPythonType> typeArgs, bool isMutable) { if (typeArgs.Count == 1) { return(TypingTypeFactory.CreateListType(Interpreter, typeName, typeId, typeArgs[0], isMutable)); } // TODO: report wrong number of arguments return(Interpreter.UnknownType); }
private IPythonType CreateListType(string typeName, BuiltinTypeId typeId, IReadOnlyList <IPythonType> typeArgs, bool isMutable) { if (typeArgs.Count == 1) { // If argument is generic type parameter then this is still a generic specification // except instead of 'List' as in 'from typing import List' it is a template // like in 'class A(Generic[T], List[T]) return(typeArgs[0] is IGenericTypeParameter ? ToGenericTemplate(typeName, typeArgs, BuiltinTypeId.List) : TypingTypeFactory.CreateListType(Interpreter, typeName, typeId, typeArgs[0], isMutable)); } // TODO: report wrong number of arguments return(Interpreter.UnknownType); }