Commit Graph

1081 Commits

Author SHA1 Message Date
Slava Pestov
5db2bf5df3 Merge pull request #40543 from slavapestov/rqm-type-witness-minimization
RequirementMachine: Implement minimization for concrete nested type requirements
2021-12-14 14:32:08 -05:00
Arnold Schwaighofer
8631376505 Merge pull request #40486 from aschwaighofer/make_objc_protocol_metadata_weak_hidden
Make Objective-C protocol metadata weak hidden
2021-12-14 07:44:02 -08:00
Slava Pestov
2441e688e4 Pass -requirement-machine-protocol-signatures=on in a few tests where the GSB got it wrong
These fail with -requirement-machine-protocol-signatures=verify because
the GSB produces incorrect output. Enable the requirement machine
unconditionally for these tests, bypassing verification.

A new file test/Generics/same_type_requirements_in_protocol.swift
contains reduced versions of all of the failures, with FileCheck
used to confirm the exact requirement signature output.
2021-12-14 02:17:51 -05:00
Konrad `ktoso` Malawski
cee89ec541 [Distributed] DistributedActorSystem renaming and redesign (#40387)
* [Distributed] towards DistributedActorSystem; synthesize the id earlier, since Identifiable.id

* Fix execute signature to what Pavel is working with

* funcs are ok in sil

* fixed lifetime of id in inits

* fix distributed_actor_deinit

* distributed_actor_local

* update more tests

fixing tests

fix TBD test

fix Serialization/distributed

fix irgen test

Fix null pointer crashes

* prevent issues with null func ptrs and fix Distributed prorotocol test

* fix deinit sil test
2021-12-13 11:29:25 +09:00
Arnold Schwaighofer
7fd49f1697 IRGen: Default to weak hidden instead of internal linkage for objc metadata
This extends #39944 to apply to more objc metadata.

rdar://85037490
2021-12-10 07:26:00 -08:00
Arnold Schwaighofer
fab112fb1e Revert "Merge pull request #40342 from aschwaighofer/make_objc_metadata_weak_hidden"
This reverts commit 4323d2fa26, reversing
changes made to 451b902cd5.

This caused linking errors on the swift source compat suite in the
Sourcery project.

rdar://86256970
2021-12-09 08:01:27 -08:00
Arnold Schwaighofer
f8d009e05f IRGen: Default to weak hidden instead of internal linkage for objc metadata
This extends #39944 to apply to more objc metadata.

rdar://85037490
2021-12-02 12:56:50 -08:00
Doug Gregor
7e375f7df6 Use new Sendable staging infrastructure consistently.
The main effect of this change is that diagnostics about Sendable
conformances now follow the same minimal/full logic used for other
Sendable diagnostics, rather than having their own separate
computation.
2021-11-30 18:22:53 -08:00
Konrad `ktoso` Malawski
f58b133a84 [Distributed] adjust conformance error messages a bit 2021-11-15 11:11:55 +09:00
Slava Pestov
ce77849aff Merge pull request #40108 from AnthonyLatsis/sr15460
AssociatedTypeInference: Fix regression introduced in 1cf9622
2021-11-09 21:04:53 -05:00
Anthony Latsis
3282b86d76 AssociatedTypeInference: Fix regression introduced in 1cf9622 2021-11-09 18:32:27 +03:00
Doug Gregor
293e31658c Prefer witnesses with no difference effects to ones that have fewer effects.
One can overload on async vs. non-async, and the constraint solver has a
preference rule based on context. Extend that preference rule to
witness matching, so we prefer a witness that exactly matches the
effects of the requirement to one that has fewer effects.

Fixes rdar://84034057.
2021-11-08 16:36:39 -08:00
Konrad `ktoso` Malawski
61a1bc2a6c [Distributed] remove public default AnyActorTransport alias
The previously set public AnyActorTransport was a temporary thing,
and instead we want to set this in every module that declares such
actors.
2021-11-04 15:54:56 +09:00
Anthony Latsis
dd984b14f7 Merge pull request #35860 from AnthonyLatsis/enum-witness-no-accessor-req
Sema: Fix enum case witness crash when the requirement does not specify accessors
2021-11-03 07:50:41 +03:00
Anthony Latsis
fb8c6bd828 Sema: Correctly handle static 'let's in VarDecl::isSettable 2021-11-02 14:24:10 +03:00
Anthony Latsis
ab9608bf37 Sema: Fix enum case witness crash when 'var' requirement has no parsed setter 2021-11-02 14:24:05 +03:00
Konrad `ktoso` Malawski
841bd4260a [Concurrency][Distributed] Handle more cases of isolation, protocols, better errors (#39895)
* [Distributed] Handle more cases of isolation, protocols, better errors/notes

* [Concurrency] Actor sync funcs can conform to async protocol reqs

* [Distributed] Offer fixit to add DistributedActor to type when dist func is encountered

* [Distributed] Witness protocol reqs in dist actor protocol extensions

* try to address availability issues
2021-11-01 19:13:33 +09:00
Karoy Lorentey
47956908b7 [Concurrency] SwiftStdlib 5.5 ⟹ SwiftStdlib 5.1 (usages)
The concurrency runtime now deploys back to macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, which corresponds to the 5.1 release of the stdlib.

Adjust macro usages accordingly.
2021-10-28 14:36:36 -07:00
Holly Borla
ba2187aea8 [Diagnostics] Add the opaque type fix-it for failed associated type
inference from the element type of a subscript value witness.
2021-10-27 10:54:35 -07:00
Holly Borla
c75178e56f [Diagnostics] Add a fix-it to insert 'some' when associated type inference
failed because existential types can't conform to protocols.
2021-10-26 22:29:09 -07:00
Konrad `ktoso` Malawski
19ab0a18ad [Codable] Improve diagnosis of empty enum Codable synthesis failure (#39795)
* [Codable] Improve diagnosis of empty enum Codable synthesis failure

* a few more tests got extra warnings now
2021-10-18 11:57:50 +09:00
Becca Royal-Gordon
354f3470a0 Add @_nonSendable decl attribute
This attribute creates an unavailable extension with a `Sendable` conformance so that the type is explicity marked as not being `Sendable`.

We also fully suppress diagnostics about unavailable Sendable conformances in Swift 5 mode code. (This is not fully developed yet—it should return to being a warning in concurrent contexts.)

The behavior when a @_nonSendable and a Sendable conformance are both on the same type is also not right yet.
2021-10-14 12:14:46 -07:00
Konrad `ktoso` Malawski
e133dadc0f [Distributed] Implement isolation check aware of Task/Task.detached etc 2021-10-01 12:20:41 +09:00
Becca Royal-Gordon
84fad66daf Merge pull request #39334 from beccadax/xfail-83066987
XFAIL decl/protocol/protocols_with_self_or_assoc_reqs_executable.swift
2021-09-16 15:37:30 -07:00
Becca Royal-Gordon
6161614414 XFAIL decl/protocol/protocols_with_self_or_assoc_reqs_executable.swift
rdar://83066987
2021-09-15 16:49:48 -07:00
Slava Pestov
c8f3476f19 Don't use back-quotes in diagnostics 2021-09-15 18:38:34 -04:00
Slava Pestov
4a019f0662 Sema: Improved recovery from circular generic signature construction
Returning a null GenericSignature is not the right way to break a cycle,
because then callers have to be careful to handle the case of a null
GenericSignature together with a non-null GenericParamList, for example
in applyGenericArguments().

An even worse problem can occur when a GenericSignatureRequest for a
nested generic declaration requests the signature of the parent context,
which hits a cycle. In this case, we would build a signature where
the first generic parameter did not have depth 0.

This makes the requirement machine upset, so this patch implements a new
strategy to break such cycles. Instead of returning a null
GenericSignature, we build a signature with the correct generic
parameters, but no requirements. The generic parameters can be computed
just by traversing GenericParamLists, which does not trigger more
GenericSignatureRequests, so this should be safe.
2021-09-04 00:13:03 -04:00
Anthony Latsis
b81db7a4fc Devirtualize: Skip requirements with covariant 'Self' nested inside a collection
The devirtualizer does not support handling these yet, which wasn't anticipated in #34140
2021-09-03 07:01:49 +03:00
Slava Pestov
5790c70fb6 Sema: Add recursion guard to AssociatedTypeInference::computeFixedTypeWitness() 2021-09-02 23:02:52 -04:00
Anthony Latsis
06b2f556f7 Hack: Avoid devirtualizing calls to requirements with covariant Self inside collections, since the optimizer doesn't know how to handle them yet 2021-08-31 19:21:27 +03:00
Anthony Latsis
e49ca21bf0 Sema: Check for invalid reference *before* checking for unsupported existential member access 2021-08-31 19:21:27 +03:00
Anthony Latsis
64b8f61b13 AST: Account for protocol compositions and nested types in «findProtocolSelfReferences» 2021-08-31 19:21:27 +03:00
Anthony Latsis
c2e5d04669 Test: Find better locations for some updated tests 2021-08-31 19:21:26 +03:00
Suyash Srijan
396087d0d4 [Test] Update existing tests 2021-08-31 19:21:26 +03:00
Suyash Srijan
4cc1506c27 [Test] Add additional tests for new behavior 2021-08-31 19:21:22 +03:00
Kavon Farvardin
bc8657b0e0 Merge pull request #39067 from kavon/revert-unlock-existential
Revert "Merge pull request #33767 ..."
2021-08-26 16:52:23 -07:00
swift-ci
4681d41286 Merge pull request #39046 from ktoso/wip-derive-style 2021-08-26 16:46:46 -07:00
Kavon Farvardin
c0607b345f Revert "Merge pull request #33767 from theblixguy/chore/remove-self-or-associated-type-diagnostic"
The following regression test added for this feature is not passing:

Swift(linux-x86_64) :: decl/protocol/protocols_with_self_or_assoc_reqs_executable.swift

with a compiler crash happening during SILFunctionTransform "Devirtualizer".

Reverting to unblock CI.

This reverts commit f96057e260, reversing
changes made to 3fc18f3603.
2021-08-26 16:46:42 -07:00
Konrad `ktoso` Malawski
f96057e260 Merge pull request #33767 from theblixguy/chore/remove-self-or-associated-type-diagnostic
SE-0309: Unlock existential types for all protocols
2021-08-27 06:09:47 +09:00
Konrad `ktoso` Malawski
fa1b4b2fec fix test: decl/protocol/special/DistributedActor.swift 2021-08-26 18:27:11 +09:00
Doug Gregor
965e5bf9c2 More test updates for Swift 6 and Sendable 2021-08-18 07:03:54 -07:00
Doug Gregor
cafa2523d9 Merge pull request #38742 from beccadax/warring-triad
Start testing Swift 6 mode changes
2021-08-18 05:52:13 -07:00
Doug Gregor
68418cd660 [SE-0302] Crank up Sendable to also diagnose in-module missing conformances.
Extend the diagnostics for `Sendable` conformances to always diagnose
missing `Sendable` conformances for nominal types that are within the
same module. The intuition here is that if the type is in the same
module, it can be updated and evaluated at the same time as code
requiring the `Sendable` conformance is introduced.

Another part of rdar://78269348.
2021-08-16 14:01:42 -07:00
Anthony Latsis
9a522205ee Sema: Check for invalid reference *before* checking for unsupported existential member access 2021-08-16 18:30:26 +03:00
Anthony Latsis
655a81cbe6 AST: Account for protocol compositions and nested types in «findProtocolSelfReferences» 2021-08-16 18:30:26 +03:00
Anthony Latsis
749a0ae853 Test: Find better locations for some updated tests 2021-08-16 18:30:26 +03:00
Suyash Srijan
7834120a87 [Test] Update existing tests 2021-08-16 18:30:26 +03:00
Suyash Srijan
0daf6822b8 [Test] Add additional tests for new behavior 2021-08-16 18:30:26 +03:00
Doug Gregor
d54abea922 Implement customizable Sendable conformance diagnostics.
Rework Sendable checking to be completely based on "missing"
conformances, so that we can individually diagnose missing Sendable
conformances based on both the module in which the conformance check
happened as well as where the type was declared. The basic rules here
are to only diagnose if either the module where the non-Sendable type
was declared or the module where it was checked was compiled with a
mode that consistently diagnoses `Sendable`, either by virtue of
being Swift 6 or because `-warn-concurrency` was provided on the
command line. And have that diagnostic be an error in Swift 6 or
warning in Swift 5.x.

There is much tuning to be done here.
2021-08-14 08:13:10 -07:00
Konrad `ktoso` Malawski
d5b7bb3572 [Distributed] diagnose missing module 2021-08-12 14:04:51 +09:00