Skip to content

Commit e5abbe8

Browse files
authored
Merge pull request swiftlang#18960 from DougGregor/prefix-postfix-inc-dec
2 parents 0605f7b + 61d1ab9 commit e5abbe8

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

stdlib/public/core/Policy.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,8 @@ precedencegroup BitwiseShiftPrecedence {
390390
//===----------------------------------------------------------------------===//
391391

392392
// Standard postfix operators.
393+
postfix operator ++
394+
postfix operator --
393395
postfix operator ...
394396

395397
// Optional<T> unwrapping operator is built into the compiler as a part of
@@ -398,6 +400,8 @@ postfix operator ...
398400
// postfix operator !
399401

400402
// Standard prefix operators.
403+
prefix operator ++
404+
prefix operator --
401405
prefix operator !
402406
prefix operator ~
403407
prefix operator +

test/Compatibility/operators.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// RUN: %target-typecheck-verify-swift -swift-version 4
2+
3+
// expect-no-diagnostics
4+
5+
struct X { }
6+
7+
postfix func ++(x: X) -> X { return x }
8+
prefix func ++(x: X) -> X { return x }
9+
postfix func --(x: X) -> X { return x }
10+
prefix func --(x: X) -> X { return x }

0 commit comments

Comments
 (0)