Skip to content

Mangling: fix mangling of functions with a single empty tuple argument #9114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 29, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/AST/ASTMangler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1351,11 +1351,13 @@ void ASTMangler::appendParams(Type ParamsTy, bool forceSingleParam) {
if (Tuple->getNumElements() == 0) {
if (forceSingleParam) {
// A tuple containing a single empty tuple.
appendOperator("y");
appendOperator("t");
appendListSeparator();
appendOperator("t");
} else {
appendOperator("y");
}
appendOperator("y");
return;
}
if (forceSingleParam && Tuple->getNumElements() > 1) {
Expand Down
2 changes: 2 additions & 0 deletions test/Demangle/Inputs/manglings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -251,3 +251,5 @@ _T08mangling14varargsVsArrayySaySiG3arrd_tF ---> mangling.varargsVsArray(arr: Sw
_T0s13_UnicodeViewsVss22RandomAccessCollectionRzs0A8EncodingR_11SubSequence_5IndexQZAFRtzsAcERpzAE_AEQZAIRSs15UnsignedInteger8Iterator_7ElementRPzAE_AlMQZANRS13EncodedScalar_AlMQY_AORSr0_lE13CharacterViewVyxq__G ---> (extension in Swift):Swift._UnicodeViews<A, B><A, B where A: Swift.RandomAccessCollection, B: Swift.UnicodeEncoding, A.Index == A.SubSequence.Index, A.SubSequence: Swift.RandomAccessCollection, A.SubSequence == A.SubSequence.SubSequence, A.Iterator.Element: Swift.UnsignedInteger, A.Iterator.Element == A.SubSequence.Iterator.Element, A.SubSequence.Iterator.Element == B.EncodedScalar.Iterator.Element>.CharacterView
_T010Foundation11MeasurementV12SimulatorKitSo9UnitAngleCRszlE11OrientationO2eeoiSbAcDEAGOyAF_G_AKtFZ ---> static (extension in SimulatorKit):Foundation.Measurement<A where A == __C.UnitAngle>.Orientation.== infix((extension in SimulatorKit):Foundation.Measurement<__C.UnitAngle>.Orientation, (extension in SimulatorKit):Foundation.Measurement<__C.UnitAngle>.Orientation) -> Swift.Bool
_T04main1_yyF ---> main._() -> ()
_T04test6testitSiyt_tF ---> test.testit(()) -> Swift.Int

2 changes: 1 addition & 1 deletion test/SILGen/arguments_as_tuple_overloads.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public func test(_ a: Int, _ b: Int) {
public func test(_ t: (Int, Int)) {
}

// CHECK: sil @_T04test3fooyt_tyF :
// CHECK: sil @_T04test3fooyyt_tF :
public func foo(_: ()) {
}

Expand Down