From cf90d1280f12aab2ea5f2d709819cf52f625a0ba Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Sat, 12 Sep 2026 10:29:06 +0200 Subject: [PATCH] categories in PredefCnc should also have lock fields --- src/compiler/api/GF/Grammar/Lockfield.hs | 6 +++--- src/compiler/api/GF/Grammar/Lookup.hs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/compiler/api/GF/Grammar/Lockfield.hs b/src/compiler/api/GF/Grammar/Lockfield.hs index da2056d67..7999a60dd 100644 --- a/src/compiler/api/GF/Grammar/Lockfield.hs +++ b/src/compiler/api/GF/Grammar/Lockfield.hs @@ -25,9 +25,9 @@ import GF.Data.Operations(ErrorMonad,Err(..)) lock :: Ident -> Term -> Term lock c t@(RecType rs) = let lbl = lockLabel c - in if elem lbl [l | (l,_,_)<-rs] || elem c [cString,cInt] - then t --- don't add an extra copy of lock field, nor predef cats - else RecType (rs ++ [(lbl, [], RecType [])]) + in if null [l | (l,_,_)<-rs, l == lbl] + then RecType (rs ++ [(lbl, [], RecType [])]) + else t --- don't add an extra copy of lock field, nor predef cats lock c t@(R rs) = let lbl = lockLabel c in if elem lbl (map fst rs) diff --git a/src/compiler/api/GF/Grammar/Lookup.hs b/src/compiler/api/GF/Grammar/Lookup.hs index 09c5ac53b..975426591 100644 --- a/src/compiler/api/GF/Grammar/Lookup.hs +++ b/src/compiler/api/GF/Grammar/Lookup.hs @@ -235,7 +235,7 @@ lookupAbsDef gr q@(m,c) = errIn (render ("looking up absdef of" <+> c)) $ do _ -> return Nothing lookupLincat :: ErrorMonad m => Grammar -> ModuleName -> Ident -> m Type -lookupLincat gr m c | isPredefCat c = return defLinType --- ad hoc; not needed? +lookupLincat gr m c | isPredefCat c = return (lock c defLinType) --- ad hoc; not needed? lookupLincat gr m c = do info <- lookupQIdentInfo gr (m,c) case info of @@ -247,7 +247,7 @@ lookupLincat gr m c = do lookupAbsType :: ErrorMonad m => Grammar -> QIdent -> m (Term,Type) lookupAbsType gr q@(m,c) | m == cPredefAbs = - if elem c [cInt,cFloat,cString] + if isPredefCat c then return (QC q,typeType) else no_type | otherwise = do