Skip to content

Map fixed-width integer types and apply variable member defaults in constructors - #266

Merged
matt-edmondson merged 3 commits into
mainfrom
claude/project-thread-zs8vhq
Oct 20, 2026
Merged

matt-edmondson merged 3 commits into
mainfrom
claude/project-thread-zs8vhq

Conversation

@matt-edmondson

@matt-edmondson matt-edmondson commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Matt · project thread

Before: the C, C++, Rust and Go generators wrote short, ushort, uint, ulong, byte and sbyte exactly as given. None of those compilers accept these names; Go accepts byte only by coincidence. Python fell back to Any for them. Separately, a constructor that didn't set a member declared as a VariableDeclaration with a starting value dropped that value. rustc refused the struct literal with E0063, and Go and C started the member at zero.

After: each of the six types maps to its fixed-width counterpart in every target. A member declared as a variable now starts at its declared value in Rust, Go and C constructors, the same as one declared as a field.

Fixes #259. Closes #262.

How:

  • Integer widths. I added the six entries to each generator's type mapping. A new CompiledExemplar.Widths() type uses every width as both a member and a constructor parameter. It is compiled by gcc, g++, dotnet, go and rustc.
  • Constructor defaults. A new StandardLanguageGenerator.InstanceDefaults collects starting values from both kinds of member. Rust, Go and C use it for their constructors. New compile-and-run tests in ConstructorFieldDefaultTests cover all three languages.
  • Test hang. ToolchainHarness.Run now reads stderr while it reads stdout. Reading them one after the other deadlocked on Windows once rustc's warnings filled the pipe.

The full suite passes locally: 1311 tests, none skipped.

https://claude.ai/code/session_01QLW9twfnbvGihgS2DBD5HX


Generated by Claude Code

…d Python generators

short, ushort, uint, ulong, byte and sbyte had no mapping, so they were written verbatim and
none of the five toolchains accepted them. A Widths exemplar holding each one as a member and
a constructor parameter now goes through every compile test. Fixes #259.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QLW9twfnbvGihgS2DBD5HX
…er cannot deadlock the tests

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QLW9twfnbvGihgS2DBD5HX
@matt-edmondson matt-edmondson self-assigned this Oct 19, 2026
…ared value in Rust, Go and C

The Rust, Go and C constructors gathered starting values from field declarations only, so a
variable declaration with an initial value that the constructor did not set was dropped: rustc
refused the struct literal with E0063, and Go and C started the member at zero. Both member kinds
are now gathered through one helper. Closes #262.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QLW9twfnbvGihgS2DBD5HX
@matt-edmondson matt-edmondson changed the title Map every fixed-width integer type in the C, C++, Rust, Go and Python generators Map fixed-width integer types and apply variable member defaults in constructors Oct 19, 2026
@sonarqubecloud

Copy link
Copy Markdown

@matt-edmondson
matt-edmondson merged commit 907cfec into main Oct 20, 2026
16 checks passed
@matt-edmondson
matt-edmondson deleted the claude/project-thread-zs8vhq branch October 20, 2026 00:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants