File: print_ast_tc_decls.swift

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (1445 lines) | stat: -rw-r--r-- 57,778 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
// RUN: %empty-directory(%t)
//
// Build swift modules this test depends on.
// RUN: %target-swift-frontend -emit-module -o %t %S/Inputs/foo_swift_module.swift -enable-objc-interop -disable-objc-attr-requires-foundation-module
//
// FIXME: BEGIN -enable-source-import hackaround
// RUN:  %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -emit-module -o %t  %S/../Inputs/clang-importer-sdk/swift-modules/ObjectiveC.swift -enable-objc-interop -disable-objc-attr-requires-foundation-module
// FIXME: END -enable-source-import hackaround
//
// This file should not have any syntax or type checker errors.
// RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -swift-version 4 -D ERRORS -typecheck -verify %s -F %S/Inputs/mock-sdk -enable-objc-interop -disable-objc-attr-requires-foundation-module
//
// RUN: %target-swift-ide-test(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -swift-version 4 -skip-deinit=false -print-ast-typechecked -source-filename %s -F %S/Inputs/mock-sdk -function-definitions=false -prefer-type-repr=false -print-implicit-attrs=true -enable-objc-interop -disable-objc-attr-requires-foundation-module > %t.printed.txt
// RUN: %FileCheck %s -check-prefix=PASS_COMMON -strict-whitespace < %t.printed.txt
// RUN: %FileCheck %s -check-prefixes=PASS_PRINT_AST,PASS_PRINT_AST_TYPE -strict-whitespace < %t.printed.txt
// RUN: %FileCheck %s -check-prefix=PASS_RW_PROP_GET_SET -strict-whitespace < %t.printed.txt
// RUN: %FileCheck %s -check-prefix=PASS_2200 -strict-whitespace < %t.printed.txt
// RUN: %FileCheck %s -check-prefix=PASS_2500 -strict-whitespace < %t.printed.txt
// RUN: %FileCheck %s -check-prefix=PASS_ONE_LINE -strict-whitespace < %t.printed.txt
// RUN: %FileCheck %s -check-prefix=PASS_ONE_LINE_TYPE -strict-whitespace < %t.printed.txt
// RUN: %FileCheck %s -check-prefix=PREFER_TYPE_PRINTING -strict-whitespace < %t.printed.txt
// RUN: %FileCheck %s -check-prefix=PASS_QUAL_UNQUAL -strict-whitespace < %t.printed.txt
//
// RUN: %target-swift-ide-test(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -swift-version 4 -skip-deinit=false -print-ast-typechecked -source-filename %s -F %S/Inputs/mock-sdk -function-definitions=false -prefer-type-repr=true -print-implicit-attrs=true -enable-objc-interop -disable-objc-attr-requires-foundation-module > %t.printed.txt
// RUN: %FileCheck %s -check-prefix=PASS_COMMON -strict-whitespace < %t.printed.txt
// RUN: %FileCheck %s -check-prefixes=PASS_PRINT_AST,PASS_PRINT_AST_TYPEREPR -strict-whitespace < %t.printed.txt
// RUN: %FileCheck %s -check-prefix=PASS_RW_PROP_GET_SET -strict-whitespace < %t.printed.txt
// RUN: %FileCheck %s -check-prefix=PASS_2200 -strict-whitespace < %t.printed.txt
// RUN: %FileCheck %s -check-prefix=PASS_2500 -strict-whitespace < %t.printed.txt
// RUN: %FileCheck %s -check-prefix=PASS_ONE_LINE -strict-whitespace < %t.printed.txt
// RUN: %FileCheck %s -check-prefix=PASS_ONE_LINE_TYPEREPR -strict-whitespace < %t.printed.txt
// RUN: %FileCheck %s -check-prefix=PREFER_TYPE_REPR_PRINTING -strict-whitespace < %t.printed.txt
// RUN: %FileCheck %s -check-prefix=PASS_QUAL_UNQUAL -strict-whitespace < %t.printed.txt
//
// RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -swift-version 4 -emit-module -o %t -F %S/Inputs/mock-sdk -enable-objc-interop -disable-objc-attr-requires-foundation-module %s
// RUN: %target-swift-ide-test(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -swift-version 4 -skip-deinit=false -print-module -source-filename %s -F %S/Inputs/mock-sdk -module-to-print=print_ast_tc_decls -print-implicit-attrs=true -enable-objc-interop -disable-objc-attr-requires-foundation-module > %t.printed.txt
// RUN: %FileCheck %s -check-prefix=PASS_COMMON -strict-whitespace < %t.printed.txt
// RUN: %FileCheck %s -check-prefix=PASS_PRINT_MODULE_INTERFACE -strict-whitespace < %t.printed.txt
// RUN: %FileCheck %s -check-prefix=PASS_RW_PROP_NO_GET_SET -strict-whitespace < %t.printed.txt
// RUN: %FileCheck %s -check-prefix=PASS_2200_DESERIALIZED -strict-whitespace < %t.printed.txt
// FIXME: rdar://15167697
// FIXME: %FileCheck %s -check-prefix=PASS_2500 -strict-whitespace < %t.printed.txt
// RUN: %FileCheck %s -check-prefix=PASS_ONE_LINE -strict-whitespace < %t.printed.txt
// RUN: %FileCheck %s -check-prefix=PREFER_TYPE_REPR_PRINTING -strict-whitespace < %t.printed.txt
// RUN: %FileCheck %s -check-prefix=PASS_QUAL_UNQUAL -strict-whitespace < %t.printed.txt
// RUN: %FileCheck %s -check-prefix=PASS_EXPLODE_PATTERN -strict-whitespace < %t.printed.txt
//
// RUN: %target-swift-ide-test(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -skip-deinit=false -print-module -source-filename %s -F %S/Inputs/mock-sdk -I %t -module-to-print=print_ast_tc_decls -synthesize-sugar-on-types=true -print-implicit-attrs=true -enable-objc-interop -disable-objc-attr-requires-foundation-module > %t.printed.txt
// RUN: %FileCheck %s -check-prefix=PASS_PRINT_MODULE_INTERFACE -strict-whitespace < %t.printed.txt
// RUN: %FileCheck %s -check-prefix=PASS_QUAL_UNQUAL -strict-whitespace < %t.printed.txt
// RUN: %FileCheck %s -check-prefix=SYNTHESIZE_SUGAR_ON_TYPES -strict-whitespace < %t.printed.txt
// RUN: %FileCheck %s -check-prefix=PASS_EXPLODE_PATTERN -strict-whitespace < %t.printed.txt

// RUN: %target-swift-ide-test(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -skip-deinit=false -print-module -source-filename %s -F %S/Inputs/mock-sdk -I %t -module-to-print=print_ast_tc_decls -synthesize-sugar-on-types=true -fully-qualified-types-if-ambiguous=true -print-implicit-attrs=true -enable-objc-interop -disable-objc-attr-requires-foundation-module > %t.printed.txt
// RUN: %FileCheck %s -check-prefix=PASS_PRINT_MODULE_INTERFACE -strict-whitespace < %t.printed.txt
// RUN: %FileCheck %s -check-prefix=PASS_QUAL_IF_AMBIGUOUS -strict-whitespace < %t.printed.txt
// RUN: %FileCheck %s -check-prefix=SYNTHESIZE_SUGAR_ON_TYPES -strict-whitespace < %t.printed.txt
// FIXME: %FileCheck %s -check-prefix=PASS_EXPLODE_PATTERN -strict-whitespace < %t.printed.txt

// FIXME: rdar://problem/19648117 Needs splitting objc parts out
// REQUIRES: objc_interop

import Bar
import ObjectiveC
import class Foo.FooClassBase
import struct Foo.FooStruct1
import func Foo.fooFunc1
@_exported import FooHelper
import foo_swift_module

// FIXME: enum tests
//import enum FooClangModule.FooEnum1

// PASS_COMMON: {{^}}import Bar{{$}}
// PASS_COMMON: {{^}}import class Foo.FooClassBase{{$}}
// PASS_COMMON: {{^}}import struct Foo.FooStruct1{{$}}
// PASS_COMMON: {{^}}import func Foo.fooFunc1{{$}}
// PASS_COMMON: {{^}}@_exported import FooHelper{{$}}
// PASS_COMMON: {{^}}import foo_swift_module{{$}}

//===---
//===--- Helper types.
//===---

struct FooStruct {}

class FooClass {}
class BarClass {}

protocol FooProtocol {}
protocol BarProtocol {}
protocol BazProtocol { func baz() }
protocol QuxProtocol {
  associatedtype Qux
}

protocol SubFooProtocol : FooProtocol { }

class FooProtocolImpl : FooProtocol {}
class FooBarProtocolImpl : FooProtocol, BarProtocol {}
class BazProtocolImpl : BazProtocol { func baz() {} }

//===---
//===--- Basic smoketest.
//===---

struct d0100_FooStruct {
// PASS_COMMON-LABEL: {{^}}struct d0100_FooStruct {{{$}}

  var instanceVar1: Int = 0
// PASS_COMMON-NEXT: {{^}}  @_hasInitialValue var instanceVar1: Int{{$}}

  var computedProp1: Int {
    get {
      return 42
    }
  }
// PASS_COMMON-NEXT: {{^}}  var computedProp1: Int { get }{{$}}

  func instanceFunc0() {}
// PASS_COMMON-NEXT: {{^}}  func instanceFunc0(){{$}}

  func instanceFunc1(a: Int) {}
// PASS_COMMON-NEXT: {{^}}  func instanceFunc1(a: Int){{$}}

  func instanceFunc2(a: Int, b: inout Double) {}
// PASS_COMMON-NEXT: {{^}}  func instanceFunc2(a: Int, b: inout Double){{$}}

  func instanceFunc3(a: Int, b: Double) { var a = a; a = 1; _ = a }
// PASS_COMMON-NEXT: {{^}}  func instanceFunc3(a: Int, b: Double){{$}}

  func instanceFuncWithDefaultArg1(a: Int = 0) {}
// PASS_COMMON-NEXT: {{^}}  func instanceFuncWithDefaultArg1(a: Int = 0){{$}}

