diff --git a/stdlib/public/core/Assert.swift b/stdlib/public/core/Assert.swift index 325f1d1dfdc6b..e25d84a553b7a 100644 --- a/stdlib/public/core/Assert.swift +++ b/stdlib/public/core/Assert.swift @@ -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 @@ -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 diff --git a/validation-test/stdlib/AssertDiagnosticsSIL.swift b/validation-test/stdlib/AssertDiagnosticsSIL.swift index 72a74440ab59b..428337bcb245c 100644 --- a/validation-test/stdlib/AssertDiagnosticsSIL.swift +++ b/validation-test/stdlib/AssertDiagnosticsSIL.swift @@ -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 +}