Skip to content

Surface const-sql diagnostics from generated files - #178

Merged
mgravell merged 2 commits into
DapperLib:mainfrom
gtbuchanan:fix/177-const-sql-generated-diagnostics
Aug 20, 2026
Merged

Surface const-sql diagnostics from generated files#178
mgravell merged 2 commits into
DapperLib:mainfrom
gtbuchanan:fix/177-const-sql-generated-diagnostics

Conversation

@gtbuchanan

Copy link
Copy Markdown

When the sql argument resolves to a const string, the SQL parameter analysis already runs, but its diagnostics (DAP214, etc.) were anchored at the constant's declaration. For a constant emitted into a generated file, the analyzer driver drops diagnostics there (generated-code suppression), so only the call-site DAP018 survived and it looked like the SQL was never analyzed.

Re-home the SQL-parse diagnostics onto the call-site sql argument when the declaration is in generated code, so they stay visible. Inline literals and constants in hand-written documents (same or sibling file) keep their precise declaration-token location.

Closes #177

gtbuchanan and others added 2 commits June 30, 2026 09:39
When the `sql` argument resolves to a `const string`, the SQL parameter
analysis already runs, but its diagnostics (DAP214, etc.) were anchored at
the constant's declaration. For a constant emitted into a generated file,
the analyzer driver drops diagnostics there (generated-code suppression),
so only the call-site DAP018 survived and it looked like the SQL was never
analyzed.

Re-home the SQL-parse diagnostics onto the call-site sql argument when the
declaration is in generated code, so they stay visible. Inline literals and
constants in hand-written documents (same or sibling file) keep their
precise declaration-token location.

Closes DapperLib#177

@mgravell mgravell left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks - the root cause is exactly right, LGTM; I ate the merge conflicts on your behalf: that's my fault for being slow in getting through backlog

@mgravell
mgravell merged commit 8352469 into DapperLib:main Aug 20, 2026
2 checks passed
@gtbuchanan
gtbuchanan deleted the fix/177-const-sql-generated-diagnostics branch August 20, 2026 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SQL/parameter diagnostics suppressed when sql is a const declared in a generated file

2 participants