llvm-project/clang/test/CodeCompletion/objc-protocol-member-access.m
Sam McCall 8e9baa3f17 [CodeComplete] Penalize inherited ObjC properties for auto-completion
Summary:
Similar to auto-completion for ObjC methods, inherited properties
should be penalized / direct class and category properties should
be prioritized.

Note that currently, the penalty for using a result from a base class
(CCD_InBaseClass) is equal to the penalty for using a method as a
property (CCD_MethodAsProperty).

Reviewers: jkorous, sammccall, akyrtzi, arphaman, benlangmuir

Reviewed By: sammccall, akyrtzi

Subscribers: arphaman, cfe-commits

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

llvm-svn: 347352
2018-11-20 22:06:54 +00:00

25 lines
526 B
Objective-C

// Note: the run lines follow their respective tests, since line/column
// matter in this test.
@protocol Bar
@property (readonly) int bar;
@end
@protocol Foo <Bar>
@property (nonatomic, readonly) int foo;
- (void)foobar: (int)x;
@end
int getFoo(id object) {
id<Foo> modelObject = (id<Foo>)object;
int foo = modelObject.;
return foo;
}
// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:17:25 %s -o - | FileCheck %s
// CHECK: bar (InBase) : [#int#]bar
// CHECK: foo (InBase) : [#int#]foo
// CHECK-NOT: foobar