self.arg_tuple = TupleNode(self.pos, args = self.args)
self.arg_tuple.analyse_types(env)
self.args = None
- if func_type is Builtin.type_type and function.entry.is_builtin and \
+ if func_type is Builtin.type_type and function.is_name and \
+ function.entry and \
+ function.entry.is_builtin and \
function.entry.name in Builtin.types_that_construct_their_instance:
# calling a builtin type that returns a specific object type
if function.entry.name == 'float':
--- /dev/null
+cdef class MyType:
+ def dup(self):
+ """
+ >>> x1 = MyType()
+ >>> isinstance(x1, MyType)
+ True
+ >>> x2 = x1.dup()
+ >>> isinstance(x2, MyType)
+ True
+ >>> x1 != x2
+ True
+ """
+ cdef MyType clone = <MyType>type(self)()
+ return clone