Move to CSharpAuthor 1.1.1007 and drop the workarounds - #21
Merged
Conversation
Three types existed only because the library could not express what the interception writer needed. It can now, so they go: - ConstrainedTypeDefinition carried a where clause on a base type, because a class could not declare one. ClassDefinition.WhereStatement replaces it, and the type parameters move out of the class name into AddGenericParameter — so the state class no longer needs a hand-built ConstructorDefinition to avoid emitting `DmState0<T>(...)` as its constructor name. - AccessorMemberDefinition wrote events and multi-index indexers. EventDefinition and PropertyDefinition.IndexParameters replace it. - TypeParameterDefinition is now the library's own, with the value equality the local copy was missing. Its tests go with it: they covered a dependency's behaviour, which is tested where it lives. State classes are sealed now, which ComponentModifier could not say before. The snapshots move for a reason worth reading: 1.1.1007 fixes stray indentation before a closing parenthesis, so every single-argument invocation this generator emits loses the spaces it used to carry — `Add(ModuleDependencies )` becomes `Add(ModuleDependencies)`. Checked that every snapshot diff is whitespace before a closing paren and nothing else. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EgLfDy82CnQZiuU5j8byu9
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.
Three types in
SourceGenerator.Impl.Utilitiesexisted only because CSharpAuthor could not express what the interception writer needed. 1.1.1007 can, so they go — 515 lines deleted, 170 added.ConstrainedTypeDefinitionClassDefinition.WhereStatementAccessorMemberDefinitionEventDefinition,PropertyDefinition.IndexParametersTypeParameterDefinitionCSharpAuthor.TypeParameterDefinitionTwo related hacks go with them. The state class no longer smuggles its type parameters through the class name —
AddGenericParameterdeclares them — which in turn means the hand-builtnew ConstructorDefinition($"DmState{index}")can go back toAddConstructor(), since the name no longer carries<T>for the constructor to inherit. State classes are alsosealednow, whichComponentModifiercould not say before.The local
TypeParameterDefinitiontests are deleted rather than moved: they covered a dependency's behaviour, and it is tested where it lives.The snapshots move, and it is worth reading why
1.1.1007 fixes stray indentation before a closing parenthesis, which this generator has been emitting on every single-argument invocation:
That is not interception-specific — it is all generated output from this library, which is why eight module snapshots move. I checked every diff across all of them normalises to whitespace before a closing paren and nothing else, so no semantics changed.
The API snapshot also shows the whole 1006→1007 CSharpAuthor delta, because that source is compiled into the analyzer assembly. That includes
sealed/record/init/file-scoped-namespace support which was already on theirmainbefore any of this work.Verification
385 tests pass (400 minus the 15 deleted duplicates), 0 warnings, 86.9% coverage,
verify-packages.shclean. Generated output inspected directly for the generic state class, the event, and the multi-index indexer.🤖 Generated with Claude Code
https://claude.ai/code/session_01EgLfDy82CnQZiuU5j8byu9