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 Stream boilerplate source-generator and attribute #2185

Merged

Conversation

Jozkee
Copy link
Member

@Jozkee Jozkee commented Jan 30, 2023

Forked from https://github.com/dotnet/runtimelab/tree/standalone-template.

  • Adds the System.IO.StreamSourceGeneration project containing the generator and the [GenerateStreamBoilerplate] attribute.

  • Adds test verifying generation of a variety of streams that implement one or more members that can be used to hint to the generator what it should do:

    • StreamThatImplementsNothing
    • StreamThatImplementsReadAsyncByte
    • StreamThatImplementsReadAsyncMemory
    • StreamThatImplementsReadByte
    • StreamThatImplementsReadSpan
    • StreamThatImplementsSeek
    • StreamThatImplementsWriteAsyncByte
    • StreamThatImplementsWriteAsyncMemory
    • StreamThatImplementsWriteByte
    • StreamThatImplementsWriteSpan

This PR does not add, but is intended as a foundation for adding analyzer rules that hint the user about potential improvements on their Stream implementation. e.g: "Prefer overriding Span/Memory overloads instead of calling byte[] ones."

  • Adds several diagnostics (without fixers).

@Jozkee Jozkee marked this pull request as ready for review February 13, 2023 16:24
@Jozkee Jozkee changed the title Initial comit for Stream boilerplate source-gen Add Stream boilerplate source-generator and attribute Feb 13, 2023
@bartonjs bartonjs added * NO MERGE * The PR is not ready for merge yet (see discussion for detailed reasons) and removed * NO MERGE * The PR is not ready for merge yet (see discussion for detailed reasons) labels Feb 14, 2023
@Jozkee Jozkee requested a review from bartonjs February 17, 2023 00:19
@Jozkee
Copy link
Member Author

Jozkee commented Feb 23, 2023

Ping @stephentoub @bartonjs, this is ready for re-review.

@Jozkee
Copy link
Member Author

Jozkee commented Aug 28, 2023

Ping @stephentoub.

I'm planning on adding tests to ensure we emit the proper diagnostics, functional tests checking the behavior of the generated code already exists. In the meantime, this PR could benefit from a code review.

@Jozkee Jozkee merged commit b535999 into dotnet:feature/stream-sourcegen Dec 12, 2023
8 checks passed
@Jozkee Jozkee deleted the feature/stream-sourcegen branch December 12, 2023 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants