I have 3 frameworks (I've tested this with 3 SPM library packages, the compiler emits the same warning).
In framework "C", I've defined a struct in a public file:
public struct StructFromC {
public struct Inner {
public init() {}
}
public init() {}
}
In framework "B", I have a public file containing the following:
import FrameworkC
public typealias StructFromCViaB = FrameworkC.StructFromC
In framework "A", I have a file containing the following:
import FrameworkB
// No warnings
let structC = StructFromCViaB()
// No warnings
let inner = StructFromCViaB.Inner()
// No warnings
public let publicStructC = StructFromCViaB()
// Warning: Cannot use struct 'Inner' here; 'FrameworkC' was not imported by this file
public let publicInner = StructFromCViaB.Inner()
Prior to Xcode 14.3 (or was it Xcode 14.2?), the warning above was not emitted by the compiler. As of Xcode 15, the warning is still emitted. I'm surprised I can declare "public let publicStructC" without a warning, but declaring "public let publicInner" produces a warning.
Is this warning spurious and thus a compiler bug?
Or was this design flawed and will it eventually fail to compile?
Thanks,
--David