Skip to content

Commit

Permalink
Merge pull request #4654 from unisonweb/travis/4280/use-blanks
Browse files Browse the repository at this point in the history
Fix parsing bug involving `use` and underscore-prefixed names
  • Loading branch information
mergify[bot] authored Jan 30, 2024
2 parents 54f64a5 + 1568dfc commit a162fcc
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
12 changes: 12 additions & 0 deletions unison-src/transcripts/fix4280.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
```ucm:hide
.> builtins.merge
```

```unison
foo.bar._baz = 5
bonk : Nat
bonk =
use foo.bar _baz
_baz
```
23 changes: 23 additions & 0 deletions unison-src/transcripts/fix4280.output.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
```unison
foo.bar._baz = 5
bonk : Nat
bonk =
use foo.bar _baz
_baz
```

```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`:
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 a162fcc

Please sign in to comment.