Skip to content
Open
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
6 changes: 2 additions & 4 deletions stdlib/public/core/Assert.swift
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,7 @@ public func precondition(
/// where `assertionFailure(_:file:line:)` is called.
/// - line: The line number to print along with `message`. The default is the
/// line number where `assertionFailure(_:file:line:)` is called.
@inlinable
@inline(__always)
@_transparent
#if $Embedded
@_disfavoredOverload
#endif
Expand All @@ -182,8 +181,7 @@ public func assertionFailure(
}

#if $Embedded
@inlinable
@inline(__always)
@_transparent
public func assertionFailure(
_ message: @autoclosure () -> StaticString = StaticString(),
file: StaticString = #file, line: UInt = #line
Expand Down
9 changes: 6 additions & 3 deletions validation-test/stdlib/AssertDiagnosticsSIL.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
// RUN: %target-swift-frontend %s -emit-sil -verify

func assertionFailure_isNotNoreturn() -> Int {
_ = 0 // Don't implicitly return the assertionFailure call.
// assertionFailure() is now @_transparent (previously @inlinable), so the
// compiler can see that it never returns, eliminating the "missing return" error.
func assertionFailure_isNoreturn() -> Int {
_ = 0
assertionFailure("")
} // expected-error {{missing return in global function expected to return 'Int'}}
// No error expected - assertionFailure() is recognized as Never-returning
}