Skip to content

[stdlib] Adjust _assertionFailed signature for naming guidelines #6388

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 20, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions stdlib/public/core/Assert.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public func assert(
// Only assert in debug mode.
if _isDebugAssertConfiguration() {
if !_branchHint(condition(), expected: true) {
_assertionFailed("assertion failed", message(), file, line,
_assertionFailure("assertion failed", message(), file: file, line: line,
flags: _fatalErrorFlags())
}
}
Expand Down Expand Up @@ -88,7 +88,7 @@ public func precondition(
// Only check in debug and release mode. In release mode just trap.
if _isDebugAssertConfiguration() {
if !_branchHint(condition(), expected: true) {
_assertionFailed("precondition failed", message(), file, line,
_assertionFailure("precondition failed", message(), file: file, line: line,
flags: _fatalErrorFlags())
}
} else if _isReleaseAssertConfiguration() {
Expand Down Expand Up @@ -128,7 +128,7 @@ public func assertionFailure(
file: StaticString = #file, line: UInt = #line
) {
if _isDebugAssertConfiguration() {
_assertionFailed("fatal error", message(), file, line,
_assertionFailure("fatal error", message(), file: file, line: line,
flags: _fatalErrorFlags())
}
else if _isFastAssertConfiguration() {
Expand Down Expand Up @@ -167,7 +167,7 @@ public func preconditionFailure(
) -> Never {
// Only check in debug and release mode. In release mode just trap.
if _isDebugAssertConfiguration() {
_assertionFailed("fatal error", message(), file, line,
_assertionFailure("fatal error", message(), file: file, line: line,
flags: _fatalErrorFlags())
} else if _isReleaseAssertConfiguration() {
Builtin.int_trap()
Expand All @@ -188,7 +188,7 @@ public func fatalError(
_ message: @autoclosure () -> String = String(),
file: StaticString = #file, line: UInt = #line
) -> Never {
_assertionFailed("fatal error", message(), file, line,
_assertionFailure("fatal error", message(), file: file, line: line,
flags: _fatalErrorFlags())
}

Expand All @@ -206,7 +206,7 @@ public func _precondition(
// Only check in debug and release mode. In release mode just trap.
if _isDebugAssertConfiguration() {
if !_branchHint(condition(), expected: true) {
_fatalErrorMessage("fatal error", message, file, line,
_fatalErrorMessage("fatal error", message, file: file, line: line,
flags: _fatalErrorFlags())
}
} else if _isReleaseAssertConfiguration() {
Expand Down Expand Up @@ -235,8 +235,8 @@ public func _overflowChecked<T>(
let (result, error) = args
if _isDebugAssertConfiguration() {
if _branchHint(error, expected: false) {
_fatalErrorMessage("fatal error", "Overflow/underflow", file, line,
flags: _fatalErrorFlags())
_fatalErrorMessage("fatal error", "Overflow/underflow",
file: file, line: line, flags: _fatalErrorFlags())
}
} else {
Builtin.condfail(error._value)
Expand All @@ -260,7 +260,7 @@ public func _debugPrecondition(
// Only check in debug mode.
if _isDebugAssertConfiguration() {
if !_branchHint(condition(), expected: true) {
_fatalErrorMessage("fatal error", message, file, line,
_fatalErrorMessage("fatal error", message, file: file, line: line,
flags: _fatalErrorFlags())
}
}
Expand Down Expand Up @@ -290,7 +290,7 @@ public func _sanityCheck(
) {
#if INTERNAL_CHECKS_ENABLED
if !_branchHint(condition(), expected: true) {
_fatalErrorMessage("fatal error", message, file, line,
_fatalErrorMessage("fatal error", message, file: file, line: line,
flags: _fatalErrorFlags())
}
#endif
Expand Down
15 changes: 6 additions & 9 deletions stdlib/public/core/AssertCommon.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,9 @@ func _fatalErrorFlags() -> UInt32 {
@_versioned
@inline(never)
@_semantics("stdlib_binary_only")
func _assertionFailed(
// FIXME(ABI)#18 : add argument labels to conform to API guidelines.
func _assertionFailure(
_ prefix: StaticString, _ message: StaticString,
_ file: StaticString, _ line: UInt,
file: StaticString, line: UInt,
flags: UInt32
) -> Never {
prefix.withUTF8Buffer {
Expand Down Expand Up @@ -112,10 +111,9 @@ func _assertionFailed(
@_versioned
@inline(never)
@_semantics("stdlib_binary_only")
func _assertionFailed(
// FIXME(ABI)#19 : add argument labels to conform to API guidelines.
func _assertionFailure(
_ prefix: StaticString, _ message: String,
_ file: StaticString, _ line: UInt,
file: StaticString, line: UInt,
flags: UInt32
) -> Never {
prefix.withUTF8Buffer {
Expand Down Expand Up @@ -146,9 +144,8 @@ func _assertionFailed(
@_semantics("stdlib_binary_only")
@_semantics("arc.programtermination_point")
func _fatalErrorMessage(
// FIXME(ABI)#20 : add argument labels to conform to API guidelines.
_ prefix: StaticString, _ message: StaticString,
_ file: StaticString, _ line: UInt,
file: StaticString, line: UInt,
flags: UInt32
) -> Never {
#if INTERNAL_CHECKS_ENABLED
Expand Down Expand Up @@ -235,5 +232,5 @@ func _undefined<T>(
_ message: @autoclosure () -> String = String(),
file: StaticString = #file, line: UInt = #line
) -> T {
_assertionFailed("fatal error", message(), file, line, flags: 0)
_assertionFailure("fatal error", message(), file: file, line: line, flags: 0)
}