FB11244375: Xcode shows an error message when importing a module that declares a typealias to a protocol with a primary associated type
Xcode 14beta5 shows a message stating that "An internal error occurred. Source editor functionality is limited. Attempting to restore..." when importing a module that declare a typealias to a protocol with a primary associated type (and where the alias specifies the primary associated type, generically or not).
To reproduce, create a SwiftPM package with two modules A
and B
having A
as a dependency.
In the module A
, declare:
public protocol Foo<Bar> {
associatedtype Bar
}
public typealias Problem = Foo<String>
In the module B
, import A
, and then start to type struct Hello {}
:
import A
str… // The error message appears
It builds after completing the declaration, but it shows an error message at the top of the editor.
I'm attaching a zip of such package where you can reproduce by by starting editing the EditThis.swift file!
The issue started to occur in Xcode 14.0 beta 4. There is no issue when using Xcode 14.0 beta 3.
It seems to be mostly triggered by starting to write top-level declarations or enums cases.
This is likely related to https://github.com/pointfreeco/swift-composable-architecture/discussions/1264
.
Associated Swift bug report, in any case it comes from Swift itself: https://github.com/apple/swift/issues/60550
.
macOS 13.0 beta 5 (22A5321d) Xcode 4.0 beta 5 (14A5294e)
For some reason, I can't attach the zip archive of the package to this gist. It can be retrieved here or here.