You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The set of precedence groups listed in the Operator Declarations article, referenced from multiple locations in The Swift Programming Language, includes an AssignmentPrecedenceGroup that is the lowest level. It is unclear whether the operator precedence of a custom compound assignment operator is implicitly associated with this precedence level or its precedence level must be explicitly specified.
Secondly, it is unclear whether a new precedence group may be created with a lower precedence than the **AssignmentPrecedenceGroup"". It likely shouldn't be allowed as that would prevent such an operator from being executed unless it were contained in a parenthesized expression.
In either event, the behavior of Swift should be clarified in the document.
Correction
In either the Compound Assignment Operators or Precedence for Custom Infix Operators subsection of the Advanced Operators section, add whichever of the following is correct:
Custom compound assignment operators are implicitly assigned to the AssignmentPrecedenceGroup precedence group.
or
As with other custom infix operators, custom compound assignment operators must be explicitly assigned to a precedence group. In general, these should be assigned to the AssignmentPrecedenceGroup precedence group.
In the Precedence Group Declaration subsection of the Declarations section, add the whichever of following notes is correct below the existing note:
Note: Custom precedence groups may not be assigned a precedence below the AssignmentPrecedenceGroup precedence group.
or
Note: Custom precedence groups should not be assigned a precedence below the AssignmentPrecedenceGroup precedence group. To do so would require that those operators be enclosed in a parenthesized expression in order for their value to be employed in an assignment.
The text was updated successfully, but these errors were encountered:
Location
https://developer.apple.com/documentation/swift/operator-declarations
https://docs.swift.org/swift-book/documentation/the-swift-programming-language/advancedoperators#Compound-Assignment-Operators
https://docs.swift.org/swift-book/documentation/the-swift-programming-language/advancedoperators#Precedence-for-Custom-Infix-Operators
https://docs.swift.org/swift-book/documentation/the-swift-programming-language/declarations#Precedence-Group-Declaration
Description
The set of precedence groups listed in the Operator Declarations article, referenced from multiple locations in The Swift Programming Language, includes an AssignmentPrecedenceGroup that is the lowest level. It is unclear whether the operator precedence of a custom compound assignment operator is implicitly associated with this precedence level or its precedence level must be explicitly specified.
Secondly, it is unclear whether a new precedence group may be created with a lower precedence than the **AssignmentPrecedenceGroup"". It likely shouldn't be allowed as that would prevent such an operator from being executed unless it were contained in a parenthesized expression.
In either event, the behavior of Swift should be clarified in the document.
Correction
In either the Compound Assignment Operators or Precedence for Custom Infix Operators subsection of the Advanced Operators section, add whichever of the following is correct:
Custom compound assignment operators are implicitly assigned to the AssignmentPrecedenceGroup precedence group.
or
As with other custom infix operators, custom compound assignment operators must be explicitly assigned to a precedence group. In general, these should be assigned to the AssignmentPrecedenceGroup precedence group.
In the Precedence Group Declaration subsection of the Declarations section, add the whichever of following notes is correct below the existing note:
Note: Custom precedence groups may not be assigned a precedence below the AssignmentPrecedenceGroup precedence group.
or
Note: Custom precedence groups should not be assigned a precedence below the AssignmentPrecedenceGroup precedence group. To do so would require that those operators be enclosed in a parenthesized expression in order for their value to be employed in an assignment.
The text was updated successfully, but these errors were encountered: