diff --git a/SwiftCompilerSources/Sources/SIL/Argument.swift b/SwiftCompilerSources/Sources/SIL/Argument.swift index 004bc778158b5..4e7f6a34afacb 100644 --- a/SwiftCompilerSources/Sources/SIL/Argument.swift +++ b/SwiftCompilerSources/Sources/SIL/Argument.swift @@ -60,10 +60,6 @@ final public class FunctionArgument : Argument { return index < parentFunction.numIndirectResultArguments } - public var hasResultDependsOn : Bool { - return bridged.hasResultDependsOn() - } - /// If the function's result depends on this argument, return the /// kind of dependence. public var resultDependence: LifetimeDependenceConvention? { diff --git a/SwiftCompilerSources/Sources/SIL/Function.swift b/SwiftCompilerSources/Sources/SIL/Function.swift index f18073c5aa313..a66e487c7aa3e 100644 --- a/SwiftCompilerSources/Sources/SIL/Function.swift +++ b/SwiftCompilerSources/Sources/SIL/Function.swift @@ -290,10 +290,6 @@ extension Function { public var hasResultDependence: Bool { convention.resultDependencies != nil } - - public var hasResultDependsOnSelf: Bool { - return bridged.hasResultDependsOnSelf() - } } public struct ArgumentTypeArray : RandomAccessCollection, FormattedLikeArray { diff --git a/include/swift/AST/ASTBridging.h b/include/swift/AST/ASTBridging.h index 5a2783bb3e451..b7ad51e54e6f9 100644 --- a/include/swift/AST/ASTBridging.h +++ b/include/swift/AST/ASTBridging.h @@ -1550,7 +1550,6 @@ enum ENUM_EXTENSIBILITY_ATTR(open) BridgedAttributedTypeSpecifier : size_t { BridgedAttributedTypeSpecifierLegacyOwned, BridgedAttributedTypeSpecifierConst, BridgedAttributedTypeSpecifierIsolated, - BridgedAttributedTypeSpecifierResultDependsOn, BridgedAttributedTypeSpecifierTransferring, BridgedAttributedTypeSpecifierSending, }; diff --git a/include/swift/AST/Decl.h b/include/swift/AST/Decl.h index fb7fa1eeba8b3..c8af917ce0068 100644 --- a/include/swift/AST/Decl.h +++ b/include/swift/AST/Decl.h @@ -6616,8 +6616,6 @@ class ParamDecl : public VarDecl { /// Whether or not this parameter is '_const'. IsCompileTimeConst = 1 << 1, - - HasResultDependsOn = 1 << 2, }; llvm::PointerIntPair> @@ -6656,9 +6654,6 @@ class ParamDecl : public VarDecl { /// Whether or not this parameter is 'isolated'. IsIsolated = 1 << 2, - /// Whether or not this paramater is '_resultDependsOn' - IsResultDependsOn = 1 << 3, - /// Whether or not this parameter is 'sending'. IsSending = 1 << 4, }; @@ -6961,18 +6956,6 @@ class ParamDecl : public VarDecl { ArgumentNameAndFlags.setInt(flags); } - bool hasResultDependsOn() const { - return ArgumentNameAndFlags.getInt().contains( - ArgumentNameFlags::HasResultDependsOn); - } - - void setResultDependsOn(bool value = true) { - auto flags = ArgumentNameAndFlags.getInt(); - flags = value ? flags | ArgumentNameFlags::HasResultDependsOn - : flags - ArgumentNameFlags::HasResultDependsOn; - ArgumentNameAndFlags.setInt(flags); - } - /// Does this parameter reject temporary pointer conversions? bool isNonEphemeral() const; diff --git a/include/swift/AST/DeclAttr.def b/include/swift/AST/DeclAttr.def index be7f607df20b4..693fdc30ced90 100644 --- a/include/swift/AST/DeclAttr.def +++ b/include/swift/AST/DeclAttr.def @@ -468,9 +468,6 @@ DECL_ATTR(storageRestrictions, StorageRestrictions, CONTEXTUAL_SIMPLE_DECL_ATTR(actor, Actor, DeclModifier | OnClass | ConcurrencyOnly | ABIBreakingToAdd | ABIBreakingToRemove | APIBreakingToAdd | APIBreakingToRemove, 102) -CONTEXTUAL_SIMPLE_DECL_ATTR(_resultDependsOnSelf, ResultDependsOnSelf, - OnFunc | DeclModifier | UserInaccessible | ABIBreakingToAdd | ABIStableToRemove | APIBreakingToAdd | APIStableToRemove, - 150) SIMPLE_DECL_ATTR(_staticExclusiveOnly, StaticExclusiveOnly, OnStruct | UserInaccessible | ABIStableToAdd | ABIStableToRemove | APIBreakingToAdd | APIStableToRemove, 151) diff --git a/include/swift/AST/DiagnosticsSema.def b/include/swift/AST/DiagnosticsSema.def index 38b816ec0af08..e6a2d7f84499f 100644 --- a/include/swift/AST/DiagnosticsSema.def +++ b/include/swift/AST/DiagnosticsSema.def @@ -7931,13 +7931,6 @@ ERROR(referencebindings_binding_must_have_initial_value,none, ERROR(referencebindings_binding_must_be_to_lvalue,none, "%0 bindings must be bound to an lvalue", (StringRef)) -//------------------------------------------------------------------------------ -// MARK: resultDependsOn Errors -//------------------------------------------------------------------------------ - -ERROR(result_depends_on_no_result,none, - "Incorrect use of %0 with no result", (StringRef)) - //------------------------------------------------------------------------------ // MARK: Pack Iteration Diagnostics //------------------------------------------------------------------------------ diff --git a/include/swift/AST/TypeRepr.h b/include/swift/AST/TypeRepr.h index 24d2285fd0358..5178c3b3ef193 100644 --- a/include/swift/AST/TypeRepr.h +++ b/include/swift/AST/TypeRepr.h @@ -1114,7 +1114,6 @@ class SpecifierTypeRepr : public TypeRepr { return T->getKind() == TypeReprKind::Ownership || T->getKind() == TypeReprKind::Isolated || T->getKind() == TypeReprKind::CompileTimeConst || - T->getKind() == TypeReprKind::ResultDependsOn || T->getKind() == TypeReprKind::LifetimeDependentReturn || T->getKind() == TypeReprKind::Transferring || T->getKind() == TypeReprKind::Sending; @@ -1188,21 +1187,6 @@ class CompileTimeConstTypeRepr : public SpecifierTypeRepr { static bool classof(const CompileTimeConstTypeRepr *T) { return true; } }; -/// A lifetime dependent type. -/// \code -/// x : _resultDependsOn Int -/// \endcode -class ResultDependsOnTypeRepr : public SpecifierTypeRepr { -public: - ResultDependsOnTypeRepr(TypeRepr *Base, SourceLoc InOutLoc) - : SpecifierTypeRepr(TypeReprKind::ResultDependsOn, Base, InOutLoc) {} - - static bool classof(const TypeRepr *T) { - return T->getKind() == TypeReprKind::ResultDependsOn; - } - static bool classof(const ResultDependsOnTypeRepr *T) { return true; } -}; - /// A transferring type. /// \code /// x : transferring Int @@ -1637,7 +1621,6 @@ inline bool TypeRepr::isSimple() const { case TypeReprKind::Sending: case TypeReprKind::Placeholder: case TypeReprKind::CompileTimeConst: - case TypeReprKind::ResultDependsOn: case TypeReprKind::LifetimeDependentReturn: return true; } diff --git a/include/swift/AST/TypeReprNodes.def b/include/swift/AST/TypeReprNodes.def index ddd8e68a3f190..8b81985e7d7b0 100644 --- a/include/swift/AST/TypeReprNodes.def +++ b/include/swift/AST/TypeReprNodes.def @@ -70,7 +70,6 @@ ABSTRACT_TYPEREPR(Specifier, TypeRepr) SPECIFIER_TYPEREPR(Ownership, SpecifierTypeRepr) SPECIFIER_TYPEREPR(Isolated, SpecifierTypeRepr) SPECIFIER_TYPEREPR(CompileTimeConst, SpecifierTypeRepr) - SPECIFIER_TYPEREPR(ResultDependsOn, SpecifierTypeRepr) SPECIFIER_TYPEREPR(Transferring, SpecifierTypeRepr) SPECIFIER_TYPEREPR(Sending, SpecifierTypeRepr) TYPEREPR(Fixed, TypeRepr) diff --git a/include/swift/AST/Types.h b/include/swift/AST/Types.h index d3b3f91a4c62b..055003687c791 100644 --- a/include/swift/AST/Types.h +++ b/include/swift/AST/Types.h @@ -2226,9 +2226,8 @@ class ParameterTypeFlags { NoDerivative = 1 << 6, Isolated = 1 << 7, CompileTimeConst = 1 << 8, - ResultDependsOn = 1 << 9, - Sending = 1 << 10, - NumBits = 11 + Sending = 1 << 9, + NumBits = 10 }; OptionSet value; static_assert(NumBits <= 8*sizeof(OptionSet), "overflowed"); @@ -2243,14 +2242,12 @@ class ParameterTypeFlags { ParameterTypeFlags(bool variadic, bool autoclosure, bool nonEphemeral, ParamSpecifier specifier, bool isolated, bool noDerivative, - bool compileTimeConst, bool hasResultDependsOn, - bool isSending) + bool compileTimeConst, bool isSending) : value((variadic ? Variadic : 0) | (autoclosure ? AutoClosure : 0) | (nonEphemeral ? NonEphemeral : 0) | uint8_t(specifier) << SpecifierShift | (isolated ? Isolated : 0) | (noDerivative ? NoDerivative : 0) | (compileTimeConst ? CompileTimeConst : 0) | - (hasResultDependsOn ? ResultDependsOn : 0) | (isSending ? Sending : 0)) {} /// Create one from what's present in the parameter type @@ -2258,7 +2255,7 @@ class ParameterTypeFlags { fromParameterType(Type paramTy, bool isVariadic, bool isAutoClosure, bool isNonEphemeral, ParamSpecifier ownership, bool isolated, bool isNoDerivative, bool compileTimeConst, - bool hasResultDependsOn, bool isSending); + bool isSending); bool isNone() const { return !value; } bool isVariadic() const { return value.contains(Variadic); } @@ -2270,7 +2267,6 @@ class ParameterTypeFlags { bool isIsolated() const { return value.contains(Isolated); } bool isCompileTimeConst() const { return value.contains(CompileTimeConst); } bool isNoDerivative() const { return value.contains(NoDerivative); } - bool hasResultDependsOn() const { return value.contains(ResultDependsOn); } bool isSending() const { return value.contains(Sending); } /// Get the spelling of the parameter specifier used on the parameter. @@ -2433,7 +2429,6 @@ class YieldTypeFlags { /*nonEphemeral*/ false, getOwnershipSpecifier(), /*isolated*/ false, /*noDerivative*/ false, /*compileTimeConst*/ false, - /*hasResultDependsOn*/ false, /*is transferring*/ false); } @@ -7771,7 +7766,7 @@ inline TupleTypeElt TupleTypeElt::getWithType(Type T) const { inline ParameterTypeFlags ParameterTypeFlags::fromParameterType( Type paramTy, bool isVariadic, bool isAutoClosure, bool isNonEphemeral, ParamSpecifier ownership, bool isolated, bool isNoDerivative, - bool compileTimeConst, bool hasResultDependsOn, bool isSending) { + bool compileTimeConst, bool isSending) { // FIXME(Remove InOut): The last caller that needs this is argument // decomposition. Start by enabling the assertion there and fixing up those // callers, then remove this, then remove @@ -7781,9 +7776,8 @@ inline ParameterTypeFlags ParameterTypeFlags::fromParameterType( ownership == ParamSpecifier::InOut); ownership = ParamSpecifier::InOut; } - return {isVariadic, isAutoClosure, isNonEphemeral, - ownership, isolated, isNoDerivative, - compileTimeConst, hasResultDependsOn, isSending}; + return {isVariadic, isAutoClosure, isNonEphemeral, ownership, + isolated, isNoDerivative, compileTimeConst, isSending}; } inline const Type *BoundGenericType::getTrailingObjectsPointer() const { diff --git a/include/swift/Parse/Parser.h b/include/swift/Parse/Parser.h index 31373eacce1b8..2020c178838cc 100644 --- a/include/swift/Parse/Parser.h +++ b/include/swift/Parse/Parser.h @@ -1200,9 +1200,6 @@ class Parser { Tok.isContextualKeyword("isolated") || Tok.isContextualKeyword("_const")) return true; - if (Context.LangOpts.hasFeature(Feature::NonescapableTypes) && - Tok.isContextualKeyword("_resultDependsOn")) - return true; if (Context.LangOpts.hasFeature(Feature::TransferringArgsAndResults) && Tok.isContextualKeyword("transferring")) return true; @@ -1210,8 +1207,7 @@ class Parser { Tok.isContextualKeyword("sending")) return true; if (Context.LangOpts.hasFeature(Feature::NonescapableTypes) && - (Tok.isContextualKeyword("_resultDependsOn") || - isLifetimeDependenceToken())) + isLifetimeDependenceToken()) return true; return false; } @@ -1257,7 +1253,6 @@ class Parser { SourceLoc SpecifierLoc; SourceLoc IsolatedLoc; SourceLoc ConstLoc; - SourceLoc ResultDependsOnLoc; SourceLoc TransferringLoc; SourceLoc SendingLoc; SmallVector Attributes; @@ -1571,9 +1566,6 @@ class Parser { /// The location of the '_const' keyword, if present. SourceLoc CompileConstLoc; - /// The location of the '_resultDependsOn' keyword, if present. - SourceLoc ResultDependsOnLoc; - /// The location of the 'transferring' keyword if present. SourceLoc TransferringLoc; diff --git a/include/swift/SIL/SILArgument.h b/include/swift/SIL/SILArgument.h index de5d0d88c62b3..cfbcc70db43f9 100644 --- a/include/swift/SIL/SILArgument.h +++ b/include/swift/SIL/SILArgument.h @@ -366,15 +366,13 @@ class SILFunctionArgument : public SILArgument { ValueOwnershipKind ownershipKind, const ValueDecl *decl = nullptr, bool isNoImplicitCopy = false, LifetimeAnnotation lifetimeAnnotation = LifetimeAnnotation::None, - bool isCapture = false, bool isParameterPack = false, - bool hasResultDependsOn = false) + bool isCapture = false, bool isParameterPack = false) : SILArgument(ValueKind::SILFunctionArgument, parentBlock, type, ownershipKind, decl) { sharedUInt32().SILFunctionArgument.noImplicitCopy = isNoImplicitCopy; sharedUInt32().SILFunctionArgument.lifetimeAnnotation = lifetimeAnnotation; sharedUInt32().SILFunctionArgument.closureCapture = isCapture; sharedUInt32().SILFunctionArgument.parameterPack = isParameterPack; - sharedUInt32().SILFunctionArgument.hasResultDependsOn = hasResultDependsOn; } // A special constructor, only intended for use in @@ -426,14 +424,6 @@ class SILFunctionArgument : public SILArgument { sharedUInt32().SILFunctionArgument.lifetimeAnnotation = newValue; } - bool hasResultDependsOn() const { - return sharedUInt32().SILFunctionArgument.hasResultDependsOn; - } - - void setHasResultDependsOn(bool flag = true) { - sharedUInt32().SILFunctionArgument.hasResultDependsOn = flag; - } - bool isSending() const { return getKnownParameterInfo().hasOption(SILParameterInfo::Sending); } diff --git a/include/swift/SIL/SILBridging.h b/include/swift/SIL/SILBridging.h index 676f9218bc12d..4cd39306654f9 100644 --- a/include/swift/SIL/SILBridging.h +++ b/include/swift/SIL/SILBridging.h @@ -622,7 +622,6 @@ struct BridgedFunction { BRIDGED_INLINE bool isGeneric() const; BRIDGED_INLINE bool hasSemanticsAttr(BridgedStringRef attrName) const; BRIDGED_INLINE bool hasUnsafeNonEscapableResult() const; - BRIDGED_INLINE bool hasResultDependsOnSelf() const; bool mayBindDynamicSelf() const; BRIDGED_INLINE EffectsKind getEffectAttribute() const; BRIDGED_INLINE PerformanceConstraints getPerformanceConstraints() const; @@ -1026,7 +1025,6 @@ struct BridgedArgument { BRIDGED_INLINE swift::SILArgument * _Nonnull getArgument() const; SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedBasicBlock getParent() const; BRIDGED_INLINE bool isReborrow() const; - BRIDGED_INLINE bool hasResultDependsOn() const; SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedNullableVarDecl getVarDecl() const; BRIDGED_INLINE void copyFlags(BridgedArgument fromArgument) const; }; diff --git a/include/swift/SIL/SILBridgingImpl.h b/include/swift/SIL/SILBridgingImpl.h index 7ae19d31fc1d4..b8fe702bef9c9 100644 --- a/include/swift/SIL/SILBridgingImpl.h +++ b/include/swift/SIL/SILBridgingImpl.h @@ -520,11 +520,6 @@ BridgedBasicBlock BridgedArgument::getParent() const { return {getArgument()->getParent()}; } -bool BridgedArgument::hasResultDependsOn() const { - auto *fArg = static_cast(getArgument()); - return fArg->hasResultDependsOn(); -} - bool BridgedArgument::isReborrow() const { return getArgument()->isReborrow(); } BridgedNullableVarDecl BridgedArgument::getVarDecl() const { @@ -692,10 +687,6 @@ bool BridgedFunction::hasUnsafeNonEscapableResult() const { return getFunction()->hasUnsafeNonEscapableResult(); } -bool BridgedFunction::hasResultDependsOnSelf() const { - return getFunction()->hasResultDependsOnSelf(); -} - BridgedFunction::EffectsKind BridgedFunction::getEffectAttribute() const { return (EffectsKind)getFunction()->getEffectsKind(); } diff --git a/include/swift/SIL/SILFunction.h b/include/swift/SIL/SILFunction.h index dfc94cb42cef5..155505220c783 100644 --- a/include/swift/SIL/SILFunction.h +++ b/include/swift/SIL/SILFunction.h @@ -464,8 +464,6 @@ class SILFunction /// lifetime-dependence on an argument. unsigned HasUnsafeNonEscapableResult : 1; - unsigned HasResultDependsOnSelf : 1; - /// True, if this function or a caller (transitively) has a performance /// constraint. /// If true, optimizations must not introduce new runtime calls or metadata @@ -758,11 +756,6 @@ class SILFunction HasUnsafeNonEscapableResult = value; } - bool hasResultDependsOnSelf() const { return HasResultDependsOnSelf; } - - void setHasResultDependsOnSelf(bool flag = true) { - HasResultDependsOnSelf = flag; - } /// Returns true if this is a reabstraction thunk of escaping function type /// whose single argument is a potentially non-escaping closure. i.e. the /// thunks' function argument may itself have @inout_aliasable parameters. diff --git a/include/swift/SIL/SILNode.h b/include/swift/SIL/SILNode.h index b72705f5e8324..14ca9d207afbd 100644 --- a/include/swift/SIL/SILNode.h +++ b/include/swift/SIL/SILNode.h @@ -311,7 +311,7 @@ class alignas(8) SILNode : SHARED_FIELD(PointerToAddressInst, uint32_t alignment); SHARED_FIELD(SILFunctionArgument, uint32_t noImplicitCopy : 1, lifetimeAnnotation : 2, closureCapture : 1, - parameterPack : 1, hasResultDependsOn : 1); + parameterPack : 1); // Do not use `_sharedUInt32_private` outside of SILNode. } _sharedUInt32_private; diff --git a/lib/AST/ASTBridging.cpp b/lib/AST/ASTBridging.cpp index 84d1d89cedfb3..afe9a3780fc25 100644 --- a/lib/AST/ASTBridging.cpp +++ b/lib/AST/ASTBridging.cpp @@ -2236,9 +2236,6 @@ BridgedSpecifierTypeRepr BridgedSpecifierTypeRepr_createParsed( case BridgedAttributedTypeSpecifierIsolated: { return new (context) IsolatedTypeRepr(baseType, loc); } - case BridgedAttributedTypeSpecifierResultDependsOn: { - return new (context) ResultDependsOnTypeRepr(baseType, loc); - } } } diff --git a/lib/AST/ASTDumper.cpp b/lib/AST/ASTDumper.cpp index 87fa92bf1dd21..7b22da4ec9a7f 100644 --- a/lib/AST/ASTDumper.cpp +++ b/lib/AST/ASTDumper.cpp @@ -3462,13 +3462,6 @@ class PrintTypeRepr : public TypeReprVisitor, printFoot(); } - void visitResultDependsOnTypeRepr(ResultDependsOnTypeRepr *T, - StringRef label) { - printCommon("_resultDependsOn", label); - printRec(T->getBase()); - printFoot(); - } - void visitOptionalTypeRepr(OptionalTypeRepr *T, StringRef label) { printCommon("type_optional", label); printRec(T->getBase()); diff --git a/lib/AST/ASTPrinter.cpp b/lib/AST/ASTPrinter.cpp index de6f7c758dda7..6dd5681dd8c26 100644 --- a/lib/AST/ASTPrinter.cpp +++ b/lib/AST/ASTPrinter.cpp @@ -3783,9 +3783,6 @@ static void printParameterFlags(ASTPrinter &printer, printer.printKeyword("isolated", options, " "); } - if (flags.hasResultDependsOn()) - printer.printKeyword("_resultDependsOn", options, " "); - if (!options.excludeAttrKind(TypeAttrKind::Escaping) && escaping) printer.printKeyword("@escaping", options, " "); diff --git a/lib/AST/ASTWalker.cpp b/lib/AST/ASTWalker.cpp index 7fee5518988b5..c96d684c997e0 100644 --- a/lib/AST/ASTWalker.cpp +++ b/lib/AST/ASTWalker.cpp @@ -2348,10 +2348,6 @@ bool Traversal::visitCompileTimeConstTypeRepr(CompileTimeConstTypeRepr *T) { return doIt(T->getBase()); } -bool Traversal::visitResultDependsOnTypeRepr(ResultDependsOnTypeRepr *T) { - return doIt(T->getBase()); -} - bool Traversal::visitOpaqueReturnTypeRepr(OpaqueReturnTypeRepr *T) { return doIt(T->getConstraint()); } diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index 8359c6eb4c172..284751f7a7708 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -8659,7 +8659,7 @@ AnyFunctionType::Param ParamDecl::toFunctionParam(Type type) const { auto flags = ParameterTypeFlags::fromParameterType( type, isVariadic(), isAutoClosure(), isNonEphemeral(), getSpecifier(), isIsolated(), /*isNoDerivative*/ false, isCompileTimeConst(), - hasResultDependsOn(), isSending()); + isSending()); return AnyFunctionType::Param(type, label, flags, internalLabel); } diff --git a/lib/AST/FeatureSet.cpp b/lib/AST/FeatureSet.cpp index 6cbb9e653b80a..cbccc40dcdbd7 100644 --- a/lib/AST/FeatureSet.cpp +++ b/lib/AST/FeatureSet.cpp @@ -622,14 +622,6 @@ static bool usesFeatureNonescapableTypes(Decl *decl) { decl->getAttrs().hasAttribute()) { return true; } - auto *fd = dyn_cast(decl); - if (fd && fd->getAttrs().getAttribute(DeclAttrKind::ResultDependsOnSelf)) { - return true; - } - auto *pd = dyn_cast(decl); - if (pd && pd->hasResultDependsOn()) { - return true; - } return false; } diff --git a/lib/AST/NameLookup.cpp b/lib/AST/NameLookup.cpp index 560de8c5bc039..856520ff0c52a 100644 --- a/lib/AST/NameLookup.cpp +++ b/lib/AST/NameLookup.cpp @@ -3178,7 +3178,6 @@ directReferencesForTypeRepr(Evaluator &evaluator, case TypeReprKind::OpaqueReturn: case TypeReprKind::NamedOpaqueReturn: case TypeReprKind::Existential: - case TypeReprKind::ResultDependsOn: case TypeReprKind::LifetimeDependentReturn: case TypeReprKind::Transferring: case TypeReprKind::Sending: diff --git a/lib/AST/TypeRepr.cpp b/lib/AST/TypeRepr.cpp index ce7b5d915c9da..b70fc56777c05 100644 --- a/lib/AST/TypeRepr.cpp +++ b/lib/AST/TypeRepr.cpp @@ -856,9 +856,6 @@ void SpecifierTypeRepr::printImpl(ASTPrinter &Printer, case TypeReprKind::CompileTimeConst: Printer.printKeyword("_const", Opts, " "); break; - case TypeReprKind::ResultDependsOn: - Printer.printKeyword("_resultDependsOn", Opts, " "); - break; } printTypeRepr(Base, Printer, Opts); } diff --git a/lib/ASTGen/Sources/ASTGen/DeclAttrs.swift b/lib/ASTGen/Sources/ASTGen/DeclAttrs.swift index 367f4e2743503..eeab952eba627 100644 --- a/lib/ASTGen/Sources/ASTGen/DeclAttrs.swift +++ b/lib/ASTGen/Sources/ASTGen/DeclAttrs.swift @@ -288,7 +288,6 @@ extension ASTGenVisitor { .override, .indirect, .final, - .resultDependsOnSelf, .knownToBeLocal, .compileTimeConst: diff --git a/lib/ASTGen/Sources/ASTGen/Types.swift b/lib/ASTGen/Sources/ASTGen/Types.swift index bfb57da17ac0f..69b79c30295fb 100644 --- a/lib/ASTGen/Sources/ASTGen/Types.swift +++ b/lib/ASTGen/Sources/ASTGen/Types.swift @@ -350,7 +350,6 @@ extension BridgedAttributedTypeSpecifier { case .__owned: self = .legacyOwned case ._const: self = .const case .isolated: self = .isolated - case ._resultDependsOn: self = .resultDependsOn default: return nil } } diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index 54261f61c56d6..068c2be02cab8 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -2901,13 +2901,6 @@ ParserStatus Parser::parseNewDeclAttribute(DeclAttributes &Attributes, DiscardAttribute = true; } - if (DK == DeclAttrKind::ResultDependsOnSelf && - !Context.LangOpts.hasFeature(Feature::NonescapableTypes)) { - diagnose(Loc, diag::requires_experimental_feature, AttrName, true, - getFeatureName(Feature::NonescapableTypes)); - DiscardAttribute = true; - } - // Filled in during parsing. If there is a duplicate // diagnostic this can be used for better error presentation. SourceRange AttrRange; @@ -5452,15 +5445,6 @@ ParserStatus Parser::ParsedTypeAttributeList::slowParse(Parser &P) { continue; } - if (Tok.isContextualKeyword("_resultDependsOn")) { - if (!P.Context.LangOpts.hasFeature(Feature::NonescapableTypes)) { - P.diagnose(Tok, diag::requires_experimental_feature, "resultDependsOn", - false, getFeatureName(Feature::NonescapableTypes)); - } - ResultDependsOnLoc = P.consumeToken(); - continue; - } - // Perform an extra check for transferring. Since it is a specifier, we use // the actual parsing logic below. if (Tok.isContextualKeyword("transferring")) { diff --git a/lib/Parse/ParsePattern.cpp b/lib/Parse/ParsePattern.cpp index 4fca0dc3eb0db..4920c7d550074 100644 --- a/lib/Parse/ParsePattern.cpp +++ b/lib/Parse/ParsePattern.cpp @@ -128,9 +128,7 @@ bool Parser::startsParameterName(bool isClosure) { !Tok.isContextualKeyword("transferring")) && (!Context.LangOpts.hasFeature(Feature::SendingArgsAndResults) || !Tok.isContextualKeyword("sending")) && - !Tok.isContextualKeyword("consuming") && !Tok.is(tok::kw_repeat) && - (!Context.LangOpts.hasFeature(Feature::NonescapableTypes) || - !Tok.isContextualKeyword("_resultDependsOn"))) + !Tok.isContextualKeyword("consuming") && !Tok.is(tok::kw_repeat)) return true; // Parameter specifiers can be an argument label, but they're also @@ -612,12 +610,6 @@ mapParsedParameters(Parser &parser, param->setCompileTimeConst(); } - if (paramInfo.ResultDependsOnLoc.isValid()) { - type = new (parser.Context) - ResultDependsOnTypeRepr(type, paramInfo.ResultDependsOnLoc); - param->setResultDependsOn(); - } - if (paramInfo.TransferringLoc.isValid()) { type = new (parser.Context) TransferringTypeRepr(type, paramInfo.TransferringLoc); @@ -654,8 +646,6 @@ mapParsedParameters(Parser &parser, param->setIsolated(true); else if (isa(STR)) param->setCompileTimeConst(true); - else if (isa(STR)) - param->setResultDependsOn(true); else if (isa(STR)) param->setSending(true); else if (isa(STR)) diff --git a/lib/Parse/ParseType.cpp b/lib/Parse/ParseType.cpp index 16af391fefa1d..4ee647533c4b3 100644 --- a/lib/Parse/ParseType.cpp +++ b/lib/Parse/ParseType.cpp @@ -53,10 +53,6 @@ Parser::ParsedTypeAttributeList::applyAttributesToType(Parser &p, ty = new (p.Context) CompileTimeConstTypeRepr(ty, ConstLoc); } - if (ResultDependsOnLoc.isValid()) { - ty = new (p.Context) ResultDependsOnTypeRepr(ty, ResultDependsOnLoc); - } - if (TransferringLoc.isValid()) { ty = new (p.Context) TransferringTypeRepr(ty, TransferringLoc); } diff --git a/lib/SIL/IR/SILFunction.cpp b/lib/SIL/IR/SILFunction.cpp index 6ca75bbc3725b..beb9cebf3a8b9 100644 --- a/lib/SIL/IR/SILFunction.cpp +++ b/lib/SIL/IR/SILFunction.cpp @@ -266,7 +266,6 @@ void SILFunction::init( this->ForceEnableLexicalLifetimes = DoNotForceEnableLexicalLifetimes; this->UseStackForPackMetadata = DoUseStackForPackMetadata; this->HasUnsafeNonEscapableResult = false; - this->HasResultDependsOnSelf = false; this->IsPerformanceConstraint = false; this->stackProtection = false; this->Inlined = false; diff --git a/lib/SIL/IR/SILFunctionBuilder.cpp b/lib/SIL/IR/SILFunctionBuilder.cpp index 7344864d2c3da..55c38a142e62c 100644 --- a/lib/SIL/IR/SILFunctionBuilder.cpp +++ b/lib/SIL/IR/SILFunctionBuilder.cpp @@ -212,10 +212,6 @@ void SILFunctionBuilder::addFunctionAttributes( F->setHasUnsafeNonEscapableResult(true); } - if (Attrs.hasAttribute()) { - F->setHasResultDependsOnSelf(); - } - // Validate `@differentiable` attributes by calling `getParameterIndices`. // This is important for: // - Skipping invalid `@differentiable` attributes in non-primary files. diff --git a/lib/SIL/IR/SILPrinter.cpp b/lib/SIL/IR/SILPrinter.cpp index 8a7ae3014b085..890bfb3ef0cdd 100644 --- a/lib/SIL/IR/SILPrinter.cpp +++ b/lib/SIL/IR/SILPrinter.cpp @@ -164,7 +164,6 @@ struct SILValuePrinterInfo { bool IsCapture = false; bool IsReborrow = false; bool IsEscaping = false; - bool HasResultDependsOn = false; SILValuePrinterInfo(ID ValueID) : ValueID(ValueID), Type(), OwnershipKind() {} SILValuePrinterInfo(ID ValueID, SILType Type) @@ -175,11 +174,10 @@ struct SILValuePrinterInfo { SILValuePrinterInfo(ID ValueID, SILType Type, ValueOwnershipKind OwnershipKind, bool IsNoImplicitCopy, LifetimeAnnotation Lifetime, bool IsCapture, - bool IsReborrow, bool IsEscaping, bool HasResultDependsOn) + bool IsReborrow, bool IsEscaping) : ValueID(ValueID), Type(Type), OwnershipKind(OwnershipKind), IsNoImplicitCopy(IsNoImplicitCopy), Lifetime(Lifetime), - IsCapture(IsCapture), IsReborrow(IsReborrow), IsEscaping(IsEscaping), - HasResultDependsOn(HasResultDependsOn) {} + IsCapture(IsCapture), IsReborrow(IsReborrow), IsEscaping(IsEscaping) {} SILValuePrinterInfo(ID ValueID, SILType Type, bool IsNoImplicitCopy, LifetimeAnnotation Lifetime, bool IsCapture, bool IsReborrow, bool IsEscaping) @@ -695,8 +693,6 @@ class SILPrinter : public SILInstructionVisitor { *this << "@reborrow "; if (i.IsEscaping) *this << "@pointer_escape "; - if (i.HasResultDependsOn) - *this << "@_resultDependsOn "; if (i.OwnershipKind && *i.OwnershipKind != OwnershipKind::None) { *this << "@" << i.OwnershipKind.value() << " "; } @@ -747,8 +743,7 @@ class SILPrinter : public SILInstructionVisitor { arg->getLifetimeAnnotation(), arg->isClosureCapture(), arg->isReborrow(), - arg->hasPointerEscape(), - arg->hasResultDependsOn()}; + arg->hasPointerEscape()}; } SILValuePrinterInfo getIDAndTypeAndOwnership(SILArgument *arg) { return {Ctx.getID(arg), arg->getType(), arg->getOwnershipKind(), @@ -3508,10 +3503,6 @@ void SILFunction::print(SILPrintContext &PrintCtx) const { if (needsStackProtection()) OS << "[stack_protection] "; - if (hasResultDependsOnSelf()) { - OS << "[_resultDependsOnSelf] "; - } - llvm::DenseMap sugaredTypeNames; printSILFunctionNameAndType(OS, this, sugaredTypeNames, &PrintCtx); diff --git a/lib/SIL/Parser/ParseSIL.cpp b/lib/SIL/Parser/ParseSIL.cpp index ad5e77cfd5184..36bd5ba27bc40 100644 --- a/lib/SIL/Parser/ParseSIL.cpp +++ b/lib/SIL/Parser/ParseSIL.cpp @@ -666,7 +666,7 @@ void SILParser::convertRequirements(ArrayRef From, static bool parseDeclSILOptional( bool *isTransparent, SerializedKind_t *serializedKind, bool *isCanonical, - bool *hasOwnershipSSA, bool *hasResultDependsOnSelf, IsThunk_t *isThunk, + bool *hasOwnershipSSA, IsThunk_t *isThunk, IsDynamicallyReplaceable_t *isDynamic, IsDistributed_t *isDistributed, IsRuntimeAccessible_t *isRuntimeAccessible, ForceEnableLexicalLifetimes_t *forceEnableLexicalLifetimes, @@ -719,9 +719,6 @@ static bool parseDeclSILOptional( *isCanonical = true; else if (hasOwnershipSSA && SP.P.Tok.getText() == "ossa") *hasOwnershipSSA = true; - else if (hasResultDependsOnSelf && - SP.P.Tok.getText() == "_resultDependsOnSelf") - *hasResultDependsOnSelf = true; else if (needStackProtection && SP.P.Tok.getText() == "stack_protection") *needStackProtection = true; else if (isThunk && SP.P.Tok.getText() == "thunk") @@ -6982,11 +6979,9 @@ bool SILParser::parseSILBasicBlock(SILBuilder &B) { bool foundEagerMove = false; bool foundReborrow = false; bool hasPointerEscape = false; - bool hasResultDependsOn = false; - while ( - auto attributeName = parseOptionalAttribute( - {"noImplicitCopy", "_lexical", "_eagerMove", "closureCapture", - "reborrow", "pointer_escape", "_resultDependsOn"})) { + while (auto attributeName = parseOptionalAttribute( + {"noImplicitCopy", "_lexical", "_eagerMove", + "closureCapture", "reborrow", "pointer_escape"})) { if (*attributeName == "noImplicitCopy") foundNoImplicitCopy = true; else if (*attributeName == "_lexical") @@ -6999,8 +6994,6 @@ bool SILParser::parseSILBasicBlock(SILBuilder &B) { foundReborrow = true; else if (*attributeName == "pointer_escape") hasPointerEscape = true; - else if (*attributeName == "_resultDependsOn") - hasResultDependsOn = true; else { llvm_unreachable("Unexpected attribute!"); } @@ -7033,7 +7026,6 @@ bool SILParser::parseSILBasicBlock(SILBuilder &B) { fArg->setLifetimeAnnotation(lifetime); fArg->setReborrow(foundReborrow); fArg->setHasPointerEscape(hasPointerEscape); - fArg->setHasResultDependsOn(hasResultDependsOn); Arg = fArg; // Today, we construct the ownership kind straight from the function @@ -7117,7 +7109,6 @@ bool SILParserState::parseDeclSIL(Parser &P) { bool hasUnsafeNonEscapableResult = false; IsExactSelfClass_t isExactSelfClass = IsNotExactSelfClass; bool hasOwnershipSSA = false; - bool hasResultDependsOnSelf = false; IsThunk_t isThunk = IsNotThunk; SILFunction::Purpose specialPurpose = SILFunction::Purpose::None; bool isWeakImported = false; @@ -7140,16 +7131,15 @@ bool SILParserState::parseDeclSIL(Parser &P) { if (parseSILLinkage(FnLinkage, P) || parseDeclSILOptional( &isTransparent, &isSerialized, &isCanonical, &hasOwnershipSSA, - &hasResultDependsOnSelf, &isThunk, &isDynamic, &isDistributed, - &isRuntimeAccessible, &forceEnableLexicalLifetimes, - &useStackForPackMetadata, &hasUnsafeNonEscapableResult, - &isExactSelfClass, &DynamicallyReplacedFunction, - &AdHocWitnessFunction, &objCReplacementFor, &specialPurpose, - &inlineStrategy, &optimizationMode, &perfConstr, - &isPerformanceConstraint, &markedAsUsed, §ion, nullptr, - &isWeakImported, &needStackProtection, &availability, - &isWithoutActuallyEscapingThunk, &Semantics, &SpecAttrs, &ClangDecl, - &MRK, FunctionState, M) || + &isThunk, &isDynamic, &isDistributed, &isRuntimeAccessible, + &forceEnableLexicalLifetimes, &useStackForPackMetadata, + &hasUnsafeNonEscapableResult, &isExactSelfClass, + &DynamicallyReplacedFunction, &AdHocWitnessFunction, + &objCReplacementFor, &specialPurpose, &inlineStrategy, + &optimizationMode, &perfConstr, &isPerformanceConstraint, + &markedAsUsed, §ion, nullptr, &isWeakImported, + &needStackProtection, &availability, &isWithoutActuallyEscapingThunk, + &Semantics, &SpecAttrs, &ClangDecl, &MRK, FunctionState, M) || P.parseToken(tok::at_sign, diag::expected_sil_function_name) || P.parseIdentifier(FnName, FnNameLoc, /*diagnoseDollarPrefix=*/false, diag::expected_sil_function_name) || @@ -7177,7 +7167,6 @@ bool SILParserState::parseDeclSIL(Parser &P) { FunctionState.F->setWasDeserializedCanonical(isCanonical); if (!hasOwnershipSSA) FunctionState.F->setOwnershipEliminated(); - FunctionState.F->setHasResultDependsOnSelf(hasResultDependsOnSelf); FunctionState.F->setThunk(IsThunk_t(isThunk)); FunctionState.F->setIsDynamic(isDynamic); FunctionState.F->setIsDistributed(isDistributed); @@ -7397,7 +7386,7 @@ bool SILParserState::parseSILGlobal(Parser &P) { SILParser State(P); if (parseSILLinkage(GlobalLinkage, P) || - parseDeclSILOptional(nullptr, &isSerialized, nullptr, nullptr, nullptr, + parseDeclSILOptional(nullptr, &isSerialized, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, @@ -7455,7 +7444,7 @@ bool SILParserState::parseSILProperty(Parser &P) { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, - nullptr, nullptr, nullptr, SP, M)) + nullptr, nullptr, SP, M)) return true; ValueDecl *VD; @@ -7525,7 +7514,7 @@ bool SILParserState::parseSILVTable(Parser &P) { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, - nullptr, nullptr, nullptr, VTableState, M)) + nullptr, nullptr, VTableState, M)) return true; @@ -7643,12 +7632,12 @@ bool SILParserState::parseSILMoveOnlyDeinit(Parser &parser) { SILParser moveOnlyDeinitTableState(parser); SerializedKind_t Serialized = IsNotSerialized; - if (parseDeclSILOptional( - nullptr, &Serialized, nullptr, nullptr, nullptr, nullptr, nullptr, - nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, - nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, - nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, - nullptr, nullptr, nullptr, nullptr, moveOnlyDeinitTableState, M)) + if (parseDeclSILOptional(nullptr, &Serialized, nullptr, nullptr, nullptr, + nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, + nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, + nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, + nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, + nullptr, nullptr, moveOnlyDeinitTableState, M)) return true; // Parse the class name. @@ -8135,7 +8124,7 @@ bool SILParserState::parseSILWitnessTable(Parser &P) { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, - nullptr, nullptr, nullptr, WitnessState, M)) + nullptr, nullptr, WitnessState, M)) return true; // Parse the protocol conformance. diff --git a/lib/SILGen/SILGenBuilder.cpp b/lib/SILGen/SILGenBuilder.cpp index 0534d720433fb..5fa712fe980a8 100644 --- a/lib/SILGen/SILGenBuilder.cpp +++ b/lib/SILGen/SILGenBuilder.cpp @@ -536,9 +536,6 @@ static ManagedValue createInputFunctionArgument( isNoImplicitCopy |= pd->getSpecifier() == ParamSpecifier::Borrowing; isNoImplicitCopy |= pd->getSpecifier() == ParamSpecifier::Consuming; } - if (pd->hasResultDependsOn()) { - arg->setHasResultDependsOn(); - } } if (isNoImplicitCopy) arg->setNoImplicitCopy(isNoImplicitCopy); diff --git a/lib/SILGen/SILGenLValue.cpp b/lib/SILGen/SILGenLValue.cpp index cdb9c7f117ea0..eabe7d03f414e 100644 --- a/lib/SILGen/SILGenLValue.cpp +++ b/lib/SILGen/SILGenLValue.cpp @@ -3042,9 +3042,6 @@ class LLVM_LIBRARY_VISIBILITY SILGenBorrowedBaseVisitor case ParamSpecifier::ImplicitlyCopyableConsuming: return false; } - if (pd->hasResultDependsOn()) { - return true; - } } } return false; diff --git a/lib/Sema/TypeCheckAttr.cpp b/lib/Sema/TypeCheckAttr.cpp index e719f4e3e450e..b143faa060fcd 100644 --- a/lib/Sema/TypeCheckAttr.cpp +++ b/lib/Sema/TypeCheckAttr.cpp @@ -205,16 +205,8 @@ class AttributeChecker : public AttributeVisitor { void visitNonMutatingAttr(NonMutatingAttr *attr) { visitMutationAttr(attr); } void visitBorrowingAttr(BorrowingAttr *attr) { visitMutationAttr(attr); } void visitConsumingAttr(ConsumingAttr *attr) { visitMutationAttr(attr); } - void visitLegacyConsumingAttr(LegacyConsumingAttr *attr) { visitMutationAttr(attr); } - void visitResultDependsOnSelfAttr(ResultDependsOnSelfAttr *attr) { - FuncDecl *FD = cast(D); - if (FD->getDescriptiveKind() != DescriptiveDeclKind::Method) { - diagnoseAndRemoveAttr(attr, diag::attr_methods_only, attr); - } - if (FD->getResultTypeRepr() == nullptr) { - diagnoseAndRemoveAttr(attr, diag::result_depends_on_no_result, - attr->getAttrName()); - } + void visitLegacyConsumingAttr(LegacyConsumingAttr *attr) { + visitMutationAttr(attr); } void visitDynamicAttr(DynamicAttr *attr); diff --git a/lib/Sema/TypeCheckDeclOverride.cpp b/lib/Sema/TypeCheckDeclOverride.cpp index b5e9782eb0bc8..b6d6f2ad7a307 100644 --- a/lib/Sema/TypeCheckDeclOverride.cpp +++ b/lib/Sema/TypeCheckDeclOverride.cpp @@ -1536,7 +1536,6 @@ namespace { UNINTERESTING_ATTR(Override) UNINTERESTING_ATTR(RawDocComment) UNINTERESTING_ATTR(RawLayout) - UNINTERESTING_ATTR(ResultDependsOnSelf) UNINTERESTING_ATTR(Required) UNINTERESTING_ATTR(Convenience) UNINTERESTING_ATTR(Semantics) diff --git a/lib/Sema/TypeCheckType.cpp b/lib/Sema/TypeCheckType.cpp index 45bc4fe02a972..b812c893424b9 100644 --- a/lib/Sema/TypeCheckType.cpp +++ b/lib/Sema/TypeCheckType.cpp @@ -2156,10 +2156,9 @@ namespace { TypeResolutionOptions options); NeverNullType resolveSendingTypeRepr(SendingTypeRepr *repr, TypeResolutionOptions options); - NeverNullType resolveCompileTimeConstTypeRepr(CompileTimeConstTypeRepr *repr, - TypeResolutionOptions options); - NeverNullType resolveResultDependsOnTypeRepr(ResultDependsOnTypeRepr *repr, - TypeResolutionOptions options); + NeverNullType + resolveCompileTimeConstTypeRepr(CompileTimeConstTypeRepr *repr, + TypeResolutionOptions options); NeverNullType resolveLifetimeDependentReturnTypeRepr( LifetimeDependentReturnTypeRepr *repr, TypeResolutionOptions options); NeverNullType resolveArrayType(ArrayTypeRepr *repr, @@ -2769,10 +2768,6 @@ NeverNullType TypeResolver::resolveType(TypeRepr *repr, case TypeReprKind::Self: return cast(repr)->getType(); - case TypeReprKind::ResultDependsOn: - return resolveResultDependsOnTypeRepr(cast(repr), - options); - case TypeReprKind::LifetimeDependentReturn: return resolveLifetimeDependentReturnTypeRepr( cast(repr), options); @@ -3645,7 +3640,6 @@ TypeResolver::resolveASTFunctionTypeParams(TupleTypeRepr *inputRepr, bool isolated = false; bool compileTimeConst = false; - bool hasResultDependsOn = false; bool isSending = false; while (true) { if (auto *specifierRepr = dyn_cast(nestedRepr)) { @@ -3671,10 +3665,6 @@ TypeResolver::resolveASTFunctionTypeParams(TupleTypeRepr *inputRepr, compileTimeConst = true; nestedRepr = specifierRepr->getBase(); continue; - case TypeReprKind::ResultDependsOn: - hasResultDependsOn = true; - nestedRepr = specifierRepr->getBase(); - continue; default: break; } @@ -3777,8 +3767,7 @@ TypeResolver::resolveASTFunctionTypeParams(TupleTypeRepr *inputRepr, auto paramFlags = ParameterTypeFlags::fromParameterType( ty, variadic, autoclosure, /*isNonEphemeral*/ false, ownership, - isolated, noDerivative, compileTimeConst, hasResultDependsOn, - isSending); + isolated, noDerivative, compileTimeConst, isSending); elements.emplace_back(ty, argumentLabel, paramFlags, parameterName); } @@ -5047,31 +5036,6 @@ NeverNullType TypeResolver::resolveArrayType(ArrayTypeRepr *repr, return ArraySliceType::get(baseTy); } -NeverNullType -TypeResolver::resolveResultDependsOnTypeRepr(ResultDependsOnTypeRepr *repr, - TypeResolutionOptions options) { - // _resultDependsOn is only valid for (non-Subscript and non-EnumCaseDecl) - // function parameters. - if (!options.is(TypeResolverContext::FunctionInput) || - options.hasBase(TypeResolverContext::SubscriptDecl) || - options.hasBase(TypeResolverContext::EnumElementDecl)) { - - decltype(diag::attr_only_on_parameters) diagID; - if (options.hasBase(TypeResolverContext::SubscriptDecl) || - options.hasBase(TypeResolverContext::EnumElementDecl)) { - diagID = diag::attr_only_valid_on_func_or_init_params; - } else if (options.is(TypeResolverContext::VariadicFunctionInput)) { - diagID = diag::attr_not_on_variadic_parameters; - } else { - diagID = diag::attr_only_on_parameters; - } - - diagnoseInvalid(repr, repr->getSpecifierLoc(), diagID, "_resultDependsOn"); - return ErrorType::get(getASTContext()); - } - return resolveType(repr->getBase(), options); -} - NeverNullType TypeResolver::resolveLifetimeDependentReturnTypeRepr( LifetimeDependentReturnTypeRepr *repr, TypeResolutionOptions options) { if (options.is(TypeResolverContext::TupleElement)) { @@ -6090,7 +6054,6 @@ class ExistentialTypeSyntaxChecker : public ASTWalker { case TypeReprKind::Pack: case TypeReprKind::PackExpansion: case TypeReprKind::PackElement: - case TypeReprKind::ResultDependsOn: case TypeReprKind::LifetimeDependentReturn: return false; } diff --git a/lib/Serialization/Deserialization.cpp b/lib/Serialization/Deserialization.cpp index 894506d040a58..6305c740c35f0 100644 --- a/lib/Serialization/Deserialization.cpp +++ b/lib/Serialization/Deserialization.cpp @@ -7015,13 +7015,13 @@ detail::function_deserializer::deserialize(ModuleFile &MF, IdentifierID internalLabelID; TypeID typeID; bool isVariadic, isAutoClosure, isNonEphemeral, isIsolated, - isCompileTimeConst, hasResultDependsOn; + isCompileTimeConst; bool isNoDerivative, isSending; unsigned rawOwnership; decls_block::FunctionParamLayout::readRecord( scratch, labelID, internalLabelID, typeID, isVariadic, isAutoClosure, isNonEphemeral, rawOwnership, isIsolated, isNoDerivative, - isCompileTimeConst, hasResultDependsOn, isSending); + isCompileTimeConst, isSending); auto ownership = getActualParamDeclSpecifier( (serialization::ParamDeclSpecifier)rawOwnership); @@ -7036,8 +7036,7 @@ detail::function_deserializer::deserialize(ModuleFile &MF, ParameterTypeFlags(isVariadic, isAutoClosure, isNonEphemeral, *ownership, isIsolated, isNoDerivative, - isCompileTimeConst, - hasResultDependsOn, isSending), + isCompileTimeConst, isSending), MF.getIdentifier(internalLabelID)); } diff --git a/lib/Serialization/ModuleFormat.h b/lib/Serialization/ModuleFormat.h index eec82b46c9035..ae2c1795d4990 100644 --- a/lib/Serialization/ModuleFormat.h +++ b/lib/Serialization/ModuleFormat.h @@ -1268,7 +1268,6 @@ namespace decls_block { BCFixed<1>, // isolated BCFixed<1>, // noDerivative? BCFixed<1>, // compileTimeConst - BCFixed<1>, // _resultDependsOn BCFixed<1> // transferring >; diff --git a/lib/Serialization/Serialization.cpp b/lib/Serialization/Serialization.cpp index d253072509890..9e50bc9f30da2 100644 --- a/lib/Serialization/Serialization.cpp +++ b/lib/Serialization/Serialization.cpp @@ -5583,8 +5583,7 @@ class Serializer::TypeSerializer : public TypeVisitor { S.addTypeRef(param.getPlainType()), paramFlags.isVariadic(), paramFlags.isAutoClosure(), paramFlags.isNonEphemeral(), rawOwnership, paramFlags.isIsolated(), paramFlags.isNoDerivative(), - paramFlags.isCompileTimeConst(), paramFlags.hasResultDependsOn(), - paramFlags.isSending()); + paramFlags.isCompileTimeConst(), paramFlags.isSending()); } } diff --git a/test/Parse/result_depends_on.swift b/test/Parse/result_depends_on.swift deleted file mode 100644 index 0c9233572d2b1..0000000000000 --- a/test/Parse/result_depends_on.swift +++ /dev/null @@ -1,25 +0,0 @@ -// RUN: %target-typecheck-verify-swift -enable-builtin-module -enable-experimental-feature NonescapableTypes -// REQUIRES: asserts - -import Builtin - -class Klass {} - -class MethodModifiers { - _resultDependsOnSelf func getDependentResult() -> Builtin.NativeObject { - return Builtin.unsafeCastToNativeObject(self) - } -} - -func testTypeSpecifier(x : _resultDependsOn Klass) -> Builtin.NativeObject { - return Builtin.unsafeCastToNativeObject(x) -} - -func testMultipleTypeSpecifier(x : _resultDependsOn Klass, y : _resultDependsOn Klass) -> (Builtin.NativeObject, Builtin.NativeObject) { - return (Builtin.unsafeCastToNativeObject(x), Builtin.unsafeCastToNativeObject(x)) -} - -// rdar://118125715 (Combining parameter modifiers doesn't work in the new swift parser) -func testTypeSpecifierBorrowing(x : borrowing _resultDependsOn Klass) -> Builtin.NativeObject { - return Builtin.unsafeCastToNativeObject(copy x) -} diff --git a/test/Parse/result_depends_on_contextual_tests1.swift b/test/Parse/result_depends_on_contextual_tests1.swift deleted file mode 100644 index 2857f9bf0e368..0000000000000 --- a/test/Parse/result_depends_on_contextual_tests1.swift +++ /dev/null @@ -1,16 +0,0 @@ -// RUN: %target-typecheck-verify-swift -enable-builtin-module -enable-experimental-feature NonescapableTypes -// REQUIRES: asserts - -import Builtin - -class Klass {} - -var _resultDependsOn = 0 -var _resultDependsOnSelf = 100.9 - -class MethodModifiers { - _resultDependsOnSelf func _resultDependsOnSelf() -> Builtin.NativeObject { - return Builtin.unsafeCastToNativeObject(self) - } -} - diff --git a/test/Parse/result_depends_on_contextual_tests2.swift b/test/Parse/result_depends_on_contextual_tests2.swift deleted file mode 100644 index 1da4866d14e26..0000000000000 --- a/test/Parse/result_depends_on_contextual_tests2.swift +++ /dev/null @@ -1,38 +0,0 @@ -// RUN: %target-typecheck-verify-swift -enable-builtin-module -enable-experimental-feature NonescapableTypes -// REQUIRES: asserts - -import Builtin - -class Klass {} - -class borrowing {} - -class _resultDependsOn {} -class _resultDependsOnSelf {} - -class MethodModifiers { - func getNoOpReturn() -> _resultDependsOnSelf { - return _resultDependsOnSelf() - } -} - -func testNoopArgLabel(_resultDependsOn : _resultDependsOn Klass) -> Builtin.NativeObject { - return Builtin.unsafeCastToNativeObject(_resultDependsOn) -} - -func testNoopParamName(_resultDependsOn x: _resultDependsOn Klass) -> Builtin.NativeObject { - return Builtin.unsafeCastToNativeObject(x) -} - -func testNoopLocalName(x: _resultDependsOn Klass) -> Builtin.NativeObject { - let _resultDependsOn = Builtin.unsafeCastToNativeObject(x) - return _resultDependsOn -} - -/* -func testNoopParamNameTypeName(resultDependsOn x: resultDependsOn resultDependsOn) -> Builtin.NativeObject { - return Builtin.unsafeCastToNativeObject(x) -} -*/ - -// Also test function names, global variable names diff --git a/test/SIL/Parser/result_depends_on.sil b/test/SIL/Parser/result_depends_on.sil deleted file mode 100644 index 73dcf96c3010a..0000000000000 --- a/test/SIL/Parser/result_depends_on.sil +++ /dev/null @@ -1,34 +0,0 @@ -// RUN: %target-sil-opt %s -enable-experimental-feature NonescapableTypes | %FileCheck %s -// REQUIRES: asserts - -sil_stage raw - -import Builtin - -class Klass { } - -class MethodModifiers { - _resultDependsOnSelf func getDependentResult() -> Builtin.NativeObject -} - -func foo(_ x: _resultDependsOn Klass) -> Builtin.NativeObject - -// CHECK-LABEL: sil hidden [ossa] [_resultDependsOnSelf] @getDependentResult : -// CHECK-LABEL: } // end sil function 'getDependentResult' -sil hidden [ossa] [_resultDependsOnSelf] @getDependentResult : $@convention(method) (@guaranteed MethodModifiers) -> @owned Builtin.NativeObject { -bb0(%0 : @guaranteed $MethodModifiers): - %2 = copy_value %0 : $MethodModifiers - %3 = unchecked_ref_cast %2 : $MethodModifiers to $Builtin.NativeObject - return %3 : $Builtin.NativeObject -} - -// CHECK-LABEL: sil hidden [ossa] @foo : -// CHECK: bb0(%0 : @_resultDependsOn @guaranteed $Klass): -// CHECK-LABEL: } // end sil function 'foo' -sil hidden [ossa] @foo : $@convention(thin) (@guaranteed Klass) -> @owned Builtin.NativeObject { -bb0(%0 : @_resultDependsOn @guaranteed $Klass): - %2 = copy_value %0 : $Klass - %3 = unchecked_ref_cast %2 : $Klass to $Builtin.NativeObject - return %3 : $Builtin.NativeObject -} - diff --git a/test/SIL/result_depends_on.swift b/test/SIL/result_depends_on.swift deleted file mode 100644 index ec33d3d65b1aa..0000000000000 --- a/test/SIL/result_depends_on.swift +++ /dev/null @@ -1,21 +0,0 @@ -// RUN: %target-swift-frontend %s -emit-sil -enable-builtin-module -enable-experimental-feature NonescapableTypes -// REQUIRES: asserts - -import Builtin - -class Klass {} - -class MethodModifiers { -// CHECK-LABEL: sil hidden [ossa] [_resultDependsOnSelf] @$s17result_depends_on15MethodModifiersC18getDependentResultBoyF : - _resultDependsOnSelf func getDependentResult() -> Builtin.NativeObject { - return Builtin.unsafeCastToNativeObject(self) - } -} - -// CHECK-LABEL: sil hidden [ossa] @$s17result_depends_on3fooyBoAA5KlassCF : -// CHECK: bb0(%0 : @_resultDependsOn @guaranteed $Klass): -// CHECK: } // end sil function '$s17result_depends_on3fooyBoAA5KlassCF' -func foo(_ x : _resultDependsOn Klass) -> Builtin.NativeObject { - return Builtin.unsafeCastToNativeObject(x) -} - diff --git a/test/Sema/result_depends_on_errors.swift b/test/Sema/result_depends_on_errors.swift deleted file mode 100644 index 0dfadadca3fb0..0000000000000 --- a/test/Sema/result_depends_on_errors.swift +++ /dev/null @@ -1,22 +0,0 @@ -// RUN: %target-typecheck-verify-swift -enable-builtin-module -enable-experimental-feature NonescapableTypes -// REQUIRES: asserts - -import Builtin - -class Klass {} - -struct View { - var pointer: UnsafeRawPointer? -} - -class MethodModifiers { - _resultDependsOnSelf func testAttrOnMethod() { } // expected-error{{Incorrect use of _resultDependsOnSelf with no result}} -} - -_resultDependsOnSelf func testAttrOnFunc () -> View { return View(pointer:nil) } // expected-error{{only methods can be declared '_resultDependsOnSelf'}} - -// TODO: Seems like Sema doesn't have enough info to diagnose this -func testTypeSpecifierNoResult(x : _resultDependsOn Klass) { } // todo{{'_resultDependsOn' is only valid when there is a result}} - -// TODO: Sema doesn't know if a type is non-trivial, diagnose this in SILGen maybe ? -func testTypeSpecifierTrivial(x : _resultDependsOn Int) -> Int { 0 } // todo{{'_resultDependsOnSelf' is only valid on non-trivial types}} diff --git a/utils/swift-mode.el b/utils/swift-mode.el index df879ff3cf532..d835c24b4c92d 100644 --- a/utils/swift-mode.el +++ b/utils/swift-mode.el @@ -76,7 +76,7 @@ "convenience" "dynamic" "optional" "indirect" "override" "open" "final" "required" "lazy" "weak" - "_compilerInitialized" "_const" "_local" "_resultDependsOnSelf" + "_compilerInitialized" "_const" "_local" "nonisolated" "distributed") 'words) . font-lock-keyword-face) `("\\" . font-lock-keyword-face)