Skip to content

Commit af1d601

Browse files
authored
Merge pull request #74132 from meg-gupta/deleteresultdependson
Remove resultDependsOn/resultDependsOnSelf
2 parents 4f8181d + 470fa2f commit af1d601

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+49
-442
lines changed

SwiftCompilerSources/Sources/SIL/Argument.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,6 @@ final public class FunctionArgument : Argument {
6060
return index < parentFunction.numIndirectResultArguments
6161
}
6262

63-
public var hasResultDependsOn : Bool {
64-
return bridged.hasResultDependsOn()
65-
}
66-
6763
/// If the function's result depends on this argument, return the
6864
/// kind of dependence.
6965
public var resultDependence: LifetimeDependenceConvention? {

SwiftCompilerSources/Sources/SIL/Function.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -290,10 +290,6 @@ extension Function {
290290
public var hasResultDependence: Bool {
291291
convention.resultDependencies != nil
292292
}
293-
294-
public var hasResultDependsOnSelf: Bool {
295-
return bridged.hasResultDependsOnSelf()
296-
}
297293
}
298294

299295
public struct ArgumentTypeArray : RandomAccessCollection, FormattedLikeArray {

include/swift/AST/ASTBridging.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1550,7 +1550,6 @@ enum ENUM_EXTENSIBILITY_ATTR(open) BridgedAttributedTypeSpecifier : size_t {
15501550
BridgedAttributedTypeSpecifierLegacyOwned,
15511551
BridgedAttributedTypeSpecifierConst,
15521552
BridgedAttributedTypeSpecifierIsolated,
1553-
BridgedAttributedTypeSpecifierResultDependsOn,
15541553
BridgedAttributedTypeSpecifierTransferring,
15551554
BridgedAttributedTypeSpecifierSending,
15561555
};

include/swift/AST/Decl.h

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6616,8 +6616,6 @@ class ParamDecl : public VarDecl {
66166616

66176617
/// Whether or not this parameter is '_const'.
66186618
IsCompileTimeConst = 1 << 1,
6619-
6620-
HasResultDependsOn = 1 << 2,
66216619
};
66226620

66236621
llvm::PointerIntPair<Identifier, 3, OptionSet<ArgumentNameFlags>>
@@ -6656,9 +6654,6 @@ class ParamDecl : public VarDecl {
66566654
/// Whether or not this parameter is 'isolated'.
66576655
IsIsolated = 1 << 2,
66586656

6659-
/// Whether or not this paramater is '_resultDependsOn'
6660-
IsResultDependsOn = 1 << 3,
6661-
66626657
/// Whether or not this parameter is 'sending'.
66636658
IsSending = 1 << 4,
66646659
};
@@ -6961,18 +6956,6 @@ class ParamDecl : public VarDecl {
69616956
ArgumentNameAndFlags.setInt(flags);
69626957
}
69636958

6964-
bool hasResultDependsOn() const {
6965-
return ArgumentNameAndFlags.getInt().contains(
6966-
ArgumentNameFlags::HasResultDependsOn);
6967-
}
6968-
6969-
void setResultDependsOn(bool value = true) {
6970-
auto flags = ArgumentNameAndFlags.getInt();
6971-
flags = value ? flags | ArgumentNameFlags::HasResultDependsOn
6972-
: flags - ArgumentNameFlags::HasResultDependsOn;
6973-
ArgumentNameAndFlags.setInt(flags);
6974-
}
6975-
69766959
/// Does this parameter reject temporary pointer conversions?
69776960
bool isNonEphemeral() const;
69786961

include/swift/AST/DeclAttr.def

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -468,9 +468,6 @@ DECL_ATTR(storageRestrictions, StorageRestrictions,
468468
CONTEXTUAL_SIMPLE_DECL_ATTR(actor, Actor,
469469
DeclModifier | OnClass | ConcurrencyOnly | ABIBreakingToAdd | ABIBreakingToRemove | APIBreakingToAdd | APIBreakingToRemove,
470470
102)
471-
CONTEXTUAL_SIMPLE_DECL_ATTR(_resultDependsOnSelf, ResultDependsOnSelf,
472-
OnFunc | DeclModifier | UserInaccessible | ABIBreakingToAdd | ABIStableToRemove | APIBreakingToAdd | APIStableToRemove,
473-
150)
474471
SIMPLE_DECL_ATTR(_staticExclusiveOnly, StaticExclusiveOnly,
475472
OnStruct | UserInaccessible | ABIStableToAdd | ABIStableToRemove | APIBreakingToAdd | APIStableToRemove,
476473
151)

include/swift/AST/DiagnosticsSema.def

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7917,13 +7917,6 @@ ERROR(referencebindings_binding_must_have_initial_value,none,
79177917
ERROR(referencebindings_binding_must_be_to_lvalue,none,
79187918
"%0 bindings must be bound to an lvalue", (StringRef))
79197919

7920-
//------------------------------------------------------------------------------
7921-
// MARK: resultDependsOn Errors
7922-
//------------------------------------------------------------------------------
7923-
7924-
ERROR(result_depends_on_no_result,none,
7925-
"Incorrect use of %0 with no result", (StringRef))
7926-
79277920
//------------------------------------------------------------------------------
79287921
// MARK: Pack Iteration Diagnostics
79297922
//------------------------------------------------------------------------------

include/swift/AST/TypeRepr.h

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,7 +1118,6 @@ class SpecifierTypeRepr : public TypeRepr {
11181118
return T->getKind() == TypeReprKind::Ownership ||
11191119
T->getKind() == TypeReprKind::Isolated ||
11201120
T->getKind() == TypeReprKind::CompileTimeConst ||
1121-
T->getKind() == TypeReprKind::ResultDependsOn ||
11221121
T->getKind() == TypeReprKind::LifetimeDependentReturn ||
11231122
T->getKind() == TypeReprKind::Transferring ||
11241123
T->getKind() == TypeReprKind::Sending;
@@ -1192,21 +1191,6 @@ class CompileTimeConstTypeRepr : public SpecifierTypeRepr {
11921191
static bool classof(const CompileTimeConstTypeRepr *T) { return true; }
11931192
};
11941193

1195-
/// A lifetime dependent type.
1196-
/// \code
1197-
/// x : _resultDependsOn Int
1198-
/// \endcode
1199-
class ResultDependsOnTypeRepr : public SpecifierTypeRepr {
1200-
public:
1201-
ResultDependsOnTypeRepr(TypeRepr *Base, SourceLoc InOutLoc)
1202-
: SpecifierTypeRepr(TypeReprKind::ResultDependsOn, Base, InOutLoc) {}
1203-
1204-
static bool classof(const TypeRepr *T) {
1205-
return T->getKind() == TypeReprKind::ResultDependsOn;
1206-
}
1207-
static bool classof(const ResultDependsOnTypeRepr *T) { return true; }
1208-
};
1209-
12101194
/// A transferring type.
12111195
/// \code
12121196
/// x : transferring Int
@@ -1641,7 +1625,6 @@ inline bool TypeRepr::isSimple() const {
16411625
case TypeReprKind::Sending:
16421626
case TypeReprKind::Placeholder:
16431627
case TypeReprKind::CompileTimeConst:
1644-
case TypeReprKind::ResultDependsOn:
16451628
case TypeReprKind::LifetimeDependentReturn:
16461629
return true;
16471630
}

include/swift/AST/TypeReprNodes.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ ABSTRACT_TYPEREPR(Specifier, TypeRepr)
7070
SPECIFIER_TYPEREPR(Ownership, SpecifierTypeRepr)
7171
SPECIFIER_TYPEREPR(Isolated, SpecifierTypeRepr)
7272
SPECIFIER_TYPEREPR(CompileTimeConst, SpecifierTypeRepr)
73-
SPECIFIER_TYPEREPR(ResultDependsOn, SpecifierTypeRepr)
7473
SPECIFIER_TYPEREPR(Transferring, SpecifierTypeRepr)
7574
SPECIFIER_TYPEREPR(Sending, SpecifierTypeRepr)
7675
TYPEREPR(Fixed, TypeRepr)

include/swift/AST/Types.h

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2226,9 +2226,8 @@ class ParameterTypeFlags {
22262226
NoDerivative = 1 << 6,
22272227
Isolated = 1 << 7,
22282228
CompileTimeConst = 1 << 8,
2229-
ResultDependsOn = 1 << 9,
2230-
Sending = 1 << 10,
2231-
NumBits = 11
2229+
Sending = 1 << 9,
2230+
NumBits = 10
22322231
};
22332232
OptionSet<ParameterFlags> value;
22342233
static_assert(NumBits <= 8*sizeof(OptionSet<ParameterFlags>), "overflowed");
@@ -2243,22 +2242,20 @@ class ParameterTypeFlags {
22432242

22442243
ParameterTypeFlags(bool variadic, bool autoclosure, bool nonEphemeral,
22452244
ParamSpecifier specifier, bool isolated, bool noDerivative,
2246-
bool compileTimeConst, bool hasResultDependsOn,
2247-
bool isSending)
2245+
bool compileTimeConst, bool isSending)
22482246
: value((variadic ? Variadic : 0) | (autoclosure ? AutoClosure : 0) |
22492247
(nonEphemeral ? NonEphemeral : 0) |
22502248
uint8_t(specifier) << SpecifierShift | (isolated ? Isolated : 0) |
22512249
(noDerivative ? NoDerivative : 0) |
22522250
(compileTimeConst ? CompileTimeConst : 0) |
2253-
(hasResultDependsOn ? ResultDependsOn : 0) |
22542251
(isSending ? Sending : 0)) {}
22552252

22562253
/// Create one from what's present in the parameter type
22572254
inline static ParameterTypeFlags
22582255
fromParameterType(Type paramTy, bool isVariadic, bool isAutoClosure,
22592256
bool isNonEphemeral, ParamSpecifier ownership,
22602257
bool isolated, bool isNoDerivative, bool compileTimeConst,
2261-
bool hasResultDependsOn, bool isSending);
2258+
bool isSending);
22622259

22632260
bool isNone() const { return !value; }
22642261
bool isVariadic() const { return value.contains(Variadic); }
@@ -2270,7 +2267,6 @@ class ParameterTypeFlags {
22702267
bool isIsolated() const { return value.contains(Isolated); }
22712268
bool isCompileTimeConst() const { return value.contains(CompileTimeConst); }
22722269
bool isNoDerivative() const { return value.contains(NoDerivative); }
2273-
bool hasResultDependsOn() const { return value.contains(ResultDependsOn); }
22742270
bool isSending() const { return value.contains(Sending); }
22752271

22762272
/// Get the spelling of the parameter specifier used on the parameter.
@@ -2433,7 +2429,6 @@ class YieldTypeFlags {
24332429
/*nonEphemeral*/ false, getOwnershipSpecifier(),
24342430
/*isolated*/ false, /*noDerivative*/ false,
24352431
/*compileTimeConst*/ false,
2436-
/*hasResultDependsOn*/ false,
24372432
/*is transferring*/ false);
24382433
}
24392434

@@ -7771,7 +7766,7 @@ inline TupleTypeElt TupleTypeElt::getWithType(Type T) const {
77717766
inline ParameterTypeFlags ParameterTypeFlags::fromParameterType(
77727767
Type paramTy, bool isVariadic, bool isAutoClosure, bool isNonEphemeral,
77737768
ParamSpecifier ownership, bool isolated, bool isNoDerivative,
7774-
bool compileTimeConst, bool hasResultDependsOn, bool isSending) {
7769+
bool compileTimeConst, bool isSending) {
77757770
// FIXME(Remove InOut): The last caller that needs this is argument
77767771
// decomposition. Start by enabling the assertion there and fixing up those
77777772
// callers, then remove this, then remove
@@ -7781,9 +7776,8 @@ inline ParameterTypeFlags ParameterTypeFlags::fromParameterType(
77817776
ownership == ParamSpecifier::InOut);
77827777
ownership = ParamSpecifier::InOut;
77837778
}
7784-
return {isVariadic, isAutoClosure, isNonEphemeral,
7785-
ownership, isolated, isNoDerivative,
7786-
compileTimeConst, hasResultDependsOn, isSending};
7779+
return {isVariadic, isAutoClosure, isNonEphemeral, ownership,
7780+
isolated, isNoDerivative, compileTimeConst, isSending};
77877781
}
77887782

77897783
inline const Type *BoundGenericType::getTrailingObjectsPointer() const {

include/swift/Parse/Parser.h

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1200,18 +1200,14 @@ class Parser {
12001200
Tok.isContextualKeyword("isolated") ||
12011201
Tok.isContextualKeyword("_const"))
12021202
return true;
1203-
if (Context.LangOpts.hasFeature(Feature::NonescapableTypes) &&
1204-
Tok.isContextualKeyword("_resultDependsOn"))
1205-
return true;
12061203
if (Context.LangOpts.hasFeature(Feature::TransferringArgsAndResults) &&
12071204
Tok.isContextualKeyword("transferring"))
12081205
return true;
12091206
if (Context.LangOpts.hasFeature(Feature::SendingArgsAndResults) &&
12101207
Tok.isContextualKeyword("sending"))
12111208
return true;
12121209
if (Context.LangOpts.hasFeature(Feature::NonescapableTypes) &&
1213-
(Tok.isContextualKeyword("_resultDependsOn") ||
1214-
isLifetimeDependenceToken()))
1210+
isLifetimeDependenceToken())
12151211
return true;
12161212
return false;
12171213
}
@@ -1257,7 +1253,6 @@ class Parser {
12571253
SourceLoc SpecifierLoc;
12581254
SourceLoc IsolatedLoc;
12591255
SourceLoc ConstLoc;
1260-
SourceLoc ResultDependsOnLoc;
12611256
SourceLoc TransferringLoc;
12621257
SourceLoc SendingLoc;
12631258
SmallVector<TypeOrCustomAttr> Attributes;
@@ -1571,9 +1566,6 @@ class Parser {
15711566
/// The location of the '_const' keyword, if present.
15721567
SourceLoc CompileConstLoc;
15731568

1574-
/// The location of the '_resultDependsOn' keyword, if present.
1575-
SourceLoc ResultDependsOnLoc;
1576-
15771569
/// The location of the 'transferring' keyword if present.
15781570
SourceLoc TransferringLoc;
15791571

0 commit comments

Comments
 (0)