Commit 3304d76
committed
feat(core): reject an undefined NormalizationForm, and declare the no-op as .NET's invariant mode (#2386)
Split out of #2338 after measurement corrected that ticket's premise twice.
THE FORM CHECK LANDS BECAUSE IT DEPENDS ON NO TABLE. CheckNormalizationForm
(Normalization.cs:88-97) runs BEFORE the invariant shortcut, so .NET rejects an undefined form
on every platform and in every mode. All four overloads now do too: ArgumentException with
.NET's verbatim "Invalid or unsupported normalization form." (Strings.resx:1324-1326) and
paramName "normalizationForm" -- nameof, not this port's own parameter spelling "form", because
a caller reads ParamName.
The four values are ENUMERATED, not range-checked, and that is load-bearing: 3 and 4 are HOLES
(FormC=1, FormD=2, FormKC=5, FormKD=6), so `raw >= 1 && raw <= 6` accepts two undefined values.
That mutation is caught.
.NET's second clause -- PlatformNotSupportedException for FormKC/FormKD on Browser/WASI -- is
deliberately NOT reproduced: it is conditioned on !GlobalizationMode.Invariant and so is
unreachable in .NET under this port's own conditions.
THE LARGER HALF IS A PREMISE CORRECTION. #2337 pinned three behaviours as "statements about the
CURRENT stub", each of which "must be inverted by the repair (#2338)". Measured, .NET's own body
is:
// In Invariant mode we assume all characters are normalized because we don't
// support any linguistic operations on strings.
if (GlobalizationMode.Invariant || Ascii.IsValid(source)) { return true; }
Normalization.cs:11-20, 27-40
So returning true and returning the argument unchanged is exactly what .NET does for a build
with no globalization backend, which is what this runtime is. Those three pins are a DECLARED
DEVIATION with the reference behind it, not a stub awaiting repair, and the class doc-comment
now says so with the citation instead of describing itself as a stub.
WHY #2338 IS needs_user RATHER THAN UNBLOCKED BY SA-4. Its recorded gate is Approval F, and SA-4
is Approval F -- but SA-4's source of record is CharUnicodeInfoData.cs, and that file contains
ZERO normalization data (grep decompos|combiningclass|composition|quickcheck|nfc|nfd|nfkc|nfkd: 0
hits). .NET has no normalization tables at all. Using Perl unicore or Python unicodedata instead
would promote a cross-check corpus to source of record at Unicode 15.0.0/15.1.0 rather than the
16.0 SA-4 pins. Three options are recorded on #2338: declare invariant-mode parity (recommended),
grant a new data source plus UAX #15, or take an ICU dependency.
Mutations: 5, all caught. The identity mutation is caught by FOUR cases, three of them
PRE-EXISTING #2337 pins, which is what shows the identity behaviour is load-bearing.
Gate: 17,376 run, 17,376 passed, 0 failed, 0 skipped across 38 executables (+1, in
SharpRuntimeTests_Core_Base, 6,063 -> 6,064). Built in build/ with --parallel 2.
Downstream: zero IsNormalized/Normalize call sites in cna and mobile-eggbert.
docs/Migration-NormalizationFormValidation.md1 parent 538174f commit 3304d76
5 files changed
Lines changed: 267 additions & 22 deletions
File tree
- docs
- modules/core
- include/System
- tests/System
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
Lines changed: 71 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
19 | 44 | | |
20 | 45 | | |
21 | 46 | | |
22 | 47 | | |
23 | 48 | | |
24 | 49 | | |
25 | 50 | | |
26 | | - | |
| 51 | + | |
27 | 52 | | |
28 | 53 | | |
29 | 54 | | |
30 | 55 | | |
31 | 56 | | |
32 | 57 | | |
33 | 58 | | |
34 | | - | |
| 59 | + | |
35 | 60 | | |
36 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
37 | 64 | | |
38 | 65 | | |
39 | | - | |
| 66 | + | |
| 67 | + | |
40 | 68 | | |
41 | 69 | | |
42 | 70 | | |
43 | 71 | | |
44 | 72 | | |
45 | 73 | | |
46 | | - | |
| 74 | + | |
47 | 75 | | |
48 | 76 | | |
49 | 77 | | |
| |||
53 | 81 | | |
54 | 82 | | |
55 | 83 | | |
56 | | - | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
57 | 87 | | |
58 | 88 | | |
59 | | - | |
| 89 | + | |
| 90 | + | |
60 | 91 | | |
61 | 92 | | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
62 | 122 | | |
63 | 123 | | |
64 | 124 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
897 | 897 | | |
898 | 898 | | |
899 | 899 | | |
900 | | - | |
901 | | - | |
902 | | - | |
903 | | - | |
904 | | - | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
905 | 921 | | |
906 | 922 | | |
907 | 923 | | |
| |||
936 | 952 | | |
937 | 953 | | |
938 | 954 | | |
939 | | - | |
940 | | - | |
941 | | - | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
942 | 959 | | |
943 | | - | |
944 | | - | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
945 | 1024 | | |
946 | 1025 | | |
947 | 1026 | | |
| |||
Binary file not shown.
0 commit comments