Skip to content

Commit cda1ecd

Browse files
authored
Merge pull request #5526 from unisonweb/cp/fix-set-echo
Fix old bool wrapper on setEcho builtin
2 parents b7b3439 + e5242d2 commit cda1ecd

File tree

3 files changed

+27
-8
lines changed

3 files changed

+27
-8
lines changed

unison-runtime/src/Unison/Runtime/Builtin.hs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,11 +1015,10 @@ set'echo :: ForeignOp
10151015
set'echo instr =
10161016
([BX, BX],)
10171017
. TAbss [arg1, arg2]
1018-
. unenum 2 arg2 Ty.booleanRef bol
1019-
. TLetD result UN (TFOp instr [arg1, bol])
1018+
. TLetD result UN (TFOp instr [arg1, arg2])
10201019
$ outIoFailUnit stack1 stack2 stack3 unit fail result
10211020
where
1022-
(arg1, arg2, bol, stack1, stack2, stack3, unit, fail, result) = fresh
1021+
(arg1, arg2, stack1, stack2, stack3, unit, fail, result) = fresh
10231022

10241023
-- a -> IOMode -> ...
10251024
inIomr :: forall v. (Var v) => v -> v -> v -> v -> ANormal v -> ForeignFunc -> ([Mem], ANormal v)

unison-runtime/src/Unison/Runtime/Stack.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1181,7 +1181,7 @@ peekOffBool stk i = do
11811181
b <- bpeekOff stk i
11821182
pure $ case b of
11831183
Enum _ t -> t /= TT.falseTag
1184-
_ -> error "peekBool: not a boolean"
1184+
_ -> error "peekOffBool: not a boolean"
11851185
{-# INLINE peekOffBool #-}
11861186

11871187
peekOffS :: Stack -> Int -> IO USeq

unison-src/transcripts/idempotent/io.md

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,14 @@ testSeek _ =
319319
320320
runTest test
321321
322+
testSetEcho : '{io2.IO} [Result]
323+
testSetEcho = do
324+
a = setEcho.impl (stdHandle StdErr) true
325+
b = setEcho.impl (stdHandle StdErr) false
326+
match (a, b) with
327+
(Right _, Right _) -> [ Ok "setEcho works" ]
328+
_ -> [ Fail "setEcho failure" ]
329+
322330
testAppend : '{io2.IO} [Result]
323331
testAppend _ =
324332
test = 'let
@@ -352,17 +360,19 @@ testAppend _ =
352360
353361
⍟ These new definitions are ok to `add`:
354362
355-
testAppend : '{IO} [Result]
356-
testSeek : '{IO} [Result]
363+
testAppend : '{IO} [Result]
364+
testSeek : '{IO} [Result]
365+
testSetEcho : '{IO} [Result]
357366
```
358367

359368
``` ucm
360369
scratch/main> add
361370
362371
⍟ I've added these definitions:
363372
364-
testAppend : '{IO} [Result]
365-
testSeek : '{IO} [Result]
373+
testAppend : '{IO} [Result]
374+
testSeek : '{IO} [Result]
375+
testSetEcho : '{IO} [Result]
366376
367377
scratch/main> io.test testSeek
368378
@@ -380,6 +390,16 @@ scratch/main> io.test testSeek
380390
381391
Tip: Use view 1 to view the source of a test.
382392
393+
scratch/main> io.test testSetEcho
394+
395+
New test results:
396+
397+
1. testSetEcho ◉ setEcho works
398+
399+
✅ 1 test(s) passing
400+
401+
Tip: Use view 1 to view the source of a test.
402+
383403
scratch/main> io.test testAppend
384404
385405
New test results:

0 commit comments

Comments
 (0)