SwiftSemantics Documentation Beta

Structure Precedence​Group

public struct PrecedenceGroup: Declaration, Hashable, Codable

An operator precedence group declaration.

%3 PrecedenceGroup PrecedenceGroup Hashable Hashable PrecedenceGroup->Hashable ExpressibleBySyntax ExpressibleBySyntax PrecedenceGroup->ExpressibleBySyntax Codable Codable PrecedenceGroup->Codable Declaration Declaration PrecedenceGroup->Declaration

Nested Types

PrecedenceGroup.Associativity

The associativity of an operator, which determines how operators of the same precedence are grouped in the absence of parentheses.

PrecedenceGroup.Relation

The relation of operators to operators in other precedence groups, which determines the order in which operators of different precedence groups are evaluated in absence of parentheses.

Conforms To

Declaration

A Swift declaration.

ExpressibleBySyntax

A type that can be initialized with a Swift syntax node.

Codable
Hashable

Initializers

init(_:​)

public init(_ node: PrecedenceGroupDeclSyntax)

Creates an instance initialized with the given syntax node.

Properties

attributes

let attributes: [Attribute]

The declaration attributes.

modifiers

let modifiers: [Modifier]

The declaration modifiers.

keyword

let keyword: String

The declaration keyword ("precedencegroup")

name

let name: String

The precedence group name.

assignment

let assignment: Bool?

Whether operators in the precedence group are folded into optional chains.

For example, if assignment is true, the expression entry?.count += 1 has the effect of entry?(.count += 1); otherwise, the same expression is interpreted as (entry?.count) += 1 and fails to type-check.

associativity

let associativity: Associativity?

The associativity of operators in the precedence group.

relations

let relations: [Relation]

The relation of operators to operators in other precedence groups.