Compare commits

...

1 Commits

Author SHA1 Message Date
Philip Ginsbach
977eb5c79a Avoid inconsistent implicit toString on potential string subtypes
Fix cases where the compiler cannot prove types don't extend string:

1. FileSystem.qll: Add toString() to ContainerBase signature. The
   instantiation sites already provide toString(), so no changes needed
   there. Container.toString() now delegates to super.toString().
   No behaviour change.

2. DataFlowImplCommon.qll: Content.toString() now delegates to
   super.toString() instead of returning the literal "Content".
   This is a behaviour change: Content now displays its actual
   description (e.g. field names) rather than the generic "Content".
2026-02-12 12:05:34 +00:00
2 changed files with 9 additions and 2 deletions

View File

@@ -112,7 +112,7 @@ module MakeImplCommon<LocationSig Location, InputSig<Location> Lang> {
final private class LangContentSet = Lang::ContentSet; final private class LangContentSet = Lang::ContentSet;
class Content extends LangContentSet { class Content extends LangContentSet {
string toString() { result = "Content" } string toString() { result = super.toString() }
} }
class ContentFilter extends Unit { class ContentFilter extends Unit {

View File

@@ -23,6 +23,13 @@ signature module InputSig {
* Typically `containerparent(result, this)`. * Typically `containerparent(result, this)`.
*/ */
ContainerBase getParentContainer(); ContainerBase getParentContainer();
/**
* Gets a textual representation of this container.
*
* Typically `result = this.getAbsolutePath()`.
*/
string toString();
} }
/** /**
@@ -206,7 +213,7 @@ module Make<InputSig Input> {
* *
* This is the absolute path of the container. * This is the absolute path of the container.
*/ */
string toString() { result = this.getAbsolutePath() } string toString() { result = super.toString() }
} }
/** A folder. */ /** A folder. */