Skip to content

Commit 46e14f8

Browse files
author
Fariborz Jahanian
committed
objective-c: improve diagnostic when collection expression is
not a pointer to a fast-enumerable object. // rdar://11488666 llvm-svn: 158998
1 parent a6c8cc3 commit 46e14f8

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5485,7 +5485,7 @@ def err_selector_element_not_lvalue : Error<
54855485
def err_selector_element_type : Error<
54865486
"selector element type %0 is not a valid object">;
54875487
def err_collection_expr_type : Error<
5488-
"collection expression type %0 is not a valid object">;
5488+
"the type %0 is not a pointer to a fast-enumerable object">;
54895489
def warn_collection_expr_type : Warning<
54905490
"collection expression type %0 may not respond to %1">;
54915491

clang/test/Parser/objc-forcollection-neg.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ - (void)compilerTestAgainst {
2626

2727
int i=0;
2828
for (int * elem in elem) // expected-error {{selector element type 'int *' is not a valid object}} \
29-
expected-error {{collection expression type 'int *' is not a valid object}}
29+
expected-error {{the type 'int *' is not a pointer to a fast-enumerable object}}
3030
++i;
3131
for (i in elem) // expected-error {{use of undeclared identifier 'elem'}} \
3232
expected-error {{selector element type 'int' is not a valid object}}
3333
++i;
34-
for (id se in i) // expected-error {{collection expression type 'int' is not a valid object}}
34+
for (id se in i) // expected-error {{the type 'int' is not a pointer to a fast-enumerable object}}
3535
++i;
3636
}
3737
@end

clang/test/SemaObjCXX/instantiate-stmt.mm

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,20 @@ @interface NSString
3838
template<typename E, typename T>
3939
void fast_enumeration_test(T collection) {
4040
for (E element in collection) { // expected-error{{selector element type 'int' is not a valid object}} \
41-
// expected-error{{collection expression type 'vector' is not a valid object}}
41+
// expected-error{{the type 'vector' is not a pointer to a fast-enumerable object}}
4242
eat(element);
4343
}
4444

4545
E element;
4646
for (element in collection) // expected-error{{selector element type 'int' is not a valid object}} \
47-
// expected-error{{collection expression type 'vector' is not a valid object}}
47+
// expected-error{{the type 'vector' is not a pointer to a fast-enumerable object}}
4848
eat(element);
4949

50-
for (NSString *str in collection) // expected-error{{collection expression type 'vector' is not a valid object}}
50+
for (NSString *str in collection) // expected-error{{the type 'vector' is not a pointer to a fast-enumerable object}}
5151
eat(str);
5252

5353
NSString *str;
54-
for (str in collection) // expected-error{{collection expression type 'vector' is not a valid object}}
54+
for (str in collection) // expected-error{{the type 'vector' is not a pointer to a fast-enumerable object}}
5555
eat(str);
5656
}
5757

0 commit comments

Comments
 (0)