Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

L2 typechecking error from a packed type #206

Open
jazullo opened this issue Mar 30, 2023 · 0 comments
Open

L2 typechecking error from a packed type #206

jazullo opened this issue Mar 30, 2023 · 0 comments

Comments

@jazullo
Copy link
Collaborator

jazullo commented Mar 30, 2023

Consider this code. This comes from taking the red-black tree implementation and converting the packed Ord type + case expressions to integers + chained if-elses. This produces the following error:

~/gibbon$ cabal v2-exec gibbon -- --packed --no-gc --to-exe ../llrbt/rbtree2.hs
gibbon: Error typechecking L2 Program
In the expression:
IfE (VarE "fltIf_1312_1410")
    (LetE (cpy_2157,
           [],
           PackedTy "B" "loc_2151",
           AppE "_copy_B" [case_2115,loc_2151] [VarE "colorx_211_1008_1404"])
          (Ext (LetLocE "loc_2152"
                        (AfterVariableLE "cpy_2157" "loc_2151" True)
                        (LetE (cpy_2158,
                               [],
                               PackedTy "I" "loc_2152",
                               AppE "_copy_I" [case_2116,loc_2152] [VarE "x_212_1009_1405"])
                              (Ext (LetLocE "loc_2153"
                                            (AfterVariableLE "cpy_2158" "loc_2152" True)
                                            (LetE (fltPkd_1313_1411,
                                                   [],
                                                   PackedTy "RBT" "loc_2153",
                                                   AppE "insert"
                                                        [loc_1782,case_2117,loc_2153]
                                                        [VarE "e1_209_1006_1402",
                                                         VarE "left_213_1010_1406"])
                                                  (Ext (LetLocE "loc_2154"
                                                                (AfterVariableLE "fltPkd_1313_1411"
                                                                                 "loc_2153"
                                                                                 True)
                                                                (LetE (right_214_1011_1407_1734,
                                                                       [],
                                                                       PackedTy "RBT" "loc_2154",
                                                                       AppE "_copy_RBT"
                                                                            [case_2118,loc_2154]
                                                                            [VarE "right_214_1011_1407"])
                                                                      (DataConE "datacon_2150"
                                                                                "Node"
                                                                                [VarE "cpy_2157",
                                                                                 VarE "cpy_2158",
                                                                                 VarE "fltPkd_1313_1411",
                                                                                 VarE "right_214_1011_1407_1734"])))))))))))
    (VarE "t_210_1007_1403")
Expected these types to be the same: PackedTy "RBT" (Var "datacon_2150"), PackedTy "RBT" (Var "loc_1783")

CallStack (from HasCallStack):
  error, called at src/Gibbon/L2/Typecheck.hs:948:23 in gibbon-0.2-inplace:Gibbon.L2.Typecheck

Evidently there is a problem with disagreeing versions of the RBT type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant