Skip to content

Commit 5fa272b

Browse files
committed
Read import hashes correctly
Need to use the 8 byte version of Ints for the shortcut version of reading TTCs too, otherwise we'll read the wrong hash and build things unnecessarily.
1 parent 5aba3b4 commit 5fa272b

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/Core/Binary.idr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ getImportHashes : String -> Ref Bin Binary ->
495495
getImportHashes file b
496496
= do hdr <- fromBuf {a = String} b
497497
when (hdr /= "TT2") $ corrupt ("TTC header in " ++ file ++ " " ++ show hdr)
498-
ver <- fromBuf {a = Int} b
498+
ver <- fromBuf @{Wasteful} b
499499
checkTTCVersion file ver ttcVersion
500500
ifaceHash <- fromBuf {a = Int} b
501501
fromBuf b
@@ -504,7 +504,7 @@ getHash : String -> Ref Bin Binary -> Core Int
504504
getHash file b
505505
= do hdr <- fromBuf {a = String} b
506506
when (hdr /= "TT2") $ corrupt ("TTC header in " ++ file ++ " " ++ show hdr)
507-
ver <- fromBuf {a = Int} b
507+
ver <- fromBuf @{Wasteful} b
508508
checkTTCVersion file ver ttcVersion
509509
fromBuf b
510510

tests/idris2/import001/expected

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,5 @@
44
Test> S (S (S (S (S (S (S (S (S (S (S (S (S (S (S (S (S (S Z)))))))))))))))))
55
Test> Bye for now!
66
2/3: Building Mult (Mult.idr)
7-
3/3: Building Test (Test.idr)
87
Test> S (S (S (S (S (S (S (S (S (S (S (S (S (S (S (S (S (S Z)))))))))))))))))
98
Test> Bye for now!

0 commit comments

Comments
 (0)