1
1
mirror of https://github.com/github/semantic.git synced 2024-12-25 07:55:12 +03:00

Correct the term type.

This commit is contained in:
Rob Rix 2019-10-23 10:21:06 -04:00
parent 0651d21e63
commit 6b6574eb56
No known key found for this signature in database
GPG Key ID: F188A01508EA1CF7

View File

@ -14,11 +14,10 @@ import Data.Abstract.Number as Number
import Data.Abstract.Package (PackageInfo (..))
import Data.Abstract.Value.Concrete as Concrete
import qualified Data.Language as Language
import Data.Quieterm
import Data.Scientific (scientific)
import Data.Sum
import Data.Text (pack)
import qualified Language.TypeScript.Assignment as TypeScript
import qualified Language.TypeScript.Term as TypeScript
import Source.Loc
import SpecHelpers
@ -176,7 +175,7 @@ spec = do
it "member access of private methods throws AccessControlError" $ do
(_, (_, res)) <- evaluate ["access_control/adder.ts", "access_control/private_method.ts"]
let expected = Left (SomeError (inject @TypeScriptEvalError (BaseError (ModuleInfo "private_method.ts" Language.TypeScript mempty) (Span (Pos 4 1) (Pos 4 16)) (AccessControlError ("foo", ScopeGraph.Public) ("private_add", ScopeGraph.Private) (Closure (PackageInfo "access_control" mempty) (ModuleInfo "adder.ts" Language.TypeScript mempty) (Just "private_add") Nothing [] (Right (Quieterm (In (Loc (Range 146 148) (Span (Pos 7 27) (Pos 7 29))) (inject (StatementBlock []))))) (Precise 20) (Precise 18))))))
let expected = Left (SomeError (inject @TypeScriptEvalError (BaseError (ModuleInfo "private_method.ts" Language.TypeScript mempty) (Span (Pos 4 1) (Pos 4 16)) (AccessControlError ("foo", ScopeGraph.Public) ("private_add", ScopeGraph.Private) (Closure (PackageInfo "access_control" mempty) (ModuleInfo "adder.ts" Language.TypeScript mempty) (Just "private_add") Nothing [] (Right (TypeScript.Term (In (Loc (Range 146 148) (Span (Pos 7 27) (Pos 7 29))) (inject (StatementBlock []))))) (Precise 20) (Precise 18))))))
res `shouldBe` expected
where
@ -184,5 +183,4 @@ spec = do
evaluate = evalTypeScriptProject . map (fixtures <>)
evalTypeScriptProject = testEvaluating <=< (evaluateProject' ?session (Proxy :: Proxy 'Language.TypeScript) typescriptParser)
type TypeScriptTerm = Quieterm (Sum TypeScript.Syntax) Loc
type TypeScriptEvalError = BaseError (EvalError TypeScriptTerm Precise (Concrete.Value TypeScriptTerm Precise))
type TypeScriptEvalError = BaseError (EvalError (TypeScript.Term Loc) Precise (Concrete.Value (TypeScript.Term Loc) Precise))