Skip to content

Commit 17c937b

Browse files
authored
---
yaml --- r: 349030 b: refs/heads/master c: adfd8b3 h: refs/heads/master
1 parent c2e63dd commit 17c937b

File tree

293 files changed

+6042
-3710
lines changed

Some content is hidden

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

293 files changed

+6042
-3710
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 0e9425ee382e2b2a378a53459d2600f3e4810b81
2+
refs/heads/master: adfd8b358ec21ff75699326168e49ec0ec38940f
33
refs/heads/master-next: 203b3026584ecad859eb328b2e12490099409cd5
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea

trunk/.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.swift.gyb linguist-language=Swift
2+
*.cpp.gyb linguist-language=C++

trunk/CHANGELOG.md

Lines changed: 1 addition & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -58,63 +58,6 @@ Swift 5.2
5858
(foo as Magic)(5)
5959
```
6060

61-
* [SR-11298][]:
62-
63-
A class-constrained protocol extension, where the extended protocol does
64-
not impose a class constraint, will now infer the constraint implicitly.
65-
66-
```swift
67-
protocol Foo {}
68-
class Bar: Foo {
69-
var someProperty: Int = 0
70-
}
71-
72-
// Even though 'Foo' does not impose a class constraint, it is automatically
73-
// inferred due to the Self: Bar constraint.
74-
extension Foo where Self: Bar {
75-
var anotherProperty: Int {
76-
get { return someProperty }
77-
// As a result, the setter is now implicitly nonmutating, just like it would
78-
// be if 'Foo' had a class constraint.
79-
set { someProperty = newValue }
80-
}
81-
}
82-
```
83-
84-
As a result, this could lead to code that currently compiles today to throw an error.
85-
86-
```swift
87-
protocol Foo {
88-
var someProperty: Int { get set }
89-
}
90-
91-
class Bar: Foo {
92-
var someProperty = 0
93-
}
94-
95-
extension Foo where Self: Bar {
96-
var anotherProperty1: Int {
97-
get { return someProperty }
98-
// This will now error, because the protocol requirement
99-
// is implicitly mutating and the setter is implicitly
100-
// nonmutating.
101-
set { someProperty = newValue } // Error
102-
}
103-
}
104-
```
105-
106-
**Workaround**: Define a new mutable variable inside the setter that has a reference to `self`:
107-
108-
```swift
109-
var anotherProperty1: Int {
110-
get { return someProperty }
111-
set {
112-
var mutableSelf = self
113-
mutableSelf.someProperty = newValue // Okay
114-
}
115-
}
116-
```
117-
11861
* [SE-0253][]:
11962

12063
Values of types that declare `func callAsFunction` methods can be called
@@ -140,7 +83,7 @@ Swift 5.2
14083

14184
* [SR-4206][]:
14285

143-
A method override is no longer allowed to have a generic signature with
86+
A method override is no longer allowed to have a generic signature with
14487
requirements not imposed by the base method. For example:
14588

14689
```
@@ -7856,5 +7799,4 @@ Swift 1.0
78567799
[SR-8974]: <https://bugs.swift.org/browse/SR-8974>
78577800
[SR-9043]: <https://bugs.swift.org/browse/SR-9043>
78587801
[SR-9827]: <https://bugs.swift.org/browse/SR-9827>
7859-
[SR-11298]: <https://bugs.swift.org/browse/SR-11298>
78607802
[SR-11429]: <https://bugs.swift.org/browse/SR-11429>

trunk/cmake/modules/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ set(SWIFT_LIBRARY_DIRS ${SWIFT_LIBRARY_OUTPUT_INTDIR})
1616
configure_file(
1717
SwiftConfig.cmake.in
1818
${swift_cmake_builddir}/SwiftConfig.cmake
19-
@ONLY)
19+
@ONLY)

trunk/cmake/modules/SwiftConfig.cmake.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ set(SWIFT_VERSION @SWIFT_VERSION@)
66
set(SWIFT_MAIN_SRC_DIR @SWIFT_SOURCE_DIR@)
77

