diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-07-06 00:07:09 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-07-06 00:07:09 +0000 |
commit | 1838703fea568b394407b83d1055b4c7f52fb105 (patch) | |
tree | 059bd7c16739da1228d9352c3f1152f5a189d741 /test/ARCMT | |
parent | c4133a477389dacb4479a96ee2227b92aea0a237 (diff) |
[objcmt] Check for classes that accept 'objectForKey:' (or the other selectors
that the migrator handles) but return their instances as 'id', resulting
in the compiler resolving 'objectForKey:' as the method from NSDictionary.
When checking if we can convert to subscripting syntax, check whether
the receiver is a result of a class method from a hardcoded list of
such classes. In such a case return the specific class as the interface
of the receiver.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159788 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/ARCMT')
-rw-r--r-- | test/ARCMT/objcmt-subscripting-literals.m | 10 | ||||
-rw-r--r-- | test/ARCMT/objcmt-subscripting-literals.m.result | 10 |
2 files changed, 20 insertions, 0 deletions
diff --git a/test/ARCMT/objcmt-subscripting-literals.m b/test/ARCMT/objcmt-subscripting-literals.m index ea33bbae55..0174fcf060 100644 --- a/test/ARCMT/objcmt-subscripting-literals.m +++ b/test/ARCMT/objcmt-subscripting-literals.m @@ -211,3 +211,13 @@ void test2() { o = [mutcunaval objectAtIndex:4]; [mutcunaval replaceObjectAtIndex:2 withObject:@"val"]; } + +@interface NSLocale : NSObject ++ (id)systemLocale; ++ (id)currentLocale; +- (id)objectForKey:(id)key; +@end + +void test3(id key) { + id o = [[NSLocale currentLocale] objectForKey:key]; +} diff --git a/test/ARCMT/objcmt-subscripting-literals.m.result b/test/ARCMT/objcmt-subscripting-literals.m.result index 8a9e6f0b92..9975996524 100644 --- a/test/ARCMT/objcmt-subscripting-literals.m.result +++ b/test/ARCMT/objcmt-subscripting-literals.m.result @@ -211,3 +211,13 @@ void test2() { o = [mutcunaval objectAtIndex:4]; [mutcunaval replaceObjectAtIndex:2 withObject:@"val"]; } + +@interface NSLocale : NSObject ++ (id)systemLocale; ++ (id)currentLocale; +- (id)objectForKey:(id)key; +@end + +void test3(id key) { + id o = [[NSLocale currentLocale] objectForKey:key]; +} |