summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/GF/Speech/TransformCFG.hs2
-rw-r--r--test/srg/srg0006/srg0006.gf10
2 files changed, 11 insertions, 1 deletions
diff --git a/src/GF/Speech/TransformCFG.hs b/src/GF/Speech/TransformCFG.hs
index 93f2a1be9..f687e86df 100644
--- a/src/GF/Speech/TransformCFG.hs
+++ b/src/GF/Speech/TransformCFG.hs
@@ -88,7 +88,7 @@ stateGFCC = mkGFCC . mkCanon2gfcc . stateGrammarST
-- * Grammar filtering
--- | Removes all directly cyclic productions.
+-- | Removes all directly and indirectly cyclic productions.
removeCycles :: CFRules -> CFRules
removeCycles = groupProds . removeCycles_ . ungroupProds
where removeCycles_ rs = [r | r@(CFRule c rhs _) <- rs, rhs /= [Cat c]]
diff --git a/test/srg/srg0006/srg0006.gf b/test/srg/srg0006/srg0006.gf
new file mode 100644
index 000000000..9fa34ed64
--- /dev/null
+++ b/test/srg/srg0006/srg0006.gf
@@ -0,0 +1,10 @@
+-- A grammar with a cycle caused by an empty category.
+cat S; E;
+
+fun f : E -> S -> S;
+fun g : S ;
+fun e : E ;
+
+lin f e s = { s = e.s ++ s.s } ;
+lin g = { s = "s" } ;
+lin e = { s = [] } ; \ No newline at end of file