Skip to content

Commit 76b5af2

Browse files
committed
Merge pull request #255 from Austinate/master
Changes related to SE-0028
2 parents 6bdb074 + 970a991 commit 76b5af2

File tree

5 files changed

+20
-20
lines changed

5 files changed

+20
-20
lines changed

Foundation/NSCalendar.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1538,10 +1538,10 @@ public class NSDateComponents : NSObject, NSCopying, NSSecureCoding {
15381538
yearForWeekOfYear = value
15391539
break
15401540
case NSCalendarUnit.Calendar:
1541-
print(".Calendar cannot be set via \(__FUNCTION__)")
1541+
print(".Calendar cannot be set via \(#function)")
15421542
break
15431543
case NSCalendarUnit.TimeZone:
1544-
print(".TimeZone cannot be set via \(__FUNCTION__)")
1544+
print(".TimeZone cannot be set via \(#function)")
15451545
break
15461546
default:
15471547
break

Foundation/NSObjCRuntime.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,15 +194,15 @@ public typealias NSComparator = (AnyObject, AnyObject) -> NSComparisonResult
194194

195195
public let NSNotFound: Int = Int.max
196196

197-
@noreturn internal func NSRequiresConcreteImplementation(fn: String = __FUNCTION__, file: StaticString = __FILE__, line: UInt = __LINE__) {
197+
@noreturn internal func NSRequiresConcreteImplementation(fn: String = #function, file: StaticString = #file, line: UInt = #line) {
198198
fatalError("\(fn) must be overriden in subclass implementations", file: file, line: line)
199199
}
200200

201-
@noreturn internal func NSUnimplemented(fn: String = __FUNCTION__, file: StaticString = __FILE__, line: UInt = __LINE__) {
201+
@noreturn internal func NSUnimplemented(fn: String = #function, file: StaticString = #file, line: UInt = #line) {
202202
fatalError("\(fn) is not yet implemented", file: file, line: line)
203203
}
204204

205-
@noreturn internal func NSInvalidArgument(message: String, method: String = __FUNCTION__, file: StaticString = __FILE__, line: UInt = __LINE__) {
205+
@noreturn internal func NSInvalidArgument(message: String, method: String = #function, file: StaticString = #file, line: UInt = #line) {
206206
fatalError("\(method): \(message)", file: file, line: line)
207207
}
208208

TestFoundation/TestNSAffineTransform.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,23 @@ class TestNSAffineTransform : XCTestCase {
4141
]
4242
}
4343

44-
func checkPointTransformation(transform: NSAffineTransform, point: NSPoint, expectedPoint: NSPoint, _ message: String = "", file: StaticString = __FILE__, line: UInt = __LINE__) {
44+
func checkPointTransformation(transform: NSAffineTransform, point: NSPoint, expectedPoint: NSPoint, _ message: String = "", file: StaticString = #file, line: UInt = #line) {
4545
let newPoint = transform.transformPoint(point)
4646
XCTAssertEqualWithAccuracy(Double(newPoint.x), Double(expectedPoint.x), accuracy: accuracyThreshold, file: file, line: line,
4747
"x (expected: \(expectedPoint.x), was: \(newPoint.x)): \(message)")
4848
XCTAssertEqualWithAccuracy(Double(newPoint.y), Double(expectedPoint.y), accuracy: accuracyThreshold, file: file, line: line,
4949
"y (expected: \(expectedPoint.y), was: \(newPoint.y)): \(message)")
5050
}
5151

52-
func checkSizeTransformation(transform: NSAffineTransform, size: NSSize, expectedSize: NSSize, _ message: String = "", file: StaticString = __FILE__, line: UInt = __LINE__) {
52+
func checkSizeTransformation(transform: NSAffineTransform, size: NSSize, expectedSize: NSSize, _ message: String = "", file: StaticString = #file, line: UInt = #line) {
5353
let newSize = transform.transformSize(size)
5454
XCTAssertEqualWithAccuracy(Double(newSize.width), Double(expectedSize.width), accuracy: accuracyThreshold, file: file, line: line,
5555
"width (expected: \(expectedSize.width), was: \(newSize.width)): \(message)")
5656
XCTAssertEqualWithAccuracy(Double(newSize.height), Double(expectedSize.height), accuracy: accuracyThreshold, file: file, line: line,
5757
"height (expected: \(expectedSize.height), was: \(newSize.height)): \(message)")
5858
}
5959

60-
func checkRectTransformation(transform: NSAffineTransform, rect: NSRect, expectedRect: NSRect, _ message: String = "", file: StaticString = __FILE__, line: UInt = __LINE__) {
60+
func checkRectTransformation(transform: NSAffineTransform, rect: NSRect, expectedRect: NSRect, _ message: String = "", file: StaticString = #file, line: UInt = #line) {
6161
let newRect = transform.transformRect(rect)
6262

6363
checkPointTransformation(transform, point: newRect.origin, expectedPoint: expectedRect.origin, file: file, line: line,

TestFoundation/TestNSRegularExpression.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class TestNSRegularExpression : XCTestCase {
2828
]
2929
}
3030

31-
func simpleRegularExpressionTestWithPattern(patternString: String, target searchString: String, looking: Bool, match: Bool, file: StaticString = __FILE__, line: UInt = __LINE__) {
31+
func simpleRegularExpressionTestWithPattern(patternString: String, target searchString: String, looking: Bool, match: Bool, file: StaticString = #file, line: UInt = #line) {
3232
do {
3333
let str = searchString.bridge()
3434
var range = NSMakeRange(0, str.length)
@@ -159,7 +159,7 @@ class TestNSRegularExpression : XCTestCase {
159159
simpleRegularExpressionTestWithPattern("\\\\\\|\\(\\)\\[\\{\\~\\$\\*\\+\\?\\.", target:"\\|()[{~$*+?.", looking:true, match:true)
160160
}
161161

162-
func replaceRegularExpressionTest(patternString: String, _ patternOptions: NSRegularExpressionOptions, _ searchString: String, _ searchOptions: NSMatchingOptions, _ searchRange: NSRange, _ templ: String, _ numberOfMatches: Int, _ result: String, file: StaticString = __FILE__, line: UInt = __LINE__) {
162+
func replaceRegularExpressionTest(patternString: String, _ patternOptions: NSRegularExpressionOptions, _ searchString: String, _ searchOptions: NSMatchingOptions, _ searchRange: NSRange, _ templ: String, _ numberOfMatches: Int, _ result: String, file: StaticString = #file, line: UInt = #line) {
163163
do {
164164
let regex = try NSRegularExpression(pattern: patternString, options: patternOptions)
165165
let mutableString = searchString.bridge().mutableCopy() as! NSMutableString
@@ -198,7 +198,7 @@ class TestNSRegularExpression : XCTestCase {
198198
replaceRegularExpressionTest("\\b(th[a-z]+) \\1\\b", .CaseInsensitive, "This this is the the way.", [], NSMakeRange(0, 25), "*\\\\\\$1*", 2, "*\\$1* is *\\$1* way.")
199199
}
200200

201-
func complexRegularExpressionTest(patternString: String, _ patternOptions: NSRegularExpressionOptions, _ searchString: String, _ searchOptions: NSMatchingOptions, _ searchRange: NSRange, _ numberOfMatches: Int, _ firstMatchOverallRange: NSRange, _ firstMatchFirstCaptureRange: NSRange, _ firstMatchLastCaptureRange: NSRange, file: StaticString = __FILE__, line: UInt = __LINE__) {
201+
func complexRegularExpressionTest(patternString: String, _ patternOptions: NSRegularExpressionOptions, _ searchString: String, _ searchOptions: NSMatchingOptions, _ searchRange: NSRange, _ numberOfMatches: Int, _ firstMatchOverallRange: NSRange, _ firstMatchFirstCaptureRange: NSRange, _ firstMatchLastCaptureRange: NSRange, file: StaticString = #file, line: UInt = #line) {
202202
do {
203203
let regex = try NSRegularExpression(pattern: patternString, options: patternOptions)
204204
let matches = regex.matchesInString(searchString, options: searchOptions, range: searchRange)

TestFoundation/TestNSString.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,7 @@ struct ComparisonTest {
888888

889889
init(
890890
_ lhs: String, _ rhs: String,
891-
reason: String = "", line: UInt = __LINE__
891+
reason: String = "", line: UInt = #line
892892
) {
893893
self.lhs = lhs
894894
self.rhs = rhs
@@ -1039,8 +1039,8 @@ func checkHasPrefixHasSuffix(lhs: String, _ rhs: String, _ stack: [UInt]) -> Int
10391039
}
10401040

10411041
var failures = 0
1042-
failures += testFailure(expectHasPrefix, lhs.hasPrefix(rhs), stack + [__LINE__])
1043-
failures += testFailure(expectHasSuffix, lhs.hasSuffix(rhs), stack + [__LINE__])
1042+
failures += testFailure(expectHasPrefix, lhs.hasPrefix(rhs), stack + [#line])
1043+
failures += testFailure(expectHasSuffix, lhs.hasSuffix(rhs), stack + [#line])
10441044
return failures
10451045
}
10461046

@@ -1049,16 +1049,16 @@ extension TestNSString {
10491049
#if !_runtime(_ObjC)
10501050
for test in comparisonTests {
10511051
var failures = 0
1052-
failures += checkHasPrefixHasSuffix(test.lhs, test.rhs, [test.loc, __LINE__])
1053-
failures += checkHasPrefixHasSuffix(test.rhs, test.lhs, [test.loc, __LINE__])
1052+
failures += checkHasPrefixHasSuffix(test.lhs, test.rhs, [test.loc, #line])
1053+
failures += checkHasPrefixHasSuffix(test.rhs, test.lhs, [test.loc, #line])
10541054

10551055
let fragment = "abc"
10561056
let combiner = "\u{0301}"
10571057

1058-
failures += checkHasPrefixHasSuffix(test.lhs + fragment, test.rhs, [test.loc, __LINE__])
1059-
failures += checkHasPrefixHasSuffix(fragment + test.lhs, test.rhs, [test.loc, __LINE__])
1060-
failures += checkHasPrefixHasSuffix(test.lhs + combiner, test.rhs, [test.loc, __LINE__])
1061-
failures += checkHasPrefixHasSuffix(combiner + test.lhs, test.rhs, [test.loc, __LINE__])
1058+
failures += checkHasPrefixHasSuffix(test.lhs + fragment, test.rhs, [test.loc, #line])
1059+
failures += checkHasPrefixHasSuffix(fragment + test.lhs, test.rhs, [test.loc, #line])
1060+
failures += checkHasPrefixHasSuffix(test.lhs + combiner, test.rhs, [test.loc, #line])
1061+
failures += checkHasPrefixHasSuffix(combiner + test.lhs, test.rhs, [test.loc, #line])
10621062

10631063
let fail = (failures > 0)
10641064
if fail {

0 commit comments

Comments
 (0)