  func instanceFuncWithDefaultArg2(a: Int = 0, b: Double = 0) {}
// PASS_COMMON-NEXT: {{^}}  func instanceFuncWithDefaultArg2(a: Int = 0, b: Double = 0){{$}}

  func varargInstanceFunc0(v: Int...) {}
// PASS_COMMON-NEXT: {{^}}  func varargInstanceFunc0(v: Int...){{$}}

  func varargInstanceFunc1(a: Float, v: Int...) {}
// PASS_COMMON-NEXT: {{^}}  func varargInstanceFunc1(a: Float, v: Int...){{$}}

  func varargInstanceFunc2(a: Float, b: Double, v: Int...) {}
// PASS_COMMON-NEXT: {{^}}  func varargInstanceFunc2(a: Float, b: Double, v: Int...){{$}}

  func overloadedInstanceFunc1() -> Int { return 0; }
// PASS_COMMON-NEXT: {{^}}  func overloadedInstanceFunc1() -> Int{{$}}

  func overloadedInstanceFunc1() -> Double { return 0.0; }
// PASS_COMMON-NEXT: {{^}}  func overloadedInstanceFunc1() -> Double{{$}}

  func overloadedInstanceFunc2(x: Int) -> Int { return 0; }
// PASS_COMMON-NEXT: {{^}}  func overloadedInstanceFunc2(x: Int) -> Int{{$}}

  func overloadedInstanceFunc2(x: Double) -> Int { return 0; }
// PASS_COMMON-NEXT: {{^}}  func overloadedInstanceFunc2(x: Double) -> Int{{$}}

  func builderFunc1(a: Int) -> d0100_FooStruct { return d0100_FooStruct(); }
// PASS_COMMON-NEXT: {{^}}  func builderFunc1(a: Int) -> d0100_FooStruct{{$}}

  subscript(i: Int) -> Double {
    get {
      return Double(i)
    }
  }
// PASS_COMMON-NEXT: {{^}}  subscript(i: Int) -> Double { get }{{$}}

  subscript(i: Int, j: Int) -> Double {
    get {
      return Double(i + j)
    }
  }
// PASS_COMMON-NEXT: {{^}}  subscript(i: Int, j: Int) -> Double { get }{{$}}
  
  static subscript(i: Int) -> Double {
    get {
      return Double(i)
    }
  }
// PASS_COMMON-NEXT: {{^}}  static subscript(i: Int) -> Double { get }{{$}}

  func bodyNameVoidFunc1(a: Int, b x: Float) {}
// PASS_COMMON-NEXT: {{^}}  func bodyNameVoidFunc1(a: Int, b x: Float){{$}}

  func bodyNameVoidFunc2(a: Int, b x: Float, c y: Double) {}
// PASS_COMMON-NEXT: {{^}}  func bodyNameVoidFunc2(a: Int, b x: Float, c y: Double){{$}}

  func bodyNameStringFunc1(a: Int, b x: Float) -> String { return "" }
// PASS_COMMON-NEXT: {{^}}  func bodyNameStringFunc1(a: Int, b x: Float) -> String{{$}}

  func bodyNameStringFunc2(a: Int, b x: Float, c y: Double) -> String { return "" }
// PASS_COMMON-NEXT: {{^}}  func bodyNameStringFunc2(a: Int, b x: Float, c y: Double) -> String{{$}}

  struct NestedStruct {}
// PASS_COMMON-NEXT: {{^}}  struct NestedStruct {{{$}}
// PASS_COMMON-NEXT: {{^}}    init(){{$}}
// PASS_COMMON-NEXT: {{^}}  }{{$}}

  class NestedClass {}
// PASS_COMMON-NEXT: {{^}}  class NestedClass {{{$}}
// PASS_COMMON-NEXT: {{^}}    @objc deinit{{$}}
// PASS_COMMON-NEXT: {{^}}    init(){{$}}
// PASS_COMMON-NEXT: {{^}}  }{{$}}

  enum NestedEnum {}
// PASS_COMMON-NEXT: {{^}}  enum NestedEnum {{{$}}
// PASS_COMMON-NEXT: {{^}}  }{{$}}

  // Cannot declare a nested protocol.
  // protocol NestedProtocol {}

  typealias NestedTypealias = Int
// PASS_COMMON-NEXT: {{^}}  typealias NestedTypealias = Int{{$}}

  static var staticVar1: Int = 42
// PASS_COMMON-NEXT: {{^}}  @_hasInitialValue static var staticVar1: Int{{$}}

  static var computedStaticProp1: Int {
    get {
      return 42
    }
  }
// PASS_COMMON-NEXT: {{^}}  static var computedStaticProp1: Int { get }{{$}}

  static func staticFunc0() {}
// PASS_COMMON-NEXT: {{^}}  static func staticFunc0(){{$}}

  static func staticFunc1(a: Int) {}
// PASS_COMMON-NEXT: {{^}}  static func staticFunc1(a: Int){{$}}

  static func overloadedStaticFunc1() -> Int { return 0 }
// PASS_COMMON-NEXT: {{^}}  static func overloadedStaticFunc1() -> Int{{$}}

  static func overloadedStaticFunc1() -> Double { return 0.0 }
// PASS_COMMON-NEXT: {{^}}  static func overloadedStaticFunc1() -> Double{{$}}

  static func overloadedStaticFunc2(x: Int) -> Int { return 0 }
// PASS_COMMON-NEXT: {{^}}  static func overloadedStaticFunc2(x: Int) -> Int{{$}}

  static func overloadedStaticFunc2(x: Double) -> Int { return 0 }
// PASS_COMMON-NEXT: {{^}}  static func overloadedStaticFunc2(x: Double) -> Int{{$}}
}
// PASS_COMMON-NEXT: {{^}}  init(){{$}}
// PASS_COMMON-NEXT: {{^}}  init(instanceVar1: Int = 0){{$}}
// PASS_COMMON-NEXT: {{^}}}{{$}}

extension d0100_FooStruct {
// PASS_COMMON-LABEL: {{^}}extension d0100_FooStruct {{{$}}

  var extProp: Int {
    get {
      return 42
    }
  }
// PASS_COMMON-NEXT: {{^}}  var extProp: Int { get }{{$}}

  func extFunc0() {}
// PASS_COMMON-NEXT: {{^}}  func extFunc0(){{$}}

  static var extStaticProp: Int {
    get {
      return 42
    }
  }
// PASS_COMMON-NEXT: {{^}}  static var extStaticProp: Int { get }{{$}}

  static func extStaticFunc0() {}
// PASS_COMMON-NEXT: {{^}}  static func extStaticFunc0(){{$}}

  struct ExtNestedStruct {}
// PASS_COMMON-NEXT: {{^}}  struct ExtNestedStruct {{{$}}
// PASS_COMMON-NEXT: {{^}}    init(){{$}}
// PASS_COMMON-NEXT: {{^}}  }{{$}}

  class ExtNestedClass {}
// PASS_COMMON-NEXT: {{^}}  class ExtNestedClass {{{$}}
// PASS_COMMON-NEXT: {{^}}    @objc deinit{{$}}
// PASS_COMMON-NEXT: {{^}}    init(){{$}}
// PASS_COMMON-NEXT: {{^}}  }{{$}}

  enum ExtNestedEnum {
    case ExtEnumX(Int)
  }
// PASS_COMMON-NEXT: {{^}}  enum ExtNestedEnum {{{$}}
// PASS_COMMON-NEXT: {{^}}    case ExtEnumX(Int){{$}}
// PASS_COMMON-NEXT: {{^}}  }{{$}}

  typealias ExtNestedTypealias = Int
// PASS_COMMON-NEXT: {{^}}  typealias ExtNestedTypealias = Int{{$}}
}
// PASS_COMMON-NEXT: {{^}}}{{$}}

extension d0100_FooStruct.NestedStruct {
// PASS_COMMON-LABEL: {{^}}extension d0100_FooStruct.NestedStruct {{{$}}
  struct ExtNestedStruct2 {}
// PASS_COMMON-NEXT: {{^}}  struct ExtNestedStruct2 {{{$}}
// PASS_COMMON-NEXT: {{^}}    init(){{$}}
// PASS_COMMON-NEXT: {{^}}  }{{$}}
}

extension d0100_FooStruct.ExtNestedStruct {
// PASS_COMMON-LABEL: {{^}}extension d0100_FooStruct.ExtNestedStruct {{{$}}
  struct ExtNestedStruct3 {}
// PASS_COMMON-NEXT: {{^}}  struct ExtNestedStruct3 {{{$}}
// PASS_COMMON-NEXT: {{^}}    init(){{$}}
// PASS_COMMON-NEXT: {{^}}  }{{$}}
}

// PASS_COMMON-NEXT: {{^}}}{{$}}

var fooObject: d0100_FooStruct = d0100_FooStruct()
// PASS_ONE_LINE-DAG: {{^}}@_hasInitialValue var fooObject: d0100_FooStruct{{$}}

struct d0110_ReadWriteProperties {
// PASS_RW_PROP_GET_SET-LABEL:    {{^}}struct d0110_ReadWriteProperties {{{$}}
// PASS_RW_PROP_NO_GET_SET-LABEL: {{^}}struct d0110_ReadWriteProperties {{{$}}

  var computedProp1: Int {
    get {
      return 42
    }
    set {}
  }
// PASS_RW_PROP_GET_SET-NEXT:    {{^}}  var computedProp1: Int { get set }{{$}}
// PASS_RW_PROP_NO_GET_SET-NEXT: {{^}}  var computedProp1: Int{{$}}

  subscript(i: Int) -> Int {
    get {
      return 42
    }
    set {}
  }
// PASS_RW_PROP_GET_SET-NEXT:    {{^}}  subscript(i: Int) -> Int { get set }{{$}}
// PASS_RW_PROP_NO_GET_SET-NEXT: {{^}}  subscript(i: Int) -> Int{{$}}

  static var computedStaticProp1: Int {
    get {
      return 42
    }
    set {}
  }
// PASS_RW_PROP_GET_SET-NEXT:    {{^}}  static var computedStaticProp1: Int { get set }{{$}}
// PASS_RW_PROP_NO_GET_SET-NEXT: {{^}}  static var computedStaticProp1: Int{{$}}

  var computedProp2: Int {
    mutating get {
      return 42
    }
    set {}
  }
// PASS_RW_PROP_GET_SET-NEXT:    {{^}}  var computedProp2: Int { mutating get set }{{$}}
// PASS_RW_PROP_NO_GET_SET-NEXT: {{^}}  var computedProp2: Int { mutating get set }{{$}}

  var computedProp3: Int {
    get {
      return 42
    }
    nonmutating set {}
  }
// PASS_RW_PROP_GET_SET-NEXT:    {{^}}  var computedProp3: Int { get nonmutating set }{{$}}
// PASS_RW_PROP_NO_GET_SET-NEXT: {{^}}  var computedProp3: Int { get nonmutating set }{{$}}

  var computedProp4: Int {
    mutating get {
      return 42
    }
    nonmutating set {}
  }
// PASS_RW_PROP_GET_SET-NEXT:    {{^}}  var computedProp4: Int { mutating get nonmutating set }{{$}}
// PASS_RW_PROP_NO_GET_SET-NEXT: {{^}}  var computedProp4: Int { mutating get nonmutating set }{{$}}

  subscript(i: Float) -> Int {
    get {
      return 42
    }
    nonmutating set {}
  }
// PASS_RW_PROP_GET_SET-NEXT:    {{^}}  subscript(i: Float) -> Int { get nonmutating set }{{$}}
// PASS_RW_PROP_NO_GET_SET-NEXT: {{^}}  subscript(i: Float) -> Int { get nonmutating set }{{$}}
}
// PASS_RW_PROP_GET_SET-NEXT:    {{^}}  init(){{$}}
// PASS_RW_PROP_GET_SET-NEXT:    {{^}}}{{$}}
// PASS_RW_PROP_NO_GET_SET-NEXT: {{^}}  init(){{$}}
// PASS_RW_PROP_NO_GET_SET-NEXT: {{^}}}{{$}}

extension d0110_ReadWriteProperties {
// PASS_RW_PROP_GET_SET-LABEL:    {{^}}extension d0110_ReadWriteProperties {{{$}}
// PASS_RW_PROP_NO_GET_SET-LABEL: {{^}}extension d0110_ReadWriteProperties {{{$}}

  var extProp: Int {
    get {
      return 42
    }
    set(v) {}
  }
// PASS_RW_PROP_GET_SET-NEXT:    {{^}}  var extProp: Int { get set }{{$}}
// PASS_RW_PROP_NO_GET_SET-NEXT: {{^}}  var extProp: Int{{$}}

  static var extStaticProp: Int {
    get {
      return 42
    }
    set(v) {}
  }
// PASS_RW_PROP_GET_SET-NEXT:    {{^}}  static var extStaticProp: Int { get set }{{$}}
// PASS_RW_PROP_NO_GET_SET-NEXT: {{^}}  static var extStaticProp: Int{{$}}
}
// PASS_RW_PROP_GET_SET-NEXT:    {{^}}}{{$}}
// PASS_RW_PROP_NO_GET_SET-NEXT: {{^}}}{{$}}

class d0120_TestClassBase {
// PASS_COMMON-LABEL: {{^}}class d0120_TestClassBase {{{$}}

  required init() {}
// PASS_COMMON-NEXT: {{^}}  required init(){{$}}

  init?(fail: String) {}
// PASS_COMMON-NEXT: {{^}}  init?(fail: String){{$}}

  init!(iuoFail: String) {}
// PASS_COMMON-NEXT: {{^}}  init!(iuoFail: String){{$}}

  final func baseFunc1() {}
// PASS_COMMON-NEXT: {{^}}  final func baseFunc1(){{$}}

  func baseFunc2() {}
// PASS_COMMON-NEXT: {{^}}  func baseFunc2(){{$}}

  subscript(i: Int) -> Int {
    return 0
  }
// PASS_COMMON-NEXT: {{^}}  subscript(i: Int) -> Int { get }{{$}}

  class var baseClassVar1: Int { return 0 }
// PASS_COMMON-NEXT: {{^}}  class var baseClassVar1: Int { get }{{$}}

// FIXME: final class var not allowed to have storage, but static is?
#if ERRORS
  final class var baseClassVar2: Int = 0
  // expected-error@-1 {{class stored properties not supported in classes; did you mean 'static'?}}
#endif

  final class var baseClassVar3: Int { return 0 }
// PASS_COMMON: {{^}}  final class var baseClassVar3: Int { get }{{$}}
  static var baseClassVar4: Int = 0
// PASS_COMMON-NEXT: {{^}}  @_hasInitialValue static var baseClassVar4: Int{{$}}
  static var baseClassVar5: Int { return 0 }
// PASS_COMMON-NEXT: {{^}}  static var baseClassVar5: Int { get }{{$}}

  class func baseClassFunc1() {}
// PASS_COMMON-NEXT: {{^}}  class func baseClassFunc1(){{$}}
  final class func baseClassFunc2() {}
// PASS_COMMON-NEXT: {{^}}  final class func baseClassFunc2(){{$}}
  static func baseClassFunc3() {}
// PASS_COMMON-NEXT: {{^}}  static func baseClassFunc3(){{$}}
}

class d0121_TestClassDerived : d0120_TestClassBase {
// PASS_COMMON-LABEL: {{^}}@_inheritsConvenienceInitializers {{()?}}class d0121_TestClassDerived : d0120_TestClassBase {{{$}}

  required init() { super.init() }
// PASS_COMMON-NEXT: {{^}}  required init(){{$}}

  override init?(fail: String) { nil }
// PASS_COMMON-NEXT: {{^}}  override init?(fail: String){{$}}

  override init!(iuoFail: String) { nil }
// PASS_COMMON-NEXT: {{^}}  override init!(iuoFail: String){{$}}

  final override func baseFunc2() {}
// PASS_COMMON-NEXT: {{^}}  {{(override |final )+}}func baseFunc2(){{$}}

  override final subscript(i: Int) -> Int {
    return 0
  }
// PASS_COMMON-NEXT: {{^}}  override final subscript(i: Int) -> Int { get }{{$}}
}

protocol d0130_TestProtocol {
// PASS_COMMON-LABEL: {{^}}protocol d0130_TestProtocol {{{$}}

  associatedtype NestedTypealias
// PASS_COMMON-NEXT: {{^}}  associatedtype NestedTypealias{{$}}

  var property1: Int { get }
// PASS_COMMON-NEXT: {{^}}  var property1: Int { get }{{$}}

  var property2: Int { get set }
// PASS_COMMON-NEXT: {{^}}  var property2: Int { get set }{{$}}

  func protocolFunc1()
// PASS_COMMON-NEXT: {{^}}  func protocolFunc1(){{$}}
}

@objc protocol d0140_TestObjCProtocol {
// PASS_COMMON-LABEL: {{^}}@objc protocol d0140_TestObjCProtocol {{{$}}

  @objc optional var property1: Int { get }
// PASS_COMMON-NEXT: {{^}}  @objc optional var property1: Int { get }{{$}}

  @objc optional func protocolFunc1()
// PASS_COMMON-NEXT: {{^}}  @objc optional func protocolFunc1(){{$}}
}

protocol d0150_TestClassProtocol : class {}
// PASS_COMMON-LABEL: {{^}}protocol d0150_TestClassProtocol : AnyObject {{{$}}

@objc protocol d0151_TestClassProtocol {}
// PASS_COMMON-LABEL: {{^}}@objc protocol d0151_TestClassProtocol {{{$}}


class d0170_TestAvailability {
// PASS_COMMON-LABEL: {{^}}class d0170_TestAvailability {{{$}}

  @available(*, unavailable)
  func f1() {}
// PASS_COMMON-NEXT: {{^}}  @available(*, unavailable){{$}}
// PASS_COMMON-NEXT: {{^}}  func f1(){{$}}

  @available(*, unavailable, message: "aaa \"bbb\" ccc\nddd\0eee")
  func f2() {}
// PASS_COMMON-NEXT: {{^}}  @available(*, unavailable, message: "aaa \"bbb\" ccc\nddd\0eee"){{$}}
// PASS_COMMON-NEXT: {{^}}  func f2(){{$}}

  @available(iOS, unavailable)
  @available(OSX, unavailable)
  func f3() {}
// PASS_COMMON-NEXT: {{^}}  @available(iOS, unavailable){{$}}
// PASS_COMMON-NEXT: {{^}}  @available(macOS, unavailable){{$}}
// PASS_COMMON-NEXT: {{^}}  func f3(){{$}}

  @available(iOS 8.0, OSX 10.10, *)
  func f4() {}
// PASS_COMMON-NEXT: {{^}}  @available(iOS 8.0, macOS 10.10, *){{$}}
// PASS_COMMON-NEXT: {{^}}  func f4(){{$}}

// Convert long-form @available() to short form when possible.
  @available(iOS, introduced: 8.0)
  @available(OSX, introduced: 10.10)
  func f5() {}
// PASS_COMMON-NEXT: {{^}}  @available(iOS 8.0, macOS 10.10, *){{$}}
// PASS_COMMON-NEXT: {{^}}  func f5(){{$}}
}

@objc class d0180_TestIBAttrs {
// PASS_COMMON-LABEL: {{^}}@objc class d0180_TestIBAttrs {{{$}}

  @IBAction func anAction(_: AnyObject) {}
// Tolerate different attribute orders to support both reading from source
// and deserializing from swiftmodule.
// PASS_COMMON-NEXT: {{^}}  @objc
// PASS_COMMON-DAG: @IBAction
// PASS_COMMON-DAG: @MainActor
// PASS_COMMON: func anAction(_: AnyObject){{$}}

  @IBSegueAction func aSegueAction(_ coder: AnyObject, sender: AnyObject, identifier: AnyObject?) -> Any? { fatalError() }
// PASS_COMMON-NEXT: {{^}}  @objc @IBSegueAction func aSegueAction(_ coder: AnyObject, sender: AnyObject, identifier: AnyObject?) -> Any?{{$}}

  @IBDesignable
  class ADesignableClass {}
// PASS_COMMON-NEXT: {{^}}  @IBDesignable class ADesignableClass {{{$}}

}

@objc class d0181_TestIBAttrs {
// PASS_EXPLODE_PATTERN-LABEL: {{^}}@objc class d0181_TestIBAttrs {{{$}}

