unison/unison-src/transcripts/duplicate-names.output.md

144 lines
2.3 KiB
Markdown
Raw Permalink Normal View History

2022-01-21 19:29:23 +03:00
# Duplicate names in scratch file.
Term and ability constructor collisions should cause a parse error.
``` unison
2022-01-21 19:29:23 +03:00
structural ability Stream where
send : a -> ()
Stream.send : a -> ()
Stream.send _ = ()
```
``` ucm
2022-01-21 19:29:23 +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.
``` unison
2022-01-21 19:29:23 +03:00
structural type X = x
X.x : a -> ()
X.x _ = ()
```
``` ucm
2022-01-21 19:29:23 +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.
``` unison
2022-01-21 19:29:23 +03:00
structural type X = x
structural ability X where
x : ()
```
``` ucm
2022-01-21 19:29:23 +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.
``` unison
2022-01-21 19:29:23 +03:00
structural type X = {x : ()}
X.x.modify = ()
X.x.set = ()
X.x = ()
```
``` ucm
2022-01-21 19:29:23 +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.
``` unison
2022-01-21 19:29:23 +03:00
structural type X = Z
X = ()
```
``` ucm
2022-01-21 19:29:23 +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 : ()
```
``` ucm
scratch/main> add
2022-01-21 19:29:23 +03:00
⍟ I've added these definitions:
structural type X
(also named builtin.Unit)
X : ()
scratch/main> view X
2022-01-21 19:29:23 +03:00
structural type X = Z
X : ()
X = ()
```