1
0
forked from GitHub/gf-core

Make cleanupRecordFields also recurse into variants

It's possible that more constructors need to be handled
This commit is contained in:
John J. Camilleri
2021-07-01 13:53:33 +02:00
parent e5a2aed5b6
commit 78b73fba20
2 changed files with 2 additions and 10 deletions

View File

@@ -12,7 +12,7 @@ import GF.Data.ErrM
import GF.Text.Pretty
import GF.Grammar.Grammar as G
import GF.Grammar.Lookup(lookupOrigInfo,allOrigInfos,allParamValues)
import GF.Grammar.Macros(typeForm,collectOp,collectPattOp,mkAbs,mkApp,term2patt,sortRec)
import GF.Grammar.Macros(typeForm,collectOp,collectPattOp,composSafeOp,mkAbs,mkApp,term2patt,sortRec)
import GF.Grammar.Lockfield(isLockLabel)
import GF.Grammar.Predef(cPredef,cInts)
import GF.Compile.Compute.Predef(predef)
@@ -163,6 +163,7 @@ cleanupRecordFields (RecType ls) (R as) =
, let Just ty = M.lookup lbl defnFields
, let t' = cleanupRecordFields ty t
]
cleanupRecordFields ty t@(FV _) = composSafeOp (cleanupRecordFields ty) t
cleanupRecordFields _ t = t
convert :: G.Grammar -> Term -> LinValue

View File

@@ -23,15 +23,6 @@ echo ""
# https://github.com/GrammaticalFramework/gf-core/issues/101
stack run -- --batch --output-format=canonical_gf grammars/PhrasebookGer.gf
# for s in c2 objCtrl; do
# grep VRead --after-context=216 canonical/PhrasebookGer.gf | grep "$s" > /dev/null
# if [ $? -ne 1 ]; then
# echo "Canonical grammar contains \`$s\`: FAIL"
# FAILURES=$((FAILURES+1))
# else
# echo "Canonical grammar does not contain \`$s\`: OK"
# fi
# done
diff canonical/PhrasebookGer.gf gold/PhrasebookGer.gf
if [ $? -ne 0 ]; then
echo "Canonical grammar doesn't match gold version: FAIL"