File tree Expand file tree Collapse file tree 3 files changed +9
-5
lines changed Expand file tree Collapse file tree 3 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -468,8 +468,10 @@ ParserResult<TypeRepr> Parser::parseTypeIdentifierOrTypeComposition() {
468
468
StringRef TrailingContent = L->getTokenAt (RAngleLoc).getRange ().str ().
469
469
substr (1 );
470
470
if (!TrailingContent.empty ()) {
471
- replacement.insert (replacement.begin (), ' (' );
472
- replacement += " )" ;
471
+ if (Protocols.size () > 1 ) {
472
+ replacement.insert (replacement.begin (), ' (' );
473
+ replacement += " )" ;
474
+ }
473
475
replacement += TrailingContent;
474
476
}
475
477
Original file line number Diff line number Diff line change @@ -308,4 +308,4 @@ func testBoolValue(a : BoolFoo) {
308
308
protocol P1 {}
309
309
protocol P2 {}
310
310
var a : (P1 & P2)?
311
- var a2 : (P1) = 17 as! P1
311
+ var a2 : P1 = 17 as! P1
Original file line number Diff line number Diff line change @@ -123,9 +123,11 @@ func testConversion() {
123
123
}
124
124
125
125
// Test the parser's splitting of >= into > and =.
126
- var x : protocol < P5 > = 17 // expected-warning {{'protocol<...>' composition syntax is deprecated and not needed here}} {{9-22=(P5)=}}
126
+ var x : protocol < P5 > = 17 // expected-warning {{'protocol<...>' composition syntax is deprecated and not needed here}} {{9-22=P5=}}
127
+ var y : protocol < P5 , P7 > = 17 // expected-warning {{'protocol<...>' composition syntax is deprecated; join the protocols using '&'}} {{9-26=(P5 & P7)=}}
127
128
128
- typealias A = protocol < > // expected-warning {{'protocol<>' syntax is deprecated; use 'Any' instead}} {{15-25=Any}}
129
+ typealias A1 = protocol < > // expected-warning {{'protocol<>' syntax is deprecated; use 'Any' instead}} {{16-26=Any}}
130
+ typealias A2 = protocol < > ? // expected-warning {{'protocol<>' syntax is deprecated; use 'Any' instead}} {{16-27=Any?}}
129
131
typealias B1 = protocol < P1 , P2 > // expected-warning {{'protocol<...>' composition syntax is deprecated; join the protocols using '&'}} {{16-31=P1 & P2}}
130
132
typealias B2 = protocol < P1 , P2 > // expected-warning {{'protocol<...>' composition syntax is deprecated; join the protocols using '&'}} {{16-32=P1 & P2}}
131
133
typealias B3 = protocol < P1 , P2 > // expected-warning {{'protocol<...>' composition syntax is deprecated; join the protocols using '&'}} {{16-32=P1 & P2}}
You can’t perform that action at this time.
0 commit comments