Constraint
protocol Constraint : Sendable
A constraint used to perform type checking or inference.
A constraint is a predicate over one or multiple types, including type variables, that must be satisfied in order for a program to be well-typed. Constraints also server to infer implicit type information from the structure of the program.
-
The site from which a constraint originates and the reason why it was formed.
Declaration
Swift
var origin: ConstraintOrigin { get } -
Inserts the type variables that occur free in
selfintos.Declaration
Swift
func collectOpenVariables(in s: inout Set<TypeVariable>) -
Applies
transformon constituent types ofself. -
Hashes the salient features of
selfby feeding them intohasher.Declaration
Swift
func hash(into hasher: inout Hasher) -
Returns whether
selfis equal toother.Declaration
Swift
func equals<Other>(_ other: Other) -> Bool where Other : Constraint -
isSimpler(than:Extension method) Returns whether
selfis heuristically simpler to solve thanrhs.Declaration
Swift
fileprivate func isSimpler(than rhs: any Constraint) -> Bool -
openVariablesExtension methodReturns the type variables that occur free in
self.Declaration
Swift
var openVariables: Set<TypeVariable> { get } -
modifyingTypes(_:Extension method) Returns a copy of
selfwhere constituent types have been transformed withtransform.
-
equals(_:Extension method) Returns whether
selfis equal toother.Declaration
Swift
func equals<Other>(_ other: Other) -> Bool where Other : Constraint
View on GitHub