Skip to content

Commit 01f6b6b

Browse files
authored
---
yaml --- r: 348989 b: refs/heads/master c: 12231d2 h: refs/heads/master i: 348987: 7330db1
1 parent 3b396dd commit 01f6b6b

File tree

80 files changed

+1632
-465
lines changed

Some content is hidden

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

80 files changed

+1632
-465
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: 6701a7efcf917d1ea3a7888b0ea36edee391cfef
2+
refs/heads/master: 12231d2df32c2960f44dc3cd6a0affafefc836be
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: 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/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/DeclContext.h

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

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

trunk/include/swift/AST/DiagnosticsParse.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -970,6 +970,8 @@ 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", ())
973975

974976
// Defer Statement
975977
ERROR(expected_lbrace_after_defer,PointsToFirstBadToken,

trunk/include/swift/AST/FileUnit.h

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

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

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

trunk/include/swift/AST/RawComment.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,19 @@ 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+
8194
} // namespace swift
8295

8396
#endif // LLVM_SWIFT_AST_RAW_COMMENT_H

trunk/include/swift/AST/SourceFile.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ 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;
279280

280281
virtual bool walk(ASTWalker &walker) override;
281282

trunk/include/swift/AST/USRGeneration.h

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

2424
namespace swift {
25+
class Decl;
2526
class AbstractStorageDecl;
2627
class ValueDecl;
2728
class ExtensionDecl;
@@ -39,9 +40,9 @@ bool printTypeUSR(Type Ty, raw_ostream &OS);
3940
/// \returns true if it failed, false on success.
4041
bool printDeclTypeUSR(const ValueDecl *D, raw_ostream &OS);
4142

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

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

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+
5964
} // namespace ide
6065
} // namespace swift
6166

trunk/include/swift/Frontend/Frontend.h

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,7 @@ 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;
398399
};
399400

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

556557
Optional<unsigned> getRecordedBufferID(const InputFile &input, bool &failed);
557558

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+
558571
/// Given an input file, return a buffer to use for its contents,
559572
/// and a buffer for the corresponding module doc file if one exists.
560573
/// On failure, return a null pointer for the first element of the returned
561574
/// pair.
562-
std::pair<std::unique_ptr<llvm::MemoryBuffer>,
563-
std::unique_ptr<llvm::MemoryBuffer>>
564-
getInputBufferAndModuleDocBufferIfPresent(const InputFile &input);
575+
Optional<ModuleBuffers> getInputBuffersIfPresent(const InputFile &input);
565576

566577
/// Try to open the module doc file corresponding to the input parameter.
567578
/// Return None for error, nullptr if no such file exists, or the buffer if
568579
/// one was found.
569580
Optional<std::unique_ptr<llvm::MemoryBuffer>>
570581
openModuleDoc(const InputFile &input);
571582

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);
572588
public:
573589
/// Parses and type-checks all input files.
574590
void performSema();

trunk/include/swift/Frontend/ModuleInterfaceLoader.h

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

155157
bool isCached(StringRef DepPath) override;
156158

trunk/include/swift/Parse/ASTGen.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ 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);
9091
Expr *generate(const syntax::EditorPlaceholderExprSyntax &Expr,
9192
const SourceLoc Loc);
9293
Expr *generate(const syntax::SpecializeExprSyntax &Expr, const SourceLoc Loc);
@@ -112,6 +113,12 @@ class ASTGen {
112113
const Optional<syntax::DeclNameArgumentsSyntax> &args,
113114
const SourceLoc Loc);
114115

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+
115122
private:
116123
void validateCollectionElement(Expr *elementExpr);
117124

trunk/include/swift/Parse/Parser.h

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

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

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

15761578
ParserResult<Expr> parseTrailingClosure(SourceRange calleeRange);
15771579

0 commit comments

Comments
 (0)