Skip to content

Commit bf6f743

Browse files
committed
---
yaml --- r: 348521 b: refs/heads/master c: 09236b1 h: refs/heads/master i: 348519: 39329b0
1 parent f129780 commit bf6f743

File tree

3 files changed

+24
-13
lines changed

3 files changed

+24
-13
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: fd0ba114623fd22dc8f751da26c5408c067b6b62
2+
refs/heads/master: 09236b17018a0eae6543da3408b4cb93010556b9
33
refs/heads/master-next: 203b3026584ecad859eb328b2e12490099409cd5
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea

trunk/test/SILOptimizer/pound_assert.swift

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// RUN: %target-swift-frontend -enable-experimental-static-assert -emit-sil %s -verify
2+
// RUN: %target-swift-frontend -enable-experimental-static-assert -enable-ownership-stripping-after-serialization -emit-sil %s -verify
23

34
// REQUIRES: optimized_stdlib
45
// REQUIRES: asserts
@@ -67,18 +68,6 @@ func test_loops() {
6768
#assert(infiniteLoop() == 1)
6869
}
6970

70-
// NOTE: We currently hit the limit of 512 on a debug_value in the prelude of
71-
// this function. TODO: What is the right thing to do here?
72-
func recursive(a: Int) -> Int { // expected-note {{limit exceeded here}}
73-
return a == 0 ? 0 : recursive(a: a-1)
74-
}
75-
76-
func test_recursive() {
77-
// expected-error @+2 {{#assert condition not constant}}
78-
// expected-note @+1 {{exceeded instruction limit: 512 when evaluating the expression at compile time}}
79-
#assert(recursive(a: 20000) > 42)
80-
}
81-
8271
func conditional(_ x: Int) -> Int {
8372
if x < 0 {
8473
return 0
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// RUN: not %target-swift-frontend -enable-experimental-static-assert -emit-sil %s 2>&1 | %FileCheck %s
2+
// RUN: not %target-swift-frontend -enable-experimental-static-assert -enable-ownership-stripping-after-serialization -emit-sil %s 2>&1 | %FileCheck %s
3+
4+
// This is a special FileCheck test for testing that we properly catch that we
5+
// are recursing here. The reason why this is separate from the other
6+
// pound_assert tests is that the "limit exceeded" here diagnostic can vary
7+
// depending on the codegen since we are using an arbitrary limit of 512. If the
8+
// codegen changes, the line where we stop evaluating can change meaning that
9+
// the note moves around lines. With FileCheck we have more flexibility to just
10+
// match what we actually want.
11+
12+
// CHECK: error: #assert condition not constant
13+
// CHECK: note: exceeded instruction limit: 512 when evaluating the expression at compile time
14+
// CHECK: limit exceeded here
15+
func recursive(a: Int) -> Int {
16+
return a == 0 ? 0 : recursive(a: a-1)
17+
}
18+
19+
func test_recursive() {
20+
#assert(recursive(a: 20000) > 42)
21+
}
22+

0 commit comments

Comments
 (0)