Skip to content

Commit fae0186

Browse files
---
yaml --- r: 349123 b: refs/heads/master c: d68866c h: refs/heads/master i: 349121: 7b82bed 349119: 6d69a30
1 parent 5b9a446 commit fae0186

File tree

327 files changed

+3443
-6786
lines changed

Some content is hidden

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

327 files changed

+3443
-6786
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: 3bd45c81357dc03dc54ee57c567230b147d3a8c8
2+
refs/heads/master: d68866ca98e68b4b85b5aa1adc0484887a1c061f
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: 0 additions & 2 deletions
This file was deleted.

trunk/CHANGELOG.md

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,63 @@ 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+
61118
* [SE-0253][]:
62119

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

84141
* [SR-4206][]:
85142

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

89146
```
@@ -7799,4 +7856,5 @@ Swift 1.0
77997856
[SR-8974]: <https://bugs.swift.org/browse/SR-8974>
78007857
[SR-9043]: <https://bugs.swift.org/browse/SR-9043>
78017858
[SR-9827]: <https://bugs.swift.org/browse/SR-9827>
7859+
[SR-11298]: <https://bugs.swift.org/browse/SR-11298>
78027860
[SR-11429]: <https://bugs.swift.org/browse/SR-11429>

trunk/CMakeLists.txt

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

14-
set(CMAKE_DISABLE_IN_SOURCE_BUILD YES)
15-
1614
if(DEFINED CMAKE_JOB_POOLS)
1715
# CMake < 3.11 doesn't support CMAKE_JOB_POOLS. Manually set the property.
1816
set_property(GLOBAL PROPERTY JOB_POOLS "${CMAKE_JOB_POOLS}")
@@ -377,10 +375,6 @@ option(SWIFT_ENABLE_STDLIBCORE_EXCLUSIVITY_CHECKING
377375
"Build stdlibCore with exclusivity checking enabled"
378376
FALSE)
379377

380-
option(SWIFT_ENABLE_EXPERIMENTAL_DIFFERENTIABLE_PROGRAMMING
381-
"Enable experimental Swift differentiable programming features"
382-
FALSE)
383-
384378
#
385379
# End of user-configurable options.
386380
#

trunk/benchmark/scripts/run_smoke_bench

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,6 @@ 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)
10096
argparser.add_argument(
10197
'-platform', type=str,
10298
help='The benchmark build platform', default='macosx')
@@ -124,7 +120,7 @@ def test_opt_levels(args):
124120
if test_performance(opt_level, args.oldbuilddir[0],
125121
args.newbuilddir[0],
126122
float(args.threshold) / 100, args.num_samples,
127-
args.num_reruns, output_file):
123+
output_file):
128124
changes = True
129125

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

176172

177173
def test_performance(opt_level, old_dir, new_dir, threshold, num_samples,
178-
num_reruns, output_file):
174+
output_file):
179175
"""Detect performance changes in benchmarks.
180176
181177
Start fast with few samples per benchmark and gradually spend more time
@@ -189,7 +185,7 @@ def test_performance(opt_level, old_dir, new_dir, threshold, num_samples,
189185
tests = TestComparator(results[0], results[1], threshold)
190186
changed = tests.decreased + tests.increased
191187

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

trunk/benchmark/single-source/UTF8Decode.swift

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,6 @@ public let UTF8Decode = [
4242
name: "UTF8Decode_InitFromBytes_ascii",
4343
runFunction: run_UTF8Decode_InitFromBytes_ascii,
4444
tags: [.validation, .api, .String]),
45-
BenchmarkInfo(
46-
name: "UTF8Decode_InitFromData_ascii_as_ascii",
47-
runFunction: run_UTF8Decode_InitFromData_ascii_as_ascii,
48-
tags: [.validation, .api, .String]),
49-
BenchmarkInfo(
50-
name: "UTF8Decode_InitDecoding_ascii_as_ascii",
51-
runFunction: run_UTF8Decode_InitDecoding_ascii_as_ascii,
52-
tags: [.validation, .api, .String]),
53-
BenchmarkInfo(
54-
name: "UTF8Decode_InitFromBytes_ascii_as_ascii",
55-
runFunction: run_UTF8Decode_InitFromBytes_ascii_as_ascii,
56-
tags: [.validation, .api, .String]),
5745
]
5846

5947
// 1-byte sequences
@@ -141,26 +129,4 @@ public func run_UTF8Decode_InitFromBytes_ascii(_ N: Int) {
141129
}
142130
}
143131

144-
@inline(never)
145-
public func run_UTF8Decode_InitFromData_ascii_as_ascii(_ N: Int) {
146-
let input = asciiData
147-
for _ in 0..<1_000*N {
148-
blackHole(String(data: input, encoding: .ascii))
149-
}
150-
}
151-
@inline(never)
152-
public func run_UTF8Decode_InitDecoding_ascii_as_ascii(_ N: Int) {
153-
let input = asciiBytes
154-
for _ in 0..<1_000*N {
155-
blackHole(String(decoding: input, as: Unicode.ASCII.self))
156-
}
157-
}
158-
@inline(never)
159-
public func run_UTF8Decode_InitFromBytes_ascii_as_ascii(_ N: Int) {
160-
let input = asciiBytes
161-
for _ in 0..<1_000*N {
162-
blackHole(String(bytes: input, encoding: .ascii))
163-
}
164-
}
165-
166132

trunk/cmake/modules/AddSwift.cmake

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -422,10 +422,6 @@ 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-
429425
set("${result_var_name}" "${result}" PARENT_SCOPE)
430426
endfunction()
431427

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_project_dir "${specific_module_dir}/Project")
314-
set(source_info_file "${specific_module_project_dir}/${SWIFTFILE_ARCHITECTURE}.swiftsourceinfo")
313+
set(specific_module_private_dir "${specific_module_dir}/Private")
314+
set(source_info_file "${specific_module_private_dir}/${SWIFTFILE_ARCHITECTURE}.swiftsourceinfo")
315315
set(module_base "${module_base}.swiftmodule/${SWIFTFILE_ARCHITECTURE}")
316316
else()
317317
set(specific_module_dir)
318-
set(specific_module_project_dir)
318+
set(specific_module_private_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 "Project" EXCLUDE)
357+
PATTERN "Private" 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_project_dir}
498+
${specific_module_private_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: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ 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. Make sure that the build
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
103104
type for LLVM/Clang is compatible with the build type for Swift. That is,
104105
either build everything `Debug` or some variant of `Release` (e.g. `Release`,
105106
`RelWithDebInfo`).
@@ -125,8 +126,8 @@ ninja
125126
path S:\b\llvm\bin;%PATH%
126127
```
127128
## 7. Build CMark
128-
- This must be done from within a developer command prompt.
129-
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.
130131
```cmd
131132
md "S:\b\cmark"
132133
cd "S:\b\cmark"
@@ -179,8 +180,8 @@ cmake -G "Visual Studio 2017" -A x64 -T "host=x64"^ ...
179180
```
180181

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

