My opinion is that this is at most a bug, at least a missed behaviour. The code states:
// Check the declaration of the generic type for longhand, but allow Nullable<> which has no shorthand
if (genericType.ChildTokens.Count > 0 && Utils.TokenContainNullable(genericType.ChildTokens.First))
{
if (genericType.Parent == null || !(genericType.Parent is TypeofExpression))
{
Which looks like it is trying to support Nullable<>
inside of typeof(Nullable<>)
. However, the check on TypeofExpression
inadvertently filters out closed generics for no apparent reason.
Look for CheckShorthandForNullableTypes
: