Nullable<T> loss of functionality

Issue #407 wontfix
Scott van der Linden created an issue

Variables of type Nullable<T> could have Null assigned to them in previous releases, Now assigning Null raises an EVariantTypeCastError. (Delphi 11.3)

Test:

var
  value: Nullable<TColor>;
begin
  value := Null; // raises exception
end;

Is this an intentional change and if so how are Nullable<T> to be used moving forward?

Comments (3)

  1. Stefan Glienke repo owner

    You apparently ignored the warning in 1.2 that pointed out the use of the implicit operator when assigning a Variant to a nullable (or you compiled Spring with turning those off as documented in Spring.inc). To reset a nullable to the “no value” state assign nil to it.

  2. Log in to comment