From 88696e4666d9088e2a21ae5d4dba810457bc7986 Mon Sep 17 00:00:00 2001 From: Ilya Rezvov Date: Sun, 25 Feb 2018 16:12:56 -0800 Subject: [PATCH] make tests green again --- src/Language/Wasm/Parser.y | 2 +- src/Language/Wasm/Validate.hs | 4 ++-- tests/Test.hs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Language/Wasm/Parser.y b/src/Language/Wasm/Parser.y index d667611..aadd782 100644 --- a/src/Language/Wasm/Parser.y +++ b/src/Language/Wasm/Parser.y @@ -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 { diff --git a/src/Language/Wasm/Validate.hs b/src/Language/Wasm/Validate.hs index 330dd71..f9dfdf0 100644 --- a/src/Language/Wasm/Validate.hs +++ b/src/Language/Wasm/Validate.hs @@ -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} = diff --git a/tests/Test.hs b/tests/Test.hs index 2caaf6c..3c671b1 100644 --- a/tests/Test.hs +++ b/tests/Test.hs @@ -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