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:
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user