Esempio n. 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
Esempio n. 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
Esempio n. 3
0
def test_repr_recursive():
    sa = S(t=ty.Int[64])
    ta = T.empty()
    la = T.empty()
    la.__init__([ta])
    ta.__init__([sa, la])
    ta = ta.intern()
    repr(ta)
Esempio n. 4
0
def test_concretize_recursive():
    loop = asyncio.new_event_loop()
    s = S(t=ty.Int[64])
    p = Pending(None, None, loop=loop)
    t = T([s, p])
    p.set_result(t)

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

    async def coro():
        assert (await concretize_abstract(t)) is ta

    asyncio.run(coro())
Esempio n. 5
0
def to_abstract_test(self, tup: tuple):
    return AbstractTuple([self(x) for x in tup])