forked from M-Labs/nac3
1
0
Fork 0
nac3/nac3core
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
Cargo.toml meta: Update cargo dependencies 2023-12-12 15:41:59 +08:00
build.rs core: Apply clippy pedantic changes 2023-12-11 15:16:23 +08:00