Struct SymbolResolutionResult
The result of resolving an identifier name against a scope. Mirrors the other
*Result records: it carries a payload — the bound Symbol — or a diagnostic,
never both.
public readonly record struct SymbolResolutionResult : IEquatable<SymbolResolutionResult>
- Implements
- Inherited Members
Remarks
The resolver reports which compile-time error a lookup hit, not a located VBCompileErrorInfo — it does not know where the reference is. The caller, which has the syntax node, builds the diagnostic from ErrorId and Candidates.
- DuplicateDeclaration — the name is declared more than once within one module or procedure.
- AmbiguousName — the name resolves in more than one enclosing scope (members promoted from different modules or references); the reference must qualify it.
Constructors
SymbolResolutionResult(Symbol?, VBCompileErrorId?, ImmutableArray<Symbol>)
The result of resolving an identifier name against a scope. Mirrors the other
*Result records: it carries a payload — the bound Symbol — or a diagnostic,
never both.
public SymbolResolutionResult(Symbol? Symbol, VBCompileErrorId? ErrorId, ImmutableArray<Symbol> Candidates)
Parameters
SymbolSymbolThe bound symbol, or
nullwhen the name is unbound or in error.ErrorIdVBCompileErrorId?The compile-time error the lookup hit, or
null.CandidatesImmutableArray<Symbol>The colliding declarations for an error result; empty otherwise.
Remarks
The resolver reports which compile-time error a lookup hit, not a located VBCompileErrorInfo — it does not know where the reference is. The caller, which has the syntax node, builds the diagnostic from ErrorId and Candidates.
- DuplicateDeclaration — the name is declared more than once within one module or procedure.
- AmbiguousName — the name resolves in more than one enclosing scope (members promoted from different modules or references); the reference must qualify it.
Fields
Unbound
The name is declared nowhere visible from the origin scope.
public static readonly SymbolResolutionResult Unbound
Field Value
Properties
Candidates
The colliding declarations for an error result; empty otherwise.
public ImmutableArray<Symbol> Candidates { get; init; }
Property Value
ErrorId
The compile-time error the lookup hit, or null.
public VBCompileErrorId? ErrorId { get; init; }
Property Value
IsError
true when the lookup hit a compile-time error.
public bool IsError { get; }
Property Value
IsResolved
true when the name bound to exactly one symbol.
public bool IsResolved { get; }
Property Value
IsUnbound
true when no scope declared the name — not an error in itself.
public bool IsUnbound { get; }
Property Value
Symbol
The bound symbol, or null when the name is unbound or in error.
public Symbol? Symbol { get; init; }
Property Value
Methods
Ambiguous(IEnumerable<Symbol>)
The name resolves in more than one enclosing scope and must be qualified (AmbiguousName).
public static SymbolResolutionResult Ambiguous(IEnumerable<Symbol> candidates)
Parameters
candidatesIEnumerable<Symbol>
Returns
Duplicate(IEnumerable<Symbol>)
The name is declared more than once in a single scope (DuplicateDeclaration).
public static SymbolResolutionResult Duplicate(IEnumerable<Symbol> candidates)
Parameters
candidatesIEnumerable<Symbol>
Returns
Resolved(Symbol)
A successful resolution to symbol.
public static SymbolResolutionResult Resolved(Symbol symbol)
Parameters
symbolSymbol