From 16b0eea5684a8371c6884ea1a560dd975bb44419 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Tue, 28 Dec 2021 13:38:19 +0100 Subject: [PATCH] code cleanup --- src/compiler/GF/Command/SourceCommands.hs | 2 +- src/compiler/GF/Compile/TypeCheck/Concrete.hs | 7 +------ src/compiler/GF/Grammar/Lookup.hs | 2 -- src/compiler/GF/Grammar/Macros.hs | 6 ------ src/compiler/GF/Grammar/Predef.hs | 2 -- src/compiler/GF/Infra/Option.hs | 2 +- src/compiler/GF/Interactive.hs | 1 - 7 files changed, 3 insertions(+), 19 deletions(-) diff --git a/src/compiler/GF/Command/SourceCommands.hs b/src/compiler/GF/Command/SourceCommands.hs index 2c505d4db..578dcab71 100644 --- a/src/compiler/GF/Command/SourceCommands.hs +++ b/src/compiler/GF/Command/SourceCommands.hs @@ -255,7 +255,7 @@ checkComputeTerm os sgr t = do mo <- maybe (checkError (pp "no source grammar in scope")) return $ greatestResource sgr t <- renameSourceTerm sgr mo t - (t,_) <- inferLType sgr [] t + (t,_) <- inferLType sgr [] t fmap evalStr (normalForm sgr t) where -- ** Try to compute pre{...} tokens in token sequences diff --git a/src/compiler/GF/Compile/TypeCheck/Concrete.hs b/src/compiler/GF/Compile/TypeCheck/Concrete.hs index 521c9d6d6..a0412d1b7 100644 --- a/src/compiler/GF/Compile/TypeCheck/Concrete.hs +++ b/src/compiler/GF/Compile/TypeCheck/Concrete.hs @@ -844,12 +844,7 @@ ppType ty = _ -> ppTerm Unqualified 0 ty Prod _ x a b -> ppType a <+> "->" <+> ppType b _ -> ppTerm Unqualified 0 ty -{- -ppqType :: Type -> Type -> Doc -ppqType t u = case (ppType t, ppType u) of - (pt,pu) | render pt == render pu -> ppTerm Qualified 0 t - (pt,_) -> pt --} + checkLookup :: Ident -> Context -> Check Type checkLookup x g = case [ty | (b,y,ty) <- g, x == y] of diff --git a/src/compiler/GF/Grammar/Lookup.hs b/src/compiler/GF/Grammar/Lookup.hs index 306def2cb..e04965967 100644 --- a/src/compiler/GF/Grammar/Lookup.hs +++ b/src/compiler/GF/Grammar/Lookup.hs @@ -41,8 +41,6 @@ import GF.Grammar.Predef import GF.Grammar.Lockfield import Data.List (sortBy) ---import Data.Maybe (maybe) ---import Control.Monad import GF.Text.Pretty import qualified Data.Map as Map diff --git a/src/compiler/GF/Grammar/Macros.hs b/src/compiler/GF/Grammar/Macros.hs index 5df554957..7d083fbe3 100644 --- a/src/compiler/GF/Grammar/Macros.hs +++ b/src/compiler/GF/Grammar/Macros.hs @@ -152,12 +152,6 @@ isVariable :: Term -> Bool isVariable (Vr _ ) = True isVariable _ = False ---eqIdent :: Ident -> Ident -> Bool ---eqIdent = (==) - -uType :: Type -uType = Cn cUndefinedType - -- *** Assignment assign :: Label -> Term -> Assign diff --git a/src/compiler/GF/Grammar/Predef.hs b/src/compiler/GF/Grammar/Predef.hs index e330f583c..882d374fa 100644 --- a/src/compiler/GF/Grammar/Predef.hs +++ b/src/compiler/GF/Grammar/Predef.hs @@ -23,12 +23,10 @@ cPredef = moduleNameS "Predef" cInt = identS "Int" cFloat = identS "Float" cString = identS "String" -cVar = identS "__gfVar" cInts = identS "Ints" cPBool = identS "PBool" cErrorType = identS "Error" cOverload = identS "overload" -cUndefinedType = identS "UndefinedType" cNonExist = identS "nonExist" cBIND = identS "BIND" cSOFT_BIND = identS "SOFT_BIND" diff --git a/src/compiler/GF/Infra/Option.hs b/src/compiler/GF/Infra/Option.hs index a2af18188..6ee81ea1d 100644 --- a/src/compiler/GF/Infra/Option.hs +++ b/src/compiler/GF/Infra/Option.hs @@ -269,7 +269,7 @@ defaultFlags = Flags { optBlank = Nothing, optSISR = Nothing, optHaskellOptions = Set.empty, - optLiteralCats = Set.fromList [cString,cInt,cFloat,cVar], + optLiteralCats = Set.fromList [cString,cInt,cFloat], optLexicalCats = Set.empty, optGFODir = Nothing, optOutputDir = Nothing, diff --git a/src/compiler/GF/Interactive.hs b/src/compiler/GF/Interactive.hs index 22145e5e7..e925adce8 100644 --- a/src/compiler/GF/Interactive.hs +++ b/src/compiler/GF/Interactive.hs @@ -13,7 +13,6 @@ import GF.Command.Help(helpCommand) import GF.Command.Abstract import GF.Command.Parse(readCommandLine,pCommand,readTransactionCommand) import GF.Compile.Rename(renameSourceTerm) -import GF.Compile.CheckGrammar(linTypeOfType) import GF.Compile.TypeCheck.Concrete(inferLType) import GF.Compile.GeneratePMCFG(pmcfgForm) import GF.Data.Operations (Err(..))