Skip to content

Commit bf0e0f1

Browse files
committed
[CSClosure] $__builderSelf should be allowed to carry type variables
Just like parameter types, `$__builderSelf` is allowed to have not yet inferred type variables.
1 parent 861f5c8 commit bf0e0f1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/Sema/CSClosure.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,13 @@ class TypeVariableRefFinder : public ASTWalker {
6363
auto *decl = DRE->getDecl();
6464

6565
if (auto type = CS.getTypeIfAvailable(DRE->getDecl())) {
66+
auto &ctx = CS.getASTContext();
6667
// If this is not one of the closure parameters which
6768
// is inferrable from the body, let's replace type
6869
// variables with errors to avoid bringing external
6970
// information to the element component.
70-
if (type->hasTypeVariable() && !isa<ParamDecl>(decl)) {
71+
if (type->hasTypeVariable() &&
72+
!(isa<ParamDecl>(decl) || decl->getName() == ctx.Id_builderSelf)) {
7173
// If there are type variables left in the simplified version,
7274
// it means that this is an invalid external declaration
7375
// relative to this element's context.

0 commit comments

Comments
 (0)