예제 #1
0
def test_broaden_recursive():
    s1 = S(1)
    t1 = T.empty()
    t1.__init__([s1, t1])
    t1 = t1.intern()

    sa = S(t=ty.Int[64])
    ta = T.empty()
    ta.__init__([sa, ta])
    ta = ta.intern()

    assert broaden(t1) is ta
    assert broaden(ta) is ta

    t2 = T.empty()
    u2 = AbstractUnion.empty()
    u2.__init__([s1, t2])
    t2.__init__([s1, u2])
    t2 = t2.intern()

    tb = T.empty()
    ub = AbstractUnion.empty()
    ub.__init__([sa, tb])
    tb.__init__([sa, ub])
    tb = tb.intern()

    assert broaden(t2) is tb
    assert broaden(tb) is tb
예제 #2
0
def test_broaden_recursive():
    s1 = S(1)
    t1 = T.empty()
    t1.__init__([s1, t1])
    t1 = t1.intern()

    sa = S(t=ty.Int[64])
    ta = T.empty()
    ta.__init__([sa, ta])
    ta = ta.intern()

    assert broaden(t1, None) is ta
    assert broaden(ta, None) is ta

    t2 = T.empty()
    u2 = U(s1, t2)
    t2.__init__([s1, u2])
    t2 = t2.intern()

    tb = T.empty()
    ub = U(sa, tb)
    tb.__init__([sa, ub])
    tb = tb.intern()

    assert broaden(t2, None) is tb
    assert broaden(tb, None) is tb