Railway-oriented programming for source generator pipelines. Never lose a diagnostic.
The Problem
Traditional generator code loses diagnostics:
The Solution
DiagnosticFlow<T> carries both value AND diagnostics through the pipeline:
Creating Flows
Chaining Operations
Select - Map Without Flow
Where - Filter with Diagnostic
WarnIf - Conditional Warning
Combining Flows
Result Handling
Pipeline Integration
Use with IncrementalValuesProvider:
Properties
Null-Safety
DiagnosticFlow<T> uses [MemberNotNullWhen] to enable flow-dependent null analysis:
The [MemberNotNullWhen(true, nameof(Value))] attribute on IsSuccess tells
the compiler that Value is guaranteed non-null when IsSuccess returns
true.