11

Switching from v59.0 to v60.0 I noticed a significant change in handling type checking and inference with Iterable<T> types.

A very simple example:

new List<Id>() instanceof Iterable<String>;

v59.0

// true

v60.0

Compile Failure: Operation instanceof is always true since an instance of List<Id> is always an instance of System.Iterable<String>

Basically, starting from v60.0 the List<? extends T> is always an instance of Iterable<T>.

the Set<? extends T> is also always an instance of Iterable<T> but starting from a few releases ago.

I'm not going to complain about the impact of breaking backward compatibility as well as the fact that these changes were missing in Salesforce Spring ’24 Release Notes

Questions:

  • What is the motivation behind these type-checking and inference changes?
  • What are the following consequences?

0

You must log in to answer this question.