diff --git a/semantic.cabal b/semantic.cabal index 6692454d2..a228f3fdf 100644 --- a/semantic.cabal +++ b/semantic.cabal @@ -53,7 +53,6 @@ library , Control.Rewriting -- Datatypes for abstract interpretation , Data.Abstract.Address.Hole - , Data.Abstract.Address.Located , Data.Abstract.Address.Monovariant , Data.Abstract.Address.Precise , Data.Abstract.BaseError @@ -349,7 +348,7 @@ test-suite test , Reprinting.Spec , Rewriting.Go.Spec , Rewriting.JSON.Spec - , Rewriting.Python.Spec + , Rewriting.Python.Spec , Rendering.TOC.Spec , Semantic.Spec , Semantic.CLI.Spec diff --git a/src/Analysis/Abstract/Graph.hs b/src/Analysis/Abstract/Graph.hs index 90f455dcd..29825f070 100644 --- a/src/Analysis/Abstract/Graph.hs +++ b/src/Analysis/Abstract/Graph.hs @@ -20,8 +20,6 @@ import Algebra.Graph.Export.Dot hiding (vertexName) import Control.Abstract hiding (Function(..)) import Control.Effect.Carrier import Control.Effect.Sum -import Data.Abstract.Address.Hole -import Data.Abstract.Address.Located import Data.Abstract.BaseError import Data.Abstract.Declarations import Data.Abstract.Module (Module (moduleInfo), ModuleInfo (..)) @@ -65,24 +63,22 @@ style = (defaultStyle (T.encodeUtf8Builder . vertexIdentifier)) graphingTerms :: ( Member (Reader ModuleInfo) sig , Member (Reader Span) sig , Member (State (Graph ControlFlowVertex)) sig - , Member (State (Map (Slot hole) ControlFlowVertex)) sig - , Member (State (Heap hole hole value)) sig - , Member (State (ScopeGraph (Hole context (Located address)))) sig - , Member (Resumable (BaseError (ScopeError hole))) sig - , Member (Resumable (BaseError (HeapError hole))) sig - , Member (Reader (CurrentFrame hole)) sig - , Member (Reader (CurrentScope hole)) sig + , Member (State (Map (Slot address) ControlFlowVertex)) sig + , Member (State (Heap address address value)) sig + , Member (State (ScopeGraph address)) sig + , Member (Resumable (BaseError (ScopeError address))) sig + , Member (Resumable (BaseError (HeapError address))) sig + , Member (Reader (CurrentFrame address)) sig + , Member (Reader (CurrentScope address)) sig , Member (Reader ControlFlowVertex) sig , VertexDeclaration syntax , Declarations1 syntax , Ord address - , Ord context , Foldable syntax - , hole ~ Hole context (Located address) , term ~ Term syntax Location , Carrier sig m ) - => Open (term -> Evaluator term hole value m a) + => Open (term -> Evaluator term address value m a) graphingTerms recur term@(Term (In a syntax)) = do definedInModule <- currentModule case toVertex a definedInModule syntax of diff --git a/src/Data/Abstract/Address/Located.hs b/src/Data/Abstract/Address/Located.hs deleted file mode 100644 index 4604c77e1..000000000 --- a/src/Data/Abstract/Address/Located.hs +++ /dev/null @@ -1,48 +0,0 @@ -{-# LANGUAGE LambdaCase, TypeOperators, UndecidableInstances #-} -module Data.Abstract.Address.Located -( Located(..) -) where - -import Control.Abstract -import Control.Effect.Carrier -import Control.Effect.Sum -import Data.Abstract.Module (ModuleInfo) -import Data.Abstract.Name -import Data.Abstract.Package (PackageInfo) - -data Located address = Located - { address :: address - , addressPackage :: {-# UNPACK #-} !PackageInfo - , addressModule :: !ModuleInfo - , addressName :: Name - , addressSpan :: Span - } - deriving (Eq, Ord, Show) - - -promoteA :: AllocatorC address m a -> AllocatorC (Located address) m a -promoteA = AllocatorC . runAllocatorC - -instance ( Carrier (Allocator address :+: sig) (AllocatorC address m) - , Carrier sig m - , Member (Reader ModuleInfo) sig - , Member (Reader PackageInfo) sig - , Member (Reader Span) sig - , Monad m - ) - => Carrier (Allocator (Located address) :+: sig) (AllocatorC (Located address) m) where - ret = promoteA . ret - eff = handleSum - (AllocatorC . eff . handleCoercible) - (\ (Alloc name k) -> Located <$> promoteA (eff (L (Alloc name ret))) <*> currentPackage <*> currentModule <*> pure name <*> ask >>= k) - - -promoteD :: DerefC address value m a -> DerefC (Located address) value m a -promoteD = DerefC . runDerefC - -instance (Carrier (Deref value :+: sig) (DerefC address value m), Carrier sig m, Monad m) - => Carrier (Deref value :+: sig) (DerefC (Located address) value m) where - ret = promoteD . ret - eff = handleSum (DerefC . eff . handleCoercible) (\case - DerefCell cell k -> promoteD (eff (L (DerefCell cell ret))) >>= k - AssignCell value cell k -> promoteD (eff (L (AssignCell value cell ret))) >>= k) diff --git a/src/Semantic/Graph.hs b/src/Semantic/Graph.hs index 246d289b2..5ccf200d2 100644 --- a/src/Semantic/Graph.hs +++ b/src/Semantic/Graph.hs @@ -34,7 +34,6 @@ import Analysis.Abstract.Graph as Graph import Control.Abstract hiding (String) import Control.Abstract.PythonPackage as PythonPackage import Data.Abstract.Address.Hole as Hole -import Data.Abstract.Address.Located as Located import Data.Abstract.Address.Monovariant as Monovariant import Data.Abstract.Address.Precise as Precise import Data.Abstract.BaseError (BaseError (..)) @@ -114,7 +113,7 @@ runCallGraph :: ( VertexDeclarationWithStrategy (VertexDeclarationStrategy synta runCallGraph lang includePackages modules package = fmap (simplify . fst) . runEvaluator - . graphing @_ @_ @_ @(Hole (Maybe Name) (Located Monovariant)) @Abstract + . graphing @_ @_ @_ @(Hole (Maybe Name) Monovariant) @Abstract . runHeap . runScopeGraph . caching