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