  @IBOutlet weak var anOutlet: d0181_TestIBAttrs!
// PASS_EXPLODE_PATTERN-NEXT: {{^}}  @objc @IBOutlet @_hasInitialValue weak var anOutlet: @sil_weak d0181_TestIBAttrs!{{$}}

  @IBInspectable var inspectableProp: Int = 0
// PASS_EXPLODE_PATTERN-NEXT: {{^}}  @objc @IBInspectable @_hasInitialValue var inspectableProp: Int{{$}}

  @GKInspectable var inspectableProp2: Int = 0
// PASS_EXPLODE_PATTERN-NEXT: {{^}}  @objc @GKInspectable @_hasInitialValue var inspectableProp2: Int{{$}}
}

struct d0190_LetVarDecls {
// PASS_PRINT_AST-LABEL: {{^}}struct d0190_LetVarDecls {{{$}}
// PASS_PRINT_MODULE_INTERFACE-LABEL: {{^}}struct d0190_LetVarDecls {{{$}}

  let instanceVar1: Int = 0
// PASS_PRINT_AST-NEXT: {{^}}  @_hasInitialValue let instanceVar1: Int{{$}}
// PASS_PRINT_MODULE_INTERFACE-NEXT: {{^}}  @_hasInitialValue let instanceVar1: Int{{$}}

  let instanceVar2 = 0
// PASS_PRINT_AST-NEXT: {{^}}  @_hasInitialValue let instanceVar2: Int{{$}}
// PASS_PRINT_MODULE_INTERFACE-NEXT: {{^}}  @_hasInitialValue let instanceVar2: Int{{$}}

  static let staticVar1: Int = 42
// PASS_PRINT_AST-NEXT: {{^}}  @_hasInitialValue static let staticVar1: Int{{$}}
// PASS_PRINT_MODULE_INTERFACE-NEXT: {{^}}  @_hasInitialValue static let staticVar1: Int{{$}}

  static let staticVar2 = 42
  // FIXME: PRINTED_WITHOUT_TYPE
// PASS_PRINT_AST-NEXT: {{^}}  @_hasInitialValue static let staticVar2: Int{{$}}
// PASS_PRINT_MODULE_INTERFACE-NEXT: {{^}}  @_hasInitialValue static let staticVar2: Int{{$}}
}

struct d0200_EscapedIdentifiers {
// PASS_COMMON-LABEL: {{^}}struct d0200_EscapedIdentifiers {{{$}}

  struct `struct` {}
// PASS_COMMON-NEXT: {{^}}  struct `struct` {{{$}}
// PASS_COMMON-NEXT: {{^}}    init(){{$}}
// PASS_COMMON-NEXT: {{^}}  }{{$}}

  enum `enum` {
    case `case`
  }
// PASS_COMMON-NEXT: {{^}}  enum `enum` {{{$}}
// PASS_COMMON-NEXT: {{^}}    case `case`{{$}}
// PASS_COMMON-NEXT: {{^}}    {{.*}}static func __derived_enum_equals(_ a: d0200_EscapedIdentifiers.`enum`, _ b: d0200_EscapedIdentifiers.`enum`) -> Bool
// PASS_COMMON-NEXT: {{^}}    func hash(into hasher: inout Hasher)
// PASS_COMMON-NEXT: {{^}}    var hashValue: Int { get }{{$}}
// PASS_COMMON-NEXT: {{^}}  }{{$}}

  class `class` {}
// PASS_COMMON-NEXT: {{^}}  class `class` {{{$}}
// PASS_COMMON-NEXT: {{^}}    @objc deinit{{$}}
// PASS_COMMON-NEXT: {{^}}    init(){{$}}
// PASS_COMMON-NEXT: {{^}}  }{{$}}

  typealias `protocol` = `class`
// PASS_ONE_LINE_TYPE-DAG: {{^}}  typealias `protocol` = d0200_EscapedIdentifiers.`class`{{$}}
// PASS_ONE_LINE_TYPEREPR-DAG: {{^}}  typealias `protocol` = `class`{{$}}

  class `extension` : `class` {}
// PASS_ONE_LINE_TYPE-DAG: {{^}}  @_inheritsConvenienceInitializers class `extension` : d0200_EscapedIdentifiers.`class` {{{$}}
// PASS_ONE_LINE_TYPEREPR-DAG: {{^}}  @_inheritsConvenienceInitializers class `extension` : `class` {{{$}}
// PASS_COMMON:      {{^}}    {{(override )?}}init(){{$}}
// PASS_COMMON-NEXT: {{^}}    @objc deinit{{$}}
// PASS_COMMON-NEXT: {{^}}  }{{$}}

  func `func`<`let`: `protocol`, `where`>(
      class: Int, struct: `protocol`, foo: `let`, bar: `where`) where `where` : `protocol` {}
// PASS_COMMON-NEXT: {{^}}  func `func`<`let`, `where`>(class: Int, struct: {{(d0200_EscapedIdentifiers.)?}}`protocol`, foo: `let`, bar: `where`) where `let` : {{(d0200_EscapedIdentifiers.)?}}`class`, `where` : {{(d0200_EscapedIdentifiers.)?}}`class`{{$}}

  var `var`: `struct` = `struct`()
// PASS_COMMON-NEXT: {{^}}  @_hasInitialValue var `var`: {{(d0200_EscapedIdentifiers.)?}}`struct`{{$}}

  var tupleType: (`var`: Int, `let`: `struct`)
// PASS_COMMON-NEXT: {{^}}  var tupleType: (var: Int, let: {{(d0200_EscapedIdentifiers.)?}}`struct`){{$}}

  var accessors1: Int {
    get { return 0 }
    set(`let`) {}
  }
// PASS_COMMON-NEXT: {{^}}  var accessors1: Int{{( { get set })?}}{{$}}

  static func `static`(protocol: Int) {}
// PASS_COMMON-NEXT: {{^}}  static func `static`(protocol: Int){{$}}

// PASS_COMMON-NEXT: {{^}}  init(var: {{(d0200_EscapedIdentifiers.)?}}`struct` = {{(d0200_EscapedIdentifiers.)?}}`struct`(), tupleType: (var: Int, let: {{(d0200_EscapedIdentifiers.)?}}`struct`)){{$}}
// PASS_COMMON-NEXT: {{^}}}{{$}}
}

struct d0210_Qualifications {
// PASS_QUAL_UNQUAL:       {{^}}struct d0210_Qualifications {{{$}}
// PASS_QUAL_IF_AMBIGUOUS: {{^}}struct d0210_Qualifications {{{$}}

  var propFromStdlib1: Int = 0
// PASS_QUAL_UNQUAL-NEXT:       {{^}}  @_hasInitialValue var propFromStdlib1: Int{{$}}
// PASS_QUAL_IF_AMBIGUOUS-NEXT: {{^}}  @_hasInitialValue var propFromStdlib1: Int{{$}}

  var propFromSwift1: FooSwiftStruct = FooSwiftStruct()
// PASS_QUAL_UNQUAL-NEXT:       {{^}}  @_hasInitialValue var propFromSwift1: FooSwiftStruct{{$}}
// PASS_QUAL_IF_AMBIGUOUS-NEXT: {{^}}  @_hasInitialValue var propFromSwift1: foo_swift_module.FooSwiftStruct{{$}}

  var propFromClang1: FooStruct1 = FooStruct1(x: 0, y: 0.0)
// PASS_QUAL_UNQUAL-NEXT:       {{^}}  @_hasInitialValue var propFromClang1: FooStruct1{{$}}
// PASS_QUAL_IF_AMBIGUOUS-NEXT: {{^}}  @_hasInitialValue var propFromClang1: FooStruct1{{$}}


  func instanceFuncFromStdlib1(a: Int) -> Float {
    return 0.0
  }
// PASS_QUAL_UNQUAL-NEXT:       {{^}}  func instanceFuncFromStdlib1(a: Int) -> Float{{$}}
// PASS_QUAL_IF_AMBIGUOUS-NEXT: {{^}}  func instanceFuncFromStdlib1(a: Int) -> Float{{$}}

  func instanceFuncFromStdlib2(a: ObjCBool) {}
// PASS_QUAL_UNQUAL-NEXT:       {{^}}  func instanceFuncFromStdlib2(a: ObjCBool){{$}}
// PASS_QUAL_IF_AMBIGUOUS-NEXT: {{^}}  func instanceFuncFromStdlib2(a: ObjCBool){{$}}

  func instanceFuncFromSwift1(a: FooSwiftStruct) -> FooSwiftStruct {
    return FooSwiftStruct()
  }
// PASS_QUAL_UNQUAL-NEXT:       {{^}}  func instanceFuncFromSwift1(a: FooSwiftStruct) -> FooSwiftStruct{{$}}
// PASS_QUAL_IF_AMBIGUOUS-NEXT: {{^}}  func instanceFuncFromSwift1(a: foo_swift_module.FooSwiftStruct) -> foo_swift_module.FooSwiftStruct{{$}}

  func instanceFuncFromClang1(a: FooStruct1) -> FooStruct1 {
    return FooStruct1(x: 0, y: 0.0)
  }
// PASS_QUAL_UNQUAL-NEXT:       {{^}}  func instanceFuncFromClang1(a: FooStruct1) -> FooStruct1{{$}}
// PASS_QUAL_IF_AMBIGUOUS-NEXT: {{^}}  func instanceFuncFromClang1(a: FooStruct1) -> FooStruct1{{$}}
}

// FIXME: this should be printed reasonably in case we use
// -prefer-type-repr=true.  Either we should print the types we inferred, or we
// should print the initializers.
class d0250_ExplodePattern {
// PASS_EXPLODE_PATTERN-LABEL: {{^}}class d0250_ExplodePattern {{{$}}
  var instanceVar1 = 0
  var instanceVar2 = 0.0
  var instanceVar3 = ""
// PASS_EXPLODE_PATTERN: {{^}}  @_hasInitialValue var instanceVar1: Int{{$}}
// PASS_EXPLODE_PATTERN: {{^}}  @_hasInitialValue var instanceVar2: Double{{$}}
// PASS_EXPLODE_PATTERN: {{^}}  @_hasInitialValue var instanceVar3: String{{$}}

  var instanceVar4 = FooStruct()
  var (instanceVar5, instanceVar6) = (FooStruct(), FooStruct())
  var (instanceVar7, instanceVar8) = (FooStruct(), FooStruct())
  var (instanceVar9, instanceVar10) : (FooStruct, FooStruct) = (FooStruct(), FooStruct())
  final var (instanceVar11, instanceVar12) = (FooStruct(), FooStruct())
// PASS_EXPLODE_PATTERN: {{^}}  @_hasInitialValue var instanceVar4: FooStruct{{$}}
// PASS_EXPLODE_PATTERN: {{^}}  @_hasInitialValue var instanceVar5: FooStruct{{$}}
// PASS_EXPLODE_PATTERN: {{^}}  @_hasInitialValue var instanceVar6: FooStruct{{$}}
// PASS_EXPLODE_PATTERN: {{^}}  @_hasInitialValue var instanceVar7: FooStruct{{$}}
// PASS_EXPLODE_PATTERN: {{^}}  @_hasInitialValue var instanceVar8: FooStruct{{$}}
// PASS_EXPLODE_PATTERN: {{^}}  @_hasInitialValue var instanceVar9: FooStruct{{$}}
// PASS_EXPLODE_PATTERN: {{^}}  @_hasInitialValue var instanceVar10: FooStruct{{$}}
// PASS_EXPLODE_PATTERN: {{^}}  @_hasInitialValue final var instanceVar11: FooStruct{{$}}
// PASS_EXPLODE_PATTERN: {{^}}  @_hasInitialValue final var instanceVar12: FooStruct{{$}}

  let instanceLet1 = 0
  let instanceLet2 = 0.0
  let instanceLet3 = ""
// PASS_EXPLODE_PATTERN: {{^}}  @_hasInitialValue final let instanceLet1: Int{{$}}
// PASS_EXPLODE_PATTERN: {{^}}  @_hasInitialValue final let instanceLet2: Double{{$}}
// PASS_EXPLODE_PATTERN: {{^}}  @_hasInitialValue final let instanceLet3: String{{$}}

  let instanceLet4 = FooStruct()
  let (instanceLet5, instanceLet6) = (FooStruct(), FooStruct())
  let (instanceLet7, instanceLet8) = (FooStruct(), FooStruct())
  let (instanceLet9, instanceLet10) : (FooStruct, FooStruct) = (FooStruct(), FooStruct())
// PASS_EXPLODE_PATTERN: {{^}}  @_hasInitialValue final let instanceLet4: FooStruct{{$}}
// PASS_EXPLODE_PATTERN: {{^}}  @_hasInitialValue final let instanceLet5: FooStruct{{$}}
// PASS_EXPLODE_PATTERN: {{^}}  @_hasInitialValue final let instanceLet6: FooStruct{{$}}
// PASS_EXPLODE_PATTERN: {{^}}  @_hasInitialValue final let instanceLet7: FooStruct{{$}}
// PASS_EXPLODE_PATTERN: {{^}}  @_hasInitialValue final let instanceLet8: FooStruct{{$}}
// PASS_EXPLODE_PATTERN: {{^}}  @_hasInitialValue final let instanceLet9: FooStruct{{$}}
// PASS_EXPLODE_PATTERN: {{^}}  @_hasInitialValue final let instanceLet10: FooStruct{{$}}
}

class d0260_ExplodePattern_TestClassBase {
// PASS_EXPLODE_PATTERN-LABEL: {{^}}class d0260_ExplodePattern_TestClassBase {{{$}}

  init() {
    baseProp1 = 0
  }
// PASS_EXPLODE_PATTERN-NEXT: {{^}}  init(){{$}}

  final var baseProp1: Int
// PASS_EXPLODE_PATTERN-NEXT: {{^}}  final var baseProp1: Int{{$}}

  var baseProp2: Int {
    get {
      return 0
    }
    set {}
  }
// PASS_EXPLODE_PATTERN-NEXT: {{^}}  var baseProp2: Int{{$}}
}

class d0261_ExplodePattern_TestClassDerived : d0260_ExplodePattern_TestClassBase {
// PASS_EXPLODE_PATTERN-LABEL: {{^}}@_inheritsConvenienceInitializers class d0261_ExplodePattern_TestClassDerived : d0260_ExplodePattern_TestClassBase {{{$}}

  override final var baseProp2: Int {
    get {
      return 0
    }
    set {}
  }
// PASS_EXPLODE_PATTERN-NEXT: {{^}}  override final var baseProp2: Int{{$}}
}

//===---
//===--- Inheritance list in structs.
//===---

struct StructWithoutInheritance1 {}
// PASS_ONE_LINE-DAG: {{^}}struct StructWithoutInheritance1 {{{$}}

struct StructWithInheritance1 : FooProtocol {}
// PASS_ONE_LINE-DAG: {{^}}struct StructWithInheritance1 : FooProtocol {{{$}}

struct StructWithInheritance2 : FooProtocol, BarProtocol {}
// PASS_ONE_LINE-DAG: {{^}}struct StructWithInheritance2 : FooProtocol, BarProtocol {{{$}}

struct StructWithInheritance3 : QuxProtocol, SubFooProtocol {
  typealias Qux = Int
}
// PASS_ONE_LINE-DAG: {{^}}struct StructWithInheritance3 : QuxProtocol, SubFooProtocol {{{$}}

//===---
//===--- Inheritance list in classes.
//===---

class ClassWithoutInheritance1 {}
// PASS_ONE_LINE-DAG: {{^}}class ClassWithoutInheritance1 {{{$}}

class ClassWithInheritance1 : FooProtocol {}
// PASS_ONE_LINE-DAG: {{^}}class ClassWithInheritance1 : FooProtocol {{{$}}

class ClassWithInheritance2 : FooProtocol, BarProtocol {}
// PASS_ONE_LINE-DAG: {{^}}class ClassWithInheritance2 : FooProtocol, BarProtocol {{{$}}

class ClassWithInheritance3 : FooClass {}
// PASS_ONE_LINE-DAG: {{^}}@_inheritsConvenienceInitializers class ClassWithInheritance3 : FooClass {{{$}}

class ClassWithInheritance4 : FooClass, FooProtocol {}
// PASS_ONE_LINE-DAG: {{^}}@_inheritsConvenienceInitializers class ClassWithInheritance4 : FooClass, FooProtocol {{{$}}

class ClassWithInheritance5 : FooClass, FooProtocol, BarProtocol {}
// PASS_ONE_LINE-DAG: {{^}}@_inheritsConvenienceInitializers class ClassWithInheritance5 : FooClass, FooProtocol, BarProtocol {{{$}}

class ClassWithInheritance6 : QuxProtocol, SubFooProtocol {
  typealias Qux = Int
}
// PASS_ONE_LINE-DAG: {{^}}class ClassWithInheritance6 : QuxProtocol, SubFooProtocol {{{$}}

//===---
//===--- Inheritance list in enums.
//===---

enum EnumWithoutInheritance1 {}
// PASS_ONE_LINE-DAG: {{^}}enum EnumWithoutInheritance1 {{{$}}

enum EnumWithInheritance1 : FooProtocol {}
// PASS_ONE_LINE-DAG: {{^}}enum EnumWithInheritance1 : FooProtocol {{{$}}

enum EnumWithInheritance2 : FooProtocol, BarProtocol {}
// PASS_ONE_LINE-DAG: {{^}}enum EnumWithInheritance2 : FooProtocol, BarProtocol {{{$}}

enum EnumDeclWithUnderlyingType1 : Int { case X }
// PASS_ONE_LINE-DAG: {{^}}enum EnumDeclWithUnderlyingType1 : Int {{{$}}

enum EnumDeclWithUnderlyingType2 : Int, FooProtocol { case X }
// PASS_ONE_LINE-DAG: {{^}}enum EnumDeclWithUnderlyingType2 : Int, FooProtocol {{{$}}

enum EnumWithInheritance3 : QuxProtocol, SubFooProtocol {
  typealias Qux = Int
}
// PASS_ONE_LINE-DAG: {{^}}enum EnumWithInheritance3 : QuxProtocol, SubFooProtocol {{{$}}

//===---
//===--- Inheritance list in protocols.
//===---

protocol ProtocolWithoutInheritance1 {}
// PASS_ONE_LINE-DAG: {{^}}protocol ProtocolWithoutInheritance1 {{{$}}

protocol ProtocolWithInheritance1 : FooProtocol {}
// PASS_ONE_LINE-DAG: {{^}}protocol ProtocolWithInheritance1 : FooProtocol {{{$}}

protocol ProtocolWithInheritance2 : FooProtocol, BarProtocol { }
// PASS_ONE_LINE-DAG: {{^}}protocol ProtocolWithInheritance2 : BarProtocol, FooProtocol {{{$}}

protocol ProtocolWithInheritance3 : QuxProtocol, SubFooProtocol {
}
// PASS_ONE_LINE-DAG: {{^}}protocol ProtocolWithInheritance3 : QuxProtocol, SubFooProtocol {{{$}}

//===---
//===--- Inheritance list in extensions
//===---

struct StructInherited { }

// PASS_ONE_LINE-DAG: {{.*}}extension StructInherited : QuxProtocol, SubFooProtocol {{{$}}
extension StructInherited : QuxProtocol, SubFooProtocol {
  typealias Qux = Int
}

//===---
//===--- Typealias printing.
//===---

// Normal typealiases.

typealias SimpleTypealias1 = FooProtocol
// PASS_ONE_LINE-DAG: {{^}}typealias SimpleTypealias1 = FooProtocol{{$}}

// Associated types.

protocol AssociatedType1 {
  associatedtype AssociatedTypeDecl1 = Int
// PASS_ONE_LINE-DAG: {{^}}  associatedtype AssociatedTypeDecl1 = Int{{$}}

  associatedtype AssociatedTypeDecl2 : FooProtocol
// PASS_ONE_LINE-DAG: {{^}}  associatedtype AssociatedTypeDecl2 : FooProtocol{{$}}

  associatedtype AssociatedTypeDecl3 : FooProtocol, BarProtocol
// PASS_ONE_LINE_TYPEREPR-DAG: {{^}}  associatedtype AssociatedTypeDecl3 : BarProtocol, FooProtocol{{$}}

  associatedtype AssociatedTypeDecl4 where AssociatedTypeDecl4 : QuxProtocol, AssociatedTypeDecl4.Qux == Int
// PASS_ONE_LINE_TYPEREPR-DAG: {{^}}  associatedtype AssociatedTypeDecl4 : QuxProtocol where Self.AssociatedTypeDecl4.Qux == Int{{$}}

  associatedtype AssociatedTypeDecl5: FooClass
// PASS_ONE_LINE_TYPEREPR-DAG: {{^}}  associatedtype AssociatedTypeDecl5 : FooClass{{$}}
}

//===---
//===--- Variable declaration printing.
//===---

var d0300_topLevelVar1: Int = 42
// PASS_COMMON: {{^}}@_hasInitialValue var d0300_topLevelVar1: Int{{$}}
// PASS_COMMON-NOT: d0300_topLevelVar1

var d0400_topLevelVar2: Int = 42
// PASS_COMMON: {{^}}@_hasInitialValue var d0400_topLevelVar2: Int{{$}}
// PASS_COMMON-NOT: d0400_topLevelVar2

var d0500_topLevelVar2: Int {
  get {
    return 42
  }
}
// PASS_COMMON: {{^}}var d0500_topLevelVar2: Int { get }{{$}}
// PASS_COMMON-NOT: d0500_topLevelVar2

class d0600_InClassVar1 {
// PASS_O600-LABEL: d0600_InClassVar1

  var instanceVar1: Int
// PASS_COMMON: {{^}}  var instanceVar1: Int{{$}}
// PASS_COMMON-NOT: instanceVar1

  var instanceVar2: Int = 42
// PASS_COMMON: {{^}}  @_hasInitialValue var instanceVar2: Int{{$}}
// PASS_COMMON-NOT: instanceVar2

  // FIXME: this is sometimes printed without a type, see PASS_EXPLODE_PATTERN.
  // FIXME: PRINTED_WITHOUT_TYPE
  var instanceVar3 = 42
// PASS_COMMON: {{^}}  @_hasInitialValue var instanceVar3
// PASS_COMMON-NOT: instanceVar3

  var instanceVar4: Int {
    get {
      return 42
    }
  }
// PASS_COMMON: {{^}}  var instanceVar4: Int { get }{{$}}
// PASS_COMMON-NOT: instanceVar4

  static var staticVar1: Int = 42
// PASS_COMMON: {{^}}  @_hasInitialValue static var staticVar1: Int{{$}}
// PASS_COMMON-NOT: staticVar1

  static var staticVar2: Int { 42 }
// PASS_COMMON: {{^}}  static var staticVar2: Int { get }{{$}}
// PASS_COMMON-NOT: staticVar2

  init() {
    instanceVar1 = 10
  }
}

//===---
//===--- Subscript declaration printing.
//===---

class d0700_InClassSubscript1 {
// PASS_COMMON-LABEL: d0700_InClassSubscript1
  subscript(i: Int) -> Int {
    get {
      return 42
    }
  }
  subscript(index i: Float) -> Int { return 42 }
  class `class` {}
  subscript(x: Float) -> `class` { return `class`() }
// PASS_COMMON: {{^}}  subscript(i: Int) -> Int { get }{{$}}
// PASS_COMMON: {{^}}  subscript(index i: Float) -> Int { get }{{$}}
// PASS_COMMON: {{^}}  subscript(x: Float) -> {{.*}} { get }{{$}}
// PASS_COMMON-NOT: subscript

// PASS_ONE_LINE_TYPE: {{^}}  subscript(x: Float) -> d0700_InClassSubscript1.`class` { get }{{$}}
// PASS_ONE_LINE_TYPEREPR: {{^}}  subscript(x: Float) -> `class` { get }{{$}}
}
// PASS_COMMON: {{^}}}{{$}}


//===---
//===--- Constructor declaration printing.
//===---

struct d0800_ExplicitConstructors1 {
// PASS_COMMON-LABEL: d0800_ExplicitConstructors1

  init() {}
// PASS_COMMON: {{^}}  init(){{$}}

  init(a: Int) {}
// PASS_COMMON: {{^}}  init(a: Int){{$}}
}

struct d0900_ExplicitConstructorsSelector1 {
// PASS_COMMON-LABEL: d0900_ExplicitConstructorsSelector1

  init(int a: Int) {}
// PASS_COMMON: {{^}}  init(int a: Int){{$}}

  init(int a: Int, andFloat b: Float) {}
// PASS_COMMON: {{^}}  init(int a: Int, andFloat b: Float){{$}}
}

struct d1000_ExplicitConstructorsSelector2 {
// PASS_COMMON-LABEL: d1000_ExplicitConstructorsSelector2

  init(noArgs _: ()) {}
// PASS_COMMON: {{^}}  init(noArgs _: ()){{$}}

  init(_ a: Int) {}
// PASS_COMMON: {{^}}  init(_ a: Int){{$}}

  init(_ a: Int, withFloat b: Float) {}
// PASS_COMMON: {{^}}  init(_ a: Int, withFloat b: Float){{$}}

  init(int a: Int, _ b: Float) {}
// PASS_COMMON: {{^}}  init(int a: Int, _ b: Float){{$}}
}

//===---
//===--- Destructor declaration printing.
//===---

class d1100_ExplicitDestructor1 {
// PASS_COMMON-LABEL: d1100_ExplicitDestructor1

  deinit {}
// PASS_COMMON: {{^}}  @objc deinit{{$}}
}

//===---
//===--- Enum declaration printing.
//===---

enum d2000_EnumDecl1 {
  case ED1_First
  case ED1_Second
}
// PASS_COMMON: {{^}}enum d2000_EnumDecl1 {{{$}}
// PASS_COMMON-NEXT: {{^}}  case ED1_First{{$}}
// PASS_COMMON-NEXT: {{^}}  case ED1_Second{{$}}
// PASS_COMMON-NEXT: {{^}}  {{.*}}static func __derived_enum_equals(_ a: d2000_EnumDecl1, _ b: d2000_EnumDecl1) -> Bool
// PASS_COMMON-NEXT: {{^}}  func hash(into hasher: inout Hasher)
// PASS_COMMON-NEXT: {{^}}  var hashValue: Int { get }{{$}}
// PASS_COMMON-NEXT: {{^}}}{{$}}

enum d2100_EnumDecl2 {
  case ED2_A(Int)
  case ED2_B(Float)
  case ED2_C(Int, Float)
  case ED2_D(x: Int, y: Float)
  case ED2_E(x: Int, y: (Float, Double))
  case ED2_F(x: Int, (y: Float, z: Double))
}
// PASS_COMMON: {{^}}enum d2100_EnumDecl2 {{{$}}
// PASS_COMMON-NEXT: {{^}}  case ED2_A(Int){{$}}
// PASS_COMMON-NEXT: {{^}}  case ED2_B(Float){{$}}
// PASS_COMMON-NEXT: {{^}}  case ED2_C(Int, Float){{$}}
// PASS_COMMON-NEXT: {{^}}  case ED2_D(x: Int, y: Float){{$}}
// PASS_COMMON-NEXT: {{^}}  case ED2_E(x: Int, y: (Float, Double)){{$}}
// PASS_COMMON-NEXT: {{^}}  case ED2_F(x: Int, (y: Float, z: Double)){{$}}
// PASS_COMMON-NEXT: {{^}}}{{$}}

enum d2200_EnumDecl3 {
  case ED3_A, ED3_B
  case ED3_C(Int), ED3_D
  case ED3_E, ED3_F(Int)
  case ED3_G(Int), ED3_H(Int)
  case ED3_I(Int), ED3_J(Int), ED3_K
}
// PASS_2200: {{^}}enum d2200_EnumDecl3 {{{$}}
// PASS_2200-NEXT: {{^}}  case ED3_A, ED3_B{{$}}
// PASS_2200-NEXT: {{^}}  case ED3_C(Int), ED3_D{{$}}
// PASS_2200-NEXT: {{^}}  case ED3_E, ED3_F(Int){{$}}
// PASS_2200-NEXT: {{^}}  case ED3_G(Int), ED3_H(Int){{$}}
// PASS_2200-NEXT: {{^}}  case ED3_I(Int), ED3_J(Int), ED3_K{{$}}
// PASS_2200-NEXT: {{^}}}{{$}}

// PASS_2200_DESERIALIZED: {{^}}enum d2200_EnumDecl3 {{{$}}
// PASS_2200_DESERIALIZED-NEXT: {{^}}  case ED3_A{{$}}
// PASS_2200_DESERIALIZED-NEXT: {{^}}  case ED3_B{{$}}
// PASS_2200_DESERIALIZED-NEXT: {{^}}  case ED3_C(Int){{$}}
// PASS_2200_DESERIALIZED-NEXT: {{^}}  case ED3_D{{$}}
// PASS_2200_DESERIALIZED-NEXT: {{^}}  case ED3_E{{$}}
// PASS_2200_DESERIALIZED-NEXT: {{^}}  case ED3_F(Int){{$}}
// PASS_2200_DESERIALIZED-NEXT: {{^}}  case ED3_G(Int){{$}}
// PASS_2200_DESERIALIZED-NEXT: {{^}}  case ED3_H(Int){{$}}
// PASS_2200_DESERIALIZED-NEXT: {{^}}  case ED3_I(Int){{$}}
// PASS_2200_DESERIALIZED-NEXT: {{^}}  case ED3_J(Int){{$}}
// PASS_2200_DESERIALIZED-NEXT: {{^}}  case ED3_K{{$}}
// PASS_2200_DESERIALIZED-NEXT: {{^}}}{{$}}

enum d2300_EnumDeclWithValues1 : Int {
  case EDV2_First = 10
  case EDV2_Second
}
// PASS_COMMON: {{^}}enum d2300_EnumDeclWithValues1 : Int {{{$}}
// PASS_COMMON-NEXT: {{^}}  case EDV2_First{{$}}
// PASS_COMMON-NEXT: {{^}}  case EDV2_Second{{$}}
// PASS_COMMON-DAG: {{^}}  typealias RawValue = Int
// PASS_COMMON-DAG: {{^}}  init?(rawValue: Int){{$}}
// PASS_COMMON-DAG: {{^}}  var rawValue: Int { get }{{$}}
// PASS_COMMON: {{^}}}{{$}}

enum d2400_EnumDeclWithValues2 : Double {
  case EDV3_First = 10
  case EDV3_Second
}
// PASS_COMMON: {{^}}enum d2400_EnumDeclWithValues2 : Double {{{$}}
// PASS_COMMON-NEXT: {{^}}  case EDV3_First{{$}}
// PASS_COMMON-NEXT: {{^}}  case EDV3_Second{{$}}
// PASS_COMMON-DAG: {{^}}  typealias RawValue = Double
// PASS_COMMON-DAG: {{^}}  init?(rawValue: Double){{$}}
// PASS_COMMON-DAG: {{^}}  var rawValue: Double { get }{{$}}
// PASS_COMMON: {{^}}}{{$}}

//===---
//===--- Custom operator printing.
//===---

postfix operator <*>

// PASS_2500-LABEL: {{^}}postfix operator <*>{{$}}

protocol d2600_ProtocolWithOperator1 {
  static postfix func <*>(_: Self)
}
// PASS_2500: {{^}}protocol d2600_ProtocolWithOperator1 {{{$}}
// PASS_2500-NEXT: {{^}}  postfix static func <*> (_: Self){{$}}
// PASS_2500-NEXT: {{^}}}{{$}}

struct d2601_TestAssignment {}
infix operator %%%
func %%%(lhs: inout d2601_TestAssignment, rhs: d2601_TestAssignment) -> Int {
  return 0
}
// PASS_2500-LABEL: {{^}}infix operator %%% : DefaultPrecedence{{$}}
// PASS_2500: {{^}}func %%% (lhs: inout d2601_TestAssignment, rhs: d2601_TestAssignment) -> Int{{$}}

precedencegroup BoringPrecedence {
// PASS_2500-LABEL: {{^}}precedencegroup BoringPrecedence {{{$}}
  associativity: left
// PASS_2500-NEXT: {{^}}  associativity: left{{$}}
  higherThan: AssignmentPrecedence
// PASS_2500-NEXT: {{^}}  higherThan: AssignmentPrecedence{{$}}
// PASS_2500-NOT:         assignment
// PASS_2500-NOT:         lowerThan
}

precedencegroup ReallyBoringPrecedence {
// PASS_2500-LABEL: {{^}}precedencegroup ReallyBoringPrecedence {{{$}}
  associativity: right
// PASS_2500-NEXT: {{^}}  associativity: right{{$}}
// PASS_2500-NOT: higherThan
// PASS_2500-NOT: lowerThan
// PASS_2500-NOT: assignment
}

precedencegroup BoringAssignmentPrecedence {
// PASS_2500-LABEL: {{^}}precedencegroup BoringAssignmentPrecedence {{{$}}
  lowerThan: AssignmentPrecedence
  assignment: true
// PASS_2500-NEXT: {{^}}  assignment: true{{$}}
// PASS_2500-NEXT: {{^}}  lowerThan: AssignmentPrecedence{{$}}
// PASS_2500-NOT: associativity
// PASS_2500-NOT: higherThan
}
// PASS_2500: {{^}}}{{$}}

//===---
//===--- Printing of deduced associated types.
//===---

protocol d2700_ProtocolWithAssociatedType1 {
  associatedtype TA1
  func returnsTA1() -> TA1
}

// PREFER_TYPE_PRINTING: {{^}}protocol d2700_ProtocolWithAssociatedType1 {{{$}}
// PREFER_TYPE_PRINTING-NEXT: {{^}}  associatedtype TA1{{$}}
// PREFER_TYPE_PRINTING-NEXT: {{^}}  func returnsTA1() -> Self.TA1{{$}}
// PREFER_TYPE_PRINTING-NEXT: {{^}}}{{$}}

// PREFER_TYPEREPR_PRINTING: {{^}}protocol d2700_ProtocolWithAssociatedType1 {{{$}}
// PREFER_TYPEREPR_PRINTING-NEXT: {{^}}  associatedtype TA1{{$}}
// PREFER_TYPEREPR_PRINTING-NEXT: {{^}}  func returnsTA1() -> TA1{{$}}
// PREFER_TYPEREPR_PRINTING-NEXT: {{^}}}{{$}}

struct d2800_ProtocolWithAssociatedType1Impl : d2700_ProtocolWithAssociatedType1 {
  func returnsTA1() -> Int {
    return 42
  }
}

// PASS_COMMON: {{^}}struct d2800_ProtocolWithAssociatedType1Impl : d2700_ProtocolWithAssociatedType1 {{{$}}
// PASS_COMMON-NEXT: {{^}}  func returnsTA1() -> Int{{$}}
// PASS_COMMON-NEXT: {{^}}  typealias TA1 = Int
// PASS_COMMON-NEXT: {{^}}  init(){{$}}
// PASS_COMMON-NEXT: {{^}}}{{$}}

//===---
//===--- Generic parameter list printing.
//===---

struct GenericParams1<
    StructGenericFoo : FooProtocol,
    StructGenericFooX : FooClass,
    StructGenericBar : FooProtocol & BarProtocol,
    StructGenericBaz> {
// PASS_ONE_LINE_TYPE-DAG: {{^}}struct GenericParams1<StructGenericFoo, StructGenericFooX, StructGenericBar, StructGenericBaz> where StructGenericFoo : FooProtocol, StructGenericFooX : FooClass, StructGenericBar : BarProtocol, StructGenericBar : FooProtocol {{{$}}
// PASS_ONE_LINE_TYPEREPR-DAG: {{^}}struct GenericParams1<StructGenericFoo, StructGenericFooX, StructGenericBar, StructGenericBaz> where StructGenericFoo : FooProtocol, StructGenericFooX : FooClass, StructGenericBar : BarProtocol, StructGenericBar : FooProtocol {{{$}}
  init<
      GenericFoo : FooProtocol,
      GenericFooX : FooClass,
      GenericBar : FooProtocol & BarProtocol,
      GenericBaz>(a: StructGenericFoo, b: StructGenericBar, c: StructGenericBaz,
                  d: GenericFoo, e: GenericFooX, f: GenericBar, g: GenericBaz)
  {}
// PASS_ONE_LINE_TYPE-DAG: {{^}}  init<GenericFoo, GenericFooX, GenericBar, GenericBaz>(a: StructGenericFoo, b: StructGenericBar, c: StructGenericBaz, d: GenericFoo, e: GenericFooX, f: GenericBar, g: GenericBaz) where GenericFoo : FooProtocol, GenericFooX : FooClass, GenericBar : BarProtocol, GenericBar : FooProtocol{{$}}
// FIXME: in protocol compositions protocols are listed in reverse order.
//
// PASS_ONE_LINE_TYPEREPR-DAG: {{^}}  init<GenericFoo, GenericFooX, GenericBar, GenericBaz>(a: StructGenericFoo, b: StructGenericBar, c: StructGenericBaz, d: GenericFoo, e: GenericFooX, f: GenericBar, g: GenericBaz) where GenericFoo : FooProtocol, GenericFooX : FooClass, GenericBar : BarProtocol, GenericBar : FooProtocol{{$}}

  func genericParams1<
      GenericFoo : FooProtocol,
      GenericFooX : FooClass,
      GenericBar : FooProtocol & BarProtocol,
      GenericBaz>(a: StructGenericFoo, b: StructGenericBar, c: StructGenericBaz,
                  d: GenericFoo, e: GenericFooX, f: GenericBar, g: GenericBaz)
  {}
// PASS_ONE_LINE_TYPE-DAG: {{^}}  func genericParams1<GenericFoo, GenericFooX, GenericBar, GenericBaz>(a: StructGenericFoo, b: StructGenericBar, c: StructGenericBaz, d: GenericFoo, e: GenericFooX, f: GenericBar, g: GenericBaz) where GenericFoo : FooProtocol, GenericFooX : FooClass, GenericBar : BarProtocol, GenericBar : FooProtocol{{$}}
// FIXME: in protocol compositions protocols are listed in reverse order.
//
// PASS_ONE_LINE_TYPEREPR-DAG: {{^}}  func genericParams1<GenericFoo, GenericFooX, GenericBar, GenericBaz>(a: StructGenericFoo, b: StructGenericBar, c: StructGenericBaz, d: GenericFoo, e: GenericFooX, f: GenericBar, g: GenericBaz) where GenericFoo : FooProtocol, GenericFooX : FooClass, GenericBar : BarProtocol, GenericBar : FooProtocol{{$}}

  func contextualWhereClause1() where StructGenericBaz == Never {}
  // PASS_PRINT_AST: func contextualWhereClause1() where StructGenericBaz == Never{{$}}

  subscript(index: Int) -> Never where StructGenericBaz: FooProtocol {
    return fatalError()
  }
  // PASS_PRINT_AST: subscript(index: Int) -> Never where StructGenericBaz : FooProtocol { get }{{$}}
}
extension GenericParams1 where StructGenericBaz: FooProtocol {
  static func contextualWhereClause2() where StructGenericBaz: FooClass {}
  // PASS_PRINT_AST: static func contextualWhereClause2() where StructGenericBaz : FooClass{{$}}

  typealias ContextualWhereClause3 = Never where StructGenericBaz: QuxProtocol, StructGenericBaz.Qux == Void
  // PASS_PRINT_AST: typealias ContextualWhereClause3 = Never where StructGenericBaz : QuxProtocol, StructGenericBaz.Qux == (){{$}}
}

struct GenericParams2<T : FooProtocol> where T : BarProtocol {}
// PASS_ONE_LINE-DAG: {{^}}struct GenericParams2<T> where T : BarProtocol, T : FooProtocol {{{$}}

struct GenericParams3<T : FooProtocol> where T : BarProtocol, T : QuxProtocol {}
// PASS_ONE_LINE-DAG: {{^}}struct GenericParams3<T> where T : BarProtocol, T : FooProtocol, T : QuxProtocol {{{$}}

struct GenericParams4<T : QuxProtocol> where T.Qux : FooProtocol {}
// PASS_ONE_LINE-DAG: {{^}}struct GenericParams4<T> where T : QuxProtocol, T.Qux : FooProtocol {{{$}}

