mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-24 04:09:10 +03:00
[ fix ] Add missing cases for BITS types in extractInt
e79e4277
("[ fix ] Make Bits types use int switch statement in RefC")
made the RefC backend generate code calling `extractInt` with Bits
types, bit did not add the extra cases to `extractInt`. This commit adds
the missing cases.
Fixes #2452
This commit is contained in:
parent
7618491536
commit
7a5f63eab0
@ -69,6 +69,14 @@ Value *tailcall_apply_closure(Value *_clos, Value *arg) {
|
||||
|
||||
int extractInt(Value *v) {
|
||||
switch (v->header.tag) {
|
||||
case BITS8_TAG:
|
||||
return (int)((Value_Bits8 *)v)->ui8;
|
||||
case BITS16_TAG:
|
||||
return (int)((Value_Bits16 *)v)->ui16;
|
||||
case BITS32_TAG:
|
||||
return (int)((Value_Bits32 *)v)->ui32;
|
||||
case BITS64_TAG:
|
||||
return (int)((Value_Bits64 *)v)->ui64;
|
||||
case INT8_TAG:
|
||||
return (int)((Value_Int8 *)v)->i8;
|
||||
case INT16_TAG:
|
||||
|
9
tests/refc/issue2452/BitsCase.idr
Normal file
9
tests/refc/issue2452/BitsCase.idr
Normal file
@ -0,0 +1,9 @@
|
||||
x : Bits8
|
||||
x = 0
|
||||
|
||||
main : IO ()
|
||||
main = do
|
||||
putStrLn $
|
||||
case x of
|
||||
0 => "good"
|
||||
_ => "bad"
|
1
tests/refc/issue2452/expected
Normal file
1
tests/refc/issue2452/expected
Normal file
@ -0,0 +1 @@
|
||||
good
|
4
tests/refc/issue2452/run
Normal file
4
tests/refc/issue2452/run
Normal file
@ -0,0 +1,4 @@
|
||||
rm -rf build
|
||||
|
||||
$1 --no-banner --no-color --console-width 0 --cg refc -o bits_case BitsCase.idr > /dev/null
|
||||
./build/exec/bits_case
|
Loading…
Reference in New Issue
Block a user