-
Couldn't load subscription status.
- Fork 10.6k
Open
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itself
Description
| Previous ID | SR-15277 |
| Radar | None |
| Original Reporter | kenbongort (JIRA User) |
| Type | Bug |
Attachment: Download
Environment
Mac OS 11.5.2
Xcode 13.0 (13A233)
Swift 5.5 (swift-5.5-RELEASE)
Additional Detail from JIRA
| Votes | 0 |
| Component/s | Compiler |
| Labels | Bug |
| Assignee | None |
| Priority | Medium |
md5: 5964d985162594057b7ed12a23b3d304
Issue Description:
Calling swift-frontend with -experimental-skip-non-inlinable-function-bodies-without-types throws up errors when compiling this code:
import os.log
@inlinable public func os_log() {
if #available(macOS 10.14, iOS 12, tvOS 12, watchOS 5, *) {
os.os_log(.debug, log: .default, "Hello")
}
}The errors are:
/Users/kennethbongort/Source/swift-build-test/Sources/swift-build-test/main.swift:13:10: error: 'os_log(_:dso:log:_:_:)' is only available in macOS 10.14 or newer
os.os_log(.debug, log: .default, "Hello")
^
/Users/kennethbongort/Source/swift-build-test/Sources/swift-build-test/main.swift:13:10: note: add 'if #available' version check
os.os_log(.debug, log: .default, "Hello")
^
/Users/kennethbongort/Source/swift-build-test/Sources/swift-build-test/main.swift:11:24: note: add @available attribute to enclosing global function
@inlinable public func os_log() {
^
/Users/kennethbongort/Source/swift-build-test/Sources/swift-build-test/main.swift:13:18: error: 'debug' is only available in macOS 10.12 or newer
os.os_log(.debug, log: .default, "Hello")
^
/Users/kennethbongort/Source/swift-build-test/Sources/swift-build-test/main.swift:13:18: note: add 'if #available' version check
os.os_log(.debug, log: .default, "Hello")
^
/Users/kennethbongort/Source/swift-build-test/Sources/swift-build-test/main.swift:11:24: note: add @available attribute to enclosing global function
@inlinable public func os_log() {
^
/Users/kennethbongort/Source/swift-build-test/Sources/swift-build-test/main.swift:13:31: error: 'default' is only available in macOS 10.12 or newer
os.os_log(.debug, log: .default, "Hello")
^
/Users/kennethbongort/Source/swift-build-test/Sources/swift-build-test/main.swift:13:31: note: add 'if #available' version check
os.os_log(.debug, log: .default, "Hello")
^
/Users/kennethbongort/Source/swift-build-test/Sources/swift-build-test/main.swift:11:24: note: add @available attribute to enclosing global function
@inlinable public func os_log() {A small SwiftPM project is attached with code that demonstrates this issue. When I run the following swift-frontend command line, I get the errors described above:
/Library/Developer/Toolchains/swift-5.5-RELEASE.xctoolchain/usr/bin/swift-frontend -frontend -emit-module -experimental-skip-non-inlinable-function-bodies-without-types /Users/kennethbongort/Source/swift-build-test/Sources/swift-build-test/main.swift -target x86_64-apple-macosx10.10 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk -I /Users/kennethbongort/Source/swift-build-test/.build/x86_64-apple-macosx/debug -I /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib -F /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -color-diagnostics -enable-testing -g -module-cache-path /Users/kennethbongort/Source/swift-build-test/.build/x86_64-apple-macosx/debug/ModuleCache -swift-version 5 -Onone -D SWIFT_PACKAGE -D DEBUG -entry-point-function-name swift_build_test_main -resource-dir /Library/Developer/Toolchains/swift-5.5-RELEASE.xctoolchain/usr/lib/swift -enable-anonymous-context-mangled-names -module-name swift_build_test -target-sdk-version 11.3.0 -emit-module-doc-path /Users/kennethbongort/Source/swift-build-test/.build/x86_64-apple-macosx/debug/swift_build_test.swiftdoc -emit-module-source-info-path /Users/kennethbongort/Source/swift-build-test/.build/x86_64-apple-macosx/debug/swift_build_test.swiftsourceinfo -o /Users/kennethbongort/Source/swift-build-test/.build/x86_64-apple-macosx/debug/swift_build_test.swiftmoduleThe same command line succeeds when the -experimental-skip-non-inlinable-function-bodies-without-types argument is removed.
davemackintosh
Metadata
Metadata
Assignees
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itself