fix: align generated nullable policy with consuming project - #50
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Make generated nullable handling project-level
Summary
AlephMapper-generated mapper files now follow the consuming project's
NullableContextOptionsrather than the source-local#nullablestate of individual mapping methods or inlined helpers.Each generated mapper file emits one file-level
#nullable restoreimmediately after its auto-generated header. This restores the project's nullable configuration for Roslyn-generated source trees, which otherwise default to nullable-disabled behavior.Changes
NullablePolicyto map project-levelEnable,Disable,Warnings, andAnnotationsmodes.class?constraints, when project annotations are disabled.!ornull!syntax.Tests
NullableContextOptionsmodes, independently modeling source annotations and expected generated annotations.CS8602warning is not silently suppressed under project nullable Enable.#nullable restoreand no member-level nullable directives.Nullable-flow behavior
Enable: generated annotations are emitted and nullable-flow warnings may surface.Disable: generated annotations and nullable-flow warnings are disabled.Warnings: generated annotations are omitted while nullable-flow warnings may surface.Annotations: generated annotations are emitted while nullable-flow warnings are disabled.The solution build now reports two legitimate
CS8600warnings from existing generated Experiment code. They are intentionally not suppressed: generated code follows the consuming project's nullable-warning policy.Validation
dotnet build AlephMapper.slnx --configuration Releasedotnet run --project tests/AlephMapper.Tests/AlephMapper.Tests.csproj -c Release— 60 passeddotnet test AlephMapper.slnx --configuration Release— 97 passeddotnet pack source/AlephMapper.csproj --configuration Release --output artifacts/nuget<Nullable>enable</Nullable>