feat(core): virtual file system and Swift string semantics

The core gains Swift's virtual file system (paths, case-insensitive
lookup that keeps the spelling, quotas, atomic changes, the defaults of
a new device) and the string behaviour the ported code relies on without
saying so. Both are measured in the Swift oracle: 11 file system cases
(the three Swift tests among them) step by step, and trimming, lower
case, equality, ordering and Base64 case by case — whitespace and control
characters over all of Unicode.

Found by measuring:
- Swift trims NEL and ZERO WIDTH SPACE, not the BOM; JS trim() does the
  opposite. The .fls import now trims with swiftTrim.
- lowercased() maps scalar by scalar: a word-final sigma stays σ.
- Foundation decodes "====" and "Y===" as empty data.
- Foundation on Linux counts 24,735 plane-14 scalars as control
  characters, a table artefact; the port keeps Unicode Cc+Cf.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-29 21:23:45 +00:00
co-authored by Claude Opus 5.5
parent 51a83ea68d
commit a198d10b4a
15 changed files with 5247 additions and 18 deletions
+130
View File
@@ -0,0 +1,130 @@
{
"trim": [
" a ",
"\t\na\r",
"\u0085a\u0085",
"\ufeffa",
"\u00a0a\u00a0",
"\u2028a\u2029",
"\u3000a",
"\u200ba",
"\u001ca",
"\u000ba\f",
" \u0301a",
"a \u0301",
"\u180ea",
"\u1680a"
],
"lowercased": [
"ABC",
"\u03a3\u0391\u03a3",
"\u0391\u03a3 x",
"\u0130",
"\u1e9e",
"\u01c5",
"\u00c4\u00d6\u00dc",
"\u212a"
],
"equal": [
[
"\u00e9",
"e\u0301"
],
[
"\u00c5",
"A\u030a"
],
[
"\ufb01",
"fi"
],
[
"K",
"\u212a"
],
[
"\u03a9",
"\u2126"
],
[
"a",
"A"
],
[
"\u00e9",
"\u00e9"
]
],
"sort": [
[
"b",
"a",
"B"
],
[
"\uff5e",
"\ud83d\ude00"
],
[
"e\u0301x",
"\u00e9a"
],
[
"a",
"A",
"\u00e1",
"Z"
],
[
"file10",
"file2",
"File1"
]
],
"base64": [
"aGVsbG8=",
"aGVsbG8",
"aGVs bG8=",
"aGVsbG8=\n",
"aGVs=bG8=",
"====",
"",
"aGVsbG8==",
"YQ==",
"YQ",
"Y",
"!!!!YQ==",
"YQ==YQ==",
"YWJj",
"Y\u00e9Q==",
"YQ=\n=",
"Y===",
"YQ=",
"YWI=",
"YW==",
"=YQ=",
"A===",
"AA==",
"AAA=",
"AB==",
"ABC=",
"YQ===",
"YQ==\u0000",
"Y=Q=",
"YWJjZA",
"YWJjZA=",
"=",
"==",
"==="
],
"controlCharacters": [
"a",
"a\u200b",
"a\u007f",
"a\u00ad",
"a\u0085",
"\ufeff",
"a\ud83d\ude00",
"a\ue000"
]
}