Repository navigation
Make generated stunt names unique per constructed type - #317
Merged
Merged
Conversation
kzu
enabled auto-merge (rebase)
October 27, 2026 02:06
Stunt and default-interface helper names drop argument namespaces and nesting, and array arguments added nothing to the name, so different constructed types (IList<int[]>/IList<string[]>, IFoo<A.Bar>/IFoo<B.Bar>) shared one name and the generator silently dropped all but one of them. Deduplicate by run-time identity instead, name array arguments (ArrayOfInt32, Array2DOfString), and append a stable hash to every name that different types would share. Non-colliding names are unchanged. Also add the missing [Fact] to StuntNamingTests.GenericOfTwoGenericNames. Co-authored-by: CodeAlta <noreply@codealta.io> Co-authored-by: Cursor <cursoragent@cursor.com>
kzu
force-pushed
the
alta/stout-gannet-qnx8
branch
from
October 27, 2026 02:07
32e0e47 to
e72783d
Compare
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.
Generated stunt names only used simple type names, and array type arguments added nothing to the name. Different constructed types could therefore share one name:
IList<int[]>andIList<string[]>(bothIListOfStunt),IFoo<A.Bar>andIFoo<B.Bar>, orIFoo<Wrap<int>, string>andIFoo<Wrap<int, string>>. The generator deduplicated candidates by that name, so it generated only one of them, and the other call site failed at run time with a registry miss. Default-interface helper classes (DefaultIFooOfBar) had the same collision.Changes
ArrayOfInt32,Array2DOfString,ArrayOfArrayOfInt32, in bothNamingConventionand the run-timeStuntNaming.NamingConvention.GetIdentityignores type order, nullable annotations and tuple element names. SoIFoo<(int a, int b)>andIFoo<(int, int)>still share one stunt.GetUniqueName/GetUniqueDefaultImplementationName, which append an FNV-1a hash, for exampleIFooOfBarStunt_1a2b3c4d. Every colliding name gets the hash, so names don't depend on the order of the call sites. Names without a collision are unchanged.ProcessorContext.AmbiguousDefaultImplementations.[Fact]toStuntNamingTests.GenericOfTwoGenericNames, which never ran before.Tests
StuntGeneratorTests.GeneratesConstructedTypesWithCollidingNamescovers arrays (including rank 2), same-named arguments from different namespaces, ambiguous generic nesting, default members through the suffixed helpers, and tuple-name variants. It calls every factory and checks the returned stunt's type.StuntNamingTests.ArrayArgumentNamescovers the run-time names.Stunts.UnitTestssuite passes locally.This pull request was created by CodeAlta, an AI coding agent.