pyrser/type_system/inference.py
def infer_type(self, init_scope: Scope=None, diagnostic=None):
        """
        Do inference. Write infos into diagnostic object, if this parameter
        is not provide and self is a AST (has is own diagnostic object),
        use the diagnostic of self.
        """
        # create the first .infer_node
        if not hasattr(self, 'infer_node'):
            self.infer_node = InferNode(init_scope)
        elif init_scope is not None:
            # only change the root scope
            self.infer_node.scope_node = init_scope
        # get algo
        type_algo = self.type_algos()
        if diagnostic is None and hasattr(self, 'diagnostic'):
            diagnostic = self.diagnostic
        type_algo[0](type_algo[1], diagnostic)
def infer_type(self, init_scope: Scope=None, diagnostic=None):
        """
        Do inference. Write infos into diagnostic object, if this parameter
        is not provide and self is a AST (has is own diagnostic object),
        use the diagnostic of self.
        """
        # create the first .infer_node
        if not hasattr(self, 'infer_node'):
            self.infer_node = InferNode(init_scope)
        elif init_scope is not None:
            # only change the root scope
            self.infer_node.scope_node = init_scope
        # get algo
        type_algo = self.type_algos()
        if diagnostic is None and hasattr(self, 'diagnostic'):
            diagnostic = self.diagnostic
        type_algo[0](type_algo[1], diagnostic)
Do inference. Write infos into diagnostic object, if this parameter
        is not provide and self is a AST (has is own diagnostic object),
        use the diagnostic of self.