Skip to content

Commit e67a0e3

Browse files
committed
---
yaml --- r: 348980 b: refs/heads/master c: 29caee2 h: refs/heads/master
1 parent 5ecaac0 commit e67a0e3

File tree

81 files changed

+468
-1648
lines changed

Some content is hidden

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

81 files changed

+468
-1648
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: 0ea63be37ec4ec4179677b4ecd6013cfd8eb7840
2+
refs/heads/master: 29caee2ba68dfb3fae133e4a4d7ddd876d63fc2e
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/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/cmake/modules/SwiftSource.cmake

Lines changed: 5 additions & 10 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")
@@ -333,11 +333,6 @@ 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-
341336
# If we have extra regexp flags, check if we match any of the regexps. If so
342337
# add the relevant flags to our swift_flags.
343338
if (SWIFT_EXPERIMENTAL_EXTRA_REGEXP_FLAGS OR SWIFT_EXPERIMENTAL_EXTRA_NEGATIVE_REGEXP_FLAGS)
@@ -359,7 +354,7 @@ function(_compile_swift_files
359354
DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/swift/${library_subdir}"
360355
COMPONENT "${SWIFTFILE_INSTALL_IN_COMPONENT}"
361356
OPTIONAL
362-
PATTERN "Project" EXCLUDE)
357+
PATTERN "Private" EXCLUDE)
363358
else()
364359
swift_install_in_component(FILES ${module_outputs}
365360
DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/swift/${library_subdir}"
@@ -500,7 +495,7 @@ function(_compile_swift_files
500495
COMMAND
501496
"${CMAKE_COMMAND}" "-E" "make_directory" ${module_dir}
502497
${specific_module_dir}
503-
${specific_module_project_dir}
498+
${specific_module_private_dir}
504499
COMMAND
505500
"${PYTHON_EXECUTABLE}" "${line_directive_tool}" "@${file_path}" --
506501
"${swift_compiler_tool}" "-emit-module" "-o" "${module_file}"

trunk/include/swift/AST/DeclContext.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,10 @@ class alignas(1 << DeclContextAlignInBits) DeclContext {
261261

262262
/// Returns the kind of context this is.
263263
DeclContextKind getContextKind() const;
264-
264+
265+
/// Returns whether this context has value semantics.
266+
bool hasValueSemantics() const;
267+
265268
/// Determines whether this context is itself a local scope in a
266269
/// code block. A context that appears in such a scope, like a
267270
/// local type declaration, does not itself become a local context.

trunk/include/swift/AST/DiagnosticsParse.def

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -970,8 +970,6 @@ ERROR(expected_expr_throw,PointsToFirstBadToken,
970970
// Yield Statment
971971
ERROR(expected_expr_yield,PointsToFirstBadToken,
972972
"expected expression in 'yield' statement", ())
973-
ERROR(unexpected_arg_label_yield,none,
974-
"unexpected argument label in 'yield' statement", ())
975973

976974
// Defer Statement
977975
ERROR(expected_lbrace_after_defer,PointsToFirstBadToken,

trunk/include/swift/AST/FileUnit.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,6 @@ class FileUnit : public DeclContext {
131131
return None;
132132
}
133133

134-
virtual Optional<BasicDeclLocs> getBasicLocsForDecl(const Decl *D) const {
135-
return None;
136-
}
137-
138134
virtual void collectAllGroups(std::vector<StringRef> &Names) const {}
139135

140136
/// Returns an implementation-defined "discriminator" for \p D, which

trunk/include/swift/AST/RawComment.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -78,19 +78,6 @@ struct CommentInfo {
7878
uint32_t SourceOrder;
7979
};
8080

81-
struct LineColumn {
82-
uint32_t Line = 0;
83-
uint32_t Column = 0;
84-
bool isValid() const { return Line && Column; }
85-
};
86-
87-
struct BasicDeclLocs {
88-
StringRef SourceFilePath;
89-
LineColumn Loc;
90-
LineColumn StartLoc;
91-
LineColumn EndLoc;
92-
};
93-
9481
} // namespace swift
9582

9683
#endif // LLVM_SWIFT_AST_RAW_COMMENT_H

trunk/include/swift/AST/SourceFile.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,6 @@ class SourceFile final : public FileUnit {
276276

277277
Identifier getDiscriminatorForPrivateValue(const ValueDecl *D) const override;
278278
Identifier getPrivateDiscriminator() const { return PrivateDiscriminator; }
279-
Optional<BasicDeclLocs> getBasicLocsForDecl(const Decl *D) const override;
280279

281280
virtual bool walk(ASTWalker &walker) override;
282281

trunk/include/swift/AST/USRGeneration.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#include "swift/Basic/LLVM.h"
2323

2424
namespace swift {
25-
class Decl;
2625
class AbstractStorageDecl;
2726
class ValueDecl;
2827
class ExtensionDecl;
@@ -40,9 +39,9 @@ bool printTypeUSR(Type Ty, raw_ostream &OS);
4039
/// \returns true if it failed, false on success.
4140
bool printDeclTypeUSR(const ValueDecl *D, raw_ostream &OS);
4241

43-
/// Prints out the USR for the given ValueDecl.
42+
/// Prints out the USR for the given Decl.
4443
/// \returns true if it failed, false on success.
45-
bool printValueDeclUSR(const ValueDecl *D, raw_ostream &OS);
44+
bool printDeclUSR(const ValueDecl *D, raw_ostream &OS);
4645

4746
/// Prints out the USR for the given ModuleEntity.
4847
/// \returns true if it failed, false on success.
@@ -57,10 +56,6 @@ bool printAccessorUSR(const AbstractStorageDecl *D, AccessorKind AccKind,
5756
/// \returns true if it failed, false on success.
5857
bool printExtensionUSR(const ExtensionDecl *ED, raw_ostream &OS);
5958

60-
/// Prints out the USR for the given Decl.
61-
/// \returns true if it failed, false on success.
62-
bool printDeclUSR(const Decl *D, raw_ostream &OS);
63-
6459
} // namespace ide
6560
} // namespace swift
6661

trunk/include/swift/Frontend/Frontend.h

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,6 @@ class CompilerInstance {
395395
struct PartialModuleInputs {
396396
std::unique_ptr<llvm::MemoryBuffer> ModuleBuffer;
397397
std::unique_ptr<llvm::MemoryBuffer> ModuleDocBuffer;
398-
std::unique_ptr<llvm::MemoryBuffer> ModuleSourceInfoBuffer;
399398
};
400399

401400
/// Contains \c MemoryBuffers for partial serialized module files and
@@ -556,35 +555,20 @@ class CompilerInstance {
556555

557556
Optional<unsigned> getRecordedBufferID(const InputFile &input, bool &failed);
558557

559-
struct ModuleBuffers {
560-
std::unique_ptr<llvm::MemoryBuffer> ModuleBuffer;
561-
std::unique_ptr<llvm::MemoryBuffer> ModuleDocBuffer;
562-
std::unique_ptr<llvm::MemoryBuffer> ModuleSourceInfoBuffer;
563-
ModuleBuffers(std::unique_ptr<llvm::MemoryBuffer> ModuleBuffer,
564-
std::unique_ptr<llvm::MemoryBuffer> ModuleDocBuffer = nullptr,
565-
std::unique_ptr<llvm::MemoryBuffer> ModuleSourceInfoBuffer = nullptr):
566-
ModuleBuffer(std::move(ModuleBuffer)),
567-
ModuleDocBuffer(std::move(ModuleDocBuffer)),
568-
ModuleSourceInfoBuffer(std::move(ModuleSourceInfoBuffer)) {}
569-
};
570-
571558
/// Given an input file, return a buffer to use for its contents,
572559
/// and a buffer for the corresponding module doc file if one exists.
573560
/// On failure, return a null pointer for the first element of the returned
574561
/// pair.
575-
Optional<ModuleBuffers> getInputBuffersIfPresent(const InputFile &input);
562+
std::pair<std::unique_ptr<llvm::MemoryBuffer>,
563+
std::unique_ptr<llvm::MemoryBuffer>>
564+
getInputBufferAndModuleDocBufferIfPresent(const InputFile &input);
576565

577566
/// Try to open the module doc file corresponding to the input parameter.
578567
/// Return None for error, nullptr if no such file exists, or the buffer if
579568
/// one was found.
580569
Optional<std::unique_ptr<llvm::MemoryBuffer>>
581570
openModuleDoc(const InputFile &input);
582571

583-
/// Try to open the module source info file corresponding to the input parameter.
584-
/// Return None for error, nullptr if no such file exists, or the buffer if
585-
/// one was found.
586-
Optional<std::unique_ptr<llvm::MemoryBuffer>>
587-
openModuleSourceInfo(const InputFile &input);
588572
public:
589573
/// Parses and type-checks all input files.
590574
void performSema();

trunk/include/swift/Frontend/ModuleInterfaceLoader.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,8 @@ class ModuleInterfaceLoader : public SerializedModuleLoaderBase {
149149
std::error_code findModuleFilesInDirectory(
150150
AccessPathElem ModuleID, StringRef DirPath, StringRef ModuleFilename,
151151
StringRef ModuleDocFilename,
152-
StringRef ModuleSourceInfoFilename,
153152
std::unique_ptr<llvm::MemoryBuffer> *ModuleBuffer,
154-
std::unique_ptr<llvm::MemoryBuffer> *ModuleDocBuffer,
155-
std::unique_ptr<llvm::MemoryBuffer> *ModuleSourceInfoBuffer) override;
153+
std::unique_ptr<llvm::MemoryBuffer> *ModuleDocBuffer) override;
156154

157155
bool isCached(StringRef DepPath) override;
158156

trunk/include/swift/Parse/ASTGen.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ class ASTGen {
8787
Expr *generate(const syntax::SuperRefExprSyntax &Expr, const SourceLoc Loc);
8888
Expr *generate(const syntax::ArrayExprSyntax &Expr, const SourceLoc Loc);
8989
Expr *generate(const syntax::DictionaryExprSyntax &Expr, const SourceLoc Loc);
90-
Expr *generate(const syntax::TupleExprSyntax &E, const SourceLoc Loc);
9190
Expr *generate(const syntax::EditorPlaceholderExprSyntax &Expr,
9291
const SourceLoc Loc);
9392
Expr *generate(const syntax::SpecializeExprSyntax &Expr, const SourceLoc Loc);
@@ -113,12 +112,6 @@ class ASTGen {
113112
const Optional<syntax::DeclNameArgumentsSyntax> &args,
114113
const SourceLoc Loc);
115114

116-
void generateExprTupleElementList(const syntax::TupleExprElementListSyntax &elements,
117-
const SourceLoc Loc, bool isForCallArguments,
118-
SmallVectorImpl<Expr *> &exprs,
119-
SmallVectorImpl<Identifier> &exprLabels,
120-
SmallVectorImpl<SourceLoc> &exprLabelLocs);
121-
122115
private:
123116
void validateCollectionElement(Expr *elementExpr);
124117

trunk/include/swift/Parse/Parser.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1558,11 +1558,8 @@ class Parser {
15581558
SourceLoc &inLoc);
15591559

15601560
Expr *parseExprAnonClosureArg();
1561-
ParserResult<Expr> parseExprParenOrTuple();
1562-
ParsedSyntaxResult<ParsedExprSyntax> parseExprTupleSyntax();
1563-
ParserStatus parseExprTupleElementListSyntax(
1564-
SmallVectorImpl<ParsedTupleExprElementSyntax> &elements,
1565-
llvm::function_ref<bool()> isAtCloseTok);
1561+
ParserResult<Expr> parseExprList(tok LeftTok, tok RightTok,
1562+
syntax::SyntaxKind Kind);
15661563

15671564
/// Parse an expression list, keeping all of the pieces separated.
15681565
ParserStatus parseExprList(tok leftTok, tok rightTok,
@@ -1573,7 +1570,8 @@ class Parser {
15731570
SmallVectorImpl<Identifier> &exprLabels,
15741571
SmallVectorImpl<SourceLoc> &exprLabelLocs,
15751572
SourceLoc &rightLoc,
1576-
Expr *&trailingClosure);
1573+
Expr *&trailingClosure,
1574+
syntax::SyntaxKind Kind);
15771575

15781576
ParserResult<Expr> parseTrailingClosure(SourceRange calleeRange);
15791577

0 commit comments

Comments
 (0)