Skip to content

Commit c5357ff

Browse files
authored
Merge pull request #20008 from Hug0Vincent/csharp
feat: add getASupertype() predicate in ValueOrRefType.
2 parents d264fb5 + 8c82405 commit c5357ff

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: feature
3+
---
4+
* Added a new predicate, `getASuperType()`, to get a direct supertype of this type.

csharp/ql/lib/semmle/code/csharp/Type.qll

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,9 @@ class ValueOrRefType extends Type, Attributable, @value_or_ref_type {
138138
/** Gets an immediate subtype of this type, if any. */
139139
ValueOrRefType getASubType() { result.getABaseType() = this }
140140

141+
/** Gets an immediate supertype of this type, if any. */
142+
ValueOrRefType getASuperType() { this.getABaseType() = result }
143+
141144
/** Gets a member of this type, if any. */
142145
Member getAMember() { result.getDeclaringType() = this }
143146

0 commit comments

Comments
 (0)