categories in PredefCnc should also have lock fields

This commit is contained in:
Krasimir Angelov
2026-09-12 10:29:06 +02:00
parent b4e8d48a9b
commit cf90d1280f
2 changed files with 5 additions and 5 deletions
+3 -3
View File
@@ -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)
+2 -2
View File
@@ -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