Skip to content

Commit

Permalink
fix #4280
Browse files Browse the repository at this point in the history
  • Loading branch information
tstat committed Jan 30, 2024
1 parent a87f379 commit 1568dfc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
2 changes: 1 addition & 1 deletion unison-src/transcripts/fix4280.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.> builtins.merge
```

```unison:error
```unison
foo.bar._baz = 5
bonk : Nat
Expand Down
18 changes: 7 additions & 11 deletions unison-src/transcripts/fix4280.output.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,13 @@ bonk =
Loading changes detected in scratch.u.
I found a value of type: Nat
where I expected to find: Unit
I found and typechecked these definitions in scratch.u. If you
do an `add` or `update`, here's how your codebase would
change:
5 | use foo.bar _baz
6 | _baz
from right here:
1 | foo.bar._baz = 5
Hint: Actions within a block must have type Unit.
Use _ = <expr> to ignore a result.
⍟ These new definitions are ok to `add`:
bonk : Nat
foo.bar._baz : Nat
```
1 change: 1 addition & 0 deletions unison-syntax/src/Unison/Syntax/Parser.hs
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ wordyDefinitionName = queryToken $ \case
importWordyId :: Ord v => P v m (L.Token Name)
importWordyId = queryToken \case
L.WordyId (HQ'.NameOnly n) -> Just n
L.Blank s | not (null s) -> Just $ Name.unsafeFromString ("_" <> s)
_ -> Nothing

-- The `+` in: use Foo.bar + as a Name
Expand Down

0 comments on commit 1568dfc

Please sign in to comment.