Environment
SwiftFormat version 0.60.1
Precondition
Test file (InferredType.swift):
enum Tools {
static func makeString() -> String {
"string"
}
}
func inferredType() {
let value = Tools.makeString()
print("Value: \(value)")
}
inferredType()
This compiles properly.
Reproduction
Runing command
$ swiftformat --rules propertyTypes --property-types explicit <InferredType.swift
produces this output
enum Tools {
static func makeString() -> String {
"string"
}
}
func inferredType() {
let value: Tools = .makeString()
print("Value: \(value)")
}
inferredType()
which is incorrect (and cannot compile).
Expected result:
enum Tools {
static func makeString() -> String {
"string"
}
}
func inferredType() {
let value: String = Tools.makeString()
print("Value: \(value)")
}
inferredType()
Environment
SwiftFormat version 0.60.1
Precondition
Test file (
InferredType.swift):This compiles properly.
Reproduction
Runing command
$ swiftformat --rules propertyTypes --property-types explicit <InferredType.swiftproduces this output
which is incorrect (and cannot compile).
Expected result: