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