From 1a1ea72626c9653eb930dcdebd9dc408661a679d Mon Sep 17 00:00:00 2001 From: Timothee Cour Date: Mon, 19 Apr 2021 19:36:55 -0700 Subject: [PATCH] rename: magic => legacyRelProj --- compiler/commands.nim | 8 ++++---- compiler/msgs.nim | 3 ++- compiler/options.nim | 2 +- doc/advopt.txt | 2 +- tests/config.nims | 2 +- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/compiler/commands.nim b/compiler/commands.nim index 8157d33e8881d..0733e500a004f 100644 --- a/compiler/commands.nim +++ b/compiler/commands.nim @@ -898,11 +898,11 @@ proc processSwitch*(switch, arg: string, pass: TCmdLinePass, info: TLineInfo; case arg.normalize of "abs": conf.filenameOption = foAbs of "canonical": conf.filenameOption = foCanonical - of "magic": conf.filenameOption = foMagicSauce - else: localError(conf, info, "expected: abs|canonical|magic, got: $1" % arg) + of "legacyrelproj": conf.filenameOption = foLegacyRelProj + else: localError(conf, info, "expected: abs|canonical|legacyRelProj, got: $1" % arg) of "listfullpaths": - conf.filenameOption = if switchOn(arg): foAbs else: foMagicSauce - # xxx in future work, s/foMagicSauce/foCanonical/ here + # xxx in future work, use `warningDeprecated` + conf.filenameOption = if switchOn(arg): foAbs else: foCanonical of "spellsuggest": if arg.len == 0: conf.spellSuggestMax = spellSuggestSecretSauce elif arg == "auto": conf.spellSuggestMax = spellSuggestSecretSauce diff --git a/compiler/msgs.nim b/compiler/msgs.nim index b3e134bdabd84..783772bbc9f1a 100644 --- a/compiler/msgs.nim +++ b/compiler/msgs.nim @@ -249,7 +249,7 @@ proc toFilenameOption*(conf: ConfigRef, fileIdx: FileIndex, opt: FilenameOption) let absPath = toFullPath(conf, fileIdx) result = canonicalImportAux(conf, absPath.AbsoluteFile) of foName: result = toProjPath(conf, fileIdx).lastPathPart - of foMagicSauce: + of foLegacyRelProj: let absPath = toFullPath(conf, fileIdx) relPath = toProjPath(conf, fileIdx) @@ -543,6 +543,7 @@ proc liMessage*(conf: ConfigRef; info: TLineInfo, msg: TMsgKind, arg: string, if conf.hasHint(hintSource) and info != unknownLineInfo: conf.writeSurroundingSrc(info) if hintMsgOrigin in conf.mainPackageNotes: + # xxx needs a bit of refactoring to honor `conf.filenameOption` styledMsgWriteln(styleBright, toFileLineCol(info2), resetStyle, " compiler msg initiated here", KindColor, KindFormat % $hintMsgOrigin, diff --git a/compiler/options.nim b/compiler/options.nim index f43e47472fab4..2aaaf58443c91 100644 --- a/compiler/options.nim +++ b/compiler/options.nim @@ -261,7 +261,7 @@ type foAbs # absolute path, e.g.: /pathto/bar/foo.nim foRelProject # relative to project path, e.g.: ../foo.nim foCanonical # canonical module name - foMagicSauce # magic sauce, shortest of (foAbs, foRelProject) + foLegacyRelProj # legacy, shortest of (foAbs, foRelProject) foName # lastPathPart, e.g.: foo.nim foStacktrace # if optExcessiveStackTrace: foAbs else: foName diff --git a/doc/advopt.txt b/doc/advopt.txt index 2869ac3540b23..012806563cd2e 100644 --- a/doc/advopt.txt +++ b/doc/advopt.txt @@ -36,7 +36,7 @@ Advanced options: to after all options have been processed --stdout:on|off output to stdout --colors:on|off turn compiler messages coloring on|off - --filenames:abs|canonical|magic + --filenames:abs|canonical|legacyRelProj customize how filenames are rendered in compiler messages, defaults to `abs` (absolute) --declaredLocs:on|off show declaration locations in messages diff --git a/tests/config.nims b/tests/config.nims index 3a6a0686c1f25..e5d6545f4a36a 100644 --- a/tests/config.nims +++ b/tests/config.nims @@ -6,7 +6,7 @@ switch("path", "$lib/../testament/lib") ## prevent common user config settings to interfere with testament expectations ## Indifidual tests can override this if needed to test for these options. switch("colors", "off") -switch("filenames", "magic") +switch("filenames", "legacyRelProj") switch("excessiveStackTrace", "off") switch("spellSuggest", "0")