forked from GitHub/haskell-wasm
more green test
This commit is contained in:
@@ -952,7 +952,7 @@ eval budget store FunctionInstance { funcType, moduleInstance, code = Function {
|
||||
let dest = fromIntegral d
|
||||
let len = fromIntegral n
|
||||
dropped <- readIORef isDropped
|
||||
if dropped || src + len > LBS.length bytes || dest + len > size
|
||||
if (dropped && len > 0) || src + len > LBS.length bytes || dest + len > size
|
||||
then return Trap
|
||||
else do
|
||||
mapM_ (uncurry $ ByteArray.writeByteArray memory) $ zip [fromIntegral d..] $
|
||||
@@ -978,7 +978,7 @@ eval budget store FunctionInstance { funcType, moduleInstance, code = Function {
|
||||
isDropped <- readIORef dropFlag
|
||||
if src + len > Vector.length refs
|
||||
|| dst + len > MVector.length els
|
||||
|| isDropped
|
||||
|| (isDropped && len > 0)
|
||||
|| isDeclarative mode
|
||||
then return Trap
|
||||
else do
|
||||
|
||||
@@ -550,9 +550,15 @@ getExpressionTypeWithInput inp = fmap (inp `Arrow`) . foldM go inp
|
||||
if isRef v
|
||||
then throwError $ TypeMismatch (empty ==> empty) (empty ==> empty)
|
||||
else matchStack stack (subst args) (subst res)
|
||||
matchStack (Var:stack) (NonRefVar:args) res =
|
||||
let subst = replace NonRefVar NonRefVar in
|
||||
matchStack stack (subst args) (subst res)
|
||||
matchStack (NonRefVar:stack) (Var:args) res =
|
||||
let subst = replace Var NonRefVar in
|
||||
matchStack stack (subst args) (subst res)
|
||||
matchStack stack [] res = return $ res ++ stack
|
||||
matchStack [] args res = throwError $ TypeMismatch ((reverse args) `Arrow` res) ([] `Arrow` [])
|
||||
matchStack _ _ _ = error "inconsistent checker state"
|
||||
matchStack st args res = error $ "inconsistent checker state: " ++ show (st, args, res)
|
||||
|
||||
getExpressionType :: Expression -> Checker Arrow
|
||||
getExpressionType = getExpressionTypeWithInput []
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ main = do
|
||||
files <-
|
||||
filter (not . List.isPrefixOf "simd") . filter (List.isSuffixOf ".wast")
|
||||
<$> Directory.listDirectory "tests/spec"
|
||||
-- let files = ["imports.wast"]
|
||||
-- let files = ["unreached-valid.wast"]
|
||||
scriptTestCases <- (`mapM` files) $ \file -> do
|
||||
test <- LBS.readFile ("tests/spec/" ++ file)
|
||||
return $ testCase file $ do
|
||||
|
||||
Reference in New Issue
Block a user