Skip to content

Commit 558dcb8

Browse files
committed
Fix all merge conflicts.
Note: this was done as a distinct commit in order to make it easier to see what's actually going on.
1 parent cfe04e9 commit 558dcb8

File tree

9 files changed

+13
-268
lines changed

9 files changed

+13
-268
lines changed

include/swift/AST/ASTContext.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,8 @@ namespace swift {
110110
class VarDecl;
111111
class UnifiedStatsReporter;
112112
class IndexSubset;
113-
<<<<<<< HEAD
114113
class VectorSpace;
115114
class DifferentiableAttr;
116-
=======
117-
>>>>>>> swift-DEVELOPMENT-SNAPSHOT-2019-10-13-a
118115

119116
enum class KnownProtocolKind : uint8_t;
120117

include/swift/AST/IndexSubset.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -201,26 +201,10 @@ class IndexSubset : public llvm::FoldingSetNode {
201201
id.AddInteger(index);
202202
}
203203

204-
<<<<<<< HEAD
205204
void print(llvm::raw_ostream &s = llvm::outs()) const;
206205
LLVM_ATTRIBUTE_DEPRECATED(void dump(llvm::raw_ostream &s = llvm::errs())
207206
const LLVM_ATTRIBUTE_USED,
208207
"only for use within the debugger");
209-
=======
210-
void print(llvm::raw_ostream &s = llvm::outs()) const {
211-
s << '{';
212-
interleave(range(capacity), [this, &s](unsigned i) { s << contains(i); },
213-
[&s] { s << ", "; });
214-
s << '}';
215-
}
216-
217-
void dump(llvm::raw_ostream &s = llvm::errs()) const {
218-
s << "(index_subset capacity=" << capacity << " indices=(";
219-
interleave(getIndices(), [&s](unsigned i) { s << i; },
220-
[&s] { s << ", "; });
221-
s << "))";
222-
}
223-
>>>>>>> swift-DEVELOPMENT-SNAPSHOT-2019-10-13-a
224208

225209
int findNext(int startIndex) const;
226210
int findFirst() const { return findNext(-1); }

include/swift/Parse/Parser.h

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1642,28 +1642,14 @@ class Parser {
16421642
ParsedSyntaxResult<ParsedClosureExprSyntax>
16431643
parseTrailingClosureSyntax(SourceRange calleeRange);
16441644

1645-
<<<<<<< HEAD
1646-
/// Parse an object literal.
1647-
///
1648-
/// \param LK The literal kind as determined by the first token.
1649-
ParserResult<Expr> parseExprObjectLiteral(ObjectLiteralExpr::LiteralKind LK,
1650-
bool isExprBasic);
1651-
ParserResult<Expr> parseExprQuoteLiteral();
1652-
ParserResult<Expr> parseExprUnquote();
1653-
ParserResult<Expr> parseExprCallSuffix(ParserResult<Expr> fn,
1654-
bool isExprBasic);
1655-
ParserResult<Expr> parseExprCollection();
1656-
ParserResult<Expr> parseExprCollectionElement(Optional<bool> &isDictionary);
1657-
ParserResult<Expr> parseExprPoundAssert();
1658-
ParserResult<Expr> parseExprArray(SourceLoc LSquareLoc);
1659-
ParserResult<Expr> parseExprDictionary(SourceLoc LSquareLoc);
1660-
=======
16611645
ParserResult<Expr> parseExprObjectLiteral(bool isExprBasic);
16621646
ParsedSyntaxResult<ParsedExprSyntax>
16631647
parseExprObjectLiteralSyntax(bool isExprBasic);
1648+
ParserResult<Expr> parseExprQuoteLiteral();
1649+
ParserResult<Expr> parseExprUnquote();
16641650
ParserResult<Expr> parseExprCallSuffix(ParserResult<Expr> fn,
16651651
bool isExprBasic);
1666-
ParserResult<Expr> parseExprCollection();
1652+
ParserResult<Expr> parseExprPoundAssert();
16671653
ParsedSyntaxResult<ParsedExprSyntax> parseExprCollectionSyntax();
16681654
ParsedSyntaxResult<ParsedExprSyntax>
16691655
parseExprArraySyntax(ParsedTokenSyntax &&LSquare, SourceLoc LSquareLoc,
@@ -1672,7 +1658,6 @@ class Parser {
16721658
parseExprDictionarySyntax(ParsedTokenSyntax &&LSquare, SourceLoc LSquareLoc,
16731659
ParsedSyntaxResult<ParsedExprSyntax> &&firstExpr);
16741660

1675-
>>>>>>> swift-DEVELOPMENT-SNAPSHOT-2019-10-13-a
16761661
ParserResult<Expr> parseExprPoundUnknown(SourceLoc LSquareLoc);
16771662
ParsedSyntaxResult<ParsedExprSyntax>
16781663
parseExprPoundUnknownSyntax(Optional<ParsedTokenSyntax> &&LSquare,

lib/AST/ASTContext.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,6 @@ FOR_KNOWN_FOUNDATION_TYPES(CACHE_FOUNDATION_DECL)
443443
llvm::FoldingSet<DeclName::CompoundDeclName> CompoundNames;
444444
llvm::DenseMap<UUID, OpenedArchetypeType *> OpenedExistentialArchetypes;
445445

446-
<<<<<<< HEAD
447446
// SWIFT_ENABLE_TENSORFLOW
448447
/// A cache of tangent spaces per type.
449448
llvm::DenseMap<CanType, Optional<VectorSpace>> VectorSpaces;
@@ -456,11 +455,6 @@ FOR_KNOWN_FOUNDATION_TYPES(CACHE_FOUNDATION_DECL)
456455
AutoDiffDerivativeFunctionIdentifiers;
457456
// SWIFT_ENABLE_TENSORFLOW END
458457

459-
=======
460-
/// For uniquifying `IndexSubset` allocations.
461-
llvm::FoldingSet<IndexSubset> IndexSubsets;
462-
463-
>>>>>>> swift-DEVELOPMENT-SNAPSHOT-2019-10-13-a
464458
/// A cache of information about whether particular nominal types
465459
/// are representable in a foreign language.
466460
llvm::DenseMap<NominalTypeDecl *, ForeignRepresentationInfo>

lib/AST/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,9 @@ add_swift_host_library(swiftAST STATIC
2929
ASTVerifier.cpp
3030
ASTWalker.cpp
3131
Attr.cpp
32-
<<<<<<< HEAD
3332
# SWIFT_ENABLE_TENSORFLOW
3433
AutoDiff.cpp
35-
=======
3634
IndexSubset.cpp
37-
>>>>>>> swift-DEVELOPMENT-SNAPSHOT-2019-10-13-a
3835
Availability.cpp
3936
AvailabilitySpec.cpp
4037
Builtins.cpp

lib/AST/IndexSubset.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ IndexSubset *IndexSubset::extendingCapacity(
7979
return IndexSubset::get(ctx, indices);
8080
}
8181

82-
<<<<<<< HEAD
8382
void IndexSubset::print(llvm::raw_ostream &s) const {
8483
s << '{';
8584
interleave(range(capacity), [this, &s](unsigned i) { s << contains(i); },
@@ -94,8 +93,6 @@ void IndexSubset::dump(llvm::raw_ostream &s) const {
9493
s << "))\n";
9594
}
9695

97-
=======
98-
>>>>>>> swift-DEVELOPMENT-SNAPSHOT-2019-10-13-a
9996
int IndexSubset::findNext(int startIndex) const {
10097
assert(startIndex < (int)capacity && "Start index cannot be past the end");
10198
unsigned bitWordIndex = 0, offset = 0;

lib/Sema/TypeCheckDecl.cpp

Lines changed: 9 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -4278,135 +4278,16 @@ void TypeChecker::validateDecl(ValueDecl *D) {
42784278
}
42794279

42804280
case DeclKind::Func:
4281-
<<<<<<< HEAD
4282-
case DeclKind::Accessor: {
4283-
auto *FD = cast<FuncDecl>(D);
4284-
4285-
DeclValidationRAII IBV(FD);
4286-
4287-
// Accessors should pick up various parts of their type signatures
4288-
// directly from the storage declaration instead of re-deriving them.
4289-
// FIXME: should this include the generic signature?
4290-
if (auto accessor = dyn_cast<AccessorDecl>(FD)) {
4291-
auto storage = accessor->getStorage();
4292-
4293-
// Note that it's important for correctness that we're filling in
4294-
// empty TypeLocs, because otherwise revertGenericFuncSignature might
4295-
// erase the types we set, causing them to be re-validated in a later
4296-
// pass. That later validation might be incorrect even if the TypeLocs
4297-
// are a clone of the type locs from which we derived the value type,
4298-
// because the rules for interpreting types in parameter contexts
4299-
// are sometimes different from the rules elsewhere; for example,
4300-
// function types default to non-escaping.
4301-
4302-
auto valueParams = accessor->getParameters();
4303-
4304-
// Determine the value type.
4305-
Type valueIfaceTy = storage->getValueInterfaceType();
4306-
if (auto SD = dyn_cast<SubscriptDecl>(storage)) {
4307-
// Copy the index types instead of re-validating them.
4308-
auto indices = SD->getIndices();
4309-
for (size_t i = 0, e = indices->size(); i != e; ++i) {
4310-
auto subscriptParam = indices->get(i);
4311-
if (!subscriptParam->hasInterfaceType())
4312-
continue;
4313-
4314-
Type paramIfaceTy = subscriptParam->getInterfaceType();
4315-
4316-
auto accessorParam = valueParams->get(valueParams->size() - e + i);
4317-
accessorParam->setInterfaceType(paramIfaceTy);
4318-
accessorParam->getTypeLoc().setType(paramIfaceTy);
4319-
}
4320-
}
4321-
4322-
// Propagate the value type into the correct position.
4323-
switch (accessor->getAccessorKind()) {
4324-
// For getters, set the result type to the value type.
4325-
case AccessorKind::Get:
4326-
accessor->getBodyResultTypeLoc().setType(valueIfaceTy);
4327-
break;
4328-
4329-
// For setters and observers, set the old/new value parameter's type
4330-
// to the value type.
4331-
case AccessorKind::DidSet:
4332-
case AccessorKind::WillSet:
4333-
case AccessorKind::Set: {
4334-
auto newValueParam = valueParams->get(0);
4335-
newValueParam->setInterfaceType(valueIfaceTy);
4336-
newValueParam->getTypeLoc().setType(valueIfaceTy);
4337-
accessor->getBodyResultTypeLoc().setType(TupleType::getEmpty(Context));
4338-
break;
4339-
}
4340-
4341-
// Addressor result types can get complicated because of the owner.
4342-
case AccessorKind::Address:
4343-
case AccessorKind::MutableAddress:
4344-
if (Type resultType =
4345-
buildAddressorResultType(*this, accessor, valueIfaceTy)) {
4346-
accessor->getBodyResultTypeLoc().setType(resultType);
4347-
}
4348-
break;
4349-
4350-
// These don't mention the value type directly.
4351-
// If we add yield types to the function type, we'll need to update this.
4352-
case AccessorKind::Read:
4353-
case AccessorKind::Modify:
4354-
accessor->getBodyResultTypeLoc().setType(TupleType::getEmpty(Context));
4355-
break;
4356-
}
4357-
}
4358-
4359-
// We want the function to be available for name lookup as soon
4360-
// as it has a valid interface type.
4361-
typeCheckParameterList(FD->getParameters(), FD,
4362-
TypeResolverContext::AbstractFunctionDecl);
4363-
validateResultType(FD, FD->getBodyResultTypeLoc());
4364-
// FIXME: Roll all of this interface type computation into a request.
4365-
FD->computeType();
4366-
4367-
// SWIFT_ENABLE_TENSORFLOW
4368-
// TODO(TF-789): Find proper way to type-check `@differentiable` attributes.
4369-
checkDeclDifferentiableAttributes(FD);
4370-
// SWIFT_ENABLE_TENSORFLOW END
4371-
4372-
// If the function is exported to C, it must be representable in (Obj-)C.
4373-
if (auto CDeclAttr = FD->getAttrs().getAttribute<swift::CDeclAttr>()) {
4374-
Optional<ForeignErrorConvention> errorConvention;
4375-
if (isRepresentableInObjC(FD, ObjCReason::ExplicitlyCDecl,
4376-
errorConvention)) {
4377-
if (FD->hasThrows()) {
4378-
FD->setForeignErrorConvention(*errorConvention);
4379-
diagnose(CDeclAttr->getLocation(), diag::cdecl_throws);
4380-
}
4381-
}
4382-
}
4383-
4384-
break;
4385-
}
4386-
4387-
case DeclKind::Constructor: {
4388-
auto *CD = cast<ConstructorDecl>(D);
4389-
4390-
DeclValidationRAII IBV(CD);
4391-
4392-
typeCheckParameterList(CD->getParameters(), CD,
4393-
TypeResolverContext::AbstractFunctionDecl);
4394-
CD->computeType();
4395-
// SWIFT_ENABLE_TENSORFLOW
4396-
// TODO(TF-789): Find proper way to type-check `@differentiable` attributes.
4397-
checkDeclDifferentiableAttributes(CD);
4398-
// SWIFT_ENABLE_TENSORFLOW END
4399-
break;
4400-
}
4401-
4402-
=======
44034281
case DeclKind::Accessor:
44044282
case DeclKind::Constructor:
4405-
>>>>>>> swift-DEVELOPMENT-SNAPSHOT-2019-10-13-a
44064283
case DeclKind::Destructor: {
44074284
auto *AFD = cast<AbstractFunctionDecl>(D);
44084285
DeclValidationRAII IBV(AFD);
44094286
AFD->computeType();
4287+
// SWIFT_ENABLE_TENSORFLOW
4288+
// TODO(TF-789): Find proper way to type-check `@differentiable` attributes.
4289+
checkDeclDifferentiableAttributes(CD);
4290+
// SWIFT_ENABLE_TENSORFLOW END
44104291
break;
44114292
}
44124293

@@ -4416,13 +4297,6 @@ void TypeChecker::validateDecl(ValueDecl *D) {
44164297

44174298
auto elementTy = SD->getElementInterfaceType();
44184299

4419-
<<<<<<< HEAD
4420-
// SWIFT_ENABLE_TENSORFLOW
4421-
// TODO(TF-789): Find proper way to type-check `@differentiable` attributes.
4422-
checkDeclDifferentiableAttributes(SD);
4423-
// SWIFT_ENABLE_TENSORFLOW END
4424-
4425-
=======
44264300
SmallVector<AnyFunctionType::Param, 2> argTy;
44274301
SD->getIndices()->getParams(argTy);
44284302

@@ -4434,7 +4308,11 @@ void TypeChecker::validateDecl(ValueDecl *D) {
44344308

44354309
// Record the interface type.
44364310
SD->setInterfaceType(funcTy);
4437-
>>>>>>> swift-DEVELOPMENT-SNAPSHOT-2019-10-13-a
4311+
// SWIFT_ENABLE_TENSORFLOW
4312+
// TODO(TF-789): Find proper way to type-check `@differentiable` attributes.
4313+
checkDeclDifferentiableAttributes(SD);
4314+
// SWIFT_ENABLE_TENSORFLOW END
4315+
44384316
break;
44394317
}
44404318

unittests/AST/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
add_swift_unittest(SwiftASTTests
22
ArithmeticEvaluator.cpp
3-
<<<<<<< HEAD
4-
# SWIFT_ENABLE_TENSORFLOW
5-
=======
6-
>>>>>>> swift-DEVELOPMENT-SNAPSHOT-2019-10-13-a
73
IndexSubsetTests.cpp
84
DiagnosticConsumerTests.cpp
95
SourceLocTests.cpp

0 commit comments

Comments
 (0)