HomePhabricator

[ObjC generics] Fix applying `__kindof` to the type parameter.

Authored by vsapsai on Feb 15 2019, 5:01 PM.

Description

[ObjC generics] Fix applying __kindof to the type parameter.

Fixes the warning about incompatible pointer types on assigning to a
subclass of type argument an expression of type __kindof TypeParam.

We already have a mechanism in ASTContext::canAssignObjCInterfaces
that handles ObjCObjectType with __kindof. But it wasn't triggered
because during type substitution __kindof TypeParam was represented as
AttributedType with attribute ObjCKindOf and equivalent type
TypeArg. For assignment type checking we use canonical types so
attributed type was desugared and the attribute was ignored.

The fix is in checking transformed AttributedType and pushing
__kindof down into ObjCObjectType when necessary.

rdar://problem/38514910

Reviewers: ahatanak, erik.pilkington, doug.gregor

Reviewed By: doug.gregor

Subscribers: jkorous, dexonsmith, manmanren, jordan_rose, doug.gregor, cfe-commits

Differential Revision: https://reviews.llvm.org/D57076

llvm-svn: 354189

Details

Committed
vsapsaiFeb 15 2019, 5:01 PM
Reviewer
doug.gregor
Differential Revision
D57076: [ObjC generics] Fix applying `__kindof` to the type parameter.
Parents
rG70ca752ccf6a: [lit] Remove LitTestCase
Branches
Unknown
Tags
Unknown