profile
viewpoint

DougGregor/swift-evolution 15

This maintains proposals for changes and user-visible enhancements to the Swift Programming Language.

DougGregor/swift 6

The Swift Programming Language

DougGregor/swift-concurrency-objc 6

Swift Concurrency Translation of Objective-C APIs for iOS, macOS, tvOS, and watchOS

airspeedswift/swift 2

The Swift Programming Language

DougGregor/clang 0

Mirror of official clang git repository located at http://llvm.org/git/clang. Updated every five minutes.

DougGregor/swift-corelibs-libdispatch 0

The libdispatch Project, (a.k.a. Grand Central Dispatch), for concurrency on multicore hardware

DougGregor/swift-corelibs-xctest 0

The XCTest Project, A Swift core library for providing unit test support

push eventDougGregor/swift-evolution

Konrad `ktoso` Malawski

commit sha 16470ad4162ae13d5d0681a35495078fefbc663b

wip actors

view details

Konrad `ktoso` Malawski

commit sha f9a3175d330309da186f153c24b0932214e08248

rewording

view details

Doug Gregor

commit sha 2e33d4c70b08c90847cebedc304426a1a6adc3f5

Merge pull request #9 from ktoso/wip-actors [Feedback] Actors proposal: feedback, rewordings, etc

view details

push time in 2 hours

PR merged DougGregor/swift-evolution

[Feedback] Actors proposal: feedback, rewordings, etc

I've been poking at this a bit trying to improve the wording / preciseness in a few spots...

In the next sections I guess we'll have to dive into executors as well or are we not going to deep dive there yet? There's still some open unknowns about that piece of the design hmm...

+38 -19

0 comment

1 changed file

ktoso

pr closed time in 2 hours

Pull request review commentDougGregor/swift-evolution

[Feedback] Actors proposal: feedback, rewordings, etc

 extension BankAccount {  If `BankAccount` were a normal class, the `transfer(amount:to:)` method would be well-formed, but would be subject to data races in concurrent code without an external locking mechanism. With actor classes, the attempt to reference `other.balance` triggers a compiler error, because `balance` may only be referenced on `self`. -As noted in the error message, `balance` is *actor-isolated*, meaning that it can only be accessed from within the specific actor it is tied to. In this case, it's the instance of `BankAccount` referenced by `self`. Stored properties, computed properties, subscripts, and synchronous instance methods (like `transfer(amount:to:)`) in an actor class are all actor-isolated by default.+As noted in the error message, `balance` is *actor-isolated*, meaning that it can only be accessed from within the specific actor it is tied to or "isolated by". In this case, it's the instance of `BankAccount` referenced by `self`. Stored properties, computed properties, subscripts, and synchronous instance methods (like `transfer(amount:to:)`) in an actor class are all actor-isolated by default.  On the other hand, the reference to `other.ownerName` is allowed, because `ownerName` is immutable (defined by `let`). Once initialized, it is never written, so there can be no data races in accessing it. `ownerName` is called *actor-independent*, because it can be freely used from any actor. Constants introduced with `let` are actor-independent by default; there is also an attribute `@actorIndependent` (described in a later section) to specify that a particular declaration is actor-independent. -Actor-isolation checking, as shown above, ensures that code outside the actor does not interfere with the actor's mutable state. Each actor instance also has its own internal *queue* (like a [`DispatchQueue`](https://developer.apple.com/documentation/dispatch/dispatchqueue)) that ensures that only a single thread is executing on a given actor at any point. Therefore, even calling a method on an actor instance requires synchronization through the queue. For example, if we wanted to call a method `accumulateInterest(rate: Double, time: Double)` on a given bank account `account`, that call would need to be placed on the queue to be executed when no other code is executing on `account`.+> NOTE: The careful reader may here be alerted, that one may store a mutable reference type based object in a `let` property in which case mutating it would be unsafe, under the rules discussed so far. We will discuss in a future section how we will resolve these situations.

We'll definitely talk about the issue here, although I don't know that we'll go into a lot of details about unique/actor-local/etc. because those are "future things" not "this proposal." I absolutely need to write a section on this as part of the proposed design.

ktoso

comment created time in 3 hours

Pull request review commentDougGregor/swift-evolution

[Feedback] Actors proposal: feedback, rewordings, etc

 Such types can then be used to annotate particular declarations that are isolate  ```swift @UIActor-func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {+func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) async {

It's meant to be synchronous, which means it's caller must already be on the UI thread.

ktoso

comment created time in 2 hours

Pull request review commentDougGregor/swift-evolution

[Feedback] Actors proposal: feedback, rewordings, etc

 extension BankAccount {  func accumulateMonthlyInterest(accounts: [BankAccount]) {   for account in accounts {-    account.accumulateInterestSynchronously(rate: 0.005, time: 1.0/12.0) // error: actor-isolated instance method 'accumulateInterestSynchronously(rate:time:)' can only be referenced inside the actor+    account.accumulateInterestSynchronously(rate: 0.005, time: 1.0 / 12.0) // error: actor-isolated instance method 'accumulateInterestSynchronously(rate:time:)' can only be referenced inside the actor   } } ``` -The [async/await proposal](https://github.com/DougGregor/swift-evolution/blob/async-await/proposals/nnnn-async-await.md) provides a mechanism for describing work that can be efficiently enqueued for later execution: `async` functions. We can make the `accumulateInterest(rate:time:)` instance method `async`:+It should be noted that actor isolation adds a new dimension, separate from access-control, to the decision making process whether or not one is allowed to invoke a specific function on an actor. Specifically, synchronous functions may only be invoked by the specific actor instance itself, and not even by any other instance of the same actor class. ++All interactions with an actor (other than the special cased access to constants) must be performed asynchronously (semantically one may think about this as the actor model's messaging to and from the actor). Thankfully, Swift provides a mechanism perfectly suitable for describing such operations: asynchronous functions which are explained in depth in the [async/await proposal](https://github.com/DougGregor/swift-evolution/blob/async-await/proposals/nnnn-async-await.md). We can make the `accumulateInterest(rate:time:)` instance method `async`, and thereby make it accessible to other actors (as well as non-actor code):

It's a complementary proposal rather than something already in the language, but yeah---I like this approach.

ktoso

comment created time in 2 hours

PullRequestReviewEvent
PullRequestReviewEvent

create barnchDougGregor/swift-evolution

branch : actors

created branch time in 12 hours

push eventDougGregor/swift-evolution

Doug Gregor

commit sha 6ac3eb9c305a1da220c12d946aace342d6857d1d

Address comments from Konrad, thank you!

view details

push time in 2 days

CommitCommentEvent
CommitCommentEvent
CommitCommentEvent
CommitCommentEvent
CommitCommentEvent
CommitCommentEvent

push eventDougGregor/swift-evolution

Konrad `ktoso` Malawski

commit sha 522a612ea46698207fbc2c520ee211d0641bea65

=async-await fix minor typos

view details

Doug Gregor

commit sha 694a7a18855e44dddfb7be9a0f749b4e4e4f7a9a

Merge pull request #8 from ktoso/async-await-typos =async-await fix minor typos

view details

push time in 2 days

PR merged DougGregor/swift-evolution

=async-await fix minor typos

Just some minor typos, feel free to fix them yourself rather than merging the PR -- either's fine @DougGregor 👍

+8 -8

1 comment

1 changed file

ktoso

pr closed time in 2 days

pull request commentDougGregor/swift-evolution

=async-await fix minor typos

Thank you!

ktoso

comment created time in 2 days

CommitCommentEvent
PullRequestReviewEvent

push eventDougGregor/swift-evolution

Doug Gregor

commit sha 8b1b04f475d376fa005749faa23a502a9e196ff5

Remove promise of dynamic tooling

view details

Doug Gregor

commit sha 082c08f20c68f0623b9c2b275a24847befc18898

Add `withUnsafe(Throwing)Continuation`.

view details

push time in 3 days

Pull request review commentapple/swift

[Concurrency] SIL: add hop_to_executor instruction

 initialized with the resume value, and that value is then owned by the current function. If ``await_async_continuation`` instead resumes to its ``error`` successor, then the memory remains uninitialized. +hop_to_executor+```````````````++::++  sil-instruction ::= 'hop_to_executor' sil-operand++  hop_to_executor %0 : $T++  // $T must be reference to an actor class++Ensures that all instructions, which need to run on the actor's executor+actually run on that executor.+This instruction can only be used inside an ``@async`` function.++Checks if the current executor is the one which is bound to the operand actor.+If not, begins a suspension point and enques the continuation to the executor

Typo "enques".

eeckstein

comment created time in 3 days

Pull request review commentapple/swift

[Concurrency] SIL: add hop_to_executor instruction

 initialized with the resume value, and that value is then owned by the current function. If ``await_async_continuation`` instead resumes to its ``error`` successor, then the memory remains uninitialized. +hop_to_executor+```````````````++::++  sil-instruction ::= 'hop_to_executor' sil-operand++  hop_to_executor %0 : $T++  // $T must be reference to an actor class

We might want to loosen this to operate on any type that conforms to the Actor protocol (e.g., taking an actor existential). But that can be "later", and may very well depend on us implementing the more-efficient form of existential Actors.

eeckstein

comment created time in 3 days

Pull request review commentapple/swift

[Concurrency] SIL: add hop_to_executor instruction

 class IRGenSILFunction :     llvm_unreachable("not implemented");   } +  void visitHopToExecutorInst(HopToExecutorInst *i) {+    //TODO(async)+    llvm_unreachable("not implemented");

We might want to start with this being a no-op, rather than an unreachable, so we can get further in "compiling" async code end-to-end.

eeckstein

comment created time in 3 days

Pull request review commentapple/swift

[Concurrency] SIL: add hop_to_executor instruction

 class GetAsyncContinuationAddrInst final   {} }; +/// Marks the end of the mutation of a reference counted object.

Please update the comment here.

eeckstein

comment created time in 3 days

PullRequestReviewEvent
PullRequestReviewEvent

push eventDougGregor/swift-evolution

Doug Gregor

commit sha adbd2ce9965d0cc7114f4319c80f2edf4d5e404a

Add a short section on related proposals

view details

push time in 3 days

create barnchDougGregor/swift-evolution

branch : async-await

created branch time in 3 days

push eventDougGregor/swift-concurrency-objc

Doug Gregor

commit sha e8bef4a3917dc43b524d18cc0e643393297238a5

[Concurrency] Retain text from a completion-handler selector piece.

view details

push time in 3 days

push eventapple/swift

Doug Gregor

commit sha 16104d8045d55c5b6ac2381764a07d91402f80f3

[Concurrency] Don't lose name information from completion-handler arguments. When a completion handler parameter has a selector piece that ends with "WithCompletion(Handler)", prepend the text before that suffix to the base name or previous argument label, as appropriate. This ensures that we don't lose information from the name, particularly with delegate names.

view details

Doug Gregor

commit sha b094758bd3c786c5cee66b8c241736ea3d66a2af

Merge pull request #34394 from DougGregor/concurrency-objc-name-adjustments [Concurrency] Don't lose name information from completion-handler arguments

view details

push time in 4 days

delete branch DougGregor/swift

delete branch : concurrency-objc-name-adjustments

delete time in 4 days

PR merged apple/swift

[Concurrency] Don't lose name information from completion-handler arguments

When a completion handler parameter has a selector piece that ends with "WithCompletion(Handler)", prepend the text before that suffix to the base name or previous argument label, as appropriate. This ensures that we don't lose information from the name, particularly with delegate names.

+86 -38

3 comments

8 changed files

DougGregor

pr closed time in 4 days

push eventapple/swift-evolution

Doug Gregor

commit sha 15b9660ca599fe7eb4ebf6e6473afd505a77a6a1

SE-0289: Use "Swift Next" as implementation version

view details

push time in 4 days

push eventDougGregor/swift-evolution

Doug Gregor

commit sha 33cc6131c5818969a30a23ee887ee3307797d8d0

Expand on the naming translation rules

view details

push time in 4 days

pull request commentapple/swift

[Concurrency] Don't lose name information from completion-handler arguments

While you're here, would it make sense to add WithCompletionBlock as well?

FWIW, it doesn't show up in the iOS or macOS SDKs at all, and a general web search finds relatively few uses.

DougGregor

comment created time in 4 days

create barnchDougGregor/swift

branch : concurrency-objc-name-adjustments

created branch time in 4 days

pull request commentapple/swift

[Concurrency] Don't lose name information from completion-handler arguments

@swift-ci please smoke test

DougGregor

comment created time in 4 days

PR opened apple/swift

[Concurrency] Don't lose name information from completion-handler arguments

When a completion handler parameter has a selector piece that ends with "WithCompletion(Handler)", prepend the text before that suffix to the base name or previous argument label, as appropriate. This ensures that we don't lose information from the name, particularly with delegate names.

+86 -38

0 comment

8 changed files

pr created time in 4 days

delete branch DougGregor/swift-evolution

delete branch : se-0289-implemented

delete time in 4 days

push eventapple/swift-evolution

Doug Gregor

commit sha 510866545390364f4faea652aca255ee44b14567

SE-0289 is implemented in GitHub main for Swift 5.4 (#1199)

view details

push time in 4 days

create barnchDougGregor/swift-evolution

branch : se-0289-implemented

created branch time in 4 days

push eventapple/swift

Doug Gregor

commit sha e1852956a065bdeca503c28fec37b3de139f8010

[Concurrency] Drop "get" prefix when importing Objective-C methods as async. Implements rdar://70506634.

view details

Doug Gregor

commit sha 24ea8becc8726859671d6086e5c8f724b3c6a13c

[Concurrency] Move removal of leading "get" for async imports. Name adjustments should be performed by omitNeedlessWords(), not the early classifcation of async imports.

view details

Doug Gregor

commit sha 8521453af39abae6fa29fbeaa474bcbbc64597ff

[Concurrency] Drop "Asynchronously" suffix from imported 'async' methods. The "Asynchronously" is a needless word for an "async" function. Remove it.

view details

Doug Gregor

commit sha fa9d4fd931eb149c41b6df066b376e4ed95deded

Merge pull request #34382 from DougGregor/concurrency-objc-get-async [Concurrency] Asynchronous Objective-C method importer naming adjustments

view details

push time in 4 days

delete branch DougGregor/swift

delete branch : concurrency-objc-get-async

delete time in 4 days

PR merged apple/swift

[Concurrency] Asynchronous Objective-C method importer naming adjustments

Make some adjustments to the names of Objective-C methods imported as async:

  • Drop a leading get from the base name; the async function returns the result directly
  • Drop an Asynchronously suffix from the base name; it's redundant with async

Implements rdar://70506634.

+42 -13

2 comments

7 changed files

DougGregor

pr closed time in 4 days

pull request commentapple/swift

[Concurrency] Asynchronous Objective-C method importer naming adjustments

@swift-ci please smoke test

DougGregor

comment created time in 4 days

push eventDougGregor/swift-concurrency-objc

Doug Gregor

commit sha 512537636291cd368c0ce859de0ed415d3dee7b0

[Concurrency] Drop "Asynchronously" suffix from imported 'async' methods.

view details

push time in 5 days

push eventDougGregor/swift

Doug Gregor

commit sha 24ea8becc8726859671d6086e5c8f724b3c6a13c

[Concurrency] Move removal of leading "get" for async imports. Name adjustments should be performed by omitNeedlessWords(), not the early classifcation of async imports.

view details

Doug Gregor

commit sha 8521453af39abae6fa29fbeaa474bcbbc64597ff

[Concurrency] Drop "Asynchronously" suffix from imported 'async' methods. The "Asynchronously" is a needless word for an "async" function. Remove it.

view details

push time in 5 days

PullRequestReviewEvent

create barnchDougGregor/swift

branch : concurrency-objc-get-async

created branch time in 5 days

pull request commentapple/swift

[Concurrency] Drop "get" prefix when importing Objective-C methods as async

@swift-ci please smoke test

DougGregor

comment created time in 5 days

PR opened apple/swift

[Concurrency] Drop "get" prefix when importing Objective-C methods as async

Implements rdar://70506634.

+22 -5

0 comment

4 changed files

pr created time in 5 days

push eventDougGregor/swift-concurrency-objc

Doug Gregor

commit sha 0806bd6f91ff5925dfcc5b8c47418cf6067f0b1d

[Concurrency] Drop "get" prefix when importing Objective-C methods as async. Implements rdar://70506634.

view details

push time in 5 days

Pull request review commentapple/swift

[WIP] Type lowering and SILGen for imported ObjC async decls.

 class DestructureInputs {   /// Given that we've just reached an argument index for the   /// first time, add any foreign parameters.   void maybeAddForeignParameters() {-    while (maybeAddForeignErrorParameter() ||+    while (maybeAddForeignAsyncParameter() ||+           maybeAddForeignErrorParameter() ||            maybeAddForeignSelfParameter()) {       // Continue to see, just in case there are more parameters to add.     }   }+  +  bool maybeAddForeignAsyncParameter() {+    if (!Foreign.Async+        || NextOrigParamIndex != Foreign.Async->completionHandlerParamIndex())+      return false;+    +    auto nativeCHTy = Foreign.Async->completionHandlerType();++    // Use the abstraction pattern we're lowering against in order to lower+    // the completion handler type, so we can preserve C/ObjC distinctions that+    // normally get abstracted away by the importer.+    auto completionHandlerNativeOrigTy = TopLevelOrigType+      .getObjCMethodAsyncCompletionHandlerType(nativeCHTy);+    +    // Bridge the Swift completion handler type back to its+    // foreign representation.+    auto foreignCHTy = TC.getLoweredBridgedType(completionHandlerNativeOrigTy,+                                      nativeCHTy,+                                      Bridgeability::Full,+                                      SILFunctionTypeRepresentation::ObjCMethod,+                                      TypeConverter::ForArgument)+      ->getCanonicalType();+    +    auto completionHandlerOrigTy = TopLevelOrigType+      .getObjCMethodAsyncCompletionHandlerType(foreignCHTy);+    auto completionHandlerTy = TC.getLoweredType(completionHandlerOrigTy,+                                                 foreignCHTy, expansion)+      .getASTType();+    Inputs.push_back(SILParameterInfo(completionHandlerTy,+                                      ParameterConvention::Direct_Unowned));+    ++NextOrigParamIndex;+    return true;+  }    bool maybeAddForeignErrorParameter() {+    // A foreign async convention absorbs any error parameter, making it into+    // an argument to the callback.+    if (Foreign.Async)

Per my first comment, the Clang importer creates declarations for which this isn't true. We can remove that feature of the Clang importer, or deal with it here.

jckarter

comment created time in 5 days

PullRequestReviewEvent

Pull request review commentapple/swift

[WIP] Type lowering and SILGen for imported ObjC async decls.

 AbstractionPattern TypeConverter::getAbstractionPattern(EnumElementDecl *decl) {   return AbstractionPattern(genericSig, type); } -AbstractionPattern::EncodedForeignErrorInfo-AbstractionPattern::EncodedForeignErrorInfo::encode(-                         const Optional<ForeignErrorConvention> &foreignError) {-  EncodedForeignErrorInfo errorInfo;-  if (foreignError.hasValue()) {-    errorInfo =-      EncodedForeignErrorInfo(foreignError->getErrorParameterIndex(),+AbstractionPattern::EncodedForeignInfo+AbstractionPattern::EncodedForeignInfo::encode(+                         const Optional<ForeignErrorConvention> &foreignError,+                         const Optional<ForeignAsyncConvention> &foreignAsync) {+  // Foreign async convention takes precedence.+  if (foreignAsync.hasValue()) {+    return EncodedForeignInfo(EncodedForeignInfo::Async,+                              foreignAsync->completionHandlerParamIndex(),+                              foreignAsync->completionHandlerErrorParamIndex());+  } else if (foreignError.hasValue()) {+    return EncodedForeignInfo(EncodedForeignInfo::Error,+                              foreignError->getErrorParameterIndex(),                               foreignError->isErrorParameterReplacedWithVoid(),                               foreignError->stripsResultOptionality());

The Clang importer can produce Swift declarations that have both a foreign async convention and a foreign error convention. This can happen when the Objective-C method in question has both "error" and "completion handler" parameters, i.e., because it can fail synchronously before launching asynchronous work. Here's an example from the Clang importer tests:

-(BOOL)findAnswerFailinglyWithError:(NSError * _Nullable * _Nullable)error completion:(void (^)(NSString *_Nullable, NSError * _Nullable))handler;

would be imported as

func findAnswerFailingly() async throws -> String?

The client won't be able to tell whether the error came from the synchronous "error" parameter or is delivered asynchronously, but I don't think the client would care. I don't recall seeing APIs of this form in the wild, so we could drop this feature from the Clang importer or we can support it here, but we shouldn't be inconsistent.

jckarter

comment created time in 5 days

Pull request review commentapple/swift

[WIP] Type lowering and SILGen for imported ObjC async decls.

 AbstractionPattern AbstractionPattern::getFunctionResultType() const {         getGenericSignatureForFunctionComponent(), getResultType(getType()),         getCXXMethod());   case Kind::PartialCurriedObjCMethodType:-  case Kind::ObjCMethodType:+  case Kind::ObjCMethodType: {+    // If this is a foreign async function, the result type comes from the+    // completion callback argument to the original method. Line up the+    // result abstraction pattern with that callback argument.+    if (getEncodedForeignInfo().getKind() == EncodedForeignInfo::IsAsync) {+      auto paramIndex+        = getEncodedForeignInfo().getAsyncCompletionHandlerParamIndex();+      +      auto callbackParamTy = getObjCMethod()->parameters()[paramIndex]+                                            ->getType()+                                            ->getPointeeType()+                                            ->getAs<clang::FunctionProtoType>();+      +      // The result is the first non-error argument to the callback.

The result type can be a tuple composed of all of the non-error arguments to the callback, e.g., if your callback had the type

void (^)(NSString * _Nullable, NSInteger, NSError * _Nullable)

the result type would be (String? Int). The Clang importer has a a function decomposeCompletionHandlerType that does this work on Swift types.

jckarter

comment created time in 5 days

Pull request review commentapple/swift

[WIP] Type lowering and SILGen for imported ObjC async decls.

 static bool isPseudogeneric(SILDeclRef c) {  /// Update the result type given the foreign error convention that we will be /// using.-static std::pair<AbstractionPattern, CanType> updateResultTypeForForeignError(-    ForeignErrorConvention convention, CanGenericSignature genericSig,-    AbstractionPattern origResultType, CanType substFormalResultType) {+void updateResultTypeForForeignInfo(+    const ForeignInfo &foreignInfo, CanGenericSignature genericSig,+    AbstractionPattern &origResultType, CanType &substFormalResultType) {+  // If there's no error or async convention, the return type is unchanged.+  if (!foreignInfo.Async && !foreignInfo.Error) {+    return;+  }+  +  // A foreign async convention means our lowered return type is Void, since

In the synchronous-error case I've been commenting on, you could end up with (e.g.) BOOL here, as dictated by the foreign error convention.

jckarter

comment created time in 5 days

PullRequestReviewEvent

push eventapple/swift

Doug Gregor

commit sha 6a40a3a8aac7b4133bac70f98d92adabf30b6f7b

[SE-0289] Add support for @resultBuilder. "Function builders" are being renamed to "result builders". Add the corresponding `@resultBuilder` attribute, with `@_functionBuilder` as an alias for it, Update test cases to use @resultBuilder.

view details

Doug Gregor

commit sha 0d568a93d46973ac29eb1d0f4311e7ffd11df485

[SE-0289] Update diagnostics & many other strings to "result builders"

view details

Doug Gregor

commit sha 6d41524fe66c21c98165a6836848736fb0aef929

[SE-0289] Finish renaming source code, tests to "result builders"

view details

Doug Gregor

commit sha b6c0145932ad121635f8413b16bef68ddf01cc38

[SE-0289] Continue printing @_functionBuilder in .swiftinterfaces. Maintain the ability for older Swift compilers to read .swiftinterfaces that make use of result builders by always emitting @_functionBuilder rather than the newer @resultBuilder.

view details

Doug Gregor

commit sha 3b6fd4ece87f84953d65565f76b32d733ce65022

Merge pull request #34374 from DougGregor/se-0289-result-builders-rename [SE-0289] Rename "function builders" to "result builders"

view details

push time in 5 days

delete branch DougGregor/swift

delete branch : se-0289-result-builders-rename

delete time in 5 days

PR merged apple/swift

[SE-0289] Rename "function builders" to "result builders"

Rename "function builders" to "result builders", per the second review of SE-0289. Start accepting @resultBuilder, but keep accepting @_functionBuilder with a warning for existing clients. The scope of the change is large because I'm updated source names, diagnostic text, and test files as well as accepting the new syntax so we'll have a clean slate going forward.

Tracked by rdar://60354369

+753 -732

4 comments

86 changed files

DougGregor

pr closed time in 5 days

pull request commentapple/swift

[SE-0289] Rename "function builders" to "result builders"

Source compatibility failures are unrelated

DougGregor

comment created time in 5 days

pull request commentapple/swift

[SE-0289] Rename "function builders" to "result builders"

@swift-ci please smoke test macOS

DougGregor

comment created time in 5 days

pull request commentapple/swift

[SE-0289] Rename "function builders" to "result builders"

@swift-ci please test source compatibility

DougGregor

comment created time in 6 days

pull request commentapple/swift

[SE-0289] Rename "function builders" to "result builders"

@swift-ci please smoke test

DougGregor

comment created time in 6 days

PR opened apple/swift

[SE-0289] Rename "function builders" to "result builders"

Rename "function builders" to "result builders", per the second review of SE-0289. Start accepting @resultBuilder, but keep accepting @_functionBuilder with a warning for existing clients. The scope of the change is large because I'm updated source names, diagnostic text, and test files as well as accepting the new syntax so we'll have a clean slate going forward.

+753 -732

0 comment

86 changed files

pr created time in 6 days

create barnchDougGregor/swift

branch : se-0289-result-builders-rename

created branch time in 6 days

push eventapple/swift

Kavon Farvardin

commit sha 849e9d660f502fd67352305220ef83170e47a21d

fix diagnostic messages that said '@actorIsolated' for @actorIndependent

view details

Kavon Farvardin

commit sha 34d22105b88236ea0a37b89c4dd0580eb11ac526

implemented parsing and typechecking for @actorIndependent(unsafe) [broken] first impl of @actorIndependent in the type checker. [broken] fixed mistake in my parsing code wrt invalid source range [broken] found another spot where ActorIndependent needs custom handling [broken] incomplete set of @actorIndependent(unsafe) tests updates to ActorIndependentUnsafe [fixed] add FIXME plus simple handling of IndependentUnsafe context finished @actorIndependent(unsafe) regression tests added wip serialization / deserialization test focus test to just one actor class round-trip serialize/deserialize test for @actorIndependent serialize -> deserialize -> serialize -> compare to original most of doug's comments addressed robert's comments fix printing bug; add module printing to regression test [nfc] update comment for ActorIsolation::IndependentUnsafe

view details

Kavon Farvardin

commit sha 0752121cc5faa5c57739aebaf6ea57ab72959378

add regression tests for SR-13735

view details

Doug Gregor

commit sha ce907672cc78616e6c5dfc317a439d73d9bf6ccb

Merge pull request #34260 from kavon/actorUnsafe [concurrency] implement the 'unsafe' option for @actorIndependent

view details

push time in 6 days

PR merged apple/swift

Reviewers
[concurrency] implement the 'unsafe' option for @actorIndependent

This PR implements @actorIndependent(unsafe), which disables static safety checks for accesses to actor-isolated storage. It is otherwise semantically the same as @actorIndependent (without the option) that is the 'safe' version.

TODOs:

  • [x] Implement parsing for this attribute.
  • [x] Conditionally disable safety checks in the type checker.
  • [x] ~Fix missing detection of mutable state access from @actorIndependent computed property~, Reported as SR-13735, but already fixed in main.
  • [x] Add @actorIndependent(unsafe) regression tests.
  • [x] Add serialization / deserialization regression tests.

<!-- Before merging this pull request, you must run the Swift continuous integration tests. For information about triggering CI builds via @swift-ci, see: https://github.com/apple/swift/blob/master/docs/ContinuousIntegration.md#swift-ci

Thank you for your contribution to Swift! -->

+464 -51

5 comments

20 changed files

kavon

pr closed time in 6 days

pull request commentapple/swift

[concurrency] implement the 'unsafe' option for @actorIndependent

Let's go ahead and merge, and we can tweak later if needed.

kavon

comment created time in 6 days

PullRequestReviewEvent

Pull request review commentapple/swift-driver

Infer .swiftdoc and .swiftsourceinfo paths from .swiftmodule path in a given outputFileMap

 public struct OutputFileMap: Hashable, Codable {   }    public func existingOutput(inputFile: VirtualPath, outputType: FileType) -> VirtualPath? {-    entries[inputFile]?[outputType]+    switch outputType {+    case .swiftDocumentation, .swiftSourceInfoFile:+      // If the output map has specific entry for these entities, use that.+      if let path = entries[inputFile]?[outputType] {+        return path+      }

How about making this the first check in the function, and then the switch only contains the fallback options or returns nil?

nkcsgexi

comment created time in 6 days

PullRequestReviewEvent
PullRequestReviewEvent

push eventDougGregor/swift-evolution

Doug Gregor

commit sha f78167b23336264daac2826a619256b788cca2a4

Rework the attribute used to describe the async Swift name.

view details

push time in 7 days

push eventDougGregor/swift-evolution

Doug Gregor

commit sha b527441e259f595d3490f931406ce9097e10b446

Fix more spacing

view details

push time in 7 days

push eventDougGregor/swift-evolution

Doug Gregor

commit sha 5dc3af240fe09a6327132ef01e604320b6557c26

Fix spacing

view details

push time in 7 days

pull request commentapple/swift

[concurrency] implement the 'unsafe' option for @actorIndependent

@swift-ci please smoke test

kavon

comment created time in 7 days

PullRequestReviewEvent
PullRequestReviewEvent
PullRequestReviewEvent
MemberEvent
PullRequestReviewEvent
PullRequestReviewEvent
PullRequestReviewEvent
PullRequestReviewEvent

push eventDougGregor/swift-evolution

Doug Gregor

commit sha 51552f4f9c59bacd271e1b73b65e727921aa39c8

Fix typos (thanks Dave Lee) and withUnsafeContinuation code (thanks Jason Gregori)

view details

push time in 10 days

delete branch DougGregor/swift

delete branch : type-eraser-resolution

delete time in 10 days

pull request commentapple/swift

[concurrency] implement the 'unsafe' option for @actorIndependent

@swift-ci smoke test

kavon

comment created time in 10 days

pull request commentapple/swift

[5.3][Sema] Consider inherited platform unavailability to silence diagnostics

@swift-ci please test macOS

xymus

comment created time in 11 days

pull request commentapple/swift

[concurrency] implement the 'unsafe' option for @actorIndependent

The code's looking good. One last request (sorry): could you do a rebase to clean up the history a little bit?

kavon

comment created time in 11 days

pull request commentapple/swift

[AST] Allow resolution of the @_typeEraser type when printing.

@swift-ci please smoke test and merge

DougGregor

comment created time in 11 days

create barnchDougGregor/swift

branch : type-eraser-resolution

created branch time in 11 days

PullRequestReviewEvent

push eventDougGregor/swift-evolution

Doug Gregor

commit sha d620738da0922a7ac1c1207027b4f900ec31f4ce

Initial draft of "Concurrency Interoperability with Objective-C"

view details

push time in 11 days

more