swift
swift copied to clipboard
[6.0 🍒][Dependency Scanning] Emit diagnostics on scan query failure during initialization or cycle detection
-
Explanation: https://github.com/swiftlang/swift/pull/71907 was an important fix that moved the diagnostics collected during dependency scanning to be associated with an individual scan query, instead of scanner overall. This meant that multiple concurrent scans launched by
libSwiftScan
clients would have isolated diagnostic domains. However, upon query failure, either when constructing a scanning instance (e.g. un-recognized scanner argument) or upon encountering and diagnosing a dependency cycle, the new per-scan diagnostic state was lost and the scanner query returned an error. This means that scanner clients (SwiftDriver) would no longer see diagnostics from such failures. With this change, on dependency scan query failure, we ensure any diagnostics that the compiler has accumulated along the way are still produced to the client, by constructing a hollow output object that contains just enough state to also carry the diagnostic error payload. -
Scope: This change primarily affects Explicit Module Builds (not default, opt-in with
-explicit-module-build
) which were already going to fail. On such failures the client would simply get an error from the dependency scanning query without additional context, and will now produce scanner-emitted diagnostics. -
Risk: Low. Due to the scope of this change being largely limited to compilation tasks which were already going to fail, and only on opt-in Explicit Module Builds
-
Original PR: https://github.com/swiftlang/swift/pull/75111
-
Issue/Radar: rdar://130897498
-
Reviewed By: @cachemeifyoucan