Files
swift-mirror/test/Migrator/rename-func-decl.swift.expected
Nathan Hawes 43c2f27783 [Refactoring][Migrator] Fix rename of callsites with a trailing closure argument
A label range of 0 length was being reported as the label of trailing closure
arguments, just before the opening '{'.

For the rename refactoring, this meant that if the corresponding parameter had
an external label (e.g. 'a') the occurrence would be treated as not matching the
expected symbol name, and so not be updated at all.

For the migrator, when renaming a function with an unlabelled closure for its
last parameter to have a label, it would incorrectly insert the new label in
front of the opening '{' on all of that function's callsites with trailing
closures.

Resolves rdar://problem/42162571
2018-12-19 16:24:14 -08:00

29 lines
1.0 KiB
Plaintext

// REQUIRES: objc_interop
// RUN: %empty-directory(%t.mod)
// RUN: %target-swift-frontend -emit-module -o %t.mod/Cities.swiftmodule %S/Inputs/Cities.swift -module-name Cities -parse-as-library
// RUN: %empty-directory(%t) && %target-swift-frontend -c -update-code -disable-migrator-fixits -primary-file %s -I %t.mod -api-diff-data-file %S/Inputs/API.json -emit-migrated-file-path %t/rename-func-decl.swift.result -o %t/rename-func-decl.swift.remap
// RUN: diff -u %S/rename-func-decl.swift.expected %t/rename-func-decl.swift.result
import Cities
class MyCities : MoreCities {
func setZooLocationNew(newX ix: Int, newY iy: Int, newZ iz: Int) {}
func addNewZooAt(_ x: Int, newY y: Int, newZ z: Int) {}
}
class MySubTopLevelType: ToplevelType {
override func member(_ x: @escaping ([Int]?) -> Void) {}
}
class MySubTopLevelType2: ToplevelType {
override func member(_ x: @escaping (((([(Int)])?))) -> Void) {}
}
class SubCities: Cities {
override var cheese: Int { return 2 }
}
func boo(_ a: ToplevelType) {
a.trailing2 { print($0!) }
}