Skip to content

Commit 12eda10

Browse files
authored
Merge pull request swiftlang#35002 from xymus/fix-func-proto-result-builder
[ModuleInterface] Print custom attributes on function protocol requirements
2 parents a884fe1 + 2ce140d commit 12eda10

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lib/AST/Attr.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,8 @@ bool DeclAttribute::printImpl(ASTPrinter &Printer, const PrintOptions &Options,
746746
if (auto *VD = dyn_cast<ValueDecl>(D)) {
747747
if (VD->getAttachedResultBuilder() == this) {
748748
if (!isa<ParamDecl>(D) &&
749-
!(isa<VarDecl>(D) && isa<ProtocolDecl>(D->getDeclContext())))
749+
!((isa<VarDecl>(D) || isa<FuncDecl>(D)) &&
750+
isa<ProtocolDecl>(D->getDeclContext())))
750751
return false;
751752
}
752753
}

test/ModuleInterface/result_builders.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,7 @@ public protocol ProtocolWithBuilderProperty {
6363

6464
// CHECK: @ResultBuilders.TupleBuilder var myVar: Self.Assoc { get }
6565
@TupleBuilder var myVar: Assoc { get }
66+
67+
// CHECK: @ResultBuilders.TupleBuilder func myFunc<T1, T2>(_ t1: T1, _ t2: T2) -> (T1, T2)
68+
@TupleBuilder func myFunc<T1, T2>(_ t1: T1, _ t2: T2) -> (T1, T2)
6669
}

0 commit comments

Comments
 (0)