Skip to content

fix!: ShapeTag generation for nullable non-blittable types - #99

Merged
sator-imaging merged 4 commits into
mainfrom
fix-shapetag-nullable-suffix-587085618536675106
Aug 30, 2026
Merged

fix!: ShapeTag generation for nullable non-blittable types#99
sator-imaging merged 4 commits into
mainfrom
fix-shapetag-nullable-suffix-587085618536675106

Conversation

@google-labs-jules

Copy link
Copy Markdown
Contributor

Omit the '?' suffix in ShapeTag generation for reference types (string, arrays, classes) and non-blittable structs. Only value types (primitives, enums, blittable structs) retain the '?' suffix when wrapped in Nullable. Update SchemaSignatureTestsModelView shape tag expectation in tests.


PR created automatically by Jules for task 587085618536675106 started by @sator-imaging

@google-labs-jules

Copy link
Copy Markdown
Contributor Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@sator-imaging sator-imaging changed the title Fix ShapeTag generation for nullable non-blittable types fix!: ShapeTag generation for nullable non-blittable types Aug 30, 2026
Comment thread src/ZeroSerializerGenerator.cs Outdated
Comment on lines +1739 to +1741
if (underlying is not INamedTypeSymbol namedUnderlying
|| namedUnderlying.TypeKind != TypeKind.Struct
|| TryGetBlittableStructByteCount(namedUnderlying, out _))

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dislike this. I said target blittable struct. Don't append ? to something.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the logic to specifically target struct types when checking for blittability before deciding whether to omit the '?' suffix.

Comment thread src/ZeroSerializerGenerator.cs Outdated
}
else
{
shapeTagBuilder.Append('?');

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this? I don't need fallback. MUST TARGET THE SPECIFIC SHAPE.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactored the check to explicitly test !IsNonBlittableStruct(underlying), removing fallback branches and directly targeting non-blittable struct types.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't introduce unnecessary code shape change!!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactored the code to avoid unnecessary helpers or branching logic, returning early when the underlying type of Nullable is a non-blittable struct.

@sator-imaging
sator-imaging marked this pull request as ready for review August 30, 2026 02:29
@sator-imaging
sator-imaging merged commit 5688bda into main Aug 30, 2026
4 checks passed
@sator-imaging
sator-imaging deleted the fix-shapetag-nullable-suffix-587085618536675106 branch August 30, 2026 02:29
@sator-imaging sator-imaging added the bug Something isn't working label Aug 30, 2026
@sator-imaging sator-imaging changed the title fix!: ShapeTag generation for nullable non-blittable types fix!: ShapeTag generation for nullable non-blittable types Aug 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-change bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant