mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Currently when call involving prefix/postfix operator is formed we don't wrap argument in implicit parens (like we do with other calls) when user didn't provide any explicitly, this is bad because argument-to-parameter matcher requires multiple special cases to handle such behavior, so let's start wrapping arguments in implicit parens instead. Resolves: rdar://problem/40722855 Resolves: [SR-7840](https://bugs.swift.org/browse/SR-7840)
25 lines
366 B
Swift
25 lines
366 B
Swift
// RUN: %target-typecheck-verify-swift
|
|
|
|
postfix operator %
|
|
postfix func % (_: Any) {}
|
|
|
|
prefix operator ~
|
|
prefix func ~ (_: Any) {}
|
|
|
|
func foo(_: String) -> Void {}
|
|
func foo(_: Int) -> Void {}
|
|
|
|
_ = foo("answer")% // Ok
|
|
_ = ~foo(42) // Ok
|
|
|
|
class A {
|
|
func bar(_: Int) {}
|
|
}
|
|
|
|
extension A {
|
|
func bar(_ qux: String) {
|
|
bar(qux)% // Ok
|
|
~bar(qux) // Ok
|
|
}
|
|
}
|