reticulated icon indicating copy to clipboard operation
reticulated copied to clipboard

__init__ function arguments types have no checks in the function body

Open migeed-z opened this issue 8 years ago • 0 comments

It seems that Reticulated skips the init function argument checks in the function body. In the following class definition:

@fields({'my_dict': Dict(Int, Tuple(Int, Int))})
class UnionFind:
    def __init__(self:UnionFind, my_dict:Dict(Int, Tuple(Int, Int)))->Void:
        self.my_dict = my_dict

There are no checks to verify that my_dict has the correct type. This is the resulting code from retic -p:

class UnionFind:
    def __init__(self, my_dict):
        self.my_dict = my_dict
    __init__ = check_type_function(__init__)

migeed-z avatar May 09 '17 17:05 migeed-z