Skip to content

Commit 3e46063

Browse files
committed
[CursorInfo] Fix bug when performing solver-based cursor info on Self
1 parent e7ee839 commit 3e46063

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

lib/AST/ASTPrinter.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ const std::function<bool(const ExtensionDecl *)>
8181
void PrintOptions::setBaseType(Type T) {
8282
if (T->is<ErrorType>())
8383
return;
84+
if (auto DynamicSelf = T->getAs<DynamicSelfType>()) {
85+
// TypeTransformContext requires `T` to have members. Look through dynamic
86+
// Self.
87+
T = DynamicSelf->getSelfType();
88+
}
8489
TransformContext = TypeTransformContext(T);
8590
}
8691

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class UserCollection {
2+
static let staticMember = "ABC"
3+
func test() {
4+
// RUN: %sourcekitd-test -req=cursor -pos=%(line + 1):10 %s -- %s
5+
Self.staticMember
6+
}
7+
}

0 commit comments

Comments
 (0)