Skip to content

Commit 4b9430d

Browse files
authored
Merge pull request #14688 from hvitved/csharp/deprecate-get-instance-type
C#: Deprecate `UnboundGenericType::getInstanceType/0`
2 parents f6ae752 + 12cd1c1 commit 4b9430d

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,13 @@ class UnboundGenericType extends ValueOrRefType, UnboundGeneric {
123123
}
124124

125125
/**
126+
* DEPRECATED: predicate does not contain any tuples.
127+
*
126128
* Gets the instance type of this type. For an unbound generic type, the instance type
127129
* is a constructed type created from the unbound type, with each of the supplied type
128130
* arguments being the corresponding type parameter.
129131
*/
130-
ConstructedType getInstanceType() {
132+
deprecated ConstructedType getInstanceType() {
131133
result = this.getAConstructedGeneric() and
132134
forall(TypeParameter tp, int i | tp = this.getTypeParameter(i) | tp = result.getTypeArgument(i))
133135
}
@@ -277,7 +279,7 @@ class TypeParameterConstraints extends Element, @type_parameter_constraints {
277279
* ```
278280
*/
279281
class UnboundGenericStruct extends Struct, UnboundGenericType {
280-
override ConstructedStruct getInstanceType() {
282+
deprecated override ConstructedStruct getInstanceType() {
281283
result = UnboundGenericType.super.getInstanceType()
282284
}
283285

@@ -300,7 +302,7 @@ class UnboundGenericStruct extends Struct, UnboundGenericType {
300302
* ```
301303
*/
302304
class UnboundGenericClass extends Class, UnboundGenericType {
303-
override ConstructedClass getInstanceType() {
305+
deprecated override ConstructedClass getInstanceType() {
304306
result = UnboundGenericType.super.getInstanceType()
305307
}
306308

@@ -323,7 +325,7 @@ class UnboundGenericClass extends Class, UnboundGenericType {
323325
* ```
324326
*/
325327
class UnboundGenericInterface extends Interface, UnboundGenericType {
326-
override ConstructedInterface getInstanceType() {
328+
deprecated override ConstructedInterface getInstanceType() {
327329
result = UnboundGenericType.super.getInstanceType()
328330
}
329331

@@ -347,7 +349,7 @@ class UnboundGenericInterface extends Interface, UnboundGenericType {
347349
* ```
348350
*/
349351
class UnboundGenericDelegateType extends DelegateType, UnboundGenericType {
350-
override ConstructedDelegateType getInstanceType() {
352+
deprecated override ConstructedDelegateType getInstanceType() {
351353
result = UnboundGenericType.super.getInstanceType()
352354
}
353355

0 commit comments

Comments
 (0)