Skip to content

Commit c9c885d

Browse files
committed
Nix.Builtins: replaceStrings: m refactor: m upd
1 parent 5d89acf commit c9c885d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/Nix/Builtins.hs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,7 @@ replaceStrings tfrom tto ts =
979979
-- Maybe `text-builder`, `text-show`?
980980
finish ctx output = makeNixString (LazyText.toStrict $ Builder.toLazyText output) ctx
981981

982-
replace (matched, replacementNS, unprocessedInput) = replaceWithNixBug unprocessedInput updatedOutput
982+
replace (key, replacementNS, unprocessedInput) = replaceWithNixBug unprocessedInput updatedOutput
983983

984984
where
985985
replaceWithNixBug =
@@ -992,15 +992,16 @@ replaceStrings tfrom tto ts =
992992
-- " H e l l o w o r l d "
993993
-- repl> builtins.replaceStrings ["ll" ""] [" " "i"] "Hello world"
994994
-- "iHie ioi iwioirilidi"
995+
-- 2021-02-18: NOTE: There is no tests for this
995996
bugPassOneChar -- augmented recursion
996997
isNixBugCase
997998

998-
isNixBugCase = matched == mempty
999+
isNixBugCase = key == mempty
9991000

10001001
updatedOutput = output <> replacement
1001-
replacement = Builder.fromText $ stringIgnoreContext replacementNS
1002-
10031002
updatedCtx = ctx <> replacementCtx
1003+
1004+
replacement = Builder.fromText $ stringIgnoreContext replacementNS
10041005
replacementCtx = NixString.getContext replacementNS
10051006

10061007
-- The bug modifies the content => bug demands `pass` to be a real function =>

0 commit comments

Comments
 (0)