Skip to content

Commit aca7898

Browse files
committed
---
yaml --- r: 341982 b: refs/heads/rxwei-patch-1 c: ab86991 h: refs/heads/master
1 parent 7dfb18b commit aca7898

File tree

229 files changed

+1651
-2529
lines changed

Some content is hidden

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

229 files changed

+1651
-2529
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,7 @@ refs/tags/swift-DEVELOPMENT-SNAPSHOT-2018-08-18-a: b10b1fce14385faa6d44f6b933e95
10151015
refs/heads/rdar-43033749-fix-batch-mode-no-diags-swift-5.0-branch: a14e64eaad30de89f0f5f0b2a782eed7ecdcb255
10161016
refs/heads/revert-19006-error-bridging-integer-type: 8a9065a3696535305ea53fe9b71f91cbe6702019
10171017
refs/heads/revert-19050-revert-19006-error-bridging-integer-type: ecf752d54b05dd0a20f510f0bfa54a3fec3bcaca
1018-
refs/heads/rxwei-patch-1: da61cc8cdf7aa2bfb3ab03200c52c4d371dc6751
1018+
refs/heads/rxwei-patch-1: ab8699195840c05ddc9e1e4f0c6d26812f90654b
10191019
refs/heads/shahmishal-patch-1: e58ec0f7488258d42bef51bc3e6d7b3dc74d7b2a
10201020
refs/heads/typelist-existential: 4046359efd541fb5c72d69a92eefc0a784df8f5e
10211021
refs/tags/swift-4.2-DEVELOPMENT-SNAPSHOT-2018-08-20-a: 4319ba09e4fb8650ee86061075c74a016b6baab9

branches/rxwei-patch-1/CHANGELOG.md

Lines changed: 16 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,27 @@ CHANGELOG
2626
Swift Next
2727
----------
2828

29-
* [SR-4206][]:
29+
* [SR-8974][]:
3030

31-
A method override is no longer allowed to have a generic signature with
32-
requirements not imposed by the base method. For example:
31+
Duplicate tuple element labels are no longer allowed, because it leads
32+
to incorrect behavior. For example:
3333

3434
```
35-
protocol P {}
36-
37-
class Base {
38-
func foo<T>(arg: T) {}
39-
}
40-
41-
class Derived: Base {
42-
override func foo<T: P>(arg: T) {}
43-
}
35+
let dupLabels: (foo: Int, foo: Int) = (foo: 1, foo: 2)
36+
37+
enum Foo { case bar(x: Int, x: Int) }
38+
let f: Foo = .bar(x: 0, x: 1)
4439
```
4540

46-
will now be diagnosed as an error.
41+
will now be diagnosed as an error.
42+
43+
Note: You can still use duplicate labels when declaring functions and
44+
subscripts, as long as the internal labels are different. For example:
45+
46+
```
47+
func foo(bar x: Int, bar y: Int) {}
48+
subscript(a x: Int, a y: Int) -> Int {}
49+
```
4750

4851
* [SR-6118][]:
4952

@@ -65,28 +68,6 @@ Swift Next
6568
Swift 5.1
6669
---------
6770

68-
* [SR-8974][]:
69-
70-
Duplicate tuple element labels are no longer allowed, because it leads
71-
to incorrect behavior. For example:
72-
73-
```
74-
let dupLabels: (foo: Int, foo: Int) = (foo: 1, foo: 2)
75-
76-
enum Foo { case bar(x: Int, x: Int) }
77-
let f: Foo = .bar(x: 0, x: 1)
78-
```
79-
80-
will now be diagnosed as an error.
81-
82-
Note: You can still use duplicate argument labels when declaring functions and
83-
subscripts, as long as the internal parameter names are different. For example:
84-
85-
```
86-
func foo(bar x: Int, bar y: Int) {}
87-
subscript(a x: Int, a y: Int) -> Int {}
88-
```
89-
9071
* [SE-0244][]:
9172

