diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs b/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs index b3af68c1f..498fe50b7 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs @@ -63,7 +63,12 @@ render d = rend 0 False (map ($ "") $ d []) "" ShowS rend i p = \case "[" : "]" : ts -> showString "[]" . rend i False ts - "(" : ")" : ts -> showString "()" . rend i False ts + "(" : ")" : (t : ts) -> + (pending . showString "()") + . ( case t of + "," -> showChar ',' . new i ts + _ -> rend i False (t : ts) + ) "⟦" : "⟧" : ts -> showString "⟦ ⟧" . rend i False ts "[" : ts -> char '[' . rend i False ts "(" : ts -> char '(' . new (i + 1) ts diff --git a/eo-phi-normalizer/test/eo/phi/from-eo/as-phi.yaml b/eo-phi-normalizer/test/eo/phi/from-eo/as-phi.yaml index 979b11eb0..786a52a38 100644 --- a/eo-phi-normalizer/test/eo/phi/from-eo/as-phi.yaml +++ b/eo-phi-normalizer/test/eo/phi/from-eo/as-phi.yaml @@ -62,3 +62,17 @@ tests: ⟧ ⟧ } + - name: "Prints empty parentheses" + input: | + {⟦ m ↦ ⟦ x ↦ ⟦ ⟧ ⟧() ⟧} + normalized: | + {⟦ m ↦ ⟦ x ↦ ⟦ ⟧ ⟧() ⟧} + prettified: | + { + ⟦ + m ↦ ⟦ + x ↦ ⟦ ⟧ + ⟧ + () + ⟧ + }