Skip to content

Commit e117378

Browse files
committed
tests: add a compile-time test for large string arrays.
rdar://problem/56268570
1 parent f83bd28 commit e117378

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %gyb %s > %t/main.swift
3+
4+
// The compiler should finish in less than 1 minute. To give some slack,
5+
// specify a timeout of 5 minutes.
6+
// If the compiler needs more than 5 minutes, there is probably a real problem.
7+
// So please don't just increase the timeout in case this fails.
8+
9+
// RUN: %{python} %S/../../test/Inputs/timeout.py 300 %target-swift-frontend -O -parse-as-library -sil-verify-none -emit-sil %t/main.swift | %FileCheck %s
10+
11+
// REQUIRES: swift_stdlib_no_asserts,optimized_stdlib
12+
// REQUIRES: long_test
13+
14+
// Check if the optimizer can optimize the whole array into a statically
15+
// initialized global
16+
17+
// CHECK: sil_global private @globalinit_{{.*}} : $_ContiguousArrayStorage<String> = {
18+
// CHECK: %initval = object $_ContiguousArrayStorage<String>
19+
20+
public let str_array: [String] = [
21+
22+
% for i in range(63500):
23+
"string in array with index ${i}",
24+
% end
25+
26+
]
27+

0 commit comments

Comments
 (0)