diff --git a/include/swift/AST/AnyFunctionRef.h b/include/swift/AST/AnyFunctionRef.h index 84c057c0871fb..ea558a6cb2a0b 100644 --- a/include/swift/AST/AnyFunctionRef.h +++ b/include/swift/AST/AnyFunctionRef.h @@ -96,7 +96,7 @@ class AnyFunctionRef { Type getBodyResultType() const { if (auto *AFD = TheFunction.dyn_cast()) { if (auto *FD = dyn_cast(AFD)) - return FD->mapTypeIntoContext(FD->getResultInterfaceType()); + return FD->mapTypeIntoContext(FD->getResultInterfaceTypeWithoutYields()); return TupleType::getEmpty(AFD->getASTContext()); } return cast(TheFunction)->getResultType(); @@ -311,25 +311,7 @@ class AnyFunctionRef { private: ArrayRef getYieldResultsImpl(SmallVectorImpl &buffer, - bool mapIntoContext) const { - assert(buffer.empty()); - if (auto *AFD = TheFunction.dyn_cast()) { - if (auto *AD = dyn_cast(AFD)) { - if (AD->isCoroutine()) { - auto valueTy = AD->getStorage()->getValueInterfaceType() - ->getReferenceStorageReferent(); - if (mapIntoContext) - valueTy = AD->mapTypeIntoContext(valueTy); - YieldTypeFlags flags(isYieldingMutableAccessor(AD->getAccessorKind()) - ? ParamSpecifier::InOut - : ParamSpecifier::LegacyShared); - buffer.push_back(AnyFunctionType::Yield(valueTy, flags)); - return buffer; - } - } - } - return {}; - } + bool mapIntoContext) const; }; #if SWIFT_COMPILER_IS_MSVC #pragma warning(pop) diff --git a/include/swift/AST/Decl.h b/include/swift/AST/Decl.h index e9e8ac7b82a9b..178585c22f062 100644 --- a/include/swift/AST/Decl.h +++ b/include/swift/AST/Decl.h @@ -7866,6 +7866,8 @@ class AbstractFunctionDecl : public GenericContext, public ValueDecl { /// attribute. bool isTransparent() const; + bool isCoroutine() const; + // Expose our import as member status ImportAsMemberStatus getImportAsMemberStatus() const { return ImportAsMemberStatus(Bits.AbstractFunctionDecl.IAMStatus); @@ -8506,9 +8508,15 @@ class FuncDecl : public AbstractFunctionDecl { return FnRetType.getSourceRange(); } - /// Retrieve the result interface type of this function. + /// Retrieve the full result interface type of this function, including yields Type getResultInterfaceType() const; + /// Same as above, but without @yields + Type getResultInterfaceTypeWithoutYields() const; + + /// Same as above, but only yields + Type getYieldsInterfaceType() const; + /// Returns the result interface type of this function if it has already been /// computed, otherwise `nullopt`. This should only be used for dumping. std::optional getCachedResultInterfaceType() const; diff --git a/include/swift/AST/DeclAttr.def b/include/swift/AST/DeclAttr.def index 8da6f1541ac01..eced456f2f920 100644 --- a/include/swift/AST/DeclAttr.def +++ b/include/swift/AST/DeclAttr.def @@ -899,7 +899,12 @@ DECL_ATTR(specialized, Specialized, AllowMultipleAttributes | LongAttribute | UserInaccessible | ABIStableToAdd | ABIStableToRemove | APIStableToAdd | APIStableToRemove | ForbiddenInABIAttr, 172) -LAST_DECL_ATTR(Specialized) +SIMPLE_DECL_ATTR(yield_once, Coroutine, + OnFunc, + UserInaccessible | ABIBreakingToAdd | ABIBreakingToRemove | APIBreakingToAdd | APIBreakingToRemove | EquivalentInABIAttr, + 173) + +LAST_DECL_ATTR(Coroutine) #undef DECL_ATTR_ALIAS #undef CONTEXTUAL_DECL_ATTR_ALIAS diff --git a/include/swift/AST/ExtInfo.h b/include/swift/AST/ExtInfo.h index f76e0fd36085e..5e1aff395a755 100644 --- a/include/swift/AST/ExtInfo.h +++ b/include/swift/AST/ExtInfo.h @@ -323,7 +323,7 @@ enum class SILFunctionTypeRepresentation : uint8_t { CFunctionPointer = uint8_t(FunctionTypeRepresentation::CFunctionPointer), /// The value of the greatest AST function representation. - LastAST = CFunctionPointer, + LastAST = uint8_t(FunctionTypeRepresentation::Last), /// The value of the least SIL-only function representation. FirstSIL = 8, @@ -523,8 +523,8 @@ class ASTExtInfoBuilder { // If bits are added or removed, then TypeBase::NumAFTExtInfoBits // and NumMaskBits must be updated, and they must match. // - // |representation|noEscape|concurrent|async|throws|isolation|differentiability| SendingResult | - // | 0 .. 3 | 4 | 5 | 6 | 7 | 8 .. 10 | 11 .. 13 | 14 | + // |representation|noEscape|concurrent|async|throws|isolation|differentiability| SendingResult | coroutine | + // | 0 .. 3 | 4 | 5 | 6 | 7 | 8 .. 10 | 11 .. 13 | 14 | 15 | // enum : unsigned { RepresentationMask = 0xF << 0, @@ -537,7 +537,8 @@ class ASTExtInfoBuilder { DifferentiabilityMaskOffset = 11, DifferentiabilityMask = 0x7 << DifferentiabilityMaskOffset, SendingResultMask = 1 << 14, - NumMaskBits = 15 + CoroutineMask = 1 << 15, + NumMaskBits = 16 }; static_assert(FunctionTypeIsolation::Mask == 0x7, "update mask manually"); @@ -616,6 +617,8 @@ class ASTExtInfoBuilder { constexpr bool hasSendingResult() const { return bits & SendingResultMask; } + constexpr bool isCoroutine() const { return bits & CoroutineMask; } + constexpr DifferentiabilityKind getDifferentiabilityKind() const { return DifferentiabilityKind((bits & DifferentiabilityMask) >> DifferentiabilityMaskOffset); @@ -732,6 +735,13 @@ class ASTExtInfoBuilder { clangTypeInfo, globalActor, thrownError, lifetimeDependencies); } + [[nodiscard]] + ASTExtInfoBuilder withCoroutine(bool coroutine = true) const { + return ASTExtInfoBuilder( + coroutine ? (bits | CoroutineMask) : (bits & ~CoroutineMask), + clangTypeInfo, globalActor, thrownError, lifetimeDependencies); + } + [[nodiscard]] ASTExtInfoBuilder withDifferentiabilityKind(DifferentiabilityKind differentiability) const { @@ -854,6 +864,8 @@ class ASTExtInfo { constexpr bool isThrowing() const { return builder.isThrowing(); } + constexpr bool isCoroutine() const { return builder.isCoroutine(); } + constexpr bool hasSendingResult() const { return builder.hasSendingResult(); } constexpr DifferentiabilityKind getDifferentiabilityKind() const { @@ -917,6 +929,14 @@ class ASTExtInfo { return builder.withThrows(true, Type()).build(); } + /// Helper method for changing only the coroutine field. + /// + /// Prefer using \c ASTExtInfoBuilder::withCoroutine for chaining. + [[nodiscard]] + ASTExtInfo withCoroutine(bool coroutine = true) const { + return builder.withCoroutine(coroutine).build(); + } + /// Helper method for changing only the async field. /// /// Prefer using \c ASTExtInfoBuilder::withAsync for chaining. diff --git a/include/swift/AST/TypeAttr.def b/include/swift/AST/TypeAttr.def index 4defd43cf1cdf..69c3f9032b023 100644 --- a/include/swift/AST/TypeAttr.def +++ b/include/swift/AST/TypeAttr.def @@ -68,6 +68,9 @@ TYPE_ATTR(isolated, Isolated) SIMPLE_TYPE_ATTR(nonisolated, Nonisolated) SIMPLE_TYPE_ATTR(_addressable, Addressable) SIMPLE_TYPE_ATTR(concurrent, Concurrent) +SIMPLE_TYPE_ATTR(yields, Yields) +SIMPLE_TYPE_ATTR(yield_once, YieldOnce) +SIMPLE_TYPE_ATTR(yield_once_2, YieldOnce2) // SIL-specific attributes SIMPLE_SIL_TYPE_ATTR(async, Async) @@ -103,9 +106,6 @@ SIL_TYPE_ATTR(opened, Opened) SIL_TYPE_ATTR(pack_element, PackElement) SIMPLE_SIL_TYPE_ATTR(pseudogeneric, Pseudogeneric) SIMPLE_SIL_TYPE_ATTR(unimplementable, Unimplementable) -SIMPLE_SIL_TYPE_ATTR(yields, Yields) -SIMPLE_SIL_TYPE_ATTR(yield_once, YieldOnce) -SIMPLE_SIL_TYPE_ATTR(yield_once_2, YieldOnce2) SIMPLE_SIL_TYPE_ATTR(yield_many, YieldMany) SIMPLE_SIL_TYPE_ATTR(captures_generics, CapturesGenerics) // Used at the SIL level to mark a type as moveOnly. diff --git a/include/swift/AST/TypeDifferenceVisitor.h b/include/swift/AST/TypeDifferenceVisitor.h index 5dde346477d7e..b9e9fce2f2357 100644 --- a/include/swift/AST/TypeDifferenceVisitor.h +++ b/include/swift/AST/TypeDifferenceVisitor.h @@ -172,6 +172,10 @@ class CanTypeDifferenceVisitor : public CanTypePairVisitor { type1->getElements(), type2->getElements()); } + bool visitYieldResultType(CanYieldResultType type1, CanYieldResultType type2) { + return asImpl().visit(type1.getResultType(), type2.getResultType()); + } + bool visitComponent(CanType type1, CanType type2, const TupleTypeElt &elt1, const TupleTypeElt &elt2) { if (elt1.getName() != elt2.getName()) diff --git a/include/swift/AST/TypeMatcher.h b/include/swift/AST/TypeMatcher.h index ab6d90eb2190d..8d638b56d1246 100644 --- a/include/swift/AST/TypeMatcher.h +++ b/include/swift/AST/TypeMatcher.h @@ -153,6 +153,17 @@ class TypeMatcher { return mismatch(firstTuple.getPointer(), secondType, sugaredFirstType); } + bool visitYieldResultType(CanYieldResultType firstType, Type secondType, + Type sugaredFirstType) { + if (auto secondYieldType = secondType->getAs()) + if (!this->visit(firstType.getResultType(), + secondYieldType->getResultType(), + sugaredFirstType->getAs()->getResultType())) + return false; + + return mismatch(firstType.getPointer(), secondType, sugaredFirstType); + } + bool visitSILPackType(CanSILPackType firstPack, Type secondType, Type sugaredFirstType) { if (auto secondPack = secondType->getAs()) { diff --git a/include/swift/AST/TypeNodes.def b/include/swift/AST/TypeNodes.def index b910f88e33e5f..da0dc76c94ae9 100644 --- a/include/swift/AST/TypeNodes.def +++ b/include/swift/AST/TypeNodes.def @@ -205,6 +205,7 @@ TYPE(InOut, Type) TYPE(Pack, Type) TYPE(PackExpansion, Type) TYPE(PackElement, Type) +TYPE(YieldResult, Type) UNCHECKED_TYPE(TypeVariable, Type) UNCHECKED_TYPE(ErrorUnion, Type) TYPE(Integer, Type) diff --git a/include/swift/AST/TypeTransform.h b/include/swift/AST/TypeTransform.h index e93f07b6b3eee..15f6e8a9a770b 100644 --- a/include/swift/AST/TypeTransform.h +++ b/include/swift/AST/TypeTransform.h @@ -1040,6 +1040,16 @@ case TypeKind::Id: t : InOutType::get(objectTy); } + case TypeKind::YieldResult: { + auto yield = cast(base); + auto objectTy = doIt(yield->getResultType(), TypePosition::Invariant); + if (!objectTy || objectTy->hasError()) + return objectTy; + + return objectTy.getPointer() == yield->getResultType().getPointer() ? + t : YieldResultType::get(objectTy, yield->isInOut()); + } + case TypeKind::Existential: { auto *existential = cast(base); auto constraint = doIt(existential->getConstraintType(), pos); diff --git a/include/swift/AST/Types.h b/include/swift/AST/Types.h index cc944a0b12f49..0d69e26eb134f 100644 --- a/include/swift/AST/Types.h +++ b/include/swift/AST/Types.h @@ -407,7 +407,7 @@ class alignas(1 << TypeAlignInBits) TypeBase } protected: - enum { NumAFTExtInfoBits = 15 }; + enum { NumAFTExtInfoBits = 16 }; enum { NumSILExtInfoBits = 14 }; // clang-format off @@ -437,7 +437,7 @@ class alignas(1 << TypeAlignInBits) TypeBase HasCachedType : 1 ); - SWIFT_INLINE_BITFIELD_FULL(AnyFunctionType, TypeBase, NumAFTExtInfoBits+1+1+1+1+16, + SWIFT_INLINE_BITFIELD_FULL(AnyFunctionType, TypeBase, NumAFTExtInfoBits+1+1+1+1+14, /// Extra information which affects how the function is called, like /// regparm and the calling convention. ExtInfoBits : NumAFTExtInfoBits, @@ -445,7 +445,7 @@ class alignas(1 << TypeAlignInBits) TypeBase HasClangTypeInfo : 1, HasThrownError : 1, HasLifetimeDependencies : 1, - NumParams : 15 + NumParams : 14 ); SWIFT_INLINE_BITFIELD_FULL(ArchetypeType, TypeBase, 1+1+16, @@ -1702,6 +1702,36 @@ class UnresolvedType : public TypeBase { }; DEFINE_EMPTY_CAN_TYPE_WRAPPER(UnresolvedType, Type) +class YieldResultType : public TypeBase { + Type ResultType; + bool InOut = false; + + YieldResultType(Type objectTy, bool InOut, const ASTContext *canonicalContext, + RecursiveTypeProperties properties) + : TypeBase(TypeKind::YieldResult, canonicalContext, properties), + ResultType(objectTy), InOut(InOut) {} + +public: + static YieldResultType *get(Type originalType, bool InOut); + + Type getResultType() const { return ResultType; } + bool isInOut() const { return InOut; } + + // Implement isa/cast/dyncast/etc. + static bool classof(const TypeBase *T) { + return T->getKind() == TypeKind::YieldResult; + } +}; + +BEGIN_CAN_TYPE_WRAPPER(YieldResultType, Type) + PROXY_CAN_TYPE_SIMPLE_GETTER(getResultType) + bool isInOut() const { + return getPointer()->isInOut(); + } + static CanYieldResultType get(CanType type, bool InOut) { + return CanYieldResultType(YieldResultType::get(type, InOut)); + } +END_CAN_TYPE_WRAPPER(YieldResultType, Type) /// BuiltinType - An abstract class for all the builtin types. class BuiltinType : public TypeBase { @@ -3874,6 +3904,9 @@ class AnyFunctionType : public TypeBase { /// Return the function type setting sendable to \p newValue. AnyFunctionType *withSendable(bool newValue) const; + /// Return the function type without yields (and coroutine flag) + AnyFunctionType *getWithoutYields() const; + /// True if the parameter declaration it is attached to is guaranteed /// to not persist the closure for longer than the duration of the call. bool isNoEscape() const { @@ -3886,6 +3919,8 @@ class AnyFunctionType : public TypeBase { bool isThrowing() const { return getExtInfo().isThrowing(); } + bool isCoroutine() const { return getExtInfo().isCoroutine(); } + bool hasSendingResult() const { return getExtInfo().hasSendingResult(); } bool hasEffect(EffectKind kind) const; diff --git a/include/swift/Demangling/DemangleNodes.def b/include/swift/Demangling/DemangleNodes.def index 8783d75428d34..8fac57360ad83 100644 --- a/include/swift/Demangling/DemangleNodes.def +++ b/include/swift/Demangling/DemangleNodes.def @@ -418,6 +418,8 @@ NODE(DependentGenericParamValueMarker) NODE(CoroFunctionPointer) NODE(DefaultOverride) NODE(ConstValue) +NODE(YieldResult) +NODE(Coroutine) #undef CONTEXT_NODE #undef NODE diff --git a/include/swift/Parse/Parser.h b/include/swift/Parse/Parser.h index 4d6c58ae69240..29bd65aa3fc7c 100644 --- a/include/swift/Parse/Parser.h +++ b/include/swift/Parse/Parser.h @@ -583,8 +583,8 @@ class Parser { bool isContextualYieldKeyword() { return (Tok.isContextualKeyword("yield") && - isa(CurDeclContext) && - cast(CurDeclContext)->isCoroutine()); + (isa(CurDeclContext) && + cast(CurDeclContext)->isCoroutine())); } /// Whether the current token is the contextual keyword for a \c then diff --git a/include/swift/SIL/AbstractionPattern.h b/include/swift/SIL/AbstractionPattern.h index 38eb1319d674f..6b22c4e62c226 100644 --- a/include/swift/SIL/AbstractionPattern.h +++ b/include/swift/SIL/AbstractionPattern.h @@ -1526,7 +1526,7 @@ class AbstractionPattern { /// Given that the value being abstracted is a function, return the /// abstraction pattern for its result type. - AbstractionPattern getFunctionResultType() const; + AbstractionPattern getFunctionResultType(bool withoutYields = false) const; /// Given that the value being abstracted is a function, return the /// abstraction pattern for its thrown error type. diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index c7b0d15309108..30bac2f7654e4 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -555,6 +555,8 @@ struct ASTContext::Implementation { llvm::DenseMap ReferenceStorageTypes; llvm::DenseMap LValueTypes; llvm::DenseMap InOutTypes; + llvm::DenseMap, + YieldResultType*> YieldResultTypes; llvm::DenseMap, DependentMemberType *> DependentMemberTypes; llvm::FoldingSet ErrorUnionTypes; @@ -3336,6 +3338,7 @@ size_t ASTContext::Implementation::Arena::getTotalMemory() const { llvm::capacity_in_bytes(ReferenceStorageTypes) + llvm::capacity_in_bytes(LValueTypes) + llvm::capacity_in_bytes(InOutTypes) + + llvm::capacity_in_bytes(YieldResultTypes) + llvm::capacity_in_bytes(DependentMemberTypes) + llvm::capacity_in_bytes(EnumTypes) + llvm::capacity_in_bytes(StructTypes) + @@ -3374,6 +3377,7 @@ void ASTContext::Implementation::Arena::dump(llvm::raw_ostream &os) const { SIZE_AND_BYTES(ReferenceStorageTypes); SIZE_AND_BYTES(LValueTypes); SIZE_AND_BYTES(InOutTypes); + SIZE_AND_BYTES(YieldResultTypes); SIZE_AND_BYTES(DependentMemberTypes); SIZE(ErrorUnionTypes); SIZE_AND_BYTES(PlaceholderTypes); @@ -5683,6 +5687,28 @@ InOutType *InOutType::get(Type objectTy) { properties); } +YieldResultType *YieldResultType::get(Type objectTy, bool InOut) { + auto properties = objectTy->getRecursiveProperties(); + if (InOut) { + assert(!objectTy->is() && !objectTy->is() && + "cannot have 'inout' or @lvalue wrapped inside an 'inout yield'"); + properties &= ~RecursiveTypeProperties::IsLValue; + } + + auto arena = getArena(properties); + + auto &C = objectTy->getASTContext(); + auto pair = llvm::PointerIntPair(objectTy.getPointer(), + InOut); + auto &entry = C.getImpl().getArena(arena).YieldResultTypes[pair]; + if (entry) + return entry; + + const ASTContext *canonicalContext = objectTy->isCanonical() ? &C : nullptr; + return entry = new (C, arena) YieldResultType(objectTy, InOut, canonicalContext, + properties); +} + DependentMemberType *DependentMemberType::get(Type base, Identifier name) { auto properties = base->getRecursiveProperties(); properties |= RecursiveTypeProperties::HasDependentMember; diff --git a/lib/AST/ASTDumper.cpp b/lib/AST/ASTDumper.cpp index cf0772419ed15..b9aadc94305d3 100644 --- a/lib/AST/ASTDumper.cpp +++ b/lib/AST/ASTDumper.cpp @@ -2805,6 +2805,7 @@ namespace { void printCommonFD(FuncDecl *FD, const char *type, Label label) { printCommonAFD(FD, type, label); printFlag(FD->isStatic(), "static", DeclModifierColor); + printFlag(FD->isCoroutine(), "@yield_once", DeclModifierColor); } void visitFuncDecl(FuncDecl *FD, Label label) { @@ -4967,6 +4968,7 @@ class PrintAttribute : public AttributeVisitor, TRIVIAL_ATTR_PRINTER(CompilerInitialized, compiler_initialized) TRIVIAL_ATTR_PRINTER(Consuming, consuming) TRIVIAL_ATTR_PRINTER(Convenience, convenience) + TRIVIAL_ATTR_PRINTER(Coroutine, coroutine) TRIVIAL_ATTR_PRINTER(DiscardableResult, discardable_result) TRIVIAL_ATTR_PRINTER(DisfavoredOverload, disfavored_overload) TRIVIAL_ATTR_PRINTER(DistributedActor, distributed_actor) @@ -6065,6 +6067,13 @@ namespace { printFoot(); } + void visitYieldResultType(YieldResultType *T, Label label) { + printCommon("yield", label); + printFlag(T->isInOut(), "inout"); + printRec(T->getResultType(), Label::always("type")); + printFoot(); + } + TRIVIAL_TYPE_PRINTER(Unresolved, unresolved) void visitPlaceholderType(PlaceholderType *T, Label label) { @@ -6485,6 +6494,7 @@ namespace { printFlag(T->isAsync(), "async"); printFlag(T->isThrowing(), "throws"); printFlag(T->hasSendingResult(), "sending_result"); + printFlag(T->isCoroutine(), "@yield_once"); if (T->isDifferentiable()) { switch (T->getDifferentiabilityKind()) { default: diff --git a/lib/AST/ASTMangler.cpp b/lib/AST/ASTMangler.cpp index 459ef9875d3e5..8cb0a0f091895 100644 --- a/lib/AST/ASTMangler.cpp +++ b/lib/AST/ASTMangler.cpp @@ -1897,6 +1897,11 @@ void ASTMangler::appendType(Type type, GenericSignature sig, return; } + case TypeKind::YieldResult: + appendType(cast(tybase)->getResultType(), sig, forDecl); + appendOperator("Yy"); + return; + case TypeKind::SILMoveOnlyWrapped: // If we hit this, we just mangle the underlying name and move on. llvm_unreachable("should never be mangled?"); @@ -3332,6 +3337,8 @@ void ASTMangler::appendFunctionType(AnyFunctionType *fn, GenericSignature sig, } else if (fn->isNoEscape()) { return appendOperator("XE"); } + if (fn->isCoroutine()) + return appendOperator("Xy"); return appendOperator("c"); case AnyFunctionType::Representation::CFunctionPointer: @@ -3587,7 +3594,10 @@ void ASTMangler::appendParameterTypeListElement( GenericSignature sig, const ValueDecl *forDecl) { if (auto *fnType = elementType->getAs()) appendFunctionType(fnType, sig, flags.isAutoClosure(), forDecl); - else + else if (auto *yieldType = elementType->getAs()) { + appendType(yieldType->getResultType(), sig, forDecl); + appendOperator("Yy"); + } else appendType(elementType, sig, forDecl); if (flags.isNoDerivative()) { diff --git a/lib/AST/ASTPrinter.cpp b/lib/AST/ASTPrinter.cpp index d23bcd445deec..2104f21a44af5 100644 --- a/lib/AST/ASTPrinter.cpp +++ b/lib/AST/ASTPrinter.cpp @@ -6186,6 +6186,13 @@ class TypePrinter : public TypeVisitor>"; } + void visitYieldResultType(YieldResultType *T, NonRecursivePrintOptions nrOption) { + if (T->isInOut()) + Printer << "inout "; + Printer << "@yields "; + visit(T->getResultType()); + } + void visitUnresolvedType(UnresolvedType *T, NonRecursivePrintOptions nrOptions) { if (Options.PrintTypesForDebugging) @@ -6610,6 +6617,10 @@ class TypePrinter : public TypeVisitor buf; switch (Options.PrintFunctionRepresentationAttrs) { case PrintOptions::FunctionRepresentationMode::None: diff --git a/lib/AST/ASTVerifier.cpp b/lib/AST/ASTVerifier.cpp index 039f5db5bd67b..f06aa7d598ba1 100644 --- a/lib/AST/ASTVerifier.cpp +++ b/lib/AST/ASTVerifier.cpp @@ -1098,7 +1098,7 @@ class Verifier : public ASTWalker { auto func = Functions.back(); Type resultType; if (auto *FD = dyn_cast(func)) { - resultType = FD->getResultInterfaceType(); + resultType = FD->getResultInterfaceTypeWithoutYields(); resultType = FD->mapTypeIntoContext(resultType); } else if (auto closure = dyn_cast(func)) { resultType = closure->getResultType(); diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index dcd0ea3195b02..4b7db33dc5863 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -1374,6 +1374,58 @@ bool AbstractFunctionDecl::isTransparent() const { return false; } +bool AbstractFunctionDecl::isCoroutine() const { + // Check if the declaration had the attribute. + if (getAttrs().hasAttribute()) + return true; + + // If this is an accessor, then check if its a coroutine. + if (const auto *AD = dyn_cast(this)) + return AD->isCoroutine(); + + return false; +} + +ArrayRef +AnyFunctionRef::getYieldResultsImpl(SmallVectorImpl &buffer, + bool mapIntoContext) const { + assert(buffer.empty()); + if (auto *AFD = getAbstractFunctionDecl()) { + if (AFD->isCoroutine()) { + auto fnType = AFD->getInterfaceType(); + if (fnType->hasError()) + return {}; + + auto resType = fnType->castTo()->getResult(); + if (auto *resFnType = resType->getAs()) + resType = resFnType->getResult(); + + auto addYieldInfo = + [&](const YieldResultType *yieldResultTy) { + Type valueTy = yieldResultTy->getResultType(); + if (mapIntoContext) + valueTy = AFD->mapTypeIntoContext(valueTy); + YieldTypeFlags flags(yieldResultTy->isInOut() ? + ParamSpecifier::InOut : ParamSpecifier::LegacyShared); + buffer.push_back(AnyFunctionType::Yield(valueTy, flags)); + }; + + if (auto *tupleResTy = resType->getAs()) + for (const auto &elt : tupleResTy->getElements()) { + Type eltTy = elt.getType(); + if (auto *yieldResTy = eltTy->getAs()) + addYieldInfo(yieldResTy); + } + else if (auto *yieldResTy = resType->getAs()) + addYieldInfo(yieldResTy); + + return buffer; + } + } + return {}; +} + + bool ParameterList::hasInternalParameter(StringRef Prefix) const { for (auto param : *this) { if (param->hasName() && param->getNameStr().starts_with(Prefix)) @@ -4054,6 +4106,7 @@ mapSignatureExtInfo(AnyFunctionType::ExtInfo info, .withAsync(info.isAsync()) .withThrows(info.isThrowing(), info.getThrownError()) .withClangFunctionType(info.getClangTypeInfo().getType()) + .withCoroutine(info.isCoroutine()) .build(); } @@ -11351,6 +11404,66 @@ std::optional FuncDecl::getCachedResultInterfaceType() const { return ResultTypeRequest{mutableThis}.getCachedResult(); } +Type FuncDecl::getResultInterfaceTypeWithoutYields() const { + auto resultType = getResultInterfaceType(); + if (resultType->hasError()) + return resultType; + + // Coroutine result type should either be a yield result + // or a tuple containing both yielded and normal result types. + // In both cases, strip the @yield result types + if (isCoroutine()) { + if (auto *tupleResTy = resultType->getAs()) { + // Strip @yield results on the first level of tuple + SmallVector elements; + for (const auto &elt : tupleResTy->getElements()) { + Type eltTy = elt.getType(); + if (eltTy->is()) + continue; + elements.push_back(elt); + } + + // Handle vanishing tuples -- flatten to produce the + // element type. + if (elements.size() == 1) + resultType = elements[0].getType(); + else + resultType = TupleType::get(elements, getASTContext()); + } else if (resultType->is()) { + resultType = TupleType::getEmpty(getASTContext()); + } + } + + return resultType; +} + +Type FuncDecl::getYieldsInterfaceType() const { + auto resultType = getResultInterfaceType(); + if (resultType->hasError()) + return resultType; + + if (!isCoroutine()) + return TupleType::getEmpty(getASTContext()); + + // Coroutine result type should either be a yield result + // or a tuple containing both yielded and normal result types. + // In both cases, strip the @yield result types + if (auto *tupleResTy = resultType->getAs()) { + // Keep @yield results on the first level of tuple + for (const auto &elt : tupleResTy->getElements()) { + Type eltTy = elt.getType(); + if (eltTy->is()) + return eltTy; + } + + llvm_unreachable("coroutine must have a yield result"); + } else if (resultType->is()) { + return resultType; + } + + return resultType; +} + bool FuncDecl::isUnaryOperator() const { if (!isOperator()) return false; diff --git a/lib/AST/ExistentialGeneralization.cpp b/lib/AST/ExistentialGeneralization.cpp index d12e2df63b305..3aee5d748fbd9 100644 --- a/lib/AST/ExistentialGeneralization.cpp +++ b/lib/AST/ExistentialGeneralization.cpp @@ -85,6 +85,12 @@ class Generalizer : public CanTypeVisitor { return type; } + // FIXME: Decide if we can generalize yield results at all + Type visitYieldResultType(CanYieldResultType origType) { + return YieldResultType::get(generalizeStructure(origType.getResultType()), + origType->isInOut()); + } + Type visitParameterizedProtocolType(CanParameterizedProtocolType origType) { // Generalize the argument types of parameterized protocols, // but don't generalize the base type. diff --git a/lib/AST/LifetimeDependence.cpp b/lib/AST/LifetimeDependence.cpp index 6e6612c29f5fe..c7052ff7c87b1 100644 --- a/lib/AST/LifetimeDependence.cpp +++ b/lib/AST/LifetimeDependence.cpp @@ -677,7 +677,8 @@ class LifetimeDependenceChecker { // needs one. Always runs before the checker completes if no other diagnostics // were issued. void diagnoseMissingResultDependencies(DiagID diagID) { - if (!isDiagnosedNonEscapable(getResultOrYield())) { + if (!isDiagnosedNonEscapable(getResultWithoutYield()) && + !isDiagnosedNonEscapable(getYields())) { return; } if (!depBuilder.hasTargetDeps(resultIndex)) { @@ -789,23 +790,35 @@ class LifetimeDependenceChecker { loweredOwnership == ValueOwnership::InOut; } - Type getResultOrYield() const { + Type getResultWithoutYield() const { auto *afd = cast(decl); - if (auto *accessor = dyn_cast(afd)) { - if (accessor->isCoroutine()) { - auto yieldTyInContext = accessor->mapTypeIntoContext( - accessor->getStorage()->getValueInterfaceType()); - return yieldTyInContext; - } - } Type resultType; if (auto fn = dyn_cast(afd)) { - resultType = fn->getResultInterfaceType(); + resultType = fn->getResultInterfaceTypeWithoutYields(); } else { auto ctor = cast(afd); resultType = ctor->getResultInterfaceType(); } - return afd->mapTypeIntoContext(resultType); + resultType = afd->mapTypeIntoContext(resultType); + if (resultType->isEqual(afd->getASTContext().TheEmptyTupleType)) + return ErrorType::get(afd->getASTContext()); + + return resultType; + } + + Type getYields() const { + auto *afd = cast(decl); + if (auto fn = dyn_cast(afd)) { + auto yieldType = afd->mapTypeIntoContext(fn->getYieldsInterfaceType()); + if (yieldType->isEqual(afd->getASTContext().TheEmptyTupleType)) + return ErrorType::get(afd->getASTContext()); + + if (yieldType->hasError()) + return yieldType; + + return yieldType->getAs()->getResultType(); + } + return ErrorType::get(afd->getASTContext()); } // ========================================================================== @@ -973,10 +986,14 @@ class LifetimeDependenceChecker { } targetIndex = targetDeclAndIndex->second; } else { - if (isDiagnosedEscapable(getResultOrYield())) { + if (isDiagnosedEscapable(getResultWithoutYield())) { diagnose(entry->getLoc(), diag::lifetime_target_requires_nonescapable, "result"); + } else if (isDiagnosedEscapable(getYields())) { + diagnose(entry->getLoc(), diag::lifetime_target_requires_nonescapable, + "yield"); } + targetIndex = afd->hasImplicitSelfDecl() ? afd->getParameters()->size() + 1 : afd->getParameters()->size(); @@ -1103,7 +1120,8 @@ class LifetimeDependenceChecker { } // Infer non-Escapable results. - if (isDiagnosedNonEscapable(getResultOrYield())) { + if (isDiagnosedNonEscapable(getResultWithoutYield()) || + isDiagnosedNonEscapable(getYields())) { if (isInit() && isImplicitOrSIL()) { inferImplicitInit(); } else if (hasImplicitSelfParam()) { @@ -1211,7 +1229,8 @@ class LifetimeDependenceChecker { // error. std::optional getImplicitAccessorResultDependence(AccessorDecl *accessor) { - if (!isDiagnosedNonEscapable(getResultOrYield())) + if (!isDiagnosedNonEscapable(getResultWithoutYield()) && + !isDiagnosedNonEscapable(getYields())) return std::nullopt; std::optional wrappedAccessorKind = std::nullopt; diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp index ddbb03bb29b23..672b7d8c1753e 100644 --- a/lib/AST/Type.cpp +++ b/lib/AST/Type.cpp @@ -277,6 +277,10 @@ bool CanType::isReferenceTypeImpl(CanType type, const GenericSignatureImpl *sig, #include "swift/AST/ReferenceStorage.def" return false; + case TypeKind::YieldResult: + return isReferenceTypeImpl(cast(type).getResultType(), + sig, functionsCount); + case TypeKind::GenericTypeParam: case TypeKind::DependentMember: assert(sig && "dependent types can't answer reference semantics query"); @@ -1816,6 +1820,13 @@ CanType TypeBase::computeCanonicalType() { break; } + case TypeKind::YieldResult: { + auto *ty = cast(this); + auto wrappedType = ty->getResultType()->getCanonicalType(); + Result = YieldResultType::get(wrappedType, ty->isInOut()); + break; + } + case TypeKind::Tuple: { TupleType *TT = cast(this); assert(TT->getNumElements() != 0 && "Empty tuples are always canonical"); @@ -4514,6 +4525,9 @@ ReferenceCounting TypeBase::getReferenceCounting() { ->getInnerType() ->getReferenceCounting(); + case TypeKind::YieldResult: + return cast(type)->getResultType()->getReferenceCounting(); + case TypeKind::PrimaryArchetype: case TypeKind::ExistentialArchetype: case TypeKind::OpaqueTypeArchetype: @@ -4666,6 +4680,39 @@ AnyFunctionType *AnyFunctionType::withSendable(bool newValue) const { return withExtInfo(info); } +AnyFunctionType *AnyFunctionType::getWithoutYields() const { + auto resultType = getResult(); + + if (auto *tupleResTy = resultType->getAs()) { + // Strip @yield results on the first level of tuple + SmallVector elements; + for (const auto &elt : tupleResTy->getElements()) { + Type eltTy = elt.getType(); + if (eltTy->is()) + continue; + elements.push_back(elt); + } + + // Handle vanishing tuples -- flatten to produce the + // normal coroutine result type + if (elements.size() == 1 && isCoroutine()) + resultType = elements[0].getType(); + else + resultType = TupleType::get(elements, getASTContext()); + } else if (resultType->is()) { + resultType = TupleType::getEmpty(getASTContext()); + } + + auto noCoroExtInfo = getExtInfo().intoBuilder() + .withCoroutine(false) + .build(); + if (isa(this)) + return FunctionType::get(getParams(), resultType, noCoroExtInfo); + assert(isa(this)); + return GenericFunctionType::get(getOptGenericSignature(), getParams(), + resultType, noCoroExtInfo); +} + std::optional AnyFunctionType::getEffectiveThrownErrorType() const { // A non-throwing function... has no thrown interface type. if (!isThrowing()) @@ -4724,6 +4771,19 @@ TypeBase::getAutoDiffTangentSpace(LookupConformanceFn lookupConformance) { return cache(TangentSpace::getTuple(tupleType)); } + // Yield result types are a bit special, but essentially tangent spaces of + // yields are yields of tangent space type. + if (auto *yieldResTy = getAs()) { + auto objectTanTy = + yieldResTy->getResultType()->getAutoDiffTangentSpace(lookupConformance); + if (!objectTanTy) + return cache(std::nullopt); + + auto *yieldTanType = YieldResultType::get(objectTanTy->getType(), + yieldResTy->isInOut()); + return cache(TangentSpace::getTangentVector(yieldTanType)); + } + // For `Differentiable`-conforming types: the tangent space is the // `TangentVector` associated type. auto *differentiableProtocol = @@ -4946,6 +5006,8 @@ AnyFunctionType::getAutoDiffDerivativeFunctionLinearMapType( // Compute the result linear map function type. FunctionType *linearMapType; + // FIXME: Verify ExtInfo state is correct, not working by accident. + FunctionType::ExtInfo info; switch (kind) { case AutoDiffLinearMapKind::Differential: { // Compute the differential type, returned by JVP functions. @@ -5004,6 +5066,9 @@ AnyFunctionType::getAutoDiffDerivativeFunctionLinearMapType( // Case 2: original function has wrt `inout` parameters. // - Original: `(T0, inout T1, ...) -> R` // - Pullback: `(R.Tan, inout T1.Tan) -> (T0.Tan, ...)` + // + // Special case: yields. They act as parameters, so will + // always be on result side. SmallVector pullbackResults; SmallVector semanticResultParams; for (auto i : range(diffParams.size())) { @@ -5026,21 +5091,19 @@ AnyFunctionType::getAutoDiffDerivativeFunctionLinearMapType( } pullbackResults.emplace_back(paramTan->getType()); } - Type pullbackResult; - if (pullbackResults.empty()) { - pullbackResult = ctx.TheEmptyTupleType; - } else if (pullbackResults.size() == 1) { - pullbackResult = pullbackResults.front().getType(); - } else { - pullbackResult = TupleType::get(pullbackResults, ctx); - } - // First accumulate non-inout results as pullback parameters. + // First accumulate ordinary result (not-semantic result parameters) as + // pullback parameters. SmallVector pullbackParams; for (auto i : range(resultTanTypes.size())) { auto resultTanType = resultTanTypes[i]; auto flags = ParameterTypeFlags().withInOut(false); - pullbackParams.push_back(AnyFunctionType::Param( - resultTanType, Identifier(), flags)); + if (resultTanType->is()) { + pullbackResults.emplace_back(resultTanType); + info = info.withCoroutine(true); + } else { + pullbackParams.push_back(AnyFunctionType::Param( + resultTanType, Identifier(), flags)); + } } // Then append semantic result parameters. for (auto i : range(semanticResultParams.size())) { @@ -5048,12 +5111,22 @@ AnyFunctionType::getAutoDiffDerivativeFunctionLinearMapType( auto semanticResultParamType = semanticResultParam.getPlainType(); auto semanticResultParamTan = semanticResultParamType->getAutoDiffTangentSpace(lookupConformance); + assert(!semanticResultParamType->is() && + "yields are always expected on result side"); auto flags = ParameterTypeFlags().withInOut(true); pullbackParams.push_back(AnyFunctionType::Param( semanticResultParamTan->getType(), Identifier(), flags)); } - // FIXME: Verify ExtInfo state is correct, not working by accident. - FunctionType::ExtInfo info; + + Type pullbackResult; + if (pullbackResults.empty()) { + pullbackResult = ctx.TheEmptyTupleType; + } else if (pullbackResults.size() == 1) { + pullbackResult = pullbackResults.front().getType(); + } else { + pullbackResult = TupleType::get(pullbackResults, ctx); + } + linearMapType = FunctionType::get(pullbackParams, pullbackResult, info); break; } diff --git a/lib/AST/TypeWalker.cpp b/lib/AST/TypeWalker.cpp index 9954fab3ca653..7d18fa82ef6ff 100644 --- a/lib/AST/TypeWalker.cpp +++ b/lib/AST/TypeWalker.cpp @@ -57,6 +57,10 @@ class Traversal : public TypeVisitor bool visitSILTokenType(SILTokenType *ty) { return false; } + bool visitYieldResultType(YieldResultType *ty) { + return doIt(ty->getResultType()); + } + bool visitPackType(PackType *ty) { for (auto elementTy : ty->getElementTypes()) if (doIt(elementTy)) diff --git a/lib/ASTGen/Sources/ASTGen/DeclAttrs.swift b/lib/ASTGen/Sources/ASTGen/DeclAttrs.swift index f6a5a96aed226..7c361d0dbe784 100644 --- a/lib/ASTGen/Sources/ASTGen/DeclAttrs.swift +++ b/lib/ASTGen/Sources/ASTGen/DeclAttrs.swift @@ -208,6 +208,8 @@ extension ASTGenVisitor { return handle(self.generateSimpleDeclAttr(attribute: node, kind: .AtRethrows)) case .Concurrent: return handle(self.generateSimpleDeclAttr(attribute: node, kind: .Concurrent)) + case .Coroutine: + fatalError("unimplemented") case nil where attrName == "_unavailableInEmbedded": return handle(self.generateUnavailableInEmbeddedAttr(attribute: node)?.asDeclAttribute) diff --git a/lib/ClangImporter/ImportType.cpp b/lib/ClangImporter/ImportType.cpp index 91de6cf22ee6e..5964ec2f84c92 100644 --- a/lib/ClangImporter/ImportType.cpp +++ b/lib/ClangImporter/ImportType.cpp @@ -2108,6 +2108,7 @@ class GetSendableType : VISIT(ExistentialType, recurse) NEVER_VISIT(LValueType) VISIT(InOutType, recurse) + NEVER_VISIT(YieldResultType) NEVER_VISIT(PackType) NEVER_VISIT(PackExpansionType) diff --git a/lib/Demangling/Demangler.cpp b/lib/Demangling/Demangler.cpp index 51ec6e27cddfc..589605acaa68d 100644 --- a/lib/Demangling/Demangler.cpp +++ b/lib/Demangling/Demangler.cpp @@ -1018,6 +1018,9 @@ NodePointer Demangler::demangleTypeAnnotation() { case 'u': return createType( createWithChild(Node::Kind::Sending, popTypeAndGetChild())); + case 'y': + return createType( + createWithChild(Node::Kind::YieldResult, popTypeAndGetChild())); default: return nullptr; } @@ -3870,6 +3873,8 @@ NodePointer Demangler::demangleSpecialType() { return popFunctionType(Node::Kind::ObjCBlock); case 'C': return popFunctionType(Node::Kind::CFunctionPointer); + case 'y': + return popFunctionType(Node::Kind::Coroutine); case 'g': case 'G': return demangleExtendedExistentialShape(specialChar); diff --git a/lib/Demangling/NodePrinter.cpp b/lib/Demangling/NodePrinter.cpp index 228289aa196ec..eab6bdef1630f 100644 --- a/lib/Demangling/NodePrinter.cpp +++ b/lib/Demangling/NodePrinter.cpp @@ -622,6 +622,8 @@ bool NodePrinter::isSimpleType(NodePointer Node) { case Node::Kind::DependentGenericParamValueMarker: case Node::Kind::CoroFunctionPointer: case Node::Kind::DefaultOverride: + case Node::Kind::YieldResult: + case Node::Kind::Coroutine: return false; } printer_unreachable("bad node kind"); @@ -1798,6 +1800,14 @@ NodePointer NodePrinter::print(NodePointer Node, unsigned depth, Printer << "inout "; print(Node->getChild(0), depth + 1); return nullptr; + case Node::Kind::YieldResult: + Printer << "@yields "; + print(Node->getChild(0), depth + 1); + return nullptr; + case Node::Kind::Coroutine: + Printer << "@yield_once "; + print(Node->getChild(0), depth + 1); + return nullptr; case Node::Kind::Isolated: Printer << "isolated "; print(Node->getChild(0), depth + 1); diff --git a/lib/Demangling/OldRemangler.cpp b/lib/Demangling/OldRemangler.cpp index d09cfc884521d..caea3826e7ffc 100644 --- a/lib/Demangling/OldRemangler.cpp +++ b/lib/Demangling/OldRemangler.cpp @@ -1823,6 +1823,16 @@ ManglingError Remangler::mangleImplInvocationSubstitutions(Node *node, return ManglingError::Success; } +ManglingError Remangler::mangleYieldResult(Node *node, unsigned depth) { + // The old mangler does not encode yield result. + return ManglingError::Success; +} + +ManglingError Remangler::mangleCoroutine(Node *node, unsigned depth) { + // The old mangler does not encode coroutines. + return ManglingError::Success; +} + ManglingError Remangler::mangleImplConvention(Node *node, unsigned depth) { DEMANGLER_ASSERT(node->getKind() == Node::Kind::ImplConvention, node); StringRef text = node->getText(); diff --git a/lib/Demangling/Remangler.cpp b/lib/Demangling/Remangler.cpp index b7ea08cfe3708..f5596df9090c3 100644 --- a/lib/Demangling/Remangler.cpp +++ b/lib/Demangling/Remangler.cpp @@ -840,6 +840,14 @@ ManglingError Remangler::mangleNoEscapeFunctionType(Node *node, return ManglingError::Success; } +ManglingError Remangler::mangleCoroutine(Node *node, + unsigned depth) { + RETURN_IF_ERROR( + mangleChildNodesReversed(node, depth + 1)); // argument tuple, result type + Buffer << "Xy"; + return ManglingError::Success; +} + ManglingError Remangler::mangleBoundGenericClass(Node *node, unsigned depth) { return mangleAnyNominalType(node, depth + 1); } @@ -2330,6 +2338,12 @@ ManglingError Remangler::mangleNoDerivative(Node *node, unsigned depth) { return ManglingError::Success; } +ManglingError Remangler::mangleYieldResult(Node *node, unsigned depth) { + RETURN_IF_ERROR(mangleSingleChildNode(node, depth + 1)); + Buffer << "Yy"; + return ManglingError::Success; +} + ManglingError Remangler::mangleInfixOperator(Node *node, unsigned depth) { mangleIdentifierImpl(node, /*isOperator*/ true); Buffer << "oi"; diff --git a/lib/IRGen/Fulfillment.cpp b/lib/IRGen/Fulfillment.cpp index 13cce27cc03a8..9696d5bed1e48 100644 --- a/lib/IRGen/Fulfillment.cpp +++ b/lib/IRGen/Fulfillment.cpp @@ -57,6 +57,7 @@ static bool isLeafTypeMetadata(CanType type) { case TypeKind::PackExpansion: case TypeKind::PackElement: case TypeKind::BuiltinTuple: + case TypeKind::YieldResult: llvm_unreachable("these types do not have metadata"); // All the builtin types are leaves. diff --git a/lib/IRGen/GenType.cpp b/lib/IRGen/GenType.cpp index d5cb390955fb6..e2fed2b08a3c4 100644 --- a/lib/IRGen/GenType.cpp +++ b/lib/IRGen/GenType.cpp @@ -2338,6 +2338,8 @@ const TypeInfo *TypeConverter::convertType(CanType ty) { return convertInOutType(cast(ty)); case TypeKind::Tuple: return convertTupleType(cast(ty)); + case TypeKind::YieldResult: + llvm_unreachable("AST YieldResultType should be lowered by SILGen"); case TypeKind::Function: case TypeKind::GenericFunction: llvm_unreachable("AST FunctionTypes should be lowered by SILGen"); diff --git a/lib/IRGen/IRGenDebugInfo.cpp b/lib/IRGen/IRGenDebugInfo.cpp index 3390f11f4b2f6..995e859d10d19 100644 --- a/lib/IRGen/IRGenDebugInfo.cpp +++ b/lib/IRGen/IRGenDebugInfo.cpp @@ -2326,6 +2326,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo { case TypeKind::BuiltinNonDefaultDistributedActorStorage: case TypeKind::SILMoveOnlyWrapped: case TypeKind::Integer: + case TypeKind::YieldResult: LLVM_DEBUG(llvm::dbgs() << "Unhandled type: "; DbgTy.getType()->dump(llvm::dbgs()); llvm::dbgs() << "\n"); MangledName = ""; diff --git a/lib/IRGen/MetadataRequest.cpp b/lib/IRGen/MetadataRequest.cpp index 9a325e8e6e85e..2a4e69fb06388 100644 --- a/lib/IRGen/MetadataRequest.cpp +++ b/lib/IRGen/MetadataRequest.cpp @@ -2223,6 +2223,10 @@ namespace { DynamicMetadataRequest request) { llvm_unreachable("error type should not appear in IRGen"); } + MetadataResponse visitYieldResultType(CanYieldResultType type, + DynamicMetadataRequest request) { + llvm_unreachable("yields should have been lowered by SILGen"); + } MetadataResponse visitIntegerType(CanIntegerType type, DynamicMetadataRequest request) { diff --git a/lib/SIL/IR/AbstractionPattern.cpp b/lib/SIL/IR/AbstractionPattern.cpp index 59fe0da628ed0..1ee762573d489 100644 --- a/lib/SIL/IR/AbstractionPattern.cpp +++ b/lib/SIL/IR/AbstractionPattern.cpp @@ -1171,11 +1171,15 @@ AbstractionPattern::getCXXMethodSelfPattern(CanType selfType) const { getGenericSignatureForFunctionComponent(), selfType); } -static CanType getResultType(CanType type) { - return cast(type).getResult(); +static CanType getResultType(CanType type, bool withoutYields) { + auto aft = cast(type); + if (withoutYields) + aft = CanAnyFunctionType(aft->getWithoutYields()); + + return aft.getResult(); } -AbstractionPattern AbstractionPattern::getFunctionResultType() const { +AbstractionPattern AbstractionPattern::getFunctionResultType(bool withoutYields) const { switch (getKind()) { case Kind::Invalid: llvm_unreachable("querying invalid abstraction pattern!"); @@ -1189,7 +1193,7 @@ AbstractionPattern AbstractionPattern::getFunctionResultType() const { return AbstractionPattern::getOpaque(); return AbstractionPattern(getGenericSubstitutions(), getGenericSignatureForFunctionComponent(), - getResultType(getType())); + getResultType(getType(), withoutYields)); case Kind::Discard: llvm_unreachable("don't need to discard function abstractions yet"); case Kind::ClangType: @@ -1198,33 +1202,34 @@ AbstractionPattern AbstractionPattern::getFunctionResultType() const { auto clangFunctionType = getClangFunctionType(getClangType()); return AbstractionPattern(getGenericSubstitutions(), getGenericSignatureForFunctionComponent(), - getResultType(getType()), + getResultType(getType(), withoutYields), clangFunctionType->getReturnType().getTypePtr()); } case Kind::CXXMethodType: case Kind::PartialCurriedCXXMethodType: return AbstractionPattern(getGenericSubstitutions(), getGenericSignatureForFunctionComponent(), - getResultType(getType()), + getResultType(getType(), withoutYields), getCXXMethod()->getReturnType().getTypePtr()); case Kind::CurriedObjCMethodType: return getPartialCurriedObjCMethod( getGenericSubstitutions(), getGenericSignatureForFunctionComponent(), - getResultType(getType()), + getResultType(getType(), withoutYields), getObjCMethod(), getEncodedForeignInfo()); case Kind::CurriedCFunctionAsMethodType: return getPartialCurriedCFunctionAsMethod( getGenericSubstitutions(), getGenericSignatureForFunctionComponent(), - getResultType(getType()), + getResultType(getType(), withoutYields), getClangType(), getImportAsMemberStatus()); case Kind::CurriedCXXMethodType: return getPartialCurriedCXXMethod(getGenericSubstitutions(), getGenericSignatureForFunctionComponent(), - getResultType(getType()), getCXXMethod(), + getResultType(getType(), withoutYields), + getCXXMethod(), getImportAsMemberStatus()); case Kind::PartialCurriedObjCMethodType: case Kind::ObjCMethodType: { @@ -1281,7 +1286,8 @@ AbstractionPattern AbstractionPattern::getFunctionResultType() const { return AbstractionPattern(getGenericSubstitutions(), getGenericSignatureForFunctionComponent(), - getResultType(getType()), clangResultType); + getResultType(getType(), withoutYields), + clangResultType); } default: @@ -1291,14 +1297,15 @@ AbstractionPattern AbstractionPattern::getFunctionResultType() const { return AbstractionPattern::getObjCCompletionHandlerArgumentsType( getGenericSubstitutions(), getGenericSignatureForFunctionComponent(), - getResultType(getType()), callbackParamTy, + getResultType(getType(), withoutYields), + callbackParamTy, getEncodedForeignInfo()); } } return AbstractionPattern(getGenericSubstitutions(), getGenericSignatureForFunctionComponent(), - getResultType(getType()), + getResultType(getType(), withoutYields), getObjCMethod()->getReturnType().getTypePtr()); } case Kind::OpaqueFunction: @@ -2907,10 +2914,9 @@ class SubstFunctionTypePatternVisitor addParam(param.getOrigFlags(), expansionType); } }); - - if (yieldType) { + + if (yieldType) substYieldType = visit(yieldType, yieldPattern); - } CanType newErrorType; @@ -2920,8 +2926,8 @@ class SubstFunctionTypePatternVisitor newErrorType = visit(errorType, errorPattern); } - auto newResultTy = visit(func.getResult(), - pattern.getFunctionResultType()); + auto newResultTy = visit(func->getWithoutYields()->getResult()->getCanonicalType(), + pattern.getFunctionResultType(/* withoutYields */ true)); std::optional extInfo; if (func->hasExtInfo()) @@ -2933,6 +2939,10 @@ class SubstFunctionTypePatternVisitor extInfo = extInfo->withThrows(true, newErrorType); } + // Yields were substituted separately + if (extInfo) + extInfo = extInfo->withCoroutine(false); + return CanFunctionType::get(FunctionType::CanParamArrayRef(newParams), newResultTy, extInfo); } diff --git a/lib/SIL/IR/SILFunctionType.cpp b/lib/SIL/IR/SILFunctionType.cpp index 8ba7870dec67e..200b3a2e9a3f1 100644 --- a/lib/SIL/IR/SILFunctionType.cpp +++ b/lib/SIL/IR/SILFunctionType.cpp @@ -1417,6 +1417,10 @@ class DestructureResults { return; } + // Skip yields, they should've already processed elsewhere + if (isa(substType)) + return; + auto &substResultTLForConvention = TC.getTypeLowering( origType, substType, TypeExpansionContext::minimal()); auto &substResultTL = TC.getTypeLowering(origType, substType, @@ -2317,23 +2321,22 @@ lowerCaptureContextParameters(TypeConverter &TC, SILDeclRef function, "iterating over loweredCaptures.getCaptures()."); } -static AccessorDecl * -getAsCoroutineAccessor(std::optional constant) { +static FuncDecl *getAsCoroutine(std::optional constant) { if (!constant || !constant->hasDecl()) return nullptr;; - auto accessor = dyn_cast(constant->getDecl()); - if (!accessor || !accessor->isCoroutine()) + auto fd = dyn_cast(constant->getDecl()); + if (!fd || !fd->isCoroutine()) return nullptr; - return accessor; + return fd; } static void destructureYieldsForReadAccessor(TypeConverter &TC, - TypeExpansionContext expansion, - AbstractionPattern origType, - CanType valueType, - SmallVectorImpl &yields){ + TypeExpansionContext expansion, + AbstractionPattern origType, + CanType valueType, + SmallVectorImpl &yields){ // Recursively destructure tuples. if (origType.isTuple()) { auto valueTupleType = cast(valueType); @@ -2365,17 +2368,12 @@ static void destructureYieldsForReadAccessor(TypeConverter &TC, static void destructureYieldsForCoroutine(TypeConverter &TC, TypeExpansionContext expansion, - std::optional constant, AbstractionPattern origType, CanType canValueType, - SmallVectorImpl &yields, - SILCoroutineKind &coroutineKind) { - auto accessor = getAsCoroutineAccessor(constant); - if (!accessor) - return; - + bool isInOutYield, + SmallVectorImpl &yields) { // 'modify' yields an inout of the target type. - if (isYieldingMutableAccessor(accessor->getAccessorKind())) { + if (isInOutYield) { auto loweredValueTy = TC.getLoweredType(origType, canValueType, expansion); yields.push_back(SILYieldInfo(loweredValueTy.getASTType(), @@ -2383,7 +2381,6 @@ static void destructureYieldsForCoroutine(TypeConverter &TC, } else { // 'read' yields a borrowed value of the target type, destructuring // tuples as necessary. - assert(isYieldingImmutableAccessor(accessor->getAccessorKind())); destructureYieldsForReadAccessor(TC, expansion, origType, canValueType, yields); } @@ -2511,38 +2508,58 @@ static CanSILFunctionType getSILFunctionType( bool hasSendingResult = substFnInterfaceType->getExtInfo().hasSendingResult(); - // Get the yield type for an accessor coroutine. + // Get the yield type for coroutine. SILCoroutineKind coroutineKind = SILCoroutineKind::None; AbstractionPattern coroutineOrigYieldType = AbstractionPattern::getInvalid(); CanType coroutineSubstYieldType; - if (auto accessor = getAsCoroutineAccessor(constant)) { - auto origAccessor = cast(origConstant->getDecl()); - auto &ctx = origAccessor->getASTContext(); - coroutineKind = + bool isInOutYield = false; + if (auto fd = getAsCoroutine(constant)) { // Derive yield type for declaration + auto origFd = cast(origConstant->getDecl()); + auto &ctx = origFd->getASTContext(); + if (auto accessor = dyn_cast(origFd)) { + coroutineKind = (requiresFeatureCoroutineAccessors(accessor->getAccessorKind()) && ctx.SILOpts.CoroutineAccessorsUseYieldOnce2) - ? SILCoroutineKind::YieldOnce2 - : SILCoroutineKind::YieldOnce; - - // Coroutine accessors are always native, so fetch the native - // abstraction pattern. - auto origStorage = origAccessor->getStorage(); - coroutineOrigYieldType = TC.getAbstractionPattern(origStorage, - /*nonobjc*/ true) - .getReferenceStorageReferentType(); - - auto storage = accessor->getStorage(); - auto valueType = storage->getValueInterfaceType(); + ? SILCoroutineKind::YieldOnce2 + : SILCoroutineKind::YieldOnce; + } else { + // FIXME: Decide we'd directly go to YieldOnce2 for non-accessor coroutines + coroutineKind = SILCoroutineKind::YieldOnce; + } + + // Coroutines are always native, so fetch the native abstraction pattern. + auto sig = origFd->getGenericSignatureOfContext() + .getCanonicalSignature(); + auto origYieldType = origFd->getYieldsInterfaceType()->castTo(); + auto reducedYieldType = sig.getReducedType(origYieldType->getResultType()); + coroutineOrigYieldType = AbstractionPattern(sig, reducedYieldType); + auto yieldType = fd->getYieldsInterfaceType()->castTo(); + auto valueType = yieldType->getResultType(); + isInOutYield = yieldType->isInOut(); if (reqtSubs) { valueType = valueType.subst(*reqtSubs); coroutineSubstYieldType = valueType->getReducedType( genericSig); } else { coroutineSubstYieldType = valueType->getReducedType( - accessor->getGenericSignature()); + fd->getGenericSignature()); } + } else if (substFnInterfaceType->isCoroutine()) { // Derive yield type for function type + coroutineKind = SILCoroutineKind::YieldOnce; + auto sig = origType.hasGenericSignature() ? origType.getGenericSignature() : genericSig; + auto origYieldType = origType.getFunctionResultType().getType()->castTo(); + auto reducedYieldType = sig.getReducedType(origYieldType->getResultType()); + coroutineOrigYieldType = AbstractionPattern(sig, reducedYieldType); + + auto yieldType = substFnInterfaceType->getResult()->castTo(); + auto valueType = yieldType->getResultType(); + isInOutYield = yieldType->isInOut(); + if (reqtSubs) + valueType = valueType.subst(*reqtSubs); + + coroutineSubstYieldType = valueType->getReducedType(genericSig); } bool shouldBuildSubstFunctionType = [&]{ @@ -2566,7 +2583,7 @@ static CanSILFunctionType getSILFunctionType( // for class override thunks. This is required to make the yields // match in abstraction to the base method's yields, which is necessary // to make the extracted continuation-function signatures match. - if (constant != origConstant && getAsCoroutineAccessor(constant)) + if (constant != origConstant && getAsCoroutine(constant)) return true; // We don't currently use substituted function types for generic function @@ -2670,10 +2687,12 @@ static CanSILFunctionType getSILFunctionType( // Destructure the coroutine yields. SmallVector yields; - destructureYieldsForCoroutine(TC, expansionContext, constant, - coroutineOrigYieldType, coroutineSubstYieldType, - yields, coroutineKind); - + if (coroutineKind != SILCoroutineKind::None) { + destructureYieldsForCoroutine(TC, expansionContext, + coroutineOrigYieldType, coroutineSubstYieldType, + isInOutYield, yields); + } + // Destructure the result tuple type. SmallVector results; { @@ -4977,6 +4996,8 @@ TypeConverter::getLoweredFormalTypes(SILDeclRef constant, extInfo = extInfo.withThrows(true, innerExtInfo.getThrownError()); if (innerExtInfo.isAsync()) extInfo = extInfo.withAsync(true); + if (innerExtInfo.isCoroutine()) + extInfo = extInfo.withCoroutine(true); // Distributed thunks are always `async throws` if (constant.isDistributedThunk()) { diff --git a/lib/SIL/IR/TypeLowering.cpp b/lib/SIL/IR/TypeLowering.cpp index fe81431b2da03..341f9b1621e61 100644 --- a/lib/SIL/IR/TypeLowering.cpp +++ b/lib/SIL/IR/TypeLowering.cpp @@ -605,6 +605,11 @@ namespace { IsTypeExpansionSensitive_t) { llvm_unreachable("shouldn't get an inout type here"); } + RetTy visitYieldResultType(CanYieldResultType type, + AbstractionPattern origType, + IsTypeExpansionSensitive_t) { + llvm_unreachable("shouldn't get an yield here"); + } RetTy visitErrorType(CanErrorType type, AbstractionPattern origType, IsTypeExpansionSensitive_t isSensitive) { @@ -4120,6 +4125,7 @@ getAnyFunctionRefInterfaceType(TypeConverter &TC, .withIsolation(funcType->getIsolation()) .withLifetimeDependencies(funcType->getLifetimeDependencies()) .withSendingResult(funcType->hasSendingResult()) + .withCoroutine(funcType->isCoroutine()) .build(); return CanAnyFunctionType::get( diff --git a/lib/SILGen/SILGenApply.cpp b/lib/SILGen/SILGenApply.cpp index fb0f622b8c050..b694c8da32965 100644 --- a/lib/SILGen/SILGenApply.cpp +++ b/lib/SILGen/SILGenApply.cpp @@ -5395,6 +5395,7 @@ class EndCoroutineApply : public Cleanup { if (forUnwind && CanUnwind) { SGF.B.createAbortApply(l, ApplyToken); } else { + // TODO: This is not correct when coroutine has a normal result SGF.B.createEndApply(l, ApplyToken, SILType::getEmptyTupleType(SGF.getASTContext())); } @@ -6475,17 +6476,19 @@ SILGenFunction::emitBeginApplyWithRethrow(SILLocation loc, SILValue fn, return {token, abortCleanup, allocation, deallocCleanup}; } -void SILGenFunction::emitEndApplyWithRethrow( +SILValue SILGenFunction::emitEndApplyWithRethrow( SILLocation loc, MultipleValueInstructionResult *token, - SILValue allocation) { + SILValue allocation, + SILType resultType) { // TODO: adjust this to handle results of TryBeginApplyInst. assert(token->isBeginApplyToken()); - B.createEndApply(loc, token, - SILType::getEmptyTupleType(getASTContext())); + SILValue result = + B.createEndApply(loc, token, resultType); if (allocation) { B.createDeallocStack(loc, allocation); } + return result; } void SILGenFunction::emitYield(SILLocation loc, diff --git a/lib/SILGen/SILGenFunction.cpp b/lib/SILGen/SILGenFunction.cpp index 37b5205224f8b..1c0c577307816 100644 --- a/lib/SILGen/SILGenFunction.cpp +++ b/lib/SILGen/SILGenFunction.cpp @@ -1121,7 +1121,7 @@ void SILGenFunction::emitFunction(FuncDecl *fd) { auto captureInfo = SGM.M.Types.getLoweredLocalCaptures(SILDeclRef(fd)); emitProlog(fd, captureInfo, fd->getParameters(), fd->getImplicitSelfDecl(), - fd->getResultInterfaceType(), fd->getEffectiveThrownErrorType(), + fd->getResultInterfaceTypeWithoutYields(), fd->getEffectiveThrownErrorType(), fd->getThrowsLoc()); if (fd->isDistributedActorFactory()) { @@ -1129,7 +1129,7 @@ void SILGenFunction::emitFunction(FuncDecl *fd) { emitDistributedActorFactory(fd); } else { prepareEpilog(fd, - fd->getResultInterfaceType(), + fd->getResultInterfaceTypeWithoutYields(), fd->getEffectiveThrownErrorType(), CleanupLocation(fd)); diff --git a/lib/SILGen/SILGenFunction.h b/lib/SILGen/SILGenFunction.h index 7708fb8b6587e..59ac0d67fd764 100644 --- a/lib/SILGen/SILGenFunction.h +++ b/lib/SILGen/SILGenFunction.h @@ -2353,9 +2353,10 @@ class LLVM_LIBRARY_VISIBILITY SILGenFunction bool canUnwind, SubstitutionMap subs, ArrayRef args, SmallVectorImpl &yields); - void emitEndApplyWithRethrow(SILLocation loc, - MultipleValueInstructionResult *token, - SILValue allocation); + SILValue emitEndApplyWithRethrow(SILLocation loc, + MultipleValueInstructionResult *token, + SILValue allocation, + SILType resultType); ManagedValue emitExtractFunctionIsolation(SILLocation loc, ArgumentSource &&fnValue); diff --git a/lib/SILGen/SILGenPoly.cpp b/lib/SILGen/SILGenPoly.cpp index 04bdba354370f..08a19a28478cc 100644 --- a/lib/SILGen/SILGenPoly.cpp +++ b/lib/SILGen/SILGenPoly.cpp @@ -108,6 +108,7 @@ #include "swift/AST/ProtocolConformance.h" #include "swift/AST/TypeCheckRequests.h" #include "swift/AST/Types.h" +#include "swift/SIL/ApplySite.h" #include "swift/SIL/PrettyStackTrace.h" #include "swift/SIL/AbstractionPatternGenerators.h" #include "swift/SIL/SILArgument.h" @@ -2996,14 +2997,15 @@ namespace { CanSILFunctionType loweredType, SubstitutionMap subs) { LoweredInfos = loweredType->getUnsubstitutedType(SGM.M)->getYields(); - auto accessor = cast(function.getDecl()); - auto storage = accessor->getStorage(); + auto origFd = cast(function.getDecl()); + auto sig = origFd->getGenericSignatureOfContext().getCanonicalSignature(); - OrigTypes.push_back( - SGM.Types.getAbstractionPattern(storage, /*nonobjc*/ true)); + auto origYieldType = origFd->getYieldsInterfaceType()->castTo(); + auto reducedYieldType = sig.getReducedType(origYieldType->getResultType()); + OrigTypes.emplace_back(sig, reducedYieldType); SmallVector yieldsBuffer; - auto yields = AnyFunctionRef(accessor).getYieldResults(yieldsBuffer); + auto yields = AnyFunctionRef(origFd).getYieldResults(yieldsBuffer); assert(yields.size() == 1); Yields.push_back(yields[0].getCanonical().subst(subs).asParam()); } @@ -5813,6 +5815,9 @@ static ManagedValue createThunk(SILGenFunction &SGF, assert(expectedType->getLanguage() == fn.getType().castTo()->getLanguage() && "bridging in re-abstraction thunk?"); + // We cannot reabstract coroutines (yet) + assert(!expectedType->isCoroutine() && !sourceType->isCoroutine() && + "cannot reabstract a coroutine"); // Declare the thunk. SubstitutionMap interfaceSubs; @@ -6470,14 +6475,75 @@ ManagedValue SILGenFunction::getThunkedAutoDiffLinearMap( } auto *linearMapArg = thunk->getArgumentsWithoutIndirectResults().back(); - auto *apply = thunkSGF.B.createApply(loc, linearMapArg, SubstitutionMap(), - arguments); - // Get return elements. - SmallVector results; // Extract all direct results. SmallVector directResults; - extractAllElements(apply, loc, thunkSGF.B, directResults); + FullApplySite fas; + if (fromType->isCoroutine()) { + SmallVector yields; + // Start inner coroutine execution till the suspend point + SubstitutionMap subs = thunk->getForwardingSubstitutionMap(); + SILType substFnType = linearMapArg->getType().substGenericArgs( + thunkSGF.getModule(), subs, thunk->getTypeExpansionContext()); + auto tokenAndCleanups = thunkSGF.emitBeginApplyWithRethrow( + loc, linearMapArg, substFnType, true, + SubstitutionMap(), arguments, yields); + auto token = std::get<0>(tokenAndCleanups); + auto abortCleanup = std::get<1>(tokenAndCleanups); + auto allocation = std::get<2>(tokenAndCleanups); + auto deallocCleanup = std::get<3>(tokenAndCleanups); + + { + SmallVector yieldMVs; + + // Prepare a destination for the unwind; use the current cleanup stack + // as the depth so that we branch right to it. + SILBasicBlock *unwindBB = thunkSGF.createBasicBlock(FunctionSection::Postmatter); + JumpDest unwindDest(unwindBB, thunkSGF.Cleanups.getCleanupsDepth(), + CleanupLocation(loc)); + + manageYields(thunkSGF, yields, substFnType.castTo()->getYields(), + yieldMVs); + + // Emit the yield. + thunkSGF.emitRawYield(loc, yieldMVs, unwindDest, /*unique*/ true); + + // Emit the unwind block. + { + SILGenSavedInsertionPoint savedIP(thunkSGF, unwindBB, + FunctionSection::Postmatter); + + // Emit all active cleanups. + thunkSGF.Cleanups.emitCleanupsForReturn(CleanupLocation(loc), IsForUnwind); + thunkSGF.B.createUnwind(loc); + } + } + + // Kill the normal abort cleanup without emitting it. + thunkSGF.Cleanups.setCleanupState(abortCleanup, CleanupState::Dead); + if (allocation) { + thunkSGF.Cleanups.setCleanupState(deallocCleanup, CleanupState::Dead); + } + + // End the inner coroutine normally. + auto resultTy = + thunk->mapTypeIntoContext( + fromType->getAllResultsSubstType(thunkSGF.getModule(), + thunkSGF.getTypeExpansionContext())); + auto endApply = + thunkSGF.emitEndApplyWithRethrow(loc, token, allocation, resultTy); + + extractAllElements(endApply, loc, thunkSGF.B, directResults); + fas = token->getParent(); + } else { + auto *apply = thunkSGF.B.createApply(loc, linearMapArg, SubstitutionMap(), + arguments); + extractAllElements(apply, loc, thunkSGF.B, directResults); + fas = apply; + } + + // Get return elements. + SmallVector results; // Handle self reordering. // For pullbacks: rotate direct results if self is direct. @@ -6496,7 +6562,7 @@ ManagedValue SILGenFunction::getThunkedAutoDiffLinearMap( } auto fromDirResultsIter = directResults.begin(); - auto fromIndResultsIter = apply->getIndirectSILResults().begin(); + auto fromIndResultsIter = fas.getIndirectSILResults().begin(); auto toIndResultsIter = thunkIndirectResults.begin(); // Reabstract results. for (unsigned resIdx : range(toType->getNumResults())) { @@ -6652,10 +6718,6 @@ SILFunction *SILGenModule::getOrCreateCustomDerivativeThunk( SILType substFnType = fnRef->getType().substGenericArgs( M, subs, thunk->getTypeExpansionContext()); - // Apply function argument. - auto apply = - thunkSGF.emitApplyWithRethrow(loc, fnRef, substFnType, subs, arguments); - // Self reordering thunk is necessary if wrt at least two parameters, // including self. auto shouldReorderSelf = [&]() { @@ -6692,18 +6754,66 @@ SILFunction *SILGenModule::getOrCreateCustomDerivativeThunk( thunkSGF.B.createReturn(loc, retValue); }; - if (!reorderSelf && linearMapFnType == targetLinearMapFnType) { - SmallVector results; + SmallVector results; + if (customDerivativeFnTy->isCoroutine()) { + assert(kind == AutoDiffDerivativeFunctionKind::VJP && + "only support VJP custom coroutine derivatives"); + + SmallVector yields; + // Start inner coroutine execution till the suspend point + auto tokenAndCleanups = thunkSGF.emitBeginApplyWithRethrow( + loc, fnRef, substFnType /*fnRef->getType()*/, true, + subs, arguments, yields); + auto token = std::get<0>(tokenAndCleanups); + auto abortCleanup = std::get<1>(tokenAndCleanups); + auto allocation = std::get<2>(tokenAndCleanups); + auto deallocCleanup = std::get<3>(tokenAndCleanups); + + // Forward yields + auto *customDerivativeAFD = + cast(customDerivativeFn->getDeclContext()->getAsDecl()); + auto thunkTy = thunkSGF.F.getLoweredFunctionType(); + YieldInfo innerYieldInfo(*this, SILDeclRef(customDerivativeAFD), fnRefType, + subs); + // FIXME: We do not have Decl for the thunk as it is generated entirely at SIL level. + // Fix the yield info in case when reabstraction of yields would be required + YieldInfo outerYieldInfo(*this, SILDeclRef(customDerivativeAFD), thunkTy, + thunk->getForwardingSubstitutionMap()); + translateYields(thunkSGF, loc, yields, innerYieldInfo, outerYieldInfo); + + // Kill the normal abort cleanup without emitting it. translateYields() will + // produce proper abort_apply & cleanups for inner coroutine call in the + // unwind block, and for normal return we're doing it manually below + thunkSGF.Cleanups.setCleanupState(abortCleanup, CleanupState::Dead); + if (allocation) { + thunkSGF.Cleanups.setCleanupState(deallocCleanup, CleanupState::Dead); + } + + // End the inner coroutine normally. + auto resultTy = + thunk->mapTypeIntoContext( + fnRefType->getAllResultsSubstType(M, + thunkSGF.getTypeExpansionContext())); + auto endApply = + thunkSGF.emitEndApplyWithRethrow(loc, token, allocation, resultTy); + + extractAllElements(endApply, loc, thunkSGF.B, results); + } else { + // Apply function argument. + auto apply = + thunkSGF.emitApplyWithRethrow(loc, fnRef, substFnType, subs, arguments); + extractAllElements(apply, loc, thunkSGF.B, results); - auto result = joinElements(results, thunkSGF.B, apply.getLoc()); + } + + if (!reorderSelf && linearMapFnType == targetLinearMapFnType) { + auto result = joinElements(results, thunkSGF.B, loc); createReturn(result); return thunk; } // Otherwise, apply reabstraction/self reordering thunk to linear map. - SmallVector directResults; - extractAllElements(apply, loc, thunkSGF.B, directResults); - auto linearMap = thunkSGF.emitManagedRValueWithCleanup(directResults.back()); + auto linearMap = thunkSGF.emitManagedRValueWithCleanup(results.back()); assert(linearMap.getType().castTo() == linearMapFnType); auto linearMapKind = kind.getLinearMapKind(); linearMap = thunkSGF.getThunkedAutoDiffLinearMap( @@ -6733,10 +6843,10 @@ SILFunction *SILGenModule::getOrCreateCustomDerivativeThunk( } // Return original results and thunked differential/pullback. - if (directResults.size() > 1) { - auto originalDirectResults = ArrayRef(directResults).drop_back(1); + if (results.size() > 1) { + auto originalDirectResults = ArrayRef(results).drop_back(1); auto originalDirectResult = - joinElements(originalDirectResults, thunkSGF.B, apply.getLoc()); + joinElements(originalDirectResults, thunkSGF.B, loc); auto thunkResult = joinElements( {originalDirectResult, linearMap.forward(thunkSGF)}, thunkSGF.B, loc); createReturn(thunkResult); @@ -7245,9 +7355,9 @@ SILGenFunction::emitVTableThunk(SILDeclRef base, } // End the inner coroutine normally. - emitEndApplyWithRethrow(loc, token, allocation); + result = emitEndApplyWithRethrow(loc, token, allocation, + SILType::getEmptyTupleType(getASTContext())); - result = B.createTuple(loc, {}); break; } @@ -7737,9 +7847,8 @@ void SILGenFunction::emitProtocolWitness( } // End the inner coroutine normally. - emitEndApplyWithRethrow(loc, token, allocation); - - reqtResultValue = B.createTuple(loc, {}); + reqtResultValue = emitEndApplyWithRethrow(loc, token, allocation, + SILType::getEmptyTupleType(getASTContext())); break; } diff --git a/lib/SILGen/SILGenProlog.cpp b/lib/SILGen/SILGenProlog.cpp index 1424062266d10..fa16a84192640 100644 --- a/lib/SILGen/SILGenProlog.cpp +++ b/lib/SILGen/SILGenProlog.cpp @@ -1568,6 +1568,10 @@ static void emitIndirectResultParameters(SILGenFunction &SGF, assert(!resultType->is()); + // Skip yields, they are emitted elsewhere + if (resultType->is()) + return; + // If the return type is address-only, emit the indirect return argument. // The calling convention always uses minimal resilience expansion. diff --git a/lib/SILOptimizer/Analysis/RegionAnalysis.cpp b/lib/SILOptimizer/Analysis/RegionAnalysis.cpp index c257a4b1d793f..4b3daac18d5d9 100644 --- a/lib/SILOptimizer/Analysis/RegionAnalysis.cpp +++ b/lib/SILOptimizer/Analysis/RegionAnalysis.cpp @@ -2659,6 +2659,13 @@ class PartitionOpTranslator { return translateSILBuiltin(bi); } + if (auto *eai = dyn_cast(inst)) { + // FIXME: This might not be not entirely correct. + auto *bai = eai->getBeginApply(); + return translateSILMultiAssign(eai->getResults(), + makeOperandRefRange(bai->getAllOperands())); + } + auto fas = FullApplySite::isa(inst); assert(bool(fas) && "Builtins should be handled above"); @@ -3509,7 +3516,6 @@ CONSTANT_TRANSLATION(EndUnpairedAccessInst, Ignored) CONSTANT_TRANSLATION(HopToExecutorInst, Ignored) CONSTANT_TRANSLATION(InjectEnumAddrInst, Ignored) CONSTANT_TRANSLATION(DestroyNotEscapedClosureInst, Ignored) -CONSTANT_TRANSLATION(EndApplyInst, Ignored) CONSTANT_TRANSLATION(AbortApplyInst, Ignored) CONSTANT_TRANSLATION(DebugStepInst, Ignored) CONSTANT_TRANSLATION(IncrementProfilerCounterInst, Ignored) @@ -3632,6 +3638,7 @@ CONSTANT_TRANSLATION(ApplyInst, Apply) CONSTANT_TRANSLATION(BeginApplyInst, Apply) CONSTANT_TRANSLATION(BuiltinInst, Apply) CONSTANT_TRANSLATION(TryApplyInst, Apply) +CONSTANT_TRANSLATION(EndApplyInst, Apply) //===--- // Asserting diff --git a/lib/SILOptimizer/Utils/SILInliner.cpp b/lib/SILOptimizer/Utils/SILInliner.cpp index 39a3aebffe7b8..7847e71d6b0e8 100644 --- a/lib/SILOptimizer/Utils/SILInliner.cpp +++ b/lib/SILOptimizer/Utils/SILInliner.cpp @@ -281,11 +281,22 @@ class BeginApplySite { for (auto calleeYield : BeginApply->getYieldedValues()) { calleeYield->replaceAllUsesWith(SILUndef::get(calleeYield)); } + + if (EndApply) + EndApply->replaceAllUsesWith(SILUndef::get(EndApply)); } // Remove the resumption sites. - if (EndApply) + if (EndApply) { + // All potential users of end_apply should've been replaced above. The only + // case where we might end with more users is when end_apply itself is + // unreachable. Make sure the function is well-formed and replace the + // results with undef. + if (!EndApply->use_empty()) + EndApply->replaceAllUsesWith(SILUndef::get(EndApply)); + EndApply->eraseFromParent(); + } if (AbortApply) AbortApply->eraseFromParent(); for (auto *EndBorrow : EndBorrows) diff --git a/lib/Sema/CSApply.cpp b/lib/Sema/CSApply.cpp index 0017b3cadbd8a..f418e38c62e3f 100644 --- a/lib/Sema/CSApply.cpp +++ b/lib/Sema/CSApply.cpp @@ -8059,6 +8059,7 @@ Expr *ExprRewriter::coerceToType(Expr *expr, Type toType, #define TYPE(Name, Parent) #include "swift/AST/TypeNodes.def" case TypeKind::Error: + case TypeKind::YieldResult: case TypeKind::Module: case TypeKind::Enum: case TypeKind::Struct: @@ -8147,6 +8148,7 @@ Expr *ExprRewriter::coerceToType(Expr *expr, Type toType, case TypeKind::GenericFunction: case TypeKind::LValue: case TypeKind::InOut: + case TypeKind::YieldResult: case TypeKind::Pack: case TypeKind::PackExpansion: case TypeKind::PackElement: diff --git a/lib/Sema/CSSimplify.cpp b/lib/Sema/CSSimplify.cpp index 00fce0f20f5f2..cb15591235414 100644 --- a/lib/Sema/CSSimplify.cpp +++ b/lib/Sema/CSSimplify.cpp @@ -7455,6 +7455,24 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind, locator.withPathElement( LocatorPathElt::GenericArgument(0))); } + + case TypeKind::YieldResult: { + if (kind != ConstraintKind::Bind && kind != ConstraintKind::Subtype) + return getTypeMatchFailure(locator); + + auto *yield1 = cast(desugar1); + auto *yield2 = cast(desugar2); + + // TODO: In theory we can convert inout yield to non-inout one, + // however, we disallow this for now as overall generic coroutine + // semantics is a bit vague. + if (yield1->isInOut() != yield2->isInOut()) + return getTypeMatchFailure(locator); + + return matchTypes(yield1->getResultType(), yield2->getResultType(), + ConstraintKind::Bind, subflags, + locator.withPathElement(ConstraintLocator::LValueConversion)); + } case TypeKind::Placeholder: { // If it's allowed to attempt fixes, let's delegate @@ -8567,6 +8585,7 @@ ConstraintSystem::simplifyConstructionConstraint( case TypeKind::Function: case TypeKind::LValue: case TypeKind::InOut: + case TypeKind::YieldResult: case TypeKind::Module: case TypeKind::Pack: case TypeKind::PackExpansion: diff --git a/lib/Sema/TypeCheckAttr.cpp b/lib/Sema/TypeCheckAttr.cpp index af34b013ca4b8..42fe289438217 100644 --- a/lib/Sema/TypeCheckAttr.cpp +++ b/lib/Sema/TypeCheckAttr.cpp @@ -475,6 +475,7 @@ class AttributeChecker : public AttributeVisitor { void visitAddressableSelfAttr(AddressableSelfAttr *attr); void visitAddressableForDependenciesAttr(AddressableForDependenciesAttr *attr); void visitUnsafeAttr(UnsafeAttr *attr); + void visitCoroutineAttr(CoroutineAttr *attr); }; } // end anonymous namespace @@ -2659,6 +2660,10 @@ void AttributeChecker::visitSILGenNameAttr(SILGenNameAttr *A) { } } +void AttributeChecker::visitCoroutineAttr(CoroutineAttr *attr) { + // FIXME: allow only on @differentiable for modify accessorts +} + void AttributeChecker::visitUsedAttr(UsedAttr *attr) { if (!allowSymbolLinkageMarkers(Ctx, D)) { diagnoseAndRemoveAttr(attr, diag::section_linkage_markers_disabled); @@ -6234,6 +6239,10 @@ static bool checkFunctionSignature( })) return false; + // Check that either both are coroutines or none + if (required->isCoroutine() != candidateFnTy->isCoroutine()) + return false; + // If required result type is not a function type, check that result types // match exactly. auto requiredResultFnTy = dyn_cast(required.getResult()); @@ -6259,19 +6268,17 @@ static bool checkFunctionSignature( return checkFunctionSignature(requiredResultFnTy, candidateResultTy); } -/// Returns an `AnyFunctionType` from the given parameters, result type, and -/// generic signature. +/// Returns an `AnyFunctionType` from the given parameters, result type, +/// generic signature, and `ExtInfo` static AnyFunctionType * makeFunctionType(ArrayRef parameters, Type resultType, - GenericSignature genericSignature) { - // FIXME: Verify ExtInfo state is correct, not working by accident. + GenericSignature genericSignature, + AnyFunctionType::ExtInfo extInfo) { if (genericSignature) { - GenericFunctionType::ExtInfo info; return GenericFunctionType::get(genericSignature, parameters, resultType, - info); + extInfo); } - FunctionType::ExtInfo info; - return FunctionType::get(parameters, resultType, info); + return FunctionType::get(parameters, resultType, extInfo); } /// Computes the original function type corresponding to the given derivative @@ -6290,14 +6297,16 @@ getDerivativeOriginalFunctionType(AnyFunctionType *derivativeFnTy) { currentLevel = currentLevel->getResult()->getAs(); } - auto derivativeResult = curryLevels.back()->getResult()->getAs(); + AnyFunctionType *lastType = curryLevels.back(); + auto derivativeResult = lastType->getResult()->getAs(); assert(derivativeResult && derivativeResult->getNumElements() == 2 && "Expected derivative result to be a two-element tuple"); auto originalResult = derivativeResult->getElement(0).getType(); auto *originalType = makeFunctionType( - curryLevels.back()->getParams(), originalResult, + lastType->getParams(), originalResult, curryLevels.size() == 1 ? derivativeFnTy->getOptGenericSignature() - : nullptr); + : nullptr, + lastType->getExtInfo()); // Wrap the derivative function type in additional curry levels. auto curryLevelsWithoutLast = @@ -6309,7 +6318,8 @@ getDerivativeOriginalFunctionType(AnyFunctionType *derivativeFnTy) { makeFunctionType(curryLevel->getParams(), originalType, i == curryLevelsWithoutLast.size() - 1 ? derivativeFnTy->getOptGenericSignature() - : nullptr); + : nullptr, + curryLevel->getExtInfo()); } return originalType; } @@ -6326,10 +6336,12 @@ getTransposeOriginalFunctionType(AnyFunctionType *transposeFnType, auto transposeParams = transposeFnType->getParams(); auto transposeResult = transposeFnType->getResult(); bool isCurried = transposeResult->is(); + AnyFunctionType::ExtInfo innerInfo; if (isCurried) { auto methodType = transposeResult->castTo(); transposeParams = methodType->getParams(); transposeResult = methodType->getResult(); + innerInfo = methodType->getExtInfo(); } // Get the original function's result type. @@ -6397,16 +6409,19 @@ getTransposeOriginalFunctionType(AnyFunctionType *transposeFnType, // `(Self) -> () -> `. if (isCurried) { assert(selfType && "`Self` type should be resolved"); - originalType = makeFunctionType(originalParams, originalResult, nullptr); + originalType = makeFunctionType(originalParams, originalResult, nullptr, + innerInfo); originalType = makeFunctionType(AnyFunctionType::Param(selfType), originalType, - transposeFnType->getOptGenericSignature()); + transposeFnType->getOptGenericSignature(), + transposeFnType->getExtInfo()); } // Otherwise, the original function type is simply: // `() -> `. else { originalType = makeFunctionType(originalParams, originalResult, - transposeFnType->getOptGenericSignature()); + transposeFnType->getOptGenericSignature(), + transposeFnType->getExtInfo()); } return originalType; } @@ -6980,10 +6995,12 @@ static bool typeCheckDerivativeAttr(DerivativeAttr *attr) { assert(derivativeTypeCtx); // Diagnose unsupported original accessor kinds. - // Currently, only getters and setters are supported. + // Currently, only getters, setters and _modify accessor are supported. + // FIXME: Support modify accessors (aka Modify2) if (originalName.AccessorKind.has_value()) { - if (*originalName.AccessorKind != AccessorKind::Get && - *originalName.AccessorKind != AccessorKind::Set) { + AccessorKind kind = *originalName.AccessorKind; + if (kind != AccessorKind::Get && kind != AccessorKind::Set && + kind != AccessorKind::Modify) { attr->setInvalid(); diags.diagnose( originalName.Loc, diag::derivative_attr_unsupported_accessor_kind, diff --git a/lib/Sema/TypeCheckDecl.cpp b/lib/Sema/TypeCheckDecl.cpp index 6ecc1023c0354..12c853f3d9587 100644 --- a/lib/Sema/TypeCheckDecl.cpp +++ b/lib/Sema/TypeCheckDecl.cpp @@ -2037,7 +2037,8 @@ ResultTypeRequest::evaluate(Evaluator &evaluator, ValueDecl *decl) const { if (auto *accessor = dyn_cast(decl)) { auto *storage = accessor->getStorage(); - switch (accessor->getAccessorKind()) { + auto kind = accessor->getAccessorKind(); + switch (kind) { // For getters, set the result type to the value type. case AccessorKind::Get: case AccessorKind::DistributedGet: @@ -2056,13 +2057,13 @@ ResultTypeRequest::evaluate(Evaluator &evaluator, ValueDecl *decl) const { case AccessorKind::MutableAddress: return buildAddressorResultType(accessor, storage->getValueInterfaceType()); - // Coroutine accessors don't mention the value type directly. - // If we add yield types to the function type, we'll need to update this. + // Coroutine accessors yield storage value types case AccessorKind::Read: case AccessorKind::Read2: case AccessorKind::Modify: case AccessorKind::Modify2: - return TupleType::getEmpty(ctx); + return YieldResultType::get(storage->getValueInterfaceType(), + isYieldingMutableAccessor(kind)); } } @@ -2108,6 +2109,9 @@ ResultTypeRequest::evaluate(Evaluator &evaluator, ValueDecl *decl) const { TypeResolutionOptions(TypeResolverContext::FunctionResult); if (decl->preconcurrency()) options |= TypeResolutionFlags::Preconcurrency; + if (const auto *const funcDecl = dyn_cast(decl)) + if (funcDecl->isCoroutine()) + options |= TypeResolutionFlags::Coroutine; auto *const dc = decl->getInnermostDeclContext(); return TypeResolution::forInterface(dc, options, @@ -2550,6 +2554,7 @@ InterfaceTypeRequest::evaluate(Evaluator &eval, ValueDecl *D) const { infoBuilder = infoBuilder.withNoEscape(fd->isDeferBody()); if (fd->hasSendingResult()) infoBuilder = infoBuilder.withSendingResult(); + infoBuilder = infoBuilder.withCoroutine(fd->isCoroutine()); } // Lifetime dependencies only apply to the outer function type. diff --git a/lib/Sema/TypeCheckDeclOverride.cpp b/lib/Sema/TypeCheckDeclOverride.cpp index 104bd0beeac61..8046c79b67a6e 100644 --- a/lib/Sema/TypeCheckDeclOverride.cpp +++ b/lib/Sema/TypeCheckDeclOverride.cpp @@ -1595,6 +1595,7 @@ namespace { UNINTERESTING_ATTR(CDecl) UNINTERESTING_ATTR(Concurrent) UNINTERESTING_ATTR(Consuming) + UNINTERESTING_ATTR(Coroutine) UNINTERESTING_ATTR(Documentation) UNINTERESTING_ATTR(Dynamic) UNINTERESTING_ATTR(DynamicCallable) diff --git a/lib/Sema/TypeCheckGeneric.cpp b/lib/Sema/TypeCheckGeneric.cpp index 2a51bb2253380..e4b5b3608be6e 100644 --- a/lib/Sema/TypeCheckGeneric.cpp +++ b/lib/Sema/TypeCheckGeneric.cpp @@ -928,8 +928,12 @@ GenericSignatureRequest::evaluate(Evaluator &evaluator, } }(); if (resultTypeRepr && !resultTypeRepr->hasOpaque()) { + bool isCoroutine = func ? func->isCoroutine() : false; + TypeResolutionOptions resultOptions(TypeResolverContext::FunctionResult); + if (isCoroutine) + resultOptions |= TypeResolutionFlags::Coroutine; const auto resultType = - resolution.withOptions(TypeResolverContext::FunctionResult) + resolution.withOptions(resultOptions) .resolveType(resultTypeRepr); inferenceSources.push_back(resultType.getPointer()); diff --git a/lib/Sema/TypeCheckStmt.cpp b/lib/Sema/TypeCheckStmt.cpp index 08477dc6a42fa..4907ec177fce1 100644 --- a/lib/Sema/TypeCheckStmt.cpp +++ b/lib/Sema/TypeCheckStmt.cpp @@ -1110,8 +1110,14 @@ class StmtChecker : public StmtVisitor { SmallVector buffer; auto TheFunc = AnyFunctionRef::fromDeclContext(DC); - auto yieldResults = TheFunc->getBodyYieldResults(buffer); + // Checking yields requires proper interface type. If decl is invalid, then + // we already emitted diagnostics elsewhere. + if (auto *AFD = TheFunc->getAbstractFunctionDecl()) { + if (AFD->isInvalid()) + return YS; + } + auto yieldResults = TheFunc->getBodyYieldResults(buffer); auto yieldExprs = YS->getMutableYields(); if (yieldExprs.size() != yieldResults.size()) { getASTContext().Diags.diagnose(YS->getYieldLoc(), diag::bad_yield_count, diff --git a/lib/Sema/TypeCheckStorage.cpp b/lib/Sema/TypeCheckStorage.cpp index 1db18251732ec..896a98b9c63b6 100644 --- a/lib/Sema/TypeCheckStorage.cpp +++ b/lib/Sema/TypeCheckStorage.cpp @@ -2490,8 +2490,9 @@ createCoroutineAccessorPrototype(AbstractStorageDecl *storage, // The forwarding index parameters. auto *params = buildIndexForwardingParamList(storage, {}, ctx); - // Coroutine accessors always return (). - const Type retTy = TupleType::getEmpty(ctx); + // Coroutine accessors yields storage value types + const Type retTy = YieldResultType::get(storage->getValueInterfaceType(), + isYieldingMutableAccessor(kind)); auto *accessor = AccessorDecl::create( ctx, loc, /*AccessorKeywordLoc=*/SourceLoc(), kind, storage, diff --git a/lib/Sema/TypeCheckType.cpp b/lib/Sema/TypeCheckType.cpp index 49179465b47eb..e88a6b566320d 100644 --- a/lib/Sema/TypeCheckType.cpp +++ b/lib/Sema/TypeCheckType.cpp @@ -3680,6 +3680,17 @@ TypeResolver::resolveAttributedType(TypeRepr *repr, TypeResolutionOptions option (void)claim(attrs); // TODO: add proper validation + if (auto yield = claim(attrs)) { + (void)yield; + // FIXME: What additional checks should we do here? + // FIXME: Turn into diagnostics + assert(options.contains(TypeResolutionFlags::Coroutine)); + // SIL yields are represented directly, no need to wrap them into special type + if (!options.contains(TypeResolutionFlags::SILType)) + ty = YieldResultType::get(ty, + options.is(TypeResolverContext::InoutFunctionInput)); + } + // There are a bunch of attributes in SIL that are essentially new // type constructors. Some of these are allowed even in AST positions; // other are only allowed in lowered types. @@ -4107,6 +4118,7 @@ NeverNullType TypeResolver::resolveASTFunctionType( } bool sendable = claim(attrs); + bool coroutine = claim(attrs); auto isolation = FunctionTypeIsolation::forNonIsolated(); @@ -4297,6 +4309,8 @@ NeverNullType TypeResolver::resolveASTFunctionType( auto resultOptions = options.withoutContext(); resultOptions.setContext(TypeResolverContext::FunctionResult); + if (coroutine) + resultOptions |= TypeResolutionFlags::Coroutine; auto outputTy = resolveType(repr->getResultTypeRepr(), resultOptions); if (outputTy->hasError()) { return ErrorType::get(ctx); @@ -4357,6 +4371,7 @@ NeverNullType TypeResolver::resolveASTFunctionType( .withSendable(sendable) .withAsync(repr->isAsync()) .withClangFunctionType(clangFnType) + .withCoroutine(coroutine) .build(); // SIL uses polymorphic function types to resolve overloaded member functions. @@ -4467,6 +4482,7 @@ NeverNullType TypeResolver::resolveSILFunctionType(FunctionTypeRepr *repr, default: llvm_unreachable("bad TypeAttrKind for TAR_SILCoroutine"); } + options |= TypeResolutionFlags::Coroutine; } ParameterConvention callee = ParameterConvention::Direct_Unowned; @@ -5182,12 +5198,20 @@ NeverNullType TypeResolver::resolveOwnershipTypeRepr(OwnershipTypeRepr *repr, TypeResolutionOptions options) { auto ownershipRepr = dyn_cast(repr); - // ownership is only valid for (non-Subscript and non-EnumCaseDecl) - // function parameters. - if (!options.is(TypeResolverContext::FunctionInput) || - options.hasBase(TypeResolverContext::SubscriptDecl) || - options.hasBase(TypeResolverContext::EnumElementDecl)) { + // ownership is only valid for (non-Subscript and non-EnumCaseDecl) + // function parameters or coroutine results (yields) + bool isCoroutineInOutYield = + (options.hasBase(TypeResolverContext::FunctionResult) || // decls + options.is(TypeResolverContext::FunctionResult)) && // function types + options.contains(TypeResolutionFlags::Coroutine) && + (ownershipRepr && + ownershipRepr->getSpecifier() == ParamSpecifier::InOut); + + if (!(options.is(TypeResolverContext::FunctionInput) && + !options.hasBase(TypeResolverContext::SubscriptDecl) && + !options.hasBase(TypeResolverContext::EnumElementDecl)) && + !isCoroutineInOutYield) { decltype(diag::attr_only_on_parameters) diagID; if (options.hasBase(TypeResolverContext::SubscriptDecl) || options.hasBase(TypeResolverContext::EnumElementDecl)) { @@ -5891,6 +5915,7 @@ NeverNullType TypeResolver::resolveTupleType(TupleTypeRepr *repr, !moveOnlyElementIndex.has_value() && !ty->hasUnboundGenericType() && !ty->hasTypeVariable() && + !ty->is() && !isa(tyR)) { auto contextTy = GenericEnvironment::mapTypeIntoContext( resolution.getGenericSignature().getGenericEnvironment(), ty); diff --git a/lib/Sema/TypeCheckType.h b/lib/Sema/TypeCheckType.h index dfc7ecec1426d..5b8fc9cc431fd 100644 --- a/lib/Sema/TypeCheckType.h +++ b/lib/Sema/TypeCheckType.h @@ -87,6 +87,9 @@ enum class TypeResolutionFlags : uint16_t { /// Whether the immediate context has an @escaping attribute. DirectEscaping = 1 << 14, + + /// We are in @yield_once coroutine declaration + Coroutine = 1 << 15, }; /// Type resolution contexts that require special handling. diff --git a/lib/Serialization/DeclTypeRecordNodes.def b/lib/Serialization/DeclTypeRecordNodes.def index 0ee58b5d3e668..15aabb8b457fc 100644 --- a/lib/Serialization/DeclTypeRecordNodes.def +++ b/lib/Serialization/DeclTypeRecordNodes.def @@ -124,6 +124,8 @@ TYPE(INTEGER) TYPE(BUILTIN_FIXED_ARRAY) +TYPE(YIELDS) + FIRST_DECL(TYPE_ALIAS, 50) DECL(GENERIC_TYPE_PARAM) DECL(ASSOCIATED_TYPE) diff --git a/lib/Serialization/Deserialization.cpp b/lib/Serialization/Deserialization.cpp index 1e89fd4a67926..56c5b501cb544 100644 --- a/lib/Serialization/Deserialization.cpp +++ b/lib/Serialization/Deserialization.cpp @@ -7308,6 +7308,20 @@ Expected DESERIALIZE_TYPE(NOMINAL_TYPE)( return NominalType::get(nominal, parentTy.get(), MF.getContext()); } +Expected DESERIALIZE_TYPE(YIELDS_TYPE)(ModuleFile &MF, + SmallVectorImpl &scratch, + StringRef blobData) { + TypeID yieldResultTyID; + bool isIonOut = false; + decls_block::YieldResultTypeLayout::readRecord(scratch, yieldResultTyID, isIonOut); + + auto yieldResultTy = MF.getTypeChecked(yieldResultTyID); + if (!yieldResultTy) + return yieldResultTy.takeError(); + + return YieldResultType::get(yieldResultTy.get(), isIonOut); +} + Expected DESERIALIZE_TYPE(TUPLE_TYPE)(ModuleFile &MF, SmallVectorImpl &scratch, StringRef blobData) { @@ -7345,7 +7359,7 @@ detail::function_deserializer::deserialize(ModuleFile &MF, StringRef blobData, bool isGeneric) { TypeID resultID; uint8_t rawRepresentation, rawDiffKind; - bool noescape = false, sendable, async, throws, hasSendingResult; + bool noescape = false, sendable, async, throws, hasSendingResult, coro; TypeID thrownErrorID; GenericSignature genericSig; TypeID clangTypeID; @@ -7355,12 +7369,12 @@ detail::function_deserializer::deserialize(ModuleFile &MF, decls_block::FunctionTypeLayout::readRecord( scratch, resultID, rawRepresentation, clangTypeID, noescape, sendable, async, throws, thrownErrorID, rawDiffKind, rawIsolation, - hasSendingResult); + hasSendingResult, coro); } else { GenericSignatureID rawGenericSig; decls_block::GenericFunctionTypeLayout::readRecord( scratch, resultID, rawRepresentation, sendable, async, throws, - thrownErrorID, rawDiffKind, rawIsolation, hasSendingResult, + thrownErrorID, rawDiffKind, rawIsolation, hasSendingResult, coro, rawGenericSig); genericSig = MF.getGenericSignature(rawGenericSig); clangTypeID = 0; @@ -7416,6 +7430,7 @@ detail::function_deserializer::deserialize(ModuleFile &MF, /*LifetimeDependenceInfo */ {}, hasSendingResult) .withSendable(sendable) .withAsync(async) + .withCoroutine(coro) .build(); auto resultTy = MF.getTypeChecked(resultID); diff --git a/lib/Serialization/DeserializeSIL.cpp b/lib/Serialization/DeserializeSIL.cpp index 020dc84653d4d..4d2232649be32 100644 --- a/lib/Serialization/DeserializeSIL.cpp +++ b/lib/Serialization/DeserializeSIL.cpp @@ -5135,7 +5135,8 @@ SILDeserializer::readDifferentiabilityWitness(DeclID DId) { ArrayRef(parameterAndResultIndices) .take_front(numParameterIndices)); auto numResults = originalFnType->getNumResults() + - originalFnType->getNumIndirectMutatingParameters(); + originalFnType->getNumIndirectMutatingParameters() + + originalFnType->getNumYields(); auto *resultIndices = IndexSubset::get(MF->getContext(), numResults, ArrayRef(parameterAndResultIndices) diff --git a/lib/Serialization/ModuleFormat.h b/lib/Serialization/ModuleFormat.h index 1711174b829b1..e09f816cf3885 100644 --- a/lib/Serialization/ModuleFormat.h +++ b/lib/Serialization/ModuleFormat.h @@ -58,7 +58,7 @@ const uint16_t SWIFTMODULE_VERSION_MAJOR = 0; /// describe what change you made. The content of this comment isn't important; /// it just ensures a conflict if two people change the module format. /// Don't worry about adhering to the 80-column limit for this line. -const uint16_t SWIFTMODULE_VERSION_MINOR = 960; // SILGlobalVariable parent module +const uint16_t SWIFTMODULE_VERSION_MINOR = 961; // coro AST /// A standard hash seed used for all string hashes in a serialized module. /// @@ -1332,6 +1332,12 @@ namespace decls_block { TypeIDField // type >; + TYPE_LAYOUT(YieldResultTypeLayout, + YIELDS_TYPE, + TypeIDField, // inner type + BCFixed<1> // inout? + ); + TYPE_LAYOUT(FunctionTypeLayout, FUNCTION_TYPE, TypeIDField, // output @@ -1344,7 +1350,8 @@ namespace decls_block { TypeIDField, // thrown error DifferentiabilityKindField, // differentiability kind FunctionTypeIsolationField, // isolation - BCFixed<1> // has sending result + BCFixed<1>, // has sending result + BCFixed<1> // coroutine? // trailed by parameters // Optionally lifetime dependence info ); @@ -1446,6 +1453,7 @@ namespace decls_block { DifferentiabilityKindField, // differentiability kind FunctionTypeIsolationField, // isolation BCFixed<1>, // has sending result + BCFixed<1>, // coroutine? GenericSignatureIDField // generic signature // trailed by parameters diff --git a/lib/Serialization/Serialization.cpp b/lib/Serialization/Serialization.cpp index e1b149205a6d6..b82e765a06ac1 100644 --- a/lib/Serialization/Serialization.cpp +++ b/lib/Serialization/Serialization.cpp @@ -5663,6 +5663,15 @@ class Serializer::TypeSerializer : public TypeVisitor { visitBuiltinTypeImpl(ty); } + void visitYieldResultType(const YieldResultType *ty) { + using namespace decls_block; + unsigned abbrCode = S.DeclTypeAbbrCodes[YieldResultTypeLayout::Code]; + + YieldResultTypeLayout::emitRecord(S.Out, S.ScratchRecord, abbrCode, + S.addTypeRef(ty->getResultType()), + ty->isInOut()); + } + void visitTypeAliasType(const TypeAliasType *alias) { using namespace decls_block; @@ -5939,7 +5948,8 @@ class Serializer::TypeSerializer : public TypeVisitor { S.addTypeRef(fnTy->getThrownError()), getRawStableDifferentiabilityKind(fnTy->getDifferentiabilityKind()), isolation, - fnTy->hasSendingResult()); + fnTy->hasSendingResult(), + fnTy->isCoroutine()); serializeFunctionTypeParams(fnTy); @@ -5961,7 +5971,7 @@ class Serializer::TypeSerializer : public TypeVisitor { fnTy->isSendable(), fnTy->isAsync(), fnTy->isThrowing(), S.addTypeRef(fnTy->getThrownError()), getRawStableDifferentiabilityKind(fnTy->getDifferentiabilityKind()), - isolation, fnTy->hasSendingResult(), + isolation, fnTy->hasSendingResult(), fnTy->isCoroutine(), S.addGenericSignatureRef(genericSig)); serializeFunctionTypeParams(fnTy); @@ -6396,6 +6406,8 @@ void Serializer::writeAllDeclsAndTypes() { registerDeclTypeAbbr(); + registerDeclTypeAbbr(); + registerDeclTypeAbbr(); registerDeclTypeAbbr(); registerDeclTypeAbbr(); diff --git a/lib/Serialization/SerializeSIL.cpp b/lib/Serialization/SerializeSIL.cpp index e496b30e2da8b..e8d2617146fe5 100644 --- a/lib/Serialization/SerializeSIL.cpp +++ b/lib/Serialization/SerializeSIL.cpp @@ -3547,11 +3547,9 @@ void SILSerializer::writeSILDifferentiabilityWitness( dw.getParameterIndices()->getCapacity() && "Original function parameter count should match differentiability " "witness parameter indices capacity"); - unsigned numInoutParameters = llvm::count_if( - originalFnType->getParameters(), [](SILParameterInfo paramInfo) { - return paramInfo.isIndirectMutating(); - }); - assert(originalFnType->getNumResults() + numInoutParameters == + assert(originalFnType->getNumResults() + + originalFnType->getNumIndirectMutatingParameters() + + originalFnType->getNumYields() == dw.getResultIndices()->getCapacity() && "Original function result count should match differentiability " "witness result indices capacity"); diff --git a/stdlib/public/Differentiation/ArrayDifferentiation.swift b/stdlib/public/Differentiation/ArrayDifferentiation.swift index 6441efde932f2..883cc86383de6 100644 --- a/stdlib/public/Differentiation/ArrayDifferentiation.swift +++ b/stdlib/public/Differentiation/ArrayDifferentiation.swift @@ -170,10 +170,15 @@ where Element: AdditiveArithmetic & Differentiable { @inlinable public subscript(_ index: Int) -> Element { - if index < base.count { - return base[index] - } else { - return Element.zero + get { + if index < base.count { + return base[index] + } else { + return Element.zero + } + } + _modify { + yield &base[index] } } } @@ -228,6 +233,21 @@ extension Array where Element: Differentiable { return (self[index], differential) } + @inlinable + @derivative(of: subscript._modify) + @yield_once + mutating func _vjpModify(index: Int) -> ( + value: inout @yields Element, pullback: @yield_once (inout TangentVector) -> inout @yields Element.TangentVector + ) { + yield &self[index] + + @yield_once + func pullback(_ v: inout TangentVector) -> inout @yields Element.TangentVector { + yield &v[index] + } + return pullback + } + @inlinable @derivative(of: +) static func _vjpConcatenate(_ lhs: Self, _ rhs: Self) -> ( diff --git a/test/AutoDiff/SILGen/witness_table.swift b/test/AutoDiff/SILGen/witness_table.swift index 4f631f4067dc2..6874a370af9b0 100644 --- a/test/AutoDiff/SILGen/witness_table.swift +++ b/test/AutoDiff/SILGen/witness_table.swift @@ -116,12 +116,12 @@ struct Struct: Protocol { // CHECK-NEXT: method #Protocol.property!setter: (inout Self) -> (Float) -> () : @$s13witness_table6StructVAA8ProtocolA2aDP8propertySfvsTW // CHECK-NEXT: method #Protocol.property!setter.jvp.SS.: (inout Self) -> (Float) -> () : @AD__$s13witness_table6StructVAA8ProtocolA2aDP8propertySfvsTW_jvp_SS // CHECK-NEXT: method #Protocol.property!setter.vjp.SS.: (inout Self) -> (Float) -> () : @AD__$s13witness_table6StructVAA8ProtocolA2aDP8propertySfvsTW_vjp_SS -// CHECK-NEXT: method #Protocol.property!modify: (inout Self) -> () -> () : @$s13witness_table6StructVAA8ProtocolA2aDP8propertySfvMTW +// CHECK-NEXT: method #Protocol.property!modify: (inout Self) -> @yield_once () -> inout @yields Float : @$s13witness_table6StructVAA8ProtocolA2aDP8propertySfvMTW // CHECK-NEXT: method #Protocol.subscript!getter: (Self) -> (Float, Float) -> Float : @$s13witness_table6StructVAA8ProtocolA2aDPyS2f_SftcigTW // CHECK-NEXT: method #Protocol.subscript!getter.jvp.SUS.: (Self) -> (Float, Float) -> Float : @AD__$s13witness_table6StructVAA8ProtocolA2aDPyS2f_SftcigTW_jvp_SUS // CHECK-NEXT: method #Protocol.subscript!getter.vjp.SUS.: (Self) -> (Float, Float) -> Float : @AD__$s13witness_table6StructVAA8ProtocolA2aDPyS2f_SftcigTW_vjp_SUS // CHECK-NEXT: method #Protocol.subscript!setter: (inout Self) -> (Float, Float, Float) -> () : @$s13witness_table6StructVAA8ProtocolA2aDPyS2f_SftcisTW // CHECK-NEXT: method #Protocol.subscript!setter.jvp.USUS.: (inout Self) -> (Float, Float, Float) -> () : @AD__$s13witness_table6StructVAA8ProtocolA2aDPyS2f_SftcisTW_jvp_USUS // CHECK-NEXT: method #Protocol.subscript!setter.vjp.USUS.: (inout Self) -> (Float, Float, Float) -> () : @AD__$s13witness_table6StructVAA8ProtocolA2aDPyS2f_SftcisTW_vjp_USUS -// CHECK-NEXT: method #Protocol.subscript!modify: (inout Self) -> (Float, Float) -> () : @$s13witness_table6StructVAA8ProtocolA2aDPyS2f_SftciMTW +// CHECK-NEXT: method #Protocol.subscript!modify: (inout Self) -> @yield_once (Float, Float) -> inout @yields Float : @$s13witness_table6StructVAA8ProtocolA2aDPyS2f_SftciMTW // CHECK: } diff --git a/test/AutoDiff/SILOptimizer/activity_analysis.swift b/test/AutoDiff/SILOptimizer/activity_analysis.swift index c29cdd99ad83a..a7c488f21a5ac 100644 --- a/test/AutoDiff/SILOptimizer/activity_analysis.swift +++ b/test/AutoDiff/SILOptimizer/activity_analysis.swift @@ -641,8 +641,6 @@ func testAccessorCoroutinesModify(_ x: HasCoroutineModifyAccessors) -> Float { func testBeginApplyActiveInoutArgument(array: [Float], x: Float) -> Float { var array = array // Array subscript assignment below calls `Array.subscript.modify`. - // expected-error @+2 {{expression is not differentiable}} - // expected-note @+1 {{cannot differentiate functions that have not been marked '@differentiable' and that are defined in other files}} array[0] = x return array[0] } @@ -678,8 +676,6 @@ func testBeginApplyActiveButInitiallyNonactiveInoutArgument(x: Float) -> Float { // `var array` is initially non-active. var array: [Float] = [0] // Array subscript assignment below calls `Array.subscript.modify`. - // expected-error @+2 {{expression is not differentiable}} - // expected-note @+1 {{cannot differentiate functions that have not been marked '@differentiable' and that are defined in other files}} array[0] = x return array[0] } @@ -764,7 +760,7 @@ func testClassModifyAccessor(_ c: inout C) { // CHECK: [VARIED] %7 = load [copy] %6 : $*C // CHECK: [VARIED] %9 = class_method %7 : $C, #C.float!getter : (C) -> () -> Float, $@convention(method) (@guaranteed C) -> Float // CHECK: [VARIED] %10 = apply %9(%7) : $@convention(method) (@guaranteed C) -> Float -// CHECK: [VARIED] %12 = class_method %4 : $C, #C.float!modify : (C) -> () -> (), $@yield_once @convention(method) (@guaranteed C) -> @yields @inout Float +// CHECK: [VARIED] %12 = class_method %4 : $C, #C.float!modify : (C) -> @yield_once () -> inout @yields Float, $@yield_once @convention(method) (@guaranteed C) -> @yields @inout Float // CHECK: [VARIED] (**%13**, %14) = begin_apply %12(%4) : $@yield_once @convention(method) (@guaranteed C) -> @yields @inout Float // CHECK: [VARIED] (%13, **%14**) = begin_apply %12(%4) : $@yield_once @convention(method) (@guaranteed C) -> @yields @inout Float // CHECK: [NONE] // function_ref static Float.*= infix(_:_:) diff --git a/test/AutoDiff/SILOptimizer/differentiation_diagnostics.swift b/test/AutoDiff/SILOptimizer/differentiation_diagnostics.swift index bc7c3bb71c22b..d86beb8268cd2 100644 --- a/test/AutoDiff/SILOptimizer/differentiation_diagnostics.swift +++ b/test/AutoDiff/SILOptimizer/differentiation_diagnostics.swift @@ -779,7 +779,7 @@ public func fragileDifferentiable(_ x: Float) -> Float { } //===----------------------------------------------------------------------===// -// Coroutines (SIL function yields, `begin_apply`) (not yet supported) +// Coroutines (SIL function yields, `begin_apply`) //===----------------------------------------------------------------------===// struct HasReadAccessors: Differentiable { @@ -819,8 +819,6 @@ func testModifyAccessorCoroutines(_ x: HasModifyAccessors) -> Float { func TF_1078(array: [Float], x: Float) -> Float { var array = array // Array subscript assignment below calls `Array.subscript.modify`. - // expected-error @+2 {{expression is not differentiable}} - // expected-note @+1 {{cannot differentiate functions that have not been marked '@differentiable' and that are defined in other files}} array[0] = x return array[0] } @@ -830,8 +828,6 @@ func TF_1078(array: [Float], x: Float) -> Float { func TF_1115(_ x: Float) -> Float { var array: [Float] = [0] // Array subscript assignment below calls `Array.subscript.modify`. - // expected-error @+2 {{expression is not differentiable}} - // expected-note @+1 {{cannot differentiate functions that have not been marked '@differentiable' and that are defined in other files}} array[0] = x return array[0] } diff --git a/test/AutoDiff/Sema/derivative_attr_type_checking.swift b/test/AutoDiff/Sema/derivative_attr_type_checking.swift index 4fdebeddd5276..677625a1d8b0d 100644 --- a/test/AutoDiff/Sema/derivative_attr_type_checking.swift +++ b/test/AutoDiff/Sema/derivative_attr_type_checking.swift @@ -451,10 +451,10 @@ extension Struct where T: Differentiable & AdditiveArithmetic { fatalError() } - // expected-error @+1 {{cannot register derivative for _modify accessor}} @derivative(of: computedProperty._modify) - mutating func vjpPropertyModify(_ newValue: T) -> ( - value: (), pullback: (inout TangentVector) -> T.TangentVector + @yield_once + mutating func vjpPropertyModify() -> ( + value: inout @yields T, pullback: @yield_once (inout TangentVector) -> inout @yields T.TangentVector ) { fatalError() } diff --git a/test/AutoDiff/validation-test/array.swift b/test/AutoDiff/validation-test/array.swift index 9e0bf322c5558..c9d41bbee0ecd 100644 --- a/test/AutoDiff/validation-test/array.swift +++ b/test/AutoDiff/validation-test/array.swift @@ -36,9 +36,23 @@ ArrayAutoDiffTests.test("ArraySubscript") { return array[0] + array[1] + array[2] } + func modifyArray(_ array: [Float]) -> Float { + var array = array + var result: Float = 0 + for index in withoutDerivative(at: 0 ..< array.count) { + let multiplier = 1.0 + Float(index) + array[index] *= multiplier + result += array[index] + } + + return result + } expectEqual( FloatArrayTan([1, 1, 1, 0, 0, 0]), gradient(at: [2, 3, 4, 5, 6, 7], of: sumFirstThree)) + expectEqual( + FloatArrayTan([1, 2, 3]), + gradient(at: [1, 1, 1], of: modifyArray)) } ArrayAutoDiffTests.test("ArrayLiteral") { diff --git a/test/IRGen/default_override.sil b/test/IRGen/default_override.sil index 88c4fe6e4cb00..e889defb92578 100644 --- a/test/IRGen/default_override.sil +++ b/test/IRGen/default_override.sil @@ -28,19 +28,19 @@ sil @B_i_modify : $@yield_once @convention(method) (@guaranteed B) -> @yields @i sil @B_i_modify2 : $@yield_once_2 @convention(method) (@guaranteed B) -> @yields @inout Int sil_vtable B { - #B.i!read: (B) -> () -> () : @B_i_read - #B.i!read2: (B) -> () -> () : @B_i_read2 + #B.i!read: (B) -> @yield_once () -> @yields Int : @B_i_read + #B.i!read2: (B) -> @yield_once () -> @yields Int : @B_i_read2 #B.i!setter: (B) -> (Int) -> () : @B_i_set - #B.i!modify: (B) -> () -> () : @B_i_modify - #B.i!modify2: (B) -> () -> () : @B_i_modify2 + #B.i!modify: (B) -> @yield_once () -> inout @yields Int : @B_i_modify + #B.i!modify2: (B) -> @yield_once () -> inout @yields Int : @B_i_modify2 } sil @B_i_read2_default_override : $@yield_once_2 @convention(method) (@guaranteed B) -> @yields Int sil @B_i_modify2_default_override : $@yield_once_2 @convention(method) (@guaranteed B) -> @yields @inout Int sil_default_override_table B { - #B.i!read2: #B.i!read: (B) -> () -> () : @B_i_read2_default_override - #B.i!modify2: #B.i!modify: (B) -> () -> () : @B_i_modify2_default_override + #B.i!read2: #B.i!read: (B) -> @yield_once () -> @yields Int : @B_i_read2_default_override + #B.i!modify2: #B.i!modify: (B) -> @yield_once () -> inout @yields Int : @B_i_modify2_default_override } // CHECK: %swift.method_default_override_descriptor = type { i32, i32, i32 } diff --git a/test/Parse/coroutine_accessors_ambiguity.swift b/test/Parse/coroutine_accessors_ambiguity.swift index 90aa16252f904..e0e060912a9e9 100644 --- a/test/Parse/coroutine_accessors_ambiguity.swift +++ b/test/Parse/coroutine_accessors_ambiguity.swift @@ -17,7 +17,7 @@ func read(_ c : () -> T) -> T { c() } // disabled: ok! var im : Int { modify { // expected-enabled-error{{variable with a 'modify' accessor must also have a getter, addressor, or 'read' accessor}} - 1 // expected-enabled-warning{{integer literal is unused}} + 1 // expected-enabled-error{{unexpected non-void return value in void function}} } } @@ -25,6 +25,6 @@ var im : Int { // disabled: ok! var ir : Int { read { - 1 // expected-enabled-warning{{integer literal is unused}} + 1 // expected-enabled-error{{unexpected non-void return value in void function}} } } diff --git a/test/SIL/Parser/default_override.sil b/test/SIL/Parser/default_override.sil index 19cc6b35bfd27..ac91e1baa41a9 100644 --- a/test/SIL/Parser/default_override.sil +++ b/test/SIL/Parser/default_override.sil @@ -24,21 +24,21 @@ sil @B_i_modify : $@yield_once @convention(method) (@guaranteed B) -> @yields @i sil @B_i_modify2 : $@yield_once_2 @convention(method) (@guaranteed B) -> @yields @inout Int sil_vtable B { - #B.i!read: (B) -> () -> () : @B_i_read - #B.i!read2: (B) -> () -> () : @B_i_read2 + #B.i!read: (B) -> @yield_once () -> @yields Int : @B_i_read + #B.i!read2: (B) -> @yield_once () -> @yields Int : @B_i_read2 #B.i!setter: (B) -> (Int) -> () : @B_i_set - #B.i!modify: (B) -> () -> () : @B_i_modify - #B.i!modify2: (B) -> () -> () : @B_i_modify2 + #B.i!modify: (B) -> @yield_once () -> inout @yields Int : @B_i_modify + #B.i!modify2: (B) -> @yield_once () -> inout @yields Int : @B_i_modify2 } sil @B_i_read2_default_override : $@yield_once_2 @convention(method) (@guaranteed B) -> @yields Int sil @B_i_modify2_default_override : $@yield_once_2 @convention(method) (@guaranteed B) -> @yields @inout Int // CHECK-LABEL: sil_default_override_table B { -// CHECK-NEXT: #B.i!read2: #B.i!read: (B) -> () -> () : @B_i_read2_default_override -// CHECK-NEXT: #B.i!modify2: #B.i!modify: (B) -> () -> () : @B_i_modify2_default_override +// CHECK-NEXT: #B.i!read2: #B.i!read: (B) -> @yield_once () -> @yields Int : @B_i_read2_default_override +// CHECK-NEXT: #B.i!modify2: #B.i!modify: (B) -> @yield_once () -> inout @yields Int : @B_i_modify2_default_override // CHECK-NEXT: } sil_default_override_table B { - #B.i!read2: #B.i!read: (B) -> () -> () : @B_i_read2_default_override - #B.i!modify2: #B.i!modify: (B) -> () -> () : @B_i_modify2_default_override + #B.i!read2: #B.i!read: (B) -> @yield_once () -> @yields Int : @B_i_read2_default_override + #B.i!modify2: #B.i!modify: (B) -> @yield_once () -> inout @yields Int : @B_i_modify2_default_override } diff --git a/test/SIL/Parser/overloaded_member.sil b/test/SIL/Parser/overloaded_member.sil index 151e02fe99abb..9cde855c03574 100644 --- a/test/SIL/Parser/overloaded_member.sil +++ b/test/SIL/Parser/overloaded_member.sil @@ -53,7 +53,7 @@ class B { sil [ossa] @test_overloaded_subscript : $@convention(thin) (@guaranteed B, B.Index) -> () { bb0(%0 : @guaranteed $B, %1 : $B.Index): - %reader = class_method %0 : $B, #B.subscript!read : (B) -> (B.Index) -> (), $@convention(method) @yield_once (B.Index, @guaranteed B) -> @yields @guaranteed B.Element + %reader = class_method %0 : $B, #B.subscript!read : (B) -> @yield_once (B.Index) -> @yields B.Element, $@convention(method) @yield_once (B.Index, @guaranteed B) -> @yields @guaranteed B.Element (%element, %token) = begin_apply %reader(%1, %0) : $@convention(method) @yield_once (B.Index, @guaranteed B) -> @yields @guaranteed B.Element end_apply %token as $() diff --git a/test/SIL/Serialization/default_override.sil b/test/SIL/Serialization/default_override.sil index 2ee938086a4cf..c0956d8c0ce77 100644 --- a/test/SIL/Serialization/default_override.sil +++ b/test/SIL/Serialization/default_override.sil @@ -26,21 +26,21 @@ sil @B_i_modify : $@yield_once @convention(method) (@guaranteed B) -> @yields @i sil @B_i_modify2 : $@yield_once_2 @convention(method) (@guaranteed B) -> @yields @inout Int sil_vtable B { - #B.i!read: (B) -> () -> () : @B_i_read - #B.i!read2: (B) -> () -> () : @B_i_read2 + #B.i!read: (B) -> @yield_once () -> @yields Int : @B_i_read + #B.i!read2: (B) -> @yield_once () -> @yields Int : @B_i_read2 #B.i!setter: (B) -> (Int) -> () : @B_i_set - #B.i!modify: (B) -> () -> () : @B_i_modify - #B.i!modify2: (B) -> () -> () : @B_i_modify2 + #B.i!modify: (B) -> @yield_once () -> inout @yields Int : @B_i_modify + #B.i!modify2: (B) -> @yield_once () -> inout @yields Int : @B_i_modify2 } sil @B_i_read2_default_override : $@yield_once_2 @convention(method) (@guaranteed B) -> @yields Int sil @B_i_modify2_default_override : $@yield_once_2 @convention(method) (@guaranteed B) -> @yields @inout Int // CHECK-LABEL: sil_default_override_table B { -// CHECK-NEXT: #B.i!read2: #B.i!read: (B) -> () -> () : @B_i_read2_default_override -// CHECK-NEXT: #B.i!modify2: #B.i!modify: (B) -> () -> () : @B_i_modify2_default_override +// CHECK-NEXT: #B.i!read2: #B.i!read: (B) -> @yield_once () -> @yields Int : @B_i_read2_default_override +// CHECK-NEXT: #B.i!modify2: #B.i!modify: (B) -> @yield_once () -> inout @yields Int : @B_i_modify2_default_override // CHECK-NEXT: } sil_default_override_table B { - #B.i!read2: #B.i!read: (B) -> () -> () : @B_i_read2_default_override - #B.i!modify2: #B.i!modify: (B) -> () -> () : @B_i_modify2_default_override + #B.i!read2: #B.i!read: (B) -> @yield_once () -> @yields Int : @B_i_read2_default_override + #B.i!modify2: #B.i!modify: (B) -> @yield_once () -> inout @yields Int : @B_i_modify2_default_override } diff --git a/test/SIL/concurrentclosure_capture_verify_canonical_addressonly.sil b/test/SIL/concurrentclosure_capture_verify_canonical_addressonly.sil index d1233950cbeae..03321b40984cd 100644 --- a/test/SIL/concurrentclosure_capture_verify_canonical_addressonly.sil +++ b/test/SIL/concurrentclosure_capture_verify_canonical_addressonly.sil @@ -74,7 +74,7 @@ bb0(%0 : $*T): destroy_value %15 : $@Sendable @callee_guaranteed () -> () // id: %22 destroy_value %11 : $F // id: %23 %24 = begin_access [modify] [dynamic] %9 : $*T // users: %31, %26 - %25 = witness_method $T, #MyProt.k!modify : (inout Self) -> () -> () : $@yield_once @convention(witness_method: MyProt) <τ_0_0 where τ_0_0 : MyProt> (@inout τ_0_0) -> @yields @inout FakeOptional // user: %26 + %25 = witness_method $T, #MyProt.k!modify : (inout Self) -> @yield_once () -> inout @yields FakeOptional : $@yield_once @convention(witness_method: MyProt) <τ_0_0 where τ_0_0 : MyProt> (@inout τ_0_0) -> @yields @inout FakeOptional // user: %26 (%26, %27) = begin_apply %25(%24) : $@yield_once @convention(witness_method: MyProt) <τ_0_0 where τ_0_0 : MyProt> (@inout τ_0_0) -> @yields @inout FakeOptional // users: %29, %30 // function_ref inoutUserOptKlass(_:) %28 = function_ref @$s37concurrentfunction_capturediagnostics17inoutUserOptKlassyyAA0F0CSgzF : $@convention(thin) (@inout FakeOptional) -> () // user: %29 diff --git a/test/SIL/concurrentclosure_capture_verify_raw.sil b/test/SIL/concurrentclosure_capture_verify_raw.sil index 7b5421f7309a7..8a524d4c76539 100644 --- a/test/SIL/concurrentclosure_capture_verify_raw.sil +++ b/test/SIL/concurrentclosure_capture_verify_raw.sil @@ -107,7 +107,7 @@ bb0(%0 : $*T): destroy_value %15 : $@Sendable @callee_guaranteed () -> () // id: %22 destroy_value %11 : $F // id: %23 %24 = begin_access [modify] [dynamic] %9 : $*T // users: %31, %26 - %25 = witness_method $T, #MyProt.k!modify : (inout Self) -> () -> () : $@yield_once @convention(witness_method: MyProt) <τ_0_0 where τ_0_0 : MyProt> (@inout τ_0_0) -> @yields @inout FakeOptional // user: %26 + %25 = witness_method $T, #MyProt.k!modify : (inout Self) -> @yield_once () -> inout @yields FakeOptional : $@yield_once @convention(witness_method: MyProt) <τ_0_0 where τ_0_0 : MyProt> (@inout τ_0_0) -> @yields @inout FakeOptional // user: %26 (%26, %27) = begin_apply %25(%24) : $@yield_once @convention(witness_method: MyProt) <τ_0_0 where τ_0_0 : MyProt> (@inout τ_0_0) -> @yields @inout FakeOptional // users: %29, %30 // function_ref inoutUserOptKlass(_:) %28 = function_ref @$s37concurrentfunction_capturediagnostics17inoutUserOptKlassyyAA0F0CSgzF : $@convention(thin) (@inout FakeOptional) -> () // user: %29 diff --git a/test/SILGen/addressors.swift b/test/SILGen/addressors.swift index a9829aff4ee53..c3f76d966f851 100644 --- a/test/SILGen/addressors.swift +++ b/test/SILGen/addressors.swift @@ -343,10 +343,10 @@ struct Foo: FooProtocol { // CHECK-LABEL: sil_vtable Base { // CHECK-NEXT: #Base.data!getter: (Base) -> () -> UnsafeMutablePointer : @$s10addressors4BaseC4dataSpys5Int32VGvg // CHECK-NEXT: #Base.data!setter: (Base) -> (UnsafeMutablePointer) -> () : @$s10addressors4BaseC4dataSpys5Int32VGvs -// CHECK-NEXT: #Base.data!modify: (Base) -> () -> () : @$s10addressors4BaseC4dataSpys5Int32VGvM +// CHECK-NEXT: #Base.data!modify: (Base) -> @yield_once () -> inout @yields UnsafeMutablePointer : @$s10addressors4BaseC4dataSpys5Int32VGvM // CHECK-NEXT: #Base.value!getter: (Base) -> () -> Int32 : @$s10addressors4BaseC5values5Int32Vvg // CHECK-NEXT: #Base.value!setter: (Base) -> (Int32) -> () : @$s10addressors4BaseC5values5Int32Vvs -// CHECK-NEXT: #Base.value!modify: (Base) -> () -> () : @$s10addressors4BaseC5values5Int32VvM +// CHECK-NEXT: #Base.value!modify: (Base) -> @yield_once () -> inout @yields Int32 : @$s10addressors4BaseC5values5Int32VvM // CHECK-NEXT: #Base.init!allocator: (Base.Type) -> () -> Base : @$s10addressors4BaseCACycfC // CHECK-NEXT: #Base.deinit!deallocator: @$s10addressors4BaseCfD // CHECK-NEXT: } @@ -354,10 +354,10 @@ struct Foo: FooProtocol { // CHECK-LABEL: sil_vtable Sub { // CHECK-NEXT: #Base.data!getter: (Base) -> () -> UnsafeMutablePointer : @$s10addressors4BaseC4dataSpys5Int32VGvg // CHECK-NEXT: #Base.data!setter: (Base) -> (UnsafeMutablePointer) -> () : @$s10addressors4BaseC4dataSpys5Int32VGvs -// CHECK-NEXT: #Base.data!modify: (Base) -> () -> () : @$s10addressors4BaseC4dataSpys5Int32VGvM +// CHECK-NEXT: #Base.data!modify: (Base) -> @yield_once () -> inout @yields UnsafeMutablePointer : @$s10addressors4BaseC4dataSpys5Int32VGvM // CHECK-NEXT: #Base.value!getter: (Base) -> () -> Int32 : @$s10addressors3SubC5values5Int32Vvg // CHECK-NEXT: #Base.value!setter: (Base) -> (Int32) -> () : @$s10addressors3SubC5values5Int32Vvs -// CHECK-NEXT: #Base.value!modify: (Base) -> () -> () : @$s10addressors3SubC5values5Int32VvM +// CHECK-NEXT: #Base.value!modify: (Base) -> @yield_once () -> inout @yields Int32 : @$s10addressors3SubC5values5Int32VvM // CHECK-NEXT: #Base.init!allocator: (Base.Type) -> () -> Base : @$s10addressors3SubCACycfC // CHECK-NEXT: #Sub.deinit!deallocator: @$s10addressors3SubCfD // CHECK-NEXT: } diff --git a/test/SILGen/coroutine_subst_function_types.swift b/test/SILGen/coroutine_subst_function_types.swift index bb9443590ba42..0fd9b2dbab3d1 100644 --- a/test/SILGen/coroutine_subst_function_types.swift +++ b/test/SILGen/coroutine_subst_function_types.swift @@ -114,9 +114,9 @@ extension ConcreteWithInt : ProtoWithAssoc { } // CHECK-LABEL: sil_vtable ConcreteWithInt { -// CHECK: #Generic.generic!modify: (Generic) -> () -> () : @$s3mod15ConcreteWithIntC7genericSivMAA7GenericCADxvMTV [override] -// CHECK: #Generic.genericFunction!modify: (Generic) -> () -> () : @$s3mod15ConcreteWithIntC15genericFunctionSiycvMAA7GenericCADxycvMTV [override] -// CHECK: #Generic.subscript!modify: (Generic) -> (U) -> () : @$s3mod15ConcreteWithIntC16returningGenericSix_tcluiMAA0F0CADxqd___tcluiMTV [override] -// CHECK: #Generic.subscript!modify: (Generic) -> (U) -> () : @$s3mod15ConcreteWithIntC19returningOwnGenericxx_tcluiM [override] -// CHECK: #Generic.complexTuple!modify: (Generic) -> () -> () : @$s3mod15ConcreteWithIntC12complexTupleSiSg_SDySSSiGtvMAA7GenericCADxSg_SDySSxGtvMTV [override] +// CHECK: #Generic.generic!modify: (Generic) -> @yield_once () -> inout @yields T : @$s3mod15ConcreteWithIntC7genericSivMAA7GenericCADxvMTV [override] +// CHECK: #Generic.genericFunction!modify: (Generic) -> @yield_once () -> inout @yields () -> T : @$s3mod15ConcreteWithIntC15genericFunctionSiycvMAA7GenericCADxycvMTV [override] +// CHECK: #Generic.subscript!modify: (Generic) -> @yield_once (U) -> inout @yields T : @$s3mod15ConcreteWithIntC16returningGenericSix_tcluiMAA0F0CADxqd___tcluiMTV [override] +// CHECK: #Generic.subscript!modify: (Generic) -> @yield_once (U) -> inout @yields U : @$s3mod15ConcreteWithIntC19returningOwnGenericxx_tcluiM [override] +// CHECK: #Generic.complexTuple!modify: (Generic) -> @yield_once () -> inout @yields (T?, [String : T]) : @$s3mod15ConcreteWithIntC12complexTupleSiSg_SDySSSiGtvMAA7GenericCADxSg_SDySSxGtvMTV [override] // CHECK: } diff --git a/test/SILGen/default_override.swift b/test/SILGen/default_override.swift index f3db5b64847b0..b9aa3227b89b4 100644 --- a/test/SILGen/default_override.swift +++ b/test/SILGen/default_override.swift @@ -38,7 +38,7 @@ open class OpenBase { // CHECK-SAME: [[SELF:%[^,]+]] : // CHECK-SAME: ): // CHECK: [[ORIGINAL:%[^,]+]] = class_method [[SELF]], #OpenBase.openField!read -// CHECK-SAME: (OpenBase) -> () -> () +// CHECK-SAME: (OpenBase) -> @yield_once () -> @yields T // CHECK-SAME: $@yield_once @convention(method) <τ_0_0> (@guaranteed OpenBase<τ_0_0>) -> @yields @in_guaranteed τ_0_0 // CHECK: ([[ADDR:%[^,]+]], [[TOKEN:%[^,]+]]) = begin_apply [[ORIGINAL]]<τ_0_0>([[SELF]]) // CHECK: yield [[ADDR]] @@ -69,7 +69,7 @@ open class OpenBase { // CHECK-SAME: [[SELF:%[^,]+]] : // CHECK-SAME: ): // CHECK: [[ORIGINAL:%[^,]+]] = class_method [[SELF]], #OpenBase.openField!modify -// CHECK: (OpenBase) -> () -> () +// CHECK: (OpenBase) -> @yield_once () -> inout @yields T // CHECK: $@yield_once @convention(method) <τ_0_0> (@guaranteed OpenBase<τ_0_0>) -> @yields @inout τ_0_0 // CHECK: ([[ADDR:%[^,]+]], [[TOKEN:%[^,]+]]) = begin_apply [[ORIGINAL]]<τ_0_0>([[SELF]]) // CHECK: yield [[ADDR]] @@ -107,7 +107,7 @@ open class OpenBase { // CHECK-SAME: ): // CHECK: [[ORIGINAL:%[^,]+]] = class_method [[SELF]] // CHECK: #OpenBase.subscript!read -// CHECK: (OpenBase) -> (U, Open.Type) -> () +// CHECK: (OpenBase) -> @yield_once (U, Open.Type) -> @yields T // CHECK: $@yield_once @convention(method) <τ_0_0><τ_1_0> (@in_guaranteed τ_1_0, @thin Open.Type, @guaranteed OpenBase<τ_0_0>) -> @yields @in_guaranteed τ_0_0 // CHECK: ([[ADDR:%[^,]+]], [[TOKEN:%[^,]+]]) = begin_apply [[ORIGINAL]]<τ_0_0, τ_1_0>([[KEY]], [[OPEN_TY]], [[SELF]]) // CHECK: yield [[ADDR]] @@ -143,7 +143,7 @@ open class OpenBase { // CHECK-SAME: ): // CHECK: [[ORIGINAL:%[^,]+]] = class_method [[SELF]] // CHECK-SAME: #OpenBase.subscript!modify -// CHECK-SAME: (OpenBase) -> (U, Open.Type) -> () +// CHECK-SAME: (OpenBase) -> @yield_once (U, Open.Type) -> inout @yields T // CHECK-SAME: $@yield_once @convention(method) <τ_0_0><τ_1_0> (@in_guaranteed τ_1_0, @thin Open.Type, @guaranteed OpenBase<τ_0_0>) -> @yields @inout τ_0_0 // CHECK: ([[ADDR:%[^,]+]], [[TOKEN:%[^,]+]]) = begin_apply [[ORIGINAL]]<τ_0_0, τ_1_0>([[KEY]], [[OPEN_TY]], [[SELF]]) // CHECK: yield [[ADDR]] @@ -300,24 +300,24 @@ class InternalBase { // CHECK-LABEL: sil_default_override_table OpenBase { // CHECK-NEXT: #OpenBase.openField!read2 // CHECK-SAME: #OpenBase.openField!read -// CHECK-SAME: (OpenBase) -> () -> () +// CHECK-SAME: (OpenBase) -> @yield_once () -> @yields T // CHECK-SAME: @$s16default_override8OpenBaseC9openFieldxvyTwd // CHECK-NEXT: #OpenBase.openField!modify2 // CHECK-SAME: #OpenBase.openField!modify -// CHECK-SAME: (OpenBase) -> () -> () +// CHECK-SAME: (OpenBase) -> @yield_once () -> inout @yields T // CHECK-SAME: @$s16default_override8OpenBaseC9openFieldxvxTwd // CHECK-NEXT: #OpenBase.subscript!read2 // CHECK-SAME: #OpenBase.subscript!read -// CHECK-SAME: (OpenBase) -> (U, Open.Type) -> () +// CHECK-SAME: (OpenBase) -> @yield_once (U, Open.Type) -> @yields T // CHECK-SAME: @$s16default_override8OpenBaseCyxqd___AA0C0OmtcluiyTwd // CHECK-NEXT: #OpenBase.subscript!modify2 // CHECK-SAME: #OpenBase.subscript!modify -// CHECK-SAME: (OpenBase) -> (U, Open.Type) -> () +// CHECK-SAME: (OpenBase) -> @yield_once (U, Open.Type) -> inout @yields T // CHECK-SAME: @$s16default_override8OpenBaseCyxqd___AA0C0OmtcluixTwd // CHECK-NOT: #OpenBase.publicField!read2 // CHECK-NOT: #OpenBase.publicField!modify2 -// CHECK-NOT: #OpenBase.subscript!read2: #OpenBase.subscript!read: (OpenBase) -> (U, Public.Type) -> () -// CHECK-NOT: #OpenBase.subscript!modify2: #OpenBase.subscript!modify: (OpenBase) -> (U, Public.Type) -> () +// CHECK-NOT: #OpenBase.subscript!read2: #OpenBase.subscript!read: (OpenBase) -> @yield_once (U, Public.Type) -> @yields T +// CHECK-NOT: #OpenBase.subscript!modify2: #OpenBase.subscript!modify: (OpenBase) -> @yield_once (U, Public.Type) -> inout @yields T // CHECK-NEXT: } // CHECK-NOT: sil_default_override_table PublicBase { diff --git a/test/SILGen/ivar_destroyer_resilience.swift b/test/SILGen/ivar_destroyer_resilience.swift index 250358959967a..01b1c38cacab8 100644 --- a/test/SILGen/ivar_destroyer_resilience.swift +++ b/test/SILGen/ivar_destroyer_resilience.swift @@ -25,7 +25,7 @@ public class DoesNotNeedIVarDestroyer : Base { // CHECK-NEXT: #Base.init!allocator: (Base.Type) -> () -> Base // CHECK-NEXT: #NeedsIVarDestroyer.x!getter: (NeedsIVarDestroyer) -> () -> resilient_struct.ResilientInt // CHECK-NEXT: #NeedsIVarDestroyer.x!setter: (NeedsIVarDestroyer) -> (resilient_struct.ResilientInt) -> () -// CHECK-NEXT: #NeedsIVarDestroyer.x!modify: (NeedsIVarDestroyer) -> () -> () +// CHECK-NEXT: #NeedsIVarDestroyer.x!modify: (NeedsIVarDestroyer) -> @yield_once () -> inout @yields resilient_struct.ResilientInt // CHECK-NEXT: #NeedsIVarDestroyer.deinit!deallocator // CHECK-NEXT: #NeedsIVarDestroyer!ivardestroyer // CHECK-NEXT: } @@ -34,6 +34,6 @@ public class DoesNotNeedIVarDestroyer : Base { // CHECK-NEXT: #Base.init!allocator: (Base.Type) -> () -> Base // CHECK-NEXT: #DoesNotNeedIVarDestroyer.x!getter: (DoesNotNeedIVarDestroyer) -> () -> MyResilientInt // CHECK-NEXT: #DoesNotNeedIVarDestroyer.x!setter: (DoesNotNeedIVarDestroyer) -> (MyResilientInt) -> () -// CHECK-NEXT: #DoesNotNeedIVarDestroyer.x!modify: (DoesNotNeedIVarDestroyer) -> () -> () +// CHECK-NEXT: #DoesNotNeedIVarDestroyer.x!modify: (DoesNotNeedIVarDestroyer) -> @yield_once () -> inout @yields MyResilientInt // CHECK-NEXT: #DoesNotNeedIVarDestroyer.deinit!deallocator // CHECK-NEXT: } diff --git a/test/SILGen/modify.swift b/test/SILGen/modify.swift index 92ea1deb4271a..676ce8f3944f3 100644 --- a/test/SILGen/modify.swift +++ b/test/SILGen/modify.swift @@ -80,10 +80,9 @@ extension Derived : Abstractable {} // CHECK-NEXT: [[T1:%.*]] = partial_apply [callee_guaranteed] [[REABSTRACTOR]]([[CVT_FN]]) // CHECK-NEXT: store [[T1]] to [init] [[SUPER_ADDR]] // CHECK-NEXT: dealloc_stack [[SUB_ADDR]] -// CHECK-NEXT: end_apply [[TOKEN]] -// CHECK-NEXT: tuple () +// CHECK-NEXT: [[TUPLE:%.*]] = end_apply [[TOKEN]] as $() // CHECK-NEXT: end_borrow [[T0]] -// CHECK-NEXT: return +// CHECK-NEXT: return [[TUPLE]] // CHECK-LABEL: sil private [transparent] [thunk] [ossa] @$s6modify7DerivedCAA12AbstractableA2aDP19finalStoredFunction6ResultQzycvMTW // CHECK: bb0(%0 : $*Derived): @@ -108,10 +107,9 @@ extension Derived : Abstractable {} // CHECK-NEXT: [[T1:%.*]] = partial_apply [callee_guaranteed] [[REABSTRACTOR]]([[CVT_FN]]) // CHECK-NEXT: store [[T1]] to [init] [[SUPER_ADDR]] // CHECK-NEXT: dealloc_stack [[SUB_ADDR]] -// CHECK-NEXT: end_apply [[TOKEN]] -// CHECK-NEXT: tuple () +// CHECK-NEXT: [[TUPLE:%.*]] = end_apply [[TOKEN]] as $() // CHECK-NEXT: end_borrow [[T0]] -// CHECK-NEXT: return +// CHECK-NEXT: return [[TUPLE]] // CHECK-LABEL: sil private [transparent] [thunk] [ossa] @$s6modify7DerivedCAA12AbstractableA2aDP14staticFunction6ResultQzycvMZTW // CHECK: bb0(%0 : $@thick Derived.Type): @@ -135,9 +133,8 @@ extension Derived : Abstractable {} // CHECK-NEXT: [[T1:%.*]] = partial_apply [callee_guaranteed] [[REABSTRACTOR]]([[CVT_FN]]) // CHECK-NEXT: store [[T1]] to [init] [[SUPER_ADDR]] // CHECK-NEXT: dealloc_stack [[SUB_ADDR]] -// CHECK-NEXT: end_apply [[TOKEN]] -// CHECK-NEXT: tuple () -// CHECK-NEXT: return +// CHECK-NEXT: [[TUPLE:%.*]] = end_apply [[TOKEN]] as $() +// CHECK-NEXT: return [[TUPLE]] protocol ClassAbstractable : class { associatedtype Result @@ -298,8 +295,7 @@ struct Bill : Totalled { // CHECK-NEXT: ([[T1:%.*]], [[TOKEN:%.*]]) = begin_apply [[T0]]([[SELF]]) // CHECK-NEXT: yield [[T1]] : $*Int, resume bb1, unwind bb2 // CHECK: bb1: -// CHECK-NEXT: end_apply [[TOKEN]] -// CHECK-NEXT: [[T1:%.*]] = tuple () +// CHECK-NEXT: [[T1:%.*]] = end_apply [[TOKEN]] as $() // CHECK-NEXT: return [[T1]] : protocol AddressOnlySubscript { @@ -547,10 +543,10 @@ extension HasConditionalSubscript: ConditionalSubscript where T: ConditionalSubs // CHECK-LABEL: sil_vtable DerivedForOverride { // CHECK: #BaseForOverride.valueStored!getter: (BaseForOverride) -> () -> Int : @$s6modify18DerivedForOverrideC11valueStoredSivg // CHECK: #BaseForOverride.valueStored!setter: (BaseForOverride) -> (Int) -> () : @$s6modify18DerivedForOverrideC11valueStoredSivs -// CHECK: #BaseForOverride.valueStored!modify: (BaseForOverride) -> () -> () : @$s6modify18DerivedForOverrideC11valueStoredSivM +// CHECK: #BaseForOverride.valueStored!modify: (BaseForOverride) -> @yield_once () -> inout @yields Int : @$s6modify18DerivedForOverrideC11valueStoredSivM // CHECK: #BaseForOverride.valueComputed!getter: (BaseForOverride) -> () -> Int : @$s6modify18DerivedForOverrideC13valueComputedSivg // CHECK: #BaseForOverride.valueComputed!setter: (BaseForOverride) -> (Int) -> () : @$s6modify18DerivedForOverrideC13valueComputedSivs -// CHECK: #BaseForOverride.valueComputed!modify: (BaseForOverride) -> () -> () : @$s6modify18DerivedForOverrideC13valueComputedSivM +// CHECK: #BaseForOverride.valueComputed!modify: (BaseForOverride) -> @yield_once () -> inout @yields Int : @$s6modify18DerivedForOverrideC13valueComputedSivM // CHECK: } // CHECK-LABEL: sil_witness_table hidden Bill: Totalled module modify { diff --git a/test/SILGen/properties.swift b/test/SILGen/properties.swift index d15b1e7d7749c..d0daabdb63898 100644 --- a/test/SILGen/properties.swift +++ b/test/SILGen/properties.swift @@ -203,7 +203,7 @@ func logical_struct_in_reftype_set(_ value: inout Val, z1: Int) { // -- getters and setters // -- val.ref.val_prop // CHECK: [[BORROW:%.*]] = begin_borrow [[VAL_REF]] - // CHECK: [[MAT_VAL_PROP_METHOD:%[0-9]+]] = class_method {{.*}} : $Ref, #Ref.val_prop!modify : (Ref) -> () + // CHECK: [[MAT_VAL_PROP_METHOD:%[0-9]+]] = class_method {{.*}} : $Ref, #Ref.val_prop!modify : (Ref) -> @yield_once () -> inout @yields Val // CHECK: ([[VAL_REF_VAL_PROP_MAT:%[0-9]+]], [[TOKEN:%.*]]) = begin_apply [[MAT_VAL_PROP_METHOD]]([[BORROW]]) // -- val.ref.val_prop.z_tuple // CHECK: [[V_R_VP_Z_TUPLE_MAT:%[0-9]+]] = alloc_stack $(Int, Int) diff --git a/test/SILGen/property_wrappers.swift b/test/SILGen/property_wrappers.swift index 33c33052cbbd4..92b90f9720281 100644 --- a/test/SILGen/property_wrappers.swift +++ b/test/SILGen/property_wrappers.swift @@ -997,7 +997,7 @@ struct S_58201 { // CHECK-LABEL: sil_vtable ClassUsingWrapper { // CHECK-NEXT: #ClassUsingWrapper.x!getter: (ClassUsingWrapper) -> () -> Int : @$s17property_wrappers17ClassUsingWrapperC1xSivg // ClassUsingWrapper.x.getter // CHECK-NEXT: #ClassUsingWrapper.x!setter: (ClassUsingWrapper) -> (Int) -> () : @$s17property_wrappers17ClassUsingWrapperC1xSivs // ClassUsingWrapper.x.setter -// CHECK-NEXT: #ClassUsingWrapper.x!modify: (ClassUsingWrapper) -> () -> () : @$s17property_wrappers17ClassUsingWrapperC1xSivM // ClassUsingWrapper.x.modify +// CHECK-NEXT: #ClassUsingWrapper.x!modify: (ClassUsingWrapper) -> @yield_once () -> inout @yields Int : @$s17property_wrappers17ClassUsingWrapperC1xSivM // ClassUsingWrapper.x.modify // CHECK-NEXT: #ClassUsingWrapper.init!allocator: (ClassUsingWrapper.Type) -> () -> ClassUsingWrapper : @$s17property_wrappers17ClassUsingWrapperCACycfC // CHECK-NEXT: #ClassUsingWrapper.deinit!deallocator: @$s17property_wrappers17ClassUsingWrapperCfD // CHECK-NEXT: } diff --git a/test/SILGen/property_wrappers_multifile.swift b/test/SILGen/property_wrappers_multifile.swift index 7c25657e68289..8b8131755656e 100644 --- a/test/SILGen/property_wrappers_multifile.swift +++ b/test/SILGen/property_wrappers_multifile.swift @@ -7,6 +7,6 @@ public class YourClass : MyClass {} // CHECK-NEXT: #MyClass.instanceProperty!getter: (MyClass) -> () -> Bool : @$s27property_wrappers_multifile7MyClassC16instancePropertySbvg [inherited] // CHECK-NEXT: #MyClass.$instanceProperty!getter: (MyClass) -> () -> PropertyWrapper : @$s27property_wrappers_multifile7MyClassC17$instancePropertyAA0G7WrapperVvg [inherited] // CHECK-NEXT: #MyClass.$instanceProperty!setter: (MyClass) -> (PropertyWrapper) -> () : @$s27property_wrappers_multifile7MyClassC17$instancePropertyAA0G7WrapperVvs [inherited] -// CHECK-NEXT: #MyClass.$instanceProperty!modify: (MyClass) -> () -> () : @$s27property_wrappers_multifile7MyClassC17$instancePropertyAA0G7WrapperVvM [inherited] +// CHECK-NEXT: #MyClass.$instanceProperty!modify: (MyClass) -> @yield_once () -> inout @yields PropertyWrapper : @$s27property_wrappers_multifile7MyClassC17$instancePropertyAA0G7WrapperVvM [inherited] // CHECK-NEXT: #YourClass.deinit!deallocator: @$s27property_wrappers_multifile9YourClassCfD -// CHECK-NEXT: } \ No newline at end of file +// CHECK-NEXT: } diff --git a/test/SILGen/sendable_to_any_for_generic_arguments.swift b/test/SILGen/sendable_to_any_for_generic_arguments.swift index 03c6589eb3f80..2a20f63519898 100644 --- a/test/SILGen/sendable_to_any_for_generic_arguments.swift +++ b/test/SILGen/sendable_to_any_for_generic_arguments.swift @@ -207,8 +207,8 @@ func test_subscript_computed_property_and_mutating_access(u: User) { // CHECK-NEXT: {{.*}} = apply [[SUBSCRIPT_GETTER]]({{.*}}, [[BORROWED_COPY]]) _ = u.dict[entry: ""] - // CHECK: [[DICT_GETTER:%.*]] = class_method %0, #User.dict!modify : (User) -> () -> (), $@yield_once @convention(method) (@guaranteed User) -> @yields @inout Dictionary - // CHECK-NEXT: ([[DICT_ADDR:%.*]], {{.*}}) = begin_apply [[DICT_GETTER]]({{.*}}) : $@yield_once @convention(method) (@guaranteed User) -> @yields @inout Dictionary + // CHECK: [[DICT_MODIFY:%.*]] = class_method %0, #User.dict!modify : (User) -> @yield_once () -> inout @yields [String : any Sendable], $@yield_once @convention(method) (@guaranteed User) -> @yields @inout Dictionary + // CHECK-NEXT: ([[DICT_ADDR:%.*]], {{.*}}) = begin_apply [[DICT_MODIFY]]({{.*}}) : $@yield_once @convention(method) (@guaranteed User) -> @yields @inout Dictionary // CHECK-NEXT: [[ANY_DICT:%.*]] = alloc_stack $Dictionary // CHECK-NEXT: [[LOADED_DICT:%.*]] = load [copy] [[DICT_ADDR]] // CHECK-NEXT: [[ANY_LOADED_DICT:%.*]] = unchecked_bitwise_cast [[LOADED_DICT]] to $Dictionary @@ -231,8 +231,8 @@ func test_subscript_computed_property_and_mutating_access(u: User) { // CHECK-NEXT: {{.*}} = apply [[GETTER]]([[ANY_DICT]]) : $@convention(method) (@guaranteed Dictionary) -> Optional _ = u.dict.test - // CHECK: [[DICT_GETTER:%.*]] = class_method %0, #User.dict!modify : (User) -> () -> (), $@yield_once @convention(method) (@guaranteed User) -> @yields @inout Dictionary - // CHECK-NEXT: ([[DICT:%.*]], {{.*}}) = begin_apply [[DICT_GETTER]]({{.*}}) : $@yield_once @convention(method) (@guaranteed User) -> @yields @inout Dictionary + // CHECK: [[DICT_MODIFY:%.*]] = class_method %0, #User.dict!modify : (User) -> @yield_once () -> inout @yields [String : any Sendable], $@yield_once @convention(method) (@guaranteed User) -> @yields @inout Dictionary + // CHECK-NEXT: ([[DICT:%.*]], {{.*}}) = begin_apply [[DICT_MODIFY]]({{.*}}) : $@yield_once @convention(method) (@guaranteed User) -> @yields @inout Dictionary // CHECK-NEXT: [[ANY_DICT:%.*]] = alloc_stack $Dictionary // CHECK-NEXT: [[LOADED_DICT:%.*]] = load [copy] [[DICT]] // CHECK-NEXT: [[CASTED_DICT:%.*]] = unchecked_bitwise_cast [[LOADED_DICT]] to $Dictionary @@ -246,8 +246,8 @@ func test_subscript_computed_property_and_mutating_access(u: User) { // CHECK-NEXT: assign [[COPIED_SENDABLE_DICT]] to [[DICT]] u.dict.test = 42 - // CHECK: [[DICT_GETTER:%.*]] = class_method %0, #User.dict!modify : (User) -> () -> (), $@yield_once @convention(method) (@guaranteed User) -> @yields @inout Dictionary - // CHECK-NEXT: ([[DICT:%.*]], {{.*}}) = begin_apply [[DICT_GETTER:%.*]](%0) : $@yield_once @convention(method) (@guaranteed User) -> @yields @inout Dictionary + // CHECK: [[DICT_MODIFY:%.*]] = class_method %0, #User.dict!modify : (User) -> @yield_once () -> inout @yields [String : any Sendable], $@yield_once @convention(method) (@guaranteed User) -> @yields @inout Dictionary + // CHECK-NEXT: ([[DICT:%.*]], {{.*}}) = begin_apply [[DICT_MODIFY:%.*]](%0) : $@yield_once @convention(method) (@guaranteed User) -> @yields @inout Dictionary // CHECK-NEXT: [[ANY_DICT:%.*]] = alloc_stack $Dictionary // CHECK-NEXT: [[LOADED_DICT:%.*]] = load [copy] [[DICT]] // CHECK-NEXT: [[CASTED_DICT:%.*]] = unchecked_bitwise_cast [[LOADED_DICT]] to $Dictionary diff --git a/test/SILGen/witness-modify-requirement-with-base-class-modify.swift b/test/SILGen/witness-modify-requirement-with-base-class-modify.swift index 6186720b48a86..c5ffc2f60eabf 100644 --- a/test/SILGen/witness-modify-requirement-with-base-class-modify.swift +++ b/test/SILGen/witness-modify-requirement-with-base-class-modify.swift @@ -23,5 +23,5 @@ public class Derived : Base, Q where T.A == S {} // CHECK-LABEL: sil_witness_table [serialized] Derived: Q module main { // CHECK-NEXT: method #Q.foo!getter: (Self) -> () -> S? : @$s4main7DerivedCyxGAA1QA2aEP3fooAA1SVSgvgTW // CHECK-NEXT: method #Q.foo!setter: (inout Self) -> (S?) -> () : @$s4main7DerivedCyxGAA1QA2aEP3fooAA1SVSgvsTW -// CHECK-NEXT: method #Q.foo!modify: (inout Self) -> () -> () : @$s4main7DerivedCyxGAA1QA2aEP3fooAA1SVSgvMTW -// CHECK-NEXT: } \ No newline at end of file +// CHECK-NEXT: method #Q.foo!modify: (inout Self) -> @yield_once () -> inout @yields S? : @$s4main7DerivedCyxGAA1QA2aEP3fooAA1SVSgvMTW +// CHECK-NEXT: } diff --git a/test/SILGen/witnesses.swift b/test/SILGen/witnesses.swift index 25a93423f113e..f3b28bacb7611 100644 --- a/test/SILGen/witnesses.swift +++ b/test/SILGen/witnesses.swift @@ -464,8 +464,7 @@ class PropertyRequirementWitnessFromBase : PropertyRequirementBase, PropertyRequ // CHECK-NEXT: [[METH:%.*]] = class_method [[CAST_ARG2_LOADED]] : $PropertyRequirementBase, #PropertyRequirementBase.width!modify // CHECK-NEXT: ([[RES:%.*]], [[TOKEN:%.*]]) = begin_apply [[METH]]([[CAST_ARG2_LOADED]]) : $@yield_once @convention(method) (@guaranteed PropertyRequirementBase) -> @yields @inout Int // CHECK-NEXT: yield [[RES]] - // CHECK: end_apply [[TOKEN]] - // CHECK-NEXT: [[TUPLE:%.*]] = tuple () + // CHECK: [[TUPLE:%.*]] = end_apply [[TOKEN]] as $() // CHECK-NEXT: end_borrow [[ARG2_LOADED]] // CHECK-NEXT: return [[TUPLE]] @@ -474,8 +473,7 @@ class PropertyRequirementWitnessFromBase : PropertyRequirementBase, PropertyRequ // CHECK: [[METH:%.*]] = function_ref @$s9witnesses23PropertyRequirementBaseC6heightSivMZ // CHECK-NEXT: ([[RES:%.*]], [[TOKEN:%.*]]) = begin_apply [[METH]] // CHECK-NEXT: yield [[RES]] - // CHECK: end_apply [[TOKEN]] - // CHECK-NEXT: [[TUPLE:%.*]] = tuple () + // CHECK: [[TUPLE:%.*]] = end_apply [[TOKEN]] as $() // CHECK-NEXT: return [[TUPLE]] // CHECK-LABEL: sil private [transparent] [thunk] [ossa] @$s9witnesses34PropertyRequirementWitnessFromBaseCAA0bC0A2aDP5depthSivMTW @@ -484,8 +482,7 @@ class PropertyRequirementWitnessFromBase : PropertyRequirementBase, PropertyRequ // CHECK: [[METH:%.*]] = class_method [[ARG2_LOADED]] : $PropertyRequirementWitnessFromBase, #PropertyRequirementWitnessFromBase.depth!modify // CHECK-NEXT: ([[RES:%.*]], [[TOKEN:%.*]]) = begin_apply [[METH]]([[ARG2_LOADED]]) : $@yield_once @convention(method) (@guaranteed PropertyRequirementWitnessFromBase) -> @yields @inout Int // CHECK-NEXT: yield [[RES]] - // CHECK: end_apply [[TOKEN]] - // CHECK-NEXT: [[TUPLE:%.*]] = tuple () + // CHECK: [[TUPLE:%.*]] = end_apply [[TOKEN]] as $() // CHECK-NEXT: end_borrow [[ARG2_LOADED]] // CHECK-NEXT: return [[TUPLE]] } diff --git a/test/SILOptimizer/access_dom_call.sil b/test/SILOptimizer/access_dom_call.sil index 44116736faf72..43e7f7ff875e8 100644 --- a/test/SILOptimizer/access_dom_call.sil +++ b/test/SILOptimizer/access_dom_call.sil @@ -121,7 +121,7 @@ bb2: // Preds: bb0 } // end sil function '$s1t1CC5fields5Int64VvM' sil_vtable C { - #C.field!modify: (C) -> () -> () : @CFieldModify + #C.field!modify: (C) -> @yield_once () -> inout @yields Int64 : @CFieldModify } // No, cannot optimize an access within a coroutine. @@ -134,7 +134,7 @@ bb0(%0 : $C): %ra = ref_element_addr %0 : $C, #C.field // user: %3 %a1 = begin_access [read] [dynamic] %ra : $*Int64 end_access %a1 : $*Int64 - %m = class_method %0 : $C, #C.field!modify : (C) -> () -> (), $@yield_once @convention(method) (@guaranteed C) -> @yields @inout Int64 + %m = class_method %0 : $C, #C.field!modify : (C) -> @yield_once () -> inout @yields Int64, $@yield_once @convention(method) (@guaranteed C) -> @yields @inout Int64 (%3, %4) = begin_apply %m(%0) : $@yield_once @convention(method) (@guaranteed C) -> @yields @inout Int64 %a2 = begin_access [read] [dynamic] [no_nested_conflict] %ra : $*Int64 end_access %a2 : $*Int64 @@ -150,7 +150,7 @@ bb0(%0 : $C): // CHECK-LABEL: } // end sil function 'testDominatingRDA_RD' sil @testDominatingRDA_RD : $@convention(thin) (@guaranteed C) -> () { bb0(%0 : $C): - %m = class_method %0 : $C, #C.field!modify : (C) -> () -> (), $@yield_once @convention(method) (@guaranteed C) -> @yields @inout Int64 + %m = class_method %0 : $C, #C.field!modify : (C) -> @yield_once () -> inout @yields Int64, $@yield_once @convention(method) (@guaranteed C) -> @yields @inout Int64 (%3, %4) = begin_apply %m(%0) : $@yield_once @convention(method) (@guaranteed C) -> @yields @inout Int64 %ra = ref_element_addr %0 : $C, #C.field // user: %3 %a1 = begin_access [read] [dynamic] %ra : $*Int64 @@ -169,7 +169,7 @@ bb0(%0 : $C): // CHECK-LABEL: } // end sil function 'testDominatingRDA_MD' sil @testDominatingRDA_MD : $@convention(thin) (@guaranteed C) -> () { bb0(%0 : $C): - %m = class_method %0 : $C, #C.field!modify : (C) -> () -> (), $@yield_once @convention(method) (@guaranteed C) -> @yields @inout Int64 + %m = class_method %0 : $C, #C.field!modify : (C) -> @yield_once () -> inout @yields Int64, $@yield_once @convention(method) (@guaranteed C) -> @yields @inout Int64 (%3, %4) = begin_apply %m(%0) : $@yield_once @convention(method) (@guaranteed C) -> @yields @inout Int64 %ra = ref_element_addr %0 : $C, #C.field // user: %3 %a1 = begin_access [read] [dynamic] %ra : $*Int64 @@ -198,7 +198,7 @@ bb2: br bb3 bb3: - %m = class_method %0 : $C, #C.field!modify : (C) -> () -> (), $@yield_once @convention(method) (@guaranteed C) -> @yields @inout Int64 + %m = class_method %0 : $C, #C.field!modify : (C) -> @yield_once () -> inout @yields Int64, $@yield_once @convention(method) (@guaranteed C) -> @yields @inout Int64 (%3, %4) = begin_apply %m(%0) : $@yield_once @convention(method) (@guaranteed C) -> @yields @inout Int64 %ra = ref_element_addr %0 : $C, #C.field // user: %3 %a1 = begin_access [modify] [dynamic] [no_nested_conflict] %ra : $*Int64 diff --git a/test/SILOptimizer/access_marker_verify.swift b/test/SILOptimizer/access_marker_verify.swift index e496a33828af2..4881e64bd2c6d 100644 --- a/test/SILOptimizer/access_marker_verify.swift +++ b/test/SILOptimizer/access_marker_verify.swift @@ -791,8 +791,7 @@ class C : Abstractable { // CHECK-NEXT: [[THUNKED_NEW_FN:%.*]] = partial_apply [callee_guaranteed] [[THUNK]]([[NEW_FN_CONV]]) // CHECK-NEXT: store [[THUNKED_NEW_FN]] to [init] [[ADDR]] : // CHECK-NEXT: dealloc_stack [[TEMP]] -// CHECK-NEXT: end_apply [[TOKEN]] -// CHECK-NEXT: [[TUPLE:%.*]] = tuple () +// CHECK-NEXT: [[TUPLE:%.*]] = end_apply [[TOKEN]] // CHECK-NEXT: end_borrow [[SELF]] : $C // CHECK-NEXT: return [[TUPLE]] diff --git a/test/SILOptimizer/address_lowering.sil b/test/SILOptimizer/address_lowering.sil index d863ec0b932f6..e3fb98d790464 100644 --- a/test/SILOptimizer/address_lowering.sil +++ b/test/SILOptimizer/address_lowering.sil @@ -1583,7 +1583,7 @@ bb0: sil hidden [ossa] @testBeginApply1DeadYield : $@convention(thin) (@guaranteed TestGeneric) -> () { bb0(%0 : @guaranteed $TestGeneric): - %2 = class_method %0 : $TestGeneric, #TestGeneric.borrowedGeneric!read : (TestGeneric) -> () -> (), $@yield_once @convention(method) <τ_0_0> (@guaranteed TestGeneric<τ_0_0>) -> @yields @in_guaranteed τ_0_0 + %2 = class_method %0 : $TestGeneric, #TestGeneric.borrowedGeneric!read : (TestGeneric) -> @yield_once () -> @yields T, $@yield_once @convention(method) <τ_0_0> (@guaranteed TestGeneric<τ_0_0>) -> @yields @in_guaranteed τ_0_0 (%3, %4) = begin_apply %2(%0) : $@yield_once @convention(method) <τ_0_0> (@guaranteed TestGeneric<τ_0_0>) -> @yields @in_guaranteed τ_0_0 end_apply %4 as $() %10 = tuple () @@ -1593,7 +1593,7 @@ bb0(%0 : @guaranteed $TestGeneric): // CHECK-LABEL: sil hidden [ossa] @testBeginApply2LoadableYieldWithIndirectConv : // CHECK: bb0(%0 : @guaranteed $TestGeneric): // CHECK: [[STK:%.*]] = alloc_stack $Klass -// CHECK: [[METH:%.*]] = class_method %0 : $TestGeneric, #TestGeneric.borrowedGeneric!read : (TestGeneric) -> () -> (), $@yield_once @convention(method) <τ_0_0> (@guaranteed TestGeneric<τ_0_0>) -> @yields @in_guaranteed τ_0_0 +// CHECK: [[METH:%.*]] = class_method %0 : $TestGeneric, #TestGeneric.borrowedGeneric!read : (TestGeneric) -> @yield_once () -> @yields T, $@yield_once @convention(method) <τ_0_0> (@guaranteed TestGeneric<τ_0_0>) -> @yields @in_guaranteed τ_0_0 // CHECK: ([[Y:%.*]], [[TOK:%.*]]) = begin_apply [[METH]](%0) : $@yield_once @convention(method) <τ_0_0> (@guaranteed TestGeneric<τ_0_0>) -> @yields @in_guaranteed τ_0_0 // CHECK: copy_addr [[Y]] to [init] [[STK]] : $*Klass // CHECK: end_apply [[TOK]] as $() @@ -1601,7 +1601,7 @@ bb0(%0 : @guaranteed $TestGeneric): // CHECK-LABEL: } sil hidden [ossa] @testBeginApply2LoadableYieldWithIndirectConv : $@convention(thin) (@guaranteed TestGeneric) -> () { bb0(%0 : @guaranteed $TestGeneric): - %2 = class_method %0 : $TestGeneric, #TestGeneric.borrowedGeneric!read : (TestGeneric) -> () -> (), $@yield_once @convention(method) <τ_0_0> (@guaranteed TestGeneric<τ_0_0>) -> @yields @in_guaranteed τ_0_0 + %2 = class_method %0 : $TestGeneric, #TestGeneric.borrowedGeneric!read : (TestGeneric) -> @yield_once () -> @yields Klass, $@yield_once @convention(method) <τ_0_0> (@guaranteed TestGeneric<τ_0_0>) -> @yields @in_guaranteed τ_0_0 (%3, %4) = begin_apply %2(%0) : $@yield_once @convention(method) <τ_0_0> (@guaranteed TestGeneric<τ_0_0>) -> @yields @in_guaranteed τ_0_0 %5 = copy_value %3 : $Klass end_apply %4 as $() @@ -1613,7 +1613,7 @@ bb0(%0 : @guaranteed $TestGeneric): // CHECK-LABEL: sil hidden [ossa] @testBeginApply3OpaqueYield : // CHECK: bb0(%0 : @guaranteed $TestGeneric): // CHECK: [[STK:%.*]] = alloc_stack $T -// CHECK: [[M:%.*]] = class_method %0 : $TestGeneric, #TestGeneric.borrowedGeneric!read : (TestGeneric) -> () -> (), $@yield_once @convention(method) <τ_0_0> (@guaranteed TestGeneric<τ_0_0>) -> @yields @in_guaranteed τ_0_0 +// CHECK: [[M:%.*]] = class_method %0 : $TestGeneric, #TestGeneric.borrowedGeneric!read : (TestGeneric) -> @yield_once () -> @yields T, $@yield_once @convention(method) <τ_0_0> (@guaranteed TestGeneric<τ_0_0>) -> @yields @in_guaranteed τ_0_0 // CHECK: ([[Y:%.*]], [[TOK:%.*]]) = begin_apply %2(%0) : $@yield_once @convention(method) <τ_0_0> (@guaranteed TestGeneric<τ_0_0>) -> @yields @in_guaranteed τ_0_0 // CHECK: copy_addr [[Y]] to [init] [[STK]] : $*T // CHECK: end_apply [[TOK]] as $() @@ -1621,7 +1621,7 @@ bb0(%0 : @guaranteed $TestGeneric): // CHECK-LABEL: } // end sil function 'testBeginApply3OpaqueYield' sil hidden [ossa] @testBeginApply3OpaqueYield : $@convention(thin) (@guaranteed TestGeneric) -> () { bb0(%0 : @guaranteed $TestGeneric): - %2 = class_method %0 : $TestGeneric, #TestGeneric.borrowedGeneric!read : (TestGeneric) -> () -> (), $@yield_once @convention(method) <τ_0_0> (@guaranteed TestGeneric<τ_0_0>) -> @yields @in_guaranteed τ_0_0 + %2 = class_method %0 : $TestGeneric, #TestGeneric.borrowedGeneric!read : (TestGeneric) -> @yield_once () -> @yields T, $@yield_once @convention(method) <τ_0_0> (@guaranteed TestGeneric<τ_0_0>) -> @yields @in_guaranteed τ_0_0 (%3, %4) = begin_apply %2(%0) : $@yield_once @convention(method) <τ_0_0> (@guaranteed TestGeneric<τ_0_0>) -> @yields @in_guaranteed τ_0_0 %5 = copy_value %3 : $T end_apply %4 as $() diff --git a/test/SILOptimizer/devirtualize_coroutine_accessors.sil b/test/SILOptimizer/devirtualize_coroutine_accessors.sil index 1e7dfecff9415..355af807fb623 100644 --- a/test/SILOptimizer/devirtualize_coroutine_accessors.sil +++ b/test/SILOptimizer/devirtualize_coroutine_accessors.sil @@ -29,7 +29,7 @@ sil [ossa] @utilize_begin_apply : $@convention(thin) () -> () { bb0: %derived = alloc_ref $Derived %base = upcast %derived : $Derived to $Base - %reader = class_method %base : $Base, #Base.x!read2 : (Base) -> () -> (), $@yield_once_2 @convention(method) (@guaranteed Base) -> @yields Int + %reader = class_method %base : $Base, #Base.x!read2 : (Base) -> @yield_once () -> @yields Int, $@yield_once_2 @convention(method) (@guaranteed Base) -> @yields Int (%value, %token, %allocation) = begin_apply %reader(%base) : $@yield_once_2 @convention(method) (@guaranteed Base) -> @yields Int end_apply %token as $() dealloc_stack %allocation : $*Builtin.SILToken diff --git a/test/SILOptimizer/lifetime_dependence/lifetime_dependence_util.sil b/test/SILOptimizer/lifetime_dependence/lifetime_dependence_util.sil index e582f211c3685..946e10d9af275 100644 --- a/test/SILOptimizer/lifetime_dependence/lifetime_dependence_util.sil +++ b/test/SILOptimizer/lifetime_dependence/lifetime_dependence_util.sil @@ -144,7 +144,7 @@ entry(%0 : @owned $C, %1 : @owned $D, %2 : @guaranteed $D, %3 : $*D, %4 : $*D): // CHECK-NEXT: ends: end_borrow {{.*}} : $D // CHECK: dependence_scope: lifetime_dependence_scope with: %guaranteed_mark - %m = class_method %2 : $D, #D.field!read : (D) -> () -> (), $@yield_once @convention(method) (@guaranteed D) -> @yields @guaranteed C + %m = class_method %2 : $D, #D.field!read : (D) -> @yield_once () -> @yields C, $@yield_once @convention(method) (@guaranteed D) -> @yields @guaranteed C (%yield, %token) = begin_apply %m(%2) : $@yield_once @convention(method) (@guaranteed D) -> @yields @guaranteed C %yield_mark = mark_dependence [nonescaping] %guaranteed_mark : $C on %yield : $C specify_test "lifetime_dependence_scope %yield_mark" diff --git a/test/SILOptimizer/liveness_unit.sil b/test/SILOptimizer/liveness_unit.sil index f59659aeff7f0..f09d23384ae0b 100644 --- a/test/SILOptimizer/liveness_unit.sil +++ b/test/SILOptimizer/liveness_unit.sil @@ -142,7 +142,7 @@ bb0(%0 : @owned $D): sil [ossa] @testGuaranteedResult : $@convention(thin) (@guaranteed D) -> () { bb0(%0 : @guaranteed $D): specify_test "ssa_liveness @argument[0]" - %2 = class_method %0 : $D, #D.borrowed!read : (D) -> () -> (), $@yield_once @convention(method) (@guaranteed D) -> @yields @guaranteed C + %2 = class_method %0 : $D, #D.borrowed!read : (D) -> @yield_once () -> @yields C, $@yield_once @convention(method) (@guaranteed D) -> @yields @guaranteed C (%3, %4) = begin_apply %2(%0) : $@yield_once @convention(method) (@guaranteed D) -> @yields @guaranteed C end_apply %4 as $() %99 = tuple() diff --git a/test/SILOptimizer/mandatory_combiner_opt.sil b/test/SILOptimizer/mandatory_combiner_opt.sil index ea63669871724..a16d1563ffeeb 100644 --- a/test/SILOptimizer/mandatory_combiner_opt.sil +++ b/test/SILOptimizer/mandatory_combiner_opt.sil @@ -118,7 +118,7 @@ class C { // CHECK-LABEL: sil hidden [ossa] @testCoroutineBorrow : $@convention(thin) (@owned C, Builtin.Int64) -> () { // CHECK-LABEL: bb0(%0 : @owned $C, %1 : $Builtin.Int64): // CHECK-NOT: borrow -// CHECK: class_method %0 : $C, #C.float!modify : (C) -> () -> (), $@yield_once @convention(method) (@guaranteed C) -> @yields @inout Builtin.Int64 +// CHECK: class_method %0 : $C, #C.float!modify : (C) -> @yield_once () -> inout @yields Builtin.Int64, $@yield_once @convention(method) (@guaranteed C) -> @yields @inout Builtin.Int64 // CHECK: begin_apply %{{.*}}(%0) : $@yield_once @convention(method) (@guaranteed C) -> @yields @inout Builtin.Int64 // CHECK-NOT: borrow // CHECK: destroy_value %0 : $C @@ -126,7 +126,7 @@ class C { sil hidden [ossa] @testCoroutineBorrow : $@convention(thin) (@owned C, Builtin.Int64) -> () { bb0(%0 : @owned $C, %1 : $Builtin.Int64): %14 = begin_borrow %0 : $C - %15 = class_method %14 : $C, #C.float!modify : (C) -> () -> (), $@yield_once @convention(method) (@guaranteed C) -> @yields @inout Builtin.Int64 + %15 = class_method %14 : $C, #C.float!modify : (C) -> @yield_once () -> inout @yields Builtin.Int64, $@yield_once @convention(method) (@guaranteed C) -> @yields @inout Builtin.Int64 (%16, %17) = begin_apply %15(%14) : $@yield_once @convention(method) (@guaranteed C) -> @yields @inout Builtin.Int64 store %1 to [trivial] %16 : $*Builtin.Int64 end_apply %17 as $() diff --git a/test/SILOptimizer/mandatory_inlining_ownership.sil b/test/SILOptimizer/mandatory_inlining_ownership.sil index 73adf0d336f1b..dce28f5ba2e72 100644 --- a/test/SILOptimizer/mandatory_inlining_ownership.sil +++ b/test/SILOptimizer/mandatory_inlining_ownership.sil @@ -569,7 +569,7 @@ bb2: // CHECK: } // end sil function 'begin_apply_devirt_caller' sil [ossa] @begin_apply_devirt_caller : $@convention(method) (@owned C2) -> @error Error { bb0(%0 : @owned $C2): - %1 = class_method %0 : $C2, #C2.i!modify : (C2) -> () -> (), $@yield_once @convention(method) (@guaranteed C2) -> @yields @inout Builtin.Int64 + %1 = class_method %0 : $C2, #C2.i!modify : (C2) -> @yield_once () -> inout @yields Builtin.Int64, $@yield_once @convention(method) (@guaranteed C2) -> @yields @inout Builtin.Int64 (%mem, %tok) = begin_apply %1(%0) : $@yield_once @convention(method) (@guaranteed C2) -> @yields @inout Builtin.Int64 br bb1 @@ -585,7 +585,7 @@ bb1: // CHECK: } // end sil function 'begin_apply_devirt_caller_2' sil [ossa] @begin_apply_devirt_caller_2 : $@convention(method) (@owned C2) -> @error Error { bb0(%0 : @owned $C2): - %1 = class_method %0 : $C2, #C2.i!modify : (C2) -> () -> (), $@yield_once @convention(method) (@guaranteed C2) -> @yields @inout Builtin.Int64 + %1 = class_method %0 : $C2, #C2.i!modify : (C2) -> @yield_once () -> inout @yields Builtin.Int64, $@yield_once @convention(method) (@guaranteed C2) -> @yields @inout Builtin.Int64 (%mem, %tok) = begin_apply %1(%0) : $@yield_once @convention(method) (@guaranteed C2) -> @yields @inout Builtin.Int64 br bb1 @@ -601,7 +601,7 @@ bb1: // CHECK: } // end sil function 'begin_apply_devirt_caller_3' sil [ossa] @begin_apply_devirt_caller_3 : $@convention(method) (@owned C2) -> @error Error { bb0(%0 : @owned $C2): - %1 = class_method %0 : $C2, #C2.i!modify : (C2) -> () -> (), $@yield_once @convention(method) (@guaranteed C2) -> @yields @inout Builtin.Int64 + %1 = class_method %0 : $C2, #C2.i!modify : (C2) -> @yield_once () -> inout @yields Builtin.Int64, $@yield_once @convention(method) (@guaranteed C2) -> @yields @inout Builtin.Int64 (%mem, %tok) = begin_apply %1(%0) : $@yield_once @convention(method) (@guaranteed C2) -> @yields @inout Builtin.Int64 cond_br undef, bb1, bb2 @@ -656,5 +656,5 @@ bb0(%0 : $Int): } sil_vtable C2 { - #C2.i!modify: (C2) -> () -> () : @devirt_callee + #C2.i!modify: (C2) -> @yield_once () -> inout @yields Builtin.Int64 : @devirt_callee } diff --git a/test/SILOptimizer/package-cmo-deserialize-for-external-client.swift b/test/SILOptimizer/package-cmo-deserialize-for-external-client.swift index 2b258cbfa53b5..a5a69ac10e0b6 100644 --- a/test/SILOptimizer/package-cmo-deserialize-for-external-client.swift +++ b/test/SILOptimizer/package-cmo-deserialize-for-external-client.swift @@ -30,17 +30,17 @@ // CHECK-INPKG: sil_vtable Pub { // CHECK-INPKG: #Pub.pubVar!getter: (Pub) -> () -> Int : @$s3Lib3PubC6pubVarSivg // Pub.pubVar.getter // CHECK-INPKG: #Pub.pubVar!setter: (Pub) -> (Int) -> () : @$s3Lib3PubC6pubVarSivs // Pub.pubVar.setter -// CHECK-INPKG: #Pub.pubVar!modify: (Pub) -> () -> () : @$s3Lib3PubC6pubVarSivM // Pub.pubVar.modify +// CHECK-INPKG: #Pub.pubVar!modify: (Pub) -> @yield_once () -> inout @yields Int : @$s3Lib3PubC6pubVarSivM // Pub.pubVar.modify // CHECK-INPKG: #Pub.pkgVar!getter: (Pub) -> () -> Int : @$s3Lib3PubC6pkgVarSivg // Pub.pkgVar.getter // CHECK-INPKG: #Pub.pkgVar!setter: (Pub) -> (Int) -> () : @$s3Lib3PubC6pkgVarSivs // Pub.pkgVar.setter -// CHECK-INPKG: #Pub.pkgVar!modify: (Pub) -> () -> () : @$s3Lib3PubC6pkgVarSivM // Pub.pkgVar.modify +// CHECK-INPKG: #Pub.pkgVar!modify: (Pub) -> @yield_once () -> inout @yields Int : @$s3Lib3PubC6pkgVarSivM // Pub.pkgVar.modify // CHECK-INPKG: #Pub.init!allocator: (Pub.Type) -> (Int) -> Pub : @$s3Lib3PubCyACSicfC // Pub.__allocating_init(_:) // CHECK-INPKG: #Pub.deinit!deallocator: @$s3Lib3PubCfD // Pub.__deallocating_deinit // CHECK-INPKG: sil_witness_table public_external Pub: PubProto module Lib { // CHECK-INPKG: method #PubProto.pubVar!getter: (Self) -> () -> Int : @$s3Lib3PubCAA0B5ProtoA2aDP6pubVarSivgTW // protocol witness for PubProto.pubVar.getter in conformance Pub // CHECK-INPKG: method #PubProto.pubVar!setter: (inout Self) -> (Int) -> () : @$s3Lib3PubCAA0B5ProtoA2aDP6pubVarSivsTW // protocol witness for PubProto.pubVar.setter in conformance Pub -// CHECK-INPKG: method #PubProto.pubVar!modify: (inout Self) -> () -> () : @$s3Lib3PubCAA0B5ProtoA2aDP6pubVarSivMTW // protocol witness for PubProto.pubVar.modify in conformance Pub +// CHECK-INPKG: method #PubProto.pubVar!modify: (inout Self) -> @yield_once () -> inout @yields Int : @$s3Lib3PubCAA0B5ProtoA2aDP6pubVarSivMTW // protocol witness for PubProto.pubVar.modify in conformance Pub /// Test 2: They should NOT be deserialized into Client as Lib and Client are NOT in the same package; @@ -78,17 +78,17 @@ // CHECK-LIB: sil_vtable [serialized_for_package] Pub { // CHECK-LIB: #Pub.pubVar!getter: (Pub) -> () -> Int : @$s3Lib3PubC6pubVarSivg // Pub.pubVar.getter // CHECK-LIB: #Pub.pubVar!setter: (Pub) -> (Int) -> () : @$s3Lib3PubC6pubVarSivs // Pub.pubVar.setter -// CHECK-LIB: #Pub.pubVar!modify: (Pub) -> () -> () : @$s3Lib3PubC6pubVarSivM // Pub.pubVar.modify +// CHECK-LIB: #Pub.pubVar!modify: (Pub) -> @yield_once () -> inout @yields Int : @$s3Lib3PubC6pubVarSivM // Pub.pubVar.modify // CHECK-LIB: #Pub.pkgVar!getter: (Pub) -> () -> Int : @$s3Lib3PubC6pkgVarSivg // Pub.pkgVar.getter // CHECK-LIB: #Pub.pkgVar!setter: (Pub) -> (Int) -> () : @$s3Lib3PubC6pkgVarSivs // Pub.pkgVar.setter -// CHECK-LIB: #Pub.pkgVar!modify: (Pub) -> () -> () : @$s3Lib3PubC6pkgVarSivM // Pub.pkgVar.modify +// CHECK-LIB: #Pub.pkgVar!modify: (Pub) -> @yield_once () -> inout @yields Int : @$s3Lib3PubC6pkgVarSivM // Pub.pkgVar.modify // CHECK-LIB: #Pub.init!allocator: (Pub.Type) -> (Int) -> Pub : @$s3Lib3PubCyACSicfC // Pub.__allocating_init(_:) // CHECK-LIB: #Pub.deinit!deallocator: @$s3Lib3PubCfD // Pub.__deallocating_deinit // CHECK-LIB: sil_witness_table [serialized_for_package] Pub: PubProto module Lib { // CHECK-LIB: method #PubProto.pubVar!getter: (Self) -> () -> Int : @$s3Lib3PubCAA0B5ProtoA2aDP6pubVarSivgTW // protocol witness for PubProto.pubVar.getter in conformance Pub // CHECK-LIB: method #PubProto.pubVar!setter: (inout Self) -> (Int) -> () : @$s3Lib3PubCAA0B5ProtoA2aDP6pubVarSivsTW // protocol witness for PubProto.pubVar.setter in conformance Pub -// CHECK-LIB: method #PubProto.pubVar!modify: (inout Self) -> () -> () : @$s3Lib3PubCAA0B5ProtoA2aDP6pubVarSivMTW // protocol witness for PubProto.pubVar.modify in conformance Pub +// CHECK-LIB: method #PubProto.pubVar!modify: (inout Self) -> @yield_once () -> inout @yields Int : @$s3Lib3PubCAA0B5ProtoA2aDP6pubVarSivMTW // protocol witness for PubProto.pubVar.modify in conformance Pub //--- Lib.swift diff --git a/test/SILOptimizer/package-cmo-resilient-mode.swift b/test/SILOptimizer/package-cmo-resilient-mode.swift index ccd1c6348a20c..59fd511b38a60 100644 --- a/test/SILOptimizer/package-cmo-resilient-mode.swift +++ b/test/SILOptimizer/package-cmo-resilient-mode.swift @@ -536,7 +536,7 @@ final package class FinalPkgKlass { // CHECK-NONRES-LABEL: sil_vtable [serialized] PubKlass { // CHECK-COMMON-NEXT: #PubKlass.data!getter: (PubKlass) -> () -> Int : @$s3Lib8PubKlassC4dataSivg // CHECK-COMMON-NEXT: #PubKlass.data!setter: (PubKlass) -> (Int) -> () : @$s3Lib8PubKlassC4dataSivs -// CHECK-COMMON-NEXT: #PubKlass.data!modify: (PubKlass) -> () -> () : @$s3Lib8PubKlassC4dataSivM +// CHECK-COMMON-NEXT: #PubKlass.data!modify: (PubKlass) -> @yield_once () -> inout @yields Int : @$s3Lib8PubKlassC4dataSivM // CHECK-COMMON-NEXT: #PubKlass.init!allocator: (PubKlass.Type) -> (Int) -> PubKlass : @$s3Lib8PubKlassCyACSicfC // CHECK-COMMON-NEXT: #PubKlass.pubfunc: (PubKlass) -> (Int) -> Int : @$s3Lib8PubKlassC7pubfuncyS2iF // CHECK-COMMON-NEXT: #PubKlass.deinit!deallocator: @$s3Lib8PubKlassCfD @@ -549,7 +549,7 @@ final package class FinalPkgKlass { // CHECK-RES-LABEL: sil_vtable [serialized_for_package] PkgKlass { // CHECK-RES-NEXT: #PkgKlass.data!getter: (PkgKlass) -> () -> Int : @$s3Lib8PkgKlassC4dataSivg // CHECK-RES-NEXT: #PkgKlass.data!setter: (PkgKlass) -> (Int) -> () : @$s3Lib8PkgKlassC4dataSivs -// CHECK-RES-NEXT: #PkgKlass.data!modify: (PkgKlass) -> () -> () : @$s3Lib8PkgKlassC4dataSivM +// CHECK-RES-NEXT: #PkgKlass.data!modify: (PkgKlass) -> @yield_once () -> inout @yields Int : @$s3Lib8PkgKlassC4dataSivM // CHECK-RES-NEXT: #PkgKlass.init!allocator: (PkgKlass.Type) -> (Int) -> PkgKlass : @$s3Lib8PkgKlassCyACSicfC // CHECK-RES-NEXT: #PkgKlass.pkgfunc: (PkgKlass) -> (Int) -> Int : @$s3Lib8PkgKlassC7pkgfuncyS2iF // CHECK-RES-NEXT: #PkgKlass.deinit!deallocator: @$s3Lib8PkgKlassCfD @@ -562,11 +562,11 @@ final package class FinalPkgKlass { // CHECK-NONRES-LABEL: sil_witness_table [serialized] PubKlass: PubProto module Lib { // CHECK-COMMON-NEXT: method #PubProto.data!getter: (Self) -> () -> Int : @$s3Lib8PubKlassCAA0B5ProtoA2aDP4dataSivgTW // CHECK-COMMON-NEXT: method #PubProto.data!setter: (inout Self) -> (Int) -> () : @$s3Lib8PubKlassCAA0B5ProtoA2aDP4dataSivsTW -// CHECK-COMMON-NEXT: method #PubProto.data!modify: (inout Self) -> () -> () : @$s3Lib8PubKlassCAA0B5ProtoA2aDP4dataSivMTW +// CHECK-COMMON-NEXT: method #PubProto.data!modify: (inout Self) -> @yield_once () -> inout @yields Int : @$s3Lib8PubKlassCAA0B5ProtoA2aDP4dataSivMTW // CHECK-COMMON-NEXT: method #PubProto.pubfunc: (Self) -> (Int) -> Int : @$s3Lib8PubKlassCAA0B5ProtoA2aDP7pubfuncyS2iFTW // CHECK-RES-LABEL: sil_witness_table package [serialized_for_package] PkgKlass: PkgProto module Lib { // CHECK-RES-NEXT: method #PkgProto.data!getter: (Self) -> () -> Int : @$s3Lib8PkgKlassCAA0B5ProtoA2aDP4dataSivgTW // CHECK-RES-NEXT: method #PkgProto.data!setter: (inout Self) -> (Int) -> () : @$s3Lib8PkgKlassCAA0B5ProtoA2aDP4dataSivsTW -// CHECK-RES-NEXT: method #PkgProto.data!modify: (inout Self) -> () -> () : @$s3Lib8PkgKlassCAA0B5ProtoA2aDP4dataSivMTW +// CHECK-RES-NEXT: method #PkgProto.data!modify: (inout Self) -> @yield_once () -> inout @yields Int : @$s3Lib8PkgKlassCAA0B5ProtoA2aDP4dataSivMTW // CHECK-RES-NEXT: method #PkgProto.pkgfunc: (Self) -> (Int) -> Int : @$s3Lib8PkgKlassCAA0B5ProtoA2aDP7pkgfuncyS2iFTW diff --git a/test/SILOptimizer/package-cmo-serialize-tables.swift b/test/SILOptimizer/package-cmo-serialize-tables.swift index f54e02010d4b9..1059ee26bed24 100644 --- a/test/SILOptimizer/package-cmo-serialize-tables.swift +++ b/test/SILOptimizer/package-cmo-serialize-tables.swift @@ -472,7 +472,7 @@ package func runPkg(_ arg: [any PkgProto]) { // CHECK-LABEL: sil_vtable [serialized_for_package] ParentPubKlass { // CHECK-NEXT: #ParentPubKlass.parentPubVar!getter: (ParentPubKlass) -> () -> Int : @$s3Lib14ParentPubKlassC06parentC3VarSivg // ParentPubKlass.parentPubVar.getter // CHECK-NEXT: #ParentPubKlass.parentPubVar!setter: (ParentPubKlass) -> (Int) -> () : @$s3Lib14ParentPubKlassC06parentC3VarSivs // ParentPubKlass.parentPubVar.setter -// CHECK-NEXT: #ParentPubKlass.parentPubVar!modify: (ParentPubKlass) -> () -> () : @$s3Lib14ParentPubKlassC06parentC3VarSivM // ParentPubKlass.parentPubVar.modify +// CHECK-NEXT: #ParentPubKlass.parentPubVar!modify: (ParentPubKlass) -> @yield_once () -> inout @yields Int : @$s3Lib14ParentPubKlassC06parentC3VarSivM // ParentPubKlass.parentPubVar.modify // CHECK-NEXT: #ParentPubKlass.init!allocator: (ParentPubKlass.Type) -> (Int) -> ParentPubKlass : @$s3Lib14ParentPubKlassCyACSicfC // ParentPubKlass.__allocating_init(_:) // CHECK-NEXT: #ParentPubKlass.parentPubFunc: (ParentPubKlass) -> () -> () : @$s3Lib14ParentPubKlassC06parentC4FuncyyF // ParentPubKlass.parentPubFunc() // CHECK-NEXT: #ParentPubKlass.deinit!deallocator: @$s3Lib14ParentPubKlassCfD // ParentPubKlass.__deallocating_deinit @@ -480,12 +480,12 @@ package func runPkg(_ arg: [any PkgProto]) { // CHECK-LABEL: sil_vtable [serialized_for_package] PubKlass { // CHECK-NEXT: #ParentPubKlass.parentPubVar!getter: (ParentPubKlass) -> () -> Int : @$s3Lib14ParentPubKlassC06parentC3VarSivg [inherited] // ParentPubKlass.parentPubVar.getter // CHECK-NEXT: #ParentPubKlass.parentPubVar!setter: (ParentPubKlass) -> (Int) -> () : @$s3Lib14ParentPubKlassC06parentC3VarSivs [inherited] // ParentPubKlass.parentPubVar.setter -// CHECK-NEXT: #ParentPubKlass.parentPubVar!modify: (ParentPubKlass) -> () -> () : @$s3Lib14ParentPubKlassC06parentC3VarSivM [inherited] // ParentPubKlass.parentPubVar.modify +// CHECK-NEXT: #ParentPubKlass.parentPubVar!modify: (ParentPubKlass) -> @yield_once () -> inout @yields Int : @$s3Lib14ParentPubKlassC06parentC3VarSivM [inherited] // ParentPubKlass.parentPubVar.modify // CHECK-NEXT: #ParentPubKlass.init!allocator: (ParentPubKlass.Type) -> (Int) -> ParentPubKlass : @$s3Lib8PubKlassCyACSicfC [override] // PubKlass.__allocating_init(_:) // CHECK-NEXT: #ParentPubKlass.parentPubFunc: (ParentPubKlass) -> () -> () : @$s3Lib8PubKlassC06parentB4FuncyyF [override] // PubKlass.parentPubFunc() // CHECK-NEXT: #PubKlass.pubVar!getter: (PubKlass) -> () -> String : @$s3Lib8PubKlassC6pubVarSSvg // PubKlass.pubVar.getter // CHECK-NEXT: #PubKlass.pubVar!setter: (PubKlass) -> (String) -> () : @$s3Lib8PubKlassC6pubVarSSvs // PubKlass.pubVar.setter -// CHECK-NEXT: #PubKlass.pubVar!modify: (PubKlass) -> () -> () : @$s3Lib8PubKlassC6pubVarSSvM // PubKlass.pubVar.modify +// CHECK-NEXT: #PubKlass.pubVar!modify: (PubKlass) -> @yield_once () -> inout @yields String : @$s3Lib8PubKlassC6pubVarSSvM // PubKlass.pubVar.modify // CHECK-NEXT: #PubKlass.init!allocator: (PubKlass.Type) -> (String) -> PubKlass : @$s3Lib8PubKlassCyACSScfC // PubKlass.__allocating_init(_:) // CHECK-NEXT: #PubKlass.pubFunc: (PubKlass) -> () -> () : @$s3Lib8PubKlassC7pubFuncyyF // PubKlass.pubFunc() // CHECK-NEXT: #PubKlass.deinit!deallocator: @$s3Lib8PubKlassCfD // PubKlass.__deallocating_deinit @@ -494,7 +494,7 @@ package func runPkg(_ arg: [any PkgProto]) { // CHECK-LABEL: sil_vtable [serialized_for_package] ParentPkgKlass { // CHECK-NEXT: #ParentPkgKlass.parentPkgVar!getter: (ParentPkgKlass) -> () -> Int : @$s3Lib14ParentPkgKlassC06parentC3VarSivg // ParentPkgKlass.parentPkgVar.getter // CHECK-NEXT: #ParentPkgKlass.parentPkgVar!setter: (ParentPkgKlass) -> (Int) -> () : @$s3Lib14ParentPkgKlassC06parentC3VarSivs // ParentPkgKlass.parentPkgVar.setter -// CHECK-NEXT: #ParentPkgKlass.parentPkgVar!modify: (ParentPkgKlass) -> () -> () : @$s3Lib14ParentPkgKlassC06parentC3VarSivM // ParentPkgKlass.parentPkgVar.modify +// CHECK-NEXT: #ParentPkgKlass.parentPkgVar!modify: (ParentPkgKlass) -> @yield_once () -> inout @yields Int : @$s3Lib14ParentPkgKlassC06parentC3VarSivM // ParentPkgKlass.parentPkgVar.modify // CHECK-NEXT: #ParentPkgKlass.init!allocator: (ParentPkgKlass.Type) -> (Int) -> ParentPkgKlass : @$s3Lib14ParentPkgKlassCyACSicfC // ParentPkgKlass.__allocating_init(_:) // CHECK-NEXT: #ParentPkgKlass.parentPkgFunc: (ParentPkgKlass) -> () -> Int : @$s3Lib14ParentPkgKlassC06parentC4FuncSiyF // ParentPkgKlass.parentPkgFunc() // CHECK-NEXT: #ParentPkgKlass.deinit!deallocator: @$s3Lib14ParentPkgKlassCfD // ParentPkgKlass.__deallocating_deinit @@ -502,12 +502,12 @@ package func runPkg(_ arg: [any PkgProto]) { // CHECK-LABEL: sil_vtable [serialized_for_package] PkgKlass { // CHECK-NEXT: #ParentPkgKlass.parentPkgVar!getter: (ParentPkgKlass) -> () -> Int : @$s3Lib14ParentPkgKlassC06parentC3VarSivg [inherited] // ParentPkgKlass.parentPkgVar.getter // CHECK-NEXT: #ParentPkgKlass.parentPkgVar!setter: (ParentPkgKlass) -> (Int) -> () : @$s3Lib14ParentPkgKlassC06parentC3VarSivs [inherited] // ParentPkgKlass.parentPkgVar.setter -// CHECK-NEXT: #ParentPkgKlass.parentPkgVar!modify: (ParentPkgKlass) -> () -> () : @$s3Lib14ParentPkgKlassC06parentC3VarSivM [inherited] // ParentPkgKlass.parentPkgVar.modify +// CHECK-NEXT: #ParentPkgKlass.parentPkgVar!modify: (ParentPkgKlass) -> @yield_once () -> inout @yields Int : @$s3Lib14ParentPkgKlassC06parentC3VarSivM [inherited] // ParentPkgKlass.parentPkgVar.modify // CHECK-NEXT: #ParentPkgKlass.init!allocator: (ParentPkgKlass.Type) -> (Int) -> ParentPkgKlass : @$s3Lib8PkgKlassCyACSicfC [override] // PkgKlass.__allocating_init(_:) // CHECK-NEXT: #ParentPkgKlass.parentPkgFunc: (ParentPkgKlass) -> () -> Int : @$s3Lib8PkgKlassC06parentB4FuncSiyF [override] // PkgKlass.parentPkgFunc() // CHECK-NEXT: #PkgKlass.pkgVar!getter: (PkgKlass) -> () -> String : @$s3Lib8PkgKlassC6pkgVarSSvg // PkgKlass.pkgVar.getter // CHECK-NEXT: #PkgKlass.pkgVar!setter: (PkgKlass) -> (String) -> () : @$s3Lib8PkgKlassC6pkgVarSSvs // PkgKlass.pkgVar.setter -// CHECK-NEXT: #PkgKlass.pkgVar!modify: (PkgKlass) -> () -> () : @$s3Lib8PkgKlassC6pkgVarSSvM // PkgKlass.pkgVar.modify +// CHECK-NEXT: #PkgKlass.pkgVar!modify: (PkgKlass) -> @yield_once () -> inout @yields String : @$s3Lib8PkgKlassC6pkgVarSSvM // PkgKlass.pkgVar.modify // CHECK-NEXT: #PkgKlass.init!allocator: (PkgKlass.Type) -> (String) -> PkgKlass : @$s3Lib8PkgKlassCyACSScfC // PkgKlass.__allocating_init(_:) // CHECK-NEXT: #PkgKlass.pkgFunc: (PkgKlass) -> () -> () : @$s3Lib8PkgKlassC7pkgFuncyyF // PkgKlass.pkgFunc() // CHECK-NEXT: #PkgKlass.deinit!deallocator: @$s3Lib8PkgKlassCfD // PkgKlass.__deallocating_deinit @@ -516,7 +516,7 @@ package func runPkg(_ arg: [any PkgProto]) { // CHECK-LABEL: sil_vtable [serialized_for_package] PubKlassZ { // CHECK-NEXT: #PubKlassZ.env!getter: (PubKlassZ) -> () -> UInt16 : @$s3Lib9PubKlassZC3envs6UInt16Vvg // PubKlassZ.env.getter // CHECK-NEXT: #PubKlassZ.env!setter: (PubKlassZ) -> (UInt16) -> () : @$s3Lib9PubKlassZC3envs6UInt16Vvs // PubKlassZ.env.setter -// CHECK-NEXT: #PubKlassZ.env!modify: (PubKlassZ) -> () -> () : @$s3Lib9PubKlassZC3envs6UInt16VvM // PubKlassZ.env.modify +// CHECK-NEXT: #PubKlassZ.env!modify: (PubKlassZ) -> @yield_once () -> inout @yields UInt16 : @$s3Lib9PubKlassZC3envs6UInt16VvM // PubKlassZ.env.modify // CHECK-NEXT: #PubKlassZ.init!allocator: (PubKlassZ.Type) -> (UInt16) -> PubKlassZ : @$s3Lib9PubKlassZC8rawValueACs6UInt16V_tcfC // PubKlassZ.__allocating_init(rawValue:) // CHECK-NEXT: #PubKlassZ.pubFunc: (PubKlassZ) -> () -> () : @$s3Lib9PubKlassZC7pubFuncyyF // PubKlassZ.pubFunc() // CHECK-NEXT: #PubKlassZ.deinit!deallocator: @$s3Lib9PubKlassZCfD // PubKlassZ.__deallocating_deinit @@ -525,7 +525,7 @@ package func runPkg(_ arg: [any PkgProto]) { // CHECK-LABEL: sil_vtable [serialized_for_package] PkgKlassZ { // CHECK-NEXT: #PkgKlassZ.env!getter: (PkgKlassZ) -> () -> UInt16 : @$s3Lib9PkgKlassZC3envs6UInt16Vvg // PkgKlassZ.env.getter // CHECK-NEXT: #PkgKlassZ.env!setter: (PkgKlassZ) -> (UInt16) -> () : @$s3Lib9PkgKlassZC3envs6UInt16Vvs // PkgKlassZ.env.setter -// CHECK-NEXT: #PkgKlassZ.env!modify: (PkgKlassZ) -> () -> () : @$s3Lib9PkgKlassZC3envs6UInt16VvM // PkgKlassZ.env.modify +// CHECK-NEXT: #PkgKlassZ.env!modify: (PkgKlassZ) -> @yield_once () -> inout @yields UInt16 : @$s3Lib9PkgKlassZC3envs6UInt16VvM // PkgKlassZ.env.modify // CHECK-NEXT: #PkgKlassZ.init!allocator: (PkgKlassZ.Type) -> (UInt16) -> PkgKlassZ : @$s3Lib9PkgKlassZC8rawValueACs6UInt16V_tcfC // PkgKlassZ.__allocating_init(rawValue:) // CHECK-NEXT: #PkgKlassZ.pkgFunc: (PkgKlassZ) -> () -> () : @$s3Lib9PkgKlassZC7pkgFuncyyF // PkgKlassZ.pkgFunc() // CHECK-NEXT: #PkgKlassZ.deinit!deallocator: @$s3Lib9PkgKlassZCfD // PkgKlassZ.__deallocating_deinit @@ -536,7 +536,7 @@ package func runPkg(_ arg: [any PkgProto]) { //CHECK-NEXT: method #PubProto.root!getter: (Self.Type) -> () -> UInt16 : @$s3Lib9PubKlassZCAA0B5ProtoA2aDP4roots6UInt16VvgZTW //CHECK-NEXT: method #PubProto.env!getter: (Self) -> () -> UInt16 : @$s3Lib9PubKlassZCAA0B5ProtoA2aDP3envs6UInt16VvgTW //CHECK-NEXT: method #PubProto.env!setter: (inout Self) -> (UInt16) -> () : @$s3Lib9PubKlassZCAA0B5ProtoA2aDP3envs6UInt16VvsTW -//CHECK-NEXT: method #PubProto.env!modify: (inout Self) -> () -> () : @$s3Lib9PubKlassZCAA0B5ProtoA2aDP3envs6UInt16VvMTW +//CHECK-NEXT: method #PubProto.env!modify: (inout Self) -> @yield_once () -> inout @yields UInt16 : @$s3Lib9PubKlassZCAA0B5ProtoA2aDP3envs6UInt16VvMTW //CHECK-NEXT: method #PubProto.init!allocator: (Self.Type) -> (UInt16) -> Self : @$s3Lib9PubKlassZCAA0B5ProtoA2aDP8rawValuexs6UInt16V_tcfCTW //CHECK-NEXT: method #PubProto.pubFunc: (Self) -> () -> () : @$s3Lib9PubKlassZCAA0B5ProtoA2aDP7pubFuncyyFTW @@ -545,14 +545,14 @@ package func runPkg(_ arg: [any PkgProto]) { //CHECK-NEXT: method #PubProto.root!getter: (Self.Type) -> () -> UInt16 : @$s3Lib9PubStructVAA0B5ProtoA2aDP4roots6UInt16VvgZTW //CHECK-NEXT: method #PubProto.env!getter: (Self) -> () -> UInt16 : @$s3Lib9PubStructVAA0B5ProtoA2aDP3envs6UInt16VvgTW //CHECK-NEXT: method #PubProto.env!setter: (inout Self) -> (UInt16) -> () : @$s3Lib9PubStructVAA0B5ProtoA2aDP3envs6UInt16VvsTW -//CHECK-NEXT: method #PubProto.env!modify: (inout Self) -> () -> () : @$s3Lib9PubStructVAA0B5ProtoA2aDP3envs6UInt16VvMTW +//CHECK-NEXT: method #PubProto.env!modify: (inout Self) -> @yield_once () -> inout @yields UInt16 : @$s3Lib9PubStructVAA0B5ProtoA2aDP3envs6UInt16VvMTW //CHECK-NEXT: method #PubProto.init!allocator: (Self.Type) -> (UInt16) -> Self : @$s3Lib9PubStructVAA0B5ProtoA2aDP8rawValuexs6UInt16V_tcfCTW //CHECK-NEXT: method #PubProto.pubFunc: (Self) -> () -> () : @$s3Lib9PubStructVAA0B5ProtoA2aDP7pubFuncyyFTW //CHECK-LABEL: sil_witness_table [serialized_for_package] PubStructX: PubSimpleProto module Lib { //CHECK-NEXT: method #PubSimpleProto.pubVar!getter: (Self) -> () -> Int : @$s3Lib10PubStructXVAA0B11SimpleProtoA2aDP6pubVarSivgTW //CHECK-NEXT: method #PubSimpleProto.pubVar!setter: (inout Self) -> (Int) -> () : @$s3Lib10PubStructXVAA0B11SimpleProtoA2aDP6pubVarSivsTW -//CHECK-NEXT: method #PubSimpleProto.pubVar!modify: (inout Self) -> () -> () : @$s3Lib10PubStructXVAA0B11SimpleProtoA2aDP6pubVarSivMTW +//CHECK-NEXT: method #PubSimpleProto.pubVar!modify: (inout Self) -> @yield_once () -> inout @yields Int : @$s3Lib10PubStructXVAA0B11SimpleProtoA2aDP6pubVarSivMTW //CHECK-NEXT: method #PubSimpleProto.pubFunc: (Self) -> () -> Int : @$s3Lib10PubStructXVAA0B11SimpleProtoA2aDP7pubFuncSiyFTW //CHECK-LABEL: sil_witness_table package [serialized_for_package] PkgKlassZ: PkgProto module Lib { @@ -560,7 +560,7 @@ package func runPkg(_ arg: [any PkgProto]) { //CHECK-NEXT: method #PkgProto.root!getter: (Self.Type) -> () -> UInt16 : @$s3Lib9PkgKlassZCAA0B5ProtoA2aDP4roots6UInt16VvgZTW //CHECK-NEXT: method #PkgProto.env!getter: (Self) -> () -> UInt16 : @$s3Lib9PkgKlassZCAA0B5ProtoA2aDP3envs6UInt16VvgTW //CHECK-NEXT: method #PkgProto.env!setter: (inout Self) -> (UInt16) -> () : @$s3Lib9PkgKlassZCAA0B5ProtoA2aDP3envs6UInt16VvsTW -//CHECK-NEXT: method #PkgProto.env!modify: (inout Self) -> () -> () : @$s3Lib9PkgKlassZCAA0B5ProtoA2aDP3envs6UInt16VvMTW +//CHECK-NEXT: method #PkgProto.env!modify: (inout Self) -> @yield_once () -> inout @yields UInt16 : @$s3Lib9PkgKlassZCAA0B5ProtoA2aDP3envs6UInt16VvMTW //CHECK-NEXT: method #PkgProto.init!allocator: (Self.Type) -> (UInt16) -> Self : @$s3Lib9PkgKlassZCAA0B5ProtoA2aDP8rawValuexs6UInt16V_tcfCTW //CHECK-NEXT: method #PkgProto.pkgFunc: (Self) -> () -> () : @$s3Lib9PkgKlassZCAA0B5ProtoA2aDP7pkgFuncyyFTW @@ -569,12 +569,12 @@ package func runPkg(_ arg: [any PkgProto]) { //CHECK-NEXT: method #PkgProto.root!getter: (Self.Type) -> () -> UInt16 : @$s3Lib9PkgStructVAA0B5ProtoA2aDP4roots6UInt16VvgZTW //CHECK-NEXT: method #PkgProto.env!getter: (Self) -> () -> UInt16 : @$s3Lib9PkgStructVAA0B5ProtoA2aDP3envs6UInt16VvgTW //CHECK-NEXT: method #PkgProto.env!setter: (inout Self) -> (UInt16) -> () : @$s3Lib9PkgStructVAA0B5ProtoA2aDP3envs6UInt16VvsTW -//CHECK-NEXT: method #PkgProto.env!modify: (inout Self) -> () -> () : @$s3Lib9PkgStructVAA0B5ProtoA2aDP3envs6UInt16VvMTW +//CHECK-NEXT: method #PkgProto.env!modify: (inout Self) -> @yield_once () -> inout @yields UInt16 : @$s3Lib9PkgStructVAA0B5ProtoA2aDP3envs6UInt16VvMTW //CHECK-NEXT: method #PkgProto.init!allocator: (Self.Type) -> (UInt16) -> Self : @$s3Lib9PkgStructVAA0B5ProtoA2aDP8rawValuexs6UInt16V_tcfCTW //CHECK-NEXT: method #PkgProto.pkgFunc: (Self) -> () -> () : @$s3Lib9PkgStructVAA0B5ProtoA2aDP7pkgFuncyyFTW //CHECK-LABEL: sil_witness_table package [serialized_for_package] PkgStructX: PkgSimpleProto module Lib { //CHECK-NEXT: method #PkgSimpleProto.pkgVar!getter: (Self) -> () -> Int : @$s3Lib10PkgStructXVAA0B11SimpleProtoA2aDP6pkgVarSivgTW //CHECK-NEXT: method #PkgSimpleProto.pkgVar!setter: (inout Self) -> (Int) -> () : @$s3Lib10PkgStructXVAA0B11SimpleProtoA2aDP6pkgVarSivsTW -//CHECK-NEXT: method #PkgSimpleProto.pkgVar!modify: (inout Self) -> () -> () : @$s3Lib10PkgStructXVAA0B11SimpleProtoA2aDP6pkgVarSivMTW +//CHECK-NEXT: method #PkgSimpleProto.pkgVar!modify: (inout Self) -> @yield_once () -> inout @yields Int : @$s3Lib10PkgStructXVAA0B11SimpleProtoA2aDP6pkgVarSivMTW //CHECK-NEXT: method #PkgSimpleProto.pkgFunc: (Self) -> () -> Int : @$s3Lib10PkgStructXVAA0B11SimpleProtoA2aDP7pkgFuncSiyFTW diff --git a/test/SILOptimizer/simplify_begin_apply.sil b/test/SILOptimizer/simplify_begin_apply.sil index 33d5bf6aebe92..e879dc1cebc7f 100644 --- a/test/SILOptimizer/simplify_begin_apply.sil +++ b/test/SILOptimizer/simplify_begin_apply.sil @@ -20,7 +20,7 @@ class Bar { sil @devirt_class_method : $@convention(thin) () -> (Int, @error any Error) { bb0: %0 = alloc_ref $Bar - %1 = class_method %0 : $Bar, #Bar.field!read : (Bar) -> () -> (), $@yield_once @convention(method) (@guaranteed Bar) -> @yields Int + %1 = class_method %0 : $Bar, #Bar.field!read : (Bar) -> @yield_once () -> @yields Int, $@yield_once @convention(method) (@guaranteed Bar) -> @yields Int (%2, %3) = begin_apply %1(%0) : $@yield_once @convention(method) (@guaranteed Bar) -> @yields Int end_apply %3 as $() return %2 : $Int diff --git a/test/SILOptimizer/specialize_opaque_result_types.sil b/test/SILOptimizer/specialize_opaque_result_types.sil index c828944d417ae..cb91e83ca9df0 100644 --- a/test/SILOptimizer/specialize_opaque_result_types.sil +++ b/test/SILOptimizer/specialize_opaque_result_types.sil @@ -53,7 +53,7 @@ bb0(%0 : $*Optional<τ_0_0.Element>, %1 : $*IndexingIterator<τ_0_0>): copy_addr %3 to [init] %22 : $*τ_0_0.Index %24 = alloc_stack $τ_0_0 copy_addr [take] %20 to [init] %24 : $*τ_0_0 - %26 = witness_method $τ_0_0, #Collection.subscript!read : (Self) -> (Self.Index) -> () : $@yield_once @convention(witness_method: Collection) <τ_0_0 where τ_0_0 : Collection> (@in_guaranteed τ_0_0.Index, @in_guaranteed τ_0_0) -> @yields @in_guaranteed τ_0_0.Element + %26 = witness_method $τ_0_0, #Collection.subscript!read : (Self) -> @yield_once (Self.Index) -> @yields Self.Element : $@yield_once @convention(witness_method: Collection) <τ_0_0 where τ_0_0 : Collection> (@in_guaranteed τ_0_0.Index, @in_guaranteed τ_0_0) -> @yields @in_guaranteed τ_0_0.Element // The specialized begin apply %26 has a result type of t_0_0.Element // which works out to be an opaque result type whose underlying type is Int64. diff --git a/test/SILOptimizer/specialize_opaque_result_types_ossa.sil b/test/SILOptimizer/specialize_opaque_result_types_ossa.sil index 55199064e16e1..de5b72fd9e528 100644 --- a/test/SILOptimizer/specialize_opaque_result_types_ossa.sil +++ b/test/SILOptimizer/specialize_opaque_result_types_ossa.sil @@ -52,7 +52,7 @@ bb0(%0 : $*Optional<τ_0_0.Element>, %1 : $*IndexingIterator<τ_0_0>): copy_addr %3 to [init] %22 : $*τ_0_0.Index %24 = alloc_stack $τ_0_0 copy_addr [take] %20 to [init] %24 : $*τ_0_0 - %26 = witness_method $τ_0_0, #Collection.subscript!read : (Self) -> (Self.Index) -> () : $@yield_once @convention(witness_method: Collection) <τ_0_0 where τ_0_0 : Collection> (@in_guaranteed τ_0_0.Index, @in_guaranteed τ_0_0) -> @yields @in_guaranteed τ_0_0.Element + %26 = witness_method $τ_0_0, #Collection.subscript!read : (Self) -> @yield_once (Self.Index) -> @yields Self.Element : $@yield_once @convention(witness_method: Collection) <τ_0_0 where τ_0_0 : Collection> (@in_guaranteed τ_0_0.Index, @in_guaranteed τ_0_0) -> @yields @in_guaranteed τ_0_0.Element // The specialized begin apply %26 has a result type of t_0_0.Element // which works out to be an opaque result type whose underlying type is Int64. diff --git a/test/api-digester/Inputs/stability-stdlib-abi-without-asserts-arm64.txt b/test/api-digester/Inputs/stability-stdlib-abi-without-asserts-arm64.txt index 38664f1fe1785..4dfda79fcf676 100644 --- a/test/api-digester/Inputs/stability-stdlib-abi-without-asserts-arm64.txt +++ b/test/api-digester/Inputs/stability-stdlib-abi-without-asserts-arm64.txt @@ -3,8 +3,11 @@ Accessor __VaListBuilder.storage.Get() has mangled name changing from 'Swift.__VaListBuilder.storage.getter : Swift.ContiguousArray' to 'Swift.__VaListBuilder.storage.getter : Swift.Optional>' Accessor __VaListBuilder.storage.Get() has return type change from Swift.ContiguousArray to Swift.UnsafeMutablePointer? Accessor __VaListBuilder.storage.Modify() has mangled name changing from 'Swift.__VaListBuilder.storage.modify : Swift.ContiguousArray' to 'Swift.__VaListBuilder.storage.modify : Swift.Optional>' +Accessor __VaListBuilder.storage.Modify() has return type change from () to inout @yields Swift.UnsafeMutablePointer? Accessor __VaListBuilder.storage.Set() has mangled name changing from 'Swift.__VaListBuilder.storage.setter : Swift.ContiguousArray' to 'Swift.__VaListBuilder.storage.setter : Swift.Optional>' Accessor __VaListBuilder.storage.Set() has parameter 0 type change from Swift.ContiguousArray to Swift.UnsafeMutablePointer? +Accessor _fastEnumerationStorageMutationsTarget.Modify() has return type change from () to inout @yields Swift.UInt +Accessor _playgroundPrintHook.Modify() has return type change from () to inout @yields ((Swift.String) -> ())? Constructor BinaryFloatingPoint.init(_:) has been removed Constructor Double.init(_:) has mangled name changing from 'Swift.Double.init(Swift.Float80) -> Swift.Double' to 'Swift.Double.init(Swift.Float16) -> Swift.Double' Constructor Double.init(_:) has parameter 0 type change from Swift.Float80 to Swift.Float16 diff --git a/test/api-digester/Outputs/cake-abi.json b/test/api-digester/Outputs/cake-abi.json index a1697144c7a31..1db278006d15a 100644 --- a/test/api-digester/Outputs/cake-abi.json +++ b/test/api-digester/Outputs/cake-abi.json @@ -472,8 +472,8 @@ "children": [ { "kind": "TypeNominal", - "name": "Void", - "printedName": "()" + "name": "YieldResult", + "printedName": "inout @yields cake.C1?" } ], "declKind": "Accessor", @@ -568,8 +568,8 @@ "children": [ { "kind": "TypeNominal", - "name": "Void", - "printedName": "()" + "name": "YieldResult", + "printedName": "inout @yields cake.C1" } ], "declKind": "Accessor", @@ -974,8 +974,8 @@ "children": [ { "kind": "TypeNominal", - "name": "Void", - "printedName": "()" + "name": "YieldResult", + "printedName": "inout @yields Swift.Int" } ], "declKind": "Accessor", @@ -1355,8 +1355,8 @@ "children": [ { "kind": "TypeNominal", - "name": "Void", - "printedName": "()" + "name": "YieldResult", + "printedName": "inout @yields Swift.Int" }, { "kind": "TypeNominal", diff --git a/test/api-digester/stability-concurrency-abi.test b/test/api-digester/stability-concurrency-abi.test index 8e8e24505f24f..f92f23d1e1456 100644 --- a/test/api-digester/stability-concurrency-abi.test +++ b/test/api-digester/stability-concurrency-abi.test @@ -130,6 +130,44 @@ Func withTaskGroup(of:returning:body:) has mangled name changing from '_Concurre Func pthread_main_np() is a new API without '@available' +Accessor AsyncCompactMapSequence.Iterator.baseIterator.Modify() has return type change from () to inout @yields τ_0_0.AsyncIterator +Accessor AsyncDropFirstSequence.Iterator.baseIterator.Modify() has return type change from () to inout @yields τ_0_0.AsyncIterator +Accessor AsyncDropFirstSequence.Iterator.count.Modify() has return type change from () to inout @yields Swift.Int +Accessor AsyncDropWhileSequence.Iterator.baseIterator.Modify() has return type change from () to inout @yields τ_0_0.AsyncIterator +Accessor AsyncDropWhileSequence.Iterator.predicate.Modify() has return type change from () to inout @yields ((τ_0_0.Element) async -> Swift.Bool)? +Accessor AsyncFilterSequence.Iterator.baseIterator.Modify() has return type change from () to inout @yields τ_0_0.AsyncIterator +Accessor AsyncFlatMapSequence.Iterator.baseIterator.Modify() has return type change from () to inout @yields τ_0_0.AsyncIterator +Accessor AsyncFlatMapSequence.Iterator.currentIterator.Modify() has return type change from () to inout @yields τ_0_1.AsyncIterator? +Accessor AsyncFlatMapSequence.Iterator.finished.Modify() has return type change from () to inout @yields Swift.Bool +Accessor AsyncMapSequence.Iterator.baseIterator.Modify() has return type change from () to inout @yields τ_0_0.AsyncIterator +Accessor AsyncPrefixSequence.Iterator.baseIterator.Modify() has return type change from () to inout @yields τ_0_0.AsyncIterator +Accessor AsyncPrefixSequence.Iterator.remaining.Modify() has return type change from () to inout @yields Swift.Int +Accessor AsyncPrefixWhileSequence.Iterator.baseIterator.Modify() has return type change from () to inout @yields τ_0_0.AsyncIterator +Accessor AsyncPrefixWhileSequence.Iterator.predicateHasFailed.Modify() has return type change from () to inout @yields Swift.Bool +Accessor AsyncStream.Continuation.onTermination.Modify() has return type change from () to inout @yields ((_Concurrency.AsyncStream<τ_0_0>.Continuation.Termination) -> ())? +Accessor AsyncThrowingCompactMapSequence.Iterator.baseIterator.Modify() has return type change from () to inout @yields τ_0_0.AsyncIterator +Accessor AsyncThrowingCompactMapSequence.Iterator.finished.Modify() has return type change from () to inout @yields Swift.Bool +Accessor AsyncThrowingDropWhileSequence.Iterator.baseIterator.Modify() has return type change from () to inout @yields τ_0_0.AsyncIterator +Accessor AsyncThrowingDropWhileSequence.Iterator.doneDropping.Modify() has return type change from () to inout @yields Swift.Bool +Accessor AsyncThrowingDropWhileSequence.Iterator.finished.Modify() has return type change from () to inout @yields Swift.Bool +Accessor AsyncThrowingFilterSequence.Iterator.baseIterator.Modify() has return type change from () to inout @yields τ_0_0.AsyncIterator +Accessor AsyncThrowingFilterSequence.Iterator.finished.Modify() has return type change from () to inout @yields Swift.Bool +Accessor AsyncThrowingFlatMapSequence.Iterator.baseIterator.Modify() has return type change from () to inout @yields τ_0_0.AsyncIterator +Accessor AsyncThrowingFlatMapSequence.Iterator.currentIterator.Modify() has return type change from () to inout @yields τ_0_1.AsyncIterator? +Accessor AsyncThrowingFlatMapSequence.Iterator.finished.Modify() has return type change from () to inout @yields Swift.Bool +Accessor AsyncThrowingMapSequence.Iterator.baseIterator.Modify() has return type change from () to inout @yields τ_0_0.AsyncIterator +Accessor AsyncThrowingMapSequence.Iterator.finished.Modify() has return type change from () to inout @yields Swift.Bool +Accessor AsyncThrowingPrefixWhileSequence.Iterator.baseIterator.Modify() has return type change from () to inout @yields τ_0_0.AsyncIterator +Accessor AsyncThrowingPrefixWhileSequence.Iterator.predicateHasFailed.Modify() has return type change from () to inout @yields Swift.Bool +Accessor AsyncThrowingStream.Continuation.onTermination.Modify() has return type change from () to inout @yields ((_Concurrency.AsyncThrowingStream<τ_0_0, τ_0_1>.Continuation.Termination) -> ())? +Accessor TaskGroup.Iterator.finished.Modify() has return type change from () to inout @yields Swift.Bool +Accessor TaskGroup.Iterator.group.Modify() has return type change from () to inout @yields _Concurrency.TaskGroup<τ_0_0> +Accessor TaskPriority.rawValue.Modify() has return type change from () to inout @yields Swift.UInt8 +Accessor ThrowingTaskGroup.Iterator.finished.Modify() has return type change from () to inout @yields Swift.Bool +Accessor ThrowingTaskGroup.Iterator.group.Modify() has return type change from () to inout @yields _Concurrency.ThrowingTaskGroup<τ_0_0, τ_0_1> +Accessor UnownedSerialExecutor.executor.Modify() has return type change from () to inout @yields Builtin.Executor +Accessor UnsafeContinuation.context.Modify() has return type change from () to inout @yields Builtin.RawUnsafeContinuation + // *** DO NOT DISABLE OR XFAIL THIS TEST. *** (See comment above.) diff --git a/test/api-digester/stability-stdlib-abi-without-asserts.test b/test/api-digester/stability-stdlib-abi-without-asserts.test index 1f3d391db78a3..69a20906c5c8f 100644 --- a/test/api-digester/stability-stdlib-abi-without-asserts.test +++ b/test/api-digester/stability-stdlib-abi-without-asserts.test @@ -165,9 +165,13 @@ Func ContiguousArray._createNewBuffer(bufferIsUnique:minimumCapacity:growForAppe Func ContiguousArray._reserveCapacityImpl(minimumCapacity:growForAppend:) has been renamed to Func __specialize_class__reserveCapacityImpl(minimumCapacity:growForAppend:) Func ContiguousArray._reserveCapacityImpl(minimumCapacity:growForAppend:) has mangled name changing from 'Swift.ContiguousArray._reserveCapacityImpl(minimumCapacity: Swift.Int, growForAppend: Swift.Bool) -> ()' to 'Swift.ContiguousArray.__specialize_class__reserveCapacityImpl(minimumCapacity: Swift.Int, growForAppend: Swift.Bool) -> ()' -// This hasn't actually been changed, but it seems the ABI checker gives a false positive here and detects -// it as a removal with the addition of the RangeSet subscripts -Subscript MutableCollection.subscript(_:) has been removed +Subscript MutableCollection.subscript(_:) has generic signature change from to +Subscript MutableCollection.subscript(_:) has generic signature change from to +Subscript MutableCollection.subscript(_:) has mangled name changing from '(extension in Swift):Swift.MutableCollection.subscript(Swift.Range) -> Swift.Slice' to '(extension in Swift):Swift.MutableCollection.subscript(A1) -> A.SubSequence' +Subscript MutableCollection.subscript(_:) has mangled name changing from '(extension in Swift):Swift.MutableCollection.subscript(A1) -> A.SubSequence' to '(extension in Swift):Swift.MutableCollection.subscript((Swift.UnboundedRange_) -> ()) -> A.SubSequence' +Subscript MutableCollection.subscript(_:) has parameter 0 type change from Swift.Range<τ_0_0.Index> to τ_1_0 +Subscript MutableCollection.subscript(_:) has parameter 0 type change from τ_1_0 to (Swift.UnboundedRange_) -> () +Subscript MutableCollection.subscript(_:) has return type change from Swift.Slice<τ_0_0> to τ_0_0.SubSequence Protocol SIMDScalar has added inherited protocol BitwiseCopyable Protocol SIMDScalar has generic signature change from to @@ -366,6 +370,177 @@ Protocol _UnicodeParser has added inherited protocol Escapable Protocol __DefaultCustomPlaygroundQuickLookable has added inherited protocol Copyable Protocol __DefaultCustomPlaygroundQuickLookable has added inherited protocol Escapable +Accessor AnyIndex._box.Modify() has return type change from () to inout @yields any Swift._AnyIndexBox +Accessor Array._buffer.Modify() has return type change from () to inout @yields Swift._ArrayBuffer<τ_0_0> +Accessor Array.subscript(_:).Modify() has return type change from () to inout @yields Swift.ArraySlice<τ_0_0> +Accessor Array.subscript(_:).Modify() has return type change from () to inout @yields τ_0_0 +Accessor ArraySlice._buffer.Modify() has return type change from () to inout @yields Swift._SliceBuffer<τ_0_0> +Accessor ArraySlice.subscript(_:).Modify() has return type change from () to inout @yields Swift.ArraySlice<τ_0_0> +Accessor ArraySlice.subscript(_:).Modify() has return type change from () to inout @yields τ_0_0 +Accessor AutoreleasingUnsafeMutablePointer.pointee.Modify() has return type change from () to inout @yields τ_0_0 +Accessor BidirectionalCollection.subscript(_:).Read() has return type change from () to @yields τ_0_0.Element +Accessor Bool._value.Modify() has return type change from () to inout @yields Builtin.Int1 +Accessor CVaListPointer._value.Modify() has return type change from () to inout @yields Swift.UnsafeMutableRawPointer +Accessor Character._str.Modify() has return type change from () to inout @yields Swift.String +Accessor Collection.subscript(_:).Read() has return type change from () to @yields τ_0_0.Element +Accessor CollectionOfOne.Iterator._elements.Modify() has return type change from () to inout @yields τ_0_0? +Accessor CollectionOfOne._element.Modify() has return type change from () to inout @yields τ_0_0 +Accessor CollectionOfOne.subscript(_:).Modify() has return type change from () to inout @yields Swift.Slice> +Accessor CollectionOfOne.subscript(_:).Modify() has return type change from () to inout @yields τ_0_0 +Accessor CommandLine._argc.Modify() has return type change from () to inout @yields Swift.Int32 +Accessor CommandLine._unsafeArgv.Modify() has return type change from () to inout @yields Swift.UnsafeMutablePointer?> +Accessor CommandLine.arguments.Modify() has return type change from () to inout @yields [Swift.String] +Accessor ContiguousArray._buffer.Modify() has return type change from () to inout @yields Swift._ContiguousArrayBuffer<τ_0_0> +Accessor ContiguousArray.subscript(_:).Modify() has return type change from () to inout @yields Swift.ArraySlice<τ_0_0> +Accessor ContiguousArray.subscript(_:).Modify() has return type change from () to inout @yields τ_0_0 +Accessor DefaultIndices._elements.Modify() has return type change from () to inout @yields τ_0_0 +Accessor DefaultIndices._endIndex.Modify() has return type change from () to inout @yields τ_0_0.Index +Accessor DefaultIndices._startIndex.Modify() has return type change from () to inout @yields τ_0_0.Index +Accessor DefaultStringInterpolation._storage.Modify() has return type change from () to inout @yields Swift.String +Accessor Dictionary.Index._asCocoa.Modify() has return type change from () to inout @yields Swift.__CocoaDictionary.Index +Accessor Dictionary.Index._variant.Modify() has return type change from () to inout @yields Swift.Dictionary<τ_0_0, τ_0_1>.Index._Variant +Accessor Dictionary.Iterator._asNative.Modify() has return type change from () to inout @yields Swift._NativeDictionary<τ_0_0, τ_0_1>.Iterator +Accessor Dictionary.Iterator._variant.Modify() has return type change from () to inout @yields Swift.Dictionary<τ_0_0, τ_0_1>.Iterator._Variant +Accessor Dictionary.Keys.Iterator._base.Modify() has return type change from () to inout @yields Swift.Dictionary<τ_0_0, τ_0_1>.Iterator +Accessor Dictionary.Keys._variant.Modify() has return type change from () to inout @yields Swift.Dictionary<τ_0_0, τ_0_1>._Variant +Accessor Dictionary.Values.Iterator._base.Modify() has return type change from () to inout @yields Swift.Dictionary<τ_0_0, τ_0_1>.Iterator +Accessor Dictionary.Values._variant.Modify() has return type change from () to inout @yields Swift.Dictionary<τ_0_0, τ_0_1>._Variant +Accessor Dictionary.Values.subscript(_:).Modify() has return type change from () to inout @yields τ_0_1 +Accessor Dictionary._Variant.asNative.Modify() has return type change from () to inout @yields Swift._NativeDictionary<τ_0_0, τ_0_1> +Accessor Dictionary._Variant.object.Modify() has return type change from () to inout @yields Swift._BridgeStorage +Accessor Dictionary._Variant.subscript(_:).Modify() has return type change from () to inout @yields τ_0_1? +Accessor Dictionary._variant.Modify() has return type change from () to inout @yields Swift.Dictionary<τ_0_0, τ_0_1>._Variant +Accessor Dictionary.subscript(_:).Modify() has return type change from () to inout @yields τ_0_1? +Accessor Dictionary.subscript(_:default:).Modify() has return type change from () to inout @yields τ_0_1 +Accessor Dictionary.values.Modify() has return type change from () to inout @yields Swift.Dictionary<τ_0_0, τ_0_1>.Values +Accessor Double.SIMD16Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec16xFPIEEE64 +Accessor Double.SIMD16Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.Double +Accessor Double.SIMD2Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec2xFPIEEE64 +Accessor Double.SIMD2Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.Double +Accessor Double.SIMD32Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec32xFPIEEE64 +Accessor Double.SIMD32Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.Double +Accessor Double.SIMD4Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec4xFPIEEE64 +Accessor Double.SIMD4Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.Double +Accessor Double.SIMD64Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec64xFPIEEE64 +Accessor Double.SIMD64Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.Double +Accessor Double.SIMD8Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec8xFPIEEE64 +Accessor Double.SIMD8Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.Double +Accessor Double._value.Modify() has return type change from () to inout @yields Builtin.FPIEEE64 +Accessor DropWhileSequence.Iterator._iterator.Modify() has return type change from () to inout @yields τ_0_0.Iterator +Accessor DropWhileSequence.Iterator._nextElement.Modify() has return type change from () to inout @yields τ_0_0.Element? +Accessor DropWhileSequence._iterator.Modify() has return type change from () to inout @yields τ_0_0.Iterator +Accessor DropWhileSequence._nextElement.Modify() has return type change from () to inout @yields τ_0_0.Element? +Accessor EmptyCollection.subscript(_:).Modify() has return type change from () to inout @yields Swift.EmptyCollection<τ_0_0> +Accessor EmptyCollection.subscript(_:).Modify() has return type change from () to inout @yields τ_0_0 +Accessor EnumeratedSequence.Iterator._base.Modify() has return type change from () to inout @yields τ_0_0.Iterator +Accessor EnumeratedSequence.Iterator._count.Modify() has return type change from () to inout @yields Swift.Int +Accessor EnumeratedSequence._base.Modify() has return type change from () to inout @yields τ_0_0 +Accessor FlattenSequence.Iterator._base.Modify() has return type change from () to inout @yields τ_0_0.Iterator +Accessor FlattenSequence.Iterator._inner.Modify() has return type change from () to inout @yields τ_0_0.Element.Iterator? +Accessor FlattenSequence._base.Modify() has return type change from () to inout @yields τ_0_0 +Accessor Float.SIMD16Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec16xFPIEEE32 +Accessor Float.SIMD16Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.Float +Accessor Float.SIMD2Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec2xFPIEEE32 +Accessor Float.SIMD2Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.Float +Accessor Float.SIMD32Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec32xFPIEEE32 +Accessor Float.SIMD32Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.Float +Accessor Float.SIMD4Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec4xFPIEEE32 +Accessor Float.SIMD4Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.Float +Accessor Float.SIMD64Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec64xFPIEEE32 +Accessor Float.SIMD64Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.Float +Accessor Float.SIMD8Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec8xFPIEEE32 +Accessor Float.SIMD8Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.Float +Accessor Float._value.Modify() has return type change from () to inout @yields Builtin.FPIEEE32 +Accessor IndexingIterator._position.Modify() has return type change from () to inout @yields τ_0_0.Index +Accessor Int.SIMD16Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec16xInt64 +Accessor Int.SIMD16Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.Int +Accessor Int.SIMD2Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec2xInt64 +Accessor Int.SIMD2Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.Int +Accessor Int.SIMD32Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec32xInt64 +Accessor Int.SIMD32Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.Int +Accessor Int.SIMD4Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec4xInt64 +Accessor Int.SIMD4Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.Int +Accessor Int.SIMD64Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec64xInt64 +Accessor Int.SIMD64Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.Int +Accessor Int.SIMD8Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec8xInt64 +Accessor Int.SIMD8Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.Int +Accessor Int.Words._value.Modify() has return type change from () to inout @yields Swift.Int +Accessor Int._value.Modify() has return type change from () to inout @yields Builtin.Int64 +Accessor Int16.SIMD16Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec16xInt16 +Accessor Int16.SIMD16Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.Int16 +Accessor Int16.SIMD2Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec2xInt16 +Accessor Int16.SIMD2Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.Int16 +Accessor Int16.SIMD32Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec32xInt16 +Accessor Int16.SIMD32Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.Int16 +Accessor Int16.SIMD4Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec4xInt16 +Accessor Int16.SIMD4Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.Int16 +Accessor Int16.SIMD64Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec64xInt16 +Accessor Int16.SIMD64Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.Int16 +Accessor Int16.SIMD8Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec8xInt16 +Accessor Int16.SIMD8Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.Int16 +Accessor Int16.Words._value.Modify() has return type change from () to inout @yields Swift.Int16 +Accessor Int16._value.Modify() has return type change from () to inout @yields Builtin.Int16 +Accessor Int32.SIMD16Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec16xInt32 +Accessor Int32.SIMD16Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.Int32 +Accessor Int32.SIMD2Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec2xInt32 +Accessor Int32.SIMD2Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.Int32 +Accessor Int32.SIMD32Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec32xInt32 +Accessor Int32.SIMD32Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.Int32 +Accessor Int32.SIMD4Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec4xInt32 +Accessor Int32.SIMD4Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.Int32 +Accessor Int32.SIMD64Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec64xInt32 +Accessor Int32.SIMD64Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.Int32 +Accessor Int32.SIMD8Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec8xInt32 +Accessor Int32.SIMD8Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.Int32 +Accessor Int32.Words._value.Modify() has return type change from () to inout @yields Swift.Int32 +Accessor Int32._value.Modify() has return type change from () to inout @yields Builtin.Int32 +Accessor Int64.SIMD16Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec16xInt64 +Accessor Int64.SIMD16Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.Int64 +Accessor Int64.SIMD2Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec2xInt64 +Accessor Int64.SIMD2Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.Int64 +Accessor Int64.SIMD32Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec32xInt64 +Accessor Int64.SIMD32Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.Int64 +Accessor Int64.SIMD4Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec4xInt64 +Accessor Int64.SIMD4Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.Int64 +Accessor Int64.SIMD64Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec64xInt64 +Accessor Int64.SIMD64Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.Int64 +Accessor Int64.SIMD8Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec8xInt64 +Accessor Int64.SIMD8Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.Int64 +Accessor Int64.Words._value.Modify() has return type change from () to inout @yields Swift.Int64 +Accessor Int64._value.Modify() has return type change from () to inout @yields Builtin.Int64 +Accessor Int8.SIMD16Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec16xInt8 +Accessor Int8.SIMD16Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.Int8 +Accessor Int8.SIMD2Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec2xInt8 +Accessor Int8.SIMD2Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.Int8 +Accessor Int8.SIMD32Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec32xInt8 +Accessor Int8.SIMD32Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.Int8 +Accessor Int8.SIMD4Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec4xInt8 +Accessor Int8.SIMD4Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.Int8 +Accessor Int8.SIMD64Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec64xInt8 +Accessor Int8.SIMD64Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.Int8 +Accessor Int8.SIMD8Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec8xInt8 +Accessor Int8.SIMD8Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.Int8 +Accessor Int8.Words._value.Modify() has return type change from () to inout @yields Swift.Int8 +Accessor Int8._value.Modify() has return type change from () to inout @yields Builtin.Int8 +Accessor IteratorSequence._base.Modify() has return type change from () to inout @yields τ_0_0 +Accessor JoinedSequence.Iterator._base.Modify() has return type change from () to inout @yields τ_0_0.Iterator +Accessor JoinedSequence.Iterator._inner.Modify() has return type change from () to inout @yields τ_0_0.Element.Iterator? +Accessor JoinedSequence.Iterator._separator.Modify() has return type change from () to inout @yields Swift.IndexingIterator>? +Accessor JoinedSequence.Iterator._separatorData.Modify() has return type change from () to inout @yields Swift.ContiguousArray<τ_0_0.Element.Element> +Accessor JoinedSequence.Iterator._state.Modify() has return type change from () to inout @yields Swift.JoinedSequence<τ_0_0>.Iterator._JoinIteratorState +Accessor JoinedSequence._base.Modify() has return type change from () to inout @yields τ_0_0 +Accessor JoinedSequence._separator.Modify() has return type change from () to inout @yields Swift.ContiguousArray<τ_0_0.Element.Element> +Accessor LazyDropWhileSequence.Iterator._base.Modify() has return type change from () to inout @yields τ_0_0.Iterator +Accessor LazyDropWhileSequence.Iterator._predicateHasFailed.Modify() has return type change from () to inout @yields Swift.Bool +Accessor LazyDropWhileSequence._base.Modify() has return type change from () to inout @yields τ_0_0 +Accessor LazyFilterSequence.Iterator._base.Modify() has return type change from () to inout @yields τ_0_0.Iterator +Accessor LazyFilterSequence._base.Modify() has return type change from () to inout @yields τ_0_0 +Accessor LazyMapSequence.Iterator._base.Modify() has return type change from () to inout @yields τ_0_0.Iterator +Accessor LazyMapSequence._base.Modify() has return type change from () to inout @yields τ_0_0 +Accessor LazyPrefixWhileSequence.Iterator._base.Modify() has return type change from () to inout @yields τ_0_0.Iterator +Accessor LazyPrefixWhileSequence.Iterator._predicateHasFailed.Modify() has return type change from () to inout @yields Swift.Bool +Accessor LazyPrefixWhileSequence._base.Modify() has return type change from () to inout @yields τ_0_0 +Accessor LazySequence._base.Modify() has return type change from () to inout @yields τ_0_0 Accessor ManagedBuffer.capacity.Get() has generic signature change from to Accessor ManagedBuffer.capacity.Get() has mangled name changing from 'Swift.ManagedBuffer.capacity.getter : Swift.Int' to '(extension in Swift):Swift.ManagedBuffer< where B: ~Swift.Copyable>.capacity.getter : Swift.Int' Accessor ManagedBuffer.firstElementAddress.Get() has generic signature change from to @@ -374,6 +549,7 @@ Accessor ManagedBuffer.header.Get() has generic signature change from .header.getter : A' Accessor ManagedBuffer.header.Modify() has generic signature change from to Accessor ManagedBuffer.header.Modify() has mangled name changing from 'Swift.ManagedBuffer.header.modify : A' to '(extension in Swift):Swift.ManagedBuffer< where B: ~Swift.Copyable>.header.modify : A' +Accessor ManagedBuffer.header.Modify() has return type change from () to inout @yields τ_0_0 Accessor ManagedBuffer.header.Set() has generic signature change from to Accessor ManagedBuffer.header.Set() has mangled name changing from 'Swift.ManagedBuffer.header.setter : A' to '(extension in Swift):Swift.ManagedBuffer< where B: ~Swift.Copyable>.header.setter : A' Accessor ManagedBuffer.headerAddress.Get() has generic signature change from to @@ -396,6 +572,7 @@ Accessor ManagedBufferPointer._nativeBuffer.Get() has generic signature change f Accessor ManagedBufferPointer._nativeBuffer.Get() has mangled name changing from 'Swift.ManagedBufferPointer._nativeBuffer.getter : Builtin.NativeObject' to '(extension in Swift):Swift.ManagedBufferPointer< where B: ~Swift.Copyable>._nativeBuffer.getter : Builtin.NativeObject' Accessor ManagedBufferPointer._nativeBuffer.Modify() has generic signature change from to Accessor ManagedBufferPointer._nativeBuffer.Modify() has mangled name changing from 'Swift.ManagedBufferPointer._nativeBuffer.modify : Builtin.NativeObject' to '(extension in Swift):Swift.ManagedBufferPointer< where B: ~Swift.Copyable>._nativeBuffer.modify : Builtin.NativeObject' +Accessor ManagedBufferPointer._nativeBuffer.Modify() has return type change from () to inout @yields Builtin.NativeObject Accessor ManagedBufferPointer._nativeBuffer.Set() has generic signature change from to Accessor ManagedBufferPointer._nativeBuffer.Set() has mangled name changing from 'Swift.ManagedBufferPointer._nativeBuffer.setter : Builtin.NativeObject' to '(extension in Swift):Swift.ManagedBufferPointer< where B: ~Swift.Copyable>._nativeBuffer.setter : Builtin.NativeObject' Accessor ManagedBufferPointer.buffer.Get() has generic signature change from to @@ -406,6 +583,7 @@ Accessor ManagedBufferPointer.header.Get() has generic signature change from .header.getter : A' Accessor ManagedBufferPointer.header.Modify() has generic signature change from to Accessor ManagedBufferPointer.header.Modify() has mangled name changing from 'Swift.ManagedBufferPointer.header.modify : A' to '(extension in Swift):Swift.ManagedBufferPointer< where B: ~Swift.Copyable>.header.modify : A' +Accessor ManagedBufferPointer.header.Modify() has return type change from () to inout @yields τ_0_0 Accessor ManagedBufferPointer.header.Set() has generic signature change from to Accessor ManagedBufferPointer.header.Set() has mangled name changing from 'Swift.ManagedBufferPointer.header.setter : A' to '(extension in Swift):Swift.ManagedBufferPointer< where B: ~Swift.Copyable>.header.setter : A' Accessor MemoryLayout.alignment.Get() has generic signature change from to @@ -414,6 +592,207 @@ Accessor MemoryLayout.size.Get() has generic signature change from to .size.getter : Swift.Int' Accessor MemoryLayout.stride.Get() has generic signature change from to Accessor MemoryLayout.stride.Get() has mangled name changing from 'static Swift.MemoryLayout.stride.getter : Swift.Int' to 'static (extension in Swift):Swift.MemoryLayout< where A: ~Swift.Copyable, A: ~Swift.Escapable>.stride.getter : Swift.Int' +Accessor MutableCollection.subscript(_:).Get() has generic signature change from to +Accessor MutableCollection.subscript(_:).Get() has generic signature change from to +Accessor MutableCollection.subscript(_:).Get() has mangled name changing from '(extension in Swift):Swift.MutableCollection.subscript.getter : (Swift.Range) -> Swift.Slice' to '(extension in Swift):Swift.MutableCollection.subscript.getter : (A1) -> A.SubSequence' +Accessor MutableCollection.subscript(_:).Get() has mangled name changing from '(extension in Swift):Swift.MutableCollection.subscript.getter : (A1) -> A.SubSequence' to '(extension in Swift):Swift.MutableCollection.subscript.getter : ((Swift.UnboundedRange_) -> ()) -> A.SubSequence' +Accessor MutableCollection.subscript(_:).Get() has parameter 0 type change from Swift.Range<τ_0_0.Index> to τ_1_0 +Accessor MutableCollection.subscript(_:).Get() has parameter 0 type change from τ_1_0 to (Swift.UnboundedRange_) -> () +Accessor MutableCollection.subscript(_:).Get() has return type change from Swift.Slice<τ_0_0> to τ_0_0.SubSequence +Accessor MutableCollection.subscript(_:).Modify() has generic signature change from to +Accessor MutableCollection.subscript(_:).Modify() has generic signature change from to +Accessor MutableCollection.subscript(_:).Modify() has mangled name changing from '(extension in Swift):Swift.MutableCollection.subscript.modify : (Swift.Range) -> Swift.Slice' to '(extension in Swift):Swift.MutableCollection.subscript.modify : (A1) -> A.SubSequence' +Accessor MutableCollection.subscript(_:).Modify() has mangled name changing from '(extension in Swift):Swift.MutableCollection.subscript.modify : (A1) -> A.SubSequence' to '(extension in Swift):Swift.MutableCollection.subscript.modify : ((Swift.UnboundedRange_) -> ()) -> A.SubSequence' +Accessor MutableCollection.subscript(_:).Modify() has parameter 0 type change from Swift.Range<τ_0_0.Index> to τ_1_0 +Accessor MutableCollection.subscript(_:).Modify() has parameter 0 type change from τ_1_0 to (Swift.UnboundedRange_) -> () +Accessor MutableCollection.subscript(_:).Modify() has return type change from () to inout @yields τ_0_0.Element +Accessor MutableCollection.subscript(_:).Modify() has return type change from () to inout @yields τ_0_0.SubSequence +Accessor MutableCollection.subscript(_:).Read() has return type change from () to @yields τ_0_0.Element +Accessor MutableCollection.subscript(_:).Set() has generic signature change from to +Accessor MutableCollection.subscript(_:).Set() has generic signature change from to +Accessor MutableCollection.subscript(_:).Set() has mangled name changing from '(extension in Swift):Swift.MutableCollection.subscript.setter : (Swift.Range) -> Swift.Slice' to '(extension in Swift):Swift.MutableCollection.subscript.setter : (A1) -> A.SubSequence' +Accessor MutableCollection.subscript(_:).Set() has mangled name changing from '(extension in Swift):Swift.MutableCollection.subscript.setter : (A1) -> A.SubSequence' to '(extension in Swift):Swift.MutableCollection.subscript.setter : ((Swift.UnboundedRange_) -> ()) -> A.SubSequence' +Accessor MutableCollection.subscript(_:).Set() has parameter 0 type change from Swift.Slice<τ_0_0> to τ_0_0.SubSequence +Accessor MutableCollection.subscript(_:).Set() has parameter 1 type change from Swift.Range<τ_0_0.Index> to τ_1_0 +Accessor MutableCollection.subscript(_:).Set() has parameter 1 type change from τ_1_0 to (Swift.UnboundedRange_) -> () +Accessor OpaquePointer._rawValue.Modify() has return type change from () to inout @yields Builtin.RawPointer +Accessor PartialRangeFrom.Iterator._current.Modify() has return type change from () to inout @yields τ_0_0 +Accessor PrefixSequence.Iterator._base.Modify() has return type change from () to inout @yields τ_0_0.Iterator +Accessor PrefixSequence.Iterator._remaining.Modify() has return type change from () to inout @yields Swift.Int +Accessor PrefixSequence._base.Modify() has return type change from () to inout @yields τ_0_0 +Accessor RandomAccessCollection.subscript(_:).Read() has return type change from () to @yields τ_0_0.Element +Accessor RangeReplaceableCollection.subscript(_:).Read() has return type change from () to @yields τ_0_0.Element +Accessor ReversedCollection.Iterator._position.Modify() has return type change from () to inout @yields τ_0_0.Index +Accessor SIMD16._storage.Modify() has return type change from () to inout @yields τ_0_0.SIMD16Storage +Accessor SIMD16.evenHalf.Modify() has return type change from () to inout @yields Swift.SIMD8<τ_0_0> +Accessor SIMD16.highHalf.Modify() has return type change from () to inout @yields Swift.SIMD8<τ_0_0> +Accessor SIMD16.lowHalf.Modify() has return type change from () to inout @yields Swift.SIMD8<τ_0_0> +Accessor SIMD16.oddHalf.Modify() has return type change from () to inout @yields Swift.SIMD8<τ_0_0> +Accessor SIMD16.subscript(_:).Modify() has return type change from () to inout @yields τ_0_0 +Accessor SIMD2._storage.Modify() has return type change from () to inout @yields τ_0_0.SIMD2Storage +Accessor SIMD2.subscript(_:).Modify() has return type change from () to inout @yields τ_0_0 +Accessor SIMD2.x.Modify() has return type change from () to inout @yields τ_0_0 +Accessor SIMD2.y.Modify() has return type change from () to inout @yields τ_0_0 +Accessor SIMD3._storage.Modify() has return type change from () to inout @yields τ_0_0.SIMD4Storage +Accessor SIMD3.subscript(_:).Modify() has return type change from () to inout @yields τ_0_0 +Accessor SIMD3.x.Modify() has return type change from () to inout @yields τ_0_0 +Accessor SIMD3.y.Modify() has return type change from () to inout @yields τ_0_0 +Accessor SIMD3.z.Modify() has return type change from () to inout @yields τ_0_0 +Accessor SIMD32._storage.Modify() has return type change from () to inout @yields τ_0_0.SIMD32Storage +Accessor SIMD32.evenHalf.Modify() has return type change from () to inout @yields Swift.SIMD16<τ_0_0> +Accessor SIMD32.highHalf.Modify() has return type change from () to inout @yields Swift.SIMD16<τ_0_0> +Accessor SIMD32.lowHalf.Modify() has return type change from () to inout @yields Swift.SIMD16<τ_0_0> +Accessor SIMD32.oddHalf.Modify() has return type change from () to inout @yields Swift.SIMD16<τ_0_0> +Accessor SIMD32.subscript(_:).Modify() has return type change from () to inout @yields τ_0_0 +Accessor SIMD4._storage.Modify() has return type change from () to inout @yields τ_0_0.SIMD4Storage +Accessor SIMD4.evenHalf.Modify() has return type change from () to inout @yields Swift.SIMD2<τ_0_0> +Accessor SIMD4.highHalf.Modify() has return type change from () to inout @yields Swift.SIMD2<τ_0_0> +Accessor SIMD4.lowHalf.Modify() has return type change from () to inout @yields Swift.SIMD2<τ_0_0> +Accessor SIMD4.oddHalf.Modify() has return type change from () to inout @yields Swift.SIMD2<τ_0_0> +Accessor SIMD4.subscript(_:).Modify() has return type change from () to inout @yields τ_0_0 +Accessor SIMD4.w.Modify() has return type change from () to inout @yields τ_0_0 +Accessor SIMD4.x.Modify() has return type change from () to inout @yields τ_0_0 +Accessor SIMD4.y.Modify() has return type change from () to inout @yields τ_0_0 +Accessor SIMD4.z.Modify() has return type change from () to inout @yields τ_0_0 +Accessor SIMD64._storage.Modify() has return type change from () to inout @yields τ_0_0.SIMD64Storage +Accessor SIMD64.evenHalf.Modify() has return type change from () to inout @yields Swift.SIMD32<τ_0_0> +Accessor SIMD64.highHalf.Modify() has return type change from () to inout @yields Swift.SIMD32<τ_0_0> +Accessor SIMD64.lowHalf.Modify() has return type change from () to inout @yields Swift.SIMD32<τ_0_0> +Accessor SIMD64.oddHalf.Modify() has return type change from () to inout @yields Swift.SIMD32<τ_0_0> +Accessor SIMD64.subscript(_:).Modify() has return type change from () to inout @yields τ_0_0 +Accessor SIMD8._storage.Modify() has return type change from () to inout @yields τ_0_0.SIMD8Storage +Accessor SIMD8.evenHalf.Modify() has return type change from () to inout @yields Swift.SIMD4<τ_0_0> +Accessor SIMD8.highHalf.Modify() has return type change from () to inout @yields Swift.SIMD4<τ_0_0> +Accessor SIMD8.lowHalf.Modify() has return type change from () to inout @yields Swift.SIMD4<τ_0_0> +Accessor SIMD8.oddHalf.Modify() has return type change from () to inout @yields Swift.SIMD4<τ_0_0> +Accessor SIMD8.subscript(_:).Modify() has return type change from () to inout @yields τ_0_0 +Accessor SIMDMask._storage.Modify() has return type change from () to inout @yields τ_0_0 +Accessor SIMDMask.subscript(_:).Modify() has return type change from () to inout @yields Swift.Bool +Accessor SIMDStorage.subscript(_:).Modify() has return type change from () to inout @yields τ_0_0.Scalar +Accessor Set.Index._asCocoa.Modify() has return type change from () to inout @yields Swift.__CocoaSet.Index +Accessor Set.Index._variant.Modify() has return type change from () to inout @yields Swift.Set<τ_0_0>.Index._Variant +Accessor Set.Iterator._asNative.Modify() has return type change from () to inout @yields Swift._NativeSet<τ_0_0>.Iterator +Accessor Set.Iterator._variant.Modify() has return type change from () to inout @yields Swift.Set<τ_0_0>.Iterator._Variant +Accessor Set._Variant.asNative.Modify() has return type change from () to inout @yields Swift._NativeSet<τ_0_0> +Accessor Set._Variant.object.Modify() has return type change from () to inout @yields Swift._BridgeStorage +Accessor Set._variant.Modify() has return type change from () to inout @yields Swift.Set<τ_0_0>._Variant +Accessor Slice._base.Modify() has return type change from () to inout @yields τ_0_0 +Accessor Slice._endIndex.Modify() has return type change from () to inout @yields τ_0_0.Index +Accessor Slice._startIndex.Modify() has return type change from () to inout @yields τ_0_0.Index +Accessor Slice.subscript(_:).Modify() has return type change from () to inout @yields Swift.Slice<τ_0_0> +Accessor Slice.subscript(_:).Modify() has return type change from () to inout @yields τ_0_0.Element +Accessor StaticString._flags.Modify() has return type change from () to inout @yields Builtin.Int8 +Accessor StaticString._startPtrOrData.Modify() has return type change from () to inout @yields Builtin.Word +Accessor StaticString._utf8CodeUnitCount.Modify() has return type change from () to inout @yields Builtin.Word +Accessor StrideThroughIterator._current.Modify() has return type change from () to inout @yields (index: Swift.Int?, value: τ_0_0) +Accessor StrideThroughIterator._didReturnEnd.Modify() has return type change from () to inout @yields Swift.Bool +Accessor StrideToIterator._current.Modify() has return type change from () to inout @yields (index: Swift.Int?, value: τ_0_0) +Accessor String.Index._rawBits.Modify() has return type change from () to inout @yields Swift.UInt64 +Accessor String.Iterator._end.Modify() has return type change from () to inout @yields Swift.Int +Accessor String.Iterator._guts.Modify() has return type change from () to inout @yields Swift._StringGuts +Accessor String.Iterator._position.Modify() has return type change from () to inout @yields Swift.Int +Accessor String.UTF16View.Iterator._end.Modify() has return type change from () to inout @yields Swift.Int +Accessor String.UTF16View.Iterator._guts.Modify() has return type change from () to inout @yields Swift._StringGuts +Accessor String.UTF16View.Iterator._nextIsTrailingSurrogate.Modify() has return type change from () to inout @yields Swift.UInt16? +Accessor String.UTF16View.Iterator._position.Modify() has return type change from () to inout @yields Swift.Int +Accessor String.UTF16View._guts.Modify() has return type change from () to inout @yields Swift._StringGuts +Accessor String.UTF8View._guts.Modify() has return type change from () to inout @yields Swift._StringGuts +Accessor String.UnicodeScalarView.Iterator._end.Modify() has return type change from () to inout @yields Swift.Int +Accessor String.UnicodeScalarView.Iterator._guts.Modify() has return type change from () to inout @yields Swift._StringGuts +Accessor String.UnicodeScalarView.Iterator._position.Modify() has return type change from () to inout @yields Swift.Int +Accessor String.UnicodeScalarView._guts.Modify() has return type change from () to inout @yields Swift._StringGuts +Accessor String._guts.Modify() has return type change from () to inout @yields Swift._StringGuts +Accessor String.unicodeScalars.Modify() has return type change from () to inout @yields Swift.String.UnicodeScalarView +Accessor String.utf16.Modify() has return type change from () to inout @yields Swift.String.UTF16View +Accessor String.utf8.Modify() has return type change from () to inout @yields Swift.String.UTF8View +Accessor Substring.UTF16View._slice.Modify() has return type change from () to inout @yields Swift.Slice +Accessor Substring.UTF8View._slice.Modify() has return type change from () to inout @yields Swift.Slice +Accessor Substring.UnicodeScalarView._slice.Modify() has return type change from () to inout @yields Swift.Slice +Accessor Substring._slice.Modify() has return type change from () to inout @yields Swift.Slice +Accessor Substring.unicodeScalars.Modify() has return type change from () to inout @yields Swift.Substring.UnicodeScalarView +Accessor Substring.utf16.Modify() has return type change from () to inout @yields Swift.Substring.UTF16View +Accessor Substring.utf8.Modify() has return type change from () to inout @yields Swift.Substring.UTF8View +Accessor UInt.SIMD16Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec16xInt64 +Accessor UInt.SIMD16Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.UInt +Accessor UInt.SIMD2Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec2xInt64 +Accessor UInt.SIMD2Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.UInt +Accessor UInt.SIMD32Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec32xInt64 +Accessor UInt.SIMD32Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.UInt +Accessor UInt.SIMD4Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec4xInt64 +Accessor UInt.SIMD4Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.UInt +Accessor UInt.SIMD64Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec64xInt64 +Accessor UInt.SIMD64Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.UInt +Accessor UInt.SIMD8Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec8xInt64 +Accessor UInt.SIMD8Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.UInt +Accessor UInt.Words._value.Modify() has return type change from () to inout @yields Swift.UInt +Accessor UInt._value.Modify() has return type change from () to inout @yields Builtin.Int64 +Accessor UInt16.SIMD16Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec16xInt16 +Accessor UInt16.SIMD16Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.UInt16 +Accessor UInt16.SIMD2Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec2xInt16 +Accessor UInt16.SIMD2Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.UInt16 +Accessor UInt16.SIMD32Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec32xInt16 +Accessor UInt16.SIMD32Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.UInt16 +Accessor UInt16.SIMD4Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec4xInt16 +Accessor UInt16.SIMD4Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.UInt16 +Accessor UInt16.SIMD64Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec64xInt16 +Accessor UInt16.SIMD64Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.UInt16 +Accessor UInt16.SIMD8Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec8xInt16 +Accessor UInt16.SIMD8Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.UInt16 +Accessor UInt16.Words._value.Modify() has return type change from () to inout @yields Swift.UInt16 +Accessor UInt16._value.Modify() has return type change from () to inout @yields Builtin.Int16 +Accessor UInt32.SIMD16Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec16xInt32 +Accessor UInt32.SIMD16Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.UInt32 +Accessor UInt32.SIMD2Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec2xInt32 +Accessor UInt32.SIMD2Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.UInt32 +Accessor UInt32.SIMD32Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec32xInt32 +Accessor UInt32.SIMD32Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.UInt32 +Accessor UInt32.SIMD4Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec4xInt32 +Accessor UInt32.SIMD4Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.UInt32 +Accessor UInt32.SIMD64Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec64xInt32 +Accessor UInt32.SIMD64Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.UInt32 +Accessor UInt32.SIMD8Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec8xInt32 +Accessor UInt32.SIMD8Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.UInt32 +Accessor UInt32.Words._value.Modify() has return type change from () to inout @yields Swift.UInt32 +Accessor UInt32._value.Modify() has return type change from () to inout @yields Builtin.Int32 +Accessor UInt64.SIMD16Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec16xInt64 +Accessor UInt64.SIMD16Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.UInt64 +Accessor UInt64.SIMD2Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec2xInt64 +Accessor UInt64.SIMD2Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.UInt64 +Accessor UInt64.SIMD32Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec32xInt64 +Accessor UInt64.SIMD32Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.UInt64 +Accessor UInt64.SIMD4Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec4xInt64 +Accessor UInt64.SIMD4Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.UInt64 +Accessor UInt64.SIMD64Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec64xInt64 +Accessor UInt64.SIMD64Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.UInt64 +Accessor UInt64.SIMD8Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec8xInt64 +Accessor UInt64.SIMD8Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.UInt64 +Accessor UInt64.Words._value.Modify() has return type change from () to inout @yields Swift.UInt64 +Accessor UInt64._value.Modify() has return type change from () to inout @yields Builtin.Int64 +Accessor UInt8.SIMD16Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec16xInt8 +Accessor UInt8.SIMD16Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.UInt8 +Accessor UInt8.SIMD2Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec2xInt8 +Accessor UInt8.SIMD2Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.UInt8 +Accessor UInt8.SIMD32Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec32xInt8 +Accessor UInt8.SIMD32Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.UInt8 +Accessor UInt8.SIMD4Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec4xInt8 +Accessor UInt8.SIMD4Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.UInt8 +Accessor UInt8.SIMD64Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec64xInt8 +Accessor UInt8.SIMD64Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.UInt8 +Accessor UInt8.SIMD8Storage._value.Modify() has return type change from () to inout @yields Builtin.Vec8xInt8 +Accessor UInt8.SIMD8Storage.subscript(_:).Modify() has return type change from () to inout @yields Swift.UInt8 +Accessor UInt8.Words._value.Modify() has return type change from () to inout @yields Swift.UInt8 +Accessor UInt8._value.Modify() has return type change from () to inout @yields Builtin.Int8 +Accessor UnfoldSequence._done.Modify() has return type change from () to inout @yields Swift.Bool +Accessor UnfoldSequence._state.Modify() has return type change from () to inout @yields τ_0_1 +Accessor Unicode.Scalar.Properties._scalar.Modify() has return type change from () to inout @yields Swift.Unicode.Scalar +Accessor Unicode.Scalar.UTF16View.value.Modify() has return type change from () to inout @yields Swift.Unicode.Scalar +Accessor Unicode.Scalar.UTF8View.value.Modify() has return type change from () to inout @yields Swift.Unicode.Scalar +Accessor Unicode.Scalar._value.Modify() has return type change from () to inout @yields Swift.UInt32 +Accessor Unicode.UTF16.ForwardParser._buffer.Modify() has return type change from () to inout @yields Swift._UIntBuffer +Accessor Unicode.UTF16.ReverseParser._buffer.Modify() has return type change from () to inout @yields Swift._UIntBuffer +Accessor Unicode.UTF8.ForwardParser._buffer.Modify() has return type change from () to inout @yields Swift._UIntBuffer +Accessor Unicode.UTF8.ReverseParser._buffer.Modify() has return type change from () to inout @yields Swift._UIntBuffer +Accessor Unmanaged._value.Modify() has return type change from () to inout @yields τ_0_0 Accessor UnsafeBufferPointer._position.Get() has generic signature change from to Accessor UnsafeBufferPointer._position.Get() has mangled name changing from 'Swift.UnsafeBufferPointer._position.getter : Swift.Optional>' to '(extension in Swift):Swift.UnsafeBufferPointer< where A: ~Swift.Copyable>._position.getter : Swift.Optional>' Accessor UnsafeBufferPointer.baseAddress.Get() has generic signature change from to @@ -424,6 +803,8 @@ Accessor UnsafeBufferPointer.endIndex.Get() has generic signature change from .endIndex.getter : Swift.Int' Accessor UnsafeBufferPointer.startIndex.Get() has generic signature change from to Accessor UnsafeBufferPointer.startIndex.Get() has mangled name changing from 'Swift.UnsafeBufferPointer.startIndex.getter : Swift.Int' to '(extension in Swift):Swift.UnsafeBufferPointer< where A: ~Swift.Copyable>.startIndex.getter : Swift.Int' +Accessor UnsafeBufferPointer.Iterator._end.Modify() has return type change from () to inout @yields Swift.UnsafePointer<τ_0_0>? +Accessor UnsafeBufferPointer.Iterator._position.Modify() has return type change from () to inout @yields Swift.UnsafePointer<τ_0_0>? Accessor UnsafeMutableBufferPointer._position.Get() has generic signature change from to Accessor UnsafeMutableBufferPointer._position.Get() has mangled name changing from 'Swift.UnsafeMutableBufferPointer._position.getter : Swift.Optional>' to '(extension in Swift):Swift.UnsafeMutableBufferPointer< where A: ~Swift.Copyable>._position.getter : Swift.Optional>' Accessor UnsafeMutableBufferPointer.baseAddress.Get() has generic signature change from to @@ -434,6 +815,8 @@ Accessor UnsafeMutableBufferPointer.endIndex.Get() has generic signature change Accessor UnsafeMutableBufferPointer.endIndex.Get() has mangled name changing from 'Swift.UnsafeMutableBufferPointer.endIndex.getter : Swift.Int' to '(extension in Swift):Swift.UnsafeMutableBufferPointer< where A: ~Swift.Copyable>.endIndex.getter : Swift.Int' Accessor UnsafeMutableBufferPointer.startIndex.Get() has generic signature change from to Accessor UnsafeMutableBufferPointer.startIndex.Get() has mangled name changing from 'Swift.UnsafeMutableBufferPointer.startIndex.getter : Swift.Int' to '(extension in Swift):Swift.UnsafeMutableBufferPointer< where A: ~Swift.Copyable>.startIndex.getter : Swift.Int' +Accessor UnsafeMutableBufferPointer.subscript(_:).Modify() has return type change from () to inout @yields Swift.Slice> +Accessor UnsafeMutableBufferPointer.subscript(_:).Modify() has return type change from () to inout @yields τ_0_0 Accessor UnsafeMutablePointer._cVarArgEncoding.Get() has generic signature change from to Accessor UnsafeMutablePointer._cVarArgEncoding.Get() has mangled name changing from 'Swift.UnsafeMutablePointer._cVarArgEncoding.getter : Swift.Array' to '(extension in Swift):Swift.UnsafeMutablePointer< where A: ~Swift.Copyable>._cVarArgEncoding.getter : Swift.Array' Accessor UnsafeMutablePointer._max.Get() has generic signature change from to @@ -442,6 +825,10 @@ Accessor UnsafeMutablePointer._rawValue.Get() has generic signature change from Accessor UnsafeMutablePointer._rawValue.Get() has mangled name changing from 'Swift.UnsafeMutablePointer._rawValue.getter : Builtin.RawPointer' to '(extension in Swift):Swift.UnsafeMutablePointer< where A: ~Swift.Copyable>._rawValue.getter : Builtin.RawPointer' Accessor UnsafeMutablePointer.hashValue.Get() has generic signature change from to Accessor UnsafeMutablePointer.hashValue.Get() has mangled name changing from 'Swift.UnsafeMutablePointer.hashValue.getter : Swift.Int' to '(extension in Swift):Swift.UnsafeMutablePointer< where A: ~Swift.Copyable>.hashValue.getter : Swift.Int' +Accessor UnsafeMutableRawBufferPointer.subscript(_:).Modify() has return type change from () to inout @yields Swift.Slice +Accessor UnsafeMutableRawBufferPointer.subscript(_:).Modify() has return type change from () to inout @yields Swift.UInt8 +Accessor UnsafeRawBufferPointer.Iterator._end.Modify() has return type change from () to inout @yields Swift.UnsafeRawPointer? +Accessor UnsafeRawBufferPointer.Iterator._position.Modify() has return type change from () to inout @yields Swift.UnsafeRawPointer? Accessor UnsafePointer._cVarArgEncoding.Get() has generic signature change from to Accessor UnsafePointer._cVarArgEncoding.Get() has mangled name changing from 'Swift.UnsafePointer._cVarArgEncoding.getter : Swift.Array' to '(extension in Swift):Swift.UnsafePointer< where A: ~Swift.Copyable>._cVarArgEncoding.getter : Swift.Array' Accessor UnsafePointer._max.Get() has generic signature change from to @@ -450,6 +837,91 @@ Accessor UnsafePointer._rawValue.Get() has generic signature change from ._rawValue.getter : Builtin.RawPointer' Accessor UnsafePointer.hashValue.Get() has generic signature change from to Accessor UnsafePointer.hashValue.Get() has mangled name changing from 'Swift.UnsafePointer.hashValue.getter : Swift.Int' to '(extension in Swift):Swift.UnsafePointer< where A: ~Swift.Copyable>.hashValue.getter : Swift.Int' +Accessor Zip2Sequence.Iterator._baseStream1.Modify() has return type change from () to inout @yields τ_0_0.Iterator +Accessor Zip2Sequence.Iterator._baseStream2.Modify() has return type change from () to inout @yields τ_0_1.Iterator +Accessor Zip2Sequence.Iterator._reachedEnd.Modify() has return type change from () to inout @yields Swift.Bool +Accessor _ArrayBody._capacityAndFlags.Modify() has return type change from () to inout @yields Swift.UInt +Accessor _ArrayBody._storage.Modify() has return type change from () to inout @yields SwiftShims._SwiftArrayBodyStorage +Accessor _ArrayBody.count.Modify() has return type change from () to inout @yields Swift.Int +Accessor _ArrayBody.elementTypeIsBridgedVerbatim.Modify() has return type change from () to inout @yields Swift.Bool +Accessor _ArrayBuffer._storage.Modify() has return type change from () to inout @yields Swift._BridgeStorage +Accessor _ArrayBuffer.count.Modify() has return type change from () to inout @yields Swift.Int +Accessor _ArrayBuffer.subscript(_:).Modify() has return type change from () to inout @yields Swift._SliceBuffer<τ_0_0> +Accessor _ArrayBuffer.subscript(_:).Modify() has return type change from () to inout @yields τ_0_0 +Accessor _ArrayBufferProtocol.count.Modify() has return type change from () to inout @yields Swift.Int +Accessor _BidirectionalCollectionBox._base.Modify() has return type change from () to inout @yields τ_0_0 +Accessor _BridgeStorage.rawValue.Modify() has return type change from () to inout @yields Builtin.BridgeObject +Accessor _ClosureBasedSequence._makeUnderlyingIterator.Modify() has return type change from () to inout @yields () -> τ_0_0 +Accessor _CocoaArrayWrapper.buffer.Modify() has return type change from () to inout @yields AnyObject +Accessor _CollectionBox._base.Modify() has return type change from () to inout @yields τ_0_0 +Accessor _ContiguousArrayBuffer._storage.Modify() has return type change from () to inout @yields Swift.__ContiguousArrayStorageBase +Accessor _ContiguousArrayBuffer.count.Modify() has return type change from () to inout @yields Swift.Int +Accessor _ContiguousArrayBuffer.subscript(_:).Modify() has return type change from () to inout @yields Swift._SliceBuffer<τ_0_0> +Accessor _ContiguousArrayBuffer.subscript(_:).Modify() has return type change from () to inout @yields τ_0_0 +Accessor _DictionaryBuilder._target.Modify() has return type change from () to inout @yields Swift._NativeDictionary<τ_0_0, τ_0_1> +Accessor _HashTable.Bucket.offset.Modify() has return type change from () to inout @yields Swift.Int +Accessor _HashTable.Iterator.word.Modify() has return type change from () to inout @yields Swift._UnsafeBitset.Word +Accessor _HashTable.Iterator.wordIndex.Modify() has return type change from () to inout @yields Swift.Int +Accessor _HashTable.words.Modify() has return type change from () to inout @yields Swift.UnsafeMutablePointer +Accessor _IndexBox._base.Modify() has return type change from () to inout @yields τ_0_0 +Accessor _IteratorBox._base.Modify() has return type change from () to inout @yields τ_0_0 +Accessor _NativeDictionary.Iterator.iterator.Modify() has return type change from () to inout @yields Swift._HashTable.Iterator +Accessor _NativeDictionary._storage.Modify() has return type change from () to inout @yields Swift.__RawDictionaryStorage +Accessor _NativeDictionary.subscript(_:isUnique:).Modify() has return type change from () to inout @yields τ_0_1? +Accessor _NativeSet.Iterator.iterator.Modify() has return type change from () to inout @yields Swift._HashTable.Iterator +Accessor _NativeSet._storage.Modify() has return type change from () to inout @yields Swift.__RawSetStorage +Accessor _RandomAccessCollectionBox._base.Modify() has return type change from () to inout @yields τ_0_0 +Accessor _SequenceBox._base.Modify() has return type change from () to inout @yields τ_0_0 +Accessor _SetBuilder._target.Modify() has return type change from () to inout @yields Swift._NativeSet<τ_0_0> +Accessor _SliceBuffer.count.Modify() has return type change from () to inout @yields Swift.Int +Accessor _SliceBuffer.endIndex.Modify() has return type change from () to inout @yields Swift.Int +Accessor _SliceBuffer.endIndexAndFlags.Modify() has return type change from () to inout @yields Swift.UInt +Accessor _SliceBuffer.owner.Modify() has return type change from () to inout @yields AnyObject +Accessor _SliceBuffer.startIndex.Modify() has return type change from () to inout @yields Swift.Int +Accessor _SliceBuffer.subscript(_:).Modify() has return type change from () to inout @yields Swift._SliceBuffer<τ_0_0> +Accessor _SliceBuffer.subscript(_:).Modify() has return type change from () to inout @yields τ_0_0 +Accessor _SmallString._storage.Modify() has return type change from () to inout @yields (Swift.UInt64, Swift.UInt64) +Accessor _SmallString.leadingRawBits.Modify() has return type change from () to inout @yields Swift.UInt64 +Accessor _SmallString.subscript(_:).Modify() has return type change from () to inout @yields Swift.UInt8 +Accessor _SmallString.trailingRawBits.Modify() has return type change from () to inout @yields Swift.UInt64 +Accessor _StringGuts._object.Modify() has return type change from () to inout @yields Swift._StringObject +Accessor _StringObject.CountAndFlags._storage.Modify() has return type change from () to inout @yields Swift.UInt64 +Accessor _StringObject._countAndFlagsBits.Modify() has return type change from () to inout @yields Swift.UInt64 +Accessor _StringObject._object.Modify() has return type change from () to inout @yields Builtin.BridgeObject +Accessor _StringRepresentation._capacity.Modify() has return type change from () to inout @yields Swift.Int +Accessor _StringRepresentation._count.Modify() has return type change from () to inout @yields Swift.Int +Accessor _StringRepresentation._form.Modify() has return type change from () to inout @yields Swift._StringRepresentation._Form +Accessor _StringRepresentation._isASCII.Modify() has return type change from () to inout @yields Swift.Bool +Accessor _UIntBuffer.Index.bitOffset.Modify() has return type change from () to inout @yields Swift.UInt8 +Accessor _UIntBuffer.Iterator._impl.Modify() has return type change from () to inout @yields Swift._UIntBuffer<τ_0_0> +Accessor _UIntBuffer._bitCount.Modify() has return type change from () to inout @yields Swift.UInt8 +Accessor _UIntBuffer._storage.Modify() has return type change from () to inout @yields Swift.UInt32 +Accessor _UTFParser._buffer.Modify() has return type change from () to inout @yields Swift._UIntBuffer<τ_0_0.Encoding.CodeUnit> +Accessor _UnsafeBitset.Iterator.index.Modify() has return type change from () to inout @yields Swift.Int +Accessor _UnsafeBitset.Iterator.word.Modify() has return type change from () to inout @yields Swift._UnsafeBitset.Word +Accessor _UnsafeBitset.Word.value.Modify() has return type change from () to inout @yields Swift.UInt +Accessor _UnsafePartiallyInitializedContiguousArrayBuffer.p.Modify() has return type change from () to inout @yields Swift.UnsafeMutablePointer<τ_0_0> +Accessor _UnsafePartiallyInitializedContiguousArrayBuffer.remainingCapacity.Modify() has return type change from () to inout @yields Swift.Int +Accessor _UnsafePartiallyInitializedContiguousArrayBuffer.result.Modify() has return type change from () to inout @yields Swift._ContiguousArrayBuffer<τ_0_0> +Accessor _ValidUTF8Buffer.Index._biasedBits.Modify() has return type change from () to inout @yields Swift.UInt32 +Accessor _ValidUTF8Buffer.Iterator._biasedBits.Modify() has return type change from () to inout @yields Swift.UInt32 +Accessor _ValidUTF8Buffer._biasedBits.Modify() has return type change from () to inout @yields Swift.UInt32 +Accessor __ContiguousArrayStorageBase.countAndCapacity.Modify() has return type change from () to inout @yields Swift._ArrayBody +Accessor __RawDictionaryStorage._age.Modify() has return type change from () to inout @yields Swift.Int32 +Accessor __RawDictionaryStorage._capacity.Modify() has return type change from () to inout @yields Swift.Int +Accessor __RawDictionaryStorage._count.Modify() has return type change from () to inout @yields Swift.Int +Accessor __RawDictionaryStorage._rawKeys.Modify() has return type change from () to inout @yields Swift.UnsafeMutableRawPointer +Accessor __RawDictionaryStorage._rawValues.Modify() has return type change from () to inout @yields Swift.UnsafeMutableRawPointer +Accessor __RawDictionaryStorage._reservedScale.Modify() has return type change from () to inout @yields Swift.Int8 +Accessor __RawDictionaryStorage._scale.Modify() has return type change from () to inout @yields Swift.Int8 +Accessor __RawDictionaryStorage._seed.Modify() has return type change from () to inout @yields Swift.Int +Accessor __RawSetStorage._age.Modify() has return type change from () to inout @yields Swift.Int32 +Accessor __RawSetStorage._capacity.Modify() has return type change from () to inout @yields Swift.Int +Accessor __RawSetStorage._count.Modify() has return type change from () to inout @yields Swift.Int +Accessor __RawSetStorage._rawElements.Modify() has return type change from () to inout @yields Swift.UnsafeMutableRawPointer +Accessor __RawSetStorage._reservedScale.Modify() has return type change from () to inout @yields Swift.Int8 +Accessor __RawSetStorage._scale.Modify() has return type change from () to inout @yields Swift.Int8 +Accessor __RawSetStorage._seed.Modify() has return type change from () to inout @yields Swift.Int Class ManagedBuffer has generic signature change from to Constructor ExpressibleByNilLiteral.init(nilLiteral:) has generic signature change from to Constructor ManagedBuffer.init(_doNotCallMe:) has generic signature change from to diff --git a/test/attr/attr_native_dynamic.swift b/test/attr/attr_native_dynamic.swift index 9f7a7bfb74030..192c924754757 100644 --- a/test/attr/attr_native_dynamic.swift +++ b/test/attr/attr_native_dynamic.swift @@ -5,7 +5,7 @@ struct Strukt { // CHECK: (var_decl {{.*}} "dynamicStorageOnlyVar" interface_type="Int" access=internal dynamic readImpl=stored writeImpl=stored readWriteImpl=stored // CHECK: (accessor_decl {{.*}} access=internal dynamic get for="dynamicStorageOnlyVar" // CHECK: (accessor_decl {{.*}} access=internal dynamic set for="dynamicStorageOnlyVar" - // CHECK: (accessor_decl {{.*}} access=internal _modify for="dynamicStorageOnlyVar" + // CHECK: (accessor_decl {{.*}} access=internal @yield_once _modify for="dynamicStorageOnlyVar" dynamic var dynamicStorageOnlyVar : Int = 0 // CHECK: (var_decl {{.*}} "computedVar" interface_type="Int" access=internal dynamic readImpl=getter immutable @@ -25,7 +25,7 @@ struct Strukt { // CHECK: (var_decl {{.*}} "computedVarGetterSetter" interface_type="Int" access=internal dynamic readImpl=getter writeImpl=setter readWriteImpl=materialize_to_temporary // CHECK: (accessor_decl {{.*}} access=internal dynamic get for="computedVarGetterSetter" // CHECK: (accessor_decl {{.*}} access=internal dynamic set for="computedVarGetterSetter" - // CHECK: (accessor_decl {{.*}} access=internal _modify for="computedVarGetterSetter" + // CHECK: (accessor_decl {{.*}} access=internal @yield_once _modify for="computedVarGetterSetter" dynamic var computedVarGetterSetter : Int { get { return 0 @@ -36,7 +36,7 @@ struct Strukt { // CHECK: (var_decl {{.*}} "computedVarGetterModify" interface_type="Int" access=internal dynamic readImpl=getter writeImpl=modify_coroutine readWriteImpl=modify_coroutine // CHECK: (accessor_decl {{.*}} access=internal dynamic get for="computedVarGetterModify" - // CHECK: (accessor_decl {{.*}} access=internal dynamic _modify for="computedVarGetterModify" + // CHECK: (accessor_decl {{.*}} access=internal dynamic @yield_once _modify for="computedVarGetterModify" // CHECK: (accessor_decl {{.*}} access=internal set for="computedVarGetterModify" dynamic var computedVarGetterModify : Int { get { @@ -47,10 +47,10 @@ struct Strukt { } // CHECK: (var_decl {{.*}} "computedVarReadSet" interface_type="Int" access=internal dynamic readImpl=read_coroutine writeImpl=setter readWriteImpl=materialize_to_temporary - // CHECK: (accessor_decl {{.*}} access=internal dynamic _read for="computedVarReadSet" + // CHECK: (accessor_decl {{.*}} access=internal dynamic @yield_once _read for="computedVarReadSet" // CHECK: (accessor_decl {{.*}} access=internal dynamic set for="computedVarReadSet" // CHECK: (accessor_decl {{.*}} access=internal get for="computedVarReadSet" - // CHECK: (accessor_decl {{.*}} access=internal _modify for="computedVarReadSet" + // CHECK: (accessor_decl {{.*}} access=internal @yield_once _modify for="computedVarReadSet" dynamic var computedVarReadSet : Int { _read { } @@ -59,8 +59,8 @@ struct Strukt { } // CHECK: (var_decl {{.*}} "computedVarReadModify" interface_type="Int" access=internal dynamic readImpl=read_coroutine writeImpl=modify_coroutine readWriteImpl=modify_coroutine - // CHECK: (accessor_decl {{.*}} access=internal dynamic _read for="computedVarReadModify" - // CHECK: (accessor_decl {{.*}} access=internal dynamic _modify for="computedVarReadModify" + // CHECK: (accessor_decl {{.*}} access=internal dynamic @yield_once _read for="computedVarReadModify" + // CHECK: (accessor_decl {{.*}} access=internal dynamic @yield_once _modify for="computedVarReadModify" // CHECK: (accessor_decl {{.*}} access=internal get for="computedVarReadModify" // CHECK: (accessor_decl {{.*}} access=internal set for="computedVarReadModify" dynamic var computedVarReadModify : Int { @@ -74,7 +74,7 @@ struct Strukt { // CHECK: (accessor_decl {{.*}}access=private dynamic didSet for="storedWithObserver" // CHECK: (accessor_decl {{.*}}access=internal dynamic get for="storedWithObserver" // CHECK: (accessor_decl {{.*}}access=internal set for="storedWithObserver" - // CHECK: (accessor_decl {{.*}}access=internal _modify for="storedWithObserver" + // CHECK: (accessor_decl {{.*}}access=internal @yield_once _modify for="storedWithObserver" dynamic var storedWithObserver : Int { didSet { } @@ -88,7 +88,7 @@ struct Strukt { // CHECK: (subscript_decl {{.*}} "subscript(_:)" {{.*}} access=internal dynamic readImpl=getter writeImpl=setter readWriteImpl=materialize_to_temporary // CHECK: (accessor_decl {{.*}} access=internal dynamic get for="subscript(_:)" // CHECK: (accessor_decl {{.*}} access=internal dynamic set for="subscript(_:)" - // CHECK: (accessor_decl {{.*}} access=internal _modify for="subscript(_:)" + // CHECK: (accessor_decl {{.*}} access=internal @yield_once _modify for="subscript(_:)" dynamic subscript(_ index: Int) -> Int { get { return 1 @@ -99,7 +99,7 @@ struct Strukt { // CHECK: (subscript_decl {{.*}} "subscript(_:)" {{.*}} access=internal dynamic readImpl=getter writeImpl=modify_coroutine readWriteImpl=modify_coroutine // CHECK: (accessor_decl {{.*}} access=internal dynamic get for="subscript(_:)" - // CHECK: (accessor_decl {{.*}} access=internal dynamic _modify for="subscript(_:)" + // CHECK: (accessor_decl {{.*}} access=internal dynamic @yield_once _modify for="subscript(_:)" // CHECK: (accessor_decl {{.*}} access=internal set for="subscript(_:)" dynamic subscript(_ index: Float) -> Int { get { @@ -110,8 +110,8 @@ struct Strukt { } // CHECK: (subscript_decl {{.*}} "subscript(_:)" {{.*}} access=internal dynamic readImpl=read_coroutine writeImpl=modify_coroutine readWriteImpl=modify_coroutine - // CHECK: (accessor_decl {{.*}} access=internal dynamic _read for="subscript(_:)" - // CHECK: (accessor_decl {{.*}} access=internal dynamic _modify for="subscript(_:)" + // CHECK: (accessor_decl {{.*}} access=internal dynamic @yield_once _read for="subscript(_:)" + // CHECK: (accessor_decl {{.*}} access=internal dynamic @yield_once _modify for="subscript(_:)" // CHECK: (accessor_decl {{.*}} access=internal get for="subscript(_:)" // CHECK: (accessor_decl {{.*}} access=internal set for="subscript(_:)" dynamic subscript(_ index: Double) -> Int { @@ -122,10 +122,10 @@ struct Strukt { } // CHECK: (subscript_decl {{.*}} "subscript(_:)" {{.*}} access=internal dynamic readImpl=read_coroutine writeImpl=setter readWriteImpl=materialize_to_temporary - // CHECK: (accessor_decl {{.*}} access=internal dynamic _read for="subscript(_:)" + // CHECK: (accessor_decl {{.*}} access=internal dynamic @yield_once _read for="subscript(_:)" // CHECK: (accessor_decl {{.*}} access=internal dynamic set for="subscript(_:)" // CHECK: (accessor_decl {{.*}} access=internal get for="subscript(_:)" - // CHECK: (accessor_decl {{.*}} access=internal _modify for="subscript(_:)" + // CHECK: (accessor_decl {{.*}} access=internal @yield_once _modify for="subscript(_:)" dynamic subscript(_ index: Strukt) -> Int { _read { } @@ -139,7 +139,7 @@ class Klass { // CHECK: (var_decl {{.*}} "dynamicStorageOnlyVar" interface_type="Int" access=internal dynamic readImpl=stored writeImpl=stored readWriteImpl=stored // CHECK: (accessor_decl {{.*}} access=internal dynamic get for="dynamicStorageOnlyVar" // CHECK: (accessor_decl {{.*}} access=internal dynamic set for="dynamicStorageOnlyVar" - // CHECK: (accessor_decl {{.*}} access=internal _modify for="dynamicStorageOnlyVar" + // CHECK: (accessor_decl {{.*}} access=internal @yield_once _modify for="dynamicStorageOnlyVar" dynamic var dynamicStorageOnlyVar : Int = 0 // CHECK: (var_decl {{.*}} "computedVar" interface_type="Int" access=internal dynamic readImpl=getter immutable @@ -159,7 +159,7 @@ class Klass { // CHECK: (var_decl {{.*}} "computedVarGetterSetter" interface_type="Int" access=internal dynamic readImpl=getter writeImpl=setter readWriteImpl=materialize_to_temporary // CHECK: (accessor_decl {{.*}} access=internal dynamic get for="computedVarGetterSetter" // CHECK: (accessor_decl {{.*}} access=internal dynamic set for="computedVarGetterSetter" - // CHECK: (accessor_decl {{.*}} access=internal _modify for="computedVarGetterSetter" + // CHECK: (accessor_decl {{.*}} access=internal @yield_once _modify for="computedVarGetterSetter" dynamic var computedVarGetterSetter : Int { get { return 0 @@ -170,7 +170,7 @@ class Klass { // CHECK: (var_decl {{.*}} "computedVarGetterModify" interface_type="Int" access=internal dynamic readImpl=getter writeImpl=modify_coroutine readWriteImpl=modify_coroutine // CHECK: (accessor_decl {{.*}} access=internal dynamic get for="computedVarGetterModify" - // CHECK: (accessor_decl {{.*}} access=internal dynamic _modify for="computedVarGetterModify" + // CHECK: (accessor_decl {{.*}} access=internal dynamic @yield_once _modify for="computedVarGetterModify" // CHECK: (accessor_decl {{.*}} access=internal set for="computedVarGetterModify" dynamic var computedVarGetterModify : Int { get { @@ -181,10 +181,10 @@ class Klass { } // CHECK: (var_decl {{.*}} "computedVarReadSet" interface_type="Int" access=internal dynamic readImpl=read_coroutine writeImpl=setter readWriteImpl=materialize_to_temporary - // CHECK: (accessor_decl {{.*}} access=internal dynamic _read for="computedVarReadSet" + // CHECK: (accessor_decl {{.*}} access=internal dynamic @yield_once _read for="computedVarReadSet" // CHECK: (accessor_decl {{.*}} access=internal dynamic set for="computedVarReadSet" // CHECK: (accessor_decl {{.*}} access=internal get for="computedVarReadSet" - // CHECK: (accessor_decl {{.*}} access=internal _modify for="computedVarReadSet" + // CHECK: (accessor_decl {{.*}} access=internal @yield_once _modify for="computedVarReadSet" dynamic var computedVarReadSet : Int { _read { } @@ -193,8 +193,8 @@ class Klass { } // CHECK: (var_decl {{.*}} "computedVarReadModify" interface_type="Int" access=internal dynamic readImpl=read_coroutine writeImpl=modify_coroutine readWriteImpl=modify_coroutine - // CHECK: (accessor_decl {{.*}} access=internal dynamic _read for="computedVarReadModify" - // CHECK: (accessor_decl {{.*}} access=internal dynamic _modify for="computedVarReadModify" + // CHECK: (accessor_decl {{.*}} access=internal dynamic @yield_once _read for="computedVarReadModify" + // CHECK: (accessor_decl {{.*}} access=internal dynamic @yield_once _modify for="computedVarReadModify" // CHECK: (accessor_decl {{.*}} access=internal get for="computedVarReadModify" // CHECK: (accessor_decl {{.*}} access=internal set for="computedVarReadModify" dynamic var computedVarReadModify : Int { @@ -231,7 +231,7 @@ class Klass { // CHECK: (accessor_decl {{.*}} access=internal dynamic get for="subscript(_:)" // CHECK: (accessor_decl {{.*}} access=internal dynamic unsafeMutableAddress for="subscript(_:)" // CHECK: (accessor_decl {{.*}} access=internal set for="subscript(_:)" - // CHECK: (accessor_decl {{.*}} access=internal _modify for="subscript(_:)" + // CHECK: (accessor_decl {{.*}} access=internal @yield_once _modify for="subscript(_:)" dynamic subscript(_ index: Float) -> Int { get { return 1 @@ -242,11 +242,11 @@ class Klass { } // CHECK: (subscript_decl {{.*}} "subscript(_:)" {{.*}} access=internal dynamic readImpl=read_coroutine writeImpl=mutable_addressor readWriteImpl=mutable_addressor - // CHECK: (accessor_decl {{.*}} access=internal dynamic _read for="subscript(_:)" + // CHECK: (accessor_decl {{.*}} access=internal dynamic @yield_once _read for="subscript(_:)" // CHECK: (accessor_decl {{.*}} access=internal dynamic unsafeMutableAddress for="subscript(_:)" // CHECK: (accessor_decl {{.*}} access=internal get for="subscript(_:)" // CHECK: (accessor_decl {{.*}} access=internal set for="subscript(_:)" - // CHECK: (accessor_decl {{.*}} access=internal _modify for="subscript(_:)" + // CHECK: (accessor_decl {{.*}} access=internal @yield_once _modify for="subscript(_:)" dynamic subscript(_ index: Double) -> Int { _read { } @@ -259,7 +259,7 @@ class Klass { // CHECK: (accessor_decl {{.*}} access=internal dynamic unsafeAddress for="subscript(_:)" // CHECK: (accessor_decl {{.*}} access=internal dynamic set for="subscript(_:)" // CHECK: (accessor_decl {{.*}} access=internal get for="subscript(_:)" - // CHECK: (accessor_decl {{.*}} access=internal _modify for="subscript(_:)" + // CHECK: (accessor_decl {{.*}} access=internal @yield_once _modify for="subscript(_:)" dynamic subscript(_ index: Int8) -> Int { unsafeAddress { fatalError() @@ -270,7 +270,7 @@ class Klass { // CHECK: (subscript_decl {{.*}} "subscript(_:)" {{.*}} access=internal dynamic readImpl=addressor writeImpl=modify_coroutine readWriteImpl=modify_coroutine // CHECK: (accessor_decl {{.*}} access=internal dynamic unsafeAddress for="subscript(_:)" - // CHECK: (accessor_decl {{.*}} access=internal dynamic _modify for="subscript(_:)" + // CHECK: (accessor_decl {{.*}} access=internal dynamic @yield_once _modify for="subscript(_:)" // CHECK: (accessor_decl {{.*}} access=internal get for="subscript(_:)" // CHECK: (accessor_decl {{.*}} access=internal set for="subscript(_:)" dynamic subscript(_ index: Int16) -> Int { diff --git a/test/embedded/classes-generic-no-stdlib.swift b/test/embedded/classes-generic-no-stdlib.swift index 580865fce0a9f..ea23ee0b040f4 100644 --- a/test/embedded/classes-generic-no-stdlib.swift +++ b/test/embedded/classes-generic-no-stdlib.swift @@ -38,7 +38,7 @@ public func bar(t: T2) -> MyClass { // CHECK-SIL: sil_vtable $MyClass { // CHECK-SIL: #MyClass.t!getter: (MyClass) -> () -> T : @$e4main7MyClassC1txvgAA2T2V_Tg5 // specialized MyClass.t.getter // CHECK-SIL: #MyClass.t!setter: (MyClass) -> (T) -> () : @$e4main7MyClassC1txvsAA2T2V_Tg5 // specialized MyClass.t.setter -// CHECK-SIL: #MyClass.t!modify: (MyClass) -> () -> () : @$e4main7MyClassC1txvMAA2T2V_Tg5 // specialized MyClass.t.modify +// CHECK-SIL: #MyClass.t!modify: (MyClass) -> @yield_once () -> inout @yields T : @$e4main7MyClassC1txvMAA2T2V_Tg5 // specialized MyClass.t.modify // CHECK-SIL: #MyClass.init!allocator: (MyClass.Type) -> (T) -> MyClass : @$e4main7MyClassC1tACyxGx_tcfCAA2T2V_Tg5 // specialized MyClass.__allocating_init(t:) // CHECK-SIL: #MyClass.deinit!deallocator: @$e4main7MyClassCfDAA2T2V_Tg5 // specialized MyClass.__deallocating_deinit // CHECK-SIL: } @@ -46,7 +46,7 @@ public func bar(t: T2) -> MyClass { // CHECK-SIL: sil_vtable $MyClass { // CHECK-SIL: #MyClass.t!getter: (MyClass) -> () -> T : @$e4main7MyClassC1txvgAA2T1V_Tg5 // specialized MyClass.t.getter // CHECK-SIL: #MyClass.t!setter: (MyClass) -> (T) -> () : @$e4main7MyClassC1txvsAA2T1V_Tg5 // specialized MyClass.t.setter -// CHECK-SIL: #MyClass.t!modify: (MyClass) -> () -> () : @$e4main7MyClassC1txvMAA2T1V_Tg5 // specialized MyClass.t.modify +// CHECK-SIL: #MyClass.t!modify: (MyClass) -> @yield_once () -> inout @yields T : @$e4main7MyClassC1txvMAA2T1V_Tg5 // specialized MyClass.t.modify // CHECK-SIL: #MyClass.init!allocator: (MyClass.Type) -> (T) -> MyClass : @$e4main7MyClassC1tACyxGx_tcfCAA2T1V_Tg5 // specialized MyClass.__allocating_init(t:) // CHECK-SIL: #MyClass.deinit!deallocator: @$e4main7MyClassCfDAA2T1V_Tg5 // specialized MyClass.__deallocating_deinit // CHECK-SIL: }