Commit Graph

17 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
Allan Shortlidge
5bdd952792 Tests: More test coverage in objc_async_conformance.swift
Add regression tests for rdar://125945942.
2024-04-09 15:20:18 -07:00
Allan Shortlidge
8a27b681b0 Tests: Increase test coverage in objc_async_conformance.swift.
Add regression tests for rdar://125935350.
2024-04-09 15:20:18 -07:00
Holly Borla
9ba481ad53 [Diagnostics] Clarify the wording of error_in_future_swift_version. 2024-03-01 12:05:51 -08:00
Allan Shortlidge
e057b686a5 Sema: Effectively revert https://github.com/apple/swift/pull/70569.
The fix caused a source break that is now captured as an additional test case
in `objc_async_conformance.swift`.

Resolves rdar://121527977
2024-02-20 22:54:33 -08:00
Becca Royal-Gordon
dc4162fddb Allow same-selector async/completion requirements
An @objc protocol can now explicitly declare both the `async` and completion handler signatures of a method as long as the completion handler one is marked with `@available(*, renamed:)`.

This is not yet handled correctly in PrintAsClang.
2022-06-16 14:06:47 -07:00
Josh Soref
3d488f685e Spelling clangimporter (#42464)
* spelling: enumerators

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: handler

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: heuristic

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: implicitly

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: included

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: instantiate

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: integer

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: nested

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: otherthing

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: overridden

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: simultaneously

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: special

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: typecheck

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: unfortunately

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: unknown

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: version

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
2022-04-21 09:31:12 -07:00
Doug Gregor
eeeea49764 Remove -enable-experimental-concurrency almost everywhere. 2021-07-26 21:24:43 -07:00
Doug Gregor
1e2012d816 Disable availability checking in tests that use concurrency 2021-07-20 12:46:26 -07:00
Doug Gregor
92dd8672f2 [Amendment] SE-0296: Allow overloads that differ only in async
Implement the amendment currently under review that allows overloads
that differ only in async vs. non-async.

Implements rdar://79788345.
2021-06-25 11:22:13 -07:00
Kavon Farvardin
e321955929 more test coverage for ObjC async conformance
This adds regression test coverage for a
situation related to rdar://73326085, but
was just recently fixed in:

https://github.com/apple/swift/pull/35719
2021-02-09 13:29:36 -08:00
Kavon Farvardin
739617c291 objc protocol requirements with same selector need only one witness
This really only happens when the ClangImporter imports an ObjC
protocol that has an async-looking method, which yields two
requirements in the protocol. Only one of these requirements
will be witnessed.

fixes rdar://73326224
2021-02-08 17:50:36 -08:00
Kavon Farvardin
ea8c27351b Merge pull request #35764 from kavon/diagnostics-bermuda-triangle
Ensure that delayed diagnostics in protocol conformance checking are emitted.
2021-02-05 09:58:04 -08:00
Kavon Farvardin
f60f5007f1 add expectation for "does not conform to protocol" error diag
this error was being generated, but previously not emitted
2021-02-04 13:31:33 -08:00
Doug Gregor
d12b39097d [Actor isolation] Fix a crash involving global actors, ObjC, and conformances
Fixes rdar://73801223
2021-02-02 13:06:36 -08:00
Kavon Farvardin
ff54f3b834 witnesses for an async ObjC protocol requirement cannot be sync
While a Swift protocol can have its async requirements satisfied
by a sync witness, this is not the case for ObjC protocols because
it is not just a calling convention difference.

Because every async ObjC function requirement in the protocol also
has a sibling that is sync, a sync witness might be trying
to conform to the sync version that takes a completion handler.

Without this change, we were seeing an issue where we would
consider both the async and sync versions of an ObjC requirement,
and accidentially choose the async version when the witness was
sync, and then raise an error about the typechecker's mistake.

Instead of raising an error, this change removes the ability for
the typechecker to even consider the errornous conformance.

resolves rdar://73326234
2021-02-01 17:18:11 -08:00
Doug Gregor
83e8588977 [AST Verifier] Handle ObjC requirements satisfied by alternative requirements.
With 'async' imports of Objective-C protocol requirements, a single
Objective-C method will produce two different requirements in the
protocol, with the same Objective-C selector. Teach the AST verifier
that it is sufficient for just one of the requirements with that
Objective-C selector to be satisfied by a witness.

Fixes rdar://72742910.
2021-01-25 15:20:29 -08:00