Skip to content

Commit 89577c5

Browse files
committed
---
yaml --- r: 349149 b: refs/heads/master-next c: 4a95258 h: refs/heads/master i: 349147: 1589bb9
1 parent b59a501 commit 89577c5

19 files changed

+205
-294
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
refs/heads/master: 3574c513bbc5578dd9346b4ea9ab5995c5927bb5
3-
refs/heads/master-next: 9849fe5cc586ac1e8efa6ee096a12c8b26e8a3ef
3+
refs/heads/master-next: 4a95258316c61f2e12cbed25d91c30e1aa287dc1
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea
66
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-b: 66d897bfcf64a82cb9a87f5e663d889189d06d07

branches/master-next/include/swift/AST/ASTTypeIDZone.def

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,12 @@ SWIFT_TYPEID_NAMED(Decl *, Decl)
2828
SWIFT_TYPEID_NAMED(GenericParamList *, GenericParamList)
2929
SWIFT_TYPEID_NAMED(GenericSignature *, GenericSignature)
3030
SWIFT_TYPEID_NAMED(GenericTypeParamType *, GenericTypeParamType)
31-
SWIFT_TYPEID_NAMED(InfixOperatorDecl *, InfixOperatorDecl)
3231
SWIFT_TYPEID_NAMED(IterableDeclContext *, IterableDeclContext)
3332
SWIFT_TYPEID_NAMED(ModuleDecl *, ModuleDecl)
3433
SWIFT_TYPEID_NAMED(NominalTypeDecl *, NominalTypeDecl)
3534
SWIFT_TYPEID_NAMED(OperatorDecl *, OperatorDecl)
3635
SWIFT_TYPEID_NAMED(Optional<PropertyWrapperMutability>,
3736
PropertyWrapperMutability)
38-
SWIFT_TYPEID_NAMED(PrecedenceGroupDecl *, PrecedenceGroupDecl)
3937
SWIFT_TYPEID_NAMED(ProtocolDecl *, ProtocolDecl)
4038
SWIFT_TYPEID_NAMED(TypeAliasDecl *, TypeAliasDecl)
4139
SWIFT_TYPEID_NAMED(ValueDecl *, ValueDecl)

branches/master-next/include/swift/AST/ASTTypeIDs.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,10 @@ class Decl;
2626
class GenericParamList;
2727
class GenericSignature;
2828
class GenericTypeParamType;
29-
class InfixOperatorDecl;
3029
class IterableDeclContext;
3130
class ModuleDecl;
3231
class NominalTypeDecl;
3332
class OperatorDecl;
34-
class PrecedenceGroupDecl;
3533
struct PropertyWrapperBackingPropertyInfo;
3634
struct PropertyWrapperTypeInfo;
3735
enum class CtorInitializerKind;

