Skip to content

Commit 1ed94ff

Browse files
committed
[SourceKit] Trigger generation of synthesized accessors in solver-based cursor info
1 parent 2fb487f commit 1ed94ff

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

lib/IDE/CursorInfo.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,12 @@ void typeCheckDeclAndParentClosures(ValueDecl *VD) {
5050
typeCheckASTNodeAtLoc(
5151
TypeCheckASTNodeAtLocContext::declContext(VD->getDeclContext()),
5252
VD->getLoc());
53-
// Type check any attached property wrappers so the annotated declaration can
54-
// refer to their USRs
5553
if (auto VarD = dyn_cast<VarDecl>(VD)) {
54+
// Type check any attached property wrappers so the annotated declaration
55+
// can refer to their USRs.
5656
(void)VarD->getPropertyWrapperBackingPropertyType();
57+
// Visit emitted accessors so we generated accessors from property wrappers.
58+
VarD->visitEmittedAccessors([&](AccessorDecl *accessor) {});
5759
}
5860
}
5961

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
func test() {
2+
struct MyStruct {
3+
// RUN: %sourcekitd-test -req=cursor -pos=%(line + 1):16 %s -- %s | %FileCheck %s
4+
@State var myState
5+
}
6+
}
7+
8+
@propertyWrapper struct State {
9+
init(initialValue value: Int) {}
10+
11+
public var wrappedValue: Int {
12+
get { return 1 }
13+
nonmutating set { }
14+
}
15+
}
16+
17+
// CHECK: <Declaration>@<Type usr="s:46cursor_infer_nonmutating_from_property_wrapper5StateV">State</Type> var myState: &lt;&lt;error type&gt;&gt; { get nonmutating set }</Declaration>

0 commit comments

Comments
 (0)