typescript 5.5.0-dev.20240529 → 5.5.0-dev.20240530
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/tsc.js +91 -56
- package/lib/typescript.js +99 -57
- package/package.json +11 -11
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.5";
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20240530`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -6091,8 +6091,10 @@ var Diagnostics = {
|
|
|
6091
6091
|
_0_must_be_followed_by_a_Unicode_property_value_expression_enclosed_in_braces: diag(1531, 1 /* Error */, "_0_must_be_followed_by_a_Unicode_property_value_expression_enclosed_in_braces_1531", "'\\{0}' must be followed by a Unicode property value expression enclosed in braces."),
|
|
6092
6092
|
There_is_no_capturing_group_named_0_in_this_regular_expression: diag(1532, 1 /* Error */, "There_is_no_capturing_group_named_0_in_this_regular_expression_1532", "There is no capturing group named '{0}' in this regular expression."),
|
|
6093
6093
|
This_backreference_refers_to_a_group_that_does_not_exist_There_are_only_0_capturing_groups_in_this_regular_expression: diag(1533, 1 /* Error */, "This_backreference_refers_to_a_group_that_does_not_exist_There_are_only_0_capturing_groups_in_this_r_1533", "This backreference refers to a group that does not exist. There are only {0} capturing groups in this regular expression."),
|
|
6094
|
-
|
|
6094
|
+
This_backreference_refers_to_a_group_that_does_not_exist_There_are_no_capturing_groups_in_this_regular_expression: diag(1534, 1 /* Error */, "This_backreference_refers_to_a_group_that_does_not_exist_There_are_no_capturing_groups_in_this_regul_1534", "This backreference refers to a group that does not exist. There are no capturing groups in this regular expression."),
|
|
6095
6095
|
This_character_cannot_be_escaped_in_a_regular_expression: diag(1535, 1 /* Error */, "This_character_cannot_be_escaped_in_a_regular_expression_1535", "This character cannot be escaped in a regular expression."),
|
|
6096
|
+
Octal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class_If_this_was_intended_as_an_escape_sequence_use_the_syntax_0_instead: diag(1536, 1 /* Error */, "Octal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class_If_this_was_intended__1536", "Octal escape sequences and backreferences are not allowed in a character class. If this was intended as an escape sequence, use the syntax '{0}' instead."),
|
|
6097
|
+
Decimal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class: diag(1537, 1 /* Error */, "Decimal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class_1537", "Decimal escape sequences and backreferences are not allowed in a character class."),
|
|
6096
6098
|
The_types_of_0_are_incompatible_between_these_types: diag(2200, 1 /* Error */, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
|
|
6097
6099
|
The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, 1 /* Error */, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
|
|
6098
6100
|
Call_signature_return_types_0_and_1_are_incompatible: diag(
|
|
@@ -8812,12 +8814,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
8812
8814
|
}
|
|
8813
8815
|
if (ch === 92 /* backslash */ && !jsxAttributeString) {
|
|
8814
8816
|
result += text.substring(start2, pos);
|
|
8815
|
-
result += scanEscapeSequence(
|
|
8816
|
-
/*shouldEmitInvalidEscapeError*/
|
|
8817
|
-
true,
|
|
8818
|
-
/*isRegularExpression*/
|
|
8819
|
-
false
|
|
8820
|
-
);
|
|
8817
|
+
result += scanEscapeSequence(1 /* String */ | 2 /* ReportErrors */);
|
|
8821
8818
|
start2 = pos;
|
|
8822
8819
|
continue;
|
|
8823
8820
|
}
|
|
@@ -8860,11 +8857,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
8860
8857
|
}
|
|
8861
8858
|
if (currChar === 92 /* backslash */) {
|
|
8862
8859
|
contents += text.substring(start2, pos);
|
|
8863
|
-
contents += scanEscapeSequence(
|
|
8864
|
-
shouldEmitInvalidEscapeError,
|
|
8865
|
-
/*isRegularExpression*/
|
|
8866
|
-
false
|
|
8867
|
-
);
|
|
8860
|
+
contents += scanEscapeSequence(1 /* String */ | (shouldEmitInvalidEscapeError ? 2 /* ReportErrors */ : 0));
|
|
8868
8861
|
start2 = pos;
|
|
8869
8862
|
continue;
|
|
8870
8863
|
}
|
|
@@ -8884,7 +8877,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
8884
8877
|
tokenValue = contents;
|
|
8885
8878
|
return resultingToken;
|
|
8886
8879
|
}
|
|
8887
|
-
function scanEscapeSequence(
|
|
8880
|
+
function scanEscapeSequence(flags) {
|
|
8888
8881
|
const start2 = pos;
|
|
8889
8882
|
pos++;
|
|
8890
8883
|
if (pos >= end) {
|
|
@@ -8912,9 +8905,11 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
8912
8905
|
pos++;
|
|
8913
8906
|
}
|
|
8914
8907
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
8915
|
-
if (
|
|
8908
|
+
if (flags & 6 /* ReportInvalidEscapeErrors */) {
|
|
8916
8909
|
const code = parseInt(text.substring(start2 + 1, pos), 8);
|
|
8917
|
-
if (
|
|
8910
|
+
if (flags & 4 /* RegularExpression */ && !(flags & 32 /* AtomEscape */) && ch !== 48 /* _0 */) {
|
|
8911
|
+
error(Diagnostics.Octal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class_If_this_was_intended_as_an_escape_sequence_use_the_syntax_0_instead, start2, pos - start2, "\\x" + code.toString(16).padStart(2, "0"));
|
|
8912
|
+
} else {
|
|
8918
8913
|
error(Diagnostics.Octal_escape_sequences_are_not_allowed_Use_the_syntax_0, start2, pos - start2, "\\x" + code.toString(16).padStart(2, "0"));
|
|
8919
8914
|
}
|
|
8920
8915
|
return String.fromCharCode(code);
|
|
@@ -8923,8 +8918,12 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
8923
8918
|
case 56 /* _8 */:
|
|
8924
8919
|
case 57 /* _9 */:
|
|
8925
8920
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
8926
|
-
if (
|
|
8927
|
-
|
|
8921
|
+
if (flags & 6 /* ReportInvalidEscapeErrors */) {
|
|
8922
|
+
if (flags & 4 /* RegularExpression */ && !(flags & 32 /* AtomEscape */)) {
|
|
8923
|
+
error(Diagnostics.Decimal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class, start2, pos - start2);
|
|
8924
|
+
} else {
|
|
8925
|
+
error(Diagnostics.Escape_sequence_0_is_not_allowed, start2, pos - start2, text.substring(start2, pos));
|
|
8926
|
+
}
|
|
8928
8927
|
return String.fromCharCode(ch);
|
|
8929
8928
|
}
|
|
8930
8929
|
return text.substring(start2, pos);
|
|
@@ -8945,14 +8944,14 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
8945
8944
|
case 34 /* doubleQuote */:
|
|
8946
8945
|
return '"';
|
|
8947
8946
|
case 117 /* u */:
|
|
8948
|
-
if (
|
|
8947
|
+
if (flags & 17 /* ScanExtendedUnicodeEscape */ && pos < end && charCodeUnchecked(pos) === 123 /* openBrace */) {
|
|
8949
8948
|
pos -= 2;
|
|
8950
|
-
return scanExtendedUnicodeEscape(!!
|
|
8949
|
+
return scanExtendedUnicodeEscape(!!(flags & 6 /* ReportInvalidEscapeErrors */));
|
|
8951
8950
|
}
|
|
8952
8951
|
for (; pos < start2 + 6; pos++) {
|
|
8953
8952
|
if (!(pos < end && isHexDigit(charCodeUnchecked(pos)))) {
|
|
8954
8953
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
8955
|
-
if (
|
|
8954
|
+
if (flags & 6 /* ReportInvalidEscapeErrors */) {
|
|
8956
8955
|
error(Diagnostics.Hexadecimal_digit_expected);
|
|
8957
8956
|
}
|
|
8958
8957
|
return text.substring(start2, pos);
|
|
@@ -8961,7 +8960,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
8961
8960
|
tokenFlags |= 1024 /* UnicodeEscape */;
|
|
8962
8961
|
const escapedValue = parseInt(text.substring(start2 + 2, pos), 16);
|
|
8963
8962
|
const escapedValueString = String.fromCharCode(escapedValue);
|
|
8964
|
-
if (
|
|
8963
|
+
if (flags & 16 /* AnyUnicodeMode */ && escapedValue >= 55296 && escapedValue <= 56319 && pos + 6 < end && text.substring(pos, pos + 2) === "\\u" && charCodeUnchecked(pos + 2) !== 123 /* openBrace */) {
|
|
8965
8964
|
const nextStart = pos;
|
|
8966
8965
|
let nextPos = pos + 2;
|
|
8967
8966
|
for (; nextPos < nextStart + 6; nextPos++) {
|
|
@@ -8980,7 +8979,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
8980
8979
|
for (; pos < start2 + 4; pos++) {
|
|
8981
8980
|
if (!(pos < end && isHexDigit(charCodeUnchecked(pos)))) {
|
|
8982
8981
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
8983
|
-
if (
|
|
8982
|
+
if (flags & 6 /* ReportInvalidEscapeErrors */) {
|
|
8984
8983
|
error(Diagnostics.Hexadecimal_digit_expected);
|
|
8985
8984
|
}
|
|
8986
8985
|
return text.substring(start2, pos);
|
|
@@ -8997,7 +8996,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
8997
8996
|
case 8233 /* paragraphSeparator */:
|
|
8998
8997
|
return "";
|
|
8999
8998
|
default:
|
|
9000
|
-
if (
|
|
8999
|
+
if (flags & 16 /* AnyUnicodeMode */ || flags & 4 /* RegularExpression */ && !(flags & 8 /* AnnexB */) && isIdentifierPart(ch, languageVersion)) {
|
|
9001
9000
|
error(Diagnostics.This_character_cannot_be_escaped_in_a_regular_expression, pos - 2, 2);
|
|
9002
9001
|
}
|
|
9003
9002
|
return String.fromCharCode(ch);
|
|
@@ -9696,6 +9695,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9696
9695
|
const startOfRegExpBody = tokenStart + 1;
|
|
9697
9696
|
pos = startOfRegExpBody;
|
|
9698
9697
|
let inEscape = false;
|
|
9698
|
+
let namedCaptureGroups = false;
|
|
9699
9699
|
let inCharacterClass = false;
|
|
9700
9700
|
while (true) {
|
|
9701
9701
|
const ch = charCodeChecked(pos);
|
|
@@ -9713,6 +9713,8 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9713
9713
|
inEscape = true;
|
|
9714
9714
|
} else if (ch === 93 /* closeBracket */) {
|
|
9715
9715
|
inCharacterClass = false;
|
|
9716
|
+
} else if (!inCharacterClass && ch === 40 /* openParen */ && charCodeChecked(pos + 1) === 63 /* question */ && charCodeChecked(pos + 2) === 60 /* lessThan */ && charCodeChecked(pos + 3) !== 61 /* equals */ && charCodeChecked(pos + 3) !== 33 /* exclamation */) {
|
|
9717
|
+
namedCaptureGroups = true;
|
|
9716
9718
|
}
|
|
9717
9719
|
pos++;
|
|
9718
9720
|
}
|
|
@@ -9780,7 +9782,8 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9780
9782
|
scanRegularExpressionWorker(
|
|
9781
9783
|
regExpFlags,
|
|
9782
9784
|
/*annexB*/
|
|
9783
|
-
true
|
|
9785
|
+
true,
|
|
9786
|
+
namedCaptureGroups
|
|
9784
9787
|
);
|
|
9785
9788
|
});
|
|
9786
9789
|
}
|
|
@@ -9790,12 +9793,10 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9790
9793
|
}
|
|
9791
9794
|
return token;
|
|
9792
9795
|
}
|
|
9793
|
-
function scanRegularExpressionWorker(regExpFlags, annexB) {
|
|
9796
|
+
function scanRegularExpressionWorker(regExpFlags, annexB, namedCaptureGroups) {
|
|
9794
9797
|
var unicodeSetsMode = !!(regExpFlags & 64 /* UnicodeSets */);
|
|
9795
9798
|
var anyUnicodeMode = !!(regExpFlags & 96 /* AnyUnicodeMode */);
|
|
9796
|
-
|
|
9797
|
-
annexB = false;
|
|
9798
|
-
}
|
|
9799
|
+
var anyUnicodeModeOrNonAnnexB = anyUnicodeMode || !annexB;
|
|
9799
9800
|
var mayContainStrings = false;
|
|
9800
9801
|
var numberOfCapturingGroups = 0;
|
|
9801
9802
|
var groupSpecifiers;
|
|
@@ -9850,7 +9851,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9850
9851
|
case 61 /* equals */:
|
|
9851
9852
|
case 33 /* exclamation */:
|
|
9852
9853
|
pos++;
|
|
9853
|
-
isPreviousTermQuantifiable =
|
|
9854
|
+
isPreviousTermQuantifiable = !anyUnicodeModeOrNonAnnexB;
|
|
9854
9855
|
break;
|
|
9855
9856
|
case 60 /* lessThan */:
|
|
9856
9857
|
const groupNameStart = pos;
|
|
@@ -9904,6 +9905,10 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9904
9905
|
const digitsStart = pos;
|
|
9905
9906
|
scanDigits();
|
|
9906
9907
|
const min2 = tokenValue;
|
|
9908
|
+
if (!anyUnicodeModeOrNonAnnexB && !min2) {
|
|
9909
|
+
isPreviousTermQuantifiable = true;
|
|
9910
|
+
break;
|
|
9911
|
+
}
|
|
9907
9912
|
if (charCodeChecked(pos) === 44 /* comma */) {
|
|
9908
9913
|
pos++;
|
|
9909
9914
|
scanDigits();
|
|
@@ -9912,25 +9917,29 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9912
9917
|
if (max || charCodeChecked(pos) === 125 /* closeBrace */) {
|
|
9913
9918
|
error(Diagnostics.Incomplete_quantifier_Digit_expected, digitsStart, 0);
|
|
9914
9919
|
} else {
|
|
9915
|
-
|
|
9916
|
-
error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, start2, 1, String.fromCharCode(ch));
|
|
9917
|
-
}
|
|
9920
|
+
error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, start2, 1, String.fromCharCode(ch));
|
|
9918
9921
|
isPreviousTermQuantifiable = true;
|
|
9919
9922
|
break;
|
|
9920
9923
|
}
|
|
9921
|
-
}
|
|
9922
|
-
if (max && Number.parseInt(min2) > Number.parseInt(max)) {
|
|
9924
|
+
} else if (max && Number.parseInt(min2) > Number.parseInt(max) && (anyUnicodeModeOrNonAnnexB || charCodeChecked(pos) === 125 /* closeBrace */)) {
|
|
9923
9925
|
error(Diagnostics.Numbers_out_of_order_in_quantifier, digitsStart, pos - digitsStart);
|
|
9924
9926
|
}
|
|
9925
9927
|
} else if (!min2) {
|
|
9926
|
-
if (
|
|
9928
|
+
if (anyUnicodeModeOrNonAnnexB) {
|
|
9927
9929
|
error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, start2, 1, String.fromCharCode(ch));
|
|
9928
9930
|
}
|
|
9929
9931
|
isPreviousTermQuantifiable = true;
|
|
9930
9932
|
break;
|
|
9931
9933
|
}
|
|
9932
|
-
|
|
9933
|
-
|
|
9934
|
+
if (charCodeChecked(pos) !== 125 /* closeBrace */) {
|
|
9935
|
+
if (anyUnicodeModeOrNonAnnexB) {
|
|
9936
|
+
error(Diagnostics._0_expected, pos, 0, String.fromCharCode(125 /* closeBrace */));
|
|
9937
|
+
pos--;
|
|
9938
|
+
} else {
|
|
9939
|
+
isPreviousTermQuantifiable = true;
|
|
9940
|
+
break;
|
|
9941
|
+
}
|
|
9942
|
+
}
|
|
9934
9943
|
case 42 /* asterisk */:
|
|
9935
9944
|
case 43 /* plus */:
|
|
9936
9945
|
case 63 /* question */:
|
|
@@ -9963,7 +9972,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9963
9972
|
}
|
|
9964
9973
|
case 93 /* closeBracket */:
|
|
9965
9974
|
case 125 /* closeBrace */:
|
|
9966
|
-
if (
|
|
9975
|
+
if (anyUnicodeModeOrNonAnnexB || ch === 41 /* closeParen */) {
|
|
9967
9976
|
error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
|
|
9968
9977
|
}
|
|
9969
9978
|
pos++;
|
|
@@ -10012,7 +10021,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
10012
10021
|
true
|
|
10013
10022
|
);
|
|
10014
10023
|
scanExpectedChar(62 /* greaterThan */);
|
|
10015
|
-
} else if (
|
|
10024
|
+
} else if (anyUnicodeModeOrNonAnnexB || namedCaptureGroups) {
|
|
10016
10025
|
error(Diagnostics.k_must_be_followed_by_a_capturing_group_name_enclosed_in_angle_brackets, pos - 2, 2);
|
|
10017
10026
|
}
|
|
10018
10027
|
break;
|
|
@@ -10055,9 +10064,9 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
10055
10064
|
pos++;
|
|
10056
10065
|
return String.fromCharCode(ch & 31);
|
|
10057
10066
|
}
|
|
10058
|
-
if (
|
|
10067
|
+
if (anyUnicodeModeOrNonAnnexB) {
|
|
10059
10068
|
error(Diagnostics.c_must_be_followed_by_an_ASCII_letter, pos - 2, 2);
|
|
10060
|
-
} else if (atomEscape
|
|
10069
|
+
} else if (atomEscape) {
|
|
10061
10070
|
pos--;
|
|
10062
10071
|
return "\\";
|
|
10063
10072
|
}
|
|
@@ -10082,10 +10091,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
10082
10091
|
default:
|
|
10083
10092
|
pos--;
|
|
10084
10093
|
return scanEscapeSequence(
|
|
10085
|
-
/*
|
|
10086
|
-
anyUnicodeMode,
|
|
10087
|
-
/*isRegularExpression*/
|
|
10088
|
-
annexB ? "annex-b" : true
|
|
10094
|
+
4 /* RegularExpression */ | (annexB ? 8 /* AnnexB */ : 0) | (anyUnicodeMode ? 16 /* AnyUnicodeMode */ : 0) | (atomEscape ? 32 /* AtomEscape */ : 0)
|
|
10089
10095
|
);
|
|
10090
10096
|
}
|
|
10091
10097
|
}
|
|
@@ -10127,12 +10133,12 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
10127
10133
|
if (isClassContentExit(ch2)) {
|
|
10128
10134
|
return;
|
|
10129
10135
|
}
|
|
10130
|
-
if (!minCharacter &&
|
|
10136
|
+
if (!minCharacter && anyUnicodeModeOrNonAnnexB) {
|
|
10131
10137
|
error(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, minStart, pos - 1 - minStart);
|
|
10132
10138
|
}
|
|
10133
10139
|
const maxStart = pos;
|
|
10134
10140
|
const maxCharacter = scanClassAtom();
|
|
10135
|
-
if (!maxCharacter &&
|
|
10141
|
+
if (!maxCharacter && anyUnicodeModeOrNonAnnexB) {
|
|
10136
10142
|
error(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, maxStart, pos - maxStart);
|
|
10137
10143
|
continue;
|
|
10138
10144
|
}
|
|
@@ -10562,8 +10568,11 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
10562
10568
|
if (!anyUnicodeMode) {
|
|
10563
10569
|
error(Diagnostics.Unicode_property_value_expressions_are_only_available_when_the_Unicode_u_flag_or_the_Unicode_Sets_v_flag_is_set, start2, pos - start2);
|
|
10564
10570
|
}
|
|
10565
|
-
} else if (
|
|
10571
|
+
} else if (anyUnicodeModeOrNonAnnexB) {
|
|
10566
10572
|
error(Diagnostics._0_must_be_followed_by_a_Unicode_property_value_expression_enclosed_in_braces, pos - 2, 2, String.fromCharCode(ch));
|
|
10573
|
+
} else {
|
|
10574
|
+
pos--;
|
|
10575
|
+
return false;
|
|
10567
10576
|
}
|
|
10568
10577
|
return true;
|
|
10569
10578
|
}
|
|
@@ -10603,11 +10612,11 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
10603
10612
|
}
|
|
10604
10613
|
});
|
|
10605
10614
|
forEach(decimalEscapes, (escape) => {
|
|
10606
|
-
if (
|
|
10615
|
+
if (escape.value > numberOfCapturingGroups) {
|
|
10607
10616
|
if (numberOfCapturingGroups) {
|
|
10608
10617
|
error(Diagnostics.This_backreference_refers_to_a_group_that_does_not_exist_There_are_only_0_capturing_groups_in_this_regular_expression, escape.pos, escape.end - escape.pos, numberOfCapturingGroups);
|
|
10609
10618
|
} else {
|
|
10610
|
-
error(Diagnostics.
|
|
10619
|
+
error(Diagnostics.This_backreference_refers_to_a_group_that_does_not_exist_There_are_no_capturing_groups_in_this_regular_expression, escape.pos, escape.end - escape.pos);
|
|
10611
10620
|
}
|
|
10612
10621
|
}
|
|
10613
10622
|
});
|
|
@@ -25486,7 +25495,7 @@ var addDisposableResourceHelper = {
|
|
|
25486
25495
|
var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
|
|
25487
25496
|
if (value !== null && value !== void 0) {
|
|
25488
25497
|
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
25489
|
-
var dispose;
|
|
25498
|
+
var dispose, inner;
|
|
25490
25499
|
if (async) {
|
|
25491
25500
|
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
25492
25501
|
dispose = value[Symbol.asyncDispose];
|
|
@@ -25494,8 +25503,10 @@ var addDisposableResourceHelper = {
|
|
|
25494
25503
|
if (dispose === void 0) {
|
|
25495
25504
|
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
25496
25505
|
dispose = value[Symbol.dispose];
|
|
25506
|
+
if (async) inner = dispose;
|
|
25497
25507
|
}
|
|
25498
25508
|
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
|
25509
|
+
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
|
|
25499
25510
|
env.stack.push({ value: value, dispose: dispose, async: async });
|
|
25500
25511
|
}
|
|
25501
25512
|
else if (async) {
|
|
@@ -70260,7 +70271,31 @@ function createTypeChecker(host) {
|
|
|
70260
70271
|
if (!node.asteriskToken && contextualReturnType.flags & 1048576 /* Union */) {
|
|
70261
70272
|
contextualReturnType = filterType(contextualReturnType, (type) => !!getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, type, isAsyncGenerator));
|
|
70262
70273
|
}
|
|
70263
|
-
|
|
70274
|
+
if (node.asteriskToken) {
|
|
70275
|
+
const iterationTypes = getIterationTypesOfGeneratorFunctionReturnType(contextualReturnType, isAsyncGenerator);
|
|
70276
|
+
const yieldType = (iterationTypes == null ? void 0 : iterationTypes.yieldType) ?? silentNeverType;
|
|
70277
|
+
const returnType = getContextualType(node, contextFlags) ?? silentNeverType;
|
|
70278
|
+
const nextType = (iterationTypes == null ? void 0 : iterationTypes.nextType) ?? unknownType;
|
|
70279
|
+
const generatorType = createGeneratorType(
|
|
70280
|
+
yieldType,
|
|
70281
|
+
returnType,
|
|
70282
|
+
nextType,
|
|
70283
|
+
/*isAsyncGenerator*/
|
|
70284
|
+
false
|
|
70285
|
+
);
|
|
70286
|
+
if (isAsyncGenerator) {
|
|
70287
|
+
const asyncGeneratorType = createGeneratorType(
|
|
70288
|
+
yieldType,
|
|
70289
|
+
returnType,
|
|
70290
|
+
nextType,
|
|
70291
|
+
/*isAsyncGenerator*/
|
|
70292
|
+
true
|
|
70293
|
+
);
|
|
70294
|
+
return getUnionType([generatorType, asyncGeneratorType]);
|
|
70295
|
+
}
|
|
70296
|
+
return generatorType;
|
|
70297
|
+
}
|
|
70298
|
+
return getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, contextualReturnType, isAsyncGenerator);
|
|
70264
70299
|
}
|
|
70265
70300
|
}
|
|
70266
70301
|
return void 0;
|
|
@@ -76030,7 +76065,7 @@ function createTypeChecker(host) {
|
|
|
76030
76065
|
if (nextType) nextType = getWidenedType(nextType);
|
|
76031
76066
|
}
|
|
76032
76067
|
if (isGenerator) {
|
|
76033
|
-
return
|
|
76068
|
+
return createGeneratorType(
|
|
76034
76069
|
yieldType || neverType,
|
|
76035
76070
|
returnType || fallbackReturnType,
|
|
76036
76071
|
nextType || getContextualIterationType(2 /* Next */, func) || unknownType,
|
|
@@ -76040,7 +76075,7 @@ function createTypeChecker(host) {
|
|
|
76040
76075
|
return isAsync ? createPromiseType(returnType || fallbackReturnType) : returnType || fallbackReturnType;
|
|
76041
76076
|
}
|
|
76042
76077
|
}
|
|
76043
|
-
function
|
|
76078
|
+
function createGeneratorType(yieldType, returnType, nextType, isAsyncGenerator) {
|
|
76044
76079
|
const resolver = isAsyncGenerator ? asyncIterationTypesResolver : syncIterationTypesResolver;
|
|
76045
76080
|
const globalGeneratorType = resolver.getGlobalGeneratorType(
|
|
76046
76081
|
/*reportErrors*/
|
|
@@ -78425,7 +78460,7 @@ function createTypeChecker(host) {
|
|
|
78425
78460
|
const generatorYieldType = getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, returnType, (functionFlags & 2 /* Async */) !== 0) || anyType;
|
|
78426
78461
|
const generatorReturnType = getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, returnType, (functionFlags & 2 /* Async */) !== 0) || generatorYieldType;
|
|
78427
78462
|
const generatorNextType = getIterationTypeOfGeneratorFunctionReturnType(2 /* Next */, returnType, (functionFlags & 2 /* Async */) !== 0) || unknownType;
|
|
78428
|
-
const generatorInstantiation =
|
|
78463
|
+
const generatorInstantiation = createGeneratorType(generatorYieldType, generatorReturnType, generatorNextType, !!(functionFlags & 2 /* Async */));
|
|
78429
78464
|
return checkTypeAssignableTo(generatorInstantiation, returnType, errorNode);
|
|
78430
78465
|
}
|
|
78431
78466
|
function checkClassForDuplicateDeclarations(node) {
|
package/lib/typescript.js
CHANGED
|
@@ -2370,7 +2370,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
|
2370
2370
|
|
|
2371
2371
|
// src/compiler/corePublic.ts
|
|
2372
2372
|
var versionMajorMinor = "5.5";
|
|
2373
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2373
|
+
var version = `${versionMajorMinor}.0-dev.20240530`;
|
|
2374
2374
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2375
2375
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2376
2376
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -9700,8 +9700,10 @@ var Diagnostics = {
|
|
|
9700
9700
|
_0_must_be_followed_by_a_Unicode_property_value_expression_enclosed_in_braces: diag(1531, 1 /* Error */, "_0_must_be_followed_by_a_Unicode_property_value_expression_enclosed_in_braces_1531", "'\\{0}' must be followed by a Unicode property value expression enclosed in braces."),
|
|
9701
9701
|
There_is_no_capturing_group_named_0_in_this_regular_expression: diag(1532, 1 /* Error */, "There_is_no_capturing_group_named_0_in_this_regular_expression_1532", "There is no capturing group named '{0}' in this regular expression."),
|
|
9702
9702
|
This_backreference_refers_to_a_group_that_does_not_exist_There_are_only_0_capturing_groups_in_this_regular_expression: diag(1533, 1 /* Error */, "This_backreference_refers_to_a_group_that_does_not_exist_There_are_only_0_capturing_groups_in_this_r_1533", "This backreference refers to a group that does not exist. There are only {0} capturing groups in this regular expression."),
|
|
9703
|
-
|
|
9703
|
+
This_backreference_refers_to_a_group_that_does_not_exist_There_are_no_capturing_groups_in_this_regular_expression: diag(1534, 1 /* Error */, "This_backreference_refers_to_a_group_that_does_not_exist_There_are_no_capturing_groups_in_this_regul_1534", "This backreference refers to a group that does not exist. There are no capturing groups in this regular expression."),
|
|
9704
9704
|
This_character_cannot_be_escaped_in_a_regular_expression: diag(1535, 1 /* Error */, "This_character_cannot_be_escaped_in_a_regular_expression_1535", "This character cannot be escaped in a regular expression."),
|
|
9705
|
+
Octal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class_If_this_was_intended_as_an_escape_sequence_use_the_syntax_0_instead: diag(1536, 1 /* Error */, "Octal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class_If_this_was_intended__1536", "Octal escape sequences and backreferences are not allowed in a character class. If this was intended as an escape sequence, use the syntax '{0}' instead."),
|
|
9706
|
+
Decimal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class: diag(1537, 1 /* Error */, "Decimal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class_1537", "Decimal escape sequences and backreferences are not allowed in a character class."),
|
|
9705
9707
|
The_types_of_0_are_incompatible_between_these_types: diag(2200, 1 /* Error */, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
|
|
9706
9708
|
The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, 1 /* Error */, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
|
|
9707
9709
|
Call_signature_return_types_0_and_1_are_incompatible: diag(
|
|
@@ -12445,12 +12447,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12445
12447
|
}
|
|
12446
12448
|
if (ch === 92 /* backslash */ && !jsxAttributeString) {
|
|
12447
12449
|
result += text.substring(start2, pos);
|
|
12448
|
-
result += scanEscapeSequence(
|
|
12449
|
-
/*shouldEmitInvalidEscapeError*/
|
|
12450
|
-
true,
|
|
12451
|
-
/*isRegularExpression*/
|
|
12452
|
-
false
|
|
12453
|
-
);
|
|
12450
|
+
result += scanEscapeSequence(1 /* String */ | 2 /* ReportErrors */);
|
|
12454
12451
|
start2 = pos;
|
|
12455
12452
|
continue;
|
|
12456
12453
|
}
|
|
@@ -12493,11 +12490,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12493
12490
|
}
|
|
12494
12491
|
if (currChar === 92 /* backslash */) {
|
|
12495
12492
|
contents += text.substring(start2, pos);
|
|
12496
|
-
contents += scanEscapeSequence(
|
|
12497
|
-
shouldEmitInvalidEscapeError,
|
|
12498
|
-
/*isRegularExpression*/
|
|
12499
|
-
false
|
|
12500
|
-
);
|
|
12493
|
+
contents += scanEscapeSequence(1 /* String */ | (shouldEmitInvalidEscapeError ? 2 /* ReportErrors */ : 0));
|
|
12501
12494
|
start2 = pos;
|
|
12502
12495
|
continue;
|
|
12503
12496
|
}
|
|
@@ -12517,7 +12510,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12517
12510
|
tokenValue = contents;
|
|
12518
12511
|
return resultingToken;
|
|
12519
12512
|
}
|
|
12520
|
-
function scanEscapeSequence(
|
|
12513
|
+
function scanEscapeSequence(flags) {
|
|
12521
12514
|
const start2 = pos;
|
|
12522
12515
|
pos++;
|
|
12523
12516
|
if (pos >= end) {
|
|
@@ -12545,9 +12538,11 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12545
12538
|
pos++;
|
|
12546
12539
|
}
|
|
12547
12540
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
12548
|
-
if (
|
|
12541
|
+
if (flags & 6 /* ReportInvalidEscapeErrors */) {
|
|
12549
12542
|
const code = parseInt(text.substring(start2 + 1, pos), 8);
|
|
12550
|
-
if (
|
|
12543
|
+
if (flags & 4 /* RegularExpression */ && !(flags & 32 /* AtomEscape */) && ch !== 48 /* _0 */) {
|
|
12544
|
+
error2(Diagnostics.Octal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class_If_this_was_intended_as_an_escape_sequence_use_the_syntax_0_instead, start2, pos - start2, "\\x" + code.toString(16).padStart(2, "0"));
|
|
12545
|
+
} else {
|
|
12551
12546
|
error2(Diagnostics.Octal_escape_sequences_are_not_allowed_Use_the_syntax_0, start2, pos - start2, "\\x" + code.toString(16).padStart(2, "0"));
|
|
12552
12547
|
}
|
|
12553
12548
|
return String.fromCharCode(code);
|
|
@@ -12556,8 +12551,12 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12556
12551
|
case 56 /* _8 */:
|
|
12557
12552
|
case 57 /* _9 */:
|
|
12558
12553
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
12559
|
-
if (
|
|
12560
|
-
|
|
12554
|
+
if (flags & 6 /* ReportInvalidEscapeErrors */) {
|
|
12555
|
+
if (flags & 4 /* RegularExpression */ && !(flags & 32 /* AtomEscape */)) {
|
|
12556
|
+
error2(Diagnostics.Decimal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class, start2, pos - start2);
|
|
12557
|
+
} else {
|
|
12558
|
+
error2(Diagnostics.Escape_sequence_0_is_not_allowed, start2, pos - start2, text.substring(start2, pos));
|
|
12559
|
+
}
|
|
12561
12560
|
return String.fromCharCode(ch);
|
|
12562
12561
|
}
|
|
12563
12562
|
return text.substring(start2, pos);
|
|
@@ -12578,14 +12577,14 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12578
12577
|
case 34 /* doubleQuote */:
|
|
12579
12578
|
return '"';
|
|
12580
12579
|
case 117 /* u */:
|
|
12581
|
-
if (
|
|
12580
|
+
if (flags & 17 /* ScanExtendedUnicodeEscape */ && pos < end && charCodeUnchecked(pos) === 123 /* openBrace */) {
|
|
12582
12581
|
pos -= 2;
|
|
12583
|
-
return scanExtendedUnicodeEscape(!!
|
|
12582
|
+
return scanExtendedUnicodeEscape(!!(flags & 6 /* ReportInvalidEscapeErrors */));
|
|
12584
12583
|
}
|
|
12585
12584
|
for (; pos < start2 + 6; pos++) {
|
|
12586
12585
|
if (!(pos < end && isHexDigit(charCodeUnchecked(pos)))) {
|
|
12587
12586
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
12588
|
-
if (
|
|
12587
|
+
if (flags & 6 /* ReportInvalidEscapeErrors */) {
|
|
12589
12588
|
error2(Diagnostics.Hexadecimal_digit_expected);
|
|
12590
12589
|
}
|
|
12591
12590
|
return text.substring(start2, pos);
|
|
@@ -12594,7 +12593,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12594
12593
|
tokenFlags |= 1024 /* UnicodeEscape */;
|
|
12595
12594
|
const escapedValue = parseInt(text.substring(start2 + 2, pos), 16);
|
|
12596
12595
|
const escapedValueString = String.fromCharCode(escapedValue);
|
|
12597
|
-
if (
|
|
12596
|
+
if (flags & 16 /* AnyUnicodeMode */ && escapedValue >= 55296 && escapedValue <= 56319 && pos + 6 < end && text.substring(pos, pos + 2) === "\\u" && charCodeUnchecked(pos + 2) !== 123 /* openBrace */) {
|
|
12598
12597
|
const nextStart = pos;
|
|
12599
12598
|
let nextPos = pos + 2;
|
|
12600
12599
|
for (; nextPos < nextStart + 6; nextPos++) {
|
|
@@ -12613,7 +12612,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12613
12612
|
for (; pos < start2 + 4; pos++) {
|
|
12614
12613
|
if (!(pos < end && isHexDigit(charCodeUnchecked(pos)))) {
|
|
12615
12614
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
12616
|
-
if (
|
|
12615
|
+
if (flags & 6 /* ReportInvalidEscapeErrors */) {
|
|
12617
12616
|
error2(Diagnostics.Hexadecimal_digit_expected);
|
|
12618
12617
|
}
|
|
12619
12618
|
return text.substring(start2, pos);
|
|
@@ -12630,7 +12629,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12630
12629
|
case 8233 /* paragraphSeparator */:
|
|
12631
12630
|
return "";
|
|
12632
12631
|
default:
|
|
12633
|
-
if (
|
|
12632
|
+
if (flags & 16 /* AnyUnicodeMode */ || flags & 4 /* RegularExpression */ && !(flags & 8 /* AnnexB */) && isIdentifierPart(ch, languageVersion)) {
|
|
12634
12633
|
error2(Diagnostics.This_character_cannot_be_escaped_in_a_regular_expression, pos - 2, 2);
|
|
12635
12634
|
}
|
|
12636
12635
|
return String.fromCharCode(ch);
|
|
@@ -13329,6 +13328,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13329
13328
|
const startOfRegExpBody = tokenStart + 1;
|
|
13330
13329
|
pos = startOfRegExpBody;
|
|
13331
13330
|
let inEscape = false;
|
|
13331
|
+
let namedCaptureGroups = false;
|
|
13332
13332
|
let inCharacterClass = false;
|
|
13333
13333
|
while (true) {
|
|
13334
13334
|
const ch = charCodeChecked(pos);
|
|
@@ -13346,6 +13346,8 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13346
13346
|
inEscape = true;
|
|
13347
13347
|
} else if (ch === 93 /* closeBracket */) {
|
|
13348
13348
|
inCharacterClass = false;
|
|
13349
|
+
} else if (!inCharacterClass && ch === 40 /* openParen */ && charCodeChecked(pos + 1) === 63 /* question */ && charCodeChecked(pos + 2) === 60 /* lessThan */ && charCodeChecked(pos + 3) !== 61 /* equals */ && charCodeChecked(pos + 3) !== 33 /* exclamation */) {
|
|
13350
|
+
namedCaptureGroups = true;
|
|
13349
13351
|
}
|
|
13350
13352
|
pos++;
|
|
13351
13353
|
}
|
|
@@ -13413,7 +13415,8 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13413
13415
|
scanRegularExpressionWorker(
|
|
13414
13416
|
regExpFlags,
|
|
13415
13417
|
/*annexB*/
|
|
13416
|
-
true
|
|
13418
|
+
true,
|
|
13419
|
+
namedCaptureGroups
|
|
13417
13420
|
);
|
|
13418
13421
|
});
|
|
13419
13422
|
}
|
|
@@ -13423,12 +13426,10 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13423
13426
|
}
|
|
13424
13427
|
return token;
|
|
13425
13428
|
}
|
|
13426
|
-
function scanRegularExpressionWorker(regExpFlags, annexB) {
|
|
13429
|
+
function scanRegularExpressionWorker(regExpFlags, annexB, namedCaptureGroups) {
|
|
13427
13430
|
var unicodeSetsMode = !!(regExpFlags & 64 /* UnicodeSets */);
|
|
13428
13431
|
var anyUnicodeMode = !!(regExpFlags & 96 /* AnyUnicodeMode */);
|
|
13429
|
-
|
|
13430
|
-
annexB = false;
|
|
13431
|
-
}
|
|
13432
|
+
var anyUnicodeModeOrNonAnnexB = anyUnicodeMode || !annexB;
|
|
13432
13433
|
var mayContainStrings = false;
|
|
13433
13434
|
var numberOfCapturingGroups = 0;
|
|
13434
13435
|
var groupSpecifiers;
|
|
@@ -13483,7 +13484,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13483
13484
|
case 61 /* equals */:
|
|
13484
13485
|
case 33 /* exclamation */:
|
|
13485
13486
|
pos++;
|
|
13486
|
-
isPreviousTermQuantifiable =
|
|
13487
|
+
isPreviousTermQuantifiable = !anyUnicodeModeOrNonAnnexB;
|
|
13487
13488
|
break;
|
|
13488
13489
|
case 60 /* lessThan */:
|
|
13489
13490
|
const groupNameStart = pos;
|
|
@@ -13537,6 +13538,10 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13537
13538
|
const digitsStart = pos;
|
|
13538
13539
|
scanDigits();
|
|
13539
13540
|
const min2 = tokenValue;
|
|
13541
|
+
if (!anyUnicodeModeOrNonAnnexB && !min2) {
|
|
13542
|
+
isPreviousTermQuantifiable = true;
|
|
13543
|
+
break;
|
|
13544
|
+
}
|
|
13540
13545
|
if (charCodeChecked(pos) === 44 /* comma */) {
|
|
13541
13546
|
pos++;
|
|
13542
13547
|
scanDigits();
|
|
@@ -13545,25 +13550,29 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13545
13550
|
if (max || charCodeChecked(pos) === 125 /* closeBrace */) {
|
|
13546
13551
|
error2(Diagnostics.Incomplete_quantifier_Digit_expected, digitsStart, 0);
|
|
13547
13552
|
} else {
|
|
13548
|
-
|
|
13549
|
-
error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, start2, 1, String.fromCharCode(ch));
|
|
13550
|
-
}
|
|
13553
|
+
error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, start2, 1, String.fromCharCode(ch));
|
|
13551
13554
|
isPreviousTermQuantifiable = true;
|
|
13552
13555
|
break;
|
|
13553
13556
|
}
|
|
13554
|
-
}
|
|
13555
|
-
if (max && Number.parseInt(min2) > Number.parseInt(max)) {
|
|
13557
|
+
} else if (max && Number.parseInt(min2) > Number.parseInt(max) && (anyUnicodeModeOrNonAnnexB || charCodeChecked(pos) === 125 /* closeBrace */)) {
|
|
13556
13558
|
error2(Diagnostics.Numbers_out_of_order_in_quantifier, digitsStart, pos - digitsStart);
|
|
13557
13559
|
}
|
|
13558
13560
|
} else if (!min2) {
|
|
13559
|
-
if (
|
|
13561
|
+
if (anyUnicodeModeOrNonAnnexB) {
|
|
13560
13562
|
error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, start2, 1, String.fromCharCode(ch));
|
|
13561
13563
|
}
|
|
13562
13564
|
isPreviousTermQuantifiable = true;
|
|
13563
13565
|
break;
|
|
13564
13566
|
}
|
|
13565
|
-
|
|
13566
|
-
|
|
13567
|
+
if (charCodeChecked(pos) !== 125 /* closeBrace */) {
|
|
13568
|
+
if (anyUnicodeModeOrNonAnnexB) {
|
|
13569
|
+
error2(Diagnostics._0_expected, pos, 0, String.fromCharCode(125 /* closeBrace */));
|
|
13570
|
+
pos--;
|
|
13571
|
+
} else {
|
|
13572
|
+
isPreviousTermQuantifiable = true;
|
|
13573
|
+
break;
|
|
13574
|
+
}
|
|
13575
|
+
}
|
|
13567
13576
|
case 42 /* asterisk */:
|
|
13568
13577
|
case 43 /* plus */:
|
|
13569
13578
|
case 63 /* question */:
|
|
@@ -13596,7 +13605,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13596
13605
|
}
|
|
13597
13606
|
case 93 /* closeBracket */:
|
|
13598
13607
|
case 125 /* closeBrace */:
|
|
13599
|
-
if (
|
|
13608
|
+
if (anyUnicodeModeOrNonAnnexB || ch === 41 /* closeParen */) {
|
|
13600
13609
|
error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
|
|
13601
13610
|
}
|
|
13602
13611
|
pos++;
|
|
@@ -13645,7 +13654,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13645
13654
|
true
|
|
13646
13655
|
);
|
|
13647
13656
|
scanExpectedChar(62 /* greaterThan */);
|
|
13648
|
-
} else if (
|
|
13657
|
+
} else if (anyUnicodeModeOrNonAnnexB || namedCaptureGroups) {
|
|
13649
13658
|
error2(Diagnostics.k_must_be_followed_by_a_capturing_group_name_enclosed_in_angle_brackets, pos - 2, 2);
|
|
13650
13659
|
}
|
|
13651
13660
|
break;
|
|
@@ -13688,9 +13697,9 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13688
13697
|
pos++;
|
|
13689
13698
|
return String.fromCharCode(ch & 31);
|
|
13690
13699
|
}
|
|
13691
|
-
if (
|
|
13700
|
+
if (anyUnicodeModeOrNonAnnexB) {
|
|
13692
13701
|
error2(Diagnostics.c_must_be_followed_by_an_ASCII_letter, pos - 2, 2);
|
|
13693
|
-
} else if (atomEscape
|
|
13702
|
+
} else if (atomEscape) {
|
|
13694
13703
|
pos--;
|
|
13695
13704
|
return "\\";
|
|
13696
13705
|
}
|
|
@@ -13715,10 +13724,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13715
13724
|
default:
|
|
13716
13725
|
pos--;
|
|
13717
13726
|
return scanEscapeSequence(
|
|
13718
|
-
/*
|
|
13719
|
-
anyUnicodeMode,
|
|
13720
|
-
/*isRegularExpression*/
|
|
13721
|
-
annexB ? "annex-b" : true
|
|
13727
|
+
4 /* RegularExpression */ | (annexB ? 8 /* AnnexB */ : 0) | (anyUnicodeMode ? 16 /* AnyUnicodeMode */ : 0) | (atomEscape ? 32 /* AtomEscape */ : 0)
|
|
13722
13728
|
);
|
|
13723
13729
|
}
|
|
13724
13730
|
}
|
|
@@ -13760,12 +13766,12 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13760
13766
|
if (isClassContentExit(ch2)) {
|
|
13761
13767
|
return;
|
|
13762
13768
|
}
|
|
13763
|
-
if (!minCharacter &&
|
|
13769
|
+
if (!minCharacter && anyUnicodeModeOrNonAnnexB) {
|
|
13764
13770
|
error2(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, minStart, pos - 1 - minStart);
|
|
13765
13771
|
}
|
|
13766
13772
|
const maxStart = pos;
|
|
13767
13773
|
const maxCharacter = scanClassAtom();
|
|
13768
|
-
if (!maxCharacter &&
|
|
13774
|
+
if (!maxCharacter && anyUnicodeModeOrNonAnnexB) {
|
|
13769
13775
|
error2(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, maxStart, pos - maxStart);
|
|
13770
13776
|
continue;
|
|
13771
13777
|
}
|
|
@@ -14195,8 +14201,11 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
14195
14201
|
if (!anyUnicodeMode) {
|
|
14196
14202
|
error2(Diagnostics.Unicode_property_value_expressions_are_only_available_when_the_Unicode_u_flag_or_the_Unicode_Sets_v_flag_is_set, start2, pos - start2);
|
|
14197
14203
|
}
|
|
14198
|
-
} else if (
|
|
14204
|
+
} else if (anyUnicodeModeOrNonAnnexB) {
|
|
14199
14205
|
error2(Diagnostics._0_must_be_followed_by_a_Unicode_property_value_expression_enclosed_in_braces, pos - 2, 2, String.fromCharCode(ch));
|
|
14206
|
+
} else {
|
|
14207
|
+
pos--;
|
|
14208
|
+
return false;
|
|
14200
14209
|
}
|
|
14201
14210
|
return true;
|
|
14202
14211
|
}
|
|
@@ -14236,11 +14245,11 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
14236
14245
|
}
|
|
14237
14246
|
});
|
|
14238
14247
|
forEach(decimalEscapes, (escape) => {
|
|
14239
|
-
if (
|
|
14248
|
+
if (escape.value > numberOfCapturingGroups) {
|
|
14240
14249
|
if (numberOfCapturingGroups) {
|
|
14241
14250
|
error2(Diagnostics.This_backreference_refers_to_a_group_that_does_not_exist_There_are_only_0_capturing_groups_in_this_regular_expression, escape.pos, escape.end - escape.pos, numberOfCapturingGroups);
|
|
14242
14251
|
} else {
|
|
14243
|
-
error2(Diagnostics.
|
|
14252
|
+
error2(Diagnostics.This_backreference_refers_to_a_group_that_does_not_exist_There_are_no_capturing_groups_in_this_regular_expression, escape.pos, escape.end - escape.pos);
|
|
14244
14253
|
}
|
|
14245
14254
|
}
|
|
14246
14255
|
});
|
|
@@ -29801,7 +29810,7 @@ var addDisposableResourceHelper = {
|
|
|
29801
29810
|
var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
|
|
29802
29811
|
if (value !== null && value !== void 0) {
|
|
29803
29812
|
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
29804
|
-
var dispose;
|
|
29813
|
+
var dispose, inner;
|
|
29805
29814
|
if (async) {
|
|
29806
29815
|
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
29807
29816
|
dispose = value[Symbol.asyncDispose];
|
|
@@ -29809,8 +29818,10 @@ var addDisposableResourceHelper = {
|
|
|
29809
29818
|
if (dispose === void 0) {
|
|
29810
29819
|
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
29811
29820
|
dispose = value[Symbol.dispose];
|
|
29821
|
+
if (async) inner = dispose;
|
|
29812
29822
|
}
|
|
29813
29823
|
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
|
29824
|
+
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
|
|
29814
29825
|
env.stack.push({ value: value, dispose: dispose, async: async });
|
|
29815
29826
|
}
|
|
29816
29827
|
else if (async) {
|
|
@@ -75055,7 +75066,31 @@ function createTypeChecker(host) {
|
|
|
75055
75066
|
if (!node.asteriskToken && contextualReturnType.flags & 1048576 /* Union */) {
|
|
75056
75067
|
contextualReturnType = filterType(contextualReturnType, (type) => !!getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, type, isAsyncGenerator));
|
|
75057
75068
|
}
|
|
75058
|
-
|
|
75069
|
+
if (node.asteriskToken) {
|
|
75070
|
+
const iterationTypes = getIterationTypesOfGeneratorFunctionReturnType(contextualReturnType, isAsyncGenerator);
|
|
75071
|
+
const yieldType = (iterationTypes == null ? void 0 : iterationTypes.yieldType) ?? silentNeverType;
|
|
75072
|
+
const returnType = getContextualType2(node, contextFlags) ?? silentNeverType;
|
|
75073
|
+
const nextType = (iterationTypes == null ? void 0 : iterationTypes.nextType) ?? unknownType;
|
|
75074
|
+
const generatorType = createGeneratorType(
|
|
75075
|
+
yieldType,
|
|
75076
|
+
returnType,
|
|
75077
|
+
nextType,
|
|
75078
|
+
/*isAsyncGenerator*/
|
|
75079
|
+
false
|
|
75080
|
+
);
|
|
75081
|
+
if (isAsyncGenerator) {
|
|
75082
|
+
const asyncGeneratorType = createGeneratorType(
|
|
75083
|
+
yieldType,
|
|
75084
|
+
returnType,
|
|
75085
|
+
nextType,
|
|
75086
|
+
/*isAsyncGenerator*/
|
|
75087
|
+
true
|
|
75088
|
+
);
|
|
75089
|
+
return getUnionType([generatorType, asyncGeneratorType]);
|
|
75090
|
+
}
|
|
75091
|
+
return generatorType;
|
|
75092
|
+
}
|
|
75093
|
+
return getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, contextualReturnType, isAsyncGenerator);
|
|
75059
75094
|
}
|
|
75060
75095
|
}
|
|
75061
75096
|
return void 0;
|
|
@@ -80825,7 +80860,7 @@ function createTypeChecker(host) {
|
|
|
80825
80860
|
if (nextType) nextType = getWidenedType(nextType);
|
|
80826
80861
|
}
|
|
80827
80862
|
if (isGenerator) {
|
|
80828
|
-
return
|
|
80863
|
+
return createGeneratorType(
|
|
80829
80864
|
yieldType || neverType,
|
|
80830
80865
|
returnType || fallbackReturnType,
|
|
80831
80866
|
nextType || getContextualIterationType(2 /* Next */, func) || unknownType,
|
|
@@ -80835,7 +80870,7 @@ function createTypeChecker(host) {
|
|
|
80835
80870
|
return isAsync ? createPromiseType(returnType || fallbackReturnType) : returnType || fallbackReturnType;
|
|
80836
80871
|
}
|
|
80837
80872
|
}
|
|
80838
|
-
function
|
|
80873
|
+
function createGeneratorType(yieldType, returnType, nextType, isAsyncGenerator) {
|
|
80839
80874
|
const resolver = isAsyncGenerator ? asyncIterationTypesResolver : syncIterationTypesResolver;
|
|
80840
80875
|
const globalGeneratorType = resolver.getGlobalGeneratorType(
|
|
80841
80876
|
/*reportErrors*/
|
|
@@ -83220,7 +83255,7 @@ function createTypeChecker(host) {
|
|
|
83220
83255
|
const generatorYieldType = getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, returnType, (functionFlags & 2 /* Async */) !== 0) || anyType;
|
|
83221
83256
|
const generatorReturnType = getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, returnType, (functionFlags & 2 /* Async */) !== 0) || generatorYieldType;
|
|
83222
83257
|
const generatorNextType = getIterationTypeOfGeneratorFunctionReturnType(2 /* Next */, returnType, (functionFlags & 2 /* Async */) !== 0) || unknownType;
|
|
83223
|
-
const generatorInstantiation =
|
|
83258
|
+
const generatorInstantiation = createGeneratorType(generatorYieldType, generatorReturnType, generatorNextType, !!(functionFlags & 2 /* Async */));
|
|
83224
83259
|
return checkTypeAssignableTo(generatorInstantiation, returnType, errorNode);
|
|
83225
83260
|
}
|
|
83226
83261
|
function checkClassForDuplicateDeclarations(node) {
|
|
@@ -177780,7 +177815,14 @@ function pasteEdits(targetFile, pastedText, pasteLocations, copiedFrom, host, pr
|
|
|
177780
177815
|
if (copiedFrom == null ? void 0 : copiedFrom.range) {
|
|
177781
177816
|
Debug.assert(copiedFrom.range.length === pastedText.length);
|
|
177782
177817
|
copiedFrom.range.forEach((copy) => {
|
|
177783
|
-
|
|
177818
|
+
const statementsInSourceFile = copiedFrom.file.statements;
|
|
177819
|
+
const startNodeIndex = findIndex(statementsInSourceFile, (s) => s.end > copy.pos);
|
|
177820
|
+
if (startNodeIndex === -1) return void 0;
|
|
177821
|
+
let endNodeIndex = findIndex(statementsInSourceFile, (s) => s.end >= copy.end, startNodeIndex);
|
|
177822
|
+
if (endNodeIndex !== -1 && copy.end <= statementsInSourceFile[endNodeIndex].getStart()) {
|
|
177823
|
+
endNodeIndex--;
|
|
177824
|
+
}
|
|
177825
|
+
statements.push(...statementsInSourceFile.slice(startNodeIndex, endNodeIndex === -1 ? statementsInSourceFile.length : endNodeIndex + 1));
|
|
177784
177826
|
});
|
|
177785
177827
|
const usage = getUsageInfo(copiedFrom.file, statements, originalProgram.getTypeChecker(), getExistingLocals(updatedFile, statements, originalProgram.getTypeChecker()));
|
|
177786
177828
|
Debug.assertIsDefined(originalProgram);
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "typescript",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "5.5.0-dev.
|
|
5
|
+
"version": "5.5.0-dev.20240530",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
],
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@dprint/formatter": "^0.3.0",
|
|
43
|
-
"@dprint/typescript": "0.
|
|
43
|
+
"@dprint/typescript": "0.91.0",
|
|
44
44
|
"@esfx/canceltoken": "^1.0.0",
|
|
45
45
|
"@octokit/rest": "^20.1.1",
|
|
46
46
|
"@types/chai": "^4.3.16",
|
|
@@ -51,22 +51,22 @@
|
|
|
51
51
|
"@types/node": "latest",
|
|
52
52
|
"@types/source-map-support": "^0.5.10",
|
|
53
53
|
"@types/which": "^3.0.3",
|
|
54
|
-
"@typescript-eslint/eslint-plugin": "^7.
|
|
55
|
-
"@typescript-eslint/parser": "^7.
|
|
56
|
-
"@typescript-eslint/utils": "^7.
|
|
54
|
+
"@typescript-eslint/eslint-plugin": "^7.11.0",
|
|
55
|
+
"@typescript-eslint/parser": "^7.11.0",
|
|
56
|
+
"@typescript-eslint/utils": "^7.11.0",
|
|
57
57
|
"azure-devops-node-api": "^13.0.0",
|
|
58
58
|
"c8": "^9.1.0",
|
|
59
59
|
"chai": "^4.4.1",
|
|
60
60
|
"chalk": "^4.1.2",
|
|
61
61
|
"chokidar": "^3.6.0",
|
|
62
62
|
"diff": "^5.2.0",
|
|
63
|
-
"dprint": "^0.
|
|
64
|
-
"esbuild": "^0.21.
|
|
63
|
+
"dprint": "^0.46.1",
|
|
64
|
+
"esbuild": "^0.21.4",
|
|
65
65
|
"eslint": "^8.57.0",
|
|
66
66
|
"eslint-formatter-autolinkable-stylish": "^1.3.0",
|
|
67
67
|
"eslint-plugin-local": "^4.2.2",
|
|
68
|
-
"fast-xml-parser": "^4.
|
|
69
|
-
"glob": "^10.
|
|
68
|
+
"fast-xml-parser": "^4.4.0",
|
|
69
|
+
"glob": "^10.4.1",
|
|
70
70
|
"hereby": "^1.8.9",
|
|
71
71
|
"jsonc-parser": "^3.2.1",
|
|
72
72
|
"minimist": "^1.2.8",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"mocha-fivemat-progress-reporter": "^0.1.0",
|
|
75
75
|
"ms": "^2.1.3",
|
|
76
76
|
"node-fetch": "^3.3.2",
|
|
77
|
-
"playwright": "^1.44.
|
|
77
|
+
"playwright": "^1.44.1",
|
|
78
78
|
"source-map-support": "^0.5.21",
|
|
79
79
|
"tslib": "^2.6.2",
|
|
80
80
|
"typescript": "^5.4.5",
|
|
@@ -112,5 +112,5 @@
|
|
|
112
112
|
"node": "20.1.0",
|
|
113
113
|
"npm": "8.19.4"
|
|
114
114
|
},
|
|
115
|
-
"gitHead": "
|
|
115
|
+
"gitHead": "5df3a107c0e8626479dc3310a0b3da63bf55ed9d"
|
|
116
116
|
}
|