Climbs the current stack until the given Forward reference has been resolved, or raises an InvalidForwardRefError

    :param typ: the forward reference to resolve
    :return:

def eval_forward_ref(typ: _ForwardRef):
    """
    Climbs the current stack until the given Forward reference has been resolved, or raises an InvalidForwardRefError

    :param typ: the forward reference to resolve
    :return:
    """
    for frame in stack():
        m = getmodule(frame[0])
        m_name = m.__name__ if m is not None else '<unknown>'
        if m_name.startswith('parsyfiles.tests') or not m_name.startswith('parsyfiles'):
            try:
                # print("File {}:{}".format(frame.filename, frame.lineno))
                return typ._eval_type(frame[0].f_globals, frame[0].f_locals)
            except NameError:
                pass

    raise InvalidForwardRefError(typ)