-
Notifications
You must be signed in to change notification settings - Fork 270
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5338 from unisonweb/fix-5267
- Loading branch information
Showing
3 changed files
with
165 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
```ucm:hide | ||
scratch/main> builtins.merge lib.builtin | ||
``` | ||
|
||
```unison | ||
lib.direct.foo = 17 | ||
lib.direct.lib.indirect.foo = 18 | ||
bar : Nat | ||
bar = direct.foo + direct.foo | ||
``` | ||
|
||
Here, `bar` renders as `foo + foo`, even though there are two names with suffix `foo` in scope, because one is an | ||
indirect dependency. It used to render as `direct.foo + direct.foo`. | ||
|
||
```ucm | ||
scratch/main> add | ||
scratch/main> view bar | ||
``` | ||
|
||
Same test, but for types. | ||
|
||
```unison | ||
type lib.direct.Foo = MkFoo | ||
type lib.direct.lib.indirect.Foo = MkFoo | ||
type Bar = MkBar direct.Foo | ||
``` | ||
|
||
```ucm | ||
scratch/main> add | ||
scratch/main> view Bar | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
``` unison | ||
lib.direct.foo = 17 | ||
lib.direct.lib.indirect.foo = 18 | ||
bar : Nat | ||
bar = direct.foo + direct.foo | ||
``` | ||
|
||
``` ucm | ||
Loading changes detected in scratch.u. | ||
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`: | ||
bar : Nat | ||
lib.direct.foo : Nat | ||
lib.direct.lib.indirect.foo : Nat | ||
``` | ||
Here, `bar` renders as `foo + foo`, even though there are two names with suffix `foo` in scope, because one is an | ||
indirect dependency. It used to render as `direct.foo + direct.foo`. | ||
|
||
``` ucm | ||
scratch/main> add | ||
⍟ I've added these definitions: | ||
bar : Nat | ||
lib.direct.foo : Nat | ||
lib.direct.lib.indirect.foo : Nat | ||
scratch/main> view bar | ||
bar : Nat | ||
bar = | ||
use Nat + | ||
foo + foo | ||
``` | ||
Same test, but for types. | ||
|
||
``` unison | ||
type lib.direct.Foo = MkFoo | ||
type lib.direct.lib.indirect.Foo = MkFoo | ||
type Bar = MkBar direct.Foo | ||
``` | ||
|
||
``` ucm | ||
Loading changes detected in scratch.u. | ||
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`: | ||
type Bar | ||
type lib.direct.Foo | ||
type lib.direct.lib.indirect.Foo | ||
``` | ||
``` ucm | ||
scratch/main> add | ||
⍟ I've added these definitions: | ||
type Bar | ||
type lib.direct.Foo | ||
type lib.direct.lib.indirect.Foo | ||
scratch/main> view Bar | ||
type Bar = MkBar Foo | ||
``` |