Skip to content

Commit 0c45e7e

Browse files
authored
---
yaml --- r: 349113 b: refs/heads/master c: d7d903f h: refs/heads/master i: 349111: 549117a
1 parent e701a4c commit 0c45e7e

File tree

400 files changed

+8632
-5059
lines changed

Some content is hidden

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

400 files changed

+8632
-5059
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: f0b3003b143c4d718c89955ee265473253d27e7f
2+
refs/heads/master: d7d903f7d15f392df7b25ffe559729a8b09f7783
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/CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ endif()
1111
list(APPEND CMAKE_MODULE_PATH
1212
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
1313

14+
set(CMAKE_DISABLE_IN_SOURCE_BUILD YES)
15+
1416
if(DEFINED CMAKE_JOB_POOLS)
1517
# CMake < 3.11 doesn't support CMAKE_JOB_POOLS. Manually set the property.
1618
set_property(GLOBAL PROPERTY JOB_POOLS "${CMAKE_JOB_POOLS}")
@@ -125,7 +127,7 @@ set(SWIFT_ANALYZE_CODE_COVERAGE FALSE CACHE STRING
125127
# SWIFT_VERSION is deliberately /not/ cached so that an existing build directory
126128
# can be reused when a new version of Swift comes out (assuming the user hasn't
127129
# manually set it as part of their own CMake configuration).
128-
set(SWIFT_VERSION "5.1")
130+
set(SWIFT_VERSION "5.1.1")
129131

130132
set(SWIFT_VENDOR "" CACHE STRING
131133
"The vendor name of the Swift compiler")
@@ -375,6 +377,10 @@ option(SWIFT_ENABLE_STDLIBCORE_EXCLUSIVITY_CHECKING
375377
"Build stdlibCore with exclusivity checking enabled"
376378
FALSE)
377379

380+
option(SWIFT_ENABLE_EXPERIMENTAL_DIFFERENTIABLE_PROGRAMMING
381+
"Enable experimental Swift differentiable programming features"
382+
FALSE)
383+
378384
#
379385
# End of user-configurable options.
380386
#

trunk/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
| | **Architecture** | **Master** | **Package** |
77
|---|:---:|:---:|:---:|
88
| **macOS** | x86_64 |[![Build Status](https://ci.swift.org/job/oss-swift-incremental-RA-osx/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-incremental-RA-osx)|[![Build Status](https://ci.swift.org/job/oss-swift-package-osx/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-osx)|
9-
| **Ubuntu 14.04** | x86_64 | [![Build Status](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-14_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-14_04)|[![Build Status](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-14_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-14_04)|
109
| **Ubuntu 16.04** | x86_64 | [![Build Status](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-16_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-16_04)|[![Build Status](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-16_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-16_04)|
1110
| **Ubuntu 18.04** | x86_64 | [![Build Status](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-18_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-18_04)|[![Build Status](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-18_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-18_04)|
1211

trunk/benchmark/scripts/run_smoke_bench

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ def main():
9393
argparser.add_argument(
9494
'-num-samples', type=int,
9595
help='The (minimum) number of samples to run', default=3)
96+
argparser.add_argument(
97+
'-num-reruns', type=int,
98+
help="The number of re-runs until it's assumed to be a real change",
99+
default=8)
96100
argparser.add_argument(
97101
'-platform', type=str,
98102
help='The benchmark build platform', default='macosx')
@@ -120,7 +124,7 @@ def test_opt_levels(args):
120124
if test_performance(opt_level, args.oldbuilddir[0],
121125
args.newbuilddir[0],
122126
float(args.threshold) / 100, args.num_samples,
123-
output_file):
127+
args.num_reruns, output_file):
124128
changes = True
125129

126130
# There is no point in reporting code size for Onone.
@@ -171,7 +175,7 @@ def merge(results, other_results):
171175

172176

173177
def test_performance(opt_level, old_dir, new_dir, threshold, num_samples,
174-
output_file):
178+
num_reruns, output_file):
175179
"""Detect performance changes in benchmarks.
176180
177181
Start fast with few samples per benchmark and gradually spend more time
@@ -185,7 +189,7 @@ def test_performance(opt_level, old_dir, new_dir, threshold, num_samples,
185189
tests = TestComparator(results[0], results[1], threshold)
186190
changed = tests.decreased + tests.increased
187191

188-
while len(changed) > 0 and unchanged_length_count < 10:
192+
while len(changed) > 0 and unchanged_length_count < num_reruns:
189193
i += 1
190194
if VERBOSE:
191195
log(' test again: ' + str([test.name for test in changed]))

trunk/cmake/modules/AddSwift.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,10 @@ function(_add_variant_swift_compile_flags
422422
list(APPEND result "-D" "SWIFT_ENABLE_RUNTIME_FUNCTION_COUNTERS")
423423
endif()
424424

425+
if(SWIFT_ENABLE_EXPERIMENTAL_DIFFERENTIABLE_PROGRAMMING)
426+
list(APPEND result "-D" "SWIFT_ENABLE_EXPERIMENTAL_DIFFERENTIABLE_PROGRAMMING")
427+
endif()
428+
425429
set("${result_var_name}" "${result}" PARENT_SCOPE)
426430
endfunction()
427431

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: 5 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")
@@ -354,7 +354,7 @@ function(_compile_swift_files
354354
DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/swift/${library_subdir}"
355355
COMPONENT "${SWIFTFILE_INSTALL_IN_COMPONENT}"
356356
OPTIONAL
357-
PATTERN "Private" EXCLUDE)
357+
PATTERN "Project" EXCLUDE)
358358
else()
359359
swift_install_in_component(FILES ${module_outputs}
360360
DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/swift/${library_subdir}"
@@ -495,7 +495,7 @@ function(_compile_swift_files
495495
COMMAND
496496
"${CMAKE_COMMAND}" "-E" "make_directory" ${module_dir}
497497
${specific_module_dir}
498-
${specific_module_private_dir}
498+
${specific_module_project_dir}
499499
COMMAND
500500
"${PYTHON_EXECUTABLE}" "${line_directive_tool}" "@${file_path}" --
501501
"${swift_compiler_tool}" "-emit-module" "-o" "${module_file}"

trunk/docs/WindowsBuild.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,7 @@ mklink "%VCToolsInstallDir%\include\visualc.apinotes" S:\swift\stdlib\public\Pla
9999
Warning: Creating the above links usually requires administrator privileges. The quick and easy way to do this is to open a second developer prompt by right clicking whatever shortcut you used to open the first one, choosing Run As Administrator, and pasting the above commands into the resulting window. You can then close the privileged prompt; this is the only step which requires elevation.
100100

101101
## 6. Build LLVM/Clang
102-
- This must be done from within a developer command prompt. LLVM and Clang are
103-
large projects, so building might take a few hours. Make sure that the build
102+
- This must be done from within a developer command prompt. Make sure that the build
104103
type for LLVM/Clang is compatible with the build type for Swift. That is,
105104
either build everything `Debug` or some variant of `Release` (e.g. `Release`,
106105
`RelWithDebInfo`).
@@ -126,8 +125,8 @@ ninja
126125
path S:\b\llvm\bin;%PATH%
127126
```
128127
## 7. Build CMark
129-
- This must be done from within a developer command prompt. CMark is a fairly
130-
small project and should only take a few minutes to build.
128+
- This must be done from within a developer command prompt.
129+
131130
```cmd
132131
md "S:\b\cmark"
133132
cd "S:\b\cmark"
@@ -180,8 +179,8 @@ cmake -G "Visual Studio 2017" -A x64 -T "host=x64"^ ...
180179
```
181180

182181
## 9. Build lldb
183-
- This must be done from within a developer command prompt and could take hours
184-
depending on your system.
182+
- This must be done from within a developer command prompt.
183+
185184
```cmd
186185
md "S:\b\lldb"
187186
cd "S:\b\lldb"

trunk/include/swift/AST/ASTContext.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ namespace swift {
109109
class TypeAliasDecl;
110110
class VarDecl;
111111
class UnifiedStatsReporter;
112+
class IndexSubset;
112113

113114
enum class KnownProtocolKind : uint8_t;
114115

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:

0 commit comments

Comments
 (0)