Skip to content

Commit 90139d7

Browse files
committed
[SILGen] Make #function printing more consistent.
Print parens and "_:" in cases where a function has no named parameters. We already print the parens in cases with no parameters, and the "_:" for unnamed parameters in cases where there are already named parameters. Fixes: rdar://problem/19785368
1 parent 1ec8b33 commit 90139d7

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/SILGen/SILGenApply.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the Swift.org open source project
44
//
5-
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2014 - 2018 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information
@@ -4883,7 +4883,7 @@ getMagicFunctionString(SILGenFunction &SGF) {
48834883
&& "asking for #function but we don't have a function name?!");
48844884
if (SGF.MagicFunctionString.empty()) {
48854885
llvm::raw_string_ostream os(SGF.MagicFunctionString);
4886-
SGF.MagicFunctionName.printPretty(os);
4886+
SGF.MagicFunctionName.print(os);
48874887
}
48884888
return SGF.MagicFunctionString;
48894889
}

test/SILGen/default_arguments.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ class Foo {
131131
}
132132

133133
// CHECK-LABEL: sil hidden @$S17default_arguments3FooCyS2icig
134-
// CHECK: string_literal utf16 "subscript"
134+
// CHECK: string_literal utf16 "subscript(_:)"
135135
subscript(x: Int) -> Int {
136136
testMagicLiterals()
137137
closure { testMagicLiterals() }
@@ -160,7 +160,7 @@ func testSelectorCall(_ x: Int, withMagicLiterals y: Int) {
160160
}
161161

162162
// CHECK-LABEL: sil hidden @$S17default_arguments32testSelectorCallWithUnnamedPieceyySi_SitF
163-
// CHECK: string_literal utf16 "testSelectorCallWithUnnamedPiece"
163+
// CHECK: string_literal utf16 "testSelectorCallWithUnnamedPiece(_:_:)"
164164
func testSelectorCallWithUnnamedPiece(_ x: Int, _ y: Int) {
165165
testMagicLiterals()
166166
}

0 commit comments

Comments
 (0)