diff options
author | Volodymyr Sapsai <vsapsai@apple.com> | 2019-10-09 19:29:13 +0000 |
---|---|---|
committer | Volodymyr Sapsai <vsapsai@apple.com> | 2019-10-09 19:29:13 +0000 |
commit | 6dd0be602bc5b11de1cabdec5a8f83a68a70bd1c (patch) | |
tree | f46f6a903142158610ae2fb35ecaaab0f1ba923d /include | |
parent | 24b7c8b31cc50df1e1f7d608d11fd6eb2736b9b0 (diff) | |
download | clang-6dd0be602bc5b11de1cabdec5a8f83a68a70bd1c.tar.gz |
[ObjC generics] Fix not inheriting type bounds in categories/extensions.
When a category/extension doesn't repeat a type bound, corresponding
type parameter is substituted with `id` when used as a type argument. As
a result, in the added test case it was causing errors like
> type argument 'T' (aka 'id') does not satisfy the bound ('id<NSCopying>') of type parameter 'T'
We are already checking that type parameters should be consistent
everywhere (see `checkTypeParamListConsistency`) and update
`ObjCTypeParamDecl` to have correct underlying type. And when we use the
type parameter as a method return type or a method parameter type, it is
substituted to the bounded type. But when we use the type parameter as a
type argument, we check `ObjCTypeParamType` that ignores the updated
underlying type and remains `id`.
Fix by desugaring `ObjCTypeParamType` to the underlying type, the same
way we are doing with `TypedefType`.
rdar://problem/54329242
Reviewers: erik.pilkington, ahatanak
Reviewed By: erik.pilkington
Subscribers: jkorous, dexonsmith, ributzka, cfe-commits
Differential Revision: https://reviews.llvm.org/D66696
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@374202 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/clang/AST/Type.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/clang/AST/Type.h b/include/clang/AST/Type.h index ecbbd73e19..c9238e9521 100644 --- a/include/clang/AST/Type.h +++ b/include/clang/AST/Type.h @@ -5569,7 +5569,7 @@ class ObjCTypeParamType : public Type, public: bool isSugared() const { return true; } - QualType desugar() const { return getCanonicalTypeInternal(); } + QualType desugar() const; static bool classof(const Type *T) { return T->getTypeClass() == ObjCTypeParam; |