Skip to content

Fix Long literal rendering to add L suffix#1898

Merged
lewisjkl merged 5 commits intoseries/0.18from
copilot/fix-long-value-renderer
Mar 3, 2026
Merged

Fix Long literal rendering to add L suffix#1898
lewisjkl merged 5 commits intoseries/0.18from
copilot/fix-long-value-renderer

Conversation

Copy link
Contributor

Copilot AI commented Mar 2, 2026

When rendering integer number nodes as Document.fromLong(...), the generated literal lacked the L suffix, causing compilation failures (integer number too large) for values exceeding Int.MaxValue (e.g. 1716459630).

Changes

  • Renderer.scala: Append L suffix to generated long literals
    - line"smithy4s.Document.fromLong(${x.getValue.longValue()})"
    + line"smithy4s.Document.fromLong(${x.getValue.longValue()}L)"
  • Test expectations in DynamicHintRenderingSpec and AwsStandardTypesTransformerSpec updated to match new output
  • sampleSpecs/numeric.smithy: Changed the Long field default from 1 to 9999999999 (a value exceeding Int.MaxValue) to provide a concrete test case that validates the fix — without the L suffix, this would fail to compile
  • Bootstrapped managed sources regenerated via sbt bootstrapped/managedSources
  • CHANGELOG.md: Added entries for the 0.18.48 and upcoming 0.18.49 releases
Original prompt

This section details on the original issue you should resolve

<issue_title>Renderer of Long value - integer number too large</issue_title>
<issue_description>This change introduced a breaking change on v0.18.48: 7b2e915#diff-d9b9aaad6d4cbc087589558a913c2bc9e199420e82425b42800823a6c1a09af2R1893-R1897

On renderer:

line"smithy4s.Document.fromLong(${x.getValue.longValue()})"

If the long value is actually a long, it doesn't compile with integer number too large.

Previously, it was rendered with smithy4s.Document.fromDouble(${x.getValue.doubleValue()}d) and was working.

I think it can be fixed with the following:

- line"smithy4s.Document.fromLong(${x.getValue.longValue()})"
+ line"smithy4s.Document.fromLong(${x.getValue.longValue()}L)"
```</issue_description>

<agent_instructions>Update the renderer code to add the "L" character. Re-run 'sbt bootstrapped/managedSources' after you're done, and check in the changed files before opening the PR.</agent_instructions>

## Comments on the Issue (you are @copilot in this section)

<comments>
</comments>

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

…oo large'

Co-authored-by: kubukoz <894884+kubukoz@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix renderer of Long value for huge integers Fix Long literal rendering to add L suffix Mar 2, 2026
@kubukoz
Copy link
Member

kubukoz commented Mar 2, 2026

@copilot change one of the existing test values (in sampleSpecs/) so that it's too much for a normal integer, and regenerate the code.

@kubukoz
Copy link
Member

kubukoz commented Mar 2, 2026

@copilot also update the CHANGELOG file to include this PR. The next release will be 0.18.49.

Co-authored-by: kubukoz <894884+kubukoz@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 2, 2026

@copilot change one of the existing test values (in sampleSpecs/) so that it's too much for a normal integer, and regenerate the code.

Done in 2080a04. Changed l: Long = 1 to l: Long = 9999999999 in sampleSpecs/numeric.smithy — this value exceeds Int.MaxValue (2,147,483,647), so it would have failed to compile without the L suffix fix. The regenerated Numeric.scala now contains smithy4s.Document.fromLong(9999999999L) and l: Long = 9999999999L.

Co-authored-by: kubukoz <894884+kubukoz@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 2, 2026

@copilot also update the CHANGELOG file to include this PR. The next release will be 0.18.49.

Done in 6f65f28. Added the 0.18.49 entry to CHANGELOG.md.

@kubukoz
Copy link
Member

kubukoz commented Mar 3, 2026

@copilot add the missing CHANGELOG entry for 0.18.48 too

Co-authored-by: kubukoz <894884+kubukoz@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 3, 2026

@copilot add the missing CHANGELOG entry for 0.18.48 too

Done in 44f0529. Added the 0.18.48 entry to CHANGELOG.md with the two PRs from that release (#1886 and #1893).

@kubukoz kubukoz marked this pull request as ready for review March 3, 2026 15:22
@lewisjkl lewisjkl merged commit 4644a61 into series/0.18 Mar 3, 2026
10 checks passed
@lewisjkl lewisjkl deleted the copilot/fix-long-value-renderer branch March 3, 2026 23:35
yisraelU added a commit to yisraelU/smithy4s that referenced this pull request Mar 10, 2026
  Includes:
  - Long literal rendering fix (L suffix) from disneystreaming#1898
  - Mill 1.x backport from disneystreaming#1899
  - Codegen Scala 3 cross-compilation
  - Recursive scheme caching improvements

  Generated files kept as 0.19 (Hints.dynamic) variants;
  Long literal fix carried through Renderer merge.
yisraelU added a commit to yisraelU/smithy4s that referenced this pull request Mar 10, 2026
  Sync 0.18.48 and 0.18.49 changes into the 0.19 branch:
  - Long literal L suffix fix (disneystreaming#1898)
  - Dynamic number codegen update (disneystreaming#1886)
  - Type params for struct/union in codegen schemas (disneystreaming#1893)
  - Mill 1.x documentation update
  - Dependencies.Mima.core test dependency
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Renderer of Long value - integer number too large

4 participants