From 3cc7ad7d2013a2eab3f08eab70e47e21438738a1 Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Wed, 27 Oct 2021 00:38:36 +0200 Subject: [PATCH] slightly improve error message for unknown module import --- compiler/src/prog8/CompilerMain.kt | 2 +- compiler/src/prog8/compiler/ModuleImporter.kt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/src/prog8/CompilerMain.kt b/compiler/src/prog8/CompilerMain.kt index d1cab9029..f9c258068 100644 --- a/compiler/src/prog8/CompilerMain.kt +++ b/compiler/src/prog8/CompilerMain.kt @@ -39,7 +39,7 @@ private fun compileMain(args: Array): Boolean { val watchMode by cli.option(ArgType.Boolean, fullName = "watch", description = "continuous compilation mode (watches for file changes), greatly increases compilation speed") val slowCodegenWarnings by cli.option(ArgType.Boolean, fullName = "slowwarn", description="show debug warnings about slow/problematic assembly code generation") val compilationTarget by cli.option(ArgType.String, fullName = "target", description = "target output of the compiler, currently '${C64Target.name}' and '${Cx16Target.name}' available").default(C64Target.name) - val sourceDirs by cli.option(ArgType.String, fullName="srcdirs", description = "list of extra paths to search in for imported modules").multiple().delimiter(File.pathSeparator) + val sourceDirs by cli.option(ArgType.String, fullName="srcdirs", description = "list of extra paths, separated with ${File.pathSeparator}, to search in for imported modules").multiple().delimiter(File.pathSeparator) val moduleFiles by cli.argument(ArgType.String, fullName = "modules", description = "main module file(s) to compile").multiple(999) try { diff --git a/compiler/src/prog8/compiler/ModuleImporter.kt b/compiler/src/prog8/compiler/ModuleImporter.kt index b6b270dbb..8ebbb7c48 100644 --- a/compiler/src/prog8/compiler/ModuleImporter.kt +++ b/compiler/src/prog8/compiler/ModuleImporter.kt @@ -33,7 +33,7 @@ class ModuleImporter(private val program: Program, val srcPath = when (candidates.size) { 0 -> return Err(NoSuchFileException( file = filePath.normalize().toFile(), - reason = "searched in $searchIn")) + reason = "Searched in $searchIn")) 1 -> candidates.first() else -> candidates.first() // when more candiates, pick the one from the first location } @@ -105,7 +105,7 @@ class ModuleImporter(private val program: Program, importModule(it) }, failure = { - errors.err("no module found with name $moduleName", import.position) + errors.err("no module found with name $moduleName. Searched in: $sourcePaths (and internal libraries)", import.position) return null } )