fix: type inference bug

This commit is contained in:
Shunsuke Shibayama 2024-04-28 22:30:52 +09:00
parent 0ffa23affd
commit e48311ee0c
4 changed files with 25 additions and 5 deletions

View file

@ -41,3 +41,10 @@ val = val!()
xs as [Nat or Str; _] = [1, 2, "aa"]
ys = list filter x -> x in Int, xs
ff! x: Str or NoneType =
if! x isnot! None:
do!: f1! x
do!: f0!()
f0!() = print! ""
f1! _: Str = f0!()

View file

@ -93,6 +93,9 @@ fn _test_infer_types() -> Result<(), ()> {
module
.context
.assert_var_type("ys", &unknown_len_list_t(Nat))?;
module
.context
.assert_var_type("ff!", &func1(Str | NoneType, NoneType))?;
Ok(())
}