Skip to content

Commit

Permalink
make the output deterministic
Browse files Browse the repository at this point in the history
  • Loading branch information
gelisam committed Feb 3, 2025
1 parent 8c6a1fb commit 45d119e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion examples/non-examples/type-errors/not-a-function.golden
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Type mismatch at not-a-function.kl:3.11-3.13.
Expected (Integer → META(MetaPtr 53790)) but got Integer
Expected (Integer → ?1) but got Integer
10 changes: 9 additions & 1 deletion src/Pretty.hs
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,15 @@ instance Pretty VarInfo TypeConstructor where
pp _ TType = pure $ text "Type"
pp env (TDatatype t) = pp env t
pp _ (TSchemaVar n) = pure $ text $ typeVarNames !! fromIntegral n
pp _ (TMetaVar v) = pure $ text "META" <> viaShow v -- TODO
pp _ (TMetaVar v) = do
renumbering <- get
case St.lookup v renumbering of
Just n -> do
pure $ text "?" <> viaShow n
Nothing -> do
let n = St.size renumbering + 1
put (St.insert v n renumbering)
pure $ text "?" <> viaShow n

instance Pretty VarInfo a => Pretty VarInfo (TyF a) where
pp _ (TyF TFun []) = pure $ parens (text "")
Expand Down

0 comments on commit 45d119e

Please sign in to comment.