From b31e40ceca1601067a8ce0fb958c70e1aa59c115 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Sat, 13 Feb 2021 14:58:06 -0800 Subject: [PATCH] lib: avoid shady Not (Or []) in account type queries --- hledger-lib/Hledger/Data/Journal.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hledger-lib/Hledger/Data/Journal.hs b/hledger-lib/Hledger/Data/Journal.hs index 31a91ab71..56d9007b0 100644 --- a/hledger-lib/Hledger/Data/Journal.hs +++ b/hledger-lib/Hledger/Data/Journal.hs @@ -338,7 +338,8 @@ journalAccountTypeQuery atypes fallbackregex Journal{jdeclaredaccounttypes} = concat $ mapMaybe (`M.lookup` jdeclaredaccounttypes) atypes in case declaredacctsoftype of [] -> Acct fallbackregex - as -> And [ Or acctnameRegexes , Not $ Or differentlyTypedRegexes ] + as -> And $ [ Or acctnameRegexes ] + ++ if null differentlyTypedRegexes then [] else [ Not $ Or differentlyTypedRegexes ] where -- XXX Query isn't able to match account type since that requires extra info from the journal. -- So we do a hacky search by name instead.