GenericEnvironment
public struct GenericEnvironment : Sendable
extension GenericEnvironment: Monotonic
extension GenericEnvironment: Equatable
Context to interpret the generic parameters of a declaration.
-
The declaration associated with the environment.
Declaration
Swift
public let decl: AnyDeclID -
The generic parameters introduced in the environment, in the order there declaration appears in Hylo sources.
Declaration
Swift
private(set) var parameters: [GenericParameterDecl.ID] { get } -
The traits for which a conformance can be derived given the environment.
Declaration
Swift
private(set) var dependencies: [TraitType] { get } -
The uninstantiated type constraints.
Declaration
Swift
private(set) var constraints: [GenericConstraint] { get } -
The properties of the generic parameters visible in the environment.
Declaration
Swift
var requirements: RequirementSystem -
The index of the first public rule.
Declaration
Swift
private(set) var publicStart: Int { get } -
Creates an empty environment associated with
d, which introducesparameters.Declaration
Swift
public init(of d: AnyDeclID, introducing parameters: [GenericParameterDecl.ID]) -
The non-inherited requirement rules in the environment.
Declaration
Swift
var publicRules: some Collection<RequirementRule> { get } -
Returns the set of traits to which
typeconforms in tself.Declaration
Swift
func conformedTraits(of t: AnyType, querying checker: inout TypeChecker) -> [TraitType] -
Returns
trueifftis known to be semantically equivalent touin this environment.Declaration
Swift
func areEquivalent(_ t: AnyType, _ u: AnyType, querying checker: inout TypeChecker) -> Bool -
Add the parameters, dependencies, and constraints of
baseto the environment.Declaration
Swift
mutating func registerInheritance(_ base: GenericEnvironment) -
Adds the contents of
dsto the trait dependencies of the environment.Declaration
Swift
mutating func registerDependencies(_ ds: [TraitType]) -
Adds the contents of
csto the constraints of the environment.Declaration
Swift
mutating func registerConstraints(_ cs: [GenericConstraint]) -
Adds
cto the constraints of the environment.Declaration
Swift
mutating func registerConstraint(_ c: GenericConstraint) -
Marks all the requirement rules currently in the environment as inherited.
Declaration
Swift
mutating func markRequirementsAsInherited() -
Declaration
Swift
public static func == (l: `Self`, r: `Self`) -> Bool
View on GitHub