2022-01-12 01:18:43 +03:00
|
|
|
# Duplicate Term Detection
|
|
|
|
|
|
|
|
```ucm:hide
|
2024-06-12 01:22:09 +03:00
|
|
|
scratch/main> builtins.merge
|
2022-01-12 01:18:43 +03:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
Trivial duplicate terms should be detected:
|
|
|
|
|
|
|
|
```unison:error
|
|
|
|
x = 1
|
|
|
|
x = 2
|
|
|
|
```
|
|
|
|
|
|
|
|
Equivalent duplicate terms should be detected:
|
|
|
|
|
|
|
|
```unison:error
|
|
|
|
x = 1
|
|
|
|
x = 1
|
|
|
|
```
|
|
|
|
|
|
|
|
Duplicates from record accessors/setters should be detected
|
|
|
|
|
|
|
|
```unison:error
|
|
|
|
structural type Record = {x: Nat, y: Nat}
|
|
|
|
Record.x = 1
|
|
|
|
Record.x.set = 2
|
|
|
|
Record.x.modify = 2
|
|
|
|
```
|
|
|
|
|
|
|
|
Duplicate terms and constructors should be detected:
|
|
|
|
|
|
|
|
```unison:error
|
|
|
|
structural type SumType = X
|
|
|
|
|
|
|
|
SumType.X = 1
|
|
|
|
|
|
|
|
structural ability AnAbility where
|
|
|
|
thing : Nat -> ()
|
|
|
|
|
|
|
|
AnAbility.thing = 2
|
|
|
|
```
|