-
Notifications
You must be signed in to change notification settings - Fork 272
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 #5528 from unisonweb/fix-5525
- Loading branch information
Showing
3 changed files
with
212 additions
and
46 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
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,106 @@ | ||
The original bug report identified the mishandling of this simple case involving shadowing, in which we previously | ||
erroneously rendered "bar" with a leading dot. | ||
|
||
``` ucm | ||
scratch/main> builtins.merge lib.builtin | ||
Done. | ||
``` | ||
|
||
``` unison | ||
foo = | ||
bar = | ||
match 5 with | ||
1 -> 2 | ||
bar -> bar | ||
bar | ||
``` | ||
|
||
``` ucm :added-by-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`: | ||
foo : Nat | ||
``` | ||
|
||
``` ucm | ||
scratch/main> add | ||
⍟ I've added these definitions: | ||
foo : Nat | ||
scratch/main> view foo | ||
foo : Nat | ||
foo = | ||
bar = match 5 with | ||
1 -> 2 | ||
bar -> bar | ||
bar | ||
``` | ||
|
||
``` ucm | ||
scratch/main> project.delete scratch | ||
``` | ||
|
||
There's a more complicated case that was also previously mishandled, though, which involves a top-level binding to which | ||
for which we do need to add a leading dot in order to refer to. | ||
|
||
``` ucm | ||
scratch/main> builtins.merge lib.builtin | ||
Done. | ||
``` | ||
|
||
``` unison | ||
foo = | ||
bar = | ||
match 5 with | ||
1 -> 2 | ||
bar -> bar + .bar | ||
bar | ||
bar = 17 | ||
``` | ||
|
||
``` ucm :added-by-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 | ||
foo : Nat | ||
``` | ||
|
||
``` ucm | ||
scratch/main> add | ||
⍟ I've added these definitions: | ||
bar : Nat | ||
foo : Nat | ||
scratch/main> view foo | ||
foo : Nat | ||
foo = | ||
use Nat + | ||
bar = match 5 with | ||
1 -> 2 | ||
bar -> bar + .bar | ||
bar | ||
``` | ||
|
||
``` ucm | ||
scratch/main> project.delete scratch | ||
``` |