Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add code analysis for attributed model #10

Open
FiniteReality opened this issue Apr 11, 2021 · 0 comments
Open

Add code analysis for attributed model #10

FiniteReality opened this issue Apr 11, 2021 · 0 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request
Milestone

Comments

@FiniteReality
Copy link
Owner

Right now the AttributedModelSourceGenerator doesn't do extra checks (e.g. return type checks) which means that it'll cause compilation errors if used incorrectly.

For example:

[Group("test")]
public class TestModule : Module
{
    [Command("test")]
    public void DoThing()
    { }
}

Will likely produce a class something like this:

internal class CommandFactory__TestModule__DoThing : ICommand
{
    public async ValueTask<ICommandResult> ExecuteAsync(...)
    {
        var commandClass = new TestModule(...);
        ...
        return await commandClass.DoThing();
        ...
    }
}

Which, as you can imagine, won't work.

@FiniteReality FiniteReality added bug Something isn't working enhancement New feature or request labels Apr 11, 2021
@FiniteReality FiniteReality added this to the 0.3 milestone Apr 11, 2021
@FiniteReality FiniteReality self-assigned this Apr 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant