File tree Expand file tree Collapse file tree 2 files changed +47
-0
lines changed
Expand file tree Collapse file tree 2 files changed +47
-0
lines changed Original file line number Diff line number Diff line change @@ -1253,6 +1253,29 @@ final class DeclarationTests: ParserTestCase {
12531253 )
12541254 }
12551255
1256+ func testYields( ) {
1257+ assertParse (
1258+ " func test() yields(Int) -> Int { } "
1259+ )
1260+
1261+ assertParse (
1262+ " func test() yields(inout Int) -> Int { } "
1263+ )
1264+
1265+ assertParse (
1266+ " func test() throws(MyError) yields(inout Int) -> Int { } "
1267+ )
1268+
1269+ assertParse (
1270+ " func test() yields(inout Int) 1️⃣throws(MyError) -> Int { } " ,
1271+ diagnostics: [
1272+ DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " unexpected code 'throws(MyError) -> Int' in function " )
1273+ ]
1274+ // TODO: Enable after fixits would be added
1275+ // fixedSource: "func test() throws(MyError) yields(inout Int) -> Int { }"
1276+ )
1277+ }
1278+
12561279 func testExtraneousRightBraceRecovery( ) {
12571280 assertParse (
12581281 """
Original file line number Diff line number Diff line change @@ -772,6 +772,30 @@ final class TypeTests: ParserTestCase {
772772 """
773773 )
774774 }
775+
776+ func testYields( ) {
777+ assertParse (
778+ """
779+ { () yields(Int) -> Void in }
780+ """
781+ )
782+
783+ assertParse (
784+ " typealias T = () yields(Int) -> Void "
785+ )
786+
787+ assertParse (
788+ """
789+ { () yields(inout Int) -> Void in }
790+ """
791+ )
792+
793+ assertParse (
794+ """
795+ { () yields(inout Int) -> Int in }
796+ """
797+ )
798+ }
775799}
776800
777801final class InlineArrayTypeTests : ParserTestCase {
You can’t perform that action at this time.
0 commit comments