Skip to content

Commit 959c47b

Browse files
authored
Merge pull request #37814 from al45tair/sr-13466-cp5.5
[SR-13466]: Fix demangling of optionals containing function types.
2 parents df554fd + f9ec450 commit 959c47b

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

lib/Demangling/NodePrinter.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,6 @@ class NodePrinter {
310310
case Node::Kind::Structure:
311311
case Node::Kind::OtherNominalType:
312312
case Node::Kind::TupleElementName:
313-
case Node::Kind::Type:
314313
case Node::Kind::TypeAlias:
315314
case Node::Kind::TypeList:
316315
case Node::Kind::LabelList:
@@ -321,6 +320,9 @@ class NodePrinter {
321320
case Node::Kind::SugaredParen:
322321
return true;
323322

323+
case Node::Kind::Type:
324+
return isSimpleType(Node->getChild(0));
325+
324326
case Node::Kind::ProtocolList:
325327
return Node->getChild(0)->getNumChildren() <= 1;
326328

test/Demangle/Inputs/manglings.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ _$S3BBBBi0602365061_ ---> _$S3BBBBi0602365061_
331331
_$S3BBBBv0602365061_ ---> _$S3BBBBv0602365061_
332332
_T0lxxxmmmTk ---> _T0lxxxmmmTk
333333
_TtCF4test11doNotCrash1FT_QuL_8MyClass1 ---> MyClass1 #1 in test.doNotCrash1() -> some
334-
$s3Bar3FooVAA5DrinkVyxGs5Error_pSeRzSERzlyShy4AbcdAHO6MemberVGALSeHPAKSeAAyHC_HCg_ALSEHPAKSEAAyHC_HCg0_Iseggozo_SgWOe ---> outlined consume of @escaping @callee_guaranteed @substituted <A where A: Swift.Decodable, A: Swift.Encodable> (@guaranteed Bar.Foo) -> (@owned Bar.Drink<A>, @error @owned Swift.Error) for <Swift.Set<Abcd.Abcd.Member>>?
334+
$s3Bar3FooVAA5DrinkVyxGs5Error_pSeRzSERzlyShy4AbcdAHO6MemberVGALSeHPAKSeAAyHC_HCg_ALSEHPAKSEAAyHC_HCg0_Iseggozo_SgWOe ---> outlined consume of (@escaping @callee_guaranteed @substituted <A where A: Swift.Decodable, A: Swift.Encodable> (@guaranteed Bar.Foo) -> (@owned Bar.Drink<A>, @error @owned Swift.Error) for <Swift.Set<Abcd.Abcd.Member>>)?
335335
$s4Test5ProtoP8IteratorV10collectionAEy_qd__Gqd___tcfc ---> Test.Proto.Iterator.init(collection: A1) -> Test.Proto.Iterator<A1>
336336
$s4test3fooV4blahyAA1SV1fQryFQOy_Qo_AHF ---> test.foo.blah(<<opaque return type of test.S.f() -> some>>.0) -> <<opaque return type of test.S.f() -> some>>.0
337337
$S3nix8MystructV1xACyxGx_tcfc7MyaliasL_ayx__GD ---> Myalias #1 in nix.Mystruct<A>.init(x: A) -> nix.Mystruct<A>
@@ -405,4 +405,5 @@ $s4test3fooyyS2f_SfYktYjrXEF ---> test.foo(@differentiable(reverse) (Swift.Float
405405
$s4test3fooyyS2f_SfYktYaYbYjrXEF ---> test.foo(@differentiable(reverse) @Sendable (Swift.Float, @noDerivative Swift.Float) async -> Swift.Float) -> ()
406406
$sScA ---> Swift.Actor
407407
$sScGySiG ---> Swift.TaskGroup<Swift.Int>
408-
$s4test10returnsOptyxycSgxyScMYccSglF ---> test.returnsOpt<A>(@Swift.MainActor () -> A?) -> () -> A?
408+
$s4test10returnsOptyxycSgxyScMYccSglF ---> test.returnsOpt<A>((@Swift.MainActor () -> A)?) -> (() -> A)?
409+
$sSvSgA3ASbIetCyyd_SgSbIetCyyyd_SgD ---> (@escaping @convention(thin) @convention(c) (@unowned Swift.UnsafeMutableRawPointer?, @unowned Swift.UnsafeMutableRawPointer?, @unowned (@escaping @convention(thin) @convention(c) (@unowned Swift.UnsafeMutableRawPointer?, @unowned Swift.UnsafeMutableRawPointer?) -> (@unowned Swift.Bool))?) -> (@unowned Swift.Bool))?

0 commit comments

Comments
 (0)