Skip to content

Commit aa10739

Browse files
authored
Quote constants in Nock increment optimization (#3400)
* In #3395 I forgot to quote the atoms. This PR fixes the omission.
1 parent f390420 commit aa10739

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Juvix/Compiler/Nockma/Translation/FromTree.hs

+3-2
Original file line numberDiff line numberDiff line change
@@ -982,8 +982,9 @@ compile = \case
982982

983983
goAdd :: [Term Natural] -> Sem r (Term Natural)
984984
goAdd = \case
985-
[arg, TAtom 1] -> return $ OpInc # arg
986-
[TAtom 1, arg] -> return $ OpInc # arg
985+
-- remember that 1 is quoted: we match [quote 1]
986+
[arg, TCell (TAtom 1) (TAtom 1)] -> return $ OpInc # arg
987+
[TCell (TAtom 1) (TAtom 1), arg] -> return $ OpInc # arg
987988
args -> callStdlib StdlibAdd args
988989

989990
goAllocClosure :: Tree.NodeAllocClosure -> Sem r (Term Natural)

0 commit comments

Comments
 (0)