Skip to content

Commit 37dbd05

Browse files
committed
ConstExtract: Update for noncopyable generics (sort of)
1 parent c18c7a6 commit 37dbd05

11 files changed

+19
-32
lines changed

lib/ConstExtract/ConstExtract.cpp

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,10 @@ void writeResultBuilderInformation(llvm::json::OStream &JSON,
776776

777777
for (ProtocolDecl *Decl :
778778
TypeDecl->getLocalProtocols(ConformanceLookupKind::All)) {
779+
// FIXME(noncopyable_generics): Should these be included?
780+
if (Decl->getInvertibleProtocolKind())
781+
continue;
782+
779783
for (auto Member : Decl->getMembers()) {
780784
if (auto *VD = dyn_cast<swift::VarDecl>(Member)) {
781785
if (VD->getName() != VarDecl->getName())
@@ -840,9 +844,16 @@ void writeSubstitutedOpaqueTypeAliasDetails(
840844
// Ignore requirements whose subject type is that of the owner decl
841845
if (!Requirement.getFirstType()->isEqual(OpaqueTy.getInterfaceType()))
842846
continue;
843-
if (Requirement.getKind() == RequirementKind::Conformance)
844-
JSON.value(
845-
toFullyQualifiedProtocolNameString(*Requirement.getProtocolDecl()));
847+
848+
if (Requirement.getKind() != RequirementKind::Conformance)
849+
continue;
850+
851+
// FIXME(noncopyable_generics): Should these be included?
852+
if (Requirement.getProtocolDecl()->getInvertibleProtocolKind())
853+
continue;
854+
855+
JSON.value(
856+
toFullyQualifiedProtocolNameString(*Requirement.getProtocolDecl()));
846857
}
847858
});
848859

@@ -920,7 +931,11 @@ void writeProperties(llvm::json::OStream &JSON,
920931
void writeConformances(llvm::json::OStream &JSON,
921932
const NominalTypeDecl &NomTypeDecl) {
922933
JSON.attributeArray("conformances", [&] {
923-
for (auto &Protocol : NomTypeDecl.getAllProtocols()) {
934+
for (auto *Protocol : NomTypeDecl.getAllProtocols()) {
935+
// FIXME(noncopyable_generics): Should these be included?
936+
if (Protocol->getInvertibleProtocolKind())
937+
continue;
938+
924939
JSON.value(toFullyQualifiedProtocolNameString(*Protocol));
925940
}
926941
});

test/ConstExtraction/ExtractAnnotations.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,4 +172,3 @@ public struct DeprecatedAnnotations: MyProto {}
172172
// CHECK-NEXT: }
173173
// CHECK-NEXT:]
174174

175-
// XFAIL: noncopyable_generics

test/ConstExtraction/ExtractCalls.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,3 @@ public struct Bat {
156156
// CHECK-NEXT: ]
157157
// CHECK-NEXT: }
158158
// CHECK-NEXT:]
159-
160-
// XFAIL: noncopyable_generics
161-

test/ConstExtraction/ExtractConstantsFromMembersAttribute.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,3 @@ enum DirectOnEnum {
6565
// CHECK: "kind": "enum",
6666
// CHECK: "cases": [
6767
// CHECK: "name": "yes"
68-
69-
// XFAIL: noncopyable_generics
70-

test/ConstExtraction/ExtractEnums.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,3 @@ public struct Enums: MyProto {
227227
// CHECK-NEXT: ]
228228
// CHECK-NEXT: }
229229
// CHECK-NEXT:]
230-
231-
// XFAIL: noncopyable_generics
232-

test/ConstExtraction/ExtractFromExtension.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,3 @@ extension MyType {
3131
// CHECK-NEXT: }
3232
// CHECK-NEXT: }
3333
// CHECK-NEXT: ]
34-
35-
// XFAIL: noncopyable_generics
36-

test/ConstExtraction/ExtractGroups.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,3 @@ extension String: Foo {}
333333
// CHECK-NEXT: ]
334334
// CHECK-NEXT: }
335335
// CHECK-NEXT:]
336-
337-
// XFAIL: noncopyable_generics
338-

test/ConstExtraction/ExtractLiterals.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,3 @@ public struct PropertyWrappers : MyProto {
548548
// CHECK-NEXT: ]
549549
// CHECK-NEXT: }
550550
// CHECK-NEXT:]
551-
552-
// XFAIL: noncopyable_generics
553-

test/ConstExtraction/ExtractOpaqueGenericTypealias.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,3 @@ struct Foo<L : Hashable> : myProto {
5555
// CHECK-NEXT: "properties": []
5656
// CHECK-NEXT: }
5757
// CHECK-NEXT: ]
58-
59-
// XFAIL: noncopyable_generics
60-

test/ConstExtraction/ExtractOpaqueTypealias.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,3 @@ private func baz() -> some protoA<testModBStruct> & protoB<Float> & testModBProt
7171
// CHECK-NEXT: "properties": []
7272
// CHECK-NEXT: }
7373
// CHECK-NEXT:]
74-
75-
// XFAIL: noncopyable_generics
76-

0 commit comments

Comments
 (0)