From d0a1ab2091da32085558f7925a92f247b794eb4e Mon Sep 17 00:00:00 2001 From: Saem Ghani Date: Sat, 15 Jul 2023 15:44:02 -0700 Subject: [PATCH] internal: `astrepr.debug` now useful for `PType` (#798) ## Summary `astrepr.debug` overload for `PType` now provides more tailored output, reducing spam and surfacing more useful information. ## Details Previously, `astrepr.debug` used a generic `implicitTReprConf` when generating output. This meant continually fiddling with that set and/or having largely useless/spammy output for `PType` vs `PSym` vs `PNode`, etc. Now the `PType` overload has its own config that can be tailored for types. --- compiler/utils/astrepr.nim | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/compiler/utils/astrepr.nim b/compiler/utils/astrepr.nim index dabc89314ea..d4c4eec56ee 100644 --- a/compiler/utils/astrepr.nim +++ b/compiler/utils/astrepr.nim @@ -1234,8 +1234,21 @@ template debug*(it: PSym) = template debug*(it: PType) = ## Print tree representation of a PType for compiler debugging - # TODO: customize the TReprConf here - debugAux(implicitDebugConfRef, it, implicitTReprConf, instLoc()) + # TODO: create a PType specific implicitTReprConf + var conf = implicitTReprConf + conf.flags = conf.flags + + { + trfShowTypeAst, trfShowTypeId, + + trfShowTypeFlags + } - + { + trfShowTypeSym, trfShowSymLineInfo, + trfShowSymFlags, trfShowSymMagic, + + # trfShowNodeTypes, + trfShowNodeLineInfo, trfShowNodeFlags} + debugAux(implicitDebugConfRef, it, conf, instLoc()) template debug*(it: PIdent) = ## Print tree representation of a PIdent for compiler debugging