Commit Graph

2381 Commits

Author SHA1 Message Date
Doug Gregor
2b9ca315fe [Concurrency] Remove asyncHandler attribute.
The `asyncHandler` attribute turned out to be the wrong solution
to the problem of creating a sync->async bridge. Remove it.
2021-05-13 17:01:39 -07:00
Alexis Laferrière
7487c12d05 Merge pull request #37269 from xymus/test-macro
[Concurrency] Define and use the SwiftStdlib 5.5 availability macro in tests
2021-05-10 10:46:53 -07:00
Doug Gregor
220e29d674 Reinstate "async let", with "spawn let" as an alias. 2021-05-07 00:13:56 -07:00
Doug Gregor
06dc77ddf3 Revert "[Concurrency] Resyntax 'async let' as 'spawn let'."
This reverts commit 41f42fabbf.
2021-05-06 22:18:36 -07:00
Alexis Laferrière
3310a55682 [Test] Use the SwiftStdlib 5.5 macro in Concurrency tests 2021-05-06 13:48:49 -07:00
kaar3k@gmail.com
69a812333c [SR-14135]Updating diagnostic message for convenience init in struct 2021-05-05 19:57:53 +05:30
Kavon Farvardin
e17e09c294 Enable effectful properties (SE-310) by default.
1. Removes gating on -enable-experimental-concurrency.
2. Updates eff. prop tests to remove experimental flag,
   and also adjusts some tests slightly to avoid things
   that are still behind that flag.
2021-05-03 14:10:44 -07:00
John McCall
cc2863c136 Merge pull request #36878 from rjmccall/custom-executors
Introduce basic support for custom executors
2021-04-30 13:54:02 -04:00
John McCall
186c53000d Introduce basic support for custom executors.
- Introduce an UnownedSerialExecutor type into the concurrency library.
- Create a SerialExecutor protocol which allows an executor type to
  change how it executes jobs.
- Add an unownedExecutor requirement to the Actor protocol.
- Change the ABI for ExecutorRef so that it stores a SerialExecutor
  witness table pointer in the implementation field.  This effectively
  makes ExecutorRef an `unowned(unsafe) SerialExecutor`, except that
  default actors are represented without a witness table pointer (just
  a bit-pattern).
