mirror of
https://github.com/anoma/juvix.git
synced 2024-12-03 09:41:10 +03:00
eb5b2e4595
* Closes #2954 * The problem was that the type validation algorithm was too strict for higher-order functions with a dynamic (unknown) target.
27 lines
842 B
Haskell
27 lines
842 B
Haskell
module Tree.Asm.Base where
|
|
|
|
import Asm.Run.Base qualified as Asm
|
|
import Base
|
|
import Juvix.Compiler.Asm.Translation.FromTree qualified as Asm
|
|
import Juvix.Compiler.Tree.Pipeline qualified as Tree
|
|
import Juvix.Compiler.Tree.Translation.FromSource
|
|
import Juvix.Data.PPOutput
|
|
|
|
treeAsmAssertion ::
|
|
Path Abs File ->
|
|
Path Abs File ->
|
|
(String -> IO ()) ->
|
|
Assertion
|
|
treeAsmAssertion mainFile expectedFile step = do
|
|
step "Parse"
|
|
s <- readFile mainFile
|
|
case runParser mainFile s of
|
|
Left err -> assertFailure (prettyString err)
|
|
Right tabIni -> do
|
|
step "Translate"
|
|
case run $ runError @JuvixError $ Tree.toAsm tabIni of
|
|
Left err -> assertFailure (prettyString (fromJuvixError @GenericError err))
|
|
Right tab -> do
|
|
let tab' = Asm.fromTree tab
|
|
Asm.asmRunAssertion' tab' expectedFile step
|