branches/master-next/include/swift/AST/Decl.h

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6909,6 +6909,7 @@ class OperatorDecl : public Decl {
69096909
/// \endcode
69106910
class InfixOperatorDecl : public OperatorDecl {
69116911
SourceLoc ColonLoc;
6912+
PrecedenceGroupDecl *PrecedenceGroup = nullptr;
69126913

69136914
public:
69146915
InfixOperatorDecl(DeclContext *DC, SourceLoc operatorLoc, Identifier name,
@@ -6919,6 +6920,14 @@ class InfixOperatorDecl : public OperatorDecl {
69196920
identifiers, identifierLocs),
69206921
ColonLoc(colonLoc) {}
69216922

6923+
InfixOperatorDecl(DeclContext *DC, SourceLoc operatorLoc, Identifier name,
6924+
SourceLoc nameLoc, SourceLoc colonLoc,
6925+
PrecedenceGroupDecl *precedenceGroup,
6926+
ArrayRef<NominalTypeDecl *> designatedNominalTypes)
6927+
: OperatorDecl(DeclKind::InfixOperator, DC, operatorLoc, name, nameLoc,
6928+
designatedNominalTypes),
6929+
ColonLoc(colonLoc), PrecedenceGroup(precedenceGroup) {}
6930+
69226931
SourceLoc getEndLoc() const {
69236932
auto identifierLocs = getIdentifierLocs();
69246933
if (identifierLocs.empty())
@@ -6933,7 +6942,10 @@ class InfixOperatorDecl : public OperatorDecl {
69336942

69346943
SourceLoc getColonLoc() const { return ColonLoc; }
69356944

6936-
PrecedenceGroupDecl *getPrecedenceGroup() const;
6945+
PrecedenceGroupDecl *getPrecedenceGroup() const { return PrecedenceGroup; }
6946+
void setPrecedenceGroup(PrecedenceGroupDecl *PGD) {
6947+
PrecedenceGroup = PGD;
6948+
}
69376949

69386950
/// True if this decl's attributes conflict with those declared by another
69396951
/// operator.

branches/master-next/include/swift/AST/NameLookupRequests.h

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#include "swift/AST/SimpleRequest.h"
2020
#include "swift/AST/ASTTypeIDs.h"
2121
#include "swift/Basic/Statistic.h"
22-
#include "llvm/ADT/Hashing.h"
2322
#include "llvm/ADT/TinyPtrVector.h"
2423

2524
namespace swift {
@@ -274,56 +273,6 @@ class GenericParamListRequest :
274273
void cacheResult(GenericParamList *value) const;
275274
};
276275

277-
struct PrecedenceGroupDescriptor {
278-
DeclContext *dc;
279-
Identifier ident;
280-
SourceLoc nameLoc;
281-
282-
SourceLoc getLoc() const;
283-
284-
friend llvm::hash_code hash_value(const PrecedenceGroupDescriptor &owner) {
285-
return hash_combine(llvm::hash_value(owner.dc),
286-
llvm::hash_value(owner.ident.getAsOpaquePointer()),
287-
llvm::hash_value(owner.nameLoc.getOpaquePointerValue()));
288-
}
289-
290-
friend bool operator==(const PrecedenceGroupDescriptor &lhs,
291-
const PrecedenceGroupDescriptor &rhs) {
292-
return lhs.dc == rhs.dc &&
293-
lhs.ident == rhs.ident &&
294-
lhs.nameLoc == rhs.nameLoc;
295-
}
296-
297-
friend bool operator!=(const PrecedenceGroupDescriptor &lhs,
298-
const PrecedenceGroupDescriptor &rhs) {
299-
return !(lhs == rhs);
300-
}
301-
};
302-
303-
void simple_display(llvm::raw_ostream &out, const PrecedenceGroupDescriptor &d);
304-
305-
class LookupPrecedenceGroupRequest
306-
: public SimpleRequest<LookupPrecedenceGroupRequest,
307-
PrecedenceGroupDecl *(PrecedenceGroupDescriptor),
308-
CacheKind::Cached> {
309-
public:
310-
using SimpleRequest::SimpleRequest;
311-
312-
private:
313-
friend SimpleRequest;
314-
315-
// Evaluation.
316-
llvm::Expected<PrecedenceGroupDecl *>
317-
evaluate(Evaluator &evaluator, PrecedenceGroupDescriptor descriptor) const;
318-
319-
public:
320-
// Source location
321-
SourceLoc getNearestLoc() const;
322-
323-
// Separate caching.
324-
bool isCached() const { return true; }
325-
};
326-
327276
#define SWIFT_TYPEID_ZONE NameLookup
328277
#define SWIFT_TYPEID_HEADER "swift/AST/NameLookupTypeIDZone.def"
329278
#include "swift/Basic/DefineTypeIDZone.h"

branches/master-next/include/swift/AST/NameLookupTypeIDZone.def

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ SWIFT_REQUEST(NameLookup, InheritedDeclsReferencedRequest,
3030
DirectlyReferencedTypeDecls(
3131
llvm::PointerUnion<TypeDecl *, ExtensionDecl *>, unsigned),
3232
Uncached, HasNearestLocation)
33-
SWIFT_REQUEST(NameLookup, LookupPrecedenceGroupRequest,
34-
PrecedenceGroupDecl *(DeclContext *, Identifier, SourceLoc),
35-
Cached, NoLocationInfo)
3633
SWIFT_REQUEST(NameLookup, SelfBoundsFromWhereClauseRequest,
3734
SelfBounds(llvm::PointerUnion<TypeDecl *, ExtensionDecl *>),
3835
Uncached, NoLocationInfo)

branches/master-next/include/swift/AST/TypeCheckRequests.h

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ class AbstractStorageDecl;
3333
class AccessorDecl;
3434
enum class AccessorKind;
3535
class GenericParamList;
36-
class PrecedenceGroupDecl;
3736
struct PropertyWrapperBackingPropertyInfo;
3837
struct PropertyWrapperMutability;
3938
class RequirementRepr;
@@ -1210,25 +1209,6 @@ class UnderlyingTypeRequest :
12101209
void cacheResult(Type value) const;
12111210
};
12121211

1213-
class OperatorPrecedenceGroupRequest
1214-
: public SimpleRequest<OperatorPrecedenceGroupRequest,
1215-
PrecedenceGroupDecl *(InfixOperatorDecl *),
1216-
CacheKind::Cached> {
1217-
public:
1218-
using SimpleRequest::SimpleRequest;
1219-
1220-
private:
1221-
friend SimpleRequest;
1222-
1223-
// Evaluation.
1224-
llvm::Expected<PrecedenceGroupDecl *>
1225-
evaluate(Evaluator &evaluator, InfixOperatorDecl *PGD) const;
1226-
1227-
public:
1228-
// Separate caching.
1229-
bool isCached() const { return true; }
1230-
};
1231-
12321212
// Allow AnyValue to compare two Type values, even though Type doesn't
12331213
// support ==.
12341214
template<>

branches/master-next/include/swift/AST/TypeCheckerTypeIDZone.def

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,6 @@ SWIFT_REQUEST(TypeChecker, MangleLocalTypeDeclRequest,
8585
SWIFT_REQUEST(TypeChecker, OpaqueReadOwnershipRequest,
8686
OpaqueReadOwnership(AbstractStorageDecl *), SeparatelyCached,
8787
NoLocationInfo)
88-
SWIFT_REQUEST(TypeChecker, OperatorPrecedenceGroupRequest,
89-
PrecedenceGroupDecl *(PrecedenceGroupDecl *),
90-
Cached, NoLocationInfo)
9188
SWIFT_REQUEST(TypeChecker, OverriddenDeclsRequest,
9289
llvm::TinyPtrVector<ValueDecl *>(ValueDecl *), SeparatelyCached,
9390
NoLocationInfo)

branches/master-next/lib/AST/Decl.cpp

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7471,28 +7471,6 @@ PrecedenceGroupDecl::PrecedenceGroupDecl(DeclContext *dc,
74717471
lowerThan.size() * sizeof(Relation));
74727472
}
74737473

7474-
llvm::Expected<PrecedenceGroupDecl *> LookupPrecedenceGroupRequest::evaluate(
7475-
Evaluator &eval, PrecedenceGroupDescriptor descriptor) const {
7476-
auto *dc = descriptor.dc;
7477-
PrecedenceGroupDecl *group = nullptr;
7478-
if (auto sf = dc->getParentSourceFile()) {
7479-
bool cascading = dc->isCascadingContextForLookup(false);
7480-
group = sf->lookupPrecedenceGroup(descriptor.ident, cascading,
7481-
descriptor.nameLoc);
7482-
} else {
7483-
group = dc->getParentModule()->lookupPrecedenceGroup(descriptor.ident,
7484-
descriptor.nameLoc);
7485-
}
7486-
return group;
7487-
}
7488-
7489-
PrecedenceGroupDecl *InfixOperatorDecl::getPrecedenceGroup() const {
7490-
return evaluateOrDefault(
7491-
getASTContext().evaluator,
7492-
OperatorPrecedenceGroupRequest{const_cast<InfixOperatorDecl *>(this)},
7493-
nullptr);
7494-
}
7495-
74967474
bool FuncDecl::isDeferBody() const {
74977475
return getName() == getASTContext().getIdentifier("$defer");
74987476
}

branches/master-next/lib/AST/NameLookupRequests.cpp

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -127,25 +127,6 @@ void GenericParamListRequest::cacheResult(GenericParamList *params) const {
127127
}
128128

129129

130-
//----------------------------------------------------------------------------//
131-
// LookupPrecedenceGroupRequest computation.
132-
//----------------------------------------------------------------------------//
133-
134-
SourceLoc LookupPrecedenceGroupRequest::getNearestLoc() const {
135-
auto &desc = std::get<0>(getStorage());
136-
return desc.getLoc();
137-
}
138-
139-
SourceLoc PrecedenceGroupDescriptor::getLoc() const {
140-
return nameLoc;
141-
}
142-
143-
void swift::simple_display(llvm::raw_ostream &out,
144-
const PrecedenceGroupDescriptor &desc) {
145-
out << "precedence group " << desc.ident << " at ";
146-
desc.nameLoc.print(out, desc.dc->getASTContext().SourceMgr);
147-
}
148-
149130
// Define request evaluation functions for each of the name lookup requests.
150131
static AbstractRequestFunction *nameLookupRequestFunctions[] = {
151132
#define SWIFT_REQUEST(Zone, Name, Sig, Caching, LocOptions) \

branches/master-next/lib/AST/TypeCheckRequests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,7 @@ void GenericSignatureRequest::cacheResult(GenericSignature *value) const {
827827
}
828828

829829
//----------------------------------------------------------------------------//
830-
// InferredGenericSignatureRequest computation.
830+
// GenericSignatureRequest computation.
831831
//----------------------------------------------------------------------------//
832832

833833
void InferredGenericSignatureRequest::noteCycleStep(DiagnosticEngine &d) const {

branches/master-next/lib/Sema/CSApply.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7342,7 +7342,7 @@ bool swift::exprNeedsParensInsideFollowingOperator(
73427342
TypeChecker &TC, DeclContext *DC, Expr *expr,
73437343
PrecedenceGroupDecl *followingPG) {
73447344
if (expr->isInfixOperator()) {
7345-
auto exprPG = TypeChecker::lookupPrecedenceGroupForInfixOperator(DC, expr);
7345+
auto exprPG = TC.lookupPrecedenceGroupForInfixOperator(DC, expr);
73467346
if (!exprPG) return true;
73477347

73487348
return TC.Context.associateInfixOperators(exprPG, followingPG)
@@ -7376,8 +7376,7 @@ bool swift::exprNeedsParensOutsideFollowingOperator(
73767376
return false;
73777377

73787378
if (parent->isInfixOperator()) {
7379-
auto parentPG = TypeChecker::lookupPrecedenceGroupForInfixOperator(DC,
7380-
parent);
7379+
auto parentPG = TC.lookupPrecedenceGroupForInfixOperator(DC, parent);
73817380
if (!parentPG) return true;
73827381

73837382
// If the index is 0, this is on the LHS of the parent.
@@ -7396,19 +7395,20 @@ bool swift::exprNeedsParensOutsideFollowingOperator(
73967395
bool swift::exprNeedsParensBeforeAddingNilCoalescing(TypeChecker &TC,
73977396
DeclContext *DC,
73987397
Expr *expr) {
7399-
auto asPG = TypeChecker::lookupPrecedenceGroup(
7400-
DC, DC->getASTContext().Id_NilCoalescingPrecedence, SourceLoc());
7401-
if (!asPG)
7402-
return true;
7398+
auto asPG =
7399+
TC.lookupPrecedenceGroup(DC, DC->getASTContext().Id_NilCoalescingPrecedence,
7400+
SourceLoc());
7401+
if (!asPG) return true;
74037402
return exprNeedsParensInsideFollowingOperator(TC, DC, expr, asPG);
74047403
}
74057404

74067405
bool swift::exprNeedsParensAfterAddingNilCoalescing(TypeChecker &TC,
74077406
DeclContext *DC,
74087407
Expr *expr,
74097408
Expr *rootExpr) {
7410-
auto asPG = TypeChecker::lookupPrecedenceGroup(
7411-
DC, DC->getASTContext().Id_NilCoalescingPrecedence, SourceLoc());
7409+
auto asPG =
7410+
TC.lookupPrecedenceGroup(DC, DC->getASTContext().Id_NilCoalescingPrecedence,
7411+
SourceLoc());
74127412
if (!asPG) return true;
74137413
return exprNeedsParensOutsideFollowingOperator(TC, DC, expr, rootExpr, asPG);
74147414
}

branches/master-next/lib/Sema/CSDiagnostics.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,7 @@ class MissingExplicitConversionFailure final : public ContextualFailure {
794794
auto *DC = getDC();
795795
auto &TC = getTypeChecker();
796796

797-
auto asPG = TypeChecker::lookupPrecedenceGroup(
797+
auto asPG = TC.lookupPrecedenceGroup(
798798
DC, DC->getASTContext().Id_CastingPrecedence, SourceLoc());
799799
if (!asPG)
800800
return true;
@@ -805,7 +805,7 @@ class MissingExplicitConversionFailure final : public ContextualFailure {
805805
auto *DC = getDC();
806806
auto &TC = getTypeChecker();
807807

808-
auto asPG = TypeChecker::lookupPrecedenceGroup(
808+
auto asPG = TC.lookupPrecedenceGroup(
809809
DC, DC->getASTContext().Id_CastingPrecedence, SourceLoc());
810810
if (!asPG)
811811
return true;

0 commit comments

Comments
 (0)