Looks like with Xcode 16, some errors have started coming in like this, where the same file:line:col
of some decl will be reused over and over for multiple different errors within that decl, such as a class decl or an extension, or even a typealias.
In the below excerpt, all errors point to MyProject/AppDependencies.swift:1819:5
, even though they reference properties in other areas:
MyProject/AppDependencies.swift:1819:5: error: property 'networkProgressSubject' must be declared public because it matches a requirement in public protocol 'NetworkProgressSubjectDependency'
1222 |
1223 | // swiftlint:disable:next private_subject
1224 | var networkProgressSubject: PassthroughSubject<NetworkProgress, Never> {
| `- note: mark the property as 'public' to satisfy the requirement
1225 | <redacted>
1226 | }
:
1817 |
1818 | #if INTERNAL
1819 | extension AppDependencies: _AllDependencies &
| `- error: property 'networkProgressSubject' must be declared public because it matches a requirement in public protocol 'NetworkProgressSubjectDependency'
1820 | Foo &
1821 | Bar &
MyProject/AppDependencies.swift:1819:5: error: property 'xyzDataManager' must be declared public because it matches a requirement in public protocol 'XYZDataDependency'
935 | }
936 |
937 | var xyzDataManager: XYZDataManager {
| `- note: mark the property as 'public' to satisfy the requirement
938 | <redacted>
939 | }
:
1817 |
1818 | #if INTERNAL
1819 | extension AppDependencies: _AllDependencies &
| `- error: property 'xyzDataManager' must be declared public because it matches a requirement in public protocol 'XYZDataDependency'
1820 | Foo &
1821 | Bar &
MyProject/AppDependencies.swift:1819:5: error: property 'someService' must be declared public because it matches a requirement in public protocol 'SomeServiceDependency'
1079 | }
1080 |
1081 | var someService: SomeService {
| `- note: mark the property as 'public' to satisfy the requirement
1082 | <redacted>
1083 | }
:
1817 |
1818 | #if INTERNAL
1819 | extension AppDependencies: _AllDependencies &
| `- error: property 'someService' must be declared public because it matches a requirement in public protocol 'SomeServiceDependency'
1820 | Foo &
1821 | Bar &
MyProject/AppDependencies.swift:1819:5: error: property 'somePublisher' must be declared public because it matches a requirement in public protocol 'SomeDependency'
1234 | }
1235 |
1236 | var somePublisher: AnyPublisher<Bool, Never> {
| `- note: mark the property as 'public' to satisfy the requirement
1237 | <redacted>
1238 | }
:
1817 |
1818 | #if INTERNAL
1819 | extension AppDependencies: _AllDependencies &
| `- error: property 'somePublisher' must be declared public because it matches a requirement in public protocol 'SomeDependency'
1820 | Foo &
1821 | Bar &
In this particular example, what's happening is we are conforming a type to multiple different protocols all in one go like this:
1819 | extension AppDependencies: _AllDependencies &
1820 | Foo &
1821 | Bar &
and the errors reference the conformance, but not the properties/methods that need to be updated to fix the conformance.
If this is not new, then, well, idk how our devex team hasn't come across this before... I haven't either. This is really bad though, because it makes a lot of error-parsing tooling only pick up the last error at that source location:
Ideally, each of these errors would point to the exact property that needs to be marked public. That could be done many ways, i.e. the enclosing decl could still be referenced as another error, or a note, etc. But the actual problem needs to be pointed to by the error, not just the enclosing decl.