nac3/nac3standalone/demo/src
David Mak f09f3c27a5 core: Do not keep unification result for function arguments
For some reason, when unifying a function call parameter with an
argument, subsequent calls to the same function will only accept the
type of the substituted argument.

This affect snippets like:

```
def make1() -> C[Literal[1]]:
    return ...

def make2() -> C[Literal[2]]:
    return ...

def consume(instance: C[Literal[1, 2]]):
    pass

consume(make1())
consume(make2())
```

The last statement will result in a compiler error, as the parameter of
consume is replaced with C[Literal[1]].

We fix this by getting a snapshot before performing unification, and
restoring the snapshot after unification succeeds.
2023-12-16 18:40:48 +08:00
..
bool_literal_condition.py standalone: Fix indentation of test files 2023-11-01 13:20:26 +08:00
classes.py nac3standalone: reorganize demos, compare against cpython 2022-01-23 10:35:06 +08:00
const_generic.py core: Do not keep unification result for function arguments 2023-12-16 18:40:48 +08:00
dead_code_issue118.py standalone: Fix indentation of test files 2023-11-01 13:20:26 +08:00
default_param.py nac3standalone: add test for default param 2022-03-30 04:05:47 +08:00
demo_test.py standalone: Fix indentation of test files 2023-11-01 13:20:26 +08:00
inheritance.py nac3standalone: add more tests 2022-06-01 17:58:16 +08:00
len.py nac3standalone: add tests for list slice and len 2022-01-26 03:58:27 +08:00
list_slice_issue315.py standalone: Fix indentation of test files 2023-11-01 13:20:26 +08:00
lists.py nac3standalone: fix broken test 2022-04-05 18:21:46 +08:00
loop.py standalone: Adapt loop example to output loop variable 2023-09-06 18:56:45 +08:00
loop_cont_break.py core: Fix IR generation of `for` loop containing break/continue 2023-11-01 13:21:27 +08:00
loop_decr.py core: Preserve value of variable shadowed by for loop 2023-09-06 20:09:36 +08:00
loop_iterable.py core: Use C-style for loop logic for iterables 2023-09-06 20:09:38 +08:00
loop_mutate_var.py core: Preserve value of variable shadowed by for loop 2023-09-06 20:09:36 +08:00
loop_try_break.py standalone: Fix indentation of test files 2023-11-01 13:20:26 +08:00
mandelbrot.py nac3standalone: reorganize demos, compare against cpython 2022-01-23 10:35:06 +08:00
math.py core: Add np_{round,floor,ceil} 2023-11-23 13:45:07 +08:00
min_max_abs.py nac3standalone: add test for abs function 2022-03-08 23:26:01 +08:00
numeric_primitives.py core: Change bitshift operators to accept int32/uint32 for RHS operand 2023-11-09 12:16:20 +08:00
operators.py core: Change bitshift operators to accept int32/uint32 for RHS operand 2023-11-09 12:16:20 +08:00
option.py Option type support (#224) 2022-03-26 15:09:15 +08:00
pow.py nac3standalone: add tests for power 2022-04-04 22:10:56 +08:00
recursive_type.py nac3standalone: add more tests 2022-06-01 17:58:16 +08:00
stack_addr_issue233.py standalone: Fix indentation of test files 2023-11-01 13:20:26 +08:00
tuple.py nac3standalone: add tests for tuple 2022-03-27 10:31:20 +08:00
type_annotations.py core: Infer builtins name list using builtin declaration list 2023-12-08 17:29:34 +08:00
typevar.py nac3standalone: add more tests 2022-06-01 17:58:16 +08:00