From 3824f3d4816d8d8f2ff5a95cb8005de84d572cbc Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 12 May 2026 16:19:33 +0000 Subject: [PATCH 1/2] Initial plan From 86fc38270cf64e63fcc8779c704e5a012969ae74 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 12 May 2026 20:58:18 +0000 Subject: [PATCH 2/2] Fix bs:disable-line 1001 not suppressing cannotFindFunction (1140) errors When cannotFindFunction (1140) was split from cannotFindName (1001) in commit #1169, existing 'bs:disable-line 1001' comments silently stopped suppressing undefined-function-call errors. This adds backward-compat logic to util.diagnosticIsSuppressed so that code 1001 also covers 1140, restoring the pre-split behavior. Adds two new test cases: a simple case and the exact 5-level-nested namespace/sub/if scenario from the original bug report. Agent-Logs-Url: https://github.com/rokucommunity/brighterscript/sessions/7dbf34b9-475e-4c3e-ae14-5596edfa8c8b Co-authored-by: TwitchBronBron <2544493+TwitchBronBron@users.noreply.github.com> --- src/files/BrsFile.spec.ts | 32 ++++++++++++++++++++++++++++++++ src/util.ts | 9 ++++++++- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/src/files/BrsFile.spec.ts b/src/files/BrsFile.spec.ts index 89d86f1a1..5cd71cabf 100644 --- a/src/files/BrsFile.spec.ts +++ b/src/files/BrsFile.spec.ts @@ -1017,6 +1017,38 @@ describe('BrsFile', () => { program.validate(); expectZeroDiagnostics(program); }); + + it('treats code 1001 (cannotFindName) as also suppressing cannotFindFunction (1140) for backward compatibility', () => { + // `cannotFindFunction` (1140) was split from `cannotFindName` (1001) after v0.65. + // Users with existing `bs:disable-line 1001` comments must not have their + // suppress directives silently broken for function-call "cannot find" errors. + program.setFile('source/main.bs', ` + sub main() + undefinedFunction() 'bs:disable-line 1001 + end sub + `); + program.validate(); + expectZeroDiagnostics(program); + }); + + it('treats code 1001 as suppressing cannotFindFunction at any nesting depth', () => { + // Reproduces the original report: a 5-level-deep function call whose + // bs:disable-line 1001 comment was not suppressing the error. + program.setFile('source/main.bs', ` + namespace http + function request() as object + callback = sub() + if true then + response = {} + handleInterceptedScreenData(response._interceptedScreenData) 'bs:disable-line 1001 + end if + end sub + end function + end namespace + `); + program.validate(); + expectZeroDiagnostics(program); + }); }); describe('bs:disable / bs:enable block directives', () => { diff --git a/src/util.ts b/src/util.ts index 98ead9bf1..dc3f977dd 100644 --- a/src/util.ts +++ b/src/util.ts @@ -842,7 +842,14 @@ export class Util { continue; } //if this flag disables the code, it's suppressed - const isDisabled = flag.codes === null || (diagnosticCode !== undefined && flag.codes?.includes(diagnosticCode)); + const isDisabled = flag.codes === null || (diagnosticCode !== undefined && ( + flag.codes?.includes(diagnosticCode) || + // Backward-compat: `bs:disable-line 1001` (cannotFindName) used to suppress all + // "cannot find" errors before cannotFindFunction (1140) was introduced as a + // separate diagnostic code. Keep 1001 working for function-call errors so that + // existing disable comments aren't silently broken. + (diagnosticCode === DiagnosticCodeMap.cannotFindFunction && flag.codes?.includes(DiagnosticCodeMap.cannotFindName)) + )); if (isDisabled) { return true; }