diff --git a/csharp/ql/lib/semmle/code/csharp/Generics.qll b/csharp/ql/lib/semmle/code/csharp/Generics.qll index ef3aced9cb9d..eca80c0342a8 100644 --- a/csharp/ql/lib/semmle/code/csharp/Generics.qll +++ b/csharp/ql/lib/semmle/code/csharp/Generics.qll @@ -406,17 +406,17 @@ class ConstructedType extends ValueOrRefType, ConstructedGeneric { override UnboundGenericType getUnboundGeneric() { constructed_generic(this, getTypeRef(result)) } - final override Type getChild(int n) { result = this.getTypeArgument(n) } + override Type getChild(int n) { result = this.getTypeArgument(n) } - final override string toStringWithTypes() { + override string toStringWithTypes() { result = this.getUndecoratedName() + "<" + getTypeArgumentsToString(this) + ">" } - final override string getName() { + override string getName() { result = this.getUndecoratedName() + "<" + getTypeArgumentsNames(this) + ">" } - final override predicate hasQualifiedName(string qualifier, string name) { + override predicate hasQualifiedName(string qualifier, string name) { exists(string name0 | name = name0 + "<" + getTypeArgumentsQualifiedNames(this) + ">" | exists(string enclosing | this.getDeclaringType().hasQualifiedName(qualifier, enclosing) and diff --git a/csharp/ql/lib/semmle/code/csharp/Type.qll b/csharp/ql/lib/semmle/code/csharp/Type.qll index f95ded847715..26a16a7d0240 100644 --- a/csharp/ql/lib/semmle/code/csharp/Type.qll +++ b/csharp/ql/lib/semmle/code/csharp/Type.qll @@ -401,10 +401,20 @@ class NonNestedType extends ValueOrRefType { NonNestedType() { exists(Namespace n | parent_namespace(this, n)) } } +/** + * A value type. + * + * Either a simple type (`SimpleType`), an `enum` (`Enum`), a `struct` (`Struct`), + * or a nullable type (`NullableType`). + */ +class ValueType extends ValueOrRefType, @value_type { + override predicate isValueType() { any() } +} + /** * The `void` type. */ -class VoidType extends DotNet::ValueOrRefType, Type, @void_type { +class VoidType extends ValueType, Type, @void_type { override predicate hasQualifiedName(string qualifier, string name) { qualifier = "System" and name = "Void" @@ -419,16 +429,6 @@ class VoidType extends DotNet::ValueOrRefType, Type, @void_type { override string getAPrimaryQlClass() { result = "VoidType" } } -/** - * A value type. - * - * Either a simple type (`SimpleType`), an `enum` (`Enum`), a `struct` (`Struct`), - * or a nullable type (`NullableType`). - */ -class ValueType extends ValueOrRefType, @value_type { - override predicate isValueType() { any() } -} - /** * A simple type. Simple types in C# are predefined `struct` types. * Here, however, they are not modeled as such, and we reserve the @@ -989,7 +989,7 @@ class NullType extends RefType, @null_type { /** * A nullable type, for example `int?`. */ -class NullableType extends ValueType, DotNet::ConstructedGeneric, @nullable_type { +class NullableType extends ValueType, ConstructedType, @nullable_type { /** * Gets the underlying value type of this nullable type. * For example `int` in `int?`. diff --git a/csharp/ql/lib/semmlecode.csharp.dbscheme b/csharp/ql/lib/semmlecode.csharp.dbscheme index 4ac7d8bcac6f..c01f52a1e5a3 100644 --- a/csharp/ql/lib/semmlecode.csharp.dbscheme +++ b/csharp/ql/lib/semmlecode.csharp.dbscheme @@ -456,7 +456,7 @@ case @type.kind of @unsigned_integral_type = @byte_type | @ushort_type | @uint_type | @ulong_type; @floating_point_type = @float_type | @double_type; @value_type = @simple_type | @enum_type | @struct_type | @nullable_type | @int_ptr_type - | @uint_ptr_type | @tuple_type; + | @uint_ptr_type | @tuple_type | @void_type; @ref_type = @class_type | @interface_type | @array_type | @delegate_type | @null_type | @dynamic_type; @value_or_ref_type = @value_type | @ref_type; @@ -2037,7 +2037,7 @@ cil_attribute_positional_argument( @dotnet_type = @type | @cil_type; @dotnet_call = @call | @cil_call_any; @dotnet_throw = @throw_element | @cil_throw_any; -@dotnet_valueorreftype = @cil_valueorreftype | @value_or_ref_type | @cil_array_type | @void_type; +@dotnet_valueorreftype = @cil_valueorreftype | @value_or_ref_type | @cil_array_type; @dotnet_typeparameter = @type_parameter | @cil_typeparameter; @dotnet_array_type = @array_type | @cil_array_type; @dotnet_pointer_type = @pointer_type | @cil_pointer_type;