AFAIK you can't.
1. T only constrains the type, not its value. If the type is nillable, then nil is one of its valid values.
2. in [T any], T could be any type, including types which are not nillable (e.g. int). So you can't compare the value to nil inside the generic function - although you could check for the *zero* value (using "var zero T" and compare with that)