Commit Graph

5 Commits

Author SHA1 Message Date
Alex Hoppen
66104395d7 [Sema/SourceKit] Emit same diagnostics for missing protocol requirements on the command line and in SourceKit
Some editors use diagnostics from SourceKit to replace build issues. This causes issues if the diagnostics from SourceKit are formatted differently than the build issues. Make sure they are rendered the same way, removing most uses of `DiagnosticsEditorMode`.

To do so, always emit the `add stubs for conformance` note (which previously was only emitted in editor mode) and remove all `; add <something>` suffixes from notes that state which requirements are missing.

rdar://129283608
2024-08-07 14:01:30 -07:00
Michael Gottesman
16d0194d77 [sending] Improve the sending mismatch errors and make them warnings when not in swift 6.
This will ensure that we do not break anyone who has adopted APIs like
CheckedContinuation.resume that now have sending parameters.

An example of where this can come up is shown by the ProcessType in SwiftToolsCore:

```swift
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
@discardableResult
public func waitUntilExit() async throws -> ProcessResult {
    try await withCheckedThrowingContinuation { continuation in
        DispatchQueue.processConcurrent.async {
            self.waitUntilExit(continuation.resume(with:))
        }
    }
}
```

This fails to compile since self.waitUntilExit doesn't expect a function that
takes a sending parameter. We want to give people time to fix such issues.
2024-06-13 22:23:08 -07:00
Michael Gottesman
ba6c8afd67 Simplify test to only use target-typecheck-verify-swift since we are testing typecheck errors. 2024-06-12 16:13:05 -07:00
Michael Gottesman
3c166b5d96 [sending] Implement non-protocol function subtyping rules.
rdar://127675288
2024-06-12 16:13:05 -07:00
Michael Gottesman
1c9b1780f6 [sending] Do not let protocol function reqs with a sending result be witnessed by a function without a sending result.
This is important since the witness is not promising to return a disconnected
value and the caller of the requirement is going to accept that.

rdar://127675288
2024-06-12 16:13:05 -07:00