9273
Functions can now hide their concrete return type by declaring what protocols
@@ -7727,7 +7708,6 @@ Swift 1.0
77277708
[SR-2608]: <https://bugs.swift.org/browse/SR-2608>
77287709
[SR-2672]: <https://bugs.swift.org/browse/SR-2672>
77297710
[SR-2688]: <https://bugs.swift.org/browse/SR-2688>
7730-
[SR-4206]: <https://bugs.swift.org/browse/SR-4206>
77317711
[SR-4248]: <https://bugs.swift.org/browse/SR-4248>
77327712
[SR-5581]: <https://bugs.swift.org/browse/SR-5581>
77337713
[SR-5719]: <https://bugs.swift.org/browse/SR-5719>

branches/rxwei-patch-1/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ Please make sure you use Python 2.x. Python 3.x is not supported currently.
7676

7777
#### macOS
7878

79-
To build for macOS, you need [Xcode 11 beta 4](https://developer.apple.com/xcode/downloads/).
79+
To build for macOS, you need [Xcode 11 beta](https://developer.apple.com/xcode/downloads/).
8080
The required version of Xcode changes frequently, and is often a beta release.
8181
Check this document or the host information on <https://ci.swift.org> for the
8282
current required version.

branches/rxwei-patch-1/cmake/modules/AddSwift.cmake

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1512,9 +1512,10 @@ function(add_swift_host_library name)
15121512

15131513
if(NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
15141514
swift_install_in_component(TARGETS ${name}
1515-
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT dev
1516-
LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT dev
1517-
RUNTIME DESTINATION bin COMPONENT dev)
1515+
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
1516+
LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
1517+
RUNTIME DESTINATION bin
1518+
COMPONENT dev)
15181519
endif()
15191520

15201521
swift_is_installing_component(dev is_installing)
@@ -2138,15 +2139,10 @@ function(add_swift_target_library name)
21382139

21392140
if(sdk STREQUAL WINDOWS AND CMAKE_SYSTEM_NAME STREQUAL Windows)
21402141
swift_install_in_component(TARGETS ${name}-windows-${SWIFT_PRIMARY_VARIANT_ARCH}
2141-
RUNTIME
2142-
DESTINATION "bin"
2143-
COMPONENT "${SWIFTLIB_INSTALL_IN_COMPONENT}"
2144-
LIBRARY
2145-
DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/${resource_dir}/${resource_dir_sdk_subdir}/${SWIFT_PRIMARY_VARIANT_ARCH}"
2146-
COMPONENT "${SWIFTLIB_INSTALL_IN_COMPONENT}"
2147-
ARCHIVE
2148-
DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/${resource_dir}/${resource_dir_sdk_subdir}/${SWIFT_PRIMARY_VARIANT_ARCH}"
2149-
COMPONENT "${SWIFTLIB_INSTALL_IN_COMPONENT}"
2142+
RUNTIME DESTINATION "bin"
2143+
LIBRARY DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/${resource_dir}/${resource_dir_sdk_subdir}/${SWIFT_PRIMARY_VARIANT_ARCH}"
2144+
ARCHIVE DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/${resource_dir}/${resource_dir_sdk_subdir}/${SWIFT_PRIMARY_VARIANT_ARCH}"
2145+
COMPONENT "${SWIFTLIB_INSTALL_IN_COMPONENT}"
21502146
PERMISSIONS ${file_permissions})
21512147
else()
21522148
swift_install_in_component(FILES "${UNIVERSAL_LIBRARY_NAME}"
@@ -2427,9 +2423,8 @@ function(add_swift_host_tool executable)
24272423
${ASHT_UNPARSED_ARGUMENTS})
24282424

24292425
swift_install_in_component(TARGETS ${executable}
2430-
RUNTIME
2431-
DESTINATION bin
2432-
COMPONENT ${ASHT_SWIFT_COMPONENT})
2426+
RUNTIME DESTINATION bin
2427+
COMPONENT ${ASHT_SWIFT_COMPONENT})
24332428

24342429
swift_is_installing_component(${ASHT_SWIFT_COMPONENT} is_installing)
24352430

branches/rxwei-patch-1/docs/StandardLibraryProgrammersManual.md

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,19 +50,6 @@ TODO: Should this subsume or link to [AccessControlInStdlib.rst](https://github.
5050

5151
Optionals can be unwrapped with `!`, which triggers a trap on nil. Alternatively, they can be `.unsafelyUnwrapped()`, which will check and trap in debug builds of user code. Internal to the standard library is `._unsafelyUnwrappedUnchecked()` which will only check and trap in debug builds of the standard library itself. These correspond directly with `_precondition`, `_debugPrecondition`, and `_sanityCheck`. See [that section](#precondition) for details.
5252

53-
#### UnsafeBitCast and Casting References
54-
55-
In general `unsafeBitCast` should be avoided because it's correctness relies on subtle assumptions that will never be enforced, and it indicates a bug in Swift's type system that should be fixed. It's less bad for non-pointer trivial types. Pointer casting should go through one of the memory binding API instead as a last resort.
56-
57-
Reference casting is more interesting. References casting can include converting to an Optional reference and converting from a class constrained existential.
58-
59-
The regular `as` operator should be able to convert between reference types with full dynamic checking.
60-
61-
`unsafeDownCast` is just as capable, but is only dynamically checked in debug mode or if the cast requires runtime support.
62-
63-
`_unsafeUncheckedDowncast` is the same but is only dynamically checked in the stdlib asserts build, or if the cast requires runtime support.
64-
65-
`_unsafeReferenceCast` is only dynamically checked if the cast requires runtime support. Additionally, it does not impose any static `AnyObject` constraint on the incoming reference. This is useful in a generic context where the object-ness can be determined dynamically, as done in some bridged containers.
6653

6754
### Builtins
6855

branches/rxwei-patch-1/include/swift/AST/Builtins.def

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -314,11 +314,6 @@ BUILTIN_SIL_OPERATION(BeginUnpairedModifyAccess, "beginUnpairedModifyAccess",
314314
/// be a pointer to an UnsafeValueBuffer that records an in progress access.
315315
BUILTIN_SIL_OPERATION(EndUnpairedAccess, "endUnpairedAccess", Special)
316316

317-
/// condfail(Int1) -> ()
318-
/// Triggers a runtime failure if the condition is true.
319-
/// This builtin is deprecated. Use condfail_message instead.
320-
BUILTIN_SIL_OPERATION(LegacyCondFail, "condfail", Special)
321-
322317
/// fixLifetime(T) -> ()
323318
/// Fixes the lifetime of any heap references in a value.
324319
BUILTIN_SIL_OPERATION(FixLifetime, "fixLifetime", Special)
@@ -405,9 +400,9 @@ BUILTIN_RUNTIME_CALL(IsOptionalType, "isOptional", "")
405400
BUILTIN(Id, Name, Attrs)
406401
#endif
407402

408-
/// condfail_message(Int1, RawPointer) -> ()
403+
/// condfail(Int1, RawPointer) -> ()
409404
/// Triggers a runtime failure if the condition is true.
410-
BUILTIN_MISC_OPERATION(CondFailMessage, "condfail_message", "", Special)
405+
BUILTIN_MISC_OPERATION(CondFail, "condfail", "", Special)
411406

412407
/// Sizeof has type T.Type -> Int
413408
BUILTIN_MISC_OPERATION(Sizeof, "sizeof", "n", Special)

branches/rxwei-patch-1/include/swift/AST/Decl.h

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4105,20 +4105,7 @@ class ProtocolDecl final : public NominalTypeDecl {
41054105
/// by this protocol.
41064106
const Requirement *RequirementSignature = nullptr;
41074107

4108-
/// Returns the cached result of \c requiresClass or \c None if it hasn't yet
4109-
/// been computed.
4110-
Optional<bool> getCachedRequiresClass() const {
4111-
if (Bits.ProtocolDecl.RequiresClassValid)
4112-
return Bits.ProtocolDecl.RequiresClass;
4113-
4114-
return None;
4115-
}
4116-
4117-
/// Caches the result of \c requiresClass
4118-
void setCachedRequiresClass(bool requiresClass) {
4119-
Bits.ProtocolDecl.RequiresClassValid = true;
4120-
Bits.ProtocolDecl.RequiresClass = requiresClass;
4121-
}
4108+
bool requiresClassSlow();
41224109

41234110
bool existentialConformsToSelfSlow();
41244111

@@ -4133,7 +4120,6 @@ class ProtocolDecl final : public NominalTypeDecl {
41334120
friend class SuperclassDeclRequest;
41344121
friend class SuperclassTypeRequest;
41354122
friend class RequirementSignatureRequest;
4136-
friend class ProtocolRequiresClassRequest;
41374123
friend class TypeChecker;
41384124

41394125
public:
@@ -4197,7 +4183,19 @@ class ProtocolDecl final : public NominalTypeDecl {
41974183
}
41984184

41994185
/// True if this protocol can only be conformed to by class types.
4200-
bool requiresClass() const;
4186+
bool requiresClass() const {
4187+
if (Bits.ProtocolDecl.RequiresClassValid)
4188+
return Bits.ProtocolDecl.RequiresClass;
4189+
4190+
return const_cast<ProtocolDecl *>(this)->requiresClassSlow();
4191+
}
4192+
4193+
/// Specify that this protocol is class-bounded, e.g., because it was
4194+
/// annotated with the 'class' keyword.
4195+
void setRequiresClass(bool requiresClass = true) {
4196+
Bits.ProtocolDecl.RequiresClassValid = true;
4197+
Bits.ProtocolDecl.RequiresClass = requiresClass;
4198+
}
42014199

42024200
/// Determine whether an existential conforming to this protocol can be
42034201
/// matched with a generic type parameter constrained to this protocol.

branches/rxwei-patch-1/include/swift/AST/DiagnosticsCommon.def

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,6 @@ ERROR(circular_class_inheritance,none,
153153
ERROR(circular_enum_inheritance,none,
154154
"%0 has a raw type that depends on itself", (Identifier))
155155

156-
ERROR(circular_protocol_def,none,
157-
"protocol %0 refines itself", (Identifier))
158-
159-
NOTE(kind_declname_declared_here,none,
160-
"%0 %1 declared here", (DescriptiveDeclKind, DeclName))
161-
162156
#ifndef DIAG_NO_UNDEF
163157
# if defined(DIAG)
164158
# undef DIAG

branches/rxwei-patch-1/include/swift/AST/DiagnosticsParse.def

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -762,13 +762,6 @@ ERROR(extra_rbracket,PointsToFirstBadToken,
762762
"unexpected ']' in type; did you mean to write an array type?", ())
763763
ERROR(extra_colon,PointsToFirstBadToken,
764764
"unexpected ':' in type; did you mean to write a dictionary type?", ())
765-
WARNING(subscript_array_element, none,
766-
"unexpected subscript in array literal; did you mean to write two "
767-
"separate elements instead?", ())
768-
NOTE(subscript_array_element_fix_it_add_comma, none, "add a separator between "
769-
"the elements", ())
770-
NOTE(subscript_array_element_fix_it_remove_space, none,
771-
"remove the space between the elements to silence this warning", ())
772765

773766
// Tuple Types
774767
ERROR(expected_rparen_tuple_type_list,none,
@@ -861,8 +854,6 @@ ERROR(expected_parameter_name,PointsToFirstBadToken,
861854
"expected parameter name followed by ':'", ())
862855
ERROR(expected_parameter_colon,PointsToFirstBadToken,
863856
"expected ':' following argument label and parameter name", ())
864-
ERROR(expected_assignment_instead_of_comparison_operator,none,
865-
"expected '=' instead of '==' to assign default value for parameter", ())
866857
ERROR(missing_parameter_type,PointsToFirstBadToken,
867858
"parameter requires an explicit type", ())
868859
ERROR(multiple_parameter_ellipsis,none,

branches/rxwei-patch-1/include/swift/AST/DiagnosticsSema.def

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
DIAG(NOTE,ID,Options,Text,Signature)
3838
#endif
3939

40+
NOTE(kind_declname_declared_here,none,
41+
"%0 %1 declared here", (DescriptiveDeclKind, DeclName))
4042
NOTE(decl_declared_here,none,
4143
"%0 declared here", (DeclName))
4244
NOTE(kind_declared_here,none,
@@ -2035,6 +2037,8 @@ ERROR(typealias_outside_of_protocol,none,
20352037
"type alias %0 can only be used with a concrete type or "
20362038
"generic parameter base", (Identifier))
20372039

2040+
ERROR(circular_protocol_def,none,
2041+
"protocol %0 refines itself", (Identifier))
20382042
ERROR(objc_protocol_inherits_non_objc_protocol,none,
20392043
"@objc protocol %0 cannot refine non-@objc protocol %1", (Type, Type))
20402044

branches/rxwei-patch-1/include/swift/AST/TypeCheckRequests.h

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -176,31 +176,6 @@ class IsObjCRequest :
176176
void cacheResult(bool value) const;
177177
};
178178

179-
/// Determine whether the given protocol declaration is class-bounded.
180-
class ProtocolRequiresClassRequest:
181-
public SimpleRequest<ProtocolRequiresClassRequest,
182-
bool(ProtocolDecl *),
183-
CacheKind::SeparatelyCached> {
184-
public:
185-
using SimpleRequest::SimpleRequest;
186-
187-
private:
188-
friend SimpleRequest;
189-
190-
// Evaluation.
191-
llvm::Expected<bool> evaluate(Evaluator &evaluator, ProtocolDecl *decl) const;
192-
193-
public:
194-
// Cycle handling.
195-
void diagnoseCycle(DiagnosticEngine &diags) const;
196-
void noteCycleStep(DiagnosticEngine &diags) const;
197-
198-
// Separate caching.
199-
bool isCached() const { return true; }
200-
Optional<bool> getCachedResult() const;
201-
void cacheResult(bool value) const;
202-
};
203-
204179
/// Determine whether the given declaration is 'final'.
205180
class IsFinalRequest :
206181
public SimpleRequest<IsFinalRequest,

branches/rxwei-patch-1/include/swift/AST/TypeCheckerTypeIDZone.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ SWIFT_TYPEID(SuperclassTypeRequest)
1919
SWIFT_TYPEID(EnumRawTypeRequest)
2020
SWIFT_TYPEID(OverriddenDeclsRequest)
2121
SWIFT_TYPEID(IsObjCRequest)
22-
SWIFT_TYPEID(ProtocolRequiresClassRequest)
2322
SWIFT_TYPEID(IsFinalRequest)
2423
SWIFT_TYPEID(IsDynamicRequest)
2524
SWIFT_TYPEID(RequirementRequest)

branches/rxwei-patch-1/include/swift/AST/Types.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -461,10 +461,6 @@ class alignas(1 << TypeAlignInBits) TypeBase {
461461
/// types, optionals, etc.
462462
TypeBase *reconstituteSugar(bool Recursive);
463463

464-
// If this type is a syntax sugar type, desugar it. Also desugar any nested
465-
// syntax sugar types.
466-
TypeBase *getWithoutSyntaxSugar();
467-
468464
/// getASTContext - Return the ASTContext that this type belongs to.
469465
ASTContext &getASTContext() {
470466
// If this type is canonical, it has the ASTContext in it.

branches/rxwei-patch-1/include/swift/ClangImporter/ClangImporterOptions.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,6 @@ class ClangImporterOptions {
100100
/// When set, don't enforce warnings with -Werror.
101101
bool DebuggerSupport = false;
102102

103-
/// When set, clobber the Clang instance's virtual file system with the Swift
104-
/// virtual file system.
105-
bool ForceUseSwiftVirtualFileSystem = false;
106-
107103
/// Return a hash code of any components from these options that should
108104
/// contribute to a Swift Bridging PCH hash.
109105
llvm::hash_code getPCHHashComponents() const {

branches/rxwei-patch-1/include/swift/Index/Utils.h

Lines changed: 0 additions & 41 deletions
This file was deleted.

0 commit comments

Comments
 (0)