Is it intended that the bound types swift::Optional and swift::String cannot be used to return swift types to swift?
Attempting to do so results in the swift::Optional<T> for some T being replaced with Never
/Users/andrew/Source/test/swift-return-swift-type/exe/Helper.swift:5:11: error: 'getValue()' is unavailable: return type is unavailable in Swift
3 | func printThings()
4 | {
5 | print(getValue())
| `- error: 'getValue()' is unavailable: return type is unavailable in Swift
6 | print(getString())
7 | }
exe.getValue:2:13: note: 'getValue()' has been explicitly marked unavailable here
1 | @available(*, unavailable, message: "return type is unavailable in Swift")
2 | public func getValue() -> Never
| `- note: 'getValue()' has been explicitly marked unavailable here
/Users/andrew/Source/test/swift-return-swift-type/exe/Helper.swift:6:11: error: 'getString()' is unavailable: return type is unavailable in Swift
4 | {
5 | print(getValue())
6 | print(getString())
| `- error: 'getString()' is unavailable: return type is unavailable in Swift
7 | }
8 |
exe.getString:2:13: note: 'getString()' has been explicitly marked unavailable here
1 | @available(*, unavailable, message: "return type is unavailable in Swift")
2 | public func getString() -> Never
| `- note: 'getString()' has been explicitly marked unavailable here
Reproduction
This test case requires a few files, which I have uploaded here:
Description
Is it intended that the bound types
swift::Optional
andswift::String
cannot be used to return swift types to swift?Attempting to do so results in the
swift::Optional<T>
for some T being replaced withNever
Reproduction
This test case requires a few files, which I have uploaded here:
https://github.com/ADKaster/swift-return-swift-type
The results can be reproduced with
In the example, a few things are happening:
swift::Optional<T>
for some T.Helper.h
Helper.cpp
Helper.swift
Expected behavior
The program should compile successfully and print "42\nnone\n"
Environment
swift-driver version: 1.113 Apple Swift version 6.0 (swiftlang-6.0.0.7.6 clang-1600.0.24.1) Target: arm64-apple-macosx14.0
Additional information
No response