88
set(SWIFT_INCLUDE_DIRS "@SWIFT_INCLUDE_DIRS@")
9-
set(SWIFT_LIBRARY_DIRS "@SWIFT_CONFIG_LIBRARY_DIRS@")
9+
set(SWIFT_LIBRARY_DIRS "@SWIFT_LIBRARY_DIRS@")
1010

1111
# These variables are duplicated, but they must match the LLVM variables of the
1212
# same name. The variables ending in "S" could some day become lists, and are
1313
# preserved for convention and compatibility.
1414
set(SWIFT_INCLUDE_DIR "@SWIFT_INCLUDE_DIRS@")
15-
set(SWIFT_LIBRARY_DIR "@SWIFT_CONFIG_LIBRARY_DIRS@")
15+
set(SWIFT_LIBRARY_DIR "@SWIFT_LIBRARY_DIRS@")
1616

1717
set(SWIFT_CMAKE_DIR "@SWIFT_CMAKE_DIR@")
1818
set(SWIFT_BINARY_DIR "@SWIFT_BINARY_DIR@")

trunk/cmake/modules/SwiftSource.cmake

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -310,12 +310,12 @@ function(_compile_swift_files
310310
set(module_base "${module_dir}/${SWIFTFILE_MODULE_NAME}")
311311
if(SWIFTFILE_SDK IN_LIST SWIFT_APPLE_PLATFORMS)
312312
set(specific_module_dir "${module_base}.swiftmodule")
313-
set(specific_module_private_dir "${specific_module_dir}/Private")
314-
set(source_info_file "${specific_module_private_dir}/${SWIFTFILE_ARCHITECTURE}.swiftsourceinfo")
313+
set(specific_module_project_dir "${specific_module_dir}/Project")
314+
set(source_info_file "${specific_module_project_dir}/${SWIFTFILE_ARCHITECTURE}.swiftsourceinfo")
315315
set(module_base "${module_base}.swiftmodule/${SWIFTFILE_ARCHITECTURE}")
316316
else()
317317
set(specific_module_dir)
318-
set(specific_module_private_dir)
318+
set(specific_module_project_dir)
319319
set(source_info_file "${module_base}.swiftsourceinfo")
320320
endif()
321321
set(module_file "${module_base}.swiftmodule")
@@ -333,6 +333,11 @@ function(_compile_swift_files
333333
"-emit-module-interface-path" "${interface_file}")
334334
endif()
335335

336+
if (NOT SWIFTFILE_IS_STDLIB_CORE)
337+
list(APPEND swift_module_flags
338+
"-Xfrontend" "-experimental-skip-non-inlinable-function-bodies")
339+
endif()
340+
336341
# If we have extra regexp flags, check if we match any of the regexps. If so
337342
# add the relevant flags to our swift_flags.
338343
if (SWIFT_EXPERIMENTAL_EXTRA_REGEXP_FLAGS OR SWIFT_EXPERIMENTAL_EXTRA_NEGATIVE_REGEXP_FLAGS)
@@ -354,7 +359,7 @@ function(_compile_swift_files
354359
DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/swift/${library_subdir}"
355360
COMPONENT "${SWIFTFILE_INSTALL_IN_COMPONENT}"
356361
OPTIONAL
357-
PATTERN "Private" EXCLUDE)
362+
PATTERN "Project" EXCLUDE)
358363
else()
359364
swift_install_in_component(FILES ${module_outputs}
360365
DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/swift/${library_subdir}"
@@ -495,7 +500,7 @@ function(_compile_swift_files
495500
COMMAND
496501
"${CMAKE_COMMAND}" "-E" "make_directory" ${module_dir}
497502
${specific_module_dir}
498-
${specific_module_private_dir}
503+
${specific_module_project_dir}
499504
COMMAND
500505
"${PYTHON_EXECUTABLE}" "${line_directive_tool}" "@${file_path}" --
501506
"${swift_compiler_tool}" "-emit-module" "-o" "${module_file}"

trunk/include/swift/AST/ASTDemangler.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,6 @@ class ASTBuilder {
5858
using BuiltTypeDecl = swift::GenericTypeDecl *; // nominal or type alias
5959
using BuiltProtocolDecl = swift::ProtocolDecl *;
6060
explicit ASTBuilder(ASTContext &ctx) : Ctx(ctx) {}
61-
62-
/// The resolver to use for type checking, if necessary.
63-
LazyResolver *Resolver = nullptr;
6461

6562
ASTContext &getASTContext() { return Ctx; }
6663
DeclContext *getNotionalDC();

trunk/include/swift/AST/ASTScope.h

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
#include "swift/AST/ASTNode.h"
3232
#include "swift/AST/NameLookup.h" // for DeclVisibilityKind
33+
#include "swift/AST/SimpleRequest.h"
3334
#include "swift/Basic/Compiler.h"
3435
#include "swift/Basic/LLVM.h"
3536
#include "swift/Basic/NullablePtr.h"
@@ -88,6 +89,14 @@ struct AnnotatedInsertionPoint {
8889
ASTScopeImpl *insertionPoint;
8990
const char *explanation;
9091
};
92+
} // namespace ast_scope
93+
94+
namespace ast_scope {
95+
96+
void simple_display(llvm::raw_ostream &out, const ASTScopeImpl *);
97+
void simple_display(llvm::raw_ostream &out, const ScopeCreator *);
98+
99+
SourceLoc extractNearestSourceLoc(std::tuple<ASTScopeImpl *, ScopeCreator *>);
91100

92101
#pragma mark the root ASTScopeImpl class
93102

@@ -333,6 +342,11 @@ class ASTScopeImpl {
333342
public:
334343
/// expandScope me, sending deferred nodes to my descendants.
335344
/// Return the scope into which to place subsequent decls
345+
ASTScopeImpl *expandAndBeCurrentDetectingRecursion(ScopeCreator &);
346+
347+
/// Expand or reexpand the scope if unexpanded or if not current.
348+
/// There are several places in the compiler that mutate the AST after the
349+
/// fact, above and beyond adding Decls to the SourceFile.
336350
ASTScopeImpl *expandAndBeCurrent(ScopeCreator &);
337351

338352
unsigned getASTAncestorScopeCount() const { return astAncestorScopeCount; }
@@ -344,6 +358,12 @@ class ASTScopeImpl {
344358
void setWasExpanded() { wasExpanded = true; }
345359
virtual ASTScopeImpl *expandSpecifically(ScopeCreator &) = 0;
346360
virtual void beCurrent();
361+
virtual bool doesExpansionOnlyAddNewDeclsAtEnd() const;
362+
363+
public:
364+
bool isExpansionNeeded(const ScopeCreator &) const;
365+
366+
protected:
347367
bool isCurrent() const;
348368
virtual bool isCurrentIfWasExpanded() const;
349369

@@ -374,16 +394,7 @@ class ASTScopeImpl {
374394

375395
bool isATypeDeclScope() const;
376396

377-
/// There are several places in the compiler that mutate the AST after the
378-
/// fact, above and beyond adding Decls to the SourceFile. These are
379-
/// documented in: rdar://53018839, rdar://53027266, rdar://53027733,
380-
/// rdar://53028050
381-
/// Return true if did reexpand
382-
bool reexpandIfObsolete(ScopeCreator &);
383-
384397
private:
385-
void reexpand(ScopeCreator &);
386-
387398
virtual ScopeCreator &getScopeCreator();
388399

389400
#pragma mark - - creation queries
@@ -533,8 +544,8 @@ class ASTSourceFileScope final : public ASTScopeImpl {
533544
/// The number of \c Decls in the \c SourceFile that were already seen.
534545
/// Since parsing can be interleaved with type-checking, on every
535546
/// lookup, look at creating scopes for any \c Decls beyond this number.
536-
/// rdar://55562483 Unify with numberOfChildrenWhenLastExpanded
537-
int numberOfDeclsAlreadySeen = 0;
547+
/// TODO: Unify with numberOfChildrenWhenLastExpanded
548+
size_t numberOfDeclsAlreadySeen = 0;
538549

539550
ASTSourceFileScope(SourceFile *SF, ScopeCreator *scopeCreator);
540551

@@ -548,7 +559,6 @@ class ASTSourceFileScope final : public ASTScopeImpl {
548559
public:
549560
NullablePtr<DeclContext> getDeclContext() const override;
550561

551-
void addNewDeclsToScopeTree();
552562
void buildFullyExpandedTree();
553563
void
554564
buildEnoughOfTreeForTopLevelExpressionsButDontRequestGenericsOrExtendedNominals();
@@ -559,11 +569,15 @@ class ASTSourceFileScope final : public ASTScopeImpl {
559569

560570
protected:
561571
ASTScopeImpl *expandSpecifically(ScopeCreator &scopeCreator) override;
572+
bool isCurrentIfWasExpanded() const override;
573+
void beCurrent() override;
574+
bool doesExpansionOnlyAddNewDeclsAtEnd() const override;
562575

563576
ScopeCreator &getScopeCreator() override;
564577

565578
private:
566-
void expandAScopeThatDoesNotCreateANewInsertionPoint(ScopeCreator &);
579+
AnnotatedInsertionPoint
580+
expandAScopeThatCreatesANewInsertionPoint(ScopeCreator &);
567581
};
568582

569583
class Portion {
@@ -1148,7 +1162,6 @@ class AttachedPropertyWrapperScope final : public ASTScopeImpl {
11481162
/// false positives, that that doesn't hurt anything. However, the result of
11491163
/// the conservative source range computation doesn't seem to be stable. So
11501164
/// keep the original here, and use it for source range queries.
1151-
/// rdar://55263708
11521165

11531166
const SourceRange sourceRangeWhenCreated;
11541167

@@ -1251,7 +1264,6 @@ class PatternEntryDeclScope final : public AbstractPatternEntryScope {
12511264
};
12521265

12531266
class PatternEntryInitializerScope final : public AbstractPatternEntryScope {
1254-
// Should be able to remove this when rdar://53921703 is accomplished.
12551267
Expr *initAsWrittenWhenCreated;
12561268

12571269
public:

trunk/include/swift/AST/ASTTypeIDZone.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
SWIFT_TYPEID(AncestryFlags)
1919
SWIFT_TYPEID(CtorInitializerKind)
2020
SWIFT_TYPEID(GenericSignature)
21+
SWIFT_TYPEID(ParamSpecifier)
2122
SWIFT_TYPEID(PropertyWrapperBackingPropertyInfo)
2223
SWIFT_TYPEID(PropertyWrapperTypeInfo)
2324
SWIFT_TYPEID(Requirement)
@@ -33,6 +34,7 @@ SWIFT_TYPEID_NAMED(InfixOperatorDecl *, InfixOperatorDecl)
3334
SWIFT_TYPEID_NAMED(IterableDeclContext *, IterableDeclContext)
3435
SWIFT_TYPEID_NAMED(ModuleDecl *, ModuleDecl)
3536
SWIFT_TYPEID_NAMED(NominalTypeDecl *, NominalTypeDecl)
37+
SWIFT_TYPEID_NAMED(OpaqueTypeDecl *, OpaqueTypeDecl)
3638
SWIFT_TYPEID_NAMED(OperatorDecl *, OperatorDecl)
3739
SWIFT_TYPEID_NAMED(Optional<PropertyWrapperMutability>,
3840
PropertyWrapperMutability)

trunk/include/swift/AST/ASTTypeIDs.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ class IterableDeclContext;
3434
class ModuleDecl;
3535
class NominalTypeDecl;
3636
class OperatorDecl;
37+
class OpaqueTypeDecl;
38+
class ParamDecl;
39+
enum class ParamSpecifier : uint8_t;
3740
class PrecedenceGroupDecl;
3841
struct PropertyWrapperBackingPropertyInfo;
3942
struct PropertyWrapperTypeInfo;

trunk/include/swift/AST/Attr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1672,7 +1672,7 @@ class DeclAttributes {
16721672
public:
16731673
template <typename ATTR, bool AllowInvalid>
16741674
using AttributeKindRange =
1675-
OptionalTransformRange<llvm::iterator_range<const_iterator>,
1675+
OptionalTransformRange<iterator_range<const_iterator>,
16761676
ToAttributeKind<ATTR, AllowInvalid>,
16771677
const_iterator>;
16781678

0 commit comments

Comments
 (0)