2022-01-21 19:29:23 +03:00
|
|
|
# Duplicate names in scratch file.
|
|
|
|
|
|
|
|
Term and ability constructor collisions should cause a parse error.
|
|
|
|
|
2024-07-10 17:46:18 +03:00
|
|
|
``` unison
|
2022-01-21 19:29:23 +03:00
|
|
|
structural ability Stream where
|
|
|
|
send : a -> ()
|
|
|
|
|
|
|
|
Stream.send : a -> ()
|
|
|
|
Stream.send _ = ()
|
|
|
|
```
|
|
|
|
|
2024-07-10 19:17:15 +03:00
|
|
|
``` ucm
|
2022-01-21 19:29:23 +03:00
|
|
|
|
2023-12-22 14:55:24 +03:00
|
|
|
Loading changes detected in scratch.u.
|
|
|
|
|
2022-01-21 19:29:23 +03:00
|
|
|
❗️
|
|
|
|
|
|
|
|
I found multiple bindings with the name Stream.send:
|
|
|
|
2 | send : a -> ()
|
|
|
|
3 |
|
|
|
|
4 | Stream.send : a -> ()
|
|
|
|
5 | Stream.send _ = ()
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
Term and type constructor collisions should cause a parse error.
|
|
|
|
|
2024-07-10 17:46:18 +03:00
|
|
|
``` unison
|
2022-01-21 19:29:23 +03:00
|
|
|
structural type X = x
|
|
|
|
|
|
|
|
X.x : a -> ()
|
|
|
|
X.x _ = ()
|
|
|
|
```
|
|
|
|
|
2024-07-10 19:17:15 +03:00
|
|
|
``` ucm
|
2022-01-21 19:29:23 +03:00
|
|
|
|
2023-12-22 14:55:24 +03:00
|
|
|
Loading changes detected in scratch.u.
|
|
|
|
|
2022-01-21 19:29:23 +03:00
|
|
|
❗️
|
|
|
|
|
|
|
|
I found multiple bindings with the name X.x:
|
|
|
|
1 | structural type X = x
|
|
|
|
2 |
|
|
|
|
3 | X.x : a -> ()
|
|
|
|
4 | X.x _ = ()
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
Ability and type constructor collisions should cause a parse error.
|
|
|
|
|
2024-07-10 17:46:18 +03:00
|
|
|
``` unison
|
2022-01-21 19:29:23 +03:00
|
|
|
structural type X = x
|
|
|
|
structural ability X where
|
|
|
|
x : ()
|
|
|
|
```
|
|
|
|
|
2024-07-10 19:17:15 +03:00
|
|
|
``` ucm
|
2022-01-21 19:29:23 +03:00
|
|
|
|
2023-12-22 14:55:24 +03:00
|
|
|
Loading changes detected in scratch.u.
|
|
|
|
|
2022-01-21 19:29:23 +03:00
|
|
|
I found two types called X:
|
|
|
|
|
|
|
|
1 | structural type X = x
|
|
|
|
2 | structural ability X where
|
|
|
|
3 | x : ()
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
Field accessors and terms with the same name should cause a parse error.
|
|
|
|
|
2024-07-10 17:46:18 +03:00
|
|
|
``` unison
|
2022-01-21 19:29:23 +03:00
|
|
|
structural type X = {x : ()}
|
|
|
|
X.x.modify = ()
|
|
|
|
X.x.set = ()
|
|
|
|
X.x = ()
|
|
|
|
```
|
|
|
|
|
2024-07-10 19:17:15 +03:00
|
|
|
``` ucm
|
2022-01-21 19:29:23 +03:00
|
|
|
|
2023-12-22 14:55:24 +03:00
|
|
|
Loading changes detected in scratch.u.
|
|
|
|
|
2022-01-21 19:29:23 +03:00
|
|
|
❗️
|
|
|
|
|
|
|
|
I found multiple bindings with the name X.x:
|
|
|
|
1 | structural type X = {x : ()}
|
|
|
|
2 | X.x.modify = ()
|
|
|
|
3 | X.x.set = ()
|
|
|
|
4 | X.x = ()
|
|
|
|
|
|
|
|
|
|
|
|
I found multiple bindings with the name X.x.modify:
|
|
|
|
1 | structural type X = {x : ()}
|
|
|
|
2 | X.x.modify = ()
|
|
|
|
|
|
|
|
|
|
|
|
I found multiple bindings with the name X.x.set:
|
|
|
|
1 | structural type X = {x : ()}
|
|
|
|
2 | X.x.modify = ()
|
|
|
|
3 | X.x.set = ()
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
Types and terms with the same name are allowed.
|
|
|
|
|
2024-07-10 17:46:18 +03:00
|
|
|
``` unison
|
2022-01-21 19:29:23 +03:00
|
|
|
structural type X = Z
|
|
|
|
|
|
|
|
X = ()
|
|
|
|
```
|
|
|
|
|
2024-07-10 19:17:15 +03:00
|
|
|
``` ucm
|
2022-01-21 19:29:23 +03:00
|
|
|
|
2023-12-22 14:55:24 +03:00
|
|
|
Loading changes detected in scratch.u.
|
|
|
|
|
2022-01-21 19:29:23 +03:00
|
|
|
I found and typechecked these definitions in scratch.u. If you
|
|
|
|
do an `add` or `update`, here's how your codebase would
|
|
|
|
change:
|
|
|
|
|
|
|
|
⍟ These new definitions are ok to `add`:
|
|
|
|
|
|
|
|
structural type X
|
|
|
|
(also named builtin.Unit)
|
|
|
|
X : ()
|
|
|
|
|
|
|
|
```
|
2024-07-10 19:17:15 +03:00
|
|
|
``` ucm
|
2024-06-12 01:22:09 +03:00
|
|
|
scratch/main> add
|
2022-01-21 19:29:23 +03:00
|
|
|
|
|
|
|
⍟ I've added these definitions:
|
|
|
|
|
|
|
|
structural type X
|
|
|
|
(also named builtin.Unit)
|
|
|
|
X : ()
|
|
|
|
|
2024-06-12 01:22:09 +03:00
|
|
|
scratch/main> view X
|
2022-01-21 19:29:23 +03:00
|
|
|
|
|
|
|
structural type X = Z
|
|
|
|
|
|
|
|
X : ()
|
|
|
|
X = ()
|
|
|
|
|
|
|
|
```
|