Skip to content

Conversation

@ginsbach
Copy link
Contributor

@ginsbach ginsbach commented Feb 10, 2026

Prepare libraries for a possible deprecation warning on shadowing string.toString(), which currently can expose inconsistent behaviour (implicit toString insertion on string subclasses is problematic).

These instanceof classes were using this.(Type).method() to call supertype methods, but super.method() is clearer and equivalent for instanceof supertypes.

Prepare libraries for a possible deprecation warning on shadowing
string.toString().

These instanceof classes were using this.(Type).method() to call
supertype methods, but super.method() is clearer and equivalent
for instanceof supertypes.
@ginsbach ginsbach marked this pull request as ready for review February 11, 2026 10:56
@ginsbach ginsbach requested a review from a team as a code owner February 11, 2026 10:56
Copilot AI review requested due to automatic review settings February 11, 2026 10:56
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the shared regex NFA QL libraries to avoid non-trivial shadowing patterns around string.toString() by replacing explicit supertype-cast calls (this.(Type).method()) with clearer super.method() forwarding in instanceof classes.

Changes:

  • Replaced this.(RegExpConstant).toString()/getRootTerm()/getValue() forwarding with super.* in RegexpCharacterConstant.
  • Replaced this.(RegExpTerm).* forwarding with super.* in EffectivelyPlus, EffectivelyStar, and EffectivelyQuestion.
  • Replaced this.(InfiniteRepetitionQuantifier).toString() forwarding with super.toString() in MaybeBacktrackingRepetition.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
shared/regex/codeql/regex/nfa/NfaUtils.qll Switches forwarding calls in several instanceof classes from explicit cast-based dispatch to super.*.
shared/regex/codeql/regex/nfa/ExponentialBackTracking.qll Updates toString() forwarding in an instanceof quantifier wrapper to use super.toString().

@ginsbach ginsbach added the no-change-note-required This PR does not need a change note label Feb 11, 2026
@ginsbach ginsbach requested a review from hvitved February 11, 2026 11:01
@ginsbach ginsbach merged commit 9ed2261 into main Feb 11, 2026
55 of 56 checks passed
@ginsbach ginsbach deleted the ginsbach/avoid-nontrivially-shadowing-toString branch February 11, 2026 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-change-note-required This PR does not need a change note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants