Exemplo n.º 1
0
def resolve_type(t, tcon):
    """
    Return a new type where all type variables occurring free in T and
    bound in the given context are resolved to their bound values.
    """

    free = list(T.free_in_type(t))
    if not free:  return t

    R = resolution_map(free, tcon.environment)
    for v in free:
        if R[v] != v:
            R[v] = resolve_type(R[v], tcon)

    return T.substituted_type(t, R)
Exemplo n.º 2
0
def resolve_type(t, S):
    """
    Return a new type where all type variables occurring free in t
    are replaced with their values under the substitution S.  If t has
    no free variables, it is returned unchanged.
    """

    free = list(T.free_in_type(t))
    if not free: return t

    R = resolution_map(free, S)
    for v in free:
        if R[v] != v:
            R[v] = resolve_type(R[v], S)

    return T.substituted_type(t, R)
Exemplo n.º 3
0
def resolve_type(t, S):
    """
    Return a new type where all type variables occurring free in t
    are replaced with their values under the substitution S.  If t has
    no free variables, it is returned unchanged.
    """
    
    free = list(T.free_in_type(t))
    if not free:  return t

    R = resolution_map(free, S)
    for v in free:
        if R[v] != v:
            R[v] = resolve_type(R[v], S)

    return T.substituted_type(t, R)