Skip to content

Remove ParserNullabilityExtensions.AsNullable() workaround #44

Description

@craigsmitham

Context

When removing #nullable disable directives from the LanguageModel Grammar files, Superpower's OptionalOrDefault<T>() requires TokenListParser<TKind, T?> but our grammar parsers return TokenListParser<TKind, T> (non-nullable). This causes CS8620 errors.

Current workaround

ParserNullabilityExtensions.AsNullable<TKind, T>() in src/GraphZen.LanguageModel/LanguageModel/Internal/ParserNullabilityExtensions.cs bridges this by converting the parser's type parameter to nullable at the type level.

Desired resolution

Investigate whether a newer version of Superpower provides nullable-annotated APIs, or whether we can contribute nullable annotations upstream. If so, this workaround can be removed.

🤖 Generated with Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions