Skip to content

Commit 9ffed75

Browse files
committed
[Typed throws] Avoid dependency cycle between SimpleDidSetRequest and interface types
The implementation of `SimpleDidSetRequest` currently depends on a type-checked body for `didSet`, which in turn depends on the interface type (for the thrown error type). Break that dependency in a silly way for now.
1 parent 7b9c079 commit 9ffed75

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/AST/Decl.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -957,6 +957,14 @@ Type AbstractFunctionDecl::getThrownInterfaceType() const {
957957

958958
llvm::Optional<Type>
959959
AbstractFunctionDecl::getEffectiveThrownErrorType() const {
960+
// FIXME: Only getters can have thrown error types right now, and DidSet
961+
// has a cyclic reference if we try to get its interface type here. Find a
962+
// better way to express this.
963+
if (auto accessor = dyn_cast<AccessorDecl>(this)) {
964+
if (accessor->getAccessorKind() != AccessorKind::Get)
965+
return llvm::None;
966+
}
967+
960968
Type interfaceType = getInterfaceType();
961969
if (hasImplicitSelfDecl()) {
962970
if (auto fnType = interfaceType->getAs<AnyFunctionType>())

0 commit comments

Comments
 (0)