[PATCH] D66831: [ObjC] Fix type checking for qualified id block parameters.

Volodymyr Sapsai via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 27 11:28:34 PDT 2020


vsapsai added a comment.

There should be no error for `blockWithParam = genericBlockWithParam;` because `blockWithParam` is called with `I *` and it is safe to substitute `genericBlockWithParam`. Basically you have

  I *blockArg;
  id<P> genericParam = blockArg;

And for `genericBlockWithParam = blockWithParam;` you have

  id<P> blockArg;
  I *blockParam = blockArg;
  // Or as a concrete example
  // id<NSCopying> blockArg_thatHappensToBeNumber = @42;
  // NSString *blockParam = blockArg_thatHappensToBeNumber;

It is not safe to make such assignments, that's why there is an error now.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66831/new/

https://reviews.llvm.org/D66831





More information about the llvm-commits mailing list