@@ -116,9 +116,9 @@ final class TypeExprTests: ParserTestCase {
116
116
"""
117
117
)
118
118
119
- assertParse ( " (X).Y.self " , ExprSyntax . parse)
120
- assertParse ( " (X.Y).Z.self " , ExprSyntax . parse)
121
- assertParse ( " ((X).Y).Z.self " , ExprSyntax . parse)
119
+ assertParse ( " (X).Y.self " , { ExprSyntax . parse ( from : & $0 ) } )
120
+ assertParse ( " (X.Y).Z.self " , { ExprSyntax . parse ( from : & $0 ) } )
121
+ assertParse ( " ((X).Y).Z.self " , { ExprSyntax . parse ( from : & $0 ) } )
122
122
}
123
123
124
124
func testTypeExpr9( ) {
@@ -154,9 +154,9 @@ final class TypeExprTests: ParserTestCase {
154
154
"""
155
155
)
156
156
157
- assertParse ( " X?.self " , ExprSyntax . parse)
158
- assertParse ( " [X].self " , ExprSyntax . parse)
159
- assertParse ( " [X : Y].self " , ExprSyntax . parse)
157
+ assertParse ( " X?.self " , { ExprSyntax . parse ( from : & $0 ) } )
158
+ assertParse ( " [X].self " , { ExprSyntax . parse ( from : & $0 ) } )
159
+ assertParse ( " [X : Y].self " , { ExprSyntax . parse ( from : & $0 ) } )
160
160
}
161
161
162
162
func testTypeExpr11( ) {
@@ -182,12 +182,12 @@ final class TypeExprTests: ParserTestCase {
182
182
"""
183
183
)
184
184
185
- assertParse ( " (G<X>).Y.self " , ExprSyntax . parse)
186
- assertParse ( " X?.Y.self " , ExprSyntax . parse)
187
- assertParse ( " (X)?.Y.self " , ExprSyntax . parse)
188
- assertParse ( " (X?).Y.self " , ExprSyntax . parse)
189
- assertParse ( " [X].Y.self " , ExprSyntax . parse)
190
- assertParse ( " [X : Y].Z.self " , ExprSyntax . parse)
185
+ assertParse ( " (G<X>).Y.self " , { ExprSyntax . parse ( from : & $0 ) } )
186
+ assertParse ( " X?.Y.self " , { ExprSyntax . parse ( from : & $0 ) } )
187
+ assertParse ( " (X)?.Y.self " , { ExprSyntax . parse ( from : & $0 ) } )
188
+ assertParse ( " (X?).Y.self " , { ExprSyntax . parse ( from : & $0 ) } )
189
+ assertParse ( " [X].Y.self " , { ExprSyntax . parse ( from : & $0 ) } )
190
+ assertParse ( " [X : Y].Z.self " , { ExprSyntax . parse ( from : & $0 ) } )
191
191
}
192
192
193
193
func testTypeExpr12( ) {
@@ -578,107 +578,107 @@ final class TypeExprTests: ParserTestCase {
578
578
}
579
579
580
580
func testCompositionTypeExpr( ) {
581
- assertParse ( " P & Q " , ExprSyntax . parse)
582
- assertParse ( " P & Q.self " , ExprSyntax . parse)
583
- assertParse ( " any P & Q " , ExprSyntax . parse)
581
+ assertParse ( " P & Q " , { ExprSyntax . parse ( from : & $0 ) } )
582
+ assertParse ( " P & Q.self " , { ExprSyntax . parse ( from : & $0 ) } )
583
+ assertParse ( " any P & Q " , { ExprSyntax . parse ( from : & $0 ) } )
584
584
585
- assertParse ( " (P & Q).self " , ExprSyntax . parse)
586
- assertParse ( " ((P) & (Q)).self " , ExprSyntax . parse)
585
+ assertParse ( " (P & Q).self " , { ExprSyntax . parse ( from : & $0 ) } )
586
+ assertParse ( " ((P) & (Q)).self " , { ExprSyntax . parse ( from : & $0 ) } )
587
587
588
- assertParse ( " (A.B & C.D).self " , ExprSyntax . parse)
589
- assertParse ( " ((A).B & (C).D).self " , ExprSyntax . parse)
588
+ assertParse ( " (A.B & C.D).self " , { ExprSyntax . parse ( from : & $0 ) } )
589
+ assertParse ( " ((A).B & (C).D).self " , { ExprSyntax . parse ( from : & $0 ) } )
590
590
591
- assertParse ( " (G<X> & G<Y>).self " , ExprSyntax . parse)
592
- assertParse ( " (X? & Y?).self " , ExprSyntax . parse)
593
- assertParse ( " ([X] & [Y]).self " , ExprSyntax . parse)
594
- assertParse ( " ([A : B] & [C : D]).self " , ExprSyntax . parse)
591
+ assertParse ( " (G<X> & G<Y>).self " , { ExprSyntax . parse ( from : & $0 ) } )
592
+ assertParse ( " (X? & Y?).self " , { ExprSyntax . parse ( from : & $0 ) } )
593
+ assertParse ( " ([X] & [Y]).self " , { ExprSyntax . parse ( from : & $0 ) } )
594
+ assertParse ( " ([A : B] & [C : D]).self " , { ExprSyntax . parse ( from : & $0 ) } )
595
595
596
- assertParse ( " (G<A>.B & G<C>.D).self " , ExprSyntax . parse)
597
- assertParse ( " (A?.B & C?.D).self " , ExprSyntax . parse)
598
- assertParse ( " ([A].B & [A].B).self " , ExprSyntax . parse)
599
- assertParse ( " ([A : B].C & [D : E].F).self " , ExprSyntax . parse)
596
+ assertParse ( " (G<A>.B & G<C>.D).self " , { ExprSyntax . parse ( from : & $0 ) } )
597
+ assertParse ( " (A?.B & C?.D).self " , { ExprSyntax . parse ( from : & $0 ) } )
598
+ assertParse ( " ([A].B & [A].B).self " , { ExprSyntax . parse ( from : & $0 ) } )
599
+ assertParse ( " ([A : B].C & [D : E].F).self " , { ExprSyntax . parse ( from : & $0 ) } )
600
600
601
- assertParse ( " (X.Type & Y.Type).self " , ExprSyntax . parse)
602
- assertParse ( " (X.Protocol & Y.Protocol).self " , ExprSyntax . parse)
601
+ assertParse ( " (X.Type & Y.Type).self " , { ExprSyntax . parse ( from : & $0 ) } )
602
+ assertParse ( " (X.Protocol & Y.Protocol).self " , { ExprSyntax . parse ( from : & $0 ) } )
603
603
604
- assertParse ( " ((A, B) & (C, D)).self " , ExprSyntax . parse)
604
+ assertParse ( " ((A, B) & (C, D)).self " , { ExprSyntax . parse ( from : & $0 ) } )
605
605
}
606
606
607
607
func testTupleTypeExpr( ) {
608
- assertParse ( " (X).self " , ExprSyntax . parse)
608
+ assertParse ( " (X).self " , { ExprSyntax . parse ( from : & $0 ) } )
609
609
610
- assertParse ( " (X, Y) " , ExprSyntax . parse)
610
+ assertParse ( " (X, Y) " , { ExprSyntax . parse ( from : & $0 ) } )
611
611
612
- assertParse ( " (X, Y).self " , ExprSyntax . parse)
613
- assertParse ( " ((X), (Y)).self " , ExprSyntax . parse)
612
+ assertParse ( " (X, Y).self " , { ExprSyntax . parse ( from : & $0 ) } )
613
+ assertParse ( " ((X), (Y)).self " , { ExprSyntax . parse ( from : & $0 ) } )
614
614
615
- assertParse ( " (A.B, C.D).self " , ExprSyntax . parse)
616
- assertParse ( " ((A).B, (C).D).self " , ExprSyntax . parse)
615
+ assertParse ( " (A.B, C.D).self " , { ExprSyntax . parse ( from : & $0 ) } )
616
+ assertParse ( " ((A).B, (C).D).self " , { ExprSyntax . parse ( from : & $0 ) } )
617
617
618
- assertParse ( " (G<X>, G<Y>).self " , ExprSyntax . parse)
619
- assertParse ( " (X?, Y?).self " , ExprSyntax . parse)
620
- assertParse ( " ([X], [Y]).self " , ExprSyntax . parse)
621
- assertParse ( " ([A : B], [C : D]).self " , ExprSyntax . parse)
618
+ assertParse ( " (G<X>, G<Y>).self " , { ExprSyntax . parse ( from : & $0 ) } )
619
+ assertParse ( " (X?, Y?).self " , { ExprSyntax . parse ( from : & $0 ) } )
620
+ assertParse ( " ([X], [Y]).self " , { ExprSyntax . parse ( from : & $0 ) } )
621
+ assertParse ( " ([A : B], [C : D]).self " , { ExprSyntax . parse ( from : & $0 ) } )
622
622
623
- assertParse ( " (G<A>.B, G<C>.D).self " , ExprSyntax . parse)
624
- assertParse ( " (A?.B, C?.D).self " , ExprSyntax . parse)
625
- assertParse ( " ([A].B, [C].D).self " , ExprSyntax . parse)
626
- assertParse ( " ([A : B].C, [D : E].F).self " , ExprSyntax . parse)
623
+ assertParse ( " (G<A>.B, G<C>.D).self " , { ExprSyntax . parse ( from : & $0 ) } )
624
+ assertParse ( " (A?.B, C?.D).self " , { ExprSyntax . parse ( from : & $0 ) } )
625
+ assertParse ( " ([A].B, [C].D).self " , { ExprSyntax . parse ( from : & $0 ) } )
626
+ assertParse ( " ([A : B].C, [D : E].F).self " , { ExprSyntax . parse ( from : & $0 ) } )
627
627
628
- assertParse ( " (X.Type, Y.Type).self " , ExprSyntax . parse)
629
- assertParse ( " (X.Protocol, Y.Protocol).self " , ExprSyntax . parse)
628
+ assertParse ( " (X.Type, Y.Type).self " , { ExprSyntax . parse ( from : & $0 ) } )
629
+ assertParse ( " (X.Protocol, Y.Protocol).self " , { ExprSyntax . parse ( from : & $0 ) } )
630
630
631
- assertParse ( " (P & Q, P & Q).self " , ExprSyntax . parse)
631
+ assertParse ( " (P & Q, P & Q).self " , { ExprSyntax . parse ( from : & $0 ) } )
632
632
633
633
assertParse (
634
634
"""
635
635
(
636
636
(G<X>.Y) -> (P) & X?.Y, (X.Y, [X : Y?].Type), [(G<X>).Y], [A.B.C].D
637
637
).self
638
638
""" ,
639
- ExprSyntax . parse
639
+ { ExprSyntax . parse ( from : & $0 ) }
640
640
)
641
641
}
642
642
643
643
func testFunctionTypeExpr( ) {
644
- assertParse ( " X -> Y " , ExprSyntax . parse)
645
- assertParse ( " (X) -> Y " , ExprSyntax . parse)
646
- assertParse ( " (X) -> Y -> Z " , ExprSyntax . parse)
647
- assertParse ( " P & Q -> X " , ExprSyntax . parse)
648
- assertParse ( " A & B -> C & D -> X " , ExprSyntax . parse)
649
- assertParse ( " (X -> Y).self " , ExprSyntax . parse)
650
- assertParse ( " (A & B -> C & D).self " , ExprSyntax . parse)
644
+ assertParse ( " X -> Y " , { ExprSyntax . parse ( from : & $0 ) } )
645
+ assertParse ( " (X) -> Y " , { ExprSyntax . parse ( from : & $0 ) } )
646
+ assertParse ( " (X) -> Y -> Z " , { ExprSyntax . parse ( from : & $0 ) } )
647
+ assertParse ( " P & Q -> X " , { ExprSyntax . parse ( from : & $0 ) } )
648
+ assertParse ( " A & B -> C & D -> X " , { ExprSyntax . parse ( from : & $0 ) } )
649
+ assertParse ( " (X -> Y).self " , { ExprSyntax . parse ( from : & $0 ) } )
650
+ assertParse ( " (A & B -> C & D).self " , { ExprSyntax . parse ( from : & $0 ) } )
651
651
652
- assertParse ( " ((X) -> Y).self " , ExprSyntax . parse)
653
- assertParse ( " (((X)) -> (Y)).self " , ExprSyntax . parse)
652
+ assertParse ( " ((X) -> Y).self " , { ExprSyntax . parse ( from : & $0 ) } )
653
+ assertParse ( " (((X)) -> (Y)).self " , { ExprSyntax . parse ( from : & $0 ) } )
654
654
655
- assertParse ( " ((A.B) -> C.D).self " , ExprSyntax . parse)
656
- assertParse ( " (((A).B) -> (C).D).self " , ExprSyntax . parse)
655
+ assertParse ( " ((A.B) -> C.D).self " , { ExprSyntax . parse ( from : & $0 ) } )
656
+ assertParse ( " (((A).B) -> (C).D).self " , { ExprSyntax . parse ( from : & $0 ) } )
657
657
658
- assertParse ( " ((G<X>) -> G<Y>).self " , ExprSyntax . parse)
659
- assertParse ( " ((X?) -> Y?).self " , ExprSyntax . parse)
660
- assertParse ( " (([X]) -> [Y]).self " , ExprSyntax . parse)
661
- assertParse ( " (([A : B]) -> [C : D]).self " , ExprSyntax . parse)
658
+ assertParse ( " ((G<X>) -> G<Y>).self " , { ExprSyntax . parse ( from : & $0 ) } )
659
+ assertParse ( " ((X?) -> Y?).self " , { ExprSyntax . parse ( from : & $0 ) } )
660
+ assertParse ( " (([X]) -> [Y]).self " , { ExprSyntax . parse ( from : & $0 ) } )
661
+ assertParse ( " (([A : B]) -> [C : D]).self " , { ExprSyntax . parse ( from : & $0 ) } )
662
662
663
- assertParse ( " ((Gen<Foo>.Bar) -> Gen<Foo>.Bar).self " , ExprSyntax . parse)
664
- assertParse ( " ((Foo?.Bar) -> Foo?.Bar).self " , ExprSyntax . parse)
665
- assertParse ( " (([Foo].Element) -> [Foo].Element).self " , ExprSyntax . parse)
666
- assertParse ( " (([Int : Foo].Element) -> [Int : Foo].Element).self " , ExprSyntax . parse)
663
+ assertParse ( " ((Gen<Foo>.Bar) -> Gen<Foo>.Bar).self " , { ExprSyntax . parse ( from : & $0 ) } )
664
+ assertParse ( " ((Foo?.Bar) -> Foo?.Bar).self " , { ExprSyntax . parse ( from : & $0 ) } )
665
+ assertParse ( " (([Foo].Element) -> [Foo].Element).self " , { ExprSyntax . parse ( from : & $0 ) } )
666
+ assertParse ( " (([Int : Foo].Element) -> [Int : Foo].Element).self " , { ExprSyntax . parse ( from : & $0 ) } )
667
667
668
- assertParse ( " ((X.Type) -> Y.Type).self " , ExprSyntax . parse)
669
- assertParse ( " ((X.Protocol) -> Y.Protocol).self " , ExprSyntax . parse)
668
+ assertParse ( " ((X.Type) -> Y.Type).self " , { ExprSyntax . parse ( from : & $0 ) } )
669
+ assertParse ( " ((X.Protocol) -> Y.Protocol).self " , { ExprSyntax . parse ( from : & $0 ) } )
670
670
671
- assertParse ( " (() -> X & Y).self " , ExprSyntax . parse)
672
- assertParse ( " ((A & B) -> C & D).self " , ExprSyntax . parse)
673
- assertParse ( " ((A & B) -> (C & D) -> E & Any).self " , ExprSyntax . parse)
671
+ assertParse ( " (() -> X & Y).self " , { ExprSyntax . parse ( from : & $0 ) } )
672
+ assertParse ( " ((A & B) -> C & D).self " , { ExprSyntax . parse ( from : & $0 ) } )
673
+ assertParse ( " ((A & B) -> (C & D) -> E & Any).self " , { ExprSyntax . parse ( from : & $0 ) } )
674
674
675
675
assertParse (
676
676
"""
677
677
(
678
678
((P) & X?.Y, G<X>.Y, (X, [A : B?].Type)) -> ([(X).Y]) -> [X].Y
679
679
).self
680
680
""" ,
681
- ExprSyntax . parse
681
+ { ExprSyntax . parse ( from : & $0 ) }
682
682
)
683
683
}
684
684
0 commit comments