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.