Skip to content

Commit dc78c7c

Browse files
committed
---
yaml --- r: 341486 b: refs/heads/rxwei-patch-1 c: d0c727d h: refs/heads/master
1 parent d62669b commit dc78c7c

File tree

67 files changed

+1049
-1017
lines changed

Some content is hidden

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

67 files changed

+1049
-1017
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: 8ac2d65a52707d6452be3e36d34c2063f28bfa12
1018+
refs/heads/rxwei-patch-1: d0c727dd3651518189bc76b30ef2421270ee2099
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/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
|**[Debian 9.1 (Raspberry Pi)](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/armv7_debian_stretch.json)** | ARMv7 | [![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-debian-9_1/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-debian-9_1)|
1818
|**[Fedora 27](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_fedora_27.json)** | x86_64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-fedora-27/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-fedora-27)|
1919
|**[Ubuntu 16.04](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_ubuntu_16_04.json)** | x86_64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04)|
20-
|**[Ubuntu 16.04 ](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/ppc64le_ubuntu_16_04.json)** | PPC64LE |[![Build Status](https://ci-external.swift.org/job/oss-swift-5.1-RA-linux-ubuntu-16.04-ppc64le/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-5.1-RA-linux-ubuntu-16.04-ppc64le)|
20+
|**[Ubuntu 16.04 ](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/ppc64le_ubuntu_16_04.json)** | PPC64LE |[![Build Status](https://ci-external.swift.org/job/oss-swift-4.1-RA-linux-ubuntu-16.04-ppc64le/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-4.1-RA-linux-ubuntu-16.04-ppc64le)|
2121
|**[Ubuntu 16.04 ](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/aarch64_ubuntu_16.04.json)** | AArch64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-aarch64/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-aarch64)|
2222
|**[Android](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_ubuntu_16_04_LTS_android.json)** | ARMv7 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-android/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-android)|
2323
|**[Android](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_ubuntu_16_04_LTS_android.json)** | AArch64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-android-arm64/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-android-arm64)|

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1905,7 +1905,7 @@ function(add_swift_target_library name)
19051905
if(SWIFTLIB_SHARED)
19061906
if(sdk IN_LIST SWIFT_APPLE_PLATFORMS)
19071907
list(APPEND swiftlib_link_flags_all "-dynamiclib -Wl,-headerpad_max_install_names")
1908-
elseif(${sdk} STREQUAL ANDROID)
1908+
elseif(sdk STREQUAL ANDROID)
19091909
list(APPEND swiftlib_link_flags_all "-shared")
19101910
# TODO: Instead of `lib${name}.so` find variable or target property which already have this value.
19111911
list(APPEND swiftlib_link_flags_all "-Wl,-soname,lib${name}.so")

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ namespace swift {
7070
class GenericSignature;
7171
class GenericTypeParamDecl;
7272
class GenericTypeParamType;
73+
class LazyResolver;
7374
class ModuleDecl;
7475
class EnumCaseDecl;
7576
class EnumElementDecl;
@@ -3955,7 +3956,10 @@ class ClassDecl final : public NominalTypeDecl {
39553956

39563957
/// Determine whether this class inherits the convenience initializers
39573958
/// from its superclass.
3958-
bool inheritsSuperclassInitializers();
3959+
///
3960+
/// \param resolver Used to resolve the signatures of initializers, which is
3961+
/// required for name lookup.
3962+
bool inheritsSuperclassInitializers(LazyResolver *resolver);
39593963

39603964
/// Marks that this class inherits convenience initializers from its
39613965
/// superclass.
@@ -4139,7 +4143,7 @@ class ProtocolDecl final : public NominalTypeDecl {
41394143

41404144
bool existentialConformsToSelfSlow();
41414145

4142-
bool existentialTypeSupportedSlow();
4146+
bool existentialTypeSupportedSlow(LazyResolver *resolver);
41434147

41444148
ArrayRef<ProtocolDecl *> getInheritedProtocolsSlow();
41454149

@@ -4265,12 +4269,12 @@ class ProtocolDecl final : public NominalTypeDecl {
42654269
/// conforming to this protocol. This is only permitted if the types of
42664270
/// all the members do not contain any associated types, and do not
42674271
/// contain 'Self' in 'parameter' or 'other' position.
4268-
bool existentialTypeSupported() const {
4272+
bool existentialTypeSupported(LazyResolver *resolver) const {
42694273
if (Bits.ProtocolDecl.ExistentialTypeSupportedValid)
42704274
return Bits.ProtocolDecl.ExistentialTypeSupported;
42714275

42724276
return const_cast<ProtocolDecl *>(this)
4273-
->existentialTypeSupportedSlow();
4277+
->existentialTypeSupportedSlow(resolver);
42744278
}
42754279

42764280
/// Explicitly set the existentialTypeSupported flag, without computing

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

Lines changed: 63 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -148,16 +148,19 @@ class alignas(1 << DeclAlignInBits) ProtocolConformance {
148148

149149
/// Return true if the conformance has a witness for the given associated
150150
/// type.
151-
bool hasTypeWitness(AssociatedTypeDecl *assocType) const;
151+
bool hasTypeWitness(AssociatedTypeDecl *assocType,
152+
LazyResolver *resolver = nullptr) const;
152153

153154
/// Retrieve the type witness for the given associated type.
154155
Type getTypeWitness(AssociatedTypeDecl *assocType,
156+
LazyResolver *resolver,
155157
SubstOptions options = None) const;
156158

157159
/// Retrieve the type witness and type decl (if one exists)
158160
/// for the given associated type.
159161
std::pair<Type, TypeDecl *>
160162
getTypeWitnessAndDecl(AssociatedTypeDecl *assocType,
163+
LazyResolver *resolver,
161164
SubstOptions options = None) const;
162165

163166
/// Apply the given function object to each type witness within this
@@ -170,17 +173,17 @@ class alignas(1 << DeclAlignInBits) ProtocolConformance {
170173
///
171174
/// \returns true if the function ever returned true
172175
template<typename F>
173-
bool forEachTypeWitness(F f, bool useResolver=false) const {
176+
bool forEachTypeWitness(LazyResolver *resolver, F f) const {
174177
const ProtocolDecl *protocol = getProtocol();
175178
for (auto assocTypeReq : protocol->getAssociatedTypeMembers()) {
176179
if (assocTypeReq->isInvalid())
177180
continue;
178181

179182
// If we don't have and cannot resolve witnesses, skip it.
180-
if (!useResolver && !hasTypeWitness(assocTypeReq))
183+
if (!resolver && !hasTypeWitness(assocTypeReq))
181184
continue;
182185

183-
const auto &TWInfo = getTypeWitnessAndDecl(assocTypeReq);
186+
const auto &TWInfo = getTypeWitnessAndDecl(assocTypeReq, resolver);
184187
if (f(assocTypeReq, TWInfo.first, TWInfo.second))
185188
return true;
186189
}
@@ -190,11 +193,13 @@ class alignas(1 << DeclAlignInBits) ProtocolConformance {
190193

191194
/// Retrieve the value witness declaration corresponding to the given
192195
/// requirement.
193-
ValueDecl *getWitnessDecl(ValueDecl *requirement) const;
196+
ValueDecl *getWitnessDecl(ValueDecl *requirement,
197+
LazyResolver *resolver) const;
194198

195199
/// Retrieve the witness corresponding to the given value requirement.
196200
/// TODO: maybe this should return a Witness?
197-
ConcreteDeclRef getWitnessDeclRef(ValueDecl *requirement) const;
201+
ConcreteDeclRef getWitnessDeclRef(ValueDecl *requirement,
202+
LazyResolver *resolver) const;
198203

199204
private:
200205
/// Determine whether we have a witness for the given requirement.
@@ -206,7 +211,7 @@ class alignas(1 << DeclAlignInBits) ProtocolConformance {
206211
///
207212
/// The function object should accept a \c ValueDecl* for the requirement.
208213
template<typename F>
209-
void forEachNonWitnessedRequirement(F f) const {
214+
void forEachNonWitnessedRequirement(LazyResolver *Resolver, F f) const {
210215
const ProtocolDecl *protocol = getProtocol();
211216
for (auto req : protocol->getMembers()) {
212217
auto valueReq = dyn_cast<ValueDecl>(req);
@@ -215,7 +220,7 @@ class alignas(1 << DeclAlignInBits) ProtocolConformance {
215220

216221
if (auto assocTypeReq = dyn_cast<AssociatedTypeDecl>(req)) {
217222
// If we don't have witness for the associated type, apply the function.
218-
if (getTypeWitness(assocTypeReq)->hasError()) {
223+
if (getTypeWitness(assocTypeReq, Resolver)->hasError()) {
219224
f(valueReq);
220225
}
221226
continue;
@@ -236,13 +241,15 @@ class alignas(1 << DeclAlignInBits) ProtocolConformance {
236241

237242
/// Given a dependent type expressed in terms of the self parameter,
238243
/// map it into the context of this conformance.
239-
Type getAssociatedType(Type assocType) const;
244+
Type getAssociatedType(Type assocType,
245+
LazyResolver *resolver = nullptr) const;
240246

241247
/// Given that the requirement signature of the protocol directly states
242248
/// that the given dependent type must conform to the given protocol,
243249
/// return its associated conformance.
244250
ProtocolConformanceRef
245-
getAssociatedConformance(Type assocType, ProtocolDecl *protocol) const;
251+
getAssociatedConformance(Type assocType, ProtocolDecl *protocol,
252+
LazyResolver *resolver = nullptr) const;
246253

247254
/// Get the generic parameters open on the conforming type.
248255
GenericEnvironment *getGenericEnvironment() const;
@@ -346,11 +353,12 @@ class RootProtocolConformance : public ProtocolConformance {
346353
AvailabilityContext fromContext) const;
347354

348355
bool hasWitness(ValueDecl *requirement) const;
349-
Witness getWitness(ValueDecl *requirement) const;
356+
Witness getWitness(ValueDecl *requirement, LazyResolver *resolver) const;
350357

351358
/// Retrieve the witness corresponding to the given value requirement.
352359
/// TODO: maybe this should return a Witness?
353-
ConcreteDeclRef getWitnessDeclRef(ValueDecl *requirement) const;
360+
ConcreteDeclRef getWitnessDeclRef(ValueDecl *requirement,
361+
LazyResolver *resolver) const;
354362

355363
/// Apply the given function object to each value witness within this
356364
/// protocol conformance.
@@ -360,7 +368,7 @@ class RootProtocolConformance : public ProtocolConformance {
360368
/// witness will only be specialized if the conformance came from the current
361369
/// file.
362370
template<typename F>
363-
void forEachValueWitness(F f, bool useResolver=false) const {
371+
void forEachValueWitness(LazyResolver *resolver, F f) const {
364372
const ProtocolDecl *protocol = getProtocol();
365373
for (auto req : protocol->getMembers()) {
366374
auto valueReq = dyn_cast<ValueDecl>(req);
@@ -372,10 +380,10 @@ class RootProtocolConformance : public ProtocolConformance {
372380
continue;
373381

374382
// If we don't have and cannot resolve witnesses, skip it.
375-
if (!useResolver && !hasWitness(valueReq))
383+
if (!resolver && !hasWitness(valueReq))
376384
continue;
377385

378-
f(valueReq, getWitness(valueReq));
386+
f(valueReq, getWitness(valueReq, resolver));
379387
}
380388
}
381389

@@ -589,11 +597,13 @@ class NormalProtocolConformance : public RootProtocolConformance,
589597
/// for the given associated type.
590598
std::pair<Type, TypeDecl *>
591599
getTypeWitnessAndDecl(AssociatedTypeDecl *assocType,
600+
LazyResolver *resolver,
592601
SubstOptions options = None) const;
593602

594603
/// Determine whether the protocol conformance has a type witness for the
595604
/// given associated type.
596-
bool hasTypeWitness(AssociatedTypeDecl *assocType) const;
605+
bool hasTypeWitness(AssociatedTypeDecl *assocType,
606+
LazyResolver *resolver = nullptr) const;
597607

598608
/// Set the type witness for the given associated type.
599609
/// \param typeDecl the type decl the witness type came from, if one exists.
@@ -604,10 +614,11 @@ class NormalProtocolConformance : public RootProtocolConformance,
604614
/// that the given dependent type must conform to the given protocol,
605615
/// return its associated conformance.
606616
ProtocolConformanceRef
607-
getAssociatedConformance(Type assocType, ProtocolDecl *protocol) const;
617+
getAssociatedConformance(Type assocType, ProtocolDecl *protocol,
618+
LazyResolver *resolver = nullptr) const;
608619

609620
/// Retrieve the value witness corresponding to the given requirement.
610-
Witness getWitness(ValueDecl *requirement) const;
621+
Witness getWitness(ValueDecl *requirement, LazyResolver *resolver) const;
611622

612623
/// Determine whether the protocol conformance has a witness for the given
613624
/// requirement.
@@ -633,14 +644,20 @@ class NormalProtocolConformance : public RootProtocolConformance,
633644
/// the normal conformance.
634645
void setSignatureConformances(ArrayRef<ProtocolConformanceRef> conformances);
635646

636-
/// Populate the signature conformances without checking if they satisfy
637-
/// requirements. Can only be used with parsed or imported conformances.
638-
void finishSignatureConformances();
647+
/// Retrieves a function object that should be called with each of the
648+
/// conformances required by the requirement signature.
649+
///
650+
/// This can be used to iteratively build up the signature conformances in
651+
/// the type checker (rather than emitting them in a batch via
652+
/// \c setSignatureConformances). The callee is responsible for calling
653+
/// the returned function object with protocol conformances that line up
654+
/// with the conformance requirements in the requirement signature (in order).
655+
std::function<void(ProtocolConformanceRef)> populateSignatureConformances();
639656

640657
/// Determine whether the witness for the given type requirement
641658
/// is the default definition.
642659
bool usesDefaultDefinition(AssociatedTypeDecl *requirement) const {
643-
TypeDecl *witnessDecl = getTypeWitnessAndDecl(requirement).second;
660+
TypeDecl *witnessDecl = getTypeWitnessAndDecl(requirement, nullptr).second;
644661
if (witnessDecl)
645662
return witnessDecl->isImplicit();
646663
// Conservatively assume it does not.
@@ -708,17 +725,20 @@ class SelfProtocolConformance : public RootProtocolConformance {
708725
llvm_unreachable("never an implied conformance");
709726
}
710727

711-
bool hasTypeWitness(AssociatedTypeDecl *assocType) const {
728+
bool hasTypeWitness(AssociatedTypeDecl *assocType,
729+
LazyResolver *resolver) const {
712730
llvm_unreachable("self-conformances never have associated types");
713731
}
714732

715733
std::pair<Type, TypeDecl *>
716734
getTypeWitnessAndDecl(AssociatedTypeDecl *assocType,
735+
LazyResolver *resolver,
717736
SubstOptions options) const {
718737
llvm_unreachable("self-conformances never have associated types");
719738
}
720739

721740
Type getTypeWitness(AssociatedTypeDecl *assocType,
741+
LazyResolver *resolver,
722742
SubstOptions options) const {
723743
llvm_unreachable("self-conformances never have associated types");
724744
}
@@ -728,14 +748,15 @@ class SelfProtocolConformance : public RootProtocolConformance {
728748
}
729749

730750
ProtocolConformanceRef getAssociatedConformance(Type assocType,
731-
ProtocolDecl *protocol) const{
751+
ProtocolDecl *protocol,
752+
LazyResolver *resolver) const{
732753
llvm_unreachable("self-conformances never have associated types");
733754
}
734755

735756
bool hasWitness(ValueDecl *requirement) const {
736757
return true;
737758
}
738-
Witness getWitness(ValueDecl *requirement) const;
759+
Witness getWitness(ValueDecl *requirement, LazyResolver *resolver) const;
739760

740761
Optional<ArrayRef<Requirement>> getConditionalRequirementsIfAvailable() const{
741762
return ArrayRef<Requirement>();
@@ -854,22 +875,26 @@ class SpecializedProtocolConformance : public ProtocolConformance,
854875
return GenericConformance->getImplyingConformance();
855876
}
856877

857-
bool hasTypeWitness(AssociatedTypeDecl *assocType) const;
878+
bool hasTypeWitness(AssociatedTypeDecl *assocType,
879+
LazyResolver *resolver = nullptr) const;
858880

859881
/// Retrieve the type witness and type decl (if one exists)
860882
/// for the given associated type.
861883
std::pair<Type, TypeDecl *>
862884
getTypeWitnessAndDecl(AssociatedTypeDecl *assocType,
885+
LazyResolver *resolver,
863886
SubstOptions options = None) const;
864887

865888
/// Given that the requirement signature of the protocol directly states
866889
/// that the given dependent type must conform to the given protocol,
867890
/// return its associated conformance.
868891
ProtocolConformanceRef
869-
getAssociatedConformance(Type assocType, ProtocolDecl *protocol) const;
892+
getAssociatedConformance(Type assocType, ProtocolDecl *protocol,
893+
LazyResolver *resolver = nullptr) const;
870894

871895
/// Retrieve the witness corresponding to the given value requirement.
872-
ConcreteDeclRef getWitnessDeclRef(ValueDecl *requirement) const;
896+
ConcreteDeclRef getWitnessDeclRef(ValueDecl *requirement,
897+
LazyResolver *resolver) const;
873898

874899
/// Determine whether the witness for the given requirement
875900
/// is either the default definition or was otherwise deduced.
@@ -964,26 +989,31 @@ class InheritedProtocolConformance : public ProtocolConformance,
964989
/// Get the protocol conformance which implied this implied conformance.
965990
NormalProtocolConformance *getImplyingConformance() const { return nullptr; }
966991

967-
bool hasTypeWitness(AssociatedTypeDecl *assocType) const {
968-
return InheritedConformance->hasTypeWitness(assocType);
992+
bool hasTypeWitness(AssociatedTypeDecl *assocType,
993+
LazyResolver *resolver = nullptr) const {
994+
return InheritedConformance->hasTypeWitness(assocType, resolver);
969995
}
970996

971997
/// Retrieve the type witness and type decl (if one exists)
972998
/// for the given associated type.
973999
std::pair<Type, TypeDecl *>
9741000
getTypeWitnessAndDecl(AssociatedTypeDecl *assocType,
1001+
LazyResolver *resolver,
9751002
SubstOptions options = None) const {
976-
return InheritedConformance->getTypeWitnessAndDecl(assocType, options);
1003+
return InheritedConformance->getTypeWitnessAndDecl(assocType, resolver,
1004+
options);
9771005
}
9781006

9791007
/// Given that the requirement signature of the protocol directly states
9801008
/// that the given dependent type must conform to the given protocol,
9811009
/// return its associated conformance.
9821010
ProtocolConformanceRef
983-
getAssociatedConformance(Type assocType, ProtocolDecl *protocol) const;
1011+
getAssociatedConformance(Type assocType, ProtocolDecl *protocol,
1012+
LazyResolver *resolver = nullptr) const;
9841013

9851014
/// Retrieve the witness corresponding to the given value requirement.
986-
ConcreteDeclRef getWitnessDeclRef(ValueDecl *requirement) const;
1015+
ConcreteDeclRef getWitnessDeclRef(ValueDecl *requirement,
1016+
LazyResolver *resolver) const;
9871017

9881018
/// Determine whether the witness for the given requirement
9891019
/// is either the default definition or was otherwise deduced.

0 commit comments

Comments
 (0)