Skip to content

Commit 9da87ef

Browse files
committed
Merge pull request #1270 from modocache/fix-arithetic-trap-warnings
[validation-test] Fix Swift 3 warnings in .gyb (NFC)
2 parents a105915 + cc3165a commit 9da87ef

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

validation-test/stdlib/FixedPointArithmeticTraps.swift.gyb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func expectOverflow<T>(
2828
@autoclosure _ message: () -> String = "",
2929
showFrame: Bool = true,
3030
stackTrace: SourceLocStack = SourceLocStack(),
31-
file: String = __FILE__, line: UInt = __LINE__
31+
file: String = #file, line: UInt = #line
3232
) {
3333
expectTrue(
3434
res.overflow, "expected overflow",
@@ -41,7 +41,7 @@ func expectNoOverflow<T>(
4141
@autoclosure _ message: () -> String = "",
4242
showFrame: Bool = true,
4343
stackTrace: SourceLocStack = SourceLocStack(),
44-
file: String = __FILE__, line: UInt = __LINE__
44+
file: String = #file, line: UInt = #line
4545
) {
4646
expectFalse(
4747
res.overflow, "expected no overflow",
@@ -68,45 +68,45 @@ var FixedPointArithmeticTraps = TestSuite("FixedPointArithmeticTraps")
6868

6969
FixedPointArithmeticTraps.test("PreDecrement/${IntTy}") {
7070
var x = get${IntTy}(${IntTy}.min)
71-
++x
71+
x += 1
7272

7373
x = get${IntTy}(${IntTy}.min)
7474
expectCrashLater()
7575
// --IntTy.min
76-
--x
76+
x -= 1
7777
_blackHole(x)
7878
}
7979

8080
FixedPointArithmeticTraps.test("PreIncrement/${IntTy}") {
8181
var x = get${IntTy}(${IntTy}.max)
82-
--x
82+
x -= 1
8383

8484
x = get${IntTy}(${IntTy}.max)
8585
expectCrashLater()
8686
// ++IntTy.max
87-
++x
87+
x += 1
8888
_blackHole(x)
8989
}
9090

9191
FixedPointArithmeticTraps.test("PostDecrement/${IntTy}") {
9292
var x = get${IntTy}(${IntTy}.min)
93-
x++
93+
x += 1
9494

9595
x = get${IntTy}(${IntTy}.min)
9696
expectCrashLater()
9797
// IntTy.min--
98-
x--
98+
x -= 1
9999
_blackHole(x)
100100
}
101101

102102
FixedPointArithmeticTraps.test("PostIncrement/${IntTy}") {
103103
var x = get${IntTy}(${IntTy}.max)
104-
x--
104+
x -= 1
105105

106106
x = get${IntTy}(${IntTy}.max)
107107
expectCrashLater()
108108
// IntTy.max++
109-
x++
109+
x += 1
110110
_blackHole(x)
111111
}
112112

0 commit comments

Comments
 (0)