1
0
forked from M-Labs/nac3
nac3/nac3standalone
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
..
demo core: Do not keep unification result for function arguments 2023-12-16 18:40:48 +08:00
src standalone: Output id of undefined identifier 2023-12-16 18:40:48 +08:00
Cargo.toml meta: Update to Rust Edition 2021 2023-09-15 10:25:50 +08:00