1
1
mirror of https://github.com/google/ormolu.git synced 2024-11-23 14:16:24 +03:00

Workaround pattern constructs in expressions

This commit is contained in:
Utku Demir 2019-08-30 12:05:24 +12:00 committed by Mark Karpov
parent a2af1eb831
commit 4ae8025f90
3 changed files with 21 additions and 3 deletions

View File

@ -13,3 +13,6 @@ multiline
bar bar
baz baz
) = True ) = True
-- https://github.com/tweag/ormolu/issues/343
foo = (f -> 4)

View File

@ -10,3 +10,6 @@ g ((f, _), f -> 4) = True
multiline (t -> Foo multiline (t -> Foo
bar bar
baz) = True baz) = True
-- https://github.com/tweag/ormolu/issues/343
foo = (f -> 4)

View File

@ -705,10 +705,22 @@ p_hsExpr = \case
HsTick {} -> notImplemented "HsTick" HsTick {} -> notImplemented "HsTick"
HsBinTick {} -> notImplemented "HsBinTick" HsBinTick {} -> notImplemented "HsBinTick"
HsTickPragma {} -> notImplemented "HsTickPragma" HsTickPragma {} -> notImplemented "HsTickPragma"
-- These four constructs should never appear in correct programs.
-- See: https://github.com/tweag/ormolu/issues/343
EWildPat NoExt -> txt "_" EWildPat NoExt -> txt "_"
EAsPat {} -> notImplemented "EAsPat" EAsPat NoExt n p -> do
EViewPat {} -> notImplemented "EViewPat" p_rdrName n
ELazyPat {} -> notImplemented "ELazyPat" txt "@"
located p p_hsExpr
EViewPat NoExt p e -> do
located p p_hsExpr
space
txt "->"
breakpoint
inci (located e p_hsExpr)
ELazyPat NoExt p -> do
txt "~"
located p p_hsExpr
HsWrap {} -> notImplemented "HsWrap" HsWrap {} -> notImplemented "HsWrap"
XExpr {} -> notImplemented "XExpr" XExpr {} -> notImplemented "XExpr"