Skip to content

Non-BMP string literals on Linux; readonly parameter properties (TSLANG 28) - #787

Merged
ASDAlexander77 merged 3 commits into
mainfrom
non-bmp-literal
Nov 8, 2026
Merged

ASDAlexander77 merged 3 commits into
mainfrom
non-bmp-literal

Conversation

@ASDAlexander77

Copy link
Copy Markdown
Owner

Three commits:

  • A string literal past the BMP keeps its character on Linux. The parser holds source as UTF-16, so a non-BMP character is a surrogate pair; on Linux (32-bit wchar_t) convertWideToUTF8 read it as UTF-32, failed, and "😀" came out as "" (broke DefaultLib's string_fromCharCode.ts on every Linux runner of alpha118). The conversions now use UTF-16 there; Windows unchanged. The scanner also put "\u{1F600}" in a single unit (U+F600 on Windows); it is a surrogate pair now. Test 00string_non_bmp.ts.
  • A readonly constructor parameter is a parameter property (TSLANG 28). constructor(readonly width: int) made no field, so t.width didn't resolve. readonly alone now makes a public parameter property, as in TypeScript (field list and the generated this.x = x). Test 00tslang_issue_28.ts, JIT + compiled under gc/rc/none/own.
  • README: the ray tracer's 2026-10-31 results.

Testing

  • Windows ctest -C Release: 6697/6697 passed (with the issue 28 fix).
  • Linux (WSL) ctest 6661/6661 and DefaultLib main on Linux rc/none/own, for the non-BMP fix.

🤖 Generated with Claude Code

ASDAlexander77 and others added 3 commits November 8, 2026 12:42
The Performance table still gave the 2026-10-21 numbers (gc 1298 ms,
26x slower than C++). Since then @value, parameters captured by copy,
direct calls and tagless null took the tslang builds to 70-110 ms,
1.3-2.0x of idiomatic Rust; the table now gives those, as
tslang/benchmarks/raytrace/README.md does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The parser holds a source as UTF-16 units (stows reads it with
codecvt_utf8_utf16), so a character outside the BMP is a surrogate
pair. On Linux wchar_t has 32 bits, and llvm::convertWideToUTF8 read
the wide string as UTF-32, where a surrogate is invalid: the conversion
failed and a literal such as "😀" came out as "". It broke DefaultLib's
string_fromCharCode.ts on every Linux runner of the alpha118 release.
convertWideToUTF8 / convertUTF8toWide now convert UTF-16 there too;
Windows keeps its code.

The scanner's UTF16Encoding put a code point past U+FFFF in a single
wchar_t, so "\u{1F600}" was U+F600 on Windows. It is a surrogate pair
now, as the ES spec says.

00string_non_bmp.ts covers literals, templates and both escapes.
ctest: Windows 6689/6689, Linux (WSL) 6661/6661; DefaultLib main
(f5d8edb) on Linux passes rc/none/own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TypeScript makes a parameter property of a constructor parameter with
public, private, protected or readonly; tslang only of the first three,
so `constructor(readonly width: int)` left `t.width` unresolved. readonly
alone now makes a public parameter property, in both the field list and
the generated `this.x = x` assignment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ASDAlexander77
ASDAlexander77 merged commit 49f5faa into main Nov 8, 2026
2 checks passed
@ASDAlexander77
ASDAlexander77 deleted the non-bmp-literal branch November 8, 2026 18:19
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.

1 participant