diff --git a/include/swift/AST/Decl.h b/include/swift/AST/Decl.h index 7686e4dba1268..458bce26c6011 100644 --- a/include/swift/AST/Decl.h +++ b/include/swift/AST/Decl.h @@ -5986,10 +5986,6 @@ class AbstractFunctionDecl : public GenericContext, public ValueDecl { /// Returns 'true' if the function is distributed. bool isDistributed() const; - /// Get (or synthesize) the associated remote function for this one. - /// For example, for `distributed func hi()` get `func _remote_hi()`. - AbstractFunctionDecl *getDistributedActorRemoteFuncDecl() const; - PolymorphicEffectKind getPolymorphicEffectKind(EffectKind kind) const; // FIXME: Hack that provides names with keyword arguments for accessors. diff --git a/include/swift/AST/TypeCheckRequests.h b/include/swift/AST/TypeCheckRequests.h index 5cb3e47d8ac6b..d5ba12351e716 100644 --- a/include/swift/AST/TypeCheckRequests.h +++ b/include/swift/AST/TypeCheckRequests.h @@ -933,10 +933,10 @@ class IsDistributedActorRequest : bool isCached() const { return true; } }; -/// Obtain the 'remote' counterpart of a 'distributed func'. -class GetDistributedRemoteFuncRequest : - public SimpleRequest { public: using SimpleRequest::SimpleRequest; @@ -944,7 +944,7 @@ class GetDistributedRemoteFuncRequest : private: friend SimpleRequest; - AbstractFunctionDecl *evaluate(Evaluator &evaluator, AbstractFunctionDecl *func) const; + bool evaluate(Evaluator &evaluator, FuncDecl *func) const; public: // Caching @@ -2046,6 +2046,8 @@ enum class ImplicitMemberAction : uint8_t { ResolveEncodable, ResolveDecodable, ResolveDistributedActor, + ResolveDistributedActorIdentity, + ResolveDistributedActorTransport, }; class ResolveImplicitMemberRequest diff --git a/include/swift/AST/TypeCheckerTypeIDZone.def b/include/swift/AST/TypeCheckerTypeIDZone.def index d99cdbe0018a5..81347454a1520 100644 --- a/include/swift/AST/TypeCheckerTypeIDZone.def +++ b/include/swift/AST/TypeCheckerTypeIDZone.def @@ -100,7 +100,7 @@ SWIFT_REQUEST(TypeChecker, IsDefaultActorRequest, Cached, NoLocationInfo) SWIFT_REQUEST(TypeChecker, IsDistributedActorRequest, bool(NominalTypeDecl *), Cached, NoLocationInfo) -SWIFT_REQUEST(TypeChecker, GetDistributedRemoteFuncRequest, AbstractFunctionDecl *(AbstractFunctionDecl *), +SWIFT_REQUEST(TypeChecker, IsDistributedFuncRequest, bool(FuncDecl *), Cached, NoLocationInfo) SWIFT_REQUEST(TypeChecker, GlobalActorInstanceRequest, VarDecl *(NominalTypeDecl *), diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index bbf52cd63c8dc..4e415b5c80a18 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -4222,12 +4222,21 @@ void NominalTypeDecl::synthesizeSemanticMembersIfNeeded(DeclName member) { if (baseName == DeclBaseName::createConstructor()) { if ((member.isSimpleName() || argumentNames.front() == Context.Id_from)) { action.emplace(ImplicitMemberAction::ResolveDecodable); + } else if (argumentNames.front() == Context.Id_transport) { + action.emplace(ImplicitMemberAction::ResolveDistributedActorTransport); } } else if (!baseName.isSpecial() && baseName.getIdentifier() == Context.Id_encode && (member.isSimpleName() || argumentNames.front() == Context.Id_to)) { action.emplace(ImplicitMemberAction::ResolveEncodable); } + } else if (member.isSimpleName() || argumentNames.size() == 2) { + if (baseName == DeclBaseName::createConstructor()) { + if (argumentNames[0] == Context.Id_resolve && + argumentNames[1] == Context.Id_using) { + action.emplace(ImplicitMemberAction::ResolveDistributedActor); + } + } } } @@ -7208,19 +7217,14 @@ bool AbstractFunctionDecl::isSendable() const { } bool AbstractFunctionDecl::isDistributed() const { - return this->getAttrs().hasAttribute(); -} - -AbstractFunctionDecl* -AbstractFunctionDecl::getDistributedActorRemoteFuncDecl() const { - if (!this->isDistributed()) - return nullptr; + auto func = dyn_cast(this); + if (!func) + return false; - auto mutableThis = const_cast(this); - return evaluateOrDefault( - getASTContext().evaluator, - GetDistributedRemoteFuncRequest{mutableThis}, - nullptr); + auto mutableFunc = const_cast(func); + return evaluateOrDefault(getASTContext().evaluator, + IsDistributedFuncRequest{mutableFunc}, + false); } BraceStmt *AbstractFunctionDecl::getBody(bool canSynthesize) const { diff --git a/lib/AST/TypeCheckRequests.cpp b/lib/AST/TypeCheckRequests.cpp index d0b7c628be28f..4c59adca8da4f 100644 --- a/lib/AST/TypeCheckRequests.cpp +++ b/lib/AST/TypeCheckRequests.cpp @@ -1035,6 +1035,12 @@ void swift::simple_display(llvm::raw_ostream &out, case ImplicitMemberAction::ResolveDistributedActor: out << "resolve DistributedActor"; break; + case ImplicitMemberAction::ResolveDistributedActorIdentity: + out << "resolve DistributedActor.id"; + break; + case ImplicitMemberAction::ResolveDistributedActorTransport: + out << "resolve DistributedActor.actorTransport"; + break; } } diff --git a/lib/SILGen/SILGenDistributed.cpp b/lib/SILGen/SILGenDistributed.cpp index 37ef1f28d6e00..3827813cbec32 100644 --- a/lib/SILGen/SILGenDistributed.cpp +++ b/lib/SILGen/SILGenDistributed.cpp @@ -814,6 +814,7 @@ void SILGenFunction::emitDistributedActor_resignAddress( void SILGenFunction::emitDistributedActorClassMemberDestruction( SILLocation cleanupLoc, ManagedValue selfValue, ClassDecl *cd, SILBasicBlock *normalMemberDestroyBB, SILBasicBlock *finishBB) { + ASTContext &ctx = getASTContext(); auto selfTy = cd->getDeclaredInterfaceType(); Scope scope(Cleanups, CleanupLocation(cleanupLoc)); diff --git a/lib/Sema/CodeSynthesis.cpp b/lib/Sema/CodeSynthesis.cpp index cc6e33b7fdd77..2c74d4e9906e1 100644 --- a/lib/Sema/CodeSynthesis.cpp +++ b/lib/Sema/CodeSynthesis.cpp @@ -1255,10 +1255,9 @@ ResolveImplicitMemberRequest::evaluate(Evaluator &evaluator, auto &Context = target->getASTContext(); switch (action) { - case ImplicitMemberAction::ResolveImplicitInit: { + case ImplicitMemberAction::ResolveImplicitInit: TypeChecker::addImplicitConstructors(target); break; - } case ImplicitMemberAction::ResolveCodingKeys: { // CodingKeys is a special type which may be synthesized as part of // Encodable/Decodable conformance. If the target conforms to either @@ -1275,8 +1274,8 @@ ResolveImplicitMemberRequest::evaluate(Evaluator &evaluator, if (!evaluateTargetConformanceTo(decodableProto)) { (void)evaluateTargetConformanceTo(encodableProto); } - break; } + break; case ImplicitMemberAction::ResolveEncodable: { // encode(to:) may be synthesized as part of derived conformance to the // Encodable protocol. @@ -1284,8 +1283,8 @@ ResolveImplicitMemberRequest::evaluate(Evaluator &evaluator, // conformance here to attempt synthesis. auto *encodableProto = Context.getProtocol(KnownProtocolKind::Encodable); (void)evaluateTargetConformanceTo(encodableProto); - break; } + break; case ImplicitMemberAction::ResolveDecodable: { // init(from:) may be synthesized as part of derived conformance to the // Decodable protocol. @@ -1294,11 +1293,17 @@ ResolveImplicitMemberRequest::evaluate(Evaluator &evaluator, TypeChecker::addImplicitConstructors(target); auto *decodableProto = Context.getProtocol(KnownProtocolKind::Decodable); (void)evaluateTargetConformanceTo(decodableProto); - break; } -case ImplicitMemberAction::ResolveDistributedActor: { - if (auto classDecl = dyn_cast(target)) - swift::addImplicitDistributedActorMembers(classDecl); + break; + case ImplicitMemberAction::ResolveDistributedActor: + case ImplicitMemberAction::ResolveDistributedActorTransport: + case ImplicitMemberAction::ResolveDistributedActorIdentity: { + // init(transport:) and init(resolve:using:) may be synthesized as part of + // derived conformance to the DistributedActor protocol. + // If the target should conform to the DistributedActor protocol, check the + // conformance here to attempt synthesis. + // FIXME(distributed): invoke the requirement adding explicitly here + TypeChecker::addImplicitConstructors(target); auto *distributedActorProto = Context.getProtocol(KnownProtocolKind::DistributedActor); (void)evaluateTargetConformanceTo(distributedActorProto); diff --git a/lib/Sema/CodeSynthesisDistributedActor.cpp b/lib/Sema/CodeSynthesisDistributedActor.cpp index 7133e84d4dd5f..1a8bf1c86fff4 100644 --- a/lib/Sema/CodeSynthesisDistributedActor.cpp +++ b/lib/Sema/CodeSynthesisDistributedActor.cpp @@ -205,8 +205,7 @@ synthesizeRemoteFuncStubBody(AbstractFunctionDecl *func, void *context) { auto uintInit = ctx.getIntBuiltinInitDecl(uintDecl); auto missingTransportDecl = ctx.getMissingDistributedActorTransport(); - assert(missingTransportDecl && - "Could not locate '_missingDistributedActorTransport' function"); + assert(missingTransportDecl && "Could not locate '_missingDistributedActorTransport' function"); // Create a call to _Distributed._missingDistributedActorTransport auto loc = func->getLoc(); @@ -244,10 +243,16 @@ synthesizeRemoteFuncStubBody(AbstractFunctionDecl *func, void *context) { file->setBuiltinInitializer(staticStringInit); auto startLineAndCol = SM.getPresumedLineAndColumnForLoc(distributedFunc->getStartLoc()); +// auto *line = new (ctx) MagicIdentifierLiteralExpr( +// MagicIdentifierLiteralExpr::Line, loc, /*Implicit=*/true); +// auto *line = new (ctx) IntegerLiteralExpr(startLineAndCol.first, loc, +// /*implicit*/ true); auto *line = IntegerLiteralExpr::createFromUnsigned(ctx, startLineAndCol.first); line->setType(uintType); line->setBuiltinInitializer(uintInit); +// auto *column = new (ctx) MagicIdentifierLiteralExpr( +// MagicIdentifierLiteralExpr::Column, loc, /*Implicit=*/true); auto *column = IntegerLiteralExpr::createFromUnsigned(ctx, startLineAndCol.second); column->setType(uintType); column->setBuiltinInitializer(uintInit); @@ -259,6 +264,7 @@ synthesizeRemoteFuncStubBody(AbstractFunctionDecl *func, void *context) { SmallVector stmts; stmts.push_back(call); // something() -> Never + // stmts.push_back(new (ctx) ReturnStmt(SourceLoc(), /*Result=*/nullptr)); // FIXME: this causes 'different types for return type: String vs. ()' auto body = BraceStmt::create(ctx, SourceLoc(), stmts, SourceLoc(), /*implicit=*/true); return { body, /*isTypeChecked=*/true }; @@ -284,8 +290,7 @@ static Identifier makeRemoteFuncIdentifier(FuncDecl* func) { /// /// and is intended to be replaced by a transport library by providing an /// appropriate @_dynamicReplacement function. -static FuncDecl* -addImplicitRemoteFunction(ClassDecl *decl, FuncDecl *func) { +static void addImplicitRemoteActorFunction(ClassDecl *decl, FuncDecl *func) { auto &C = decl->getASTContext(); auto parentDC = decl; @@ -310,10 +315,6 @@ addImplicitRemoteFunction(ClassDecl *decl, FuncDecl *func) { remoteFuncDecl->getAttrs().add( new (C) DistributedActorIndependentAttr(/*IsImplicit=*/true)); - // nonisolated - remoteFuncDecl->getAttrs().add( - new (C) NonisolatedAttr(/*IsImplicit=*/true)); - // users should never have to access this function directly; // it is only invoked from our distributed function thunk if the actor is remote. remoteFuncDecl->setUserAccessible(false); @@ -325,16 +326,16 @@ addImplicitRemoteFunction(ClassDecl *decl, FuncDecl *func) { remoteFuncDecl->copyFormalAccessFrom(func, /*sourceIsParentContext=*/false); decl->addMember(remoteFuncDecl); - return remoteFuncDecl; } /// Synthesize dynamic _remote stub functions for each encountered distributed function. -static void addImplicitRemoteFunctions(ClassDecl *decl) { +static void addImplicitRemoteActorFunctions(ClassDecl *decl) { assert(decl->isDistributedActor()); + for (auto member : decl->getMembers()) { - auto func = dyn_cast(member); + auto func = dyn_cast(member); if (func && func->isDistributed()) { - (void) func->getDistributedActorRemoteFuncDecl(); + addImplicitRemoteActorFunction(decl, func); } } } @@ -343,33 +344,8 @@ static void addImplicitRemoteFunctions(ClassDecl *decl) { /************************ SYNTHESIS ENTRY POINT *******************************/ /******************************************************************************/ -AbstractFunctionDecl *TypeChecker::addImplicitDistributedActorRemoteFunction( - ClassDecl *decl, AbstractFunctionDecl *AFD) { - if (!decl->isDistributedActor()) - return nullptr; - - if (auto func = dyn_cast(AFD)) - return addImplicitRemoteFunction(decl, func); - - return nullptr; -} - -void TypeChecker::addImplicitDistributedActorRemoteFunctions(NominalTypeDecl *decl) { - // Bail out if not a distributed actor definition. - if (!decl->isDistributedActor()) - return; - - // If the _Distributed module is missing we cannot synthesize anything. - if (!swift::ensureDistributedModuleLoaded(decl)) - return; - - if (auto clazz = dyn_cast(decl)) - addImplicitRemoteFunctions(clazz); -} - /// Entry point for adding all computed members to a distributed actor decl. -// TODO(distributed): move the synthesis of protocol requirements to DerivedConformance style -void swift::addImplicitDistributedActorMembers(ClassDecl *decl) { +void swift::addImplicitDistributedActorMembersToClass(ClassDecl *decl) { // Bail out if not a distributed actor definition. if (!decl->isDistributedActor()) return; @@ -380,4 +356,5 @@ void swift::addImplicitDistributedActorMembers(ClassDecl *decl) { addFactoryResolveFunction(decl); addImplicitDistributedActorStoredProperties(decl); + addImplicitRemoteActorFunctions(decl); } diff --git a/lib/Sema/TypeCheckAttr.cpp b/lib/Sema/TypeCheckAttr.cpp index b0e1036a07398..34d9250abed3a 100644 --- a/lib/Sema/TypeCheckAttr.cpp +++ b/lib/Sema/TypeCheckAttr.cpp @@ -2365,7 +2365,7 @@ void AttributeChecker::visitDiscardableResultAttr(DiscardableResultAttr *attr) { } } -/// Lookup the replaced decl in the replacements scope. +/// Lookup the replaced decl in the replacments scope. static void lookupReplacedDecl(DeclNameRef replacedDeclName, const DeclAttribute *attr, const ValueDecl *replacement, @@ -2400,10 +2400,9 @@ static void lookupReplacedDecl(DeclNameRef replacedDeclName, if (declCtxt->isInSpecializeExtensionContext()) options |= NL_IncludeUsableFromInline; - if (typeCtx) { + if (typeCtx) moduleScopeCtxt->lookupQualified({typeCtx}, replacedDeclName, options, results); - } } /// Remove any argument labels from the interface type of the given value that @@ -3499,19 +3498,6 @@ DynamicallyReplacedDeclRequest::evaluate(Evaluator &evaluator, if (attr->isInvalid()) return nullptr; - auto *clazz = VD->getDeclContext()->getSelfClassDecl(); - if (clazz && clazz->isDistributedActor()) { - // Since distributed actors synthesize their `_remote` - // counterparts to any `distributed func` declared on them, and such remote - // function is a popular target for dynamic function replacement - we must - // force the synthesis has happened here already, such that we can lookup - // the func for the replacement we're handling right now. - // - // This request is cached, so it won't cause wasted/duplicate work. - TypeChecker::addImplicitDistributedActorRemoteFunctions(clazz); - } - - // If we can lazily resolve the function, do so now. if (auto *LazyResolver = attr->Resolver) { auto decl = LazyResolver->loadDynamicallyReplacedFunctionDecl( diff --git a/lib/Sema/TypeCheckDecl.cpp b/lib/Sema/TypeCheckDecl.cpp index bc3fd36fd1945..873e93b0ea98a 100644 --- a/lib/Sema/TypeCheckDecl.cpp +++ b/lib/Sema/TypeCheckDecl.cpp @@ -2580,7 +2580,6 @@ static ArrayRef evaluateMembersRequest( TypeChecker::addImplicitConstructors(nominal); } - // Force any conformances that may introduce more members. for (auto conformance : idc->getLocalConformances()) { auto proto = conformance->getProtocol(); @@ -2612,15 +2611,15 @@ static ArrayRef evaluateMembersRequest( TypeChecker::checkConformance(conformance->getRootNormalConformance()); } + // If the type conforms to Encodable or Decodable, even via an extension, + // the CodingKeys enum is synthesized as a member of the type itself. + // Force it into existence. if (nominal) { - // If the type conforms to Encodable or Decodable, even via an extension, - // the CodingKeys enum is synthesized as a member of the type itself. - // Force it into existence. (void) evaluateOrDefault( ctx.evaluator, - ResolveImplicitMemberRequest{nominal, - ImplicitMemberAction::ResolveCodingKeys}, - {}); + ResolveImplicitMemberRequest{nominal, + ImplicitMemberAction::ResolveCodingKeys}, + {}); } // If the decl has a @main attribute, we need to force synthesis of the @@ -2639,10 +2638,6 @@ static ArrayRef evaluateMembersRequest( (void) var->getPropertyWrapperInitializerInfo(); } } - - if (auto *func = dyn_cast(member)) { - (void) func->getDistributedActorRemoteFuncDecl(); - } } SortedDeclList synthesizedMembers; diff --git a/lib/Sema/TypeCheckDeclPrimary.cpp b/lib/Sema/TypeCheckDeclPrimary.cpp index 61c0a78a43ea0..35b646516e46b 100644 --- a/lib/Sema/TypeCheckDeclPrimary.cpp +++ b/lib/Sema/TypeCheckDeclPrimary.cpp @@ -2673,7 +2673,7 @@ class DeclChecker : public DeclVisitor { /// FIXME: This is an egregious hack to turn off availability checking /// for specific functions that were missing availability in older versions - /// of existing libraries that we must nonetheless still support. + /// of existing libraries that we must nonethess still support. static bool hasHistoricallyWrongAvailability(FuncDecl *func) { return func->getName().isCompoundName("swift_deletedAsyncMethodError", { }); } diff --git a/lib/Sema/TypeCheckDistributed.cpp b/lib/Sema/TypeCheckDistributed.cpp index 9bc558254642b..3fecfa10ee2f4 100644 --- a/lib/Sema/TypeCheckDistributed.cpp +++ b/lib/Sema/TypeCheckDistributed.cpp @@ -71,33 +71,14 @@ bool IsDistributedActorRequest::evaluate( return classDecl->isExplicitDistributedActor(); } -AbstractFunctionDecl *GetDistributedRemoteFuncRequest::evaluate( - Evaluator &evaluator, AbstractFunctionDecl *func) const { - if (!func->isDistributed()) - return nullptr; - - auto &C = func->getASTContext(); - DeclContext *DC = func->getDeclContext(); - - // not via `ensureDistributedModuleLoaded` to avoid generating a warning, - // we won't be emitting the offending decl after all. - if (!C.getLoadedModule(C.Id_Distributed)) - return nullptr; - - // Locate the actor decl that the member must be synthesized to. - // TODO(distributed): should this just be added to the extension instead when we're in one? - ClassDecl *decl = dyn_cast(DC); - if (!decl) { - if (auto ED = dyn_cast(DC)) { - decl = dyn_cast(ED->getExtendedNominal()); - } +bool IsDistributedFuncRequest::evaluate( + Evaluator &evaluator, FuncDecl *func) const { + // Check whether the attribute was explicitly specified. + if (auto attr = func->getAttrs().getAttribute()) { + return true; + } else { + return false; } - - /// A distributed func cannot be added to a non-distributed actor; - /// If the 'decl' was not a distributed actor we must have declared and - /// requested it from a illegal context, let's just ignore the synthesis. - assert(decl && "Can't find actor detect to add implicit _remote function to"); - return TypeChecker::addImplicitDistributedActorRemoteFunction(decl, func); } // ==== ------------------------------------------------------------------------ @@ -150,9 +131,6 @@ bool swift::checkDistributedFunction(FuncDecl *func, bool diagnose) { // === Check _remote functions ClassDecl *actorDecl = dyn_cast(func->getParent()); - if (actorDecl == nullptr) - if (auto ED = dyn_cast(func->getParent())) - actorDecl = dyn_cast(ED->getExtendedNominal()); assert(actorDecl && actorDecl->isDistributedActor()); // _remote function for a distributed function must not be implemented by end-users, @@ -256,7 +234,7 @@ void TypeChecker::checkDistributedActor(ClassDecl *decl) { // --- Synthesize properties // TODO: those could technically move to DerivedConformance style - swift::addImplicitDistributedActorMembers(decl); + swift::addImplicitDistributedActorMembersToClass(decl); // ==== Functions } diff --git a/lib/Sema/TypeCheckDistributed.h b/lib/Sema/TypeCheckDistributed.h index 8bc5f1aa4ec39..8e556505040ae 100644 --- a/lib/Sema/TypeCheckDistributed.h +++ b/lib/Sema/TypeCheckDistributed.h @@ -45,7 +45,7 @@ bool checkDistributedFunction(FuncDecl *decl, bool diagnose); /// Synthesis of members which are not directly driven filling in protocol requirements, /// such as the default local and resolve constructors, and `_remote_` function stubs. -void addImplicitDistributedActorMembers(ClassDecl *decl); +void addImplicitDistributedActorMembersToClass(ClassDecl *decl); } diff --git a/lib/Sema/TypeChecker.h b/lib/Sema/TypeChecker.h index ab27ebdaa1701..bc43f5924eb90 100644 --- a/lib/Sema/TypeChecker.h +++ b/lib/Sema/TypeChecker.h @@ -516,17 +516,6 @@ bool checkContextualRequirements(GenericTypeDecl *decl, /// struct, class or actor. void addImplicitConstructors(NominalTypeDecl *typeDecl); -/// Synthesize and add a '_remote' counterpart of the passed in `func` to `decl`. -/// -/// \param decl the actor type to add the '_remote' definition to -/// \param func the 'distributed func' that the '_remote' func should mirror -/// \return the synthesized function -AbstractFunctionDecl *addImplicitDistributedActorRemoteFunction( - ClassDecl* decl, AbstractFunctionDecl *func); - -// TODO(distributed): remove this? -void addImplicitDistributedActorRemoteFunctions(NominalTypeDecl *decl); - /// Fold the given sequence expression into an (unchecked) expression /// tree. Expr *foldSequence(SequenceExpr *expr, DeclContext *dc); diff --git a/test/Distributed/Inputs/dynamic_replacement_da_decl.swift b/test/Distributed/Inputs/dynamic_replacement_da_decl.swift deleted file mode 100644 index b42b4023ada14..0000000000000 --- a/test/Distributed/Inputs/dynamic_replacement_da_decl.swift +++ /dev/null @@ -1,20 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// This source file is part of the Swift open source project -// -// Copyright (c) 2021 Apple Inc. and the Swift project authors -// Licensed under Apache License v2.0 -// -// See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift project authors -// -// SPDX-License-Identifier: Apache-2.0 -// -//===----------------------------------------------------------------------===// - -import _Distributed - -distributed actor DA { - distributed func hello(other: DA) {} -} - diff --git a/test/Distributed/Inputs/dynamic_replacement_da_extension.swift b/test/Distributed/Inputs/dynamic_replacement_da_extension.swift deleted file mode 100644 index 160b4fefffd7d..0000000000000 --- a/test/Distributed/Inputs/dynamic_replacement_da_extension.swift +++ /dev/null @@ -1,20 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// This source file is part of the Swift open source project -// -// Copyright (c) 2021 Apple Inc. and the Swift project authors -// Licensed under Apache License v2.0 -// -// See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift project authors -// -// SPDX-License-Identifier: Apache-2.0 -// -//===----------------------------------------------------------------------===// - -import _Distributed - -extension DA { - @_dynamicReplacement(for:_remote_hello(other:)) - nonisolated func _impl_hello(other: DA) async throws {} -} diff --git a/test/Distributed/distributed_actor_dynamic_replacement.swift b/test/Distributed/distributed_actor_dynamic_replacement.swift deleted file mode 100644 index 4244d3bb53e8d..0000000000000 --- a/test/Distributed/distributed_actor_dynamic_replacement.swift +++ /dev/null @@ -1,10 +0,0 @@ -// RUN: %target-swift-frontend -disable-availability-checking -enable-experimental-distributed -c -enable-batch-mode -module-name foo -primary-file %S/Inputs/dynamic_replacement_da_extension.swift -primary-file %S/Inputs/dynamic_replacement_da_decl.swift - -// REQUIRES: concurrency -// REQUIRES: distributed - -import _Distributed - -func runtimeReceive(da: DA) async throws { - try await da.hello(other:da) -} diff --git a/test/Distributed/distributed_actor_isolation.swift b/test/Distributed/distributed_actor_isolation.swift index a1b6e600ec5f6..0aa489977fc9f 100644 --- a/test/Distributed/distributed_actor_isolation.swift +++ b/test/Distributed/distributed_actor_isolation.swift @@ -1,5 +1,4 @@ -// RUN: %target-typecheck-verify-swift -enable-experimental-distributed -disable-availability-checking -verify-ignore-unknown -// TODO(distributed): remove the -verify-ignore-unknown, we're causing Sendable warnings in locs right now +// RUN: %target-typecheck-verify-swift -enable-experimental-distributed -disable-availability-checking // REQUIRES: concurrency // REQUIRES: distributed @@ -68,26 +67,24 @@ distributed actor DistributedActor_1 { fatalError() } - distributed func distReturnGeneric(item: T) async throws -> T { // ok + distributed func distReturnGeneric(item: T) async throws -> T { // ok item } - distributed func distReturnGenericWhere(item: Int) async throws -> T - where T: Sendable, T: Codable { // ok + distributed func distReturnGenericWhere(item: Int) async throws -> T where T: Codable { // ok fatalError() } - distributed func distBadReturnGeneric(int: Int) async throws -> T { + distributed func distBadReturnGeneric(int: Int) async throws -> T { // expected-error@-1 {{distributed function result type 'T' does not conform to 'Codable'}} fatalError() } - distributed func distGenericParam(value: T) async throws { // ok + distributed func distGenericParam(value: T) async throws { // ok fatalError() } - distributed func distGenericParamWhere(value: T) async throws -> T - where T: Sendable, T: Codable { // ok + distributed func distGenericParamWhere(value: T) async throws -> T where T: Codable { // ok value } - distributed func distBadGenericParam(int: T) async throws where T: Sendable { + distributed func distBadGenericParam(int: T) async throws { // expected-error@-1 {{distributed function parameter 'int' of type 'T' does not conform to 'Codable'}} fatalError() }