[CursorInfo] Fix bug when performing solver-based cursor info on Self

This commit is contained in:
Alex Hoppen
2023-02-08 11:11:18 +01:00
parent e7ee839189
commit 3e460630b7
2 changed files with 12 additions and 0 deletions

View File

@@ -81,6 +81,11 @@ const std::function<bool(const ExtensionDecl *)>
void PrintOptions::setBaseType(Type T) {
if (T->is<ErrorType>())
return;
if (auto DynamicSelf = T->getAs<DynamicSelfType>()) {
// TypeTransformContext requires `T` to have members. Look through dynamic
// Self.
T = DynamicSelf->getSelfType();
}
TransformContext = TypeTransformContext(T);
}

View File

@@ -0,0 +1,7 @@
class UserCollection {
static let staticMember = "ABC"
func test() {
// RUN: %sourcekitd-test -req=cursor -pos=%(line + 1):10 %s -- %s
Self.staticMember
}
}