Skip to content

Commit a906671

Browse files
authored
---
yaml --- r: 349311 b: refs/heads/master-next c: 07f2e53 h: refs/heads/master i: 349309: c6dff83 349307: ad99acf 349303: deda837 349295: b045e29 349279: 7d92306 349247: 989e86f 349183: 6bc6df8
1 parent 17d9a47 commit a906671

File tree

128 files changed

+1519
-971
lines changed

Some content is hidden

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

128 files changed

+1519
-971
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: f051ac59379f0ccebd3c235d99faedf35cb236da
3+
refs/heads/master-next: 07f2e53580ee1e713cc6495e02a5ab584b254ed6
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/ASTContext.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,7 @@ class ASTContext final {
857857
/// Register the given generic signature builder to be used as the canonical
858858
/// generic signature builder for the given signature, if we don't already
859859
/// have one.
860-
void registerGenericSignatureBuilder(GenericSignature *sig,
860+
void registerGenericSignatureBuilder(GenericSignature sig,
861861
GenericSignatureBuilder &&builder);
862862
friend class GenericSignatureBuilder;
863863

@@ -876,8 +876,8 @@ class ASTContext final {
876876
CanGenericSignature getExistentialSignature(CanType existential,
877877
ModuleDecl *mod);
878878

879-
GenericSignature *getOverrideGenericSignature(const ValueDecl *base,
880-
const ValueDecl *derived);
879+
GenericSignature getOverrideGenericSignature(const ValueDecl *base,
880+
const ValueDecl *derived);
881881

882882
enum class OverrideGenericSignatureReqCheck {
883883
/// Base method's generic requirements are satisifed by derived method

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -155,20 +155,20 @@ class ASTMangler : public Mangler {
155155
ModuleDecl *Module);
156156

157157
std::string mangleKeyPathGetterThunkHelper(const AbstractStorageDecl *property,
158-
GenericSignature *signature,
158+
GenericSignature signature,
159159
CanType baseType,
160160
SubstitutionMap subs,
161161
ResilienceExpansion expansion);
162162
std::string mangleKeyPathSetterThunkHelper(const AbstractStorageDecl *property,
163-
GenericSignature *signature,
163+
GenericSignature signature,
164164
CanType baseType,
165165
SubstitutionMap subs,
166166
ResilienceExpansion expansion);
167167
std::string mangleKeyPathEqualsHelper(ArrayRef<CanType> indices,
168-
GenericSignature *signature,
168+
GenericSignature signature,
169169
ResilienceExpansion expansion);
170170
std::string mangleKeyPathHashHelper(ArrayRef<CanType> indices,
171-
GenericSignature *signature,
171+
GenericSignature signature,
172172
ResilienceExpansion expansion);
173173

174174
std::string mangleTypeForDebugger(Type decl, const DeclContext *DC);
@@ -289,8 +289,8 @@ class ASTMangler : public Mangler {
289289
///
290290
/// \returns \c true if a generic signature was appended, \c false
291291
/// if it was empty.
292-
bool appendGenericSignature(const GenericSignature *sig,
293-
GenericSignature *contextSig = nullptr);
292+
bool appendGenericSignature(GenericSignature sig,
293+
GenericSignature contextSig = nullptr);
294294

295295
void appendRequirement(const Requirement &reqt);
296296

@@ -316,8 +316,8 @@ class ASTMangler : public Mangler {
316316
void appendBackingInitializerEntity(const VarDecl *var);
317317

318318
CanType getDeclTypeForMangling(const ValueDecl *decl,
319-
GenericSignature *&genericSig,
320-
GenericSignature *&parentGenericSig);
319+
GenericSignature &genericSig,
320+
GenericSignature &parentGenericSig);
321321

322322
void appendDeclType(const ValueDecl *decl, bool isFunctionMangling = false);
323323

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
SWIFT_TYPEID(AncestryFlags)
1919
SWIFT_TYPEID(CtorInitializerKind)
20+
SWIFT_TYPEID(GenericSignature)
2021
SWIFT_TYPEID(PropertyWrapperBackingPropertyInfo)
2122
SWIFT_TYPEID(PropertyWrapperTypeInfo)
2223
SWIFT_TYPEID(Requirement)
@@ -26,7 +27,6 @@ SWIFT_TYPEID(TypePair)
2627
SWIFT_TYPEID_NAMED(CustomAttr *, CustomAttr)
2728
SWIFT_TYPEID_NAMED(Decl *, Decl)
2829
SWIFT_TYPEID_NAMED(GenericParamList *, GenericParamList)
29-
SWIFT_TYPEID_NAMED(GenericSignature *, GenericSignature)
3030
SWIFT_TYPEID_NAMED(GenericTypeParamType *, GenericTypeParamType)
3131
SWIFT_TYPEID_NAMED(InfixOperatorDecl *, InfixOperatorDecl)
3232
SWIFT_TYPEID_NAMED(IterableDeclContext *, IterableDeclContext)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ class AnyFunctionRef {
198198
llvm_unreachable("unexpected AnyFunctionRef representation");
199199
}
200200

201-
GenericSignature *getGenericSignature() const {
201+
GenericSignature getGenericSignature() const {
202202
if (auto afd = TheFunction.dyn_cast<AbstractFunctionDecl *>()) {
203203
return afd->getGenericSignature();
204204
}

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1279,27 +1279,27 @@ class SpecializeAttr : public DeclAttribute {
12791279

12801280
private:
12811281
TrailingWhereClause *trailingWhereClause;
1282-
GenericSignature *specializedSignature;
1282+
GenericSignature specializedSignature;
12831283

12841284
SpecializeAttr(SourceLoc atLoc, SourceRange Range,
12851285
TrailingWhereClause *clause, bool exported,
12861286
SpecializationKind kind,
1287-
GenericSignature *specializedSignature);
1287+
GenericSignature specializedSignature);
12881288

12891289
public:
12901290
static SpecializeAttr *create(ASTContext &Ctx, SourceLoc atLoc,
12911291
SourceRange Range, TrailingWhereClause *clause,
12921292
bool exported, SpecializationKind kind,
1293-
GenericSignature *specializedSignature
1293+
GenericSignature specializedSignature
12941294
= nullptr);
12951295

12961296
TrailingWhereClause *getTrailingWhereClause() const;
12971297

1298-
GenericSignature *getSpecializedSgnature() const {
1298+
GenericSignature getSpecializedSgnature() const {
12991299
return specializedSignature;
13001300
}
13011301

1302-
void setSpecializedSignature(GenericSignature *newSig) {
1302+
void setSpecializedSignature(GenericSignature newSig) {
13031303
specializedSignature = newSig;
13041304
}
13051305

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

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1497,7 +1497,7 @@ class alignas(8) _GenericContext {
14971497
TrailingWhereClause *TrailingWhere = nullptr;
14981498

14991499
/// The generic signature of this declaration.
1500-
llvm::PointerIntPair<GenericSignature *, 1, bool> GenericSigAndBit;
1500+
llvm::PointerIntPair<GenericSignature, 1, bool> GenericSigAndBit;
15011501
};
15021502

15031503
class GenericContext : private _GenericContext, public DeclContext {
@@ -1541,7 +1541,7 @@ class GenericContext : private _GenericContext, public DeclContext {
15411541
}
15421542

15431543
/// Retrieve the generic signature for this context.
1544-
GenericSignature *getGenericSignature() const;
1544+
GenericSignature getGenericSignature() const;
15451545

15461546
/// Retrieve the generic context for this context.
15471547
GenericEnvironment *getGenericEnvironment() const;
@@ -1553,7 +1553,7 @@ class GenericContext : private _GenericContext, public DeclContext {
15531553
ArrayRef<Requirement> getGenericRequirements() const;
15541554

15551555
/// Set the generic signature of this context.
1556-
void setGenericSignature(GenericSignature *genericSig);
1556+
void setGenericSignature(GenericSignature genericSig);
15571557

15581558
/// Retrieve the position of any where clause for this context's
15591559
/// generic parameters.
@@ -1678,7 +1678,11 @@ class ExtensionDecl final : public GenericContext, public Decl,
16781678
TypeRepr *ExtendedTypeRepr;
16791679

16801680
/// The nominal type being extended.
1681-
NominalTypeDecl *ExtendedNominal = nullptr;
1681+
///
1682+
/// The bit indicates whether binding has been attempted. The pointer can be
1683+
/// null if either no binding was attempted or if binding could not find the
1684+
/// extended nominal.
1685+
llvm::PointerIntPair<NominalTypeDecl *, 1, bool> ExtendedNominal;
16821686

16831687
MutableArrayRef<TypeLoc> Inherited;
16841688

@@ -1738,6 +1742,12 @@ class ExtensionDecl final : public GenericContext, public Decl,
17381742
SourceRange getBraces() const { return Braces; }
17391743
void setBraces(SourceRange braces) { Braces = braces; }
17401744

1745+
bool hasBeenBound() const { return ExtendedNominal.getInt(); }
1746+
1747+
void setExtendedNominal(NominalTypeDecl *n) {
1748+
ExtendedNominal.setPointerAndInt(n, true);
1749+
}
1750+
17411751
/// Retrieve the type being extended.
17421752
///
17431753
/// Only use this entry point when the complete type, as spelled in the source,
@@ -1746,8 +1756,21 @@ class ExtensionDecl final : public GenericContext, public Decl,
17461756
Type getExtendedType() const;
17471757

17481758
/// Retrieve the nominal type declaration that is being extended.
1759+
/// Will trip an assertion if the declaration has not already been computed.
1760+
/// In order to fail fast when type checking work is attempted
1761+
/// before extension binding has taken place.
1762+
17491763
NominalTypeDecl *getExtendedNominal() const;
17501764

1765+
/// Compute the nominal type declaration that is being extended.
1766+
NominalTypeDecl *computeExtendedNominal() const;
1767+
1768+
/// \c hasBeenBound means nothing if this extension can never been bound
1769+
/// because it is not at the top level.
1770+
bool canNeverBeBound() const;
1771+
1772+
bool hasValidParent() const;
1773+
17511774
/// Determine whether this extension has already been bound to a nominal
17521775
/// type declaration.
17531776
bool alreadyBoundToNominal() const { return NextExtension.getInt(); }
@@ -2857,7 +2880,7 @@ class OpaqueTypeDecl : public GenericTypeDecl {
28572880
/// The generic signature of the opaque interface to the type. This is the
28582881
/// outer generic signature with an added generic parameter representing the
28592882
/// underlying type.
2860-
GenericSignature *OpaqueInterfaceGenericSignature;
2883+
GenericSignature OpaqueInterfaceGenericSignature;
28612884

28622885
/// The generic parameter that represents the underlying type.
28632886
GenericTypeParamType *UnderlyingInterfaceType;
@@ -2874,7 +2897,7 @@ class OpaqueTypeDecl : public GenericTypeDecl {
28742897
OpaqueTypeDecl(ValueDecl *NamingDecl,
28752898
GenericParamList *GenericParams,
28762899
DeclContext *DC,
2877-
GenericSignature *OpaqueInterfaceGenericSignature,
2900+
GenericSignature OpaqueInterfaceGenericSignature,
28782901
GenericTypeParamType *UnderlyingInterfaceType);
28792902

28802903
ValueDecl *getNamingDecl() const { return NamingDecl; }
@@ -2890,7 +2913,7 @@ class OpaqueTypeDecl : public GenericTypeDecl {
28902913
/// function could also be the getter of a storage declaration.
28912914
bool isOpaqueReturnTypeOfFunction(const AbstractFunctionDecl *func) const;
28922915

2893-
GenericSignature *getOpaqueInterfaceGenericSignature() const {
2916+
GenericSignature getOpaqueInterfaceGenericSignature() const {
28942917
return OpaqueInterfaceGenericSignature;
28952918
}
28962919

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ class alignas(1 << DeclContextAlignInBits) DeclContext {
357357

358358
/// Retrieve the innermost generic signature of this context or any
359359
/// of its parents.
360-
GenericSignature *getGenericSignatureOfContext() const;
360+
GenericSignature getGenericSignatureOfContext() const;
361361

362362
/// Retrieve the innermost archetypes of this context or any
363363
/// of its parents.
@@ -470,6 +470,10 @@ class alignas(1 << DeclContextAlignInBits) DeclContext {
470470
/// AnyObject dynamic lookup.
471471
bool mayContainMembersAccessedByDynamicLookup() const;
472472

473+
/// Extensions are only allowed at the level in a file
474+
/// FIXME: do this for Protocols, too someday
475+
bool canBeParentOfExtension() const;
476+
473477
/// Returns true if lookups within this context could affect downstream files.
474478
///
475479
/// \param functionsAreNonCascading If true, functions are considered non-

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ class LoadedFile : public FileUnit {
337337
/// \returns \c true if this module file supports retrieving all of the
338338
/// generic signatures, \c false otherwise.
339339
virtual bool getAllGenericSignatures(
340-
SmallVectorImpl<GenericSignature*> &genericSignatures) {
340+
SmallVectorImpl<GenericSignature> &genericSignatures) {
341341
return false;
342342
}
343343

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class QueryInterfaceTypeSubstitutions {
5757
///
5858
class alignas(1 << DeclAlignInBits) GenericEnvironment final
5959
: private llvm::TrailingObjects<GenericEnvironment, Type> {
60-
GenericSignature *Signature = nullptr;
60+
GenericSignature Signature = GenericSignature();
6161
GenericSignatureBuilder *Builder = nullptr;
6262

6363
friend TrailingObjects;
@@ -74,7 +74,7 @@ class alignas(1 << DeclAlignInBits) GenericEnvironment final
7474
/// generic signature.
7575
ArrayRef<Type> getContextTypes() const;
7676

77-
GenericEnvironment(GenericSignature *signature,
77+
GenericEnvironment(GenericSignature signature,
7878
GenericSignatureBuilder *builder);
7979

8080
friend ArchetypeType;
@@ -85,7 +85,7 @@ class alignas(1 << DeclAlignInBits) GenericEnvironment final
8585
friend QueryInterfaceTypeSubstitutions;
8686

8787
public:
88-
GenericSignature *getGenericSignature() const {
88+
GenericSignature getGenericSignature() const {
8989
return Signature;
9090
}
9191

@@ -94,7 +94,7 @@ class alignas(1 << DeclAlignInBits) GenericEnvironment final
9494
/// Create a new, "incomplete" generic environment that will be populated
9595
/// by calls to \c addMapping().
9696
static
97-
GenericEnvironment *getIncomplete(GenericSignature *signature,
97+
GenericEnvironment *getIncomplete(GenericSignature signature,
9898
GenericSignatureBuilder *builder);
9999

100100
/// Add a mapping of a generic parameter to a specific type (which may be

0 commit comments

Comments
 (0)