2023-11-12 18:23:33 +03:00
|
|
|
module Typecheck.PositiveNew where
|
|
|
|
|
|
|
|
import Base
|
|
|
|
import Data.HashSet qualified as HashSet
|
2023-11-16 18:19:52 +03:00
|
|
|
import Juvix.Data.Effect.TaggedLock
|
2023-11-12 18:23:33 +03:00
|
|
|
import Typecheck.Positive qualified as Old
|
|
|
|
|
|
|
|
root :: Path Abs Dir
|
|
|
|
root = relToProject $(mkRelDir "tests/positive")
|
|
|
|
|
|
|
|
posTest :: String -> Path Rel Dir -> Path Rel File -> Old.PosTest
|
|
|
|
posTest _name rdir rfile =
|
|
|
|
let _dir = root <//> rdir
|
|
|
|
_file = _dir <//> rfile
|
|
|
|
in Old.PosTest {..}
|
|
|
|
|
|
|
|
testDescr :: Old.PosTest -> TestDescr
|
|
|
|
testDescr Old.PosTest {..} =
|
|
|
|
TestDescr
|
|
|
|
{ _testName = _name,
|
|
|
|
_testRoot = _dir,
|
|
|
|
_testAssertion = Single $ do
|
2023-11-16 18:19:52 +03:00
|
|
|
entryPoint <- set entryPointNewTypeCheckingAlgorithm True <$> defaultEntryPointIO' LockModeExclusive _dir _file
|
|
|
|
(void . runIOExclusive entryPoint) upToInternalTyped
|
2023-11-12 18:23:33 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
allTests :: TestTree
|
|
|
|
allTests =
|
|
|
|
testGroup
|
|
|
|
"New typechecker positive tests"
|
|
|
|
[ testGroup
|
|
|
|
"New typechecker General typechecking tests"
|
2023-11-15 12:24:54 +03:00
|
|
|
(map (mkTest . testDescr) (filter (not . isIgnored) (extraTests <> Old.tests)))
|
2023-11-12 18:23:33 +03:00
|
|
|
]
|
|
|
|
|
|
|
|
isIgnored :: Old.PosTest -> Bool
|
|
|
|
isIgnored t = HashSet.member (t ^. Old.name) ignored
|
|
|
|
|
2023-11-15 12:24:54 +03:00
|
|
|
extraTests :: [Old.PosTest]
|
2023-11-28 18:43:14 +03:00
|
|
|
extraTests = []
|
2023-11-15 12:24:54 +03:00
|
|
|
|
2023-11-12 18:23:33 +03:00
|
|
|
-- | Default values are not supported by the new type checker at the moment
|
|
|
|
ignored :: HashSet String
|
|
|
|
ignored =
|
|
|
|
HashSet.fromList
|
2023-11-23 13:42:58 +03:00
|
|
|
[ "Test070: Nested default values and named arguments",
|
2023-11-28 18:43:14 +03:00
|
|
|
"Test071: Named application (Ord instance with default cmp)",
|
2023-11-12 18:23:33 +03:00
|
|
|
-- This test does not pass with the new hole insertion algorithm
|
|
|
|
"Test046: Polymorphic type arguments"
|
|
|
|
]
|