Files
swift-mirror/test/Serialization/Inputs/def_operator.swift
John McCall c8c41b385c Implement SE-0077: precedence group declarations.
What I've implemented here deviates from the current proposal text
in the following ways:

- I had to introduce a FunctionArrowPrecedence to capture the parsing
  of -> in expression contexts.

- I found it convenient to continue to model the assignment property
  explicitly.

- The comparison and casting operators have historically been
  non-associative; I have chosen to preserve that, since I don't
  think this proposal intended to change it.

- This uses the precedence group names and higherThan/lowerThan
  as agreed in discussion.
2016-07-26 14:04:57 -07:00

28 lines
684 B
Swift

prefix operator ~~~
postfix operator ^^
infix operator *- : LowPrecedence
precedencegroup LowPrecedence {
associativity: left
lowerThan: AssignmentPrecedence
higherThan: LollipopPrecedence
}
infix operator -* : LollipopPrecedence
precedencegroup LollipopPrecedence {
associativity: right
higherThan: DoubleLollipopPrecedence
}
infix operator *-* : DoubleLollipopPrecedence
precedencegroup DoubleLollipopPrecedence {
associativity: none
assignment: true
}
prefix public func ~~~(x: Bool) -> () {}
postfix public func ^^(x: inout Bool) -> () { x = true }
public func *-*(x: Bool, y: Bool) -> () {}
public func *-(x: inout Bool, y: Bool) -> Bool { x = y; return x }