forked from M-Labs/nac3
1
0
Fork 0
nac3/nac3standalone/demo
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
..
src core: Do not keep unification result for function arguments 2023-12-16 18:40:48 +08:00
check_demo.sh standalone: Add flags to control demo output options 2023-10-04 18:11:44 +08:00
check_demos.sh standalone: Split check_demos into check_demo 2023-09-30 09:31:18 +08:00
demo.c demo: fix 64-bit format strings 2023-12-04 18:51:06 +08:00
interpret_demo.py core: Initial implementation for const generics 2023-12-08 18:02:11 +08:00
run_demo.sh standalone: Fix run_demo script 2023-10-16 15:52:48 +08:00