]> granicus.if.org Git - clang/commit
[SemaObjC] Properly handle mix between type arguments and protocols.
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>
Wed, 13 Apr 2016 20:59:07 +0000 (20:59 +0000)
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>
Wed, 13 Apr 2016 20:59:07 +0000 (20:59 +0000)
commit55cf4bd859f8f8fdc8f1b7bbd07e7d3c12c284a2
treea668e33171067adaa56cc9dda0da4bffcbf83395
parent6fd58932619f63bad375655a14416729bdc354aa
[SemaObjC] Properly handle mix between type arguments and protocols.

Under certain conditions clang currently fails to properly diagnostic ObjectC
parameter list when type args and protocols are mixed in the same list. This
happens when the first item in the parameter list is a (1) protocol, (2)
unknown type or (3) a list of protocols/unknown types up to the first type
argument. Fix the problem to report the proper error, example:

NSArray<M, NSValue *, NSURL, NSArray <id <M>>> *foo = @[@"a"];
NSNumber *bar = foo[0];
NSLog(@"%@", bar);

$ clang ...
x.m:7:13: error: angle brackets contain both a type ('NSValue') and a protocol ('M')
        NSArray<M, NSValue *, NSURL, NSArray <id <M>>> *foo = @[@"a"];
                ~  ^

Differential Revision: http://reviews.llvm.org/D18997

rdar://problem/22204367

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@266245 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Sema/Sema.h
lib/Parse/ParseObjc.cpp
lib/Sema/SemaDeclObjC.cpp
test/SemaObjC/parameterized_classes.m