Fix a units bug in multi-module projects (#5529)

Signed-off-by: Nick Cameron <nrc@ncameron.org>
This commit is contained in:
Nick Cameron
2025-02-27 15:46:41 +13:00
committed by GitHub
parent 8d9bba02d6
commit 12edb6375d
14 changed files with 282 additions and 120 deletions

View File

@ -351,16 +351,16 @@ export function kclErrorsByFilename(
const sourceRange: SourceRange = error.sourceRange
const fileIndex = sourceRange[2]
const modulePath: ModulePath | undefined = filenames[fileIndex]
if (modulePath) {
let stdOrLocalPath = modulePath.value
if (stdOrLocalPath) {
if (modulePath && modulePath.type === 'Local') {
let localPath = modulePath.value
if (localPath) {
// Build up an array of errors per file name
const value = fileNameToError.get(stdOrLocalPath)
const value = fileNameToError.get(localPath)
if (!value) {
fileNameToError.set(stdOrLocalPath, [error])
fileNameToError.set(localPath, [error])
} else {
value.push(error)
fileNameToError.set(stdOrLocalPath, [error])
fileNameToError.set(localPath, [error])
}
}
}