Skip to content

Commit d433bf5

Browse files
authored
---
yaml --- r: 341949 b: refs/heads/rxwei-patch-1 c: f931572 h: refs/heads/master i: 341947: 1585e77
1 parent 4f2a2d4 commit d433bf5

File tree

176 files changed

+3811
-1993
lines changed

Some content is hidden

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

176 files changed

+3811
-1993
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: c6f4e2a23abf3667ebd9104a681103d9370edee3
1018+
refs/heads/rxwei-patch-1: f9315728eb39539c6f6445020fac49d3771eaef6
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: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,27 +26,24 @@ CHANGELOG
2626
Swift Next
2727
----------
2828

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

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

3434
```
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)
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+
}
3944
```
4045

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-
```
46+
will now be diagnosed as an error.
5047

5148
* [SR-6118][]:
5249

@@ -68,6 +65,28 @@ Swift Next
6865
Swift 5.1
6966
---------
7067

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+
7190
* [SE-0244][]:
7291

7392
Functions can now hide their concrete return type by declaring what protocols
@@ -7708,6 +7727,7 @@ Swift 1.0
77087727
[SR-2608]: <https://bugs.swift.org/browse/SR-2608>
77097728
[SR-2672]: <https://bugs.swift.org/browse/SR-2672>
77107729
[SR-2688]: <https://bugs.swift.org/browse/SR-2688>
7730+
[SR-4206]: <https://bugs.swift.org/browse/SR-4206>
77117731
[SR-4248]: <https://bugs.swift.org/browse/SR-4248>
77127732
[SR-5581]: <https://bugs.swift.org/browse/SR-5581>
77137733
[SR-5719]: <https://bugs.swift.org/browse/SR-5719>

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

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1512,10 +1512,9 @@ 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}
1516-
LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
1517-
RUNTIME DESTINATION bin
1518-
COMPONENT dev)
1515+
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT dev
1516+
LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT dev
1517+
RUNTIME DESTINATION bin COMPONENT dev)
15191518
endif()
15201519

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

21402139
if(sdk STREQUAL WINDOWS AND CMAKE_SYSTEM_NAME STREQUAL Windows)
21412140
swift_install_in_component(TARGETS ${name}-windows-${SWIFT_PRIMARY_VARIANT_ARCH}
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}"
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}"
21462150
PERMISSIONS ${file_permissions})
21472151
else()
21482152
swift_install_in_component(FILES "${UNIVERSAL_LIBRARY_NAME}"
@@ -2423,8 +2427,9 @@ function(add_swift_host_tool executable)
24232427
${ASHT_UNPARSED_ARGUMENTS})
24242428

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

24292434
swift_is_installing_component(${ASHT_SWIFT_COMPONENT} is_installing)
24302435

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
//===----------------------------------------------------------------------===//
1717
SWIFT_TYPEID_NAMED(NominalTypeDecl *, NominalTypeDecl)
1818
SWIFT_TYPEID_NAMED(VarDecl *, VarDecl)
19+
SWIFT_TYPEID_NAMED(Decl *, Decl)
1920
SWIFT_TYPEID(Type)
2021
SWIFT_TYPEID(PropertyWrapperBackingPropertyInfo)
2122
SWIFT_TYPEID(PropertyWrapperTypeInfo)

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,11 @@ 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+
317322
/// fixLifetime(T) -> ()
318323
/// Fixes the lifetime of any heap references in a value.
319324
BUILTIN_SIL_OPERATION(FixLifetime, "fixLifetime", Special)
@@ -400,9 +405,9 @@ BUILTIN_RUNTIME_CALL(IsOptionalType, "isOptional", "")
400405
BUILTIN(Id, Name, Attrs)
401406
#endif
402407

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

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

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

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@
1717
#ifndef SWIFT_AST_BUILTINS_H
1818
#define SWIFT_AST_BUILTINS_H
1919

20+
#include "swift/AST/Type.h"
21+
#include "swift/AST/Types.h"
2022
#include "swift/Basic/LLVM.h"
2123
#include "llvm/ADT/SmallVector.h"
2224
#include "llvm/IR/Attributes.h"
23-
#include "swift/AST/Type.h"
2425
#include "llvm/IR/Intrinsics.h"
2526
#include "llvm/Support/ErrorHandling.h"
2627

@@ -29,9 +30,17 @@ enum class AtomicOrdering;
2930
}
3031

3132
namespace swift {
32-
class ASTContext;
33-
class Identifier;
34-
class ValueDecl;
33+
34+
class ASTContext;
35+
class Identifier;
36+
class ValueDecl;
37+
38+
enum class BuiltinTypeKind : std::underlying_type<TypeKind>::type {
39+
#define TYPE(id, parent)
40+
#define BUILTIN_TYPE(id, parent) \
41+
id = std::underlying_type<TypeKind>::type(TypeKind::id),
42+
#include "swift/AST/TypeNodes.def"
43+
};
3544

3645
/// Get the builtin type for the given name.
3746
///
@@ -89,7 +98,6 @@ llvm::Intrinsic::ID getLLVMIntrinsicID(StringRef Name);
8998
llvm::Intrinsic::ID
9099
getLLVMIntrinsicIDForBuiltinWithOverflow(BuiltinValueKind ID);
91100

92-
93101
/// Create a ValueDecl for the builtin with the given name.
94102
///
95103
/// Returns null if the name does not identifier a known builtin value.

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

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3451,40 +3451,12 @@ class NominalTypeDecl : public GenericTypeDecl, public IterableDeclContext {
34513451
/// Retrieve information about this type as a property wrapper.
34523452
PropertyWrapperTypeInfo getPropertyWrapperTypeInfo() const;
34533453

3454-
private:
3455-
/// Predicate used to filter StoredPropertyRange.
3456-
struct ToStoredProperty {
3457-
ToStoredProperty() {}
3458-
Optional<VarDecl *> operator()(Decl *decl) const;
3459-
};
3460-
3461-
public:
3462-
/// A range for iterating the stored member variables of a structure.
3463-
using StoredPropertyRange = OptionalTransformRange<DeclRange,
3464-
ToStoredProperty>;
3465-
34663454
/// Return a collection of the stored member variables of this type.
3467-
StoredPropertyRange getStoredProperties() const;
3455+
ArrayRef<VarDecl *> getStoredProperties() const;
34683456

3469-
private:
3470-
/// Predicate used to filter StoredPropertyRange.
3471-
struct ToStoredPropertyOrMissingMemberPlaceholder {
3472-
Optional<Decl *> operator()(Decl *decl) const;
3473-
};
3474-
3475-
public:
3476-
/// A range for iterating the stored member variables of a structure.
3477-
using StoredPropertyOrMissingMemberPlaceholderRange
3478-
= OptionalTransformRange<DeclRange,
3479-
ToStoredPropertyOrMissingMemberPlaceholder>;
3480-
34813457
/// Return a collection of the stored member variables of this type, along
34823458
/// with placeholders for unimportable stored properties.
3483-
StoredPropertyOrMissingMemberPlaceholderRange
3484-
getStoredPropertiesAndMissingMemberPlaceholders() const {
3485-
return StoredPropertyOrMissingMemberPlaceholderRange(getMembers(),
3486-
ToStoredPropertyOrMissingMemberPlaceholder());
3487-
}
3459+
ArrayRef<Decl *> getStoredPropertiesAndMissingMemberPlaceholders() const;
34883460

34893461
// Implement isa/cast/dyncast/etc.
34903462
static bool classof(const Decl *D) {

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,9 @@ ERROR(cannot_convert_default_arg_value,none,
350350
(Type,Type))
351351
ERROR(cannot_convert_default_arg_value_protocol,none,
352352
"default argument value of type %0 does not conform to %1", (Type,Type))
353+
ERROR(default_argument_literal_cannot_convert, none,
354+
"cannot call %0 %1 because default argument of type %2 cannot be "
355+
"converted to type %3", (DescriptiveDeclKind, DeclName, Type, Type))
353356
ERROR(cannot_convert_default_arg_value_nil,none,
354357
"nil default argument value cannot be converted to type %0", (Type))
355358

@@ -3392,9 +3395,12 @@ ERROR(closure_tuple_parameter_destructuring_implicit,none,
33923395
ERROR(nested_tuple_parameter_destructuring,none,
33933396
"nested tuple parameter %0 of function %1 "
33943397
"does not support destructuring", (Type, Type))
3395-
ERROR(single_tuple_parameter_mismatch,none,
3396-
"%0 %select{|%1 }3expects a single parameter of type %2",
3397-
(DescriptiveDeclKind, Identifier, Type, bool))
3398+
ERROR(single_tuple_parameter_mismatch_special,none,
3399+
"%0 expects a single parameter of type %1%2",
3400+
(DescriptiveDeclKind, Type, StringRef))
3401+
ERROR(single_tuple_parameter_mismatch_normal,none,
3402+
"%0 %1 expects a single parameter of type %2%3",
3403+
(DescriptiveDeclKind, DeclBaseName, Type, StringRef))
33983404
ERROR(unknown_single_tuple_parameter_mismatch,none,
33993405
"single parameter of type %0 is expected in call", (Type))
34003406

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

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -713,6 +713,52 @@ class TypeCheckFunctionBodyUntilRequest :
713713
bool isCached() const { return true; }
714714
};
715715

716+
/// Request to obtain a list of stored properties in a nominal type.
717+
///
718+
/// This will include backing storage for lazy properties and
719+
/// property wrappers, synthesizing them if necessary.
720+
class StoredPropertiesRequest :
721+
public SimpleRequest<StoredPropertiesRequest,
722+
ArrayRef<VarDecl *>(NominalTypeDecl *),
723+
CacheKind::Cached> {
724+
public:
725+
using SimpleRequest::SimpleRequest;
726+
727+
private:
728+
friend SimpleRequest;
729+
730+
// Evaluation.
731+
llvm::Expected<ArrayRef<VarDecl *>>
732+
evaluate(Evaluator &evaluator, NominalTypeDecl *decl) const;
733+
734+
public:
735+
bool isCached() const { return true; }
736+
};
737+
738+
/// Request to obtain a list of stored properties in a nominal type,
739+
/// together with any missing members corresponding to stored
740+
/// properties that could not be deserialized.
741+
///
742+
/// This will include backing storage for lazy properties and
743+
/// property wrappers, synthesizing them if necessary.
744+
class StoredPropertiesAndMissingMembersRequest :
745+
public SimpleRequest<StoredPropertiesAndMissingMembersRequest,
746+
ArrayRef<Decl *>(NominalTypeDecl *),
747+
CacheKind::Cached> {
748+
public:
749+
using SimpleRequest::SimpleRequest;
750+
751+
private:
752+
friend SimpleRequest;
753+
754+
// Evaluation.
755+
llvm::Expected<ArrayRef<Decl *>>
756+
evaluate(Evaluator &evaluator, NominalTypeDecl *decl) const;
757+
758+
public:
759+
bool isCached() const { return true; }
760+
};
761+
716762
// Allow AnyValue to compare two Type values, even though Type doesn't
717763
// support ==.
718764
template<>

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,5 @@ SWIFT_TYPEID(IsSetterMutatingRequest)
4141
SWIFT_TYPEID(OpaqueReadOwnershipRequest)
4242
SWIFT_TYPEID(LazyStoragePropertyRequest)
4343
SWIFT_TYPEID(TypeCheckFunctionBodyUntilRequest)
44+
SWIFT_TYPEID(StoredPropertiesRequest)
45+
SWIFT_TYPEID(StoredPropertiesAndMissingMembersRequest)

0 commit comments

Comments
 (0)