TypeChecker
struct TypeChecker : Sendable
The transformation from a ScopedProgram to a TypedProgram.
Note
A method named with a leading underscore are meant be called only by the method with the same name but without that leading underscore. The former typically implement the actual computation of a value that is memoized by the latter.-
The diagnostics of the type errors.
Declaration
Swift
private(set) var diagnostics: DiagnosticSet { get } -
An identifier for this instance, unique across concurrent type checking tasks.
Declaration
Swift
private let identifier: UInt8 -
The identifier of the next fresh variable.
Declaration
Swift
private var nextFreshVariableIdentifier: UInt64 -
The representation under construction.
Declaration
Swift
private var cache: Cache -
A closure that accepts a node with its containing program and returns
trueif a trace of type inference should be logged on the console for that node.Declaration
Swift
private let shouldTraceInference: (@Sendable (AnyNodeID, TypedProgram) -> Bool)? -
A closure that accepts a generic declaration with its containing program and returns
trueif the requirement system of its environment should be logged on the console.Declaration
Swift
private let shouldLogRequirementSystem: (@Sendable (AnyDeclID, TypedProgram) -> Bool)? -
The local copy of the program being type checked.
Declaration
Swift
var program: TypedProgram { get } -
Creates an instance as context for algorithms on
p, whose property are already complete.Declaration
Swift
init(asContextFor p: TypedProgram) -
Creates an instance for constructing
instanceUnderConstruction.Declaration
Swift
init( constructing instanceUnderConstruction: TypedProgram, tracingInferenceIf shouldTraceInference: (@Sendable (AnyNodeID, TypedProgram) -> Bool)?, loggingRequirementSystemIf shouldLogRequirements: (@Sendable (AnyDeclID, TypedProgram) -> Bool)? ) -
Creates an instance with given
identifierfor constructinginstanceUnderConstructioncollaboratively with other instances.Requires
identifieris unique across collaborating instances.Declaration
Swift
init( _ identifier: UInt8, collaborativelyConstructing instanceUnderConstruction: SharedMutable<TypedProgram>, tracingInferenceIf shouldTraceInference: (@Sendable (AnyNodeID, TypedProgram) -> Bool)?, loggingRequirementSystemIf shouldLogRequirements: (@Sendable (AnyDeclID, TypedProgram) -> Bool)? ) -
Reports the given diagnostic.
Declaration
Swift
private mutating func report(_ d: Diagnostic) -
Reports the given diagnostics.
Declaration
Swift
private mutating func report<S>(_ batch: S) where S : Sequence, S.Element == Diagnostic
-
Returns the canonical form of
tinscopeOfUse.Declaration
Swift
mutating func canonical(_ t: AnyType, in scopeOfUse: AnyScopeID) -> AnyType -
Returns the canonical form of
tinscopeOfUse.Declaration
Swift
private mutating func canonical(_ t: AssociatedTypeType, in scopeOfUse: AnyScopeID) -> AnyType -
Returns the canonical form of
tinscopeOfUse.Declaration
Swift
private mutating func canonical(_ t: BoundGenericType, in scopeOfUse: AnyScopeID) -> AnyType -
Returns the canonical form of
tinscopeOfUse.Declaration
Swift
private mutating func canonical(_ t: UnionType, in scopeOfUse: AnyScopeID) -> AnyType -
Returns the canonical form of
vinscopeOfUse.Declaration
Swift
mutating func canonical( _ v: CompileTimeValue, in scopeOfUse: AnyScopeID ) -> CompileTimeValue -
Returns
argumentswith all types replaced by their canonical form inscopeOfUse.Declaration
Swift
mutating func canonical( _ arguments: GenericArguments, in scopeOfUse: AnyScopeID ) -> GenericArguments -
Returns
trueifftanduare semantically equivalent inscopeOfUse.Declaration
Swift
mutating func areEquivalent(_ t: AnyType, _ u: AnyType, in scopeOfUse: AnyScopeID) -> Bool -
Returns
trueifftis a refinement ofuandt != u. -
Returns the traits which
trefines, reporting a cycle if one of them is inbases.knownBasesserves as a memo to catch refinement cycles and is expected to be empty except in recursive calls tobases(of:knownBases:).Declaration
Swift
private mutating func bases( of t: TraitType, knownToRefine knownBases: Set<TraitType> = [] ) -> RefinementClosure -
Returns the traits to which
tis declared conforming inscopeOfUse.Declaration
Swift
mutating func conformedTraits( of t: AnyType, in scopeOfUse: AnyScopeID ) -> Set<TraitType> -
Returns the traits to which
tis declared conforming inscopeOfUse.Declaration
Swift
private mutating func conformedTraits( of t: AssociatedTypeType, in scopeOfUse: AnyScopeID ) -> Set<TraitType> -
Gathers the traits to which the associated type identified by
baseandsuffixconform.The traits to which an associated type conforms can be declared in the trait introducing it as well as any of the trait defining its qualification. For example, given a type
T.X.Y, a a conformanceX.Y: Pcould be declared in the trait introducingX. Hence, to collect all possible traits, one must gather the conformances ofYin the trait definingYand the conformances ofX.Yin the traits definingX.baseis the qualification of the associated type composed ofsuffixin reverse order. For example, the baseT.Xand suffix[Z, Y]denote the associated typeT.X.Y.Z.Declaration
Swift
private mutating func accumulateConformedTraits( declaredInTraitsRequiring base: AssociatedTypeType, suffixedBy suffix: [AssociatedTypeDecl.ID], in accumulator: inout Set<TraitType> ) -
Returns the traits to which
tis declared conforming inscopeOfUse.Declaration
Swift
private func conformedTraits( of t: BuiltinType, in scopeOfUse: AnyScopeID ) -> Set<TraitType> -
Returns the traits to which
tis declared conforming inscopeOfUse.Declaration
Swift
private mutating func conformedTraits( of t: GenericTypeParameterType, in scopeOfUse: AnyScopeID ) -> Set<TraitType> -
Returns the traits to which
tis declared conforming inscopeOfUse.Declaration
Swift
private mutating func conformedTraits( of t: ProductType, in scopeOfUse: AnyScopeID ) -> Set<TraitType> -
Returns the traits to which
tcan be assumed to be conforming inscopeOfUse.Declaration
Swift
private mutating func conformedTraits( of t: WitnessType, in scopeOfUse: AnyScopeID ) -> Set<TraitType> -
Returns the traits to which
tis declared conforming by conformance declarations exposed toscopeOfUse.Declaration
Swift
private mutating func conformedTraits( declaredInExtensionsOf t: AnyType, exposedTo scopeOfUse: AnyScopeID ) -> Set<TraitType> -
Returns the traits to which
tis declared conforming in its generic environment.tis a generic type parameter or an associated type introduced by a generic environment notionally containingscopeOfUse. The return value is the set of traits used as bounds oftin that environment.Declaration
Swift
private mutating func conformedTraits( declaredByConstraintsOn t: AnyType, exposedTo scopeOfUse: AnyScopeID ) -> Set<TraitType> -
Returns
trueifmconforms tocexplicitly or structurally inscopeOfUse.See also
explicitlyConformsandstructurallyConforms.Declaration
Swift
mutating func conforms( _ m: AnyType, to c: TraitType, in scopeOfUse: AnyScopeID ) -> Bool -
Returns
trueifmodelconforms totraitexplicitly inscopeOfUse.A conformance is explicit if it has been declared in sources, or if it is the consequence of generic requirements written in sources.
Declaration
Swift
private mutating func explicitlyConforms( _ model: AnyType, to trait: TraitType, in scopeOfUse: AnyScopeID ) -> Bool -
Returns
trueifmodelstructurally conforms totraitinscopeOfUse.Given a trait describing basis operations (e.g., copy) of values, a structural conformance M: T holds iff all the stored parts of M conform to T, structurally or otherwise. In that case, the conformance can be synthesized because its implementation is obvious.
Declaration
Swift
private mutating func structurallyConforms( _ model: AnyType, to trait: TraitType, in scopeOfUse: AnyScopeID ) -> Bool -
Returns
trueif implementations oftrait‘s requirements can be synthesized formodelinscopeOfImplementation.A conformance M: T is synthesizable iff M structurally conforms to T.
Declaration
Swift
private mutating func canSynthesizeConformance( _ model: AnyType, to trait: TraitType, in scopeOfImplementation: AnyScopeID ) -> Bool -
Returns
trueif implementations oftrait‘s requirements can be synthesized formodelinscopeOfImplementation.Declaration
Swift
private mutating func canSynthesizeConformance( _ model: BoundGenericType, to trait: TraitType, in scopeOfImplementation: AnyScopeID ) -> Bool -
Returns
trueif implementations oftrait‘s requirements can be synthesized formodelinscopeOfImplementation.Declaration
Swift
private mutating func canSynthesizeConformance( _ model: ProductType, to trait: TraitType, in scopeOfImplementation: AnyScopeID ) -> Bool -
Returns the checked conformance of
modeltotraitthat is exposed toscopeOfUse, ornilif such a conformance doesn’t exist.Declaration
Swift
private mutating func demandConformance( of model: AnyType, to trait: TraitType, exposedTo scopeOfUse: AnyScopeID ) -> Conformance? -
Returns the checked conformance of
modeltotraitthat is exposed toscopeOfUse, ornilif such a conformance doesn’t exist or hasn’t been checked yet.The result is the innermost available conformance of
modeltotraitinscopeOfUseiff all possible sources have already been checked. Otherwise, the returned conformance may be shadowed by one that hasn’t been checked yet.Requires
modelis canonical.Declaration
Swift
func cachedConformance( of model: AnyType, to trait: TraitType, exposedTo scopeOfUse: AnyScopeID ) -> Conformance? -
Returns the checked conformance of
modeltotraitthat is exposed toscopeOfUse, ornilif such a conformance doesn’t exist or hasn’t been checked yet.The result is the innermost available conformance of
modeltotraitinscopeOfUseiff all possible sources have already been checked. Otherwise, the returned conformance may be shadowed by one that hasn’t been checked yet.Requires
modelis canonical.Declaration
Swift
private func cachedConformance( of model: BoundGenericType, to trait: TraitType, exposedTo scopeOfUse: AnyScopeID ) -> Conformance? -
Returns the innermost element in
conformancesthat is exposed toscopeOfUse.Declaration
Swift
private func closestConformance<C: Collection<Conformance>>( in conformances: C, exposedTo scopeOfUse: AnyScopeID ) -> Conformance? -
Returns the origins of the conformances of
modeltotraitexposed toscopeOfUse.Declaration
Swift
private mutating func originsOfConformance( of model: AnyType, to trait: TraitType, exposedTo scopeOfUse: AnyScopeID ) -> [ConformanceOrigin] -
Returns the origins of the conformances of
modeltotraitexposed toscopeOfUse.Declaration
Swift
private mutating func originsOfConformance( of model: ProductType, to trait: TraitType, exposedTo scopeOfUse: AnyScopeID ) -> [ConformanceOrigin] -
Returns the origins of conformances to
traitexposed toscopeOfUseand declaredd.Declaration
Swift
private mutating func originsOfConformance<T: ConformanceSource>( to trait: TraitType, declaredBy d: T.ID, exposedTo scopeOfUse: AnyScopeID ) -> [ConformanceOrigin] -
Returns the origins of the conformances of
modeltotraitthat are declared in extensions exposed toscopeOfUse.Declaration
Swift
private mutating func originsOfConformance( to trait: TraitType, declaredInExtensionsOf model: AnyType, exposedTo scopeOfUse: AnyScopeID ) -> [ConformanceOrigin] -
Returns the type implementing
requirementformodelinscopeOfUse, ornilifmodeldoes not implementrequirement.Declaration
Swift
private mutating func demandImplementation( of requirement: AssociatedTypeDecl.ID, for model: AnyType, in scopeOfUse: AnyScopeID ) -> AnyType? -
Returns the type implementing requirement
rin conformancecifcis well-formed.Declaration
Swift
private mutating func demandImplementation( of r: AssociatedTypeDecl.ID, in c: Conformance ) -> AnyType?
-
Returns
genericwith occurrences of parameters keyingspecializationreplaced by their corresponding value, performing necessary name lookups fromscopeOfUse.This method has no effect if
See morespecializationis empty.Declaration
Swift
mutating func specialize( _ generic: AnyType, for specialization: GenericArguments, in scopeOfUse: AnyScopeID ) -> AnyType -
Returns the type checking constraint that specializes
genericforspecializationinscopeOfUse, anchoring it atorigin.Declaration
Swift
private mutating func specialize( _ generic: GenericConstraint, for specialization: GenericArguments, in scopeOfUse: AnyScopeID, origin: ConstraintOrigin ) -> Constraint -
Returns the type declared by
dwith its generic parameters bound to fresh variables.Requires
dis a a generic product type or type alias declaration.Declaration
Swift
mutating func openForUnification(_ d: AnyDeclID) -> BoundGenericType
-
Applies all pending updates to the shared instance.
Declaration
Swift
mutating func synchronize() -
Type checks all declarations in
self.program.Declaration
Swift
mutating func checkAllDeclarations() -
Type checks
m.Declaration
Swift
mutating func checkModule(_ m: ModuleDecl.ID) -
Type checks the sources in
batch.Declaration
Swift
mutating func check<S>(_ batch: S) where S : Sequence, S.Element == NodeID<TranslationUnit> -
Type checks
uand all declarations nested ind.Declaration
Swift
private mutating func check(_ u: TranslationUnit.ID) -
Type checks the declarations in
batch.Declaration
Swift
private mutating func check<S: Sequence<T>, T: DeclID>( _ batch: S, ignoringSharedCache ignoreSharedCache: Bool = false ) -
Type checks
dand all declarations nested ind.Type checking is performed if and only if
cache[\.declType][d]isnil. In this case, the type ofdis computed withuncheckedType(of: d)and assigned tocache[\.declType][d]before type checking. Then,_check(d)is called withcache.declsUnderCheckingcontainingd. After the call,cache.declsUnderCheckingdoesn’t containd. A diagnostic is reported if type checking failed.Type checking typically consists of visiting a declaration to generate proof obligations that are then discharged by solving type constraints and/or type checking additional declarations.
Requires
!cache.declsUnderChecking.contains(d)Declaration
Swift
private mutating func check<T: DeclID>( _ d: T, ignoringSharedCache ignoreSharedCache: Bool = false )Parameters
dThe declaration to type check.
-
Type checks
dand all declarations nested ind.Declaration
Swift
private mutating func _check(_ d: ConformanceDecl.ID) -
Type checks
dand all declarations nested ind.Declaration
Swift
private mutating func _check(_ d: ExtensionDecl.ID) -
Type checks
dand all declarations nested ind.Requires
dis not the underlying declaration of a lambda.Declaration
Swift
private mutating func _check(_ d: FunctionDecl.ID, ignoringSharedCache ignoreSharedCache: Bool) -
Type checks
dand all declarations nested ind.Declaration
Swift
private mutating func _check(_ d: GenericParameterDecl.ID) -
Type checks
dand all declarations nested ind.Declaration
Swift
private mutating func _check(_ d: InitializerDecl.ID) -
Type checks
dand all declarations nested ind.Declaration
Swift
private mutating func _check(_ d: MethodDecl.ID) -
Type checks
dand all declarations nested ind.Declaration
Swift
private mutating func _check(_ d: MethodImpl.ID) -
Type checks
dand all declarations nested ind.Declaration
Swift
private mutating func _check(_ d: ModuleDecl.ID) -
Type checks
dand all declarations nested ind.Declaration
Swift
private mutating func _check(_ d: NamespaceDecl.ID) -
Type checks
dand all declarations nested ind.Declaration
Swift
private mutating func _check(_ d: OperatorDecl.ID) -
Type checks
dand all declarations nested ind.Declaration
Swift
private mutating func _check(_ d: ParameterDecl.ID) -
Type checks
dand all declarations nested ind.Declaration
Swift
private mutating func _check(_ d: ProductTypeDecl.ID) -
Type checks
dand all declarations nested ind.Declaration
Swift
private mutating func _check(_ d: SubscriptDecl.ID) -
Type checks
dand all declarations nested ind.Declaration
Swift
private mutating func _check(_ d: SubscriptImpl.ID) -
Type checks
dand all declarations nested ind.Declaration
Swift
private mutating func _check(_ d: TraitDecl.ID) -
Undocumented
Declaration
Swift
private mutating func _check(_ d: TypeAliasDecl.ID) -
Type checks the parameters
psofd.Requires
The parameters inpshave type annotations.Declaration
Swift
private mutating func checkParameters<T: Decl & LexicalScope>( _ ps: [ParameterDecl.ID], of d: T.ID ) -
Type checks
dafter its type has been inferred.This method is called from
discharge(obligations:relatedTo:)on declarations whose types appear in the obligations to discharge.Requires
cache.uncheckedType[d]has been computed.Declaration
-
Type checks
d, which declares a lambda, after its type has been inferred.Declaration
Swift
private mutating func checkPostInference(_ d: FunctionDecl.ID, solution: Solution) -
Substitutes open variables occurring in
cache.uncheckedType[d]with their corresponding assignment insolution, returningd‘s reified type.Requires
cache.uncheckedType[d]has been computed.Declaration
-
Type checks
eas the body of a function returning or susbscript projectingr. -
Checks that
eis an instance oft. -
Type checks
s.Declaration
Swift
private mutating func check<T>(_ s: T) where T : StmtID -
Type checks
s.Declaration
Swift
private mutating func check(_ s: BraceStmt.ID) -
Type checks
s.Declaration
Swift
private mutating func check(_ s: AssignStmt.ID) -
Type checks
s.Declaration
Swift
private mutating func check(_ s: ConditionalBindingStmt.ID) -
Type checks
s.Declaration
Swift
private mutating func check(_ s: ConditionalCompilationStmt.ID) -
Type checks
s.Declaration
Swift
private mutating func check(_ s: ConditionalStmt.ID) -
Type checks
s.Declaration
Swift
private mutating func check(_ s: ExprStmt.ID) -
Type checks
s.Declaration
Swift
private mutating func check(_ s: DeclStmt.ID) -
Type checks
s.Declaration
Swift
private mutating func check(_ s: DiscardStmt.ID) -
Type checks
s.Declaration
Swift
private mutating func check(_ s: DoWhileStmt.ID) -
Type checks
s.Declaration
Swift
private mutating func check(_ s: ForStmt.ID) -
Type checks
s.Declaration
Swift
private mutating func check(_ s: ReturnStmt.ID) -
Type checks
s.Declaration
Swift
private mutating func check(_ s: WhileStmt.ID) -
Type checks
s.Declaration
Swift
private mutating func check(_ s: YieldStmt.ID) -
Type checks
condition.Declaration
Swift
private mutating func check(_ condition: [ConditionItem]) -
Returns the modules visible as imports in
u.The returned set contains the modules declared as explicit imports at the top of
ualong with the standard library and the module containingu.Declaration
Swift
private mutating func imports(exposedTo u: TranslationUnit.ID) -> Set<ModuleDecl.ID> -
If
dis a valid import inu, inserts the module referred bydinimports; reports a diagnostic otherwise.Declaration
Swift
private mutating func insertImport( _ d: ImportDecl.ID, from u: TranslationUnit.ID, in imports: inout Set<ModuleDecl.ID> ) -
Builds and type checks the generic environment of
d.Declaration
Swift
private mutating func checkEnvironment<T>(of d: T.ID) where T : GenericDecl -
Builds and type checks the generic environment of
d.Declaration
Swift
private mutating func checkEnvironment(of d: TraitDecl.ID) -
Builds and type checks the generic environment of
d.Declaration
Swift
private mutating func checkEnvironment<T>(of d: T.ID) where T : TypeExtendingDecl -
Type checks the conformances declared by
d.Only well-typed conformances are added to
self.conformances. A diagnostic is reported for each ill-typed conformance.Declaration
Swift
private mutating func checkAllConformances<T>(declaredBy d: T.ID) where T : ConformanceSource -
Type checks the conformances to
traitsdeclared byd.Declaration
Swift
private mutating func checkConformances(to traits: RefinementClosure, declaredBy d: AnyDeclID)Parameters
traitsA refinement closure for one of the traits mentioned by
d. For instance, ifdis a type declarationtype A: P, Q {},traitsis a closure describing the refinements of eitherPorQ.dA conformance source.
-
Type checks the conformance to
traitdeclared byoriginsinscopeOfDefinition.This method deterministically selects the declaration severing as the origin of a type’s conformance to a specific trait in a scope, reporting diagnostics of ambiguous cases.
Requires
Conformances to traits strictly refined by
traithave already been checked.Declaration
Swift
private mutating func checkConformance( to trait: TraitType, declaredBy origins: [ConformanceOrigin], in scopeOfDefinition: AnyScopeID )Parameters
traitA trait belonging to the refinement closure of a trait mentioned by one of the conformance sources in
origins.originsThe declarations introducing a conformance to
traitinscopeOfDefinition.scopeOfDefinitionThe outermost scope in which the conformance is checked.
-
Type checks the conformance to
traitdeclared byorigin.See moreRequires
Conformances to traits strictly refined by
traithave already been checked.Declaration
Swift
private mutating func checkConformance( to trait: TraitType, declaredBy origin: ConformanceOrigin )Parameters
traitA trait belonging to the refinement closure of a trait mentioned
origin.originA declaration introducing a conformance to
trait. -
Registers conformance
ciff it hasn’t been established.Note
This method doesn’t write to the shared cache.Declaration
Swift
private mutating func insertConformance(_ c: Conformance) -
Registers the use of synthesized declaration
dinm.Declaration
Swift
private mutating func registerSynthesizedDecl( _ d: SynthesizedFunctionDecl, in m: ModuleDecl.ID ) -
Type checks
dand all declarations nested ind, returning the type ofd.Requires
!cache.declsUnderChecking.contains(d)Declaration
Swift
@discardableResult private mutating func checkedType( of d: BindingDecl.ID, usedAs purpose: BindingDeclUse = .irrefutable, ignoringSharedCache ignoreSharedCache: Bool = false ) -> AnyType -
Type checks
eand returns its type, usinghintas contextual type information.Declaration
-
Type checks
eas an argument topand returns its type.Declaration
Swift
private mutating func checkedType( of e: AnyExprID, asArgumentTo p: ParameterType ) -> AnyType -
Returns the inferred type of
e, along with a set of goals to solve to check that type.Declaration
Swift
private mutating func partiallyCheckedType( of e: AnyExprID, withHint hint: AnyType? = nil ) -> (AnyType, ProofObligations) -
Calls
actionwith the innermost generic scopes containings.A scope
sinherits from a generic environmentgif:sis notionally contained ing; and/orsis an extension andgis the environment of the type extended bys.
Declaration
Swift
private mutating func forEachGenericParentScope( inheritedBy s: AnyScopeID, do action: (inout Self, AnyScopeID) -> Void ) -
Returns the generic environment introduced by
s, if any.Declaration
Swift
private mutating func environment(of s: AnyScopeID) -> GenericEnvironment? -
Returns the generic environment introduced by
d.Declaration
Swift
private mutating func environment<T: GenericDecl & LexicalScope>( of d: T.ID ) -> GenericEnvironment -
Returns the generic environment introduced by
d.Declaration
Swift
private mutating func environment(of d: TraitDecl.ID) -> GenericEnvironment -
Inserts the public requirements introduced by the generic signature of
tin its partially formed environment.Declaration
Swift
private mutating func generatePublicRequirements( of t: TraitType, in partiallyFormedEnvironment: inout GenericEnvironment ) -
Returns the generic environment introduced by
d.Declaration
Swift
private mutating func environment<T>(of d: T.ID) -> GenericEnvironment where T : TypeExtendingDecl -
Creates the partially formed generic environment of
d, which introducesparameters, initialized with constraints inherited from the enclosing generic environment.Declaration
Swift
private mutating func initialEnvironment<T: Decl>( of d: T.ID, introducing parameters: [GenericParameterDecl.ID] ) -> GenericEnvironment -
Returns the generic environment introduced by
d, which may be partially formed.Declaration
Swift
private mutating func possiblyPartiallyFormedEnvironment( of d: AnyDeclID ) -> GenericEnvironment? -
Writes
finalResultto the cache.Declaration
Swift
private mutating func commit(_ finalResult: consuming GenericEnvironment) -> GenericEnvironment -
Inserts
d‘s constraints ine.eis the environment in whichdis introduced.Declaration
Swift
private mutating func insertConstraints( of d: AssociatedTypeDecl.ID, in e: inout GenericEnvironment ) -
Inserts
d‘s constraints ine.eis the environment in whichdis introduced.Declaration
Swift
private mutating func insertConstraints( of d: AssociatedValueDecl.ID, in e: inout GenericEnvironment ) -
Evaluates
cas a generic constraint and inserts it ine.Declaration
Swift
private mutating func insertConstraint( _ c: SourceRepresentable<WhereClause.ConstraintExpr>, in e: inout GenericEnvironment ) -
Inserts a rule in
e‘s requirement system specifying thatlconforms tor.Declaration
Swift
private mutating func insertConformanceRequirement( _ l: AnyType, _ r: TraitType, in e: inout GenericEnvironment ) -
Inserts a rule in
e‘s requirement system specifying thatlis equal tor.Declaration
Swift
private mutating func insertEqualityRequirement( _ l: AnyType, _ r: AnyType, in e: inout GenericEnvironment ) -
Inserts the requirement
rintoe.Declaration
Swift
@discardableResult private mutating func insertRequirement( _ r: RequirementRule, in e: inout GenericEnvironment ) -> (inserted: Bool, ruleAfterInsertion: RequirementSystem.RuleID) -
Returns the traits to which a conformance can be derived in the environment of
d. -
Returns the traits to which a conformance can be derived given the constraints in
d. -
Returns the traits to which a conformance can be derived given the constraints in
d.Declaration
Swift
private mutating func traitMentions(in d: ConformanceDecl.ID) -> [TraitType] -
Returns the traits to which a conformance can be derived given the constraints in
d.Declaration
Swift
private mutating func traitMentions(in d: ExtensionDecl.ID) -> [TraitType] -
Returns the traits to which a conformance can be derived given the constraints in
d. -
Returns the traits to which a conformance can be derived given the constraints in
g.Declaration
Swift
private mutating func traitMentions(in g: GenericClause) -> [TraitType] -
Returns the traits to which a conformance can be derived given the constraints in
w.Declaration
Swift
private mutating func traitMentions(in w: WhereClause) -> [TraitType] -
Returns the strongly connected component that contains
tin the trait dependency graph.Declaration
Swift
private mutating func traitComponent(containing t: TraitType) -> Int -
Returns the type of
d, computing it if necessary, without type checkingd.This method returns the value for
dincache[\.declType]orcache.uncheckedTypeif it has been computed. Otherwise, it calls_uncheckedType(d)withcache.uncheckedType[d]assigned to.inProgress. After the call,cache.uncheckedType[d] == .complete(t), wheretis the return value. A diagnostic is reported if type the type ofdcontains an error.Requires
cache.uncheckedType[d] != .inProgressDeclaration
-
Commits
tas the unchecked type ofdto the local cache.Declaration
-
Computes and returns the type of
d.Declaration
Swift
private mutating func _uncheckedType(of d: AssociatedTypeDecl.ID) -> AnyType -
Computes and returns the type of
d.Declaration
Swift
private mutating func _uncheckedType(of d: AssociatedValueDecl.ID) -> AnyType -
Computes and returns the type of
d.Declaration
Swift
private mutating func _uncheckedType(of d: BindingDecl.ID) -> AnyType -
Computes and returns the type of
d.Declaration
Swift
private mutating func _uncheckedType<T>(of d: T.ID) -> AnyType where T : TypeExtendingDecl -
Computes and returns the type of
d.Declaration
Swift
private mutating func _uncheckedType(of d: FunctionDecl.ID) -> AnyType -
Computes and returns the type of
d.Declaration
Swift
private mutating func _uncheckedType(of d: GenericParameterDecl.ID) -> AnyType -
Computes and returns the type of
d.Declaration
Swift
private mutating func _uncheckedType(of d: ImportDecl.ID) -> AnyType -
Computes and returns the type of
d.Declaration
Swift
private mutating func _uncheckedType(of d: InitializerDecl.ID) -> AnyType -
Computes and returns the type of
d.Declaration
Swift
private mutating func _uncheckedType(of d: MethodDecl.ID) -> AnyType -
Computes and returns the type of
d.Declaration
Swift
private mutating func _uncheckedType(of d: MethodImpl.ID) -> AnyType -
Computes and returns the type of
d.Declaration
Swift
private mutating func _uncheckedType(of d: ModuleDecl.ID) -> AnyType -
Computes and returns the type of
d.Declaration
Swift
private mutating func _uncheckedType(of d: OperatorDecl.ID) -> AnyType -
Computes and returns the type of
d.Declaration
Swift
private mutating func _uncheckedType(of d: NamespaceDecl.ID) -> AnyType -
Computes and returns the type of
d.Requires
dhas a type annotation.Declaration
Swift
private mutating func _uncheckedType(of d: ParameterDecl.ID) -> AnyType -
Computes and returns the type of
d.Declaration
Swift
private mutating func _uncheckedType(of d: ProductTypeDecl.ID) -> AnyType -
Computes and returns the type of
d.Declaration
Swift
private mutating func _uncheckedType(of d: SubscriptDecl.ID) -> AnyType -
Computes and returns the type of
d.Declaration
Swift
private mutating func _uncheckedType(of d: SubscriptImpl.ID) -> AnyType -
Computes and returns the type of
d. -
Computes and returns the type of
d.Declaration
Swift
private mutating func _uncheckedType(of d: TypeAliasDecl.ID) -> AnyType -
Computes and returns the type of
d. -
Computes and returns the types of
d‘s captures.Requires
dis not a member declaration.Declaration
Swift
private mutating func uncheckedCaptureTypes<T: CapturingDecl>( of d: T.ID ) -> (explicit: [TupleType.Element], implicit: [TupleType.Element]) -
Computes and returns the types of the inputs
psofd.Requires
The parameters inpshave type annotations.Declaration
Swift
private mutating func uncheckedInputTypes<T: Decl & LexicalScope>( of ps: [ParameterDecl.ID], declaredBy d: T.ID ) -> [CallableTypeParameter] -
Computes and returns the types of the inputs of
e‘s underlying declaration, usinghintto guess the passing conventions of unanotated parameters.hintis used as contextual information to refine guesses iff it is a lambda type with the same number of parameters ase. Parameter annotations take precedence in case of conflict.After the call,
cache.uncheckedType[p]may be assigned to a type variable ifphas no type annotation. Type checking is expected to reify such variables once the type of the expression in whicheoccurs has been checked.Declaration
Swift
private mutating func uncheckedInputTypes( of e: LambdaExpr.ID, withHint hint: ArrowType? ) -> [CallableTypeParameter] -
Returns the passing conventions of
e‘s parameters inferred from uses ine’s body.Parameters used immutably are inferred to be passed
letunless corresponding hints specify a different convention. Parameters used mutably are inferred to be passedinoutunless corresponding hints specify a convention other thanlet.Requires
hintisnilor contains has as many elements ase’s parameters.Declaration
Swift
private mutating func uncheckedPassingConventions( of e: LambdaExpr.ID, withHint hint: [CallableTypeParameter]? ) -> [AccessEffect] -
Computes and returns the type of values expected to be returned or projected in
scopeOfUse, or returnsnilifscopeOfUseis not nested in the declaration of a callable entity.Declaration
Swift
private mutating func uncheckedOutputType(in scopeOfUse: AnyScopeID) -> AnyType? -
Computes and returns the type of values returned by
d.Declaration
Swift
private mutating func uncheckedOutputType(of d: FunctionDecl.ID) -> AnyType -
Computes and returns the type of values returned by
d.Declaration
Swift
private mutating func uncheckedOutputType(of d: MethodImpl.ID) -> AnyType -
Computes and returns the type of values projected by
d.Declaration
Swift
private mutating func uncheckedOutputType(of d: SubscriptImpl.ID) -> AnyType -
Returns the types of the explicit captures
csofd.Declaration
Swift
private mutating func explicitCaptures<T: Decl & LexicalScope>( _ cs: [BindingDecl.ID], of d: T.ID ) -> [TupleType.Element] -
Returns the implicit captures found in the body of
d.Declaration
Swift
private mutating func implicitCaptures<T: CapturingDecl>( of d: T.ID, ignoring explicitCaptures: Set<String> ) -> [TupleType.Element] -
Returns type of
d‘s memberwise initializer.Declaration
Swift
private mutating func memberwiseInitializer(of d: ProductTypeDecl.ID) -> ArrowType -
Returns the model for which
ddeclares conformances.Requires
dis a conformance source. -
If
dis a trait extension, returns the trait that it extends; returnsnilotherwise.Declaration
Swift
private mutating func extendedTrait(_ d: ExtensionDecl.ID) -> TraitType?
-
Evaluates and returns the value of
e, which is an annotation that may contain wildcards or elided generic arguments, usinghintfor context and updatingobligationswith new goals.Declaration
Swift
private mutating func evalPartialTypeAnnotation( _ e: AnyExprID, withHint hint: AnyType? = nil, updating obligations: inout ProofObligations ) -> AnyType? -
Evaluates and returns the value of
e, which is a type annotation. -
Evaluates and returns the generic arguments in
s.Wildcards are evaluated as fresh variables to support partial type inference. These may be substituted by either a type or a value.
Declaration
Swift
private mutating func evalGenericArguments(_ s: [LabeledArgument]) -> [CompileTimeValue] -
Evaluates and returns the value of
e.Declaration
Swift
private mutating func evalGenericArgument(_ e: LabeledArgument) -> CompileTimeValue -
Evaluates
eas a buffer type expression, having inferred that the type of the buffer’s elements ist.Declaration
Swift
private mutating func evalBufferTypeExpression( _ e: SubscriptCallExpr.ID, havingInferredElementType t: AnyType ) -> MetatypeType -
Ensures that
tis a valid type for an annotation and returns its meaning iff it is; otherwise, returnsnil.Declaration
-
Returns the value expressed by an expression of type
tiff that value is a type. -
Returns the value expressed by
e.Declaration
Swift
private func denotation(of e: AnyExprID) -> CompileTimeValue -
Returns the value expressed by
eDeclaration
Swift
private func denotation(of e: IntegerLiteralExpr.ID) -> CompileTimeValue -
Returns the value expressed by
eDeclaration
Swift
private func denotation(of e: NameExpr.ID) -> CompileTimeValue -
Evaluates and returns the qualification of
e, which is a type annotation. -
Returns the inferred qualification of
e, usingimplicitQualificationto resolve implicit domains and updatingobligations.Declaration
Swift
public mutating func inferredQualification( of e: NameExpr.ID, implicitlyIn implicitQualification: AnyType?, updating obligations: inout ProofObligations ) -> AnyType? -
Evaluates and returns the parameter annotations of
e.Declaration
Swift
private mutating func evalParameterAnnotations( of e: ArrowTypeExpr.ID ) -> [CallableTypeParameter] -
Evaluates and returns the value of
e.Declaration
Swift
private mutating func evalParameterAnnotation(_ e: ParameterTypeExpr.ID) -> AnyType -
Evaluates and returns the return type annotation of
d.The value of
d‘s explicit return type annotation is returned if it is defined. Otherwise, a fresh type variable is returned ifdappears in an expression context (i.e.,dis the underlying declaration of a lambda). Otherwise,.voidis returned.Declaration
Swift
private mutating func evalReturnTypeAnnotation(of d: FunctionDecl.ID) -> AnyType -
Evaluates and returns the return type annotation of
d.The value of
d‘s explicit return type annotation is returned if it is defined. Otherwise,.voidis returned.Declaration
Swift
private mutating func evalReturnTypeAnnotation(of d: MethodDecl.ID) -> AnyType -
Evaluates the traits in
composition, returning a sequence of pairs(n, t)wherenis an expression incompositionandtthe corresponding trait.The returned sequence contains an element for each valid trait expression in
composition. A diagnostic is reported each invalid expression.Declaration
-
Evaluates and returns
e, which is a type annotation describing the subject of an extension or a bound in an existential type, along with its associated constraints.Declaration
Swift
private mutating func eval(existentialBound e: AnyExprID) -> (AnyType, Set<GenericConstraint>) -
Evaluates and returns
e, which is a type annotation describing the subject of an extension or a bound in an existential type, along with its associated constraints.When a name expression describes the subject of an extension or a bound an existential bound, generic parameters are interpreted as sugared constraints that would otherwise be defined in a where clause. For example, in
See moreconformance Array<Int>: P {}, the extended type isArrayandIntis interpreted as a constraint onArray‘s generic parameter.Declaration
Swift
private mutating func eval( existentialBound e: NameExpr.ID ) -> (AnyType, Set<GenericConstraint>) -
Binds
nto its declaration and returns its type.Declaration
Swift
private mutating func bindExistentialBoundComponent( _ n: NameResolutionResult.ResolvedComponent ) -> AnyType? -
Evaluates
e, which expresses the bounds of an existential type expression, returning the type of each bound and all associated constraints.Declaration
Swift
private mutating func eval( existentialInterface e: [NameExpr.ID] ) -> (ExistentialType.Interface, Set<GenericConstraint>)
-
Returns the declarations that introduce
nameand are exposed toscopeOfUse.Declarations are lookup up qualified in
nominalScopeif it isn’tnil. Otherwise, they are looked up unqualified fromscopeOfuse. Access modifiers are ignored.Declaration
Swift
private mutating func lookup( _ name: SourceRepresentable<Name>, memberOf nominalScope: AnyType?, exposedTo scopeOfuse: AnyScopeID ) -> [AnyDeclID] -
Returns the declarations that introduce an entity with given
stemexposed toscopeOfUsewithout qualification.Requires
The imports of the module containingscopeOfUsehave been configured.Declaration
Swift
private mutating func lookup( unqualified stem: String, in scopeOfUse: AnyScopeID ) -> Set<AnyDeclID> -
Merges
newMatchesintopartialResult, returningtrueiff a non-overloadable declaration was inserted.Bindings under checking are not inserted, thus preventing initializing expressions from referring to the left hand side of a binding initialization (e.g.,
let x = x).Requires
partialResultdoesn’t contain any non-overloadable declaration.Declaration
-
Returns the declarations that introduce a name with given
stemin the declaration space oflookupContextand are exposed toscopeOfUse.Declaration
Swift
private mutating func lookup( _ stem: String, in lookupContext: AnyScopeID, exposedTo scopeOfUse: AnyScopeID ) -> Set<AnyDeclID> -
Returns the declarations that introduce a name with given
stemin the declaration space oflookupContextand are exposed toscopeOfUse.Declaration
Swift
private mutating func lookup<T: TypeExtendingDecl>( _ stem: String, in lookupContext: T.ID, exposedTo scopeOfUse: AnyScopeID ) -> Set<AnyDeclID> -
Returns the declarations that introduce a name with given
stemin the declaration space oflookupContextand are exposed toscopeOfUse.Declaration
Swift
private mutating func lookup( _ stem: String, in lookupContext: TypeAliasDecl.ID, exposedTo scopeOfUse: AnyScopeID ) -> Set<AnyDeclID> -
Returns the declarations that introduce a name with given
stemas member ofnominalScopeand are exposed toscopeOfUse.Declaration
Swift
private mutating func lookup( _ stem: String, memberOf nominalScope: AnyType, exposedTo scopeOfUse: AnyScopeID ) -> Set<AnyDeclID> -
Returns the declarations that introduce a name with given
stemas member ofnominalScopeand are exposed toscopeOfUse.Declaration
Swift
private mutating func lookup( _ stem: String, memberOf nominalScope: AssociatedTypeType, exposedTo scopeOfUse: AnyScopeID ) -> Set<AnyDeclID> -
Returns the declarations that introduce a name with given
stemas member ofnominalScopeand exposed toscopeOfUse.Declaration
Swift
private mutating func lookup( _ stem: String, memberOf nominalScope: ExistentialType, exposedTo scopeOfUse: AnyScopeID ) -> Set<AnyDeclID> -
Returns the declarations that introduce a name with given
stemas member ofnominalScopeand are exposed toscopeOfUse.Declaration
Swift
private mutating func lookup( _ stem: String, memberOf nominalScope: GenericTypeParameterType, exposedTo scopeOfUse: AnyScopeID ) -> Set<AnyDeclID> -
Returns the declarations that introduce a name with given
stemas member ofnominalScopeand are exposed toscopeOfUse.Declaration
Swift
private mutating func lookup( _ stem: String, memberOf nominalScope: TypeAliasType, exposedTo scopeOfUse: AnyScopeID ) -> Set<AnyDeclID> -
Returns the declarations that introduce a name with given
stemin extensions ofnominalScopeand are exposed toscopeOfUse.Declaration
Swift
private mutating func lookup( _ stem: String, inExtensionsOf nominalScope: AnyType, exposedTo scopeOfUse: AnyScopeID ) -> Set<AnyDeclID> -
Returns the declarations of an operator specified operator that are visible in
scopeOfUse.Declaration
Swift
private func lookup<T: ScopeID>( operator operatorName: Identifier, used notation: OperatorNotation, in scopeOfUse: T ) -> [OperatorDecl.ID] -
Returns the declaration of the specified operator that are visible in
scopeOfUse, ornilif no such operator is declared inscopeOfUse.Declaration
Swift
private func lookup( operator operatorName: Identifier, used notation: OperatorNotation, in scopeOfUse: ModuleDecl.ID ) -> OperatorDecl.ID? -
Returns the stem and declaration of
c, which occurs ind, ornilif eithercdoesn’t have to be captured or lookup failed.Declaration
Swift
private mutating func lookupImplicitCapture<T: Decl & LexicalScope>( _ c: NameExpr.ID, occurringIn d: T.ID ) -> (stem: String, decl: AnyDeclID)? -
Returns the names introduced in
s.The returned table only contains names whose declaration are lexically contained directly in
s. Names introduced by declarations in extensions or inherited by conformance are looked up usinglookup(_:memberOf:exposedTo:).Declaration
-
Returns the declarations extending
subjectexposed toscopeOfUse.Declaration
Swift
private mutating func extensions( of subject: AnyType, exposedTo scopeOfUse: AnyScopeID ) -> [AnyDeclID]Return Value
The declarations extending
subject, which all conform toTypeExtendingDecl. -
Returns the declarations extending
subjectexposed toscopeOfUse.Requires
subjectis canonical.Declaration
Swift
private mutating func _extensions( of subject: AnyType, exposedTo scopeOfUse: AnyScopeID ) -> [AnyDeclID] -
Adds the declarations in
sthat extendsttopartialResult.Requires
tis canonical.Declaration
Swift
private mutating func appendExtensions( declaredIn s: AnyScopeID, extending t: AnyType, to partialResult: inout [AnyDeclID] ) -
Returns
dif it has namen, otherwise the implementation ofdwith namenornilif no such implementation exists.Requires
The base name ofdis equal ton.stem -
Returns the labels of
ds name.Only function, method, or subscript declarations may have labels. This method returns
[]for any other declaration.Declaration
Swift
private mutating func labels(_ d: AnyDeclID) -> [String?] -
Returns the labels of
ds name.Declaration
Swift
private func labels(_ d: FunctionDecl.ID) -> [String?] -
Returns the labels of
ds name.Declaration
Swift
private mutating func labels(_ d: InitializerDecl.ID) -> [String?] -
Returns the operator notation of
d‘s name, if any.Declaration
Swift
private func operatorNotation(_ d: AnyDeclID) -> OperatorNotation? -
If
sis contained in a type extending declaration, returns the scope extended by that declaration; returnsnilotherwise.Declaration
Swift
private mutating func bridgedScope<S>(of s: S) -> AnyScopeID? where S : ScopeID -
Returns the scope of the declaration extended by
d, if any.Declaration
Swift
mutating func scopeExtended<T>(by d: T.ID) -> AnyScopeID? where T : TypeExtendingDecl -
Returns the innermost nominal scope in which
dis contained, if any.Declaration
Swift
private mutating func nominalParent(of d: AnyDeclID) -> AnyScopeID? -
Returns
trueiff a qualified reference todis visible inscopeOfUse.Qualified name lookup may “see” a declaration
diff one the following holds:dis declared public.dis a trait requirement.dis declared internal andscopeOfUseis in the same scope.dis declared private and the innermost scope enclosingdalso enclosesscopeOfUse.
Declaration
Swift
private mutating func isAccessibleWithQualification( _ d: AnyDeclID, in scopeOfUse: AnyScopeID ) -> Bool -
Returns
trueifchildis lexically contained in or in an extension ofancestor.Declaration
Swift
private mutating func isNotionallyContained<T: NodeIDProtocol, U: ScopeID>( _ child: T, in ancestor: U ) -> Bool
-
Resolves components of
nfrom left to right until all components have been resolved or one component requires overload resolution.If the leftmost component of
nis non-nominal,resolveNonNominalPrefixis called onselfand the second componentcofn(which is nominal), returning the typeTofc‘s nominal scope ornilif such a type can’t be determined. If a type is returned, name resolution proceeds, looking forcas a member ofT. Otherwise,.canceled(nil, u)is returned, whereuis the nominal suffix ofn, starting fromc.Declaration
Swift
private mutating func resolve( _ n: NameExpr.ID, usedAs purpose: NameUse = .unapplied, withNonNominalPrefix resolveNonNominalPrefix: (inout Self, NameExpr.ID) -> AnyType? ) -> NameResolutionResult -
Resolves a single name component
nbeing used aspurposeincontext.Declaration
Swift
private mutating func resolve( _ n: NameExpr.ID, in context: NameResolutionContext?, usedAs purpose: NameUse ) -> [NameResolutionResult.Candidate] -
Returns the declarations of
nameexposed toscopeOfUseand specialized byarguments.The return value is a set of candidates, each of which corresponding to one possible way to resolve
nameto a specific declaration. The declarations are searched with an unqualified lookup unlesscontextis set, in which case they are searched in the declaration space ofcontext.type. The specialization of generic is obtained by appendingargumentstoparent.arguments.If
See morenameresolves to an initializer andpurposeis.constructor, the corresponding candidate is assigned a constructor type. Ifpurposehas call labels, they are used to filter candidates with different labels.Declaration
Swift
mutating func resolve( _ name: SourceRepresentable<Name>, specializedBy arguments: [CompileTimeValue], in context: NameResolutionContext?, exposedTo scopeOfUse: AnyScopeID, usedAs purpose: NameUse ) -> NameResolutionResult.CandidateSet -
Returns the declaration of
nameinterpreted as a member of the built-in module.Declaration
Swift
private mutating func resolve( builtin name: SourceRepresentable<Name> ) -> NameResolutionResult.CandidateSet -
Returns the declarations of
See morenameinterpreted as a compiler-known type alias (e.g.,NeverorUnion<A, B>) specialized byarguments, ornilif an error occurred.Declaration
Swift
private mutating func resolve( compilerKnownAlias name: SourceRepresentable<Name>, specializedBy arguments: [CompileTimeValue], exposedTo scopeOfUse: AnyScopeID ) -> NameResolutionResult.CandidateSet -
Resolves
nameas a reference to a union type specialized byarguments.Declaration
Swift
private mutating func resolve( union name: SourceRepresentable<Name>, specializedBy arguments: [CompileTimeValue] ) -> NameResolutionResult.CandidateSet -
Resolves
nameas a reference to a metatype specialized byarguments.Declaration
Swift
private mutating func resolve( metatype name: SourceRepresentable<Name>, specializedBy arguments: [CompileTimeValue] ) -> NameResolutionResult.CandidateSet -
Resolves
nameas a sugared reference to a constructor or nameless subscript declaration or returnsnilifnameisn’t a sugar.Declaration
Swift
private mutating func resolve( sugared name: SourceRepresentable<Name>, memberOf parent: NameResolutionContext, exposedTo scopeOfUse: AnyScopeID, usedAs purpose: NameUse ) -> NameResolutionResult.CandidateSet? -
Returns the candidates
csthat are viable picks for overload resolution inscopeOfUse.Declaration
Swift
private mutating func filterResolutionCandidates( _ cs: [NameResolutionResult.Candidate], in scopeOfUse: AnyScopeID ) -> [NameResolutionResult.Candidate] -
Returns the resolved type of the entity declared by
dwhen referred to bynamewith the givenarguments, ornilifdis ill-formed.If
dis generic,contextdetermines how to construct its complete list of arguments and the specialization of the returned type is performed inscopeOfUse. Diagnostics of errors related to the construction of the generic argument list are stored inlog.If
ddeclares an initializer andpurposeis.constructor, the returned type is the constructor form ofd‘s type.Declaration
Swift
private mutating func resolveType( of d: AnyDeclID, referredToBy name: SourceRepresentable<Name>, specializedBy arguments: [CompileTimeValue], in context: NameResolutionContext?, exposedTo scopeOfUse: AnyScopeID, usedAs purpose: NameUse, reportingDiagnosticsTo log: inout DiagnosticSet ) -> (type: AnyType, specialization: GenericArguments, isConstructor: Bool)? -
Returns the generic type of a reference to
d, found incontext, reporting diagnostics atdiagnosticSite.Declaration
Swift
private mutating func resolveType( of d: AnyDeclID, lookedUpIn context: NameResolutionContext? = nil, exposedTo scopeOfUse: AnyScopeID, reportingDiagnosticsAt diagnosticSite: SourceRange ) -> AnyType -
Returns the generic type of a reference to
d, found incontextand occurring inscopeOfUse, reporting diagnostics atdiagnosticSite.Declaration
Swift
private mutating func resolveType( of d: AssociatedTypeDecl.ID, lookedUpIn context: NameResolutionContext?, exposedTo scopeOfUse: AnyScopeID, reportingDiagnosticsAt diagnosticSite: SourceRange ) -> AnyType -
Returns the generic type of a reference to
d, occurring qualified bydomaininscopeOfUse, reporting diagnostics atdiagnosticSite.Declaration
Swift
private mutating func resolveType( of d: AssociatedTypeDecl.ID, qualifiedBy domain: AnyType, exposedTo scopeOfUse: AnyScopeID, reportingDiagnosticsAt diagnosticSite: SourceRange ) -> AnyType -
Returns the generic type of a reference to
d, which is implemented bydomainfor a conformance exposed toscopeOfUse, reporting diagnostics atdiagnosticSite.domainis notionally the subject of a conformance lens focusing on its conformance to the trait that declaredd.Declaration
Swift
private mutating func resolveType( of d: AssociatedTypeDecl.ID, implementedBy domain: AnyType, forConformanceExposedTo scopeOfUse: AnyScopeID, reportingDiagnosticsAt diagnosticSite: SourceRange ) -> AnyType -
Returns the generic type of a reference to
d, found incontext.Declaration
Swift
private mutating func resolveType( of d: SubscriptDecl.ID, lookedUpIn context: NameResolutionContext? ) -> AnyType -
Computes and returns the type of
SelfinscopeOfUse.Declaration
Swift
private mutating func resolveReceiverMetatype(in scopeOfUse: AnyScopeID) -> MetatypeType? -
Computes and returns the type of
SelfinscopeOfUse.Declaration
Swift
private mutating func resolveReceiverMetatype<T: GenericDecl>( in scopeOfUse: T.ID ) -> MetatypeType? -
Computes and returns the type of
SelfinscopeOfUse.Declaration
Swift
private mutating func resolveReceiverMetatype<T: TypeExtendingDecl>( in scopeOfUse: T.ID ) -> MetatypeType? -
Computes and returns the type of
SelfinscopeOfUse.Declaration
Swift
private mutating func resolveReceiverMetatype(in scopeOfUse: TraitDecl.ID) -> MetatypeType? -
Computes and returns the type of
Selfas a trait receiver inscopeOfUse, returningnilifscopeOfUseisn’t notionally contained in a trait.Declaration
Swift
private mutating func resolveTraitReceiver( in scopeOfUse: AnyScopeID ) -> GenericTypeParameterType? -
Returns
trueif references todare captured if they occur inscopeOfUse.Declaration
Swift
private mutating func isCaptured( referenceTo d: AnyDeclID, occurringIn scopeOfUse: AnyScopeID ) -> Bool -
Returns the generic arguments passed to
d, which has typetand is being referred to byname, reporting diagnostics tolog.Declaration
Swift
private mutating func genericArguments( passedTo d: AnyDeclID, typed t: AnyType, referredToBy name: SourceRepresentable<Name>, specializedBy arguments: [CompileTimeValue], reportingDiagnosticsTo log: inout DiagnosticSet ) -> GenericArguments -
Returns the generic arguments passed to the qualification of symbols introduced in
dthat that have been looked up incontext.The arguments of
contextare returned if the latter isn’tnil. Otherwise, the arguments captured in the scope introducingdare returned as a table mapping accumulated generic parameters to a skolem.Declaration
Swift
private mutating func genericQualificationArguments( inScopeIntroducing d: AnyDeclID, resolvedIn context: NameResolutionContext? ) -> GenericArguments -
Returns a table mapping the elements of
parameters, which are introduced byname‘s declaration, to their corresponding values inargumentsif the two arrays have the same length. Otherwise, returnsniland reports diagnostics tolog.Declaration
Swift
private mutating func associateGenericParameters( _ parameters: [GenericParameterDecl.ID], of name: SourceRepresentable<Name>, to arguments: [CompileTimeValue], reportingDiagnosticsTo log: inout DiagnosticSet ) -> GenericArguments -
Calls
actiononselfand each constraint that must hold for a reference todoccurring inscopeOfUse.Declaration
Swift
private mutating func forEachConstraint( associatedWith d: AnyDeclID, in scopeOfUse: AnyScopeID, do action: (inout Self, GenericConstraint) -> Void ) -
Checks
c, which is caused by the resolution ofnspecialized byzinscopeOfUse, reporting diagnostics tolog.If the constraint does not contain skolems or open type variables, the result is
niland a diagnostic is reported tologiff the constraint does not hold. Otherwise, the result is a type checking constraint that has to be solved in context.Declaration
Swift
private mutating func evaluateResolutionConstraint( _ c: GenericConstraint, associatedWith n: SourceRepresentable<Name>, specializedBy z: GenericArguments, in scopeOfUse: AnyScopeID, reportingDiagnosticsTo log: inout DiagnosticSet ) -> Constraint? -
Returns the generic parameters introduced in the generic environment of
d.If
dis a variant implementation, the result is the parameters introduce by the containing bundle declaration.Declaration
Swift
private mutating func genericParameters(introducedBy d: AnyDeclID) -> [GenericParameterDecl.ID] -
Returns the generic parameters captured by
d.Declaration
Swift
private mutating func capturedGenericParameter<T>(of d: T) -> [GenericParameterDecl.ID] where T : DeclID -
Returns generic parameters captured by
s.A declaration may take generic parameters even if it doesn’t declare any. For example, a nested function will implicitly capture the generic parameters introduced in its context.
Declaration
Swift
mutating func accumulatedGenericParameters<T: ScopeID>( in s: T ) -> [GenericParameterDecl.ID] -
Returns the trait of which
dis a member, ornilifdisn’t member of a trait. -
Returns the declaration defining the value that can be passed as an implicit argument to a parameter of type
tin scopes.Declaration
Swift
mutating func implicitArgument(to t: ParameterType, exposedTo s: AnyScopeID) -> AnyDeclID?
-
A context in which a generic parameter can be instantiated.
See moreDeclaration
Swift
private struct InstantiationContext -
Creates a context for instantiating generic parameters used in
scopeOfUse.Declaration
Swift
private mutating func instantiationContext(in scopeOfUse: AnyScopeID) -> InstantiationContext -
Creates a context for instantiating generic parameters in
scopeOfUseby for usingr.Declaration
Swift
private mutating func instantiationContext( _ r: DeclReference, in scopeOfUse: AnyScopeID ) -> InstantiationContext -
Creates a context for instantiating generic parameters in
scopeOfUseby for usingd.Declaration
Swift
private mutating func instantiationContext( forUsing d: AnyDeclID, in scopeOfUse: AnyScopeID ) -> InstantiationContext -
Creates a context for instantiating generic parameters in
scopeOfUseby for usingd.Declaration
Swift
private mutating func instantiationContext( forUsing d: InitializerDecl.ID, in scopeOfUse: AnyScopeID ) -> InstantiationContext -
Replaces the generic parameters in
subjectby fresh variables, forming instantiation constraints atsite.Declaration
Swift
private mutating func open(type: AnyType, at site: SourceRange) -> InstantiatedType -
Replaces the generic parameters in
candidateby fresh variables if their environments don’t containscopeOfUse, updatingsubstitutionswith opened generic parameters and anchoring instantiation constraints atcause.Declaration
Swift
private mutating func instantiate( _ candidate: NameResolutionResult.Candidate, in scopeOfUse: AnyScopeID, updating substitutions: inout GenericArguments, anchoringInstantiationConstraintsAt cause: ConstraintOrigin ) -> NameResolutionResult.Candidate -
Replaces the generic parameters in
subjectby fresh variables if their environments don’t containscopeOfUse, assigningcauseto instantiation constraints.Declaration
Swift
private mutating func instantiate( _ subject: AnyType, in scopeOfUse: AnyScopeID, cause: ConstraintOrigin ) -> InstantiatedType -
Replaces the generic parameters in
See moresubjectby fresh variables if their environments don’t containcontextOfUse, assigningcauseto instantiation constraints.Declaration
Swift
private mutating func instantiate( _ subject: AnyType, in contextOfUse: InstantiationContext, cause: ConstraintOrigin, updating substitutions: inout GenericArguments ) -> InstantiatedType -
Replaces the generic parameters in
subjectby fresh variables if their environments don’t containcontextOfUse.Declaration
Swift
private mutating func instantiate( _ subject: AnyTerm, in contextOfUse: InstantiationContext, updating substitutions: inout GenericArguments ) -> AnyTerm -
Returns a fresh variables if
p‘ environment doesn’t containcontextOfUse.Declaration
Swift
private mutating func instantiate( _ p: GenericTypeParameterType, in contextOfUse: InstantiationContext, updating substitutions: inout GenericArguments ) -> AnyType -
Returns a fresh variables if
p‘ environment doesn’t containcontextOfUse.Declaration
Swift
private mutating func instantiate( _ p: GenericTermParameter, in contextOfUse: InstantiationContext, updating substitutions: inout GenericArguments ) -> AnyTerm -
Instantiates the contents of
constraintsincontextOfUse, updatingsubstitutionswith opened generic parameters and anchoring instantiation constraints atcause.Declaration
Swift
private mutating func instantiate( constraints: inout ConstraintSet, in contextOfUse: InstantiationContext, updating substitutions: inout GenericArguments, anchoringInstantiationConstraintsAt cause: ConstraintOrigin ) -
Returns
trueiffcontextOfUseis not contained inp‘s environment.Declaration
Swift
private func shouldOpen( _ p: GenericParameterDecl.ID, in contextOfUse: InstantiationContext ) -> Bool -
Returns
trueiff a use ofdinscopeOfUseis recursive.Declaration
Swift
private func isRecursive(useOf d: AnyDeclID, in scopeOfUse: AnyScopeID) -> Bool
-
Returns the inferred type of
d, which is is used aspurpose, inserting new proof obligations inobligations.Declaration
Swift
private mutating func inferredType( of d: BindingDecl.ID, usedAs purpose: BindingDeclUse, updating obligations: inout ProofObligations ) -> AnyType -
Returns the inferred type of
e, updatingobligationsand gathering contextual information fromhint.Declaration
Swift
private mutating func inferredType<T: ExprID>( of e: T, withHint hint: AnyType? = nil, updating obligations: inout ProofObligations ) -> AnyType -
Returns the inferred type of
e, updatingobligationsand gathering contextual information fromhint.Declaration
Swift
private mutating func _inferredType( of e: ArrowTypeExpr.ID, withHint hint: AnyType? = nil, updating obligations: inout ProofObligations ) -> AnyType -
Returns the inferred type of
e, updatingobligationsand gathering contextual information fromhint.Declaration
Swift
private mutating func _inferredType( of e: BooleanLiteralExpr.ID, withHint hint: AnyType? = nil, updating obligations: inout ProofObligations ) -> AnyType -
Returns the inferred type of
e, updatingobligationsand gathering contextual information fromhint.Declaration
Swift
private mutating func _inferredType( of e: BufferLiteralExpr.ID, withHint hint: AnyType? = nil, updating obligations: inout ProofObligations ) -> AnyType -
Returns the inferred type of
e, updatingobligationsand gathering contextual information fromhint.Declaration
Swift
private mutating func _inferredType( of e: CaptureExpr.ID, withHint hint: AnyType? = nil, updating obligations: inout ProofObligations ) -> AnyType -
Returns the inferred type of
e, updatingobligationsand gathering contextual information fromhint.Declaration
Swift
private mutating func _inferredType( of e: CastExpr.ID, withHint hint: AnyType? = nil, updating obligations: inout ProofObligations ) -> AnyType -
Returns the inferred type of
e, updatingobligationsand gathering contextual information fromhint.Declaration
Swift
private mutating func _inferredType( of e: ConditionalExpr.ID, withHint hint: AnyType? = nil, updating obligations: inout ProofObligations ) -> AnyType -
Undocumented
Declaration
Swift
private mutating func _inferredType( of e: ConformanceLensExpr.ID, withHint hint: AnyType? = nil, updating obligations: inout ProofObligations ) -> AnyType -
Returns the inferred type of
e, updatingobligationsand gathering contextual information fromhint.Declaration
Swift
private mutating func _inferredType( of e: ExistentialTypeExpr.ID, withHint hint: AnyType? = nil, updating obligations: inout ProofObligations ) -> AnyType -
Returns the inferred type of
e, updatingobligationsand gathering contextual information fromhint.Declaration
Swift
private mutating func _inferredType( of e: FloatLiteralExpr.ID, withHint hint: AnyType? = nil, updating obligations: inout ProofObligations ) -> AnyType -
Returns the inferred type of
e, updatingobligationsand gathering contextual information fromhint.Declaration
Swift
private mutating func _inferredType( of e: FunctionCallExpr.ID, withHint hint: AnyType? = nil, updating obligations: inout ProofObligations ) -> AnyType -
Returns the inferred type of
eknowing its callee has typecallee, updatingobligationsand gathering contextual information fromhint.Declaration
Swift
private mutating func _inferredType( of e: FunctionCallExpr.ID, withCallee callee: AnyType, withHint hint: AnyType?, updating obligations: inout ProofObligations ) -> AnyType -
Returns the inferred type of
e, updatingobligationsand gathering contextual information fromhint.Declaration
Swift
private mutating func _inferredType( of e: InoutExpr.ID, usedAs purpose: NameUse = .unapplied, withHint hint: AnyType? = nil, updating obligations: inout ProofObligations ) -> AnyType -
Returns the inferred type of
e, updatingobligationsand gathering contextual information fromhint.Declaration
Swift
private mutating func _inferredType( of e: IntegerLiteralExpr.ID, withHint hint: AnyType? = nil, updating obligations: inout ProofObligations ) -> AnyType -
Returns the inferred type of
e, updatingobligationsand gathering contextual information fromhint.Declaration
Swift
private mutating func _inferredType( of e: LambdaExpr.ID, withHint hint: AnyType? = nil, updating obligations: inout ProofObligations ) -> AnyType -
Returns the inferred type of
e, updatingobligationsand gathering contextual information fromhint.Declaration
Swift
private mutating func _inferredType( of e: MatchExpr.ID, withHint hint: AnyType? = nil, updating obligations: inout ProofObligations ) -> AnyType -
Returns the inferred type of
e, updatingobligationsand gathering contextual information fromhintandimplicitQualification.If the leftmost component of
eis implicit, (e.g.,.foo.bar), then its next component is resolved using qualified name lookup inimplicitQualification.purposedescribes the wayeis used.Declaration
-
Returns the inferred type of
e, updatingobligationsand gathering contextual information fromhint.Declaration
Swift
private mutating func _inferredType( of e: PragmaLiteralExpr.ID, withHint hint: AnyType? = nil, updating obligations: inout ProofObligations ) -> AnyType -
Returns the inferred type of
e, usinghintfor context and updatingobligations.Declaration
Swift
private mutating func _inferredType( of e: RemoteTypeExpr.ID, withHint hint: AnyType? = nil, updating obligations: inout ProofObligations ) -> AnyType -
Returns the inferred type of
e, updatingobligationsand gathering contextual information fromhint.Declaration
Swift
private mutating func _inferredType( of e: SequenceExpr.ID, withHint hint: AnyType? = nil, updating obligations: inout ProofObligations ) -> AnyType -
Returns the inferred type of
e, updatingobligationsand gathering contextual information fromhint.Declaration
Swift
private mutating func _inferredType( of e: FoldedSequenceExpr, withHint hint: AnyType? = nil, updating obligations: inout ProofObligations ) -> AnyType -
Returns the inferred type of
e, updatingobligationsand gathering contextual information fromhint.Declaration
Swift
private mutating func _inferredType( of e: StringLiteralExpr.ID, withHint hint: AnyType? = nil, updating obligations: inout ProofObligations ) -> AnyType -
Returns the inferred type of
e, updatingobligationsand gathering contextual information fromhint.Declaration
Swift
private mutating func _inferredType( of e: SubscriptCallExpr.ID, withHint hint: AnyType? = nil, updating obligations: inout ProofObligations ) -> AnyType -
Returns the inferred type of
eknowing its callee has typecallee, updatingobligationsand gathering contextual information fromhint.Declaration
Swift
private mutating func _inferredType( of e: SubscriptCallExpr.ID, withCallee callee: AnyType, withHint hint: AnyType?, updating obligations: inout ProofObligations ) -> AnyType -
Returns the inferred type of
e, updatingobligationsand gathering contextual information fromhint.Declaration
Swift
private mutating func _inferredType( of e: TupleExpr.ID, withHint hint: AnyType? = nil, updating obligations: inout ProofObligations ) -> AnyType -
Returns the inferred type of
e, updatingobligationsand gathering contextual information fromhint.Declaration
Swift
private mutating func _inferredType( of e: TupleMemberExpr.ID, withHint hint: AnyType? = nil, updating obligations: inout ProofObligations ) -> AnyType -
Returns the inferred type of
e, updatingobligationsand gathering contextual information fromhint.Declaration
Swift
private mutating func _inferredType( of e: TupleTypeExpr.ID, withHint hint: AnyType? = nil, updating obligations: inout ProofObligations ) -> AnyType -
Returns the inferred type of
eusinghintfor context and updatingobligations.Declaration
Swift
private mutating func _inferredType( of e: WildcardExpr.ID, withHint hint: AnyType? = nil, updating obligations: inout ProofObligations ) -> AnyType -
Returns the inferred type of
e‘s callee usingqto resolve implicit qualifications and updatingobligations.Declaration
Swift
private mutating func inferredCalleeType( of e: FunctionCallExpr.ID, implicitlyIn q: AnyType?, updating obligations: inout ProofObligations ) -> AnyType -
Returns the inferred type of
e‘s callee usingqto resolve implicit qualifications and updatingobligations.Declaration
Swift
private mutating func inferredCalleeType( of e: SubscriptCallExpr.ID, implicitlyIn q: AnyType?, updating obligations: inout ProofObligations ) -> AnyType -
Returns the inferred type of
callee, which is a callee used aspurpose, usingqto resolve implicit qualifications and updatingobligations.Declaration
Swift
private mutating func inferredType( ofCallee callee: AnyExprID, usedAs purpose: NameUse, implicitlyIn q: AnyType?, updating obligations: inout ProofObligations ) -> AnyType -
Returns the inferred type of
literal, which is a literal, updatingobligations, gathering contextual information fromhint, and defaulting todefaultTypeif contextual information doesn’t allow top-down inference.If
hintis notnil, it is constrained to be conforming to theExpressibleBy***Literalcorresponding todefaultTypeand the type ofeif inferred ashint. Otherwise, the type ofliteralis inferred asdefaultType.Requires
literalis a literal expression.Declaration
Swift
private mutating func _inferredType<T: Expr>( ofLiteral literal: T.ID, withHint hint: AnyType? = nil, defaultingTo defaultType: AnyType, updating obligations: inout ProofObligations ) -> AnyType -
Returns the inferred type of
e‘s output, updatingobligationsand gathering contextual information fromhint.Declaration
Swift
private mutating func inferredReturnType( of e: LambdaExpr.ID, withHint hint: AnyType? = nil, updating obligations: inout ProofObligations ) -> AnyType -
Returns the inferred type of
p, updatingobligationsand gathering contextual information fromhint.Declaration
Swift
private mutating func inferredType( of p: AnyPatternID, withHint hint: AnyType? = nil, updating obligations: inout ProofObligations ) -> AnyType -
Returns the inferred type of
p, updatingobligationsand gathering contextual information fromhint.Declaration
Swift
private mutating func inferredType( of p: BindingPattern.ID, withHint hint: AnyType? = nil, updating obligations: inout ProofObligations ) -> AnyType -
Returns the inferred type of
p, updatingobligationsand gathering contextual information fromhint.Declaration
Swift
private mutating func inferredType( of p: ExprPattern.ID, withHint hint: AnyType? = nil, updating obligations: inout ProofObligations ) -> AnyType -
Returns the inferred type of
p, updatingobligationsand gathering contextual information fromhint.Declaration
Swift
private mutating func inferredType( of p: NamePattern.ID, withHint hint: AnyType? = nil, updating obligations: inout ProofObligations ) -> AnyType -
Returns the inferred type of
p, updatingobligationsand gathering contextual information fromhint.Declaration
Swift
private mutating func inferredType( of p: OptionPattern.ID, withHint hint: AnyType? = nil, updating obligations: inout ProofObligations ) -> AnyType -
Returns the inferred type of
See morep, updatingobligationsand gathering contextual information fromhint.Declaration
Swift
private mutating func inferredType( of p: TuplePattern.ID, withHint hint: AnyType? = nil, updating obligations: inout ProofObligations ) -> AnyType -
Returns the inferred type of
p, updatingobligationsand gathering contextual information fromhint.Declaration
Swift
private mutating func inferredType( of p: WildcardPattern.ID, withHint hint: AnyType? = nil, updating obligations: inout ProofObligations ) -> AnyType -
Returns the inferred type of the elements over which
siterates.The returned type is obtained by looking at the traits implemented by the type
Dof the loop’s iteration domain. For a non-consuming loop (i.e., a loop whose pattern is introduced withletorinout), the return value is the implementation ofCollection.ElementforD‘s conformance toCollectionin the innermost scope enclosings. If such a conformance does not exist, or if the loop is consuming, then the return value is the implementation ofIterator.ElementforD’s conformance toIterator, ornilif such a conformance doesn not exist. -
Updates
obligationswith the constraints implied by the result of name resolution for each element incomponents.Declaration
Swift
private mutating func constrain( _ components: [NameResolutionResult.ResolvedComponent], in obligations: inout ProofObligations ) -> AnyType -
Updates
obligationsto constrainnameas a reference to one ofcandidates, extendingsubstitutionswith opened generic parameters, and returning the inferred type ofname.Requires
candidatesis not emptyDeclaration
Swift
private mutating func constrain( _ name: NameExpr.ID, to candidates: [NameResolutionResult.Candidate], in obligations: inout ProofObligations, extending substitutions: inout GenericArguments ) -> AnyType -
Constrains
subjectto have typetinobligations, returningcache.local.exprType[e]if it isn’tnilortotherwise.Note
Unlikeassign(_:to:), this method doesn’t overrideinferredTypes[subject]if it isn’tnilbut creates an equality constraint instead.Declaration
Swift
@discardableResult private mutating func constrain<T: ExprID>( _ e: T, to t: AnyType, in obligations: inout ProofObligations ) -> AnyType -
Proves the formulae in
obligations, which relate to the well-typedness ofn, returning the best assignment of universally quantified variables.Declaration
Swift
@discardableResult private mutating func discharge<T: NodeIDProtocol>( _ obligations: ProofObligations, relatedTo n: T, ignoringSharedCache ignoreSharedCache: Bool = false ) -> Solution -
Commits the choices made in
solutionto satisfyobligationsin the program.Declaration
Swift
private mutating func commit( _ solution: Solution, satisfying obligations: ProofObligations, ignoringSharedCache ignoreSharedCache: Bool ) -
Calls
actiononself, logging a trace of constraint solving iffshouldTraceInference(n)returnstrue.Declaration
Swift
private mutating func tracingInference<T: NodeIDProtocol>( relatedTo n: T, _ action: (inout Self, Bool) -> Solution ) -> Solution -
Returns the rank of
lhsrelative rorhs. -
Compares
lhsandrhsinscopeOfUseand returns whether one has either shadows or is more specific than the other.lhsandrhsare assumed to have compatible types.Declaration
Swift
private mutating func compareBindingPrecedence( _ lhs: AnyDeclID, _ rhs: AnyDeclID, in scopeOfUse: AnyScopeID, at site: SourceRange ) -> StrictPartialOrdering -
Compares
lhsandrhsinscopeOfUseand returns whether one shadows the other.lhsis deeper thanrhsw.r.t.scopeOfUseif any of these statements hold:lhsandrhsare members of traitst1andt2, respectively, andt1refinest2.lhsisn’t member of a trait andrhsis.lhsis lexically deeper thanrhs(seeProgram.compareLexicalDepth).
Declaration
Swift
private mutating func compareDepth( _ lhs: AnyDeclID, _ rhs: AnyDeclID, in scopeOfUse: AnyScopeID ) -> StrictPartialOrdering -
Compares
lhsandrhsinscopeOfUseand returns whether one is more specific than the other, instantiating generic type constraints atsite.lhsis more specific thanrhsiff bothlhsandrhsare callable types with the same labels andlhsaccepts strictly less arguments thanrhs.Declaration
Swift
private mutating func compareSpecificity( _ lhs: AnyType, _ rhs: AnyType, in scopeOfUse: AnyScopeID, at site: SourceRange ) -> StrictPartialOrdering -
Returns
trueifflhsis more specific thanrhsinscopeOfUse, instantiating generic type constraints atsite.Declaration
Swift
private mutating func isMoreSpecific( _ lhs: AnyType, _ rhs: AnyType, in scopeOfUse: AnyScopeID, at site: SourceRange ) -> Bool
-
Returns a binary tree encoding the evaluation order of
eornilifecontains an undefined operator.Declaration
Swift
private mutating func fold(_ e: SequenceExpr.ID) -> FoldedSequenceExpr? -
Returns a copy of
initialResultin whichtailhas been incorporated orniliftailcontains an undefined operator.Declaration
Swift
private mutating func fold( _ tail: ArraySlice<SequenceExpr.TailElement>, into initialResult: FoldedSequenceExpr ) -> FoldedSequenceExpr?
-
Creates a fresh type variable.
The returned instance is unique access concurrent type checker instances.
Declaration
Swift
mutating func freshVariable() -> TypeVariable -
Creates a fresh term variable.
The returned instance is unique access concurrent type checker instances.
Declaration
Swift
mutating func freshTermVariable() -> TermVariable -
Returns
trueifftis known as an arrow type.Declaration
Swift
private func isArrow(_ t: AnyType) -> Bool -
Returns
trueifftis known as a subscript type.Declaration
Swift
private func isSubscript(_ t: AnyType) -> Bool -
Returns
trueiffeis bound to a nominal type declaration ino.Declaration
Swift
private mutating func isBoundToNominalTypeDecl(_ e: AnyExprID, in o: ProofObligations) -> Bool -
Returns
trueiffris bound to a nominal type declaration.Declaration
Swift
private mutating func isBoundToNominalTypeDecl(_ r: DeclReference) -> Bool -
Returns
trueiffdis a nominal type declaration.Declaration
Swift
private mutating func isNominalTypeDecl(_ d: AnyDeclID) -> Bool -
Returns
trueiffdintroducesvarbindings.Declaration
Swift
private func isVar(_ d: BindingDecl.ID) -> Bool -
Returns
trueifftis the receiver of a trait declaration.Declaration
Swift
private func isTraitReceiver(_ t: GenericTypeParameterType) -> Bool -
Returns
trueifftis a generic type parameter an associated type rooted at one.Declaration
Swift
private func isAbstractAssociatedDomain(_ t: AnyType) -> Bool -
Returns
trueifdisn’t a trait requirement, an FFI, or an external function.Declaration
Swift
private func requiresBody(_ d: FunctionDecl.ID) -> Bool -
Returns the trait whose
gis the receiver, if any.Declaration
Swift
private func traitIntroducing(_ g: GenericParameterDecl.ID) -> TraitType? -
Returns
trueiff control flow may jump to the statement afters.Declaration
Swift
private mutating func canFallThrough<T>(_ s: T) -> Bool where T : StmtID -
Returns
trueiff control flow may jump to the statement afters.Declaration
Swift
private mutating func canFallThrough(_ s: BraceStmt.ID) -> Bool -
Returns
falseiff executingsalways terminates the program.Declaration
Swift
private mutating func canFallThrough(_ s: ExprStmt.ID) -> Bool -
Returns how
aandbare ordered.Declaration
-
Returns how
aandbare ordered.Declaration
Swift
private mutating func compareOrder( _ a: RequirementSymbol, _ b: RequirementSymbol ) -> StrictOrdering -
Returns how
aandbare ordered.Declaration
Swift
private mutating func compareOrder( _ a: RequirementTerm, _ b: RequirementTerm ) -> StrictOrdering -
Returns the requirement term corresponding to
t.Declaration
Swift
func buildTerm(_ t: AnyType) -> RequirementTerm
View on GitHub