Skip to content

Add Resolve delegate support to generator#2

Open
AlonTalmi wants to merge 1 commit intomainfrom
codex/add-delegate-resolution-support
Open

Add Resolve delegate support to generator#2
AlonTalmi wants to merge 1 commit intomainfrom
codex/add-delegate-resolution-support

Conversation

@AlonTalmi
Copy link
Owner

Summary

  • add Resolve and NamedResolve delegates so generated containers can provide resolver delegates
  • update known types, call site generation, and diagnostics to emit delegates and errors when registrations are missing
  • document the new analyzer rules and add unit tests covering success and failure scenarios for resolve delegates

Testing

  • dotnet test src/Jab.Tests/Jab.Tests.csproj (fails: dotnet executable not available in environment)

Codex Task

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Jab", null)]
internal
#endif
delegate T Resolve<T>(string name);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Make Resolve delegate parameterless

Resolve<T> is declared with a string name parameter, identical to NamedResolve<T>, even though the generator emits the delegate for unnamed services and never forwards a name (see the lambda _ => GetService<T>()). As a result, consumers must supply a dummy string argument (resolver("ignored")) and cannot use the natural parameterless invocation (resolver()), and any name they pass is silently ignored. This makes the new API unusable for its intended lazy resolution scenario and will fail to compile in typical usage.

Useful? React with 👍 / 👎.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant