@@ -302,4 +302,72 @@ final class ArrayDeclTests: PrettyPrintTestCase {
302
302
303
303
assertPrettyPrintEqual ( input: input, expected: expected, linelength: 32 )
304
304
}
305
+
306
+ func testInlineArrayTypeSugar( ) {
307
+ let input =
308
+ """
309
+ let a: [3 of Int]
310
+ let a: [[3 of Int]]
311
+ let a: [3 of [3 of Int]]
312
+ let a: [n of Int]
313
+ let fiveIntegers: [5 of _] = .init(repeating: 99)
314
+ let fourBytes: [_ of Int8] = [1, 2, 3, 4]
315
+ let fourIntegers: [_ of _] = [1, 2, 3, 4]
316
+ let fiveDoubles = [5 of _](repeating: 1.23)
317
+
318
+ """
319
+
320
+ let expected =
321
+ """
322
+ let a: [3 of Int]
323
+ let a: [[3 of Int]]
324
+ let a: [3 of [3 of Int]]
325
+ let a: [n of Int]
326
+ let fiveIntegers: [5 of _] = .init(repeating: 99)
327
+ let fourBytes: [_ of Int8] = [1, 2, 3, 4]
328
+ let fourIntegers: [_ of _] = [1, 2, 3, 4]
329
+ let fiveDoubles = [5 of _](repeating: 1.23)
330
+
331
+ """
332
+
333
+ assertPrettyPrintEqual ( input: input, expected: expected, linelength: 80 )
334
+ }
335
+
336
+ func testInlineArrayTypeSugarWhenLineLengthExceeded( ) {
337
+ let input =
338
+ """
339
+ let a: [3 of VeryLongGenericTypeNameThatCausesWrapping]
340
+ let a: [3 of [3 of VeryLongGenericTypeNameThatCausesWrapping]]
341
+ let a = [3 of VeryLongGenericTypeNameThatCausesWrapping](repeating: foo)
342
+
343
+ """
344
+
345
+ let expected =
346
+ """
347
+ let a:
348
+ [
349
+ 3 of
350
+ VeryLongGenericTypeNameThatCausesWrapping
351
+ ]
352
+ let a:
353
+ [
354
+ 3 of
355
+ [
356
+ 3 of
357
+ VeryLongGenericTypeNameThatCausesWrapping
358
+ ]
359
+ ]
360
+ let a =
361
+ [
362
+ 3 of
363
+ VeryLongGenericTypeNameThatCausesWrapping
364
+ ](
365
+ repeating:
366
+ foo
367
+ )
368
+
369
+ """
370
+
371
+ assertPrettyPrintEqual ( input: input, expected: expected, linelength: 5 )
372
+ }
305
373
}
0 commit comments