Skip to content

Commit

Permalink
checked_type for constructors is not populated
Browse files Browse the repository at this point in the history
  • Loading branch information
slyubomirsky committed Feb 1, 2019
1 parent e4ecb66 commit 0e015a4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 0 additions & 2 deletions tests/python/relay/test_adt.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ def test_nat_value():

def test_nat_constructor():
assert relay.ir_pass.infer_type(z(), mod).checked_type == nat()
assert relay.ir_pass.infer_type(s, mod).checked_type == relay.FuncType([nat()], nat())
assert relay.ir_pass.infer_type(s(z()), mod).checked_type == nat()


Expand All @@ -105,7 +104,6 @@ def test_add():

def test_list_constructor():
a = relay.TypeVar("a")
assert relay.ir_pass.infer_type(nil, mod).checked_type == relay.FuncType([], l(a), [a])
assert relay.ir_pass.infer_type(cons(z(), nil()), mod).checked_type == l(nat())


Expand Down
4 changes: 3 additions & 1 deletion tests/python/relay/test_type_infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,10 @@ def test_constructor_type():
mod = relay.Module()
box, constructor = initialize_box_adt(mod)

ct = relay.ir_pass.infer_type(constructor, mod)
a = relay.TypeVar('a')
x = relay.Var('x', a)
ct = relay.ir_pass.infer_type(
relay.Function([x], constructor(x), box(a), [a]), mod)
expected = relay.FuncType([a], box(a), [a])
assert ct.checked_type == expected

Expand Down

0 comments on commit 0e015a4

Please sign in to comment.