You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@_functionBuilder // expected-warning{{'@_functionBuilder' has been renamed to '@resultBuilder'}}{{2-18=resultBuilder}}
4
+
structMyBuilder{
5
+
staticfunc buildBlock(_:Any...)->Any{}
6
+
}
7
+
8
+
// rdar://104384604 - empty result builder in swiftinterface file
9
+
@resultBuilder
10
+
publicstructTestInvalidBuildBlock1{
11
+
// expected-error@-1 {{result builder must provide at least one static 'buildBlock' as accessible as result builder type 'TestInvalidBuildBlock1' (which is public)}}
12
+
staticfunc buildBlock(_:Int)->Int{42}
13
+
}
14
+
15
+
@resultBuilder
16
+
publicstructTestInvalidBuildBlock2{ // Ok
17
+
staticfunc buildBlock(_:Int)->Int{42}
18
+
publicstaticfunc buildBlock(_:String)->String{""}
19
+
}
20
+
21
+
@resultBuilder
22
+
publicstructTestInvalidBuildPartialBlockFirst1{
23
+
// expected-error@-1 {{result builder must provide at least one static 'buildPartialBlock(first:)' as accessible as result builder type 'TestInvalidBuildPartialBlockFirst1' (which is public)}}
24
+
staticfunc buildPartialBlock(first:Int)->Int{ first }
25
+
publicstaticfunc buildPartialBlock(accumulated:Int, next:Int)->Int{ accumulated + next }
26
+
}
27
+
28
+
@resultBuilder
29
+
publicstructTestInvalidBuildPartialBlockFirst2{ // Ok
30
+
staticfunc buildPartialBlock(first:Int)->Int{ first }
31
+
publicstaticfunc buildPartialBlock<T>(first:T)->T{ first }
32
+
publicstaticfunc buildPartialBlock(accumulated:Int, next:Int)->Int{ accumulated + next }
// expected-error@-1 {{result builder must provide at least one static 'buildPartialBlock(accumulated:next:)' as accessible as result builder type 'TestInvalidBuildPartialBlockAccumulated1' (which is public)}}
38
+
publicstaticfunc buildPartialBlock(first:Int)->Int{ first }
39
+
privatestaticfunc buildPartialBlock(accumulated:Int, next:Int)->Int{ accumulated + next }
40
+
}
41
+
42
+
@resultBuilder
43
+
publicstructTestInvalidBuildPartialBlockAccumulated2{ // Ok
44
+
publicstaticfunc buildPartialBlock<T>(first:T)->T{ first }
0 commit comments