- Synthesize the unownedExecutor method for default actors (i.e. actors
  that don't provide an unownedExecutor property).
- Make synthesized unownedExecutor properties `final`, and give them
  a semantics attribute specifying that they're for default actors.
- Split `Builtin.buildSerialExecutorRef` into a few more precise
  builtins.  We're not using the main-actor one yet, though.

Pitch thread:
  https://forums.swift.org/t/support-custom-executors-in-swift-concurrency/44425
2021-04-30 03:11:56 -04:00
Doug Gregor
1fa2d1656d [Concurrency] Don't complain about interpolation variables being mutated.
Implicitly-generated interpolation variables are mutated within the
autoclosures created by a `spawn let`. Don't complain about them being
concurrently accessed, because they aren't.

Fixes rdar://76020473.
2021-04-29 23:32:56 -07:00
Doug Gregor
41f42fabbf [Concurrency] Resyntax 'async let' as 'spawn let'.
This helps track the proposal.
2021-04-29 23:28:16 -07:00
Doug Gregor
a2cdef73a6 [SE-0306] Enable actors by default.
With the acceptance of SE-0306, enable actors by default and add a
ChangeLog entry.

Tracked by rdar://77223763.
2021-04-27 12:25:41 -07:00
Evan Wilde
d0d9bef703 Merge pull request #37056 from etcwilde/ewilde/fix-await-fixits
[Concurrency] Fix await fix-it placement
2021-04-26 08:12:50 -07:00
Doug Gregor
02821fd0f4 Merge pull request #37053 from DougGregor/disable-actor-inheritance 2021-04-24 22:31:09 -07:00
Evan Wilde
3da0a540eb Update tests
This patch updates all the tests to accept the new error messages.
*Gack* so many things needed cleaning up.
2021-04-24 07:51:18 -07:00
Doug Gregor
b88e678694 [SE-0306] Disable actor inheritance.
Actor inheritance was removed in the second revision of SE-0306. Remove
the ability to inherit actors.

Note that this doesn't fully eliminate all vestigates of inheritance
from actors. There are simplifications that need to be performed
still, e.g., there's no need to distinguish
designated/convenience/required initializers. That will follow.
2021-04-23 15:08:57 -07:00
Strieker
4e2b67cbae [NFC] Resolved merge conflict in CSSimplify.cpp after making changes to improve error handling for composed wrapped value mismatches 2021-04-22 11:49:21 -07:00
Strieker
b732319538 [NFC] Fixed and added property wrapper tests. 2021-04-22 11:31:41 -07:00
Kavon Farvardin
be9890815a update existing regression tests after small diagnostics refactor
new phrasing in the error messages to match up with
other phrasing used in messages.
2021-04-15 10:08:58 -07:00
Slava Pestov
228112f4bc Merge pull request #36737 from slavapestov/nil-default-arg-rethrows
Sema: Teach rethrows checking about 'nil' default arguments
2021-04-04 11:48:04 -04:00
Slava Pestov
f190e51f8d GSB: Diagnose redundant superclass requirements using the redundant requirement graph 2021-04-03 22:33:14 -04:00
Slava Pestov
f1831fb16a Sema: Teach rethrows checking about 'nil' default arguments
In Swift 5.4, this worked:

  func foo(_: (() throws -> ())? = nil) rethrows {}
  foo()  // no 'try' needed

However, this was an accident, because this was also accepted:

  func foo(_: (() throws -> ())? = { throw ... }) rethrows {}
  foo()  // 'try' *should* be required here

This got fixed at some point recently, but since people rely on the
old case working for 'nil', let's add back a check for a 'nil'
default parameter.

Fixes rdar://problem/76169080.
2021-04-02 23:56:59 -04:00
Doug Gregor
f8cb209c5a Only diagnose references to globals under -warn-concurrency.
Fixes rdar://75996222.
2021-04-02 00:06:48 -07:00
Mike Ash
6d2fc9e9bd Add @availability to some concurrency tests that were missing it. 2021-04-01 15:34:33 -04:00
Saleem Abdulrasool
c03c3b266d Merge pull request #36592 from drexin/wip-remove-codable-enum-flag
[Frontend] Remove enable-experimental-enum-codable-derivation flag
2021-03-31 15:04:32 -07:00
Holly Borla
71cd85c42b Merge pull request #36611 from hborla/property-wrapper-csgen-crash
[ConstraintSystem] Fix a property wrapper constraint generation crash.
2021-03-29 10:58:16 -07:00
Slava Pestov
986d033702 Merge pull request #36615 from slavapestov/redundant-layout-constraints
Diagnose redundant and conflicting layout requirements using the explicit requirement graph
2021-03-27 18:40:00 -04:00
David Zarzycki
8a0d68bbae [testing] Add missing REQUIRES: concurrency 2021-03-27 06:10:28 -04:00
Slava Pestov
1d9b202719 GSB: Fix inconsistent 'redundant conformance' diagnostic 2021-03-27 00:35:19 -04:00
Slava Pestov
299ff02684 GSB: Diagnose redundant layout requirements using the redundant requirement graph 2021-03-27 00:35:19 -04:00
Holly Borla
d23246568c [ConstraintSystem] Fix a property wrapper constraint generation crash. 2021-03-26 15:36:34 -07:00
Kavon Farvardin
7585f46085 [test] coverage for global effectful props 2021-03-26 07:58:28 -07:00
Kavon Farvardin
e94344593c [test] effectful properties + property wrappers
They're currently incompatible, but it should be
possible to enable this, with some care taken to
ensure that effectful wrappers are composed
correctly.
2021-03-26 07:58:28 -07:00
Kavon Farvardin
e418403fc6 [test] eff. prop + class inheritance & overrides 2021-03-26 07:58:28 -07:00
Kavon Farvardin
47ea602668 [test] eff. prop + protocol conformance, composition & inheritance 2021-03-26 07:58:28 -07:00
Doug Gregor
c76dac7155 Banish @asyncHandler to a hidden flag.
We don't want @asyncHandler to be part of the concurrency model, so put
it behind a different flag.
2021-03-25 16:45:21 -07:00
Dario Rexin
e42cf5b154 [Frontend] Remove enable-experimental-enum-codable-derivation flag
SE-295 has been accepted, so we don't need to hide the feature behind a flag anymore.
2021-03-25 15:26:21 -07:00
Evan Wilde
d572c75d21 NFC: Remove 'actor class' from diagnostics 2021-03-23 15:06:41 -07:00
Doug Gregor
508274c90e Update "non-concurrent-value" diagnostics to say "non-sendable" 2021-03-18 23:14:47 -07:00
Doug Gregor
9579390024 [SE-0304] Rename ConcurrentValue to Sendable 2021-03-18 22:48:20 -07:00
Kenneth Chew
289840b42d Add test case for diagnostic 'because_rethrows_default_argument_throws'
The first test case added ideally shouldn't have any expected error or diagnostic.
However, due to SR-1534, there is an error emitted here. Thus, an expected error is
used here to show the compiler's behavior today.

If SR-1534 is fixed in the future, the first test case should no longer have any
expected error nor an expected note. However, the second test case should still be
left alone.

Addresses SR-14270
2021-03-17 13:39:22 -04:00
Pavel Yaskevich
2e0bda57e9 Merge pull request #35933 from mininny/add-diagnostics-for-invalid-power-operator
[Diagnostics] Add diagnostic when using nonexistent '**' operator
2021-03-15 00:34:02 -07:00
Minhyuk Kim
56f4a7bb7c Add unexisting_power_operator diagnostic when using unexisting ** operator in swift 2021-03-14 21:17:16 +09:00
Anthony Latsis
b7fcd2f434 Diag: Reword some errors for invalid usage of covariant Self 2021-03-12 15:54:21 +03:00
Doug Gregor
2f2c194272 Adopt 'nonisolated' in many tests, make sure its a modifier 2021-03-07 11:37:57 -08:00
Doug Gregor
f56ba59605 Add 'nonisolated' modifier as the preferred spelling for @actorIndependent 2021-03-07 10:57:35 -08:00
Doug Gregor
6efaf7ac0f Introduce -warn-concurrency flag to warn about concurrency issues.
To help support incremental adoption of the concurrency model, a number
of concurrency-related diagnostics are enabled only in "new" code that
takes advantage of concurrency features---async, @concurrent functions,
actors, etc. This warning flag opts into additional warnings that better
approximate the eventual concurrency model, and which will become
errors a future Swift version, allowing one to both experiment with
the full concurrency model and also properly prepare for it.
2021-03-05 10:58:54 -08:00
Doug Gregor
47b0abfda4 Remove Actor.enqueue(partialTask:) and all its magic.
The backs out of some early decisions we made about actor layout
that we don't need. Custom actors will use a different approach.

This should suffice for the remainder of rdar://70146827.
2021-03-04 22:49:10 -08:00
Doug Gregor
a8beb7bc94 Merge pull request #36246 from DougGregor/se-0302-minor-tweaks 2021-03-03 12:59:10 -08:00
Doug Gregor
09121d78d6 Fix more tests 2021-03-03 08:54:08 -08:00