mirror of
https://github.com/github/codeql.git
synced 2026-07-26 21:44:02 +02:00
Once the extractor built again, the internal `possiblyThrowingExpressions`
query (a lint over the extractor's own Kotlin source that forbids constructs
which can abort extraction) flagged two spots in the KDoc code added earlier
this session:
* a `throw e` used to re-raise `ProcessCanceledException` from
`parseKDocSections`, and
* an unchecked `element as IrDeclaration` cast in the metadata-less
KDoc-owner pass.
Both were previously masked because the internal build did not compile (the
`com.intellij.psi` references failed first), so the query never ran.
Remove the re-raise and simply log and continue, matching how the rest of the
extractor handles parse failures (it never lets exceptions escape). This also
drops the last reference to `ProcessCanceledException`.
Replace the cast with a `when` over the concrete IR declaration types
(`IrEnumEntry`, `IrAnonymousInitializer`), which smart-casts each branch to the
common `IrDeclaration` supertype. A plain `&& element is IrDeclaration` guard
would instead trip the K2 compiler's "check for instance is always true"
warning, which `-Werror` turns into a build failure.
No expected-output changes: behaviour is unchanged; only the exception handling
and the type narrowing are rewritten. Verified all 12 extractor versions in
`versions.bzl` build warning-free.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>