make tests green again
This commit is contained in:
@@ -730,7 +730,7 @@ folded_else :: { [Instruction] }
|
||||
|
||||
folded_call_indirect :: { [Instruction] }
|
||||
: ')' { [PlainInstr $ CallIndirect $ AnonimousTypeUse $ FuncType [] []] }
|
||||
| '(' folded_call_indirect_typeuse { (PlainInstr $ CallIndirect $ fst $2) : snd $2 }
|
||||
| '(' folded_call_indirect_typeuse { snd $2 ++ [PlainInstr $ CallIndirect $ fst $2] }
|
||||
|
||||
folded_call_indirect_typeuse :: { (TypeUse, [Instruction]) }
|
||||
: 'type' typeidx ')' folded_call_indirect_functype {
|
||||
|
||||
@@ -364,7 +364,7 @@ unify (f `Arrow` t) (f' `Arrow` t') = unify' (f `Arrow` reverse t) (reverse f' `
|
||||
unify' (f `Arrow` (Val v':t)) ((Val v:f') `Arrow` t') =
|
||||
if v == v'
|
||||
then unify' (f `Arrow` t) (f' `Arrow` t')
|
||||
else Debug.trace ("type err " ++ show v' ++ " - " ++ show v) $ throwError TypeMismatch
|
||||
else throwError TypeMismatch
|
||||
unify' (f `Arrow` (Var r:t)) ((Val v:f') `Arrow` t') =
|
||||
let subst = replace (Var r) (Val v) in
|
||||
unify' (subst f `Arrow` subst t) (f' `Arrow` t')
|
||||
@@ -433,7 +433,7 @@ isFunctionValid Function {funcType, locals, body} mod@Module {types} =
|
||||
Right arr ->
|
||||
if isArrowMatch arr (empty ==> results)
|
||||
then Valid
|
||||
else Debug.trace ("fun err " ++ show arr ++ " - " ++ show (empty ==> results)) $ TypeMismatch
|
||||
else TypeMismatch
|
||||
|
||||
functionsShouldBeValid :: Validator
|
||||
functionsShouldBeValid mod@Module {functions} =
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ compile file = do
|
||||
main :: IO ()
|
||||
main = do
|
||||
files <- Directory.listDirectory "tests/samples"
|
||||
-- let files = ["call_indirect.wast", "br_table.wast", "br.wast"]
|
||||
-- let files = ["call_indirect.wast"]
|
||||
-- compile "fact.wast"
|
||||
syntaxTestCases <- (`mapM` files) $ \file -> do
|
||||
content <- LBS.readFile $ "tests/samples/" ++ file
|
||||
|
||||
Reference in New Issue
Block a user