struct GenericParams5<T : QuxProtocol> where T.Qux : FooProtocol & BarProtocol {}
// PREFER_TYPE_PRINTING: {{^}}struct GenericParams5<T> where T : QuxProtocol, T.Qux : BarProtocol, T.Qux : FooProtocol {{{$}}
// PREFER_TYPE_REPR_PRINTING: {{^}}struct GenericParams5<T> where T : QuxProtocol, T.Qux : BarProtocol, T.Qux : FooProtocol {{{$}}

struct GenericParams6<T : QuxProtocol, U : QuxProtocol> where T.Qux == U.Qux {}
// PREFER_TYPE_PRINTING: {{^}}struct GenericParams6<T, U> where T : QuxProtocol, U : QuxProtocol, T.Qux == U.Qux {{{$}}
// PREFER_TYPE_REPR_PRINTING: {{^}}struct GenericParams6<T, U> where T : QuxProtocol, U : QuxProtocol, T.Qux == U.Qux {{{$}}

struct GenericParams7<T : QuxProtocol, U : QuxProtocol> where T.Qux : QuxProtocol, U.Qux : QuxProtocol, T.Qux.Qux == U.Qux.Qux {}
// PREFER_TYPE_PRINTING: {{^}}struct GenericParams7<T, U> where T : QuxProtocol, U : QuxProtocol, T.Qux : QuxProtocol, U.Qux : QuxProtocol, T.Qux.Qux == U.Qux.Qux {{{$}}
// PREFER_TYPE_REPR_PRINTING: {{^}}struct GenericParams7<T, U> where T : QuxProtocol, U : QuxProtocol, T.Qux : QuxProtocol, U.Qux : QuxProtocol, T.Qux.Qux == U.Qux.Qux {{{$}}

//===---
//===--- Tupe sugar for library types.
//===---

struct d2900_TypeSugar1 {
// PASS_COMMON-LABEL: {{^}}struct d2900_TypeSugar1 {{{$}}
// SYNTHESIZE_SUGAR_ON_TYPES-LABEL: {{^}}struct d2900_TypeSugar1 {{{$}}

  func f1(x: [Int]) {}
// PASS_COMMON-NEXT: {{^}}  func f1(x: [Int]){{$}}
// SYNTHESIZE_SUGAR_ON_TYPES-NEXT: {{^}}  func f1(x: [Int]){{$}}

  func f2(x: Array<Int>) {}
// PASS_COMMON-NEXT: {{^}}  func f2(x: Array<Int>){{$}}
// SYNTHESIZE_SUGAR_ON_TYPES-NEXT: {{^}}  func f2(x: [Int]){{$}}

  func f3(x: Int?) {}
// PASS_COMMON-NEXT: {{^}}  func f3(x: Int?){{$}}
// SYNTHESIZE_SUGAR_ON_TYPES-NEXT: {{^}}  func f3(x: Int?){{$}}

  func f4(x: Optional<Int>) {}
// PASS_COMMON-NEXT: {{^}}  func f4(x: Optional<Int>){{$}}
// SYNTHESIZE_SUGAR_ON_TYPES-NEXT: {{^}}  func f4(x: Int?){{$}}

  func f5(x: [Int]...) {}
// PASS_COMMON-NEXT: {{^}}  func f5(x: [Int]...){{$}}
// SYNTHESIZE_SUGAR_ON_TYPES-NEXT: {{^}}  func f5(x: [Int]...){{$}}

  func f6(x: Array<Int>...) {}
// PASS_COMMON-NEXT: {{^}}  func f6(x: Array<Int>...){{$}}
// SYNTHESIZE_SUGAR_ON_TYPES-NEXT: {{^}}  func f6(x: [Int]...){{$}}

  func f7(x: [Int : Int]...) {}
// PASS_COMMON-NEXT: {{^}}  func f7(x: [Int : Int]...){{$}}
// SYNTHESIZE_SUGAR_ON_TYPES-NEXT: {{^}}  func f7(x: [Int : Int]...){{$}}

  func f8(x: Dictionary<String, Int>...) {}
// PASS_COMMON-NEXT: {{^}}  func f8(x: Dictionary<String, Int>...){{$}}
// SYNTHESIZE_SUGAR_ON_TYPES-NEXT: {{^}}  func f8(x: [String : Int]...){{$}}
}
// PASS_COMMON-NEXT: {{^}}  init(){{$}}
// PASS_COMMON-NEXT: {{^}}}{{$}}

// @discardableResult attribute
public struct DiscardableThingy {
    // PASS_PRINT_AST: @discardableResult
    // PASS_PRINT_AST-NEXT: public init()
    @discardableResult
    public init() {}

    // PASS_PRINT_AST: @discardableResult
    // PASS_PRINT_AST-NEXT: public func useless() -> Int
    @discardableResult
    public func useless() -> Int { return 0 }
}


// Parameter Attributes.


// <rdar://problem/19775868> Swift 1.2b1: Header gen puts @autoclosure in the wrong place
// PASS_PRINT_AST: public func ParamAttrs1(a: @autoclosure () -> ())
public func ParamAttrs1(a : @autoclosure () -> ()) {
  a()
}

// PASS_PRINT_AST: public func ParamAttrs2(a: @autoclosure @escaping () -> ())
public func ParamAttrs2(a : @autoclosure @escaping () -> ()) {
  a()
}

// PASS_PRINT_AST: public func ParamAttrs3(a: () -> ())
public func ParamAttrs3(a : () -> ()) {
  a()
}

// PASS_PRINT_AST: public func ParamAttrs4(a: @escaping () -> ())
public func ParamAttrs4(a : @escaping () -> ()) {
  a()
}

// PASS_PRINT_AST: public func ParamAttrs5(a: (@escaping () -> ()) -> ())
public func ParamAttrs5(a : (@escaping () -> ()) -> ()) {
}

// PASS_PRINT_AST: public typealias ParamAttrs6 = (@autoclosure () -> ()) -> ()
public typealias ParamAttrs6 = (@autoclosure () -> ()) -> ()

// The following type only has the internal parameter name inferred from the
// closure on the right-hand side of `=`. Thus, it is only part of the `Type`
// and not part of the `TypeRepr`.
// PASS_PRINT_AST_TYPE: public var ParamAttrs7: (_ f: @escaping () -> ()) -> ()
// PASS_PRINT_AST_TYPEREPR: public var ParamAttrs7: (@escaping () -> ()) -> ()
public var ParamAttrs7: (@escaping () -> ()) -> () = { f in f() }

// PASS_PRINT_AST: public var ParamAttrs8: (_ f: @escaping () -> ()) -> ()
public var ParamAttrs8: (_ f: @escaping () -> ()) -> () = { f in f() }

// Setter
// PASS_PRINT_AST: class FooClassComputed {
class FooClassComputed {

// PASS_PRINT_AST:   var stored: (((Int) -> Int) -> Int)?
  var stored : (((Int) -> Int) -> Int)? = nil

// PASS_PRINT_AST:   var computed: ((Int) -> Int) -> Int { get set }
  var computed : ((Int) -> Int) -> Int {
    get { return stored! }
    set { stored = newValue }
  }

// PASS_PRINT_AST: }
}

// PASS_PRINT_AST: struct HasDefaultTupleOfNils {
// PASS_PRINT_AST:   var x: (Int?, Int?)
// PASS_PRINT_AST:   var y: Int?
// PASS_PRINT_AST:   var z: Int
// PASS_PRINT_AST:   var w: ((Int?, (), Int?), (Int?, Int?))
// PASS_PRINT_AST:   init(x: (Int?, Int?) = (nil, nil), y: Int? = nil, z: Int, w: ((Int?, (), Int?), (Int?, Int?)) = ((nil, (), nil), (nil, nil)))
// PASS_PRINT_AST: }
struct HasDefaultTupleOfNils {
  var x: (Int?, Int?)
  var y: Int?
  var z: Int
  var w: ((Int?, (), Int?), (Int?, Int?))
}

// Protocol extensions

protocol ProtocolToExtend {
  associatedtype Assoc
}

extension ProtocolToExtend where Self.Assoc == Int {}
// PREFER_TYPE_REPR_PRINTING: extension ProtocolToExtend where Self.Assoc == Int {

// Protocol with where clauses

protocol ProtocolWithWhereClause : QuxProtocol where Qux == Int {}
// PREFER_TYPE_REPR_PRINTING: protocol ProtocolWithWhereClause : QuxProtocol where Self.Qux == Int {

protocol ProtocolWithWhereClauseAndAssoc : QuxProtocol where Qux == Int {
// PREFER_TYPE_REPR_PRINTING-DAG: protocol ProtocolWithWhereClauseAndAssoc : QuxProtocol where Self.Qux == Int {
  associatedtype A1 : QuxProtocol where A1 : FooProtocol, A1.Qux : QuxProtocol, Int == A1.Qux.Qux
// PREFER_TYPE_REPR_PRINTING-DAG: {{^}}  associatedtype A1 : FooProtocol, QuxProtocol where Self.A1.Qux : QuxProtocol, Self.A1.Qux.Qux == Int{{$}}

  associatedtype A2 : QuxProtocol where A2.Qux == Self
// PREFER_TYPE_REPR_PRINTING-DAG: {{^}}  associatedtype A2 : QuxProtocol where Self == Self.A2.Qux{{$}}
}

#if true
#elseif false
#else
#endif
// PASS_PRINT_AST: #if
// PASS_PRINT_AST: #elseif
// PASS_PRINT_AST: #else
// PASS_PRINT_AST: #endif

public struct MyPair<A, B> { var a: A, b: B }
public typealias MyPairI<B> = MyPair<Int, B>
// PASS_PRINT_AST: public typealias MyPairI<B> = MyPair<Int, B>
public typealias MyPairAlias<T, U> = MyPair<T, U>
// PASS_PRINT_AST: public typealias MyPairAlias<T, U> = MyPair<T, U>
typealias MyPairAlias2<T: FooProtocol, U> = MyPair<T, U> where U: BarProtocol
// PASS_PRINT_AST: typealias MyPairAlias2<T, U> = MyPair<T, U> where T : FooProtocol, U : BarProtocol