-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Labels
Area-CompilersBugFeature - Nullable Reference TypesNullable Reference TypesNullable Reference TypesLanguage-C#
Milestone
Description
// PROTOTYPE(NullableReferenceTypes): Should probably rename this method to have more specific name.
// At the moment it is used only for Nullable Reference Types feature and
// its implementation is specialized for this feature.
public static bool IsUnconstrainedTypeParameter(this TypeSymbol type)
{
if (type.TypeKind != TypeKind.TypeParameter)
{
return false;
}
var typeParameter = (TypeParameterSymbol)type;
// PROTOTYPE(NullableReferenceTypes): Test `where T : unmanaged`. See
// UninitializedNonNullableFieldTests.TypeParameterConstraints for instance.
return !typeParameter.IsValueType && !(typeParameter.IsReferenceType && typeParameter.IsNotNullableIfReferenceType == true);
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Area-CompilersBugFeature - Nullable Reference TypesNullable Reference TypesNullable Reference TypesLanguage-C#