trunk/include/swift/AST/ASTContext.h

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

114113
enum class KnownProtocolKind : uint8_t;
115114

trunk/include/swift/AST/ASTScope.h

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

3131
#include "swift/AST/ASTNode.h"
3232
#include "swift/AST/NameLookup.h" // for DeclVisibilityKind
33-
#include "swift/AST/SimpleRequest.h"
3433
#include "swift/Basic/Compiler.h"
3534
#include "swift/Basic/LLVM.h"
3635
#include "swift/Basic/NullablePtr.h"
@@ -89,14 +88,6 @@ struct AnnotatedInsertionPoint {
8988
ASTScopeImpl *insertionPoint;
9089
const char *explanation;
9190
};
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 *>);
10091

10192
#pragma mark the root ASTScopeImpl class
10293

@@ -342,11 +333,6 @@ class ASTScopeImpl {
342333
public:
343334
/// expandScope me, sending deferred nodes to my descendants.
344335
/// 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.
350336
ASTScopeImpl *expandAndBeCurrent(ScopeCreator &);
351337

352338
unsigned getASTAncestorScopeCount() const { return astAncestorScopeCount; }
@@ -358,12 +344,6 @@ class ASTScopeImpl {
358344
void setWasExpanded() { wasExpanded = true; }
359345
virtual ASTScopeImpl *expandSpecifically(ScopeCreator &) = 0;
360346
virtual void beCurrent();
361-
virtual bool doesExpansionOnlyAddNewDeclsAtEnd() const;
362-
363-
public:
364-
bool isExpansionNeeded(const ScopeCreator &) const;
365-
366-
protected:
367347
bool isCurrent() const;
368348
virtual bool isCurrentIfWasExpanded() const;
369349

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

395375
bool isATypeDeclScope() const;
396376

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+
397384
private:
385+
void reexpand(ScopeCreator &);
386+
398387
virtual ScopeCreator &getScopeCreator();
399388

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

550539
ASTSourceFileScope(SourceFile *SF, ScopeCreator *scopeCreator);
551540

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

551+
void addNewDeclsToScopeTree();
562552
void buildFullyExpandedTree();
563553
void
564554
buildEnoughOfTreeForTopLevelExpressionsButDontRequestGenericsOrExtendedNominals();
@@ -569,15 +559,11 @@ class ASTSourceFileScope final : public ASTScopeImpl {
569559

570560
protected:
571561
ASTScopeImpl *expandSpecifically(ScopeCreator &scopeCreator) override;
572-
bool isCurrentIfWasExpanded() const override;
573-
void beCurrent() override;
574-
bool doesExpansionOnlyAddNewDeclsAtEnd() const override;
575562

576563
ScopeCreator &getScopeCreator() override;
577564

578565
private:
579-
AnnotatedInsertionPoint
580-
expandAScopeThatCreatesANewInsertionPoint(ScopeCreator &);
566+
void expandAScopeThatDoesNotCreateANewInsertionPoint(ScopeCreator &);
581567
};
582568

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

11661153
const SourceRange sourceRangeWhenCreated;
11671154

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

12661253
class PatternEntryInitializerScope final : public AbstractPatternEntryScope {
1254+
// Should be able to remove this when rdar://53921703 is accomplished.
12671255
Expr *initAsWrittenWhenCreated;
12681256

12691257
public:

0 commit comments

Comments
 (0)