Files
swift-mirror/validation-test/compiler_crashers_2_fixed/0165-rdar40722855.swift
Pavel Yaskevich 2ce5ae34c1 [Parser] Make sure to add implicit parens to call for prefix/postfix operators when needed
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)
2018-07-02 06:07:15 -07:00

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
}
}