Table of Contents

Struct SymbolResolutionResult

Namespace
RDCore.SDK.Runtime.Shared
Assembly
RDCore.SDK.dll

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 ErrorCode and Candidates. The errors a lookup hits:

  • Duplicate declaration in current scope: the name is declared more than once within one module or procedure.
  • Ambiguous name detected: the name resolves in more than one enclosing scope (members promoted from different modules or references); the reference must qualify it.
  • Definitions of property procedures for the same property are inconsistent: the name resolves to a property's Get/Let/Set accessors, but their declarations are not a valid property (MS-VBAL §5.3.1.7).
  • Argument required for Property Let or Property Set: the name resolves to a Property Let or Property Set declared with no parameters at all, so it has no value parameter (MS-VBAL §5.3.1.5: value-param is never bracketed).

Constructors

SymbolResolutionResult(Symbol?, RDCoreDiagnosticCode?, 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, RDCoreDiagnosticCode? ErrorCode, ImmutableArray<Symbol> Candidates)

Parameters

Symbol Symbol

The bound symbol, or null when the name is unbound or in error.

ErrorCode RDCoreDiagnosticCode?

The diagnostic code of the compile-time error the lookup hit (a CompilePrefix code), or null.

Candidates ImmutableArray<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 ErrorCode and Candidates. The errors a lookup hits:

  • Duplicate declaration in current scope: the name is declared more than once within one module or procedure.
  • Ambiguous name detected: the name resolves in more than one enclosing scope (members promoted from different modules or references); the reference must qualify it.
  • Definitions of property procedures for the same property are inconsistent: the name resolves to a property's Get/Let/Set accessors, but their declarations are not a valid property (MS-VBAL §5.3.1.7).
  • Argument required for Property Let or Property Set: the name resolves to a Property Let or Property Set declared with no parameters at all, so it has no value parameter (MS-VBAL §5.3.1.5: value-param is never bracketed).

Fields

Unbound

The name is declared nowhere visible from the origin scope.

public static readonly SymbolResolutionResult Unbound

Field Value

SymbolResolutionResult

Properties

Candidates

The colliding declarations for an error result; empty otherwise.

public ImmutableArray<Symbol> Candidates { get; init; }

Property Value

ImmutableArray<Symbol>

ErrorCode

The diagnostic code of the compile-time error the lookup hit (a CompilePrefix code), or null.

public RDCoreDiagnosticCode? ErrorCode { get; init; }

Property Value

RDCoreDiagnosticCode?

IsError

true when the lookup hit a compile-time error.

public bool IsError { get; }

Property Value

bool

IsResolved

true when the name bound to exactly one symbol.

public bool IsResolved { get; }

Property Value

bool

IsUnbound

true when no scope declared the name: not an error in itself.

public bool IsUnbound { get; }

Property Value

bool

Symbol

The bound symbol, or null when the name is unbound or in error.

public Symbol? Symbol { get; init; }

Property Value

Symbol

Methods

Resolved(Symbol)

A successful resolution to symbol.

public static SymbolResolutionResult Resolved(Symbol symbol)

Parameters

symbol Symbol

Returns

SymbolResolutionResult