mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-09 04:59:31 -06:00
Fix an old name shadowing bug in concrete syntax by removing the refresh pass
The refresh pass does not correctly keep track of the scope of local variables and can convert things like \x->(\x->x) x into \x1->(\x2->x2) x2. Fortunately, it appears that the refresh pass is not needed anymore, so it has been removed.
This commit is contained in:
2
gf.cabal
2
gf.cabal
@@ -184,7 +184,7 @@ executable gf
|
||||
GF.Grammar.Binary
|
||||
GF.Compile.Update
|
||||
GF.Compile.CheckGrammar
|
||||
GF.Compile.Refresh
|
||||
-- GF.Compile.Refresh
|
||||
GF.Compile.Rename
|
||||
GF.Compile.ReadFiles
|
||||
GF.Compile.GrammarToPGF
|
||||
|
||||
@@ -12,7 +12,7 @@ import GF.Compile.GeneratePMCFG
|
||||
import GF.Compile.GrammarToPGF
|
||||
import GF.Compile.ReadFiles
|
||||
import GF.Compile.Update
|
||||
import GF.Compile.Refresh
|
||||
--import GF.Compile.Refresh
|
||||
import GF.Compile.Coding
|
||||
import GF.Compile.Tags
|
||||
|
||||
@@ -196,8 +196,10 @@ compileSourceModule opts env@(k,gr,_) mb_gfFile mo@(i,mi) = do
|
||||
if tagsFlag then generateTags k mo3 else compileCompleteModule k mo3
|
||||
where
|
||||
compileCompleteModule k mo3 = do
|
||||
(k',mo3r:_) <- runPass2 (head.snd) Refresh "refreshing" $
|
||||
refreshModule (k,gr) mo3
|
||||
-- (k',mo3r:_) <- runPass2 (head.snd) Refresh "refreshing" $
|
||||
-- refreshModule (k,gr) mo3
|
||||
let k' = k
|
||||
mo3r = mo3
|
||||
mo4 <- runPass2 id Optimize "optimizing" $ optimizeModule opts gr mo3r
|
||||
mo5 <- if isModCnc (snd mo4) && flag optPMCFG opts
|
||||
then runPass2' "generating PMCFG" $ generatePMCFG opts gr mb_gfFile mo4
|
||||
|
||||
@@ -24,7 +24,7 @@ import GF.Grammar.Printer
|
||||
import GF.Grammar.Predef
|
||||
import GF.Grammar.Macros
|
||||
import GF.Grammar.Lookup
|
||||
import GF.Compile.Refresh
|
||||
--import GF.Compile.Refresh
|
||||
import GF.Grammar.PatternMatch
|
||||
import GF.Grammar.Lockfield (isLockLabel,unlockRecord) ----
|
||||
|
||||
|
||||
@@ -18,14 +18,14 @@ import GF.Data.Operations
|
||||
import GF.Grammar.Grammar
|
||||
import GF.Infra.Ident
|
||||
import GF.Infra.Option
|
||||
import GF.Infra.Modules
|
||||
--import GF.Infra.Modules
|
||||
import GF.Data.Str
|
||||
import GF.Grammar.ShowTerm
|
||||
import GF.Grammar.Printer
|
||||
import GF.Grammar.Predef
|
||||
import GF.Grammar.Macros
|
||||
import GF.Grammar.Lookup
|
||||
import GF.Compile.Refresh
|
||||
--import GF.Compile.Refresh
|
||||
import GF.Grammar.PatternMatch
|
||||
import GF.Grammar.Lockfield (isLockLabel,unlockRecord) ----
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import GF.Grammar.Printer
|
||||
import GF.Grammar.Macros
|
||||
import GF.Grammar.Lookup
|
||||
import GF.Grammar.Predef
|
||||
import GF.Compile.Refresh
|
||||
--import GF.Compile.Refresh
|
||||
import GF.Compile.Compute.Concrete
|
||||
import GF.Compile.CheckGrammar
|
||||
import GF.Compile.Update
|
||||
|
||||
@@ -12,10 +12,10 @@
|
||||
-- (Description of the module)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
module GF.Compile.Refresh (refreshTerm, refreshTermN,
|
||||
refreshModule
|
||||
module GF.Compile.Refresh ({-refreshTermN, refreshTerm,
|
||||
refreshModule-}
|
||||
) where
|
||||
|
||||
{-
|
||||
import GF.Data.Operations
|
||||
import GF.Grammar.Grammar
|
||||
import GF.Infra.Ident
|
||||
@@ -143,3 +143,4 @@ inBlockSTM mo = do
|
||||
return v
|
||||
|
||||
|
||||
-}
|
||||
@@ -25,7 +25,7 @@ import GF.Infra.CheckM
|
||||
import GF.Grammar
|
||||
import GF.Grammar.Lookup
|
||||
import GF.Grammar.Unify
|
||||
import GF.Compile.Refresh
|
||||
--import GF.Compile.Refresh
|
||||
import GF.Compile.Compute.Abstract
|
||||
import GF.Compile.TypeCheck.TC
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import GF.Data.Operations
|
||||
import GF.Grammar.Grammar
|
||||
import GF.Grammar.Printer
|
||||
import GF.Infra.Ident
|
||||
import GF.Compile.Refresh
|
||||
--import GF.Compile.Refresh
|
||||
import GF.Grammar.Values
|
||||
----import GrammarST
|
||||
import GF.Grammar.Macros
|
||||
@@ -160,12 +160,12 @@ substitute v s = return . substTerm v s
|
||||
alphaConv :: [Var] -> (Var,Var) -> Exp -> Err Exp ---
|
||||
alphaConv oldvars (x,x') = substitute (x:x':oldvars) [(x,Vr x')]
|
||||
|
||||
alphaFresh :: [Var] -> Exp -> Err Exp
|
||||
alphaFresh vs = refreshTermN $ maxVarIndex vs
|
||||
--alphaFresh :: [Var] -> Exp -> Err Exp
|
||||
--alphaFresh vs = refreshTermN $ maxVarIndex vs
|
||||
|
||||
-- | done in a state monad
|
||||
alphaFreshAll :: [Var] -> [Exp] -> Err [Exp]
|
||||
alphaFreshAll vs = mapM $ alphaFresh vs
|
||||
--alphaFreshAll :: [Var] -> [Exp] -> Err [Exp]
|
||||
--alphaFreshAll vs = mapM $ alphaFresh vs
|
||||
|
||||
-- | for display
|
||||
val2exp :: Val -> Err Exp
|
||||
|
||||
Reference in New Issue
Block a user