Section: §11.3.1
Current text:
Comparison with nil (only if T might be a reference type — ambiguous without constraints)
...listed as permitted without constraints.
Problem:
This may be internally contradictory — it's listed as "permitted" while also being called "ambiguous". The compiler may actually disallow = nil/<> nil on an unconstrained type parameter (compile error) unless a class or interface constraint is present.
Why this needs compiler verification:
Compile a generic method with an unconstrained T that compares a T parameter to nil, and see whether it's accepted or rejected without a class/interface constraint.
Suggested fix (pending verification):
If disallowed: remove nil-comparison from the unconstrained-permitted list and state it requires a class/interface constraint.
Section: §11.3.1
Current text:
...listed as permitted without constraints.
Problem:
This may be internally contradictory — it's listed as "permitted" while also being called "ambiguous". The compiler may actually disallow
= nil/<> nilon an unconstrained type parameter (compile error) unless aclassorinterfaceconstraint is present.Why this needs compiler verification:
Compile a generic method with an unconstrained
Tthat compares aTparameter tonil, and see whether it's accepted or rejected without aclass/interfaceconstraint.Suggested fix (pending verification):
If disallowed: remove nil-comparison from the unconstrained-permitted list and state it requires a
class/interfaceconstraint.