File tree Expand file tree Collapse file tree 5 files changed +23
-7
lines changed Expand file tree Collapse file tree 5 files changed +23
-7
lines changed Original file line number Diff line number Diff line change @@ -146,7 +146,8 @@ Globals
146
146
global ::= type protocol-conformance 'WL' // lazy protocol witness table cache variable
147
147
148
148
global ::= protocol-conformance identifier 'Wt' // associated type metadata accessor (HISTORICAL)
149
- global ::= protocol-conformance assoc-type-list nominal-type 'WT' // associated type witness table accessor
149
+ global ::= protocol-conformance assoc-type-list protocol 'WT' // associated type witness table accessor
150
+ global ::= protocol-conformance type protocol 'WT' // inherited protocol witness table accessor
150
151
global ::= type protocol-conformance 'Wl' // lazy protocol witness table accessor
151
152
152
153
global ::= type 'WV' // value witness table
Original file line number Diff line number Diff line change @@ -2423,11 +2423,22 @@ NodePointer Demangler::demangleWitness() {
2423
2423
}
2424
2424
case ' T' : {
2425
2425
NodePointer ProtoTy = popNode (Node::Kind::Type);
2426
- auto AssocTypePath = popAssocTypePath ();
2426
+ NodePointer ConformingType = nullptr ;
2427
+ if (auto Type = popNode (Node::Kind::Type)) {
2428
+ if (Type->getChild (0 ) &&
2429
+ Type->getChild (0 )->getKind () ==
2430
+ Node::Kind::DependentGenericParamType) {
2431
+ ConformingType = Type;
2432
+ } else {
2433
+ pushNode (Type);
2434
+ }
2435
+ }
2427
2436
2437
+ if (!ConformingType)
2438
+ ConformingType = popAssocTypePath ();
2428
2439
NodePointer Conf = popProtocolConformance ();
2429
2440
return createWithChildren (Node::Kind::AssociatedTypeWitnessTableAccessor,
2430
- Conf, AssocTypePath , ProtoTy);
2441
+ Conf, ConformingType , ProtoTy);
2431
2442
}
2432
2443
case ' O' : {
2433
2444
switch (nextChar ()) {
Original file line number Diff line number Diff line change @@ -955,7 +955,7 @@ void Remangler::mangleAssociatedTypeWitnessTableAccessor(Node *node) {
955
955
Out << " WT" ;
956
956
assert (node->getNumChildren () == 3 );
957
957
mangleChildNode (node, 0 ); // protocol conformance
958
- mangleChildNode (node, 1 ); // identifier
958
+ mangleChildNode (node, 1 ); // type
959
959
mangleProtocolWithoutPrefix (node->begin ()[2 ]); // type
960
960
}
961
961
Original file line number Diff line number Diff line change @@ -596,7 +596,7 @@ void Remangler::mangleDefaultAssociatedTypeMetadataAccessor(Node *node) {
596
596
}
597
597
598
598
void Remangler::mangleAssociatedTypeWitnessTableAccessor (Node *node) {
599
- mangleChildNodes (node); // protocol conformance, identifier, type
599
+ mangleChildNodes (node); // protocol conformance, type, protocol
600
600
Buffer << " WT" ;
601
601
}
602
602
Original file line number Diff line number Diff line change @@ -266,8 +266,12 @@ class IRGenMangler : public Mangle::ASTMangler {
266
266
const ProtocolDecl *Proto) {
267
267
beginMangling ();
268
268
appendProtocolConformance (Conformance);
269
- bool isFirstAssociatedTypeIdentifier = true ;
270
- appendAssociatedTypePath (AssociatedType, isFirstAssociatedTypeIdentifier);
269
+ if (isa<GenericTypeParamType>(AssociatedType)) {
270
+ appendType (AssociatedType);
271
+ } else {
272
+ bool isFirstAssociatedTypeIdentifier = true ;
273
+ appendAssociatedTypePath (AssociatedType, isFirstAssociatedTypeIdentifier);
274
+ }
271
275
appendAnyGenericType (Proto);
272
276
appendOperator (" WT" );
273
277
return finalize ();
You can’t perform that action at this time.
0 commit comments