From d7ae00349afb4dfb233efcf68edcfed936380e4a Mon Sep 17 00:00:00 2001 From: Andreas Rumpf Date: Tue, 4 Nov 2025 17:54:23 +0100 Subject: [PATCH] =?UTF-8?q?produces=20vastly=20better=20error=20messages?= =?UTF-8?q?=20for=20implicit=20--import=20and=20--inc=E2=80=A6=20(#25258)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …lude configuration options (cherry picked from commit cfefd1d95b02fe8c099ee28074616031cf5a0b3b) --- compiler/commands.nim | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/compiler/commands.nim b/compiler/commands.nim index ba3d5eadc8..cdb6e77d11 100644 --- a/compiler/commands.nim +++ b/compiler/commands.nim @@ -882,11 +882,19 @@ proc processSwitch*(switch, arg: string, pass: TCmdLinePass, info: TLineInfo; of "import": expectArg(conf, switch, arg, pass, info) if pass in {passCmd2, passPP}: - conf.implicitImports.add findModule(conf, arg, toFullPath(conf, info)).string + let m = findModule(conf, arg, toFullPath(conf, info)).string + if m.len == 0: + localError(conf, info, "Cannot resolve filename: " & arg) + else: + conf.implicitImports.add m of "include": expectArg(conf, switch, arg, pass, info) if pass in {passCmd2, passPP}: - conf.implicitIncludes.add findModule(conf, arg, toFullPath(conf, info)).string + let m = findModule(conf, arg, toFullPath(conf, info)).string + if m.len == 0: + localError(conf, info, "Cannot resolve filename: " & arg) + else: + conf.implicitIncludes.add m of "listcmd": processOnOffSwitchG(conf, {optListCmd}, arg, pass, info) of "asm":