diff --git a/unison-src/transcripts/fix4280.md b/unison-src/transcripts/fix4280.md new file mode 100644 index 0000000000..f4cf09a011 --- /dev/null +++ b/unison-src/transcripts/fix4280.md @@ -0,0 +1,12 @@ +```ucm:hide +.> builtins.merge +``` + +```unison +foo.bar._baz = 5 + +bonk : Nat +bonk = + use foo.bar _baz + _baz +``` diff --git a/unison-src/transcripts/fix4280.output.md b/unison-src/transcripts/fix4280.output.md new file mode 100644 index 0000000000..8b918418f8 --- /dev/null +++ b/unison-src/transcripts/fix4280.output.md @@ -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 + +``` diff --git a/unison-syntax/src/Unison/Syntax/Parser.hs b/unison-syntax/src/Unison/Syntax/Parser.hs index 7b38ffa333..be115a6a92 100644 --- a/unison-syntax/src/Unison/Syntax/Parser.hs +++ b/unison-syntax/src/Unison/Syntax/Parser.hs @@ -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