---
generated: true
model: claude-opus-4-7
generated_at: 2026-06-01T13:00:00+00:00
source_commit: d25453d7f0b4867db4cb5eabf34fb6cd088cf596
watched_paths_digest: 760b853284d0cc647891d9c5be06c8b725654931b3155a3945470a6cb84548b0
source_doc: docs/language-reference/expressions-literal.md
source_doc_digest: 769b627a9edfb98d3dcd82a049d5720ec282bc1a720cf4d1da09d5420919dd11
warning: "Auto-generated. May drift from source. Do not edit by hand."
---

# Tests for language-reference/expressions-literal

## Intent

Tests verify the literal-expression grammar and semantics claimed in
the **language reference** (the authoritative spec) at
[`docs/language-reference/expressions-literal.md`](../../../../language-reference/expressions-literal.md).
The language-reference outranks the design-doc bundles when both
cover the same claim — see
[`_meta/prompts/_common.md § Source-of-truth hierarchy`](../../_meta/prompts/_common.md).

Coverage strategy: one boundary or corner-case test per
documented grammar production / table row / explicit exception.

## Functional coverage

| Claim                                                                                                                                 | Intent     | Anchor                                                                                                            | Tests                                                                    |
| ------------------------------------------------------------------------------------------------------------------------------------- | ---------- | ----------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------ |
| `0` alone is a decimal literal (not octal); deprecation warning does not fire.                                                        | functional | [#integer-literal-expressions](../../../../language-reference/expressions-literal.md#integer-literal-expressions) | [`dec-zero-is-decimal.slang`](dec-zero-is-decimal.slang)                 |
| Hexadecimal literal: prefix `0x` followed by hex digits parses to the documented value; `0xFFFFFFFF` reads as the max uint32 pattern. | functional | [#integer-literal-expressions](../../../../language-reference/expressions-literal.md#integer-literal-expressions) | [`hex-prefix-lowercase.slang`](hex-prefix-lowercase.slang)               |
| Hexadecimal prefix is case-insensitive: `0XFF` (uppercase X) parses identically to `0xFF`.                                            | boundary   | [#integer-literal-expressions](../../../../language-reference/expressions-literal.md#integer-literal-expressions) | [`hex-prefix-uppercase.slang`](hex-prefix-uppercase.slang)               |
| Hexadecimal digits are case-insensitive: `0xabcd` and `0xABCD` parse to the same value.                                               | boundary   | [#integer-literal-expressions](../../../../language-reference/expressions-literal.md#integer-literal-expressions) | [`hex-digits-case-insensitive.slang`](hex-digits-case-insensitive.slang) |
| Binary literal: prefix `0b` followed by `0`/`1` digits parses to the documented value.                                                | functional | [#integer-literal-expressions](../../../../language-reference/expressions-literal.md#integer-literal-expressions) | [`bin-prefix-lowercase.slang`](bin-prefix-lowercase.slang)               |
| Smallest-negative-int32 exception: `-2147483648` is a valid `int` literal, not an overflow.                                           | boundary   | [#integer-literal-expressions](../../../../language-reference/expressions-literal.md#integer-literal-expressions) | [`smallest-negative-int32.slang`](smallest-negative-int32.slang)         |
| Smallest-negative-int64 exception: `-9223372036854775808LL` is a valid `int64_t` literal.                                             | boundary   | [#integer-literal-expressions](../../../../language-reference/expressions-literal.md#integer-literal-expressions) | [`smallest-negative-int64.slang`](smallest-negative-int64.slang)         |
| Suffix `U` forces an unsigned type: `1U` is `uint`.                                                                                   | functional | [#integer-literal-expressions](../../../../language-reference/expressions-literal.md#integer-literal-expressions) | [`suffix-u-unsigned.slang`](suffix-u-unsigned.slang)                     |
| Suffix `LL` selects `int64_t` first per the documented table.                                                                         | functional | [#integer-literal-expressions](../../../../language-reference/expressions-literal.md#integer-literal-expressions) | [`suffix-ll-int64.slang`](suffix-ll-int64.slang)                         |
| Suffix `ULL` selects `uint64_t`.                                                                                                      | functional | [#integer-literal-expressions](../../../../language-reference/expressions-literal.md#integer-literal-expressions) | [`suffix-ull-uint64.slang`](suffix-ull-uint64.slang)                     |
| Decimal literal in `[2147483648, 9223372036854775807]` promotes to `int64_t` per the documented table (without an explicit suffix).   | boundary   | [#integer-literal-expressions](../../../../language-reference/expressions-literal.md#integer-literal-expressions) | [`dec-int64-promotion.slang`](dec-int64-promotion.slang)                 |
| Boolean literal: `true` is `bool` valued `true`; `false` is `bool` valued `false`.                                                    | functional | [#boolean-literal-expressions](../../../../language-reference/expressions-literal.md#boolean-literal-expressions) | [`bool-true-false.slang`](bool-true-false.slang)                         |

## Untested claims

| Claim                                                                   | Reason                | Anchor                                                                                                            | Why untested                                                                                                                                                                                |
| ----------------------------------------------------------------------- | --------------------- | ----------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Floating-point literal grammar and corner cases.                        | (unclassified)        | [#integer-literal-expressions](../../../../language-reference/expressions-literal.md#integer-literal-expressions) | The `expressions-literal.md` section as committed does not (yet) describe floating-point literal grammar in normative detail. Will be added when the language-reference grows that section. |
| String literal grammar, escape sequences, raw strings.                  | (unclassified)        | [#integer-literal-expressions](../../../../language-reference/expressions-literal.md#integer-literal-expressions) | Not described in the current section.                                                                                                                                                       |
| `nullptr` literal.                                                      | (unclassified)        | [#integer-literal-expressions](../../../../language-reference/expressions-literal.md#integer-literal-expressions) | Not described in the current section.                                                                                                                                                       |
| Pointer-width suffixes `Z`, `UZ`/`ZU` — selects `intptr_t`/`uintptr_t`. | implementation-detail | [#integer-literal-expressions](../../../../language-reference/expressions-literal.md#integer-literal-expressions) | These suffixes are target-dependent (32-bit vs 64-bit pointers). A robust test would need explicit target-capability gating; deferred until that infrastructure is settled.                 |

## Doc gaps observed

| Anchor                                                                                                            | Kind              | Gap                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | Suggested addition                                                                                                                                                                                                                                     |
| ----------------------------------------------------------------------------------------------------------------- | ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [#integer-literal-expressions](../../../../language-reference/expressions-literal.md#integer-literal-expressions) | drift-from-source | The reference says "Octal integer literals are deprecated and supported only for backwards compatibility; their use triggers a warning." In practice the lexer rejects values like `08` as `unexpected token` rather than diagnosing them as octal-deprecated literals with an invalid digit, and `01` does not appear to trigger the documented warning. Either the lexer needs to implement the deprecation path the doc claims, or the doc should be rewritten to say octal literals are not supported. | Clarify in the doc whether octal literals are actually supported. If not, remove the grammar production and the "Note: `00`, `01`, etc. are octal literals" caveat. If yes, document the diagnostic codes for the warning and the invalid-digit error. |
| [#integer-literal-expressions](../../../../language-reference/expressions-literal.md#integer-literal-expressions) | drift-from-source | The suffix→type table has a row "`(none)/L`, dec base, `[9223372036854775808, 18446744073709551615]` → `uint64_t` (\*)" with the asterisk meaning "triggers a warning". In practice values above `INT64_MAX` lex-reject with `E10012` outright; there is no warning-then-fallback path.                                                                                                                                                                                                                    | Either implement the documented warning-then-promote path or remove the row + the asterisked caveat.                                                                                                                                                   |
| [#integer-literal-expressions](../../../../language-reference/expressions-literal.md#integer-literal-expressions) | ambiguous-claim   | The smallest-negative-int32 carve-out states "the resulting value is `-2147483648` and the type is `int`". In practice the type-is-`int` claim only holds in `int`-typed context (assignment to `int` variable); in unconstrained overload-resolution context the literal `-2147483648` resolves as `int64_t`. The carve-out value claim holds unconditionally; the type claim is context-sensitive.                                                                                                       | Clarify in the doc whether the carve-out applies unconditionally or only when the literal appears in an `int`-typed context. Analogous clarification needed for the `int64_t` carve-out.                                                               |
| [#boolean-literal-expressions](../../../../language-reference/expressions-literal.md#boolean-literal-expressions) | drift-from-source | The bool literal `false`, passed as a function argument of type `bool`, evaluates as `true` inside the callee under the `slangi` interpreter. The frontend emits the correct call site for `-target hlsl` and `-target cpu`, so the bug is in the VM, not the spec. Filed as a finding (see `_meta/findings/`). The doc claim is correct; the test is blocked on the compiler bug.                                                                                                                         | None to the spec. The test will move from `expected-failures.txt` back to active once the VM is fixed.                                                                                                                                                 |
