coc-pyright 1.1.383 → 1.1.385
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/index.js +945 -636
- package/package.json +3 -3
package/lib/index.js
CHANGED
|
@@ -625,6 +625,7 @@ var require_collectionUtils = __commonJS({
|
|
|
625
625
|
exports2.contains = contains;
|
|
626
626
|
exports2.append = append;
|
|
627
627
|
exports2.appendArray = appendArray;
|
|
628
|
+
exports2.partition = partition;
|
|
628
629
|
exports2.find = find;
|
|
629
630
|
exports2.addRange = addRange;
|
|
630
631
|
exports2.insertAt = insertAt;
|
|
@@ -675,6 +676,18 @@ var require_collectionUtils = __commonJS({
|
|
|
675
676
|
to.push(elem);
|
|
676
677
|
}
|
|
677
678
|
}
|
|
679
|
+
function partition(array, cb) {
|
|
680
|
+
const trueItems = [];
|
|
681
|
+
const falseItems = [];
|
|
682
|
+
for (const item of array) {
|
|
683
|
+
if (cb(item)) {
|
|
684
|
+
trueItems.push(item);
|
|
685
|
+
} else {
|
|
686
|
+
falseItems.push(item);
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
return [trueItems, falseItems];
|
|
690
|
+
}
|
|
678
691
|
function find(array, predicate) {
|
|
679
692
|
for (let i = 0; i < array.length; i++) {
|
|
680
693
|
const value = array[i];
|
|
@@ -12895,7 +12908,7 @@ var require_pythonVersion = __commonJS({
|
|
|
12895
12908
|
exports2.pythonVersion3_12 = PythonVersion.create(3, 12);
|
|
12896
12909
|
exports2.pythonVersion3_13 = PythonVersion.create(3, 13);
|
|
12897
12910
|
exports2.pythonVersion3_14 = PythonVersion.create(3, 14);
|
|
12898
|
-
exports2.latestStablePythonVersion = exports2.
|
|
12911
|
+
exports2.latestStablePythonVersion = exports2.pythonVersion3_13;
|
|
12899
12912
|
}
|
|
12900
12913
|
});
|
|
12901
12914
|
|
|
@@ -16929,6 +16942,7 @@ var require_package_nls_cs = __commonJS({
|
|
|
16929
16942
|
typedDictFieldReadOnlyRedefinition: "Polo\u017Eka TypedDict {name} nejde p\u0159edefinovat jako ReadOnly.",
|
|
16930
16943
|
typedDictFieldRequiredRedefinition: "Polo\u017Eka TypedDict {name} nejde p\u0159edefinovat jako Required.",
|
|
16931
16944
|
typedDictFirstArg: "Jako prvn\xED argument byl o\u010Dek\xE1v\xE1n n\xE1zev t\u0159\xEDdy TypedDict",
|
|
16945
|
+
typedDictInClassPattern: "T\u0159\xEDda TypedDict nen\xED ve vzoru t\u0159\xEDdy povolena.",
|
|
16932
16946
|
typedDictInitsubclassParameter: "TypedDict nepodporuje parametr __init_subclass__ \u201E{name}\u201C.",
|
|
16933
16947
|
typedDictNotAllowed: "\u201ETypedDict\u201C se v tomto kontextu ned\xE1 pou\u017E\xEDt.",
|
|
16934
16948
|
typedDictSecondArgDict: "Jako druh\xFD parametr se o\u010Dek\xE1val parametr dict nebo keyword.",
|
|
@@ -17158,7 +17172,7 @@ var require_package_nls_cs = __commonJS({
|
|
|
17158
17172
|
typedDictClosedExtraTypeMismatch: "Nelze p\u0159idat polo\u017Eku {name} s typem {type}.",
|
|
17159
17173
|
typedDictClosedFieldNotRequired: "Nelze p\u0159idat polo\u017Eku {name}, proto\u017Ee mus\xED b\xFDt NotRequired.",
|
|
17160
17174
|
typedDictExtraFieldNotAllowed: "{name} nen\xED k dispozici v {type}",
|
|
17161
|
-
typedDictExtraFieldTypeMismatch: "Typ {name} nen\xED kompatibiln\xED s typem
|
|
17175
|
+
typedDictExtraFieldTypeMismatch: "Typ {name} nen\xED kompatibiln\xED s typem extra_items v typu {type}.",
|
|
17162
17176
|
typedDictFieldMissing: "V {type} chyb\xED {name}",
|
|
17163
17177
|
typedDictFieldNotReadOnly: "{name} nen\xED v {type} jen pro \u010Dten\xED",
|
|
17164
17178
|
typedDictFieldNotRequired: "{name} se v typu {type} nevy\u017Eaduje",
|
|
@@ -17755,6 +17769,7 @@ var require_package_nls_de = __commonJS({
|
|
|
17755
17769
|
typedDictFieldReadOnlyRedefinition: "Das TypedDict-Element \u201E{name}\u201C kann nicht als \u201EReadOnly\u201C neu definiert werden.",
|
|
17756
17770
|
typedDictFieldRequiredRedefinition: "Das TypedDict-Element \u201E{name}\u201C kann nicht als \u201ERequired\u201C neu definiert werden.",
|
|
17757
17771
|
typedDictFirstArg: 'Der Klassenname "TypedDict" wird als erstes Argument erwartet.',
|
|
17772
|
+
typedDictInClassPattern: "Die TypedDict-Klasse ist im Klassenmuster nicht zul\xE4ssig.",
|
|
17758
17773
|
typedDictInitsubclassParameter: "TypedDict unterst\xFCtzt __init_subclass__ Parameter \u201E{name}\u201C nicht.",
|
|
17759
17774
|
typedDictNotAllowed: '"TypedDict" kann in diesem Kontext nicht verwendet werden.',
|
|
17760
17775
|
typedDictSecondArgDict: "Es wird ein dict- oder Schl\xFCsselwortparameter als zweiter Parameter erwartet.",
|
|
@@ -17984,7 +17999,7 @@ var require_package_nls_de = __commonJS({
|
|
|
17984
17999
|
typedDictClosedExtraTypeMismatch: "Das Element \u201E{name}\u201C mit dem Typ \u201E{type}\u201C kann nicht hinzugef\xFCgt werden.",
|
|
17985
18000
|
typedDictClosedFieldNotRequired: "Das Element \u201E{name}\u201C kann nicht hinzugef\xFCgt werden, da es \u201ENotRequired\u201C sein muss.",
|
|
17986
18001
|
typedDictExtraFieldNotAllowed: "\u201E{name}\u201C ist in \u201E{type}\u201C nicht vorhanden.",
|
|
17987
|
-
typedDictExtraFieldTypeMismatch: "Der Typ von \u201E{name}\u201C ist nicht mit dem Typ \
|
|
18002
|
+
typedDictExtraFieldTypeMismatch: "Der Typ von \u201E{name}\u201C ist nicht mit dem Typ \u201Eextra_items\u201C in \u201E{type}\u201C kompatibel.",
|
|
17988
18003
|
typedDictFieldMissing: '"{name}" fehlt in "{type}"',
|
|
17989
18004
|
typedDictFieldNotReadOnly: '"{name}" ist in "{type}" nicht schreibgesch\xFCtzt.',
|
|
17990
18005
|
typedDictFieldNotRequired: '"{name}" ist in "{type}" nicht erforderlich.',
|
|
@@ -18234,6 +18249,7 @@ var require_package_nls_en_us = __commonJS({
|
|
|
18234
18249
|
dataClassConverterFunction: 'Argument of type "{argType}" is not a valid converter for field "{fieldName}" of type "{fieldType}"',
|
|
18235
18250
|
dataClassConverterOverloads: 'No overloads of "{funcName}" are valid converters for field "{fieldName}" of type "{fieldType}"',
|
|
18236
18251
|
dataClassFieldInheritedDefault: '"{fieldName}" overrides a field of the same name but is missing a default value',
|
|
18252
|
+
dataClassFieldInvalidAlias: 'Alias name "{aliasName}" is not a valid identifier',
|
|
18237
18253
|
dataClassFieldWithDefault: "Fields without default values cannot appear after fields with default values",
|
|
18238
18254
|
dataClassFieldWithPrivateName: "Dataclass field cannot use private name",
|
|
18239
18255
|
dataClassFieldWithoutAnnotation: "Dataclass field without type annotation will cause runtime exception",
|
|
@@ -19468,6 +19484,10 @@ var require_package_nls_en_us = __commonJS({
|
|
|
19468
19484
|
message: "Extra TypedDict arguments not supported",
|
|
19469
19485
|
comment: "{Locked='TypedDict'}"
|
|
19470
19486
|
},
|
|
19487
|
+
typedDictExtraItemsClosed: {
|
|
19488
|
+
message: "A TypedDict cannot be closed if it supports extra items",
|
|
19489
|
+
comment: "{Locked='TypedDict','closed'}"
|
|
19490
|
+
},
|
|
19471
19491
|
typedDictFieldNotRequiredRedefinition: {
|
|
19472
19492
|
message: 'TypedDict item "{name}" cannot be redefined as NotRequired',
|
|
19473
19493
|
comment: "{Locked='TypedDict','NotRequired'}"
|
|
@@ -20027,8 +20047,8 @@ var require_package_nls_en_us = __commonJS({
|
|
|
20027
20047
|
},
|
|
20028
20048
|
typedDictExtraFieldNotAllowed: '"{name}" is not present in "{type}"',
|
|
20029
20049
|
typedDictExtraFieldTypeMismatch: {
|
|
20030
|
-
message: 'Type of "{name}" is incompatible with type of "
|
|
20031
|
-
comment: "{Locked='
|
|
20050
|
+
message: 'Type of "{name}" is incompatible with type of "extra_items" in "{type}"',
|
|
20051
|
+
comment: "{Locked='extra_items'}"
|
|
20032
20052
|
},
|
|
20033
20053
|
typedDictFieldMissing: '"{name}" is missing from "{type}"',
|
|
20034
20054
|
typedDictFieldNotReadOnly: '"{name}" is not read-only in "{type}"',
|
|
@@ -20647,6 +20667,7 @@ var require_package_nls_es = __commonJS({
|
|
|
20647
20667
|
typedDictFieldReadOnlyRedefinition: 'El elemento TypedDict "{name}" no se puede redefinir como ReadOnly',
|
|
20648
20668
|
typedDictFieldRequiredRedefinition: 'El elemento TypedDict "{name}" no se puede redefinir como Required',
|
|
20649
20669
|
typedDictFirstArg: "Nombre de clase TypedDict esperado como primer argumento",
|
|
20670
|
+
typedDictInClassPattern: "No se permite la clase TypedDict en el patr\xF3n de clase",
|
|
20650
20671
|
typedDictInitsubclassParameter: 'TypedDict no admite __init_subclass__ par\xE1metro "{name}"',
|
|
20651
20672
|
typedDictNotAllowed: '"TypedDict" no puede utilizarse en este contexto',
|
|
20652
20673
|
typedDictSecondArgDict: "Par\xE1metro dict o palabra clave esperado como segundo par\xE1metro",
|
|
@@ -20876,7 +20897,7 @@ var require_package_nls_es = __commonJS({
|
|
|
20876
20897
|
typedDictClosedExtraTypeMismatch: 'No se puede agregar el elemento "{name}" con el tipo "{type}"',
|
|
20877
20898
|
typedDictClosedFieldNotRequired: 'No se puede agregar el elemento "{name}" porque debe ser NotRequired.',
|
|
20878
20899
|
typedDictExtraFieldNotAllowed: '"{name}" no est\xE1 presente en "{type}"',
|
|
20879
|
-
typedDictExtraFieldTypeMismatch: 'El tipo de "{name}" no es compatible con el tipo de "
|
|
20900
|
+
typedDictExtraFieldTypeMismatch: 'El tipo de "{name}" no es compatible con el tipo de "extra_items" en "{type}"',
|
|
20880
20901
|
typedDictFieldMissing: '"{name}" falta en "{type}"',
|
|
20881
20902
|
typedDictFieldNotReadOnly: '"{name}" no es de solo lectura en "{type}"',
|
|
20882
20903
|
typedDictFieldNotRequired: '"{name}" no es obligatorio en "{type}"',
|
|
@@ -21473,6 +21494,7 @@ var require_package_nls_fr = __commonJS({
|
|
|
21473
21494
|
typedDictFieldReadOnlyRedefinition: "L\u2019\xE9l\xE9ment TypedDict \xAB\xA0{name}\xA0\xBB ne peut pas \xEAtre red\xE9fini comme \xE9tat En ReadOnly",
|
|
21474
21495
|
typedDictFieldRequiredRedefinition: "L\u2019\xE9l\xE9ment TypedDict \xAB\xA0{name}\xA0\xBB ne peut pas \xEAtre red\xE9fini comme \xE9tant Required",
|
|
21475
21496
|
typedDictFirstArg: "Nom de classe TypedDict attendu comme premier argument",
|
|
21497
|
+
typedDictInClassPattern: "La classe TypedDict n'est pas autoris\xE9e dans le mod\xE8le de classe",
|
|
21476
21498
|
typedDictInitsubclassParameter: "TypedDict ne prend pas en charge __init_subclass__ param\xE8tre \xAB\xA0{name}\xA0\xBB",
|
|
21477
21499
|
typedDictNotAllowed: '"TypedDict" ne peut pas \xEAtre utilis\xE9 dans ce contexte',
|
|
21478
21500
|
typedDictSecondArgDict: "Param\xE8tre de mot cl\xE9 ou de dict attendu en tant que deuxi\xE8me param\xE8tre",
|
|
@@ -21702,7 +21724,7 @@ var require_package_nls_fr = __commonJS({
|
|
|
21702
21724
|
typedDictClosedExtraTypeMismatch: "Impossible d\u2019ajouter l\u2019\xE9l\xE9ment \xAB\xA0{name}\xA0\xBB avec le type \xAB\xA0{type}\xA0\xBB",
|
|
21703
21725
|
typedDictClosedFieldNotRequired: "Impossible d\u2019ajouter l\u2019\xE9l\xE9ment \xAB\xA0{name}\xA0\xBB, car il doit \xEAtre NotRequired",
|
|
21704
21726
|
typedDictExtraFieldNotAllowed: "\xAB\xA0{name}\xA0\xBB n\u2019est pas pr\xE9sent dans \xAB\xA0{type}\xA0\xBB",
|
|
21705
|
-
typedDictExtraFieldTypeMismatch: "Le type de \xAB\xA0{name}\xA0\xBB est incompatible avec le type \xAB\
|
|
21727
|
+
typedDictExtraFieldTypeMismatch: "Le type de \xAB\xA0{name}\xA0\xBB est incompatible avec le type \xAB\xA0extra_items\xA0\xBB dans \xAB\xA0{type}\xA0\xBB",
|
|
21706
21728
|
typedDictFieldMissing: "\xAB\xA0{name}\xA0\xBB est manquant dans \xAB\xA0{type}\xA0\xBB",
|
|
21707
21729
|
typedDictFieldNotReadOnly: "\xAB\xA0{name}\xA0\xBB n\u2019est pas en lecture seule dans \xAB\xA0{type}\xA0\xBB",
|
|
21708
21730
|
typedDictFieldNotRequired: "\xAB\xA0{name}\xA0\xBB n\u2019est pas obligatoire dans \xAB\xA0{type}\xA0\xBB",
|
|
@@ -22299,6 +22321,7 @@ var require_package_nls_it = __commonJS({
|
|
|
22299
22321
|
typedDictFieldReadOnlyRedefinition: 'Non \xE8 possibile ridefinire l\u2019elemento TypedDict "{name}" come ReadOnly',
|
|
22300
22322
|
typedDictFieldRequiredRedefinition: 'Non \xE8 possibile ridefinire il campo TypedDict "{name}" come Required',
|
|
22301
22323
|
typedDictFirstArg: "\xC8 previsto il nome della classe TypedDict come primo argomento",
|
|
22324
|
+
typedDictInClassPattern: "Classe TypedDict non consentita nel modello di classe",
|
|
22302
22325
|
typedDictInitsubclassParameter: "TypedDict non supporta __init_subclass__ parametro \u201C{name}\u201D",
|
|
22303
22326
|
typedDictNotAllowed: '"TypedDict" non pu\xF2 essere usato in questo contesto',
|
|
22304
22327
|
typedDictSecondArgDict: "Previsto parametro dict o keyword come secondo parametro",
|
|
@@ -22528,7 +22551,7 @@ var require_package_nls_it = __commonJS({
|
|
|
22528
22551
|
typedDictClosedExtraTypeMismatch: `Non \xE8 possibile aggiungere l'elemento "{name}" con tipo "{type}"`,
|
|
22529
22552
|
typedDictClosedFieldNotRequired: `Non \xE8 possibile aggiungere l'elemento "{name}" perch\xE9 deve essere NotRequired`,
|
|
22530
22553
|
typedDictExtraFieldNotAllowed: '"{name}" non \xE8 presente in "{type}"',
|
|
22531
|
-
typedDictExtraFieldTypeMismatch: 'Il tipo di "{name}" non \xE8 compatibile con il tipo "
|
|
22554
|
+
typedDictExtraFieldTypeMismatch: 'Il tipo di "{name}" non \xE8 compatibile con il tipo "extra_items" in "{type}"',
|
|
22532
22555
|
typedDictFieldMissing: '"{name}" mancante nel "{type}"',
|
|
22533
22556
|
typedDictFieldNotReadOnly: '"{name}" non \xE8 di sola lettura in "{type}"',
|
|
22534
22557
|
typedDictFieldNotRequired: '"{name}" non \xE8 obbligatorio in "{type}"',
|
|
@@ -23125,6 +23148,7 @@ var require_package_nls_ja = __commonJS({
|
|
|
23125
23148
|
typedDictFieldReadOnlyRedefinition: 'TypedDict \u30A2\u30A4\u30C6\u30E0 "{name}" \u3092 ReadOnly \u3068\u3057\u3066\u518D\u5B9A\u7FA9\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093',
|
|
23126
23149
|
typedDictFieldRequiredRedefinition: 'TypedDict \u30A2\u30A4\u30C6\u30E0 "{name}" \u3092 Required \u3068\u3057\u3066\u518D\u5B9A\u7FA9\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093',
|
|
23127
23150
|
typedDictFirstArg: "\u6700\u521D\u306E\u5F15\u6570\u3068\u3057\u3066 TypedDict \u30AF\u30E9\u30B9\u540D\u304C\u5FC5\u8981\u3067\u3059",
|
|
23151
|
+
typedDictInClassPattern: "TypedDict \u30AF\u30E9\u30B9\u306F\u30AF\u30E9\u30B9 \u30D1\u30BF\u30FC\u30F3\u3067\u306F\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093",
|
|
23128
23152
|
typedDictInitsubclassParameter: 'TypedDict \u306F __init_subclass__\u30D1\u30E9\u30E1\u30FC\u30BF\u30FC "{name}" \u3092\u30B5\u30DD\u30FC\u30C8\u3057\u3066\u3044\u307E\u305B\u3093',
|
|
23129
23153
|
typedDictNotAllowed: '"TypedDict" \u306F\u3053\u306E\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u3067\u306F\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093',
|
|
23130
23154
|
typedDictSecondArgDict: "2 \u756A\u76EE\u306E\u30D1\u30E9\u30E1\u30FC\u30BF\u30FC\u3068\u3057\u3066 dict \u30D1\u30E9\u30E1\u30FC\u30BF\u30FC\u307E\u305F\u306F\u30AD\u30FC\u30EF\u30FC\u30C9 \u30D1\u30E9\u30E1\u30FC\u30BF\u30FC\u304C\u5FC5\u8981\u3067\u3059",
|
|
@@ -23354,7 +23378,7 @@ var require_package_nls_ja = __commonJS({
|
|
|
23354
23378
|
typedDictClosedExtraTypeMismatch: '\u578B "{type}" \u306E\u30A2\u30A4\u30C6\u30E0 "{name}" \u3092\u8FFD\u52A0\u3067\u304D\u307E\u305B\u3093',
|
|
23355
23379
|
typedDictClosedFieldNotRequired: '\u30A2\u30A4\u30C6\u30E0 "{name}" \u3092\u8FFD\u52A0\u3067\u304D\u307E\u305B\u3093\u3002\u3053\u308C\u306F NotRequired \u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308B\u305F\u3081\u3067\u3059\u3002',
|
|
23356
23380
|
typedDictExtraFieldNotAllowed: '"{name}" \u306F "{type}" \u306B\u5B58\u5728\u3057\u307E\u305B\u3093',
|
|
23357
|
-
typedDictExtraFieldTypeMismatch: '"{name}" \u306E\u578B\u306F\u3001"{type}" \u306E "
|
|
23381
|
+
typedDictExtraFieldTypeMismatch: '"{name}" \u306E\u578B\u306F\u3001"{type}" \u306E "extra_items" \u578B\u3068\u4E92\u63DB\u6027\u304C\u3042\u308A\u307E\u305B\u3093',
|
|
23358
23382
|
typedDictFieldMissing: '"{name}" \u304C "{type}" \u306B\u898B\u3064\u304B\u308A\u307E\u305B\u3093',
|
|
23359
23383
|
typedDictFieldNotReadOnly: '"{name}" \u306F "{type}" \u3067\u306F\u8AAD\u307F\u53D6\u308A\u5C02\u7528\u3067\u306F\u3042\u308A\u307E\u305B\u3093',
|
|
23360
23384
|
typedDictFieldNotRequired: '"{name}" \u306F "{type}" \u306B\u306F\u5FC5\u8981\u3042\u308A\u307E\u305B\u3093',
|
|
@@ -23951,6 +23975,7 @@ var require_package_nls_ko = __commonJS({
|
|
|
23951
23975
|
typedDictFieldReadOnlyRedefinition: 'TypedDict \uD56D\uBAA9 "{name}"\uC740(\uB294) ReadOnly\uB85C \uC7AC\uC815\uC758\uB420 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.',
|
|
23952
23976
|
typedDictFieldRequiredRedefinition: 'TypedDict \uD56D\uBAA9 "{name}"\uC740(\uB294) Required\uB85C \uC7AC\uC815\uC758\uB420 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.',
|
|
23953
23977
|
typedDictFirstArg: "TypedDict \uD074\uB798\uC2A4 \uC774\uB984\uC774 \uCCAB \uBC88\uC9F8 \uC778\uC218\uB85C \uD544\uC694\uD569\uB2C8\uB2E4.",
|
|
23978
|
+
typedDictInClassPattern: "TypedDict \uD074\uB798\uC2A4\uB294 \uD074\uB798\uC2A4 \uD328\uD134\uC5D0\uC11C \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.",
|
|
23954
23979
|
typedDictInitsubclassParameter: 'TypedDict\uB294 __init_subclass__ \uB9E4\uAC1C \uBCC0\uC218 "{name}"\uC744(\uB97C) \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.',
|
|
23955
23980
|
typedDictNotAllowed: '\uC774 \uCEE8\uD14D\uC2A4\uD2B8\uC5D0\uC11C\uB294 "TypedDict"\uB97C \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.',
|
|
23956
23981
|
typedDictSecondArgDict: "\uB450 \uBC88\uC9F8 \uB9E4\uAC1C \uBCC0\uC218\uB85C dict \uB610\uB294 \uD0A4\uC6CC\uB4DC \uB9E4\uAC1C \uBCC0\uC218\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4.",
|
|
@@ -24180,7 +24205,7 @@ var require_package_nls_ko = __commonJS({
|
|
|
24180
24205
|
typedDictClosedExtraTypeMismatch: '\uD615\uC2DD\uC774 "{type}"\uC778 \uD56D\uBAA9 "{name}"\uC744(\uB97C) \uCD94\uAC00\uD560 \uC218 \uC5C6\uC74C',
|
|
24181
24206
|
typedDictClosedFieldNotRequired: '"{name}" \uD56D\uBAA9\uC740 NotRequired\uC5EC\uC57C \uD558\uBBC0\uB85C \uCD94\uAC00\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.',
|
|
24182
24207
|
typedDictExtraFieldNotAllowed: '"{name}"\uC774(\uAC00) "{type}"\uC5D0 \uC5C6\uC74C',
|
|
24183
|
-
typedDictExtraFieldTypeMismatch: '"{name}" \uD615\uC2DD\uC740 "{type}"\uC758 "
|
|
24208
|
+
typedDictExtraFieldTypeMismatch: '"{name}" \uD615\uC2DD\uC740 "{type}"\uC758 "extra_items" \uD615\uC2DD\uACFC \uD638\uD658\uB418\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.',
|
|
24184
24209
|
typedDictFieldMissing: '"{name}"\uC774(\uAC00) "{type}"\uC5D0 \uC5C6\uC2B5\uB2C8\uB2E4.',
|
|
24185
24210
|
typedDictFieldNotReadOnly: '"{name}"\uC740(\uB294) "{type}"\uC5D0\uC11C \uC77D\uAE30 \uC804\uC6A9\uC774 \uC544\uB2D9\uB2C8\uB2E4.',
|
|
24186
24211
|
typedDictFieldNotRequired: '"{name}"\uC740(\uB294) "{type}"\uC5D0 \uD544\uC694\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.',
|
|
@@ -24777,6 +24802,7 @@ var require_package_nls_pl = __commonJS({
|
|
|
24777
24802
|
typedDictFieldReadOnlyRedefinition: "Element TypedDict \u201E{name}\u201D nie mo\u017Ce by\u0107 przedefiniowany jako ReadOnly.",
|
|
24778
24803
|
typedDictFieldRequiredRedefinition: "Element TypedDict \u201E{name}\u201D nie mo\u017Ce zosta\u0107 przedefiniowany jako Required",
|
|
24779
24804
|
typedDictFirstArg: "Oczekiwano nazwy klasy TypedDict jako pierwszego argumentu",
|
|
24805
|
+
typedDictInClassPattern: "klasa TypedDict nie jest dozwolona we wzorcu klasy",
|
|
24780
24806
|
typedDictInitsubclassParameter: "Element TypedDict nie obs\u0142uguje parametru __init_subclass__ \u201E{name}\u201D",
|
|
24781
24807
|
typedDictNotAllowed: "Nie mo\u017Cna u\u017Cy\u0107 elementu \u201ETypedDict\u201D w tym kontek\u015Bcie",
|
|
24782
24808
|
typedDictSecondArgDict: "Oczekiwano parametru dict lub s\u0142owa kluczowego jako drugiego parametru",
|
|
@@ -25006,7 +25032,7 @@ var require_package_nls_pl = __commonJS({
|
|
|
25006
25032
|
typedDictClosedExtraTypeMismatch: 'Nie mo\u017Cna doda\u0107 elementu "{name}" z typem \u201E{type}\u201D',
|
|
25007
25033
|
typedDictClosedFieldNotRequired: 'Nie mo\u017Cna doda\u0107 elementu "{name}", poniewa\u017C musi on mie\u0107 warto\u015B\u0107 NotRequired',
|
|
25008
25034
|
typedDictExtraFieldNotAllowed: "Element \u201E{name}\u201D nie jest obecny w typie \u201E{type}\u201D",
|
|
25009
|
-
typedDictExtraFieldTypeMismatch: "Typ \u201E{name}\u201D jest niezgodny z typem \
|
|
25035
|
+
typedDictExtraFieldTypeMismatch: "Typ \u201E{name}\u201D jest niezgodny z typem \u201Eextra_items\u201D w typie \u201E{type}\u201D",
|
|
25010
25036
|
typedDictFieldMissing: "Brak nazwy \u201E{name}\u201D w \u201E{type}\u201D",
|
|
25011
25037
|
typedDictFieldNotReadOnly: "Nazwa \u201E{name}\u201D nie jest tylko do odczytu w \u201E{type}\u201D",
|
|
25012
25038
|
typedDictFieldNotRequired: "Nazwa \u201E{name}\u201D nie jest wymagana w typie \u201E{type}\u201D",
|
|
@@ -25603,6 +25629,7 @@ var require_package_nls_pt_br = __commonJS({
|
|
|
25603
25629
|
typedDictFieldReadOnlyRedefinition: 'O item TypedDict "{name}" n\xE3o pode ser redefinido como ReadOnly',
|
|
25604
25630
|
typedDictFieldRequiredRedefinition: 'O item TypedDict "{name}" n\xE3o pode ser redefinido como Required',
|
|
25605
25631
|
typedDictFirstArg: "Nome da classe TypedDict esperado como primeiro argumento",
|
|
25632
|
+
typedDictInClassPattern: "A classe TypedDict n\xE3o \xE9 permitida no padr\xE3o de classe",
|
|
25606
25633
|
typedDictInitsubclassParameter: 'TypedDict n\xE3o d\xE1 suporte ao par\xE2metro __init_subclass__ "{name}"',
|
|
25607
25634
|
typedDictNotAllowed: '"TypedDict" n\xE3o pode ser usado neste contexto',
|
|
25608
25635
|
typedDictSecondArgDict: "Par\xE2metro dict ou de palavra-chave esperado como segundo par\xE2metro",
|
|
@@ -25832,7 +25859,7 @@ var require_package_nls_pt_br = __commonJS({
|
|
|
25832
25859
|
typedDictClosedExtraTypeMismatch: 'N\xE3o \xE9 poss\xEDvel adicionar o item "{name}" com o tipo "{type}"',
|
|
25833
25860
|
typedDictClosedFieldNotRequired: 'N\xE3o \xE9 poss\xEDvel adicionar o item "{name}" porque ele deve ser NotRequired',
|
|
25834
25861
|
typedDictExtraFieldNotAllowed: '"{name}" n\xE3o est\xE1 presente em "{type}"',
|
|
25835
|
-
typedDictExtraFieldTypeMismatch: 'O tipo de "{name}" \xE9 incompat\xEDvel com o tipo de "
|
|
25862
|
+
typedDictExtraFieldTypeMismatch: 'O tipo de "{name}" \xE9 incompat\xEDvel com o tipo de "extra_items" em "{type}"',
|
|
25836
25863
|
typedDictFieldMissing: '"{name}" est\xE1 ausente de "{type}"',
|
|
25837
25864
|
typedDictFieldNotReadOnly: '"{name}" n\xE3o \xE9 somente leitura em "{type}"',
|
|
25838
25865
|
typedDictFieldNotRequired: '"{name}" n\xE3o \xE9 obrigat\xF3rio em "{type}"',
|
|
@@ -26429,6 +26456,7 @@ var require_package_nls_qps_ploc = __commonJS({
|
|
|
26429
26456
|
typedDictFieldReadOnlyRedefinition: '[8IFAz][\u0E19\u0E31\u0E49TypedDict \xEFt\xEBm "{\xF1\xE6m\xEB}" \xE7\xE6\xF1\xF1\xF8t \xFE\xEB r\xEB\xF0\xEBf\xEF\xF1\xEB\xF0 \xE6s ReadOnly\u1EA4\u011F\u502A\u0130\u0402\u04B0\u0915\u094D\u0930\u094D\u0924\u093F\u0943\u307E\u1EA4\u011F\u502A\u0130\u0402\u04B0\u0915\u094D\u0E19\u0E31\u0E49\u0922\u0942\u0901]',
|
|
26430
26457
|
typedDictFieldRequiredRedefinition: '[lpw97][\u0E19\u0E31\u0E49TypedDict \xEFt\xEBm "{\xF1\xE6m\xEB}" \xE7\xE6\xF1\xF1\xF8t \xFE\xEB r\xEB\xF0\xEBf\xEF\xF1\xEB\xF0 \xE6s Required\u1EA4\u011F\u502A\u0130\u0402\u04B0\u0915\u094D\u0930\u094D\u0924\u093F\u0943\u307E\u1EA4\u011F\u502A\u0130\u0402\u04B0\u0915\u094D\u0E19\u0E31\u0E49\u0922\u0942\u0901]',
|
|
26431
26458
|
typedDictFirstArg: "[OPlNk][\u0E19\u0E31\u0E49\xCBxp\xEB\xE7t\xEB\xF0 TypedDict \xE7l\xE6ss \xF1\xE6m\xEB \xE6s f\xEFrst \xE6rg\xB5m\xEB\xF1t\u1EA4\u011F\u502A\u0130\u0402\u04B0\u0915\u094D\u0930\u094D\u0924\u093F\u0943\u307E\u1EA4\u011F\u502A\u0130\u0402\u0E19\u0E31\u0E49\u0922\u0942\u0901]",
|
|
26459
|
+
typedDictInClassPattern: "[IqJCA][\u0E19\u0E31\u0E49TypedDict \xE7l\xE6ss \xF1\xF8t \xE6ll\xF8w\xEB\xF0 \xEF\xF1 \xE7l\xE6ss p\xE6tt\xEBr\xF1\u1EA4\u011F\u502A\u0130\u0402\u04B0\u0915\u094D\u0930\u094D\u0924\u093F\u0943\u307E\u1EA4\u011F\u502A\u0130\u0E19\u0E31\u0E49\u0922\u0942\u0901]",
|
|
26432
26460
|
typedDictInitsubclassParameter: '[HMpfK][\u0E19\u0E31\u0E49TypedDict \xF0\xF8\xEBs \xF1\xF8t s\xB5pp\xF8rt __init_subclass__ p\xE6r\xE6m\xEBt\xEBr "{\xF1\xE6m\xEB}"\u1EA4\u011F\u502A\u0130\u0402\u04B0\u0915\u094D\u0930\u094D\u0924\u093F\u0943\u307E\u1EA4\u011F\u502A\u0130\u0402\u04B0\u0915\u094D\u0930\u094D\u0924\u093F\u0943\u0E19\u0E31\u0E49\u0922\u0942\u0901]',
|
|
26433
26461
|
typedDictNotAllowed: '[UWg4F][\u0E19\u0E31\u0E49"TypedDict" \xE7\xE6\xF1\xF1\xF8t \xFE\xEB \xB5s\xEB\xF0 \xEF\xF1 th\xEFs \xE7\xF8\xF1t\xEBxt\u1EA4\u011F\u502A\u0130\u0402\u04B0\u0915\u094D\u0930\u094D\u0924\u093F\u0943\u307E\u1EA4\u011F\u502A\u0E19\u0E31\u0E49\u0922\u0942\u0901]',
|
|
26434
26462
|
typedDictSecondArgDict: "[mwrv7][\u0E19\u0E31\u0E49\xCBxp\xEB\xE7t\xEB\xF0 dict \xF8r k\xEB\xFFw\xF8r\xF0 p\xE6r\xE6m\xEBt\xEBr \xE6s s\xEB\xE7\xF8\xF1\xF0 p\xE6r\xE6m\xEBt\xEBr\u1EA4\u011F\u502A\u0130\u0402\u04B0\u0915\u094D\u0930\u094D\u0924\u093F\u0943\u307E\u1EA4\u011F\u502A\u0130\u0402\u04B0\u0915\u094D\u0E19\u0E31\u0E49\u0922\u0942\u0901]",
|
|
@@ -26658,7 +26686,7 @@ var require_package_nls_qps_ploc = __commonJS({
|
|
|
26658
26686
|
typedDictClosedExtraTypeMismatch: '[blC1e][\u0E19\u0E31\u0E49\xC7\xE6\xF1\xF1\xF8t \xE6\xF0\xF0 \xEFt\xEBm "{\xF1\xE6m\xEB}" w\xEFth t\xFFp\xEB "{t\xFFp\xEB}"\u1EA4\u011F\u502A\u0130\u0402\u04B0\u0915\u094D\u0930\u094D\u0924\u093F\u0943\u307E\u1EA4\u011F\u502A\u0E19\u0E31\u0E49\u0922\u0942\u0901]',
|
|
26659
26687
|
typedDictClosedFieldNotRequired: '[6rtDR][\u0E19\u0E31\u0E49\xC7\xE6\xF1\xF1\xF8t \xE6\xF0\xF0 \xEFt\xEBm "{\xF1\xE6m\xEB}" \xFE\xEB\xE7\xE6\xB5s\xEB \xEFt m\xB5st \xFE\xEB NotRequired\u1EA4\u011F\u502A\u0130\u0402\u04B0\u0915\u094D\u0930\u094D\u0924\u093F\u0943\u307E\u1EA4\u011F\u502A\u0130\u0402\u04B0\u0915\u094D\u0E19\u0E31\u0E49\u0922\u0942\u0901]',
|
|
26660
26688
|
typedDictExtraFieldNotAllowed: '[kFDh9][\u0E19\u0E31\u0E49"{\xF1\xE6m\xEB}" \xEFs \xF1\xF8t pr\xEBs\xEB\xF1t \xEF\xF1 "{t\xFFp\xEB}"\u1EA4\u011F\u502A\u0130\u0402\u04B0\u0915\u094D\u0930\u094D\u0924\u093F\u0943\u307E\u0E19\u0E31\u0E49\u0922\u0942\u0901]',
|
|
26661
|
-
typedDictExtraFieldTypeMismatch: '[DnAhM][\u0E19\u0E31\u0E49T\xFFp\xEB \xF8f "{\xF1\xE6m\xEB}" \xEFs \xEF\xF1\xE7\xF8mp\xE6t\xEF\xFEl\xEB w\xEFth t\xFFp\xEB \xF8f "
|
|
26689
|
+
typedDictExtraFieldTypeMismatch: '[DnAhM][\u0E19\u0E31\u0E49T\xFFp\xEB \xF8f "{\xF1\xE6m\xEB}" \xEFs \xEF\xF1\xE7\xF8mp\xE6t\xEF\xFEl\xEB w\xEFth t\xFFp\xEB \xF8f "extra_items" \xEF\xF1 "{t\xFFp\xEB}"\u1EA4\u011F\u502A\u0130\u0402\u04B0\u0915\u094D\u0930\u094D\u0924\u093F\u0943\u307E\u1EA4\u011F\u502A\u0130\u0402\u04B0\u0915\u094D\u0930\u094D\u0924\u093F\u0943\u307E\u1EA4\u011F\u0E19\u0E31\u0E49\u0922\u0942\u0901]',
|
|
26662
26690
|
typedDictFieldMissing: '[rNzn7][\u0E19\u0E31\u0E49"{\xF1\xE6m\xEB}" \xEFs m\xEFss\xEF\xF1g fr\xF8m "{t\xFFp\xEB}"\u1EA4\u011F\u502A\u0130\u0402\u04B0\u0915\u094D\u0930\u094D\u0924\u093F\u0943\u0E19\u0E31\u0E49\u0922\u0942\u0901]',
|
|
26663
26691
|
typedDictFieldNotReadOnly: '[BJy1V][\u0E19\u0E31\u0E49"{\xF1\xE6m\xEB}" \xEFs \xF1\xF8t r\xEB\xE6\xF0-\xF8\xF1l\xFF \xEF\xF1 "{t\xFFp\xEB}"\u1EA4\u011F\u502A\u0130\u0402\u04B0\u0915\u094D\u0930\u094D\u0924\u093F\u0943\u307E\u1EA4\u0E19\u0E31\u0E49\u0922\u0942\u0901]',
|
|
26664
26692
|
typedDictFieldNotRequired: '[eqatW][\u0E19\u0E31\u0E49"{\xF1\xE6m\xEB}" \xEFs \xF1\xF8t r\xEBq\xB5\xEFr\xEB\xF0 \xEF\xF1 "{t\xFFp\xEB}"\u1EA4\u011F\u502A\u0130\u0402\u04B0\u0915\u094D\u0930\u094D\u0924\u093F\u0943\u307E\u0E19\u0E31\u0E49\u0922\u0942\u0901]',
|
|
@@ -27255,6 +27283,7 @@ var require_package_nls_ru = __commonJS({
|
|
|
27255
27283
|
typedDictFieldReadOnlyRedefinition: '\u042D\u043B\u0435\u043C\u0435\u043D\u0442 TypedDict "{name}" \u043D\u0435\u043B\u044C\u0437\u044F \u043F\u0435\u0440\u0435\u043E\u043F\u0440\u0435\u0434\u0435\u043B\u0438\u0442\u044C \u043A\u0430\u043A \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u044B\u0439 ReadOnly',
|
|
27256
27284
|
typedDictFieldRequiredRedefinition: '\u042D\u043B\u0435\u043C\u0435\u043D\u0442 TypedDict "{name}" \u043D\u0435\u043B\u044C\u0437\u044F \u043F\u0435\u0440\u0435\u043E\u043F\u0440\u0435\u0434\u0435\u043B\u0438\u0442\u044C \u043A\u0430\u043A Required',
|
|
27257
27285
|
typedDictFirstArg: "\u0412 \u043A\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043F\u0435\u0440\u0432\u043E\u0433\u043E \u0430\u0440\u0433\u0443\u043C\u0435\u043D\u0442\u0430 \u043E\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044F \u0438\u043C\u044F \u043A\u043B\u0430\u0441\u0441\u0430 TypedDict",
|
|
27286
|
+
typedDictInClassPattern: "\u041A\u043B\u0430\u0441\u0441 TypedDict \u043D\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043D \u0432 \u0448\u0430\u0431\u043B\u043E\u043D\u0435 \u043A\u043B\u0430\u0441\u0441\u0430",
|
|
27258
27287
|
typedDictInitsubclassParameter: 'TypedDict \u043D\u0435 \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440 __init_subclass__ "{name}"',
|
|
27259
27288
|
typedDictNotAllowed: '\u041D\u0435\u0432\u043E\u0437\u043C\u043E\u0436\u043D\u043E \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C "TypedDict" \u0432 \u044D\u0442\u043E\u043C \u043A\u043E\u043D\u0442\u0435\u043A\u0441\u0442\u0435',
|
|
27260
27289
|
typedDictSecondArgDict: "\u0412 \u043A\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u0442\u043E\u0440\u043E\u0433\u043E \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u0430 \u043E\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044F dict \u0438\u043B\u0438 \u043A\u043B\u044E\u0447\u0435\u0432\u043E\u0435 \u0441\u043B\u043E\u0432\u043E",
|
|
@@ -27484,7 +27513,7 @@ var require_package_nls_ru = __commonJS({
|
|
|
27484
27513
|
typedDictClosedExtraTypeMismatch: '\u041D\u0435 \u0443\u0434\u0430\u0435\u0442\u0441\u044F \u0434\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u044D\u043B\u0435\u043C\u0435\u043D\u0442 "{name}" \u0442\u0438\u043F\u0430 "{type}"',
|
|
27485
27514
|
typedDictClosedFieldNotRequired: '\u041D\u0435 \u0443\u0434\u0430\u0435\u0442\u0441\u044F \u0434\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u044D\u043B\u0435\u043C\u0435\u043D\u0442 "{name}", \u0442\u0430\u043A \u043A\u0430\u043A \u043E\u043D \u0434\u043E\u043B\u0436\u0435\u043D \u0431\u044B\u0442\u044C \u043F\u043E\u043C\u0435\u0447\u0435\u043D \u043A\u0430\u043A NotRequired',
|
|
27486
27515
|
typedDictExtraFieldNotAllowed: '\u042D\u043B\u0435\u043C\u0435\u043D\u0442 "{name}" \u043E\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0432 \u0442\u0438\u043F\u0435 "{type}"',
|
|
27487
|
-
typedDictExtraFieldTypeMismatch: '\u0422\u0438\u043F \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430 "{name}" \u043D\u0435\u0441\u043E\u0432\u043C\u0435\u0441\u0442\u0438\u043C \u0441 \u0442\u0438\u043F\u043E\u043C "
|
|
27516
|
+
typedDictExtraFieldTypeMismatch: '\u0422\u0438\u043F \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430 "{name}" \u043D\u0435\u0441\u043E\u0432\u043C\u0435\u0441\u0442\u0438\u043C \u0441 \u0442\u0438\u043F\u043E\u043C "extra_items" \u0432 "{type}"',
|
|
27488
27517
|
typedDictFieldMissing: '"{name}" \u043E\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0432 "{type}"',
|
|
27489
27518
|
typedDictFieldNotReadOnly: '"{name}" \u043D\u0435 \u044F\u0432\u043B\u044F\u0435\u0442\u0441\u044F \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u043C "{type}" \u0442\u043E\u043B\u044C\u043A\u043E \u0434\u043B\u044F \u0447\u0442\u0435\u043D\u0438\u044F',
|
|
27490
27519
|
typedDictFieldNotRequired: '"{name}" \u043D\u0435 \u044F\u0432\u043B\u044F\u0435\u0442\u0441\u044F \u043E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u044B\u043C \u0432 "{type}"',
|
|
@@ -28081,6 +28110,7 @@ var require_package_nls_tr = __commonJS({
|
|
|
28081
28110
|
typedDictFieldReadOnlyRedefinition: '"{name}" TypedDict \xF6\u011Fesi ReadOnly olarak yeniden tan\u0131mlanamaz',
|
|
28082
28111
|
typedDictFieldRequiredRedefinition: '"{name}" TypedDict \xF6\u011Fesi Required olarak yeniden tan\u0131mlanamaz',
|
|
28083
28112
|
typedDictFirstArg: "Birinci ba\u011F\u0131ms\u0131z de\u011Fi\u015Fken olarak TypedDict s\u0131n\u0131f ad\u0131 bekleniyordu",
|
|
28113
|
+
typedDictInClassPattern: "TypedDict s\u0131n\u0131f\u0131na s\u0131n\u0131f deseninde izin verilmez",
|
|
28084
28114
|
typedDictInitsubclassParameter: 'TypedDict, "{name}" __init_subclass__ parametresini desteklemez',
|
|
28085
28115
|
typedDictNotAllowed: '"TypedDict" bu ba\u011Flamda kullan\u0131lamaz',
|
|
28086
28116
|
typedDictSecondArgDict: "Expected dict or keyword parameter as second parameter",
|
|
@@ -28310,7 +28340,7 @@ var require_package_nls_tr = __commonJS({
|
|
|
28310
28340
|
typedDictClosedExtraTypeMismatch: '"{type}" t\xFCr\xFCndeki "{name}" \xF6\u011Fesi eklenemiyor',
|
|
28311
28341
|
typedDictClosedFieldNotRequired: 'NotRequired olmas\u0131 gerekti\u011Finden "{name}" \xF6\u011Fesi eklenemiyor',
|
|
28312
28342
|
typedDictExtraFieldNotAllowed: '"{name}" \xF6\u011Fesi "{type}" t\xFCr\xFCnde mevcut de\u011Fil',
|
|
28313
|
-
typedDictExtraFieldTypeMismatch: '"{name}" t\xFCr\xFC, "{type}" alt\u0131ndaki "
|
|
28343
|
+
typedDictExtraFieldTypeMismatch: '"{name}" t\xFCr\xFC, "{type}" alt\u0131ndaki "extra_items" t\xFCr\xFCyle uyumlu de\u011Fil',
|
|
28314
28344
|
typedDictFieldMissing: '"{type}" i\xE7in "{name}" eksik',
|
|
28315
28345
|
typedDictFieldNotReadOnly: '"{name}", "{type}" i\xE7inde salt okunur de\u011Fil',
|
|
28316
28346
|
typedDictFieldNotRequired: '"{type}" i\xE7inde "{name}" gerekli de\u011Fil',
|
|
@@ -28382,7 +28412,7 @@ var require_package_nls_zh_cn = __commonJS({
|
|
|
28382
28412
|
assertAlwaysTrue: "\u65AD\u8A00\u8868\u8FBE\u5F0F\u7684\u8BA1\u7B97\u7ED3\u679C\u59CB\u7EC8\u4E3A true",
|
|
28383
28413
|
assertTypeArgs: "\u201Cassert_type\u201D\u9700\u8981\u4E24\u4E2A\u4F4D\u7F6E\u53C2\u6570",
|
|
28384
28414
|
assertTypeTypeMismatch: "\u201Cassert_type\u201D\u4E0D\u5339\u914D:\u5E94\u4E3A\u201C{expected}\u201D\uFF0C\u4F46\u6536\u5230\u201C{received}\u201D",
|
|
28385
|
-
assignmentExprComprehension: "\u8D4B\u503C\u8868\u8FBE\u5F0F\u76EE\u6807\u201C{name}\u201D\u4E0D\u80FD\u4F7F\u7528\u4E0E\u76EE\u6807\
|
|
28415
|
+
assignmentExprComprehension: "\u8D4B\u503C\u8868\u8FBE\u5F0F\u76EE\u6807\u201C{name}\u201D\u4E0D\u80FD\u4F7F\u7528\u4E0E\u76EE\u6807\u63A8\u5BFC\u5F0F\u76F8\u540C\u7684\u540D\u79F0",
|
|
28386
28416
|
assignmentExprContext: "\u8D4B\u503C\u8868\u8FBE\u5F0F\u5FC5\u987B\u5728\u6A21\u5757\u3001\u51FD\u6570\u6216 lambda \u4E2D",
|
|
28387
28417
|
assignmentExprInSubscript: "\u4EC5\u5728 Python 3.10 \u548C\u66F4\u9AD8\u7248\u672C\u4E2D\u652F\u6301\u4E0B\u6807\u4E2D\u7684\u8D4B\u503C\u8868\u8FBE\u5F0F",
|
|
28388
28418
|
assignmentInProtocol: "Protocol \u7C7B\u4E2D\u7684\u5B9E\u4F8B\u6216\u7C7B\u53D8\u91CF\u5FC5\u987B\u5728\u7C7B\u4E3B\u4F53\u5185\u663E\u5F0F\u58F0\u660E",
|
|
@@ -28428,7 +28458,7 @@ var require_package_nls_zh_cn = __commonJS({
|
|
|
28428
28458
|
collectionAliasInstantiation: "\u65E0\u6CD5\u5B9E\u4F8B\u5316\u7C7B\u578B\u201C{type}\u201D\uFF0C\u8BF7\u6539\u7528\u201C{alias}\u201D",
|
|
28429
28459
|
comparisonAlwaysFalse: "\u6761\u4EF6\u7684\u8BA1\u7B97\u7ED3\u679C\u59CB\u7EC8\u4E3A False\uFF0C\u56E0\u4E3A\u7C7B\u578B\u201C{leftType}\u201D\u548C\u201C{rightType}\u201D\u6CA1\u6709\u91CD\u53E0",
|
|
28430
28460
|
comparisonAlwaysTrue: "\u6761\u4EF6\u7684\u8BA1\u7B97\u7ED3\u679C\u59CB\u7EC8\u4E3A True\uFF0C\u56E0\u4E3A\u7C7B\u578B\u201C{leftType}\u201D\u548C\u201C{rightType}\u201D\u6CA1\u6709\u91CD\u53E0",
|
|
28431
|
-
comprehensionInDict: "\
|
|
28461
|
+
comprehensionInDict: "\u63A8\u5BFC\u5F0F\u4E0D\u80FD\u4E0E\u5176\u4ED6\u5B57\u5178\u6761\u76EE\u4E00\u8D77\u4F7F\u7528",
|
|
28432
28462
|
comprehensionInSet: "\u63A8\u5BFC\u5F0F\u4E0D\u80FD\u4E0E\u5176\u4ED6 set \u6761\u76EE\u4E00\u8D77\u4F7F\u7528",
|
|
28433
28463
|
concatenateContext: "\u6B64\u4E0A\u4E0B\u6587\u4E2D\u4E0D\u5141\u8BB8\u4F7F\u7528\u201CConcatenate\u201D",
|
|
28434
28464
|
concatenateParamSpecMissing: '\u201CConcatenate\u201D\u7684\u6700\u540E\u4E00\u4E2A\u7C7B\u578B\u53C2\u6570\u5FC5\u987B\u662F ParamSpec \u6216 "..."',
|
|
@@ -28473,7 +28503,7 @@ var require_package_nls_zh_cn = __commonJS({
|
|
|
28473
28503
|
deprecatedPropertyGetter: '\u5DF2\u5F03\u7528 property "{name}" \u7684 getter',
|
|
28474
28504
|
deprecatedPropertySetter: '\u5DF2\u5F03\u7528 property "{name}" \u7684 setter',
|
|
28475
28505
|
deprecatedType: "\u81EA Python {version} \u8D77\uFF0C\u6B64\u7C7B\u578B\u5DF2\u5F03\u7528\uFF1B\u8BF7\u6539\u7528\u201C{replacement}\u201D",
|
|
28476
|
-
dictExpandIllegalInComprehension: "\
|
|
28506
|
+
dictExpandIllegalInComprehension: "\u63A8\u5BFC\u5F0F\u4E2D\u4E0D\u5141\u8BB8\u4F7F\u7528\u5B57\u5178\u6269\u5C55",
|
|
28477
28507
|
dictInAnnotation: "\u7C7B\u578B\u8868\u8FBE\u5F0F\u4E2D\u4E0D\u5141\u8BB8\u4F7F\u7528\u5B57\u5178\u8868\u8FBE\u5F0F",
|
|
28478
28508
|
dictKeyValuePairs: "\u5B57\u5178\u6761\u76EE\u5FC5\u987B\u5305\u542B\u952E/\u503C\u5BF9",
|
|
28479
28509
|
dictUnpackIsNotMapping: "\u5B57\u5178\u89E3\u5305\u8FD0\u7B97\u7B26\u7684\u9884\u671F\u6620\u5C04",
|
|
@@ -28907,6 +28937,7 @@ var require_package_nls_zh_cn = __commonJS({
|
|
|
28907
28937
|
typedDictFieldReadOnlyRedefinition: "\u65E0\u6CD5\u5C06 TypedDict \u9879\u201C{name}\u201D\u91CD\u65B0\u5B9A\u4E49\u4E3A ReadOnly",
|
|
28908
28938
|
typedDictFieldRequiredRedefinition: "\u65E0\u6CD5\u5C06 TypedDict \u9879\u201C{name}\u201D\u91CD\u65B0\u5B9A\u4E49\u4E3A Required",
|
|
28909
28939
|
typedDictFirstArg: "\u5E94\u5C06 TypedDict \u7C7B\u540D\u4F5C\u4E3A\u7B2C\u4E00\u4E2A\u53C2\u6570",
|
|
28940
|
+
typedDictInClassPattern: "\u7C7B\u6A21\u5F0F\u4E2D\u4E0D\u5141\u8BB8\u4F7F\u7528 TypedDict \u7C7B",
|
|
28910
28941
|
typedDictInitsubclassParameter: "TypedDict \u4E0D\u652F\u6301 __init_subclass__ parameter\u201C{name}\u201D",
|
|
28911
28942
|
typedDictNotAllowed: '"TypedDict" \u4E0D\u80FD\u7528\u4E8E\u6B64\u4E0A\u4E0B\u6587',
|
|
28912
28943
|
typedDictSecondArgDict: "\u9884\u671F\u7684 dict \u6216\u5173\u952E\u5B57\u53C2\u6570\u4F5C\u4E3A\u7B2C\u4E8C\u4E2A\u53C2\u6570",
|
|
@@ -28943,7 +28974,7 @@ var require_package_nls_zh_cn = __commonJS({
|
|
|
28943
28974
|
unpackArgCount: '"Unpack"\u540E\u5E94\u4E3A\u5355\u4E2A\u7C7B\u578B\u53C2\u6570',
|
|
28944
28975
|
unpackExpectedTypeVarTuple: "Unpack \u9884\u671F\u63A5\u6536 TypeVarTuple \u6216 tuple \u4F5C\u4E3A\u7C7B\u578B\u53C2\u6570",
|
|
28945
28976
|
unpackExpectedTypedDict: "Unpack \u9884\u671F\u63A5\u6536 TypedDict \u7C7B\u578B\u53C2\u6570",
|
|
28946
|
-
unpackIllegalInComprehension: "\u5728\
|
|
28977
|
+
unpackIllegalInComprehension: "\u5728\u63A8\u5BFC\u5F0F\u4E2D\u4E0D\u5141\u8BB8\u4F7F\u7528\u89E3\u5305\u64CD\u4F5C",
|
|
28947
28978
|
unpackInAnnotation: "\u7C7B\u578B\u8868\u8FBE\u5F0F\u4E2D\u4E0D\u5141\u8BB8\u4F7F\u7528\u89E3\u5305\u8FD0\u7B97\u7B26",
|
|
28948
28979
|
unpackInDict: "\u5B57\u5178\u4E2D\u4E0D\u5141\u8BB8\u89E3\u538B\u7F29\u64CD\u4F5C",
|
|
28949
28980
|
unpackInSet: "set \u5185\u4E0D\u5141\u8BB8\u4F7F\u7528\u89E3\u5305\u8FD0\u7B97\u7B26",
|
|
@@ -28978,7 +29009,7 @@ var require_package_nls_zh_cn = __commonJS({
|
|
|
28978
29009
|
yieldFromIllegal: "\u4F7F\u7528\u201Cyield from\u201D\u9700\u8981 Python 3.3 \u6216\u66F4\u9AD8\u7248\u672C",
|
|
28979
29010
|
yieldFromOutsideAsync: 'async \u51FD\u6570\u4E2D\u4E0D\u5141\u8BB8\u4F7F\u7528 "yield from"',
|
|
28980
29011
|
yieldOutsideFunction: "\u4E0D\u5141\u8BB8\u5728\u51FD\u6570\u6216 lambda \u4E4B\u5916\u4F7F\u7528\u201Cyield\u201D",
|
|
28981
|
-
yieldWithinComprehension: '\
|
|
29012
|
+
yieldWithinComprehension: '\u5141\u8BB8\u5728\u63A8\u5BFC\u5F0F\u4E2D\u4F7F\u7528 "yield"',
|
|
28982
29013
|
zeroCaseStatementsFound: "Match \u8BED\u53E5\u5FC5\u987B\u81F3\u5C11\u5305\u542B\u4E00\u4E2A case \u8BED\u53E5",
|
|
28983
29014
|
zeroLengthTupleNotAllowed: "\u6B64\u4E0A\u4E0B\u6587\u4E2D\u4E0D\u5141\u8BB8\u4F7F\u7528\u96F6\u957F\u5EA6 tuple"
|
|
28984
29015
|
},
|
|
@@ -29136,7 +29167,7 @@ var require_package_nls_zh_cn = __commonJS({
|
|
|
29136
29167
|
typedDictClosedExtraTypeMismatch: "\u65E0\u6CD5\u6DFB\u52A0\u7C7B\u578B\u4E3A\u201C{type}\u201D\u7684\u9879\u201C{name}\u201D",
|
|
29137
29168
|
typedDictClosedFieldNotRequired: "\u65E0\u6CD5\u6DFB\u52A0\u9879\u201C{name}\u201D\uFF0C\u56E0\u4E3A\u5B83\u5FC5\u987B\u662F NotRequired",
|
|
29138
29169
|
typedDictExtraFieldNotAllowed: "\u201C{type}\u201D\u4E2D\u4E0D\u5B58\u5728\u201C{name}\u201D",
|
|
29139
|
-
typedDictExtraFieldTypeMismatch: "\u201C{name}\u201D\u7684\u7C7B\u578B\u4E0E\u201C{type}\u201D\u4E2D\u7684 \
|
|
29170
|
+
typedDictExtraFieldTypeMismatch: "\u201C{name}\u201D\u7684\u7C7B\u578B\u4E0E\u201C{type}\u201D\u4E2D\u7684 \u201Cextra_items\u201D \u7C7B\u578B\u4E0D\u517C\u5BB9",
|
|
29140
29171
|
typedDictFieldMissing: '"{type}"\u4E2D\u7F3A\u5C11"{name}"',
|
|
29141
29172
|
typedDictFieldNotReadOnly: '"{name}"\u5728"{type}"\u4E2D\u4E0D\u662F\u53EA\u8BFB\u7684',
|
|
29142
29173
|
typedDictFieldNotRequired: "\u201C{type}\u201D\u4E2D\u4E0D\u9700\u8981\u201C{name}\u201D",
|
|
@@ -29208,7 +29239,7 @@ var require_package_nls_zh_tw = __commonJS({
|
|
|
29208
29239
|
assertAlwaysTrue: "Assert \u904B\u7B97\u5F0F\u4E00\u5F8B\u6703\u8A55\u4F30\u70BA true",
|
|
29209
29240
|
assertTypeArgs: '"assert_type" \u9700\u8981\u5169\u500B\u4F4D\u7F6E\u5F15\u6578',
|
|
29210
29241
|
assertTypeTypeMismatch: '"assert_type" \u4E0D\u7B26: \u9810\u671F\u70BA "{expected}"\uFF0C\u4F46\u6536\u5230 "{received}"',
|
|
29211
|
-
assignmentExprComprehension: '\u6307\u6D3E\u904B\u7B97\u5F0F\u76EE\u6A19 "{name}" \u4E0D\u80FD\u4F7F\u7528\u8207\u76EE\u6A19
|
|
29242
|
+
assignmentExprComprehension: '\u6307\u6D3E\u904B\u7B97\u5F0F\u76EE\u6A19 "{name}" \u4E0D\u80FD\u4F7F\u7528\u8207\u76EE\u6A19 Comprehension \u76F8\u540C\u7684\u540D\u7A31',
|
|
29212
29243
|
assignmentExprContext: "Assignment \u904B\u7B97\u5F0F\u5FC5\u9808\u5728\u6A21\u7D44\u3001\u51FD\u5F0F\u6216 Lambda \u5167",
|
|
29213
29244
|
assignmentExprInSubscript: "\u4E0B\u6A19\u5167\u7684 Assignment \u904B\u7B97\u5F0F\u50C5\u5728 Python 3.10 \u548C\u66F4\u65B0\u7248\u672C\u4E2D\u652F\u63F4",
|
|
29214
29245
|
assignmentInProtocol: "\u5FC5\u9808\u5728\u985E\u5225\u4E3B\u9AD4\u5167\u660E\u78BA\u5BA3\u544A Protocol \u985E\u5225\u5167\u7684\u57F7\u884C\u500B\u9AD4\u6216\u985E\u5225\u8B8A\u6578",
|
|
@@ -29254,7 +29285,7 @@ var require_package_nls_zh_tw = __commonJS({
|
|
|
29254
29285
|
collectionAliasInstantiation: '\u7121\u6CD5\u5C07\u578B\u5225 "{type}" \u5177\u73FE\u5316\uFF0C\u8ACB\u6539\u7528 "{alias}"',
|
|
29255
29286
|
comparisonAlwaysFalse: '\u689D\u4EF6\u4E00\u5F8B\u6703\u8A55\u4F30\u70BA False\uFF0C\u56E0\u70BA\u985E\u578B "{leftType}" \u548C "{rightType}" \u6C92\u6709\u91CD\u758A',
|
|
29256
29287
|
comparisonAlwaysTrue: '\u689D\u4EF6\u4E00\u5F8B\u6703\u8A55\u4F30\u70BA True\uFF0C\u56E0\u70BA\u985E\u578B "{leftType}" \u548C "{rightType}" \u6C92\u6709\u91CD\u758A',
|
|
29257
|
-
comprehensionInDict: "\
|
|
29288
|
+
comprehensionInDict: "Comprehension \u4E0D\u80FD\u8207\u5176\u4ED6\u5B57\u5178\u9805\u76EE\u642D\u914D\u4F7F\u7528",
|
|
29258
29289
|
comprehensionInSet: "Comprehension \u7121\u6CD5\u8207\u5176\u4ED6 set \u8F38\u5165\u9805\u76EE\u4E00\u8D77\u4F7F\u7528",
|
|
29259
29290
|
concatenateContext: '\u6B64\u5167\u5BB9\u4E2D\u4E0D\u5141\u8A31 "Concatenate"',
|
|
29260
29291
|
concatenateParamSpecMissing: '"Concatenate" \u7684\u6700\u5F8C\u4E00\u500B\u985E\u578B\u5F15\u6578\u5FC5\u9808\u662F ParamSpec \u6216 "..."',
|
|
@@ -29299,7 +29330,7 @@ var require_package_nls_zh_tw = __commonJS({
|
|
|
29299
29330
|
deprecatedPropertyGetter: 'The getter for property "{name}" is deprecated',
|
|
29300
29331
|
deprecatedPropertySetter: 'The setter for property "{name}" is deprecated',
|
|
29301
29332
|
deprecatedType: '\u6B64\u985E\u578B\u5DF2\u96A8\u8457 Python {version} \u53D6\u4EE3; \u8ACB\u6539\u70BA\u4F7F\u7528 "{replacement}"',
|
|
29302
|
-
dictExpandIllegalInComprehension: "\
|
|
29333
|
+
dictExpandIllegalInComprehension: "Comprehension \u4E2D\u4E0D\u5141\u8A31\u5B57\u5178\u64F4\u5145",
|
|
29303
29334
|
dictInAnnotation: "\u985E\u578B\u904B\u7B97\u5F0F\u4E2D\u4E0D\u5141\u8A31\u5B57\u5178\u904B\u7B97\u5F0F",
|
|
29304
29335
|
dictKeyValuePairs: "\u5B57\u5178\u9805\u76EE\u5FC5\u9808\u5305\u542B\u91D1\u9470/\u503C\u7D44",
|
|
29305
29336
|
dictUnpackIsNotMapping: "\u9810\u671F\u70BA\u5B57\u5178\u89E3\u58D3\u7E2E\u904B\u7B97\u5B50\u7684\u5C0D\u61C9",
|
|
@@ -29733,6 +29764,7 @@ var require_package_nls_zh_tw = __commonJS({
|
|
|
29733
29764
|
typedDictFieldReadOnlyRedefinition: 'TypedDict \u9805\u76EE "{name}" \u4E0D\u80FD\u91CD\u65B0\u5B9A\u7FA9\u70BA ReadOnly',
|
|
29734
29765
|
typedDictFieldRequiredRedefinition: 'TypedDict \u9805\u76EE "{name}" \u4E0D\u80FD\u91CD\u65B0\u5B9A\u7FA9\u70BA Required',
|
|
29735
29766
|
typedDictFirstArg: "\u9810\u671F TypedDict \u985E\u5225\u540D\u7A31\u4F5C\u70BA\u7B2C\u4E00\u500B\u5F15\u6578",
|
|
29767
|
+
typedDictInClassPattern: "\u985E\u5225\u6A21\u5F0F\u4E2D\u4E0D\u5141\u8A31 TypedDict \u985E\u5225",
|
|
29736
29768
|
typedDictInitsubclassParameter: 'TypedDict \u4E0D\u652F\u63F4__init_subclass__\u53C3\u6578 "{name}"',
|
|
29737
29769
|
typedDictNotAllowed: '"TypedDict" \u4E0D\u80FD\u7528\u5728\u6B64\u5167\u5BB9\u4E2D',
|
|
29738
29770
|
typedDictSecondArgDict: "\u9810\u671F\u70BA dict \u6216\u95DC\u9375\u5B57\u53C3\u6578\u4F5C\u70BA\u7B2C\u4E8C\u500B\u53C3\u6578",
|
|
@@ -29769,7 +29801,7 @@ var require_package_nls_zh_tw = __commonJS({
|
|
|
29769
29801
|
unpackArgCount: '"Unpack" \u5F8C\u9762\u61C9\u70BA\u55AE\u4E00\u578B\u5225\u5F15\u6578',
|
|
29770
29802
|
unpackExpectedTypeVarTuple: "\u9810\u671F TypeVarTuple \u6216 tuple \u4F5C\u70BA Unpack \u7684\u985E\u578B\u5F15\u6578",
|
|
29771
29803
|
unpackExpectedTypedDict: "\u61C9\u70BA Unpack \u7684 TypedDict \u578B\u5225\u5F15\u6578",
|
|
29772
|
-
unpackIllegalInComprehension: "\
|
|
29804
|
+
unpackIllegalInComprehension: "Comprehension \u4E2D\u4E0D\u5141\u8A31\u89E3\u58D3\u7E2E\u4F5C\u696D",
|
|
29773
29805
|
unpackInAnnotation: "\u985E\u578B\u904B\u7B97\u5F0F\u4E2D\u4E0D\u5141\u8A31\u89E3\u58D3\u7E2E\u904B\u7B97\u5B50",
|
|
29774
29806
|
unpackInDict: "\u5B57\u5178\u4E2D\u4E0D\u5141\u8A31\u89E3\u58D3\u7E2E\u4F5C\u696D",
|
|
29775
29807
|
unpackInSet: "Unpack operator not allowed within a set",
|
|
@@ -29804,7 +29836,7 @@ var require_package_nls_zh_tw = __commonJS({
|
|
|
29804
29836
|
yieldFromIllegal: '\u4F7F\u7528 "yield from" \u9700\u8981 Python 3.3 \u6216\u66F4\u65B0\u7248\u672C',
|
|
29805
29837
|
yieldFromOutsideAsync: '"yield from" not allowed in an async function',
|
|
29806
29838
|
yieldOutsideFunction: '\u5728\u51FD\u5F0F\u6216 lambda \u5916\u90E8\u4E0D\u5141\u8A31 "yield"',
|
|
29807
|
-
yieldWithinComprehension: '\
|
|
29839
|
+
yieldWithinComprehension: 'Comprehension \u5167\u4E0D\u5141\u8A31 "yield"',
|
|
29808
29840
|
zeroCaseStatementsFound: "Match \u9673\u8FF0\u5F0F\u5FC5\u9808\u81F3\u5C11\u5305\u542B\u4E00\u500B case \u9673\u8FF0\u5F0F",
|
|
29809
29841
|
zeroLengthTupleNotAllowed: "\u6B64\u5167\u5BB9\u4E2D\u4E0D\u5141\u8A31\u96F6\u9577\u5EA6 tuple"
|
|
29810
29842
|
},
|
|
@@ -29962,7 +29994,7 @@ var require_package_nls_zh_tw = __commonJS({
|
|
|
29962
29994
|
typedDictClosedExtraTypeMismatch: '\u7121\u6CD5\u65B0\u589E\u578B\u5225\u70BA "{type}" \u7684\u9805\u76EE "{name}"',
|
|
29963
29995
|
typedDictClosedFieldNotRequired: '\u7121\u6CD5\u65B0\u589E\u9805\u76EE "{name}"\uFF0C\u56E0\u70BA\u5B83\u5FC5\u9808\u662F NotRequired',
|
|
29964
29996
|
typedDictExtraFieldNotAllowed: '"{name}" \u4E0D\u5B58\u5728\u65BC "{type}"',
|
|
29965
|
-
typedDictExtraFieldTypeMismatch: '"{name}" \u578B\u5225\u8207 "{type}" \u4E2D\u7684 "
|
|
29997
|
+
typedDictExtraFieldTypeMismatch: '"{name}" \u578B\u5225\u8207 "{type}" \u4E2D\u7684 "extra_items" \u578B\u5225\u4E0D\u76F8\u5BB9',
|
|
29966
29998
|
typedDictFieldMissing: '"{type}" \u907A\u5931 "{name}"',
|
|
29967
29999
|
typedDictFieldNotReadOnly: '"{name}" \u5728 "{type}" \u4E2D\u4E0D\u662F\u552F\u8B80',
|
|
29968
30000
|
typedDictFieldNotRequired: '"{type}" \u4E2D\u4E0D\u9700\u8981 "{name}"',
|
|
@@ -30233,6 +30265,7 @@ var require_localize = __commonJS({
|
|
|
30233
30265
|
Diagnostic4.dataClassConverterFunction = () => new ParameterizedString(getRawString("Diagnostic.dataClassConverterFunction"));
|
|
30234
30266
|
Diagnostic4.dataClassConverterOverloads = () => new ParameterizedString(getRawString("Diagnostic.dataClassConverterOverloads"));
|
|
30235
30267
|
Diagnostic4.dataClassFieldInheritedDefault = () => new ParameterizedString(getRawString("Diagnostic.dataClassFieldInheritedDefault"));
|
|
30268
|
+
Diagnostic4.dataClassFieldInvalidAlias = () => new ParameterizedString(getRawString("Diagnostic.dataClassFieldInvalidAlias"));
|
|
30236
30269
|
Diagnostic4.dataClassFieldWithDefault = () => getRawString("Diagnostic.dataClassFieldWithDefault");
|
|
30237
30270
|
Diagnostic4.dataClassFieldWithoutAnnotation = () => getRawString("Diagnostic.dataClassFieldWithoutAnnotation");
|
|
30238
30271
|
Diagnostic4.dataClassFieldWithPrivateName = () => getRawString("Diagnostic.dataClassFieldWithPrivateName");
|
|
@@ -30639,6 +30672,7 @@ var require_localize = __commonJS({
|
|
|
30639
30672
|
Diagnostic4.typedDictEntryName = () => getRawString("Diagnostic.typedDictEntryName");
|
|
30640
30673
|
Diagnostic4.typedDictEntryUnique = () => getRawString("Diagnostic.typedDictEntryUnique");
|
|
30641
30674
|
Diagnostic4.typedDictExtraArgs = () => getRawString("Diagnostic.typedDictExtraArgs");
|
|
30675
|
+
Diagnostic4.typedDictExtraItemsClosed = () => getRawString("Diagnostic.typedDictExtraItemsClosed");
|
|
30642
30676
|
Diagnostic4.typedDictFieldNotRequiredRedefinition = () => new ParameterizedString(getRawString("Diagnostic.typedDictFieldNotRequiredRedefinition"));
|
|
30643
30677
|
Diagnostic4.typedDictFieldReadOnlyRedefinition = () => new ParameterizedString(getRawString("Diagnostic.typedDictFieldReadOnlyRedefinition"));
|
|
30644
30678
|
Diagnostic4.typedDictFieldRequiredRedefinition = () => new ParameterizedString(getRawString("Diagnostic.typedDictFieldRequiredRedefinition"));
|
|
@@ -41518,6 +41552,14 @@ var require_tokenizer = __commonJS({
|
|
|
41518
41552
|
}
|
|
41519
41553
|
return !_softKeywords.has(name);
|
|
41520
41554
|
}
|
|
41555
|
+
static isPythonIdentifier(value) {
|
|
41556
|
+
for (let i = 0; i < value.length; i++) {
|
|
41557
|
+
if (i === 0 ? !(0, characters_1.isIdentifierStartChar)(value.charCodeAt(i)) : !(0, characters_1.isIdentifierChar)(value.charCodeAt(i))) {
|
|
41558
|
+
return false;
|
|
41559
|
+
}
|
|
41560
|
+
}
|
|
41561
|
+
return true;
|
|
41562
|
+
}
|
|
41521
41563
|
static isOperatorAssignment(operatorType) {
|
|
41522
41564
|
if (operatorType === void 0 || _operatorInfo[operatorType] === void 0) {
|
|
41523
41565
|
return false;
|
|
@@ -43429,7 +43471,6 @@ var require_binder = __commonJS({
|
|
|
43429
43471
|
var AnalyzerNodeInfo = __importStar(require_analyzerNodeInfo());
|
|
43430
43472
|
var codeFlowTypes_1 = require_codeFlowTypes();
|
|
43431
43473
|
var declaration_1 = require_declaration();
|
|
43432
|
-
var docStringUtils_1 = require_docStringUtils();
|
|
43433
43474
|
var ParseTreeUtils = __importStar(require_parseTreeUtils());
|
|
43434
43475
|
var parseTreeWalker_1 = require_parseTreeWalker();
|
|
43435
43476
|
var scope_1 = require_scope();
|
|
@@ -43677,7 +43718,7 @@ var require_binder = __commonJS({
|
|
|
43677
43718
|
const symbol2 = this._bindNameToScope(this._currentScope, paramNode.d.name);
|
|
43678
43719
|
let docString = ParseTreeUtils.getDocString((_b = (_a = node === null || node === void 0 ? void 0 : node.d.suite) === null || _a === void 0 ? void 0 : _a.d.statements) !== null && _b !== void 0 ? _b : []);
|
|
43679
43720
|
if (docString !== void 0) {
|
|
43680
|
-
docString =
|
|
43721
|
+
docString = this._docStringService.extractParameterDocumentation(docString, paramNode.d.name.d.value);
|
|
43681
43722
|
}
|
|
43682
43723
|
if (symbol2) {
|
|
43683
43724
|
const paramDeclaration = {
|
|
@@ -46636,6 +46677,7 @@ var require_types = __commonJS({
|
|
|
46636
46677
|
exports2.isParamSpec = isParamSpec;
|
|
46637
46678
|
exports2.isTypeVarTuple = isTypeVarTuple;
|
|
46638
46679
|
exports2.isUnpackedTypeVarTuple = isUnpackedTypeVarTuple;
|
|
46680
|
+
exports2.isUnpackedTypeVar = isUnpackedTypeVar;
|
|
46639
46681
|
exports2.isUnpackedClass = isUnpackedClass;
|
|
46640
46682
|
exports2.isUnpacked = isUnpacked;
|
|
46641
46683
|
exports2.isFunction = isFunction;
|
|
@@ -46648,6 +46690,7 @@ var require_types = __commonJS({
|
|
|
46648
46690
|
exports2.findSubtype = findSubtype;
|
|
46649
46691
|
exports2.combineTypes = combineTypes;
|
|
46650
46692
|
exports2.isSameWithoutLiteralValue = isSameWithoutLiteralValue;
|
|
46693
|
+
var collectionUtils_1 = require_collectionUtils();
|
|
46651
46694
|
var debug_1 = require_debug();
|
|
46652
46695
|
var TypeCategory;
|
|
46653
46696
|
(function(TypeCategory2) {
|
|
@@ -47104,21 +47147,30 @@ var require_types = __commonJS({
|
|
|
47104
47147
|
return newClassType;
|
|
47105
47148
|
}
|
|
47106
47149
|
ClassType2.cloneRemoveTypePromotions = cloneRemoveTypePromotions;
|
|
47107
|
-
function
|
|
47150
|
+
function cloneForPartial(classType, partialCallType) {
|
|
47108
47151
|
const newClassType = TypeBase.cloneType(classType);
|
|
47109
|
-
newClassType.
|
|
47110
|
-
newClassType.shared.fields = new Map(newClassType.shared.fields);
|
|
47111
|
-
newClassType.shared.mro = Array.from(newClassType.shared.mro);
|
|
47112
|
-
newClassType.shared.mro[0] = cloneAsInstantiable(newClassType);
|
|
47152
|
+
newClassType.priv.partialCallType = partialCallType;
|
|
47113
47153
|
return newClassType;
|
|
47114
47154
|
}
|
|
47115
|
-
ClassType2.
|
|
47116
|
-
function cloneForUnpacked(classType
|
|
47155
|
+
ClassType2.cloneForPartial = cloneForPartial;
|
|
47156
|
+
function cloneForUnpacked(classType) {
|
|
47157
|
+
if (classType.priv.isUnpacked) {
|
|
47158
|
+
return classType;
|
|
47159
|
+
}
|
|
47117
47160
|
const newClassType = TypeBase.cloneType(classType);
|
|
47118
|
-
newClassType.priv.isUnpacked =
|
|
47161
|
+
newClassType.priv.isUnpacked = true;
|
|
47119
47162
|
return newClassType;
|
|
47120
47163
|
}
|
|
47121
47164
|
ClassType2.cloneForUnpacked = cloneForUnpacked;
|
|
47165
|
+
function cloneForPacked(classType) {
|
|
47166
|
+
if (!classType.priv.isUnpacked) {
|
|
47167
|
+
return classType;
|
|
47168
|
+
}
|
|
47169
|
+
const newClassType = TypeBase.cloneType(classType);
|
|
47170
|
+
newClassType.priv.isUnpacked = false;
|
|
47171
|
+
return newClassType;
|
|
47172
|
+
}
|
|
47173
|
+
ClassType2.cloneForPacked = cloneForPacked;
|
|
47122
47174
|
function cloneWithNewFlags(classType, newFlags) {
|
|
47123
47175
|
const newClassType = TypeBase.cloneType(classType);
|
|
47124
47176
|
newClassType.shared = { ...newClassType.shared };
|
|
@@ -48359,7 +48411,9 @@ var require_types = __commonJS({
|
|
|
48359
48411
|
function cloneForUnpacked(type, isInUnion = false) {
|
|
48360
48412
|
const newInstance = TypeBase.cloneType(type);
|
|
48361
48413
|
newInstance.priv.isUnpacked = true;
|
|
48362
|
-
newInstance
|
|
48414
|
+
if (isTypeVarTuple(newInstance) && isInUnion) {
|
|
48415
|
+
newInstance.priv.isInUnion = isInUnion;
|
|
48416
|
+
}
|
|
48363
48417
|
if (newInstance.priv.freeTypeVar) {
|
|
48364
48418
|
newInstance.priv.freeTypeVar = TypeVarType2.cloneForUnpacked(newInstance.priv.freeTypeVar, isInUnion);
|
|
48365
48419
|
}
|
|
@@ -48492,8 +48546,8 @@ var require_types = __commonJS({
|
|
|
48492
48546
|
return typeVarType.priv.nameWithScope || typeVarType.shared.name;
|
|
48493
48547
|
}
|
|
48494
48548
|
TypeVarType2.getNameWithScope = getNameWithScope;
|
|
48495
|
-
function getReadableName(type) {
|
|
48496
|
-
if (type.priv.scopeName) {
|
|
48549
|
+
function getReadableName(type, includeScope = true) {
|
|
48550
|
+
if (type.priv.scopeName && includeScope) {
|
|
48497
48551
|
return `${type.shared.name}@${type.priv.scopeName}`;
|
|
48498
48552
|
}
|
|
48499
48553
|
return type.shared.name;
|
|
@@ -48583,6 +48637,9 @@ var require_types = __commonJS({
|
|
|
48583
48637
|
function isUnpackedTypeVarTuple(type) {
|
|
48584
48638
|
return isTypeVarTuple(type) && !!type.priv.isUnpacked && !type.priv.isInUnion;
|
|
48585
48639
|
}
|
|
48640
|
+
function isUnpackedTypeVar(type) {
|
|
48641
|
+
return isTypeVar(type) && !isTypeVarTuple(type) && !!type.priv.isUnpacked;
|
|
48642
|
+
}
|
|
48586
48643
|
function isUnpackedClass(type) {
|
|
48587
48644
|
if (!isClass(type) || !type.priv.isUnpacked) {
|
|
48588
48645
|
return false;
|
|
@@ -48590,7 +48647,7 @@ var require_types = __commonJS({
|
|
|
48590
48647
|
return true;
|
|
48591
48648
|
}
|
|
48592
48649
|
function isUnpacked(type) {
|
|
48593
|
-
return isUnpackedTypeVarTuple(type) || isUnpackedClass(type);
|
|
48650
|
+
return isUnpackedTypeVarTuple(type) || isUnpackedTypeVar(type) || isUnpackedClass(type);
|
|
48594
48651
|
}
|
|
48595
48652
|
function isFunction(type) {
|
|
48596
48653
|
return type.category === 4;
|
|
@@ -48693,6 +48750,11 @@ var require_types = __commonJS({
|
|
|
48693
48750
|
if (!type1.priv.isTypedDictPartial !== !classType2.priv.isTypedDictPartial) {
|
|
48694
48751
|
return false;
|
|
48695
48752
|
}
|
|
48753
|
+
if (options.honorIsTypeArgExplicit) {
|
|
48754
|
+
if (!!type1.priv.isTypeArgExplicit !== !!classType2.priv.isTypeArgExplicit) {
|
|
48755
|
+
return false;
|
|
48756
|
+
}
|
|
48757
|
+
}
|
|
48696
48758
|
if (!options.ignoreTypedDictNarrowEntries && !ClassType.isTypedDictNarrowedEntriesSame(type1, classType2)) {
|
|
48697
48759
|
return false;
|
|
48698
48760
|
}
|
|
@@ -48784,6 +48846,9 @@ var require_types = __commonJS({
|
|
|
48784
48846
|
if (type1.priv.scopeId !== type2TypeVar.priv.scopeId) {
|
|
48785
48847
|
return false;
|
|
48786
48848
|
}
|
|
48849
|
+
if (type1.priv.nameWithScope !== type2TypeVar.priv.nameWithScope) {
|
|
48850
|
+
return false;
|
|
48851
|
+
}
|
|
48787
48852
|
if (type1.shared.recursiveAlias && type2TypeVar.shared.recursiveAlias) {
|
|
48788
48853
|
const type1TypeArgs = ((_f = (_e = type1 === null || type1 === void 0 ? void 0 : type1.props) === null || _e === void 0 ? void 0 : _e.typeAliasInfo) === null || _f === void 0 ? void 0 : _f.typeArgs) || [];
|
|
48789
48854
|
const type2TypeArgs = ((_h = (_g = type2 === null || type2 === void 0 ? void 0 : type2.props) === null || _g === void 0 ? void 0 : _g.typeAliasInfo) === null || _h === void 0 ? void 0 : _h.typeArgs) || [];
|
|
@@ -48887,20 +48952,14 @@ var require_types = __commonJS({
|
|
|
48887
48952
|
return filter2(type) ? type : void 0;
|
|
48888
48953
|
}
|
|
48889
48954
|
function combineTypes(subtypes, options) {
|
|
48890
|
-
var _a;
|
|
48891
|
-
let
|
|
48892
|
-
|
|
48893
|
-
(subtype) => subtype.category === 3
|
|
48894
|
-
/* TypeCategory.Never */
|
|
48895
|
-
))
|
|
48896
|
-
subtypes = subtypes.filter((subtype) => {
|
|
48897
|
-
if (subtype.category === 3 && subtype.priv.isNoReturn) {
|
|
48898
|
-
sawNoReturn = true;
|
|
48899
|
-
}
|
|
48900
|
-
return subtype.category !== 3;
|
|
48901
|
-
});
|
|
48955
|
+
var _a, _b;
|
|
48956
|
+
let neverTypes;
|
|
48957
|
+
[neverTypes, subtypes] = (0, collectionUtils_1.partition)(subtypes, isNever);
|
|
48902
48958
|
if (subtypes.length === 0) {
|
|
48903
|
-
|
|
48959
|
+
if (neverTypes.length > 0) {
|
|
48960
|
+
return (_a = neverTypes.find((t) => t.priv.isNoReturn)) !== null && _a !== void 0 ? _a : neverTypes[0];
|
|
48961
|
+
}
|
|
48962
|
+
return NeverType.createNever();
|
|
48904
48963
|
}
|
|
48905
48964
|
let allSubtypesAreSame = true;
|
|
48906
48965
|
if (subtypes.length > 1) {
|
|
@@ -48923,7 +48982,7 @@ var require_types = __commonJS({
|
|
|
48923
48982
|
expandedTypes = subtypes.slice(0, i);
|
|
48924
48983
|
}
|
|
48925
48984
|
expandedTypes = expandedTypes.concat(subtype.priv.subtypes);
|
|
48926
|
-
if ((
|
|
48985
|
+
if ((_b = subtype.props) === null || _b === void 0 ? void 0 : _b.typeAliasInfo) {
|
|
48927
48986
|
typeAliasSources.add(subtype);
|
|
48928
48987
|
} else if (subtype.priv.typeAliasSources) {
|
|
48929
48988
|
subtype.priv.typeAliasSources.forEach((subtype2) => {
|
|
@@ -49433,6 +49492,8 @@ var require_typeUtils = __commonJS({
|
|
|
49433
49492
|
exports2.combineSameSizedTuples = combineSameSizedTuples;
|
|
49434
49493
|
exports2.combineTupleTypeArgs = combineTupleTypeArgs;
|
|
49435
49494
|
exports2.specializeTupleClass = specializeTupleClass;
|
|
49495
|
+
exports2.makePacked = makePacked;
|
|
49496
|
+
exports2.makeUnpacked = makeUnpacked;
|
|
49436
49497
|
exports2.getGeneratorTypeArgs = getGeneratorTypeArgs;
|
|
49437
49498
|
exports2.requiresTypeArgs = requiresTypeArgs;
|
|
49438
49499
|
exports2.requiresSpecialization = requiresSpecialization;
|
|
@@ -49441,7 +49502,6 @@ var require_typeUtils = __commonJS({
|
|
|
49441
49502
|
exports2.isVarianceOfTypeArgCompatible = isVarianceOfTypeArgCompatible;
|
|
49442
49503
|
exports2.computeMroLinearization = computeMroLinearization;
|
|
49443
49504
|
exports2.getDeclaringModulesForType = getDeclaringModulesForType;
|
|
49444
|
-
exports2.convertNodeToArg = convertNodeToArg;
|
|
49445
49505
|
exports2.convertTypeToParamSpecValue = convertTypeToParamSpecValue;
|
|
49446
49506
|
exports2.simplifyFunctionToParamSpec = simplifyFunctionToParamSpec;
|
|
49447
49507
|
var collectionUtils_1 = require_collectionUtils();
|
|
@@ -49757,6 +49817,16 @@ var require_typeUtils = __commonJS({
|
|
|
49757
49817
|
if (isLiteralType(a)) {
|
|
49758
49818
|
if (!isLiteralType(bClass)) {
|
|
49759
49819
|
return -1;
|
|
49820
|
+
} else if (types_1.ClassType.isSameGenericClass(a, bClass)) {
|
|
49821
|
+
const aLiteralValue = a.priv.literalValue;
|
|
49822
|
+
const bLiteralValue = bClass.priv.literalValue;
|
|
49823
|
+
if (typeof aLiteralValue === "string" && typeof bLiteralValue === "string" || typeof aLiteralValue === "number" && typeof bLiteralValue === "number") {
|
|
49824
|
+
if (aLiteralValue < bLiteralValue) {
|
|
49825
|
+
return -1;
|
|
49826
|
+
} else if (aLiteralValue > bLiteralValue) {
|
|
49827
|
+
return 1;
|
|
49828
|
+
}
|
|
49829
|
+
}
|
|
49760
49830
|
}
|
|
49761
49831
|
} else if (isLiteralType(bClass)) {
|
|
49762
49832
|
return 1;
|
|
@@ -49925,17 +49995,23 @@ var require_typeUtils = __commonJS({
|
|
|
49925
49995
|
}
|
|
49926
49996
|
return void 0;
|
|
49927
49997
|
}
|
|
49928
|
-
function addConditionToType(type, condition,
|
|
49998
|
+
function addConditionToType(type, condition, options) {
|
|
49929
49999
|
var _a, _b;
|
|
49930
50000
|
if (!condition) {
|
|
49931
50001
|
return type;
|
|
49932
50002
|
}
|
|
49933
|
-
if (skipSelfCondition) {
|
|
50003
|
+
if (options === null || options === void 0 ? void 0 : options.skipSelfCondition) {
|
|
49934
50004
|
condition = condition.filter((c) => !types_1.TypeVarType.isSelf(c.typeVar));
|
|
49935
50005
|
if (condition.length === 0) {
|
|
49936
50006
|
return type;
|
|
49937
50007
|
}
|
|
49938
50008
|
}
|
|
50009
|
+
if (options === null || options === void 0 ? void 0 : options.skipBoundTypeVars) {
|
|
50010
|
+
condition = condition.filter((c) => c.typeVar.shared.constraints.length > 0);
|
|
50011
|
+
if (condition.length === 0) {
|
|
50012
|
+
return type;
|
|
50013
|
+
}
|
|
50014
|
+
}
|
|
49939
50015
|
switch (type.category) {
|
|
49940
50016
|
case 0:
|
|
49941
50017
|
case 1:
|
|
@@ -50278,13 +50354,13 @@ var require_typeUtils = __commonJS({
|
|
|
50278
50354
|
}
|
|
50279
50355
|
function isUnboundedTupleClass(type) {
|
|
50280
50356
|
var _a;
|
|
50281
|
-
return (_a = type.priv.tupleTypeArgs) === null || _a === void 0 ? void 0 : _a.some((t) => t.isUnbounded || (0, types_1.isUnpackedTypeVarTuple)(t.type));
|
|
50357
|
+
return (_a = type.priv.tupleTypeArgs) === null || _a === void 0 ? void 0 : _a.some((t) => t.isUnbounded || (0, types_1.isUnpackedTypeVarTuple)(t.type) || (0, types_1.isUnpackedTypeVar)(t.type));
|
|
50282
50358
|
}
|
|
50283
50359
|
function isTupleIndexUnambiguous(type, index) {
|
|
50284
50360
|
if (!type.priv.tupleTypeArgs) {
|
|
50285
50361
|
return false;
|
|
50286
50362
|
}
|
|
50287
|
-
const unboundedIndex = type.priv.tupleTypeArgs.findIndex((t) => t.isUnbounded || (0, types_1.isUnpackedTypeVarTuple)(t.type));
|
|
50363
|
+
const unboundedIndex = type.priv.tupleTypeArgs.findIndex((t) => t.isUnbounded || (0, types_1.isUnpackedTypeVarTuple)(t.type) || (0, types_1.isUnpackedTypeVar)(t.type));
|
|
50288
50364
|
if (index < 0) {
|
|
50289
50365
|
const lowerIndexLimit = unboundedIndex < 0 ? 0 : unboundedIndex;
|
|
50290
50366
|
index += type.priv.tupleTypeArgs.length;
|
|
@@ -50384,7 +50460,7 @@ var require_typeUtils = __commonJS({
|
|
|
50384
50460
|
}
|
|
50385
50461
|
}
|
|
50386
50462
|
function transformExpectedType(expectedType, liveTypeVarScopes, usageOffset) {
|
|
50387
|
-
const transformer = new
|
|
50463
|
+
const transformer = new UnificationTypeTransformer(liveTypeVarScopes, usageOffset);
|
|
50388
50464
|
return transformer.apply(expectedType, 0);
|
|
50389
50465
|
}
|
|
50390
50466
|
function getProtocolSymbols(classType) {
|
|
@@ -50547,7 +50623,7 @@ var require_typeUtils = __commonJS({
|
|
|
50547
50623
|
}
|
|
50548
50624
|
}
|
|
50549
50625
|
if ((flags & 32) === 0) {
|
|
50550
|
-
|
|
50626
|
+
let symbol = memberFields.get(memberName);
|
|
50551
50627
|
if (symbol && symbol.isClassMember()) {
|
|
50552
50628
|
const hasDeclaredType = symbol.hasTypedDeclarations();
|
|
50553
50629
|
if (!declaredTypesOnly || hasDeclaredType) {
|
|
@@ -50562,6 +50638,9 @@ var require_typeUtils = __commonJS({
|
|
|
50562
50638
|
isClassMember = isDataclass;
|
|
50563
50639
|
}
|
|
50564
50640
|
}
|
|
50641
|
+
if (memberName === "__call__" && classType.priv.partialCallType && types_1.ClassType.isSameGenericClass(classType, specializedMroClass)) {
|
|
50642
|
+
symbol = symbol_1.Symbol.createWithType(4, classType.priv.partialCallType);
|
|
50643
|
+
}
|
|
50565
50644
|
const cm = {
|
|
50566
50645
|
symbol,
|
|
50567
50646
|
isInstanceMember,
|
|
@@ -51200,16 +51279,27 @@ var require_typeUtils = __commonJS({
|
|
|
51200
51279
|
})));
|
|
51201
51280
|
}
|
|
51202
51281
|
function combineTupleTypeArgs(typeArgs) {
|
|
51203
|
-
|
|
51204
|
-
|
|
51205
|
-
|
|
51206
|
-
|
|
51207
|
-
|
|
51208
|
-
|
|
51209
|
-
|
|
51282
|
+
const typesToCombine = [];
|
|
51283
|
+
typeArgs.forEach((t) => {
|
|
51284
|
+
if ((0, types_1.isTypeVar)(t.type)) {
|
|
51285
|
+
if ((0, types_1.isUnpackedTypeVarTuple)(t.type)) {
|
|
51286
|
+
typesToCombine.push(types_1.TypeVarType.cloneForUnpacked(
|
|
51287
|
+
t.type,
|
|
51288
|
+
/* isInUnion */
|
|
51289
|
+
true
|
|
51290
|
+
));
|
|
51291
|
+
return;
|
|
51292
|
+
}
|
|
51293
|
+
if ((0, types_1.isUnpackedTypeVar)(t.type)) {
|
|
51294
|
+
if (t.type.shared.boundType && (0, types_1.isClassInstance)(t.type.shared.boundType) && isTupleClass(t.type.shared.boundType) && t.type.shared.boundType.priv.tupleTypeArgs) {
|
|
51295
|
+
typesToCombine.push(combineTupleTypeArgs(t.type.shared.boundType.priv.tupleTypeArgs));
|
|
51296
|
+
}
|
|
51297
|
+
return;
|
|
51298
|
+
}
|
|
51210
51299
|
}
|
|
51211
|
-
|
|
51212
|
-
})
|
|
51300
|
+
typesToCombine.push(t.type);
|
|
51301
|
+
});
|
|
51302
|
+
return (0, types_1.combineTypes)(typesToCombine);
|
|
51213
51303
|
}
|
|
51214
51304
|
function specializeTupleClass(classType, typeArgs, isTypeArgExplicit = true, isUnpacked = false) {
|
|
51215
51305
|
const clonedClassType = types_1.ClassType.specialize(
|
|
@@ -51231,6 +51321,30 @@ var require_typeUtils = __commonJS({
|
|
|
51231
51321
|
}
|
|
51232
51322
|
return type;
|
|
51233
51323
|
}
|
|
51324
|
+
function makePacked(type) {
|
|
51325
|
+
if ((0, types_1.isUnpackedClass)(type)) {
|
|
51326
|
+
return types_1.ClassType.cloneForPacked(type);
|
|
51327
|
+
}
|
|
51328
|
+
if ((0, types_1.isUnpackedTypeVarTuple)(type) && !type.priv.isInUnion) {
|
|
51329
|
+
return types_1.TypeVarType.cloneForPacked(type);
|
|
51330
|
+
}
|
|
51331
|
+
if ((0, types_1.isUnpackedTypeVar)(type)) {
|
|
51332
|
+
return types_1.TypeVarType.cloneForPacked(type);
|
|
51333
|
+
}
|
|
51334
|
+
return type;
|
|
51335
|
+
}
|
|
51336
|
+
function makeUnpacked(type) {
|
|
51337
|
+
if ((0, types_1.isClass)(type)) {
|
|
51338
|
+
return types_1.ClassType.cloneForUnpacked(type);
|
|
51339
|
+
}
|
|
51340
|
+
if ((0, types_1.isTypeVarTuple)(type) && !type.priv.isInUnion) {
|
|
51341
|
+
return types_1.TypeVarType.cloneForUnpacked(type);
|
|
51342
|
+
}
|
|
51343
|
+
if ((0, types_1.isTypeVar)(type)) {
|
|
51344
|
+
return types_1.TypeVarType.cloneForUnpacked(type);
|
|
51345
|
+
}
|
|
51346
|
+
return type;
|
|
51347
|
+
}
|
|
51234
51348
|
function getGeneratorTypeArgs(returnType) {
|
|
51235
51349
|
var _a;
|
|
51236
51350
|
if ((0, types_1.isClassInstance)(returnType)) {
|
|
@@ -51304,6 +51418,11 @@ var require_typeUtils = __commonJS({
|
|
|
51304
51418
|
if (!type.priv.isTypeArgExplicit && (options === null || options === void 0 ? void 0 : options.ignoreImplicitTypeArgs)) {
|
|
51305
51419
|
return false;
|
|
51306
51420
|
}
|
|
51421
|
+
if (type.priv.tupleTypeArgs) {
|
|
51422
|
+
if (type.priv.tupleTypeArgs.some((typeArg) => requiresSpecialization(typeArg.type, options, recursionCount))) {
|
|
51423
|
+
return true;
|
|
51424
|
+
}
|
|
51425
|
+
}
|
|
51307
51426
|
if (type.priv.typeArgs) {
|
|
51308
51427
|
return type.priv.typeArgs.some((typeArg) => requiresSpecialization(typeArg, options, recursionCount));
|
|
51309
51428
|
}
|
|
@@ -51516,13 +51635,6 @@ var require_typeUtils = __commonJS({
|
|
|
51516
51635
|
addDeclaringModuleNamesForType(type, moduleList);
|
|
51517
51636
|
return moduleList;
|
|
51518
51637
|
}
|
|
51519
|
-
function convertNodeToArg(node) {
|
|
51520
|
-
return {
|
|
51521
|
-
argCategory: node.d.argCategory,
|
|
51522
|
-
name: node.d.name,
|
|
51523
|
-
valueExpression: node.d.valueExpr
|
|
51524
|
-
};
|
|
51525
|
-
}
|
|
51526
51638
|
function addDeclaringModuleNamesForType(type, moduleList, recursionCount = 0) {
|
|
51527
51639
|
if (recursionCount > types_1.maxTypeRecursionCount) {
|
|
51528
51640
|
return;
|
|
@@ -51798,6 +51910,8 @@ var require_typeUtils = __commonJS({
|
|
|
51798
51910
|
}
|
|
51799
51911
|
if ((0, types_1.isUnpackedTypeVarTuple)(oldTypeArgType.type) && (0, types_1.isClassInstance)(newTypeArgType) && isTupleClass(newTypeArgType) && newTypeArgType.priv.tupleTypeArgs) {
|
|
51800
51912
|
(0, collectionUtils_1.appendArray)(newTupleTypeArgs, newTypeArgType.priv.tupleTypeArgs);
|
|
51913
|
+
} else if ((0, types_1.isUnpackedClass)(newTypeArgType) && newTypeArgType.priv.tupleTypeArgs) {
|
|
51914
|
+
(0, collectionUtils_1.appendArray)(newTupleTypeArgs, newTypeArgType.priv.tupleTypeArgs);
|
|
51801
51915
|
} else {
|
|
51802
51916
|
const isEmptyTuple = oldTypeArgType.isUnbounded && (0, types_1.isTypeVar)(oldTypeArgType.type) && (0, types_1.isNever)(newTypeArgType) && classType.priv.tupleTypeArgs.length === 1;
|
|
51803
51917
|
if (!isEmptyTuple) {
|
|
@@ -52129,9 +52243,15 @@ var require_typeUtils = __commonJS({
|
|
|
52129
52243
|
if ((0, types_1.isTypeVarTuple)(replacement) && (0, types_1.isTypeVarTuple)(typeVar) && typeVar.priv.isUnpacked) {
|
|
52130
52244
|
return types_1.TypeVarType.cloneForUnpacked(replacement, typeVar.priv.isInUnion);
|
|
52131
52245
|
}
|
|
52246
|
+
if (!(0, types_1.isTypeVarTuple)(replacement) && (0, types_1.isTypeVar)(replacement) && (0, types_1.isTypeVar)(typeVar) && typeVar.priv.isUnpacked) {
|
|
52247
|
+
return types_1.TypeVarType.cloneForUnpacked(replacement);
|
|
52248
|
+
}
|
|
52132
52249
|
if (!(0, types_1.isTypeVarTuple)(typeVar) && (0, types_1.isClassInstance)(replacement) && replacement.priv.tupleTypeArgs && replacement.priv.isUnpacked) {
|
|
52133
52250
|
replacement = combineTupleTypeArgs(replacement.priv.tupleTypeArgs);
|
|
52134
52251
|
}
|
|
52252
|
+
if ((0, types_1.isUnpackedTypeVar)(typeVar) && (0, types_1.isClass)(replacement)) {
|
|
52253
|
+
replacement = types_1.ClassType.cloneForUnpacked(replacement);
|
|
52254
|
+
}
|
|
52135
52255
|
if (!(0, types_1.isTypeVar)(replacement) || !types_1.TypeVarType.isUnification(replacement) || !this._options.replaceUnsolved) {
|
|
52136
52256
|
return replacement;
|
|
52137
52257
|
}
|
|
@@ -52286,7 +52406,7 @@ var require_typeUtils = __commonJS({
|
|
|
52286
52406
|
return result;
|
|
52287
52407
|
}
|
|
52288
52408
|
};
|
|
52289
|
-
var
|
|
52409
|
+
var UnificationTypeTransformer = class extends TypeVarTransformer {
|
|
52290
52410
|
constructor(_liveTypeVarScopes, _usageOffset) {
|
|
52291
52411
|
super();
|
|
52292
52412
|
this._liveTypeVarScopes = _liveTypeVarScopes;
|
|
@@ -53515,7 +53635,7 @@ var require_constraintTracker = __commonJS({
|
|
|
53515
53635
|
if (!type1 || !type2) {
|
|
53516
53636
|
return type1 === type2;
|
|
53517
53637
|
}
|
|
53518
|
-
return (0, types_1.isTypeSame)(type1, type2);
|
|
53638
|
+
return (0, types_1.isTypeSame)(type1, type2, { honorIsTypeArgExplicit: true, honorTypeForm: true });
|
|
53519
53639
|
}
|
|
53520
53640
|
let isSame = true;
|
|
53521
53641
|
this._typeVarMap.forEach((value, key) => {
|
|
@@ -53676,8 +53796,9 @@ var require_typeEvaluatorTypes = __commonJS({
|
|
|
53676
53796
|
"node_modules/@zzzen/pyright-internal/dist/analyzer/typeEvaluatorTypes.js"(exports2) {
|
|
53677
53797
|
"use strict";
|
|
53678
53798
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
53679
|
-
exports2.AssignTypeFlags = exports2.Reachability = exports2.EvalFlags = exports2.maxSubtypesForInferredType = void 0;
|
|
53799
|
+
exports2.AssignTypeFlags = exports2.Reachability = exports2.EvalFlags = exports2.maxInferredContainerDepth = exports2.maxSubtypesForInferredType = void 0;
|
|
53680
53800
|
exports2.maxSubtypesForInferredType = 64;
|
|
53801
|
+
exports2.maxInferredContainerDepth = 8;
|
|
53681
53802
|
var EvalFlags;
|
|
53682
53803
|
(function(EvalFlags2) {
|
|
53683
53804
|
EvalFlags2[EvalFlags2["None"] = 0] = "None";
|
|
@@ -53697,13 +53818,15 @@ var require_typeEvaluatorTypes = __commonJS({
|
|
|
53697
53818
|
EvalFlags2[EvalFlags2["TypeVarGetsCurScope"] = 8192] = "TypeVarGetsCurScope";
|
|
53698
53819
|
EvalFlags2[EvalFlags2["EnforceVarianceConsistency"] = 16384] = "EnforceVarianceConsistency";
|
|
53699
53820
|
EvalFlags2[EvalFlags2["VarTypeAnnotation"] = 32768] = "VarTypeAnnotation";
|
|
53821
|
+
EvalFlags2[EvalFlags2["AllowEllipsis"] = 65536] = "AllowEllipsis";
|
|
53700
53822
|
EvalFlags2[EvalFlags2["NoClassVar"] = 131072] = "NoClassVar";
|
|
53701
53823
|
EvalFlags2[EvalFlags2["NoNakedGeneric"] = 262144] = "NoNakedGeneric";
|
|
53702
53824
|
EvalFlags2[EvalFlags2["NotParsed"] = 524288] = "NotParsed";
|
|
53703
53825
|
EvalFlags2[EvalFlags2["AllowRequired"] = 1048576] = "AllowRequired";
|
|
53704
|
-
EvalFlags2[EvalFlags2["
|
|
53705
|
-
EvalFlags2[EvalFlags2["
|
|
53706
|
-
EvalFlags2[EvalFlags2["
|
|
53826
|
+
EvalFlags2[EvalFlags2["AllowReadOnly"] = 2097152] = "AllowReadOnly";
|
|
53827
|
+
EvalFlags2[EvalFlags2["AllowUnpackedTuple"] = 4194304] = "AllowUnpackedTuple";
|
|
53828
|
+
EvalFlags2[EvalFlags2["AllowUnpackedTypedDict"] = 8388608] = "AllowUnpackedTypedDict";
|
|
53829
|
+
EvalFlags2[EvalFlags2["ParsesStringLiteral"] = 16777216] = "ParsesStringLiteral";
|
|
53707
53830
|
EvalFlags2[EvalFlags2["NoConvertSpecialForm"] = 33554432] = "NoConvertSpecialForm";
|
|
53708
53831
|
EvalFlags2[EvalFlags2["NoNonTypeSpecialForms"] = 67108864] = "NoNonTypeSpecialForms";
|
|
53709
53832
|
EvalFlags2[EvalFlags2["AllowConcatenate"] = 134217728] = "AllowConcatenate";
|
|
@@ -53792,16 +53915,20 @@ var require_constraintSolver = __commonJS({
|
|
|
53792
53915
|
isAssignable = assignParamSpec(evaluator, destType, srcType, diag, constraints, recursionCount);
|
|
53793
53916
|
} else {
|
|
53794
53917
|
if ((0, types_1.isTypeVarTuple)(destType) && !destType.priv.isInUnion) {
|
|
53795
|
-
|
|
53796
|
-
|
|
53797
|
-
|
|
53798
|
-
|
|
53799
|
-
|
|
53800
|
-
|
|
53801
|
-
|
|
53802
|
-
|
|
53803
|
-
|
|
53804
|
-
|
|
53918
|
+
if (destType.priv.isUnpacked) {
|
|
53919
|
+
const tupleClassType = evaluator.getTupleClassType();
|
|
53920
|
+
if (!(0, types_1.isUnpacked)(srcType) && tupleClassType) {
|
|
53921
|
+
srcType = (0, typeUtils_1.convertToInstance)((0, typeUtils_1.specializeTupleClass)(
|
|
53922
|
+
tupleClassType,
|
|
53923
|
+
[{ type: srcType, isUnbounded: false }],
|
|
53924
|
+
/* isTypeArgExplicit */
|
|
53925
|
+
true,
|
|
53926
|
+
/* isUnpacked */
|
|
53927
|
+
true
|
|
53928
|
+
));
|
|
53929
|
+
}
|
|
53930
|
+
} else {
|
|
53931
|
+
srcType = (0, typeUtils_1.makeUnpacked)(srcType);
|
|
53805
53932
|
}
|
|
53806
53933
|
}
|
|
53807
53934
|
if ((0, types_1.isTypeVarTuple)(srcType) && srcType.priv.isUnpacked && !srcType.priv.isInUnion && !(0, types_1.isTypeVarTuple)(destType)) {
|
|
@@ -53985,14 +54112,16 @@ var require_constraintSolver = __commonJS({
|
|
|
53985
54112
|
if (liveTypeVarScopes) {
|
|
53986
54113
|
typeArgValue = (0, typeUtils_1.transformExpectedType)(typeArgValue, liveTypeVarScopes, usageOffset);
|
|
53987
54114
|
}
|
|
53988
|
-
if (typeArgValue
|
|
53989
|
-
|
|
53990
|
-
|
|
53991
|
-
|
|
53992
|
-
|
|
53993
|
-
|
|
53994
|
-
constraints
|
|
53995
|
-
|
|
54115
|
+
if (!typeArgValue || !assignTypeVar(
|
|
54116
|
+
evaluator,
|
|
54117
|
+
targetTypeVar,
|
|
54118
|
+
typeArgValue,
|
|
54119
|
+
/* diag */
|
|
54120
|
+
void 0,
|
|
54121
|
+
constraints,
|
|
54122
|
+
256
|
|
54123
|
+
/* AssignTypeFlags.RetainLiteralsForTypeVar */
|
|
54124
|
+
)) {
|
|
53996
54125
|
isResultValid = false;
|
|
53997
54126
|
}
|
|
53998
54127
|
}
|
|
@@ -54614,6 +54743,7 @@ var require_parameterUtils = __commonJS({
|
|
|
54614
54743
|
ParamKind2[ParamKind2["Positional"] = 0] = "Positional";
|
|
54615
54744
|
ParamKind2[ParamKind2["Standard"] = 1] = "Standard";
|
|
54616
54745
|
ParamKind2[ParamKind2["Keyword"] = 2] = "Keyword";
|
|
54746
|
+
ParamKind2[ParamKind2["ExpandedArgs"] = 3] = "ExpandedArgs";
|
|
54617
54747
|
})(ParamKind || (exports2.ParamKind = ParamKind = {}));
|
|
54618
54748
|
function getParamListDetails(type) {
|
|
54619
54749
|
const result = {
|
|
@@ -54694,7 +54824,7 @@ var require_parameterUtils = __commonJS({
|
|
|
54694
54824
|
tupleArg.type,
|
|
54695
54825
|
/* defaultArgTypeOverride */
|
|
54696
54826
|
void 0,
|
|
54697
|
-
ParamKind.
|
|
54827
|
+
ParamKind.ExpandedArgs
|
|
54698
54828
|
);
|
|
54699
54829
|
if (category === 0) {
|
|
54700
54830
|
result.positionParamCount++;
|
|
@@ -54825,7 +54955,6 @@ var require_constructorTransform = __commonJS({
|
|
|
54825
54955
|
var constraintTracker_1 = require_constraintTracker();
|
|
54826
54956
|
var constructors_1 = require_constructors();
|
|
54827
54957
|
var parameterUtils_1 = require_parameterUtils();
|
|
54828
|
-
var symbol_1 = require_symbol();
|
|
54829
54958
|
var types_1 = require_types();
|
|
54830
54959
|
var typeUtils_1 = require_typeUtils();
|
|
54831
54960
|
function hasConstructorTransform(classType) {
|
|
@@ -54885,8 +55014,7 @@ var require_constructorTransform = __commonJS({
|
|
|
54885
55014
|
if (!transformResult) {
|
|
54886
55015
|
return void 0;
|
|
54887
55016
|
}
|
|
54888
|
-
const newPartialClass = types_1.ClassType.
|
|
54889
|
-
types_1.ClassType.getSymbolTable(newPartialClass).set("__call__", symbol_1.Symbol.createWithType(4, transformResult.returnType));
|
|
55017
|
+
const newPartialClass = types_1.ClassType.cloneForPartial(result.returnType, transformResult.returnType);
|
|
54890
55018
|
return {
|
|
54891
55019
|
returnType: newPartialClass,
|
|
54892
55020
|
isTypeIncomplete: result.isTypeIncomplete,
|
|
@@ -54922,7 +55050,6 @@ var require_constructorTransform = __commonJS({
|
|
|
54922
55050
|
}
|
|
54923
55051
|
return void 0;
|
|
54924
55052
|
}
|
|
54925
|
-
const newPartialClass = types_1.ClassType.cloneForSymbolTableUpdate(result.returnType);
|
|
54926
55053
|
let synthesizedCallType;
|
|
54927
55054
|
if (applicableOverloads.length === 1) {
|
|
54928
55055
|
synthesizedCallType = applicableOverloads[0];
|
|
@@ -54936,7 +55063,7 @@ var require_constructorTransform = __commonJS({
|
|
|
54936
55063
|
))
|
|
54937
55064
|
);
|
|
54938
55065
|
}
|
|
54939
|
-
types_1.ClassType.
|
|
55066
|
+
const newPartialClass = types_1.ClassType.cloneForPartial(result.returnType, synthesizedCallType);
|
|
54940
55067
|
return {
|
|
54941
55068
|
returnType: newPartialClass,
|
|
54942
55069
|
isTypeIncomplete: result.isTypeIncomplete,
|
|
@@ -55459,12 +55586,14 @@ var require_constructors = __commonJS({
|
|
|
55459
55586
|
inferenceContext
|
|
55460
55587
|
);
|
|
55461
55588
|
});
|
|
55462
|
-
|
|
55463
|
-
|
|
55464
|
-
|
|
55465
|
-
|
|
55466
|
-
|
|
55467
|
-
|
|
55589
|
+
if (!callResult.argumentErrors) {
|
|
55590
|
+
const callType = metaclassCallMethodInfo.type;
|
|
55591
|
+
if ((0, types_1.isFunction)(callType) && !callType.shared.declaredReturnType) {
|
|
55592
|
+
return void 0;
|
|
55593
|
+
}
|
|
55594
|
+
if (callResult.returnType && (0, types_1.isUnknown)(callResult.returnType)) {
|
|
55595
|
+
return void 0;
|
|
55596
|
+
}
|
|
55468
55597
|
}
|
|
55469
55598
|
return callResult;
|
|
55470
55599
|
}
|
|
@@ -56175,8 +56304,11 @@ var require_dataClasses = __commonJS({
|
|
|
56175
56304
|
var debug_1 = require_debug();
|
|
56176
56305
|
var diagnostic_1 = require_diagnostic();
|
|
56177
56306
|
var diagnosticRules_1 = require_diagnosticRules();
|
|
56307
|
+
var positionUtils_1 = require_positionUtils();
|
|
56178
56308
|
var pythonVersion_1 = require_pythonVersion();
|
|
56309
|
+
var textRange_1 = require_textRange();
|
|
56179
56310
|
var localize_1 = require_localize();
|
|
56311
|
+
var tokenizer_1 = require_tokenizer();
|
|
56180
56312
|
var AnalyzerNodeInfo = __importStar(require_analyzerNodeInfo());
|
|
56181
56313
|
var analyzerNodeInfo_1 = require_analyzerNodeInfo();
|
|
56182
56314
|
var constraintSolution_1 = require_constraintSolution();
|
|
@@ -56279,9 +56411,11 @@ var require_dataClasses = __commonJS({
|
|
|
56279
56411
|
return;
|
|
56280
56412
|
}
|
|
56281
56413
|
let variableNameNode;
|
|
56414
|
+
let typeAnnotationNode;
|
|
56282
56415
|
let aliasName;
|
|
56283
56416
|
let variableTypeEvaluator;
|
|
56284
|
-
let
|
|
56417
|
+
let hasDefault = false;
|
|
56418
|
+
let isDefaultFactory = false;
|
|
56285
56419
|
let isKeywordOnly = types_1.ClassType.isDataClassKeywordOnly(classType) || sawKeywordOnlySeparator;
|
|
56286
56420
|
let defaultExpr;
|
|
56287
56421
|
let includeInInit = true;
|
|
@@ -56289,6 +56423,7 @@ var require_dataClasses = __commonJS({
|
|
|
56289
56423
|
if (statement.nodeType === 3) {
|
|
56290
56424
|
if (statement.d.leftExpr.nodeType === 54 && statement.d.leftExpr.d.valueExpr.nodeType === 38) {
|
|
56291
56425
|
variableNameNode = statement.d.leftExpr.d.valueExpr;
|
|
56426
|
+
typeAnnotationNode = statement.d.leftExpr;
|
|
56292
56427
|
const assignmentStatement = statement;
|
|
56293
56428
|
variableTypeEvaluator = () => evaluator.getTypeOfAnnotation(assignmentStatement.d.leftExpr.d.annotation, {
|
|
56294
56429
|
varTypeAnnotation: true,
|
|
@@ -56296,7 +56431,7 @@ var require_dataClasses = __commonJS({
|
|
|
56296
56431
|
allowClassVar: true
|
|
56297
56432
|
});
|
|
56298
56433
|
}
|
|
56299
|
-
|
|
56434
|
+
hasDefault = true;
|
|
56300
56435
|
defaultExpr = statement.d.rightExpr;
|
|
56301
56436
|
if (statement.d.rightExpr.nodeType === 9) {
|
|
56302
56437
|
const callTypeResult = evaluator.getTypeOfExpression(
|
|
@@ -56326,13 +56461,24 @@ var require_dataClasses = __commonJS({
|
|
|
56326
56461
|
} else {
|
|
56327
56462
|
isKeywordOnly = (_f = getDefaultArgValueForFieldSpecifier(evaluator, statement.d.rightExpr, callTypeResult, "kw_only")) !== null && _f !== void 0 ? _f : isKeywordOnly;
|
|
56328
56463
|
}
|
|
56329
|
-
const
|
|
56330
|
-
var _a3
|
|
56331
|
-
return ((_a3 = arg.d.name) === null || _a3 === void 0 ? void 0 : _a3.d.value) === "default"
|
|
56464
|
+
const defaultValueArg = statement.d.rightExpr.d.args.find((arg) => {
|
|
56465
|
+
var _a3;
|
|
56466
|
+
return ((_a3 = arg.d.name) === null || _a3 === void 0 ? void 0 : _a3.d.value) === "default";
|
|
56467
|
+
});
|
|
56468
|
+
hasDefault = !!defaultValueArg;
|
|
56469
|
+
if (defaultValueArg === null || defaultValueArg === void 0 ? void 0 : defaultValueArg.d.valueExpr) {
|
|
56470
|
+
defaultExpr = defaultValueArg.d.valueExpr;
|
|
56471
|
+
}
|
|
56472
|
+
const defaultFactoryArg = statement.d.rightExpr.d.args.find((arg) => {
|
|
56473
|
+
var _a3, _b2;
|
|
56474
|
+
return ((_a3 = arg.d.name) === null || _a3 === void 0 ? void 0 : _a3.d.value) === "default_factory" || ((_b2 = arg.d.name) === null || _b2 === void 0 ? void 0 : _b2.d.value) === "factory";
|
|
56332
56475
|
});
|
|
56333
|
-
|
|
56334
|
-
|
|
56335
|
-
|
|
56476
|
+
if (defaultFactoryArg) {
|
|
56477
|
+
hasDefault = true;
|
|
56478
|
+
isDefaultFactory = true;
|
|
56479
|
+
}
|
|
56480
|
+
if (defaultFactoryArg === null || defaultFactoryArg === void 0 ? void 0 : defaultFactoryArg.d.valueExpr) {
|
|
56481
|
+
defaultExpr = defaultFactoryArg.d.valueExpr;
|
|
56336
56482
|
}
|
|
56337
56483
|
const aliasArg = statement.d.rightExpr.d.args.find((arg) => {
|
|
56338
56484
|
var _a3;
|
|
@@ -56342,6 +56488,9 @@ var require_dataClasses = __commonJS({
|
|
|
56342
56488
|
const valueType = evaluator.getTypeOfExpression(aliasArg.d.valueExpr).type;
|
|
56343
56489
|
if ((0, types_1.isClassInstance)(valueType) && types_1.ClassType.isBuiltIn(valueType, "str") && (0, typeUtils_1.isLiteralType)(valueType)) {
|
|
56344
56490
|
aliasName = valueType.priv.literalValue;
|
|
56491
|
+
if (!tokenizer_1.Tokenizer.isPythonIdentifier(aliasName)) {
|
|
56492
|
+
evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.dataClassFieldInvalidAlias().format({ aliasName }), aliasArg.d.valueExpr);
|
|
56493
|
+
}
|
|
56345
56494
|
}
|
|
56346
56495
|
}
|
|
56347
56496
|
const converterArg = statement.d.rightExpr.d.args.find((arg) => {
|
|
@@ -56356,6 +56505,7 @@ var require_dataClasses = __commonJS({
|
|
|
56356
56505
|
} else if (statement.nodeType === 54) {
|
|
56357
56506
|
if (statement.d.valueExpr.nodeType === 38) {
|
|
56358
56507
|
variableNameNode = statement.d.valueExpr;
|
|
56508
|
+
typeAnnotationNode = statement;
|
|
56359
56509
|
const annotationStatement = statement;
|
|
56360
56510
|
variableTypeEvaluator = () => evaluator.getTypeOfAnnotation(annotationStatement.d.annotation, {
|
|
56361
56511
|
varTypeAnnotation: true,
|
|
@@ -56367,6 +56517,7 @@ var require_dataClasses = __commonJS({
|
|
|
56367
56517
|
if ((0, types_1.isClassInstance)(annotatedType) && types_1.ClassType.isBuiltIn(annotatedType, "KW_ONLY")) {
|
|
56368
56518
|
sawKeywordOnlySeparator = true;
|
|
56369
56519
|
variableNameNode = void 0;
|
|
56520
|
+
typeAnnotationNode = void 0;
|
|
56370
56521
|
variableTypeEvaluator = void 0;
|
|
56371
56522
|
}
|
|
56372
56523
|
}
|
|
@@ -56386,10 +56537,12 @@ var require_dataClasses = __commonJS({
|
|
|
56386
56537
|
classType,
|
|
56387
56538
|
alias: aliasName,
|
|
56388
56539
|
isKeywordOnly: false,
|
|
56389
|
-
hasDefault
|
|
56540
|
+
hasDefault,
|
|
56541
|
+
isDefaultFactory,
|
|
56390
56542
|
defaultExpr,
|
|
56391
56543
|
includeInInit,
|
|
56392
56544
|
nameNode: variableNameNode,
|
|
56545
|
+
typeAnnotationNode,
|
|
56393
56546
|
type: types_1.UnknownType.create(),
|
|
56394
56547
|
isClassVar: true,
|
|
56395
56548
|
converter
|
|
@@ -56401,10 +56554,12 @@ var require_dataClasses = __commonJS({
|
|
|
56401
56554
|
classType,
|
|
56402
56555
|
alias: aliasName,
|
|
56403
56556
|
isKeywordOnly,
|
|
56404
|
-
hasDefault
|
|
56557
|
+
hasDefault,
|
|
56558
|
+
isDefaultFactory,
|
|
56405
56559
|
defaultExpr,
|
|
56406
56560
|
includeInInit,
|
|
56407
56561
|
nameNode: variableNameNode,
|
|
56562
|
+
typeAnnotationNode,
|
|
56408
56563
|
type: types_1.UnknownType.create(),
|
|
56409
56564
|
isClassVar: false,
|
|
56410
56565
|
converter
|
|
@@ -56422,7 +56577,7 @@ var require_dataClasses = __commonJS({
|
|
|
56422
56577
|
if (!dataClassEntry.hasDefault && oldEntry.hasDefault && oldEntry.includeInInit) {
|
|
56423
56578
|
dataClassEntry.hasDefault = true;
|
|
56424
56579
|
dataClassEntry.defaultExpr = oldEntry.defaultExpr;
|
|
56425
|
-
|
|
56580
|
+
hasDefault = true;
|
|
56426
56581
|
evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.dataClassFieldInheritedDefault().format({ fieldName: variableName }), variableNameNode);
|
|
56427
56582
|
}
|
|
56428
56583
|
fullDataClassEntries[insertIndex] = dataClassEntry;
|
|
@@ -56430,7 +56585,7 @@ var require_dataClasses = __commonJS({
|
|
|
56430
56585
|
fullDataClassEntries.push(dataClassEntry);
|
|
56431
56586
|
insertIndex = fullDataClassEntries.length - 1;
|
|
56432
56587
|
}
|
|
56433
|
-
if (!isKeywordOnly && includeInInit && !skipSynthesizeInit && !
|
|
56588
|
+
if (!isKeywordOnly && includeInInit && !skipSynthesizeInit && !hasDefault) {
|
|
56434
56589
|
const firstDefaultValueIndex = fullDataClassEntries.findIndex((p) => p.hasDefault && p.includeInInit && !p.isKeywordOnly);
|
|
56435
56590
|
if (firstDefaultValueIndex >= 0 && firstDefaultValueIndex < insertIndex) {
|
|
56436
56591
|
evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.dataClassFieldWithDefault(), variableNameNode);
|
|
@@ -56477,6 +56632,7 @@ var require_dataClasses = __commonJS({
|
|
|
56477
56632
|
if (allAncestorsKnown) {
|
|
56478
56633
|
fullDataClassEntries.forEach((entry) => {
|
|
56479
56634
|
if (entry.includeInInit) {
|
|
56635
|
+
let defaultType;
|
|
56480
56636
|
let effectiveType = entry.type;
|
|
56481
56637
|
if (entry.classType !== classType && (0, typeUtils_1.requiresSpecialization)(effectiveType)) {
|
|
56482
56638
|
const solution = new constraintSolution_1.ConstraintSolution();
|
|
@@ -56487,13 +56643,32 @@ var require_dataClasses = __commonJS({
|
|
|
56487
56643
|
if (entry.converter) {
|
|
56488
56644
|
const fieldType = effectiveType;
|
|
56489
56645
|
effectiveType = getConverterInputType(evaluator, entry.converter, effectiveType, entry.name);
|
|
56490
|
-
symbolTable.set(entry.name, getDescriptorForConverterField(evaluator, node, entry.converter, entry.name, fieldType, effectiveType));
|
|
56646
|
+
symbolTable.set(entry.name, getDescriptorForConverterField(evaluator, node, entry.nameNode, entry.typeAnnotationNode, entry.converter, entry.name, fieldType, effectiveType));
|
|
56647
|
+
if (entry.hasDefault) {
|
|
56648
|
+
defaultType = entry.type;
|
|
56649
|
+
}
|
|
56650
|
+
} else {
|
|
56651
|
+
if (entry.hasDefault) {
|
|
56652
|
+
if (entry.isDefaultFactory || !entry.defaultExpr) {
|
|
56653
|
+
defaultType = entry.type;
|
|
56654
|
+
} else {
|
|
56655
|
+
const defaultExpr = entry.defaultExpr;
|
|
56656
|
+
const fileInfo = AnalyzerNodeInfo.getFileInfo(node);
|
|
56657
|
+
const flags = fileInfo.isStubFile ? 1 : 0;
|
|
56658
|
+
const liveTypeVars = (0, parseTreeUtils_1.getTypeVarScopesForNode)(entry.defaultExpr);
|
|
56659
|
+
const boundEffectiveType = (0, typeUtils_1.makeTypeVarsBound)(effectiveType, liveTypeVars);
|
|
56660
|
+
defaultType = evaluator.useSpeculativeMode(defaultExpr, () => {
|
|
56661
|
+
return evaluator.getTypeOfExpression(defaultExpr, flags, (0, typeUtils_1.makeInferenceContext)(boundEffectiveType)).type;
|
|
56662
|
+
});
|
|
56663
|
+
defaultType = (0, typeUtils_1.makeTypeVarsFree)(defaultType, liveTypeVars);
|
|
56664
|
+
}
|
|
56665
|
+
}
|
|
56491
56666
|
}
|
|
56492
56667
|
const effectiveName = entry.alias || entry.name;
|
|
56493
56668
|
if (!entry.alias && entry.nameNode && (0, symbolNameUtils_1.isPrivateName)(entry.nameNode.d.value)) {
|
|
56494
56669
|
evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.dataClassFieldWithPrivateName(), entry.nameNode);
|
|
56495
56670
|
}
|
|
56496
|
-
const param = types_1.FunctionParam.create(0, effectiveType, types_1.FunctionParamFlags.TypeDeclared, effectiveName,
|
|
56671
|
+
const param = types_1.FunctionParam.create(0, effectiveType, types_1.FunctionParamFlags.TypeDeclared, effectiveName, defaultType, entry.defaultExpr);
|
|
56497
56672
|
if (entry.isKeywordOnly) {
|
|
56498
56673
|
keywordOnlyParams.push(param);
|
|
56499
56674
|
} else {
|
|
@@ -56601,14 +56776,14 @@ var require_dataClasses = __commonJS({
|
|
|
56601
56776
|
if ((0, types_1.isFunction)(callType)) {
|
|
56602
56777
|
callTarget = callType;
|
|
56603
56778
|
} else if ((0, types_1.isOverloaded)(callType)) {
|
|
56604
|
-
callTarget = evaluator.getBestOverloadForArgs(callNode, { type: callType, isIncomplete: callTypeResult.isIncomplete }, callNode.d.args.map((arg) =>
|
|
56779
|
+
callTarget = evaluator.getBestOverloadForArgs(callNode, { type: callType, isIncomplete: callTypeResult.isIncomplete }, callNode.d.args.map((arg) => evaluator.convertNodeToArg(arg)));
|
|
56605
56780
|
} else if ((0, types_1.isInstantiableClass)(callType)) {
|
|
56606
56781
|
const initMethodResult = (0, constructors_1.getBoundInitMethod)(evaluator, callNode, callType);
|
|
56607
56782
|
if (initMethodResult) {
|
|
56608
56783
|
if ((0, types_1.isFunction)(initMethodResult.type)) {
|
|
56609
56784
|
callTarget = initMethodResult.type;
|
|
56610
56785
|
} else if ((0, types_1.isOverloaded)(initMethodResult.type)) {
|
|
56611
|
-
callTarget = evaluator.getBestOverloadForArgs(callNode, { type: initMethodResult.type }, callNode.d.args.map((arg) =>
|
|
56786
|
+
callTarget = evaluator.getBestOverloadForArgs(callNode, { type: initMethodResult.type }, callNode.d.args.map((arg) => evaluator.convertNodeToArg(arg)));
|
|
56612
56787
|
}
|
|
56613
56788
|
}
|
|
56614
56789
|
}
|
|
@@ -56707,7 +56882,7 @@ var require_dataClasses = __commonJS({
|
|
|
56707
56882
|
}
|
|
56708
56883
|
return void 0;
|
|
56709
56884
|
}
|
|
56710
|
-
function getDescriptorForConverterField(evaluator, dataclassNode, converterNode, fieldName, getType, setType) {
|
|
56885
|
+
function getDescriptorForConverterField(evaluator, dataclassNode, fieldNameNode, fieldAnnotationNode, converterNode, fieldName, getType, setType) {
|
|
56711
56886
|
const fileInfo = (0, analyzerNodeInfo_1.getFileInfo)(dataclassNode);
|
|
56712
56887
|
const typeMetaclass = evaluator.getBuiltInType(dataclassNode, "type");
|
|
56713
56888
|
const descriptorName = `__converterDescriptor_${fieldName}`;
|
|
@@ -56744,7 +56919,21 @@ var require_dataClasses = __commonJS({
|
|
|
56744
56919
|
getFunction.shared.declaredReturnType = getType;
|
|
56745
56920
|
const getSymbol = symbol_1.Symbol.createWithType(4, getFunction);
|
|
56746
56921
|
fields.set("__get__", getSymbol);
|
|
56747
|
-
|
|
56922
|
+
const symbol = symbol_1.Symbol.createWithType(4, types_1.ClassType.cloneAsInstance(descriptorClass));
|
|
56923
|
+
if (fieldNameNode && fieldAnnotationNode) {
|
|
56924
|
+
const fileInfo2 = AnalyzerNodeInfo.getFileInfo(dataclassNode);
|
|
56925
|
+
const declaration = {
|
|
56926
|
+
type: 1,
|
|
56927
|
+
node: fieldNameNode,
|
|
56928
|
+
uri: fileInfo2.fileUri,
|
|
56929
|
+
typeAnnotationNode: fieldAnnotationNode,
|
|
56930
|
+
range: (0, positionUtils_1.convertOffsetsToRange)(fieldNameNode.start, textRange_1.TextRange.getEnd(fieldNameNode), fileInfo2.lines),
|
|
56931
|
+
moduleName: fileInfo2.moduleName,
|
|
56932
|
+
isInExceptSuite: false
|
|
56933
|
+
};
|
|
56934
|
+
symbol.addDeclaration(declaration);
|
|
56935
|
+
}
|
|
56936
|
+
return symbol;
|
|
56748
56937
|
}
|
|
56749
56938
|
function transformDescriptorType(evaluator, type) {
|
|
56750
56939
|
if (!(0, types_1.isClassInstance)(type) || (0, typeUtils_1.isMetaclassInstance)(type)) {
|
|
@@ -57008,7 +57197,7 @@ var require_dataClasses = __commonJS({
|
|
|
57008
57197
|
}
|
|
57009
57198
|
function applyDataClassDecorator(evaluator, errorNode, classType, defaultBehaviors, callNode) {
|
|
57010
57199
|
var _a;
|
|
57011
|
-
applyDataClassClassBehaviorOverrides(evaluator, errorNode, classType, ((_a = callNode === null || callNode === void 0 ? void 0 : callNode.d.args) !== null && _a !== void 0 ? _a : []).map((arg) =>
|
|
57200
|
+
applyDataClassClassBehaviorOverrides(evaluator, errorNode, classType, ((_a = callNode === null || callNode === void 0 ? void 0 : callNode.d.args) !== null && _a !== void 0 ? _a : []).map((arg) => evaluator.convertNodeToArg(arg)), defaultBehaviors);
|
|
57012
57201
|
}
|
|
57013
57202
|
}
|
|
57014
57203
|
});
|
|
@@ -57439,7 +57628,7 @@ var require_typedDicts = __commonJS({
|
|
|
57439
57628
|
var types_1 = require_types();
|
|
57440
57629
|
var typeUtils_1 = require_typeUtils();
|
|
57441
57630
|
function createTypedDictType(evaluator, errorNode, typedDictClass, argList) {
|
|
57442
|
-
var _a, _b, _c;
|
|
57631
|
+
var _a, _b, _c, _d, _e;
|
|
57443
57632
|
const fileInfo = AnalyzerNodeInfo.getFileInfo(errorNode);
|
|
57444
57633
|
let className;
|
|
57445
57634
|
if (argList.length === 0) {
|
|
@@ -57516,7 +57705,8 @@ var require_typedDicts = __commonJS({
|
|
|
57516
57705
|
}
|
|
57517
57706
|
}
|
|
57518
57707
|
if (usingDictSyntax) {
|
|
57519
|
-
|
|
57708
|
+
const argsToConsider = argList.slice(2);
|
|
57709
|
+
for (const arg of argsToConsider) {
|
|
57520
57710
|
if (((_a = arg.name) === null || _a === void 0 ? void 0 : _a.d.value) === "total" || ((_b = arg.name) === null || _b === void 0 ? void 0 : _b.d.value) === "closed") {
|
|
57521
57711
|
if (!arg.valueExpression || arg.valueExpression.nodeType !== 14 || !(arg.valueExpression.d.constType === 15 || arg.valueExpression.d.constType === 33)) {
|
|
57522
57712
|
evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.typedDictBoolParam().format({ name: arg.name.d.value }), arg.valueExpression || errorNode);
|
|
@@ -57527,13 +57717,23 @@ var require_typedDicts = __commonJS({
|
|
|
57527
57717
|
classType.shared.flags |= 8 | 16;
|
|
57528
57718
|
}
|
|
57529
57719
|
}
|
|
57720
|
+
} else if (((_c = arg.name) === null || _c === void 0 ? void 0 : _c.d.value) === "extra_items") {
|
|
57721
|
+
classType.shared.typedDictExtraItemsExpr = arg.valueExpression;
|
|
57722
|
+
classType.shared.flags |= 16;
|
|
57530
57723
|
} else {
|
|
57531
57724
|
evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportCallIssue, localize_1.LocMessage.typedDictExtraArgs(), arg.valueExpression || errorNode);
|
|
57532
57725
|
}
|
|
57533
57726
|
}
|
|
57727
|
+
if (types_1.ClassType.isTypedDictMarkedClosed(classType) && classType.shared.typedDictExtraItemsExpr) {
|
|
57728
|
+
const arg = argsToConsider.find((arg2) => {
|
|
57729
|
+
var _a2;
|
|
57730
|
+
return ((_a2 = arg2.name) === null || _a2 === void 0 ? void 0 : _a2.d.value) === "extra_items";
|
|
57731
|
+
});
|
|
57732
|
+
evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.typedDictExtraItemsClosed(), (_d = arg === null || arg === void 0 ? void 0 : arg.valueExpression) !== null && _d !== void 0 ? _d : errorNode);
|
|
57733
|
+
}
|
|
57534
57734
|
}
|
|
57535
57735
|
synthesizeTypedDictClassMethods(evaluator, errorNode, classType);
|
|
57536
|
-
if (((
|
|
57736
|
+
if (((_e = errorNode.parent) === null || _e === void 0 ? void 0 : _e.nodeType) === 3 && className) {
|
|
57537
57737
|
const target = errorNode.parent.d.leftExpr;
|
|
57538
57738
|
const typedDictTarget = target.nodeType === 54 ? target.d.valueExpr : target;
|
|
57539
57739
|
if (typedDictTarget.nodeType === 38) {
|
|
@@ -58016,18 +58216,33 @@ var require_typedDicts = __commonJS({
|
|
|
58016
58216
|
}
|
|
58017
58217
|
});
|
|
58018
58218
|
const solution = (0, typeUtils_1.buildSolutionFromSpecializedClass)(classType);
|
|
58219
|
+
if (types_1.ClassType.isTypedDictMarkedClosed(classType)) {
|
|
58220
|
+
entries.extraItems = {
|
|
58221
|
+
valueType: types_1.NeverType.createNever(),
|
|
58222
|
+
isReadOnly: false,
|
|
58223
|
+
isRequired: false,
|
|
58224
|
+
isProvided: false
|
|
58225
|
+
};
|
|
58226
|
+
} else if (classType.shared.typedDictExtraItemsExpr) {
|
|
58227
|
+
const extraItemsTypeResult = evaluator.getTypeOfExpressionExpectingType(classType.shared.typedDictExtraItemsExpr, { allowReadOnly: true });
|
|
58228
|
+
entries.extraItems = {
|
|
58229
|
+
valueType: (0, typeUtils_1.convertToInstance)(extraItemsTypeResult.type),
|
|
58230
|
+
isReadOnly: !!extraItemsTypeResult.isReadOnly,
|
|
58231
|
+
isRequired: false,
|
|
58232
|
+
isProvided: true
|
|
58233
|
+
};
|
|
58234
|
+
}
|
|
58019
58235
|
types_1.ClassType.getSymbolTable(classType).forEach((symbol, name) => {
|
|
58020
58236
|
if (!symbol.isIgnoredForProtocolMatch()) {
|
|
58021
58237
|
const lastDecl = (0, symbolUtils_1.getLastTypedDeclarationForSymbol)(symbol);
|
|
58022
58238
|
if (lastDecl && lastDecl.type === 1) {
|
|
58023
58239
|
let valueType = evaluator.getEffectiveTypeOfSymbol(symbol);
|
|
58024
58240
|
valueType = (0, typeUtils_1.applySolvedTypeVars)(valueType, solution);
|
|
58025
|
-
const allowRequired = !types_1.ClassType.isTypedDictMarkedClosed(classType) || name !== "__extra_items__";
|
|
58026
58241
|
let isRequired = !types_1.ClassType.isCanOmitDictValues(classType);
|
|
58027
58242
|
let isReadOnly = false;
|
|
58028
|
-
if (isRequiredTypedDictVariable(evaluator, symbol
|
|
58243
|
+
if (isRequiredTypedDictVariable(evaluator, symbol)) {
|
|
58029
58244
|
isRequired = true;
|
|
58030
|
-
} else if (isNotRequiredTypedDictVariable(evaluator, symbol
|
|
58245
|
+
} else if (isNotRequiredTypedDictVariable(evaluator, symbol)) {
|
|
58031
58246
|
isRequired = false;
|
|
58032
58247
|
}
|
|
58033
58248
|
if (isReadOnlyTypedDictVariable(evaluator, symbol)) {
|
|
@@ -58039,12 +58254,7 @@ var require_typedDicts = __commonJS({
|
|
|
58039
58254
|
isRequired,
|
|
58040
58255
|
isProvided: false
|
|
58041
58256
|
};
|
|
58042
|
-
|
|
58043
|
-
tdEntry.isRequired = false;
|
|
58044
|
-
entries.extraItems = tdEntry;
|
|
58045
|
-
} else {
|
|
58046
|
-
entries.knownItems.set(name, tdEntry);
|
|
58047
|
-
}
|
|
58257
|
+
entries.knownItems.set(name, tdEntry);
|
|
58048
58258
|
}
|
|
58049
58259
|
}
|
|
58050
58260
|
});
|
|
@@ -58168,13 +58378,13 @@ var require_typedDicts = __commonJS({
|
|
|
58168
58378
|
const subDiag = diag === null || diag === void 0 ? void 0 : diag.createAddendum();
|
|
58169
58379
|
if (!evaluator.assignType(extraDestEntries.valueType, extraSrcEntries.valueType, subDiag === null || subDiag === void 0 ? void 0 : subDiag.createAddendum(), constraints, extraDestEntries.isReadOnly ? flags : flags | 1, recursionCount)) {
|
|
58170
58380
|
subDiag === null || subDiag === void 0 ? void 0 : subDiag.addMessage(localize_1.LocAddendum.typedDictExtraFieldTypeMismatch().format({
|
|
58171
|
-
name: "
|
|
58381
|
+
name: "extra_items",
|
|
58172
58382
|
type: evaluator.printType(types_1.ClassType.cloneAsInstance(srcType))
|
|
58173
58383
|
}));
|
|
58174
58384
|
typesAreConsistent = false;
|
|
58175
58385
|
} else if (!extraDestEntries.isReadOnly && extraSrcEntries.isReadOnly) {
|
|
58176
58386
|
diag === null || diag === void 0 ? void 0 : diag.createAddendum().addMessage(localize_1.LocAddendum.typedDictFieldNotReadOnly().format({
|
|
58177
|
-
name: "
|
|
58387
|
+
name: "extra_items",
|
|
58178
58388
|
type: evaluator.printType(types_1.ClassType.cloneAsInstance(destType))
|
|
58179
58389
|
}));
|
|
58180
58390
|
typesAreConsistent = false;
|
|
@@ -58221,7 +58431,7 @@ var require_typedDicts = __commonJS({
|
|
|
58221
58431
|
)) {
|
|
58222
58432
|
if (subDiag) {
|
|
58223
58433
|
subDiag.addMessage(localize_1.LocAddendum.typedDictFieldTypeMismatch().format({
|
|
58224
|
-
name: "
|
|
58434
|
+
name: "extra_items",
|
|
58225
58435
|
type: evaluator.printType(valueTypes[index].type)
|
|
58226
58436
|
}));
|
|
58227
58437
|
subDiag.addTextRange(keyTypeResult.node);
|
|
@@ -58391,39 +58601,29 @@ var require_typedDicts = __commonJS({
|
|
|
58391
58601
|
});
|
|
58392
58602
|
return types_1.ClassType.cloneForNarrowedTypedDictEntries(classType, narrowedEntries);
|
|
58393
58603
|
}
|
|
58394
|
-
function isRequiredTypedDictVariable(evaluator, symbol
|
|
58604
|
+
function isRequiredTypedDictVariable(evaluator, symbol) {
|
|
58395
58605
|
return symbol.getDeclarations().some((decl) => {
|
|
58396
58606
|
if (decl.type !== 1 || !decl.typeAnnotationNode) {
|
|
58397
58607
|
return false;
|
|
58398
58608
|
}
|
|
58399
58609
|
const annotatedType = evaluator.getTypeOfExpressionExpectingType(decl.typeAnnotationNode, {
|
|
58400
58610
|
allowFinal: true,
|
|
58401
|
-
allowRequired: true
|
|
58611
|
+
allowRequired: true,
|
|
58612
|
+
allowReadOnly: true
|
|
58402
58613
|
});
|
|
58403
|
-
if (!allowRequired) {
|
|
58404
|
-
if (annotatedType.isRequired) {
|
|
58405
|
-
evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.requiredNotInTypedDict(), decl.typeAnnotationNode);
|
|
58406
|
-
}
|
|
58407
|
-
return false;
|
|
58408
|
-
}
|
|
58409
58614
|
return !!annotatedType.isRequired;
|
|
58410
58615
|
});
|
|
58411
58616
|
}
|
|
58412
|
-
function isNotRequiredTypedDictVariable(evaluator, symbol
|
|
58617
|
+
function isNotRequiredTypedDictVariable(evaluator, symbol) {
|
|
58413
58618
|
return symbol.getDeclarations().some((decl) => {
|
|
58414
58619
|
if (decl.type !== 1 || !decl.typeAnnotationNode) {
|
|
58415
58620
|
return false;
|
|
58416
58621
|
}
|
|
58417
58622
|
const annotatedType = evaluator.getTypeOfExpressionExpectingType(decl.typeAnnotationNode, {
|
|
58418
58623
|
allowFinal: true,
|
|
58419
|
-
allowRequired: true
|
|
58624
|
+
allowRequired: true,
|
|
58625
|
+
allowReadOnly: true
|
|
58420
58626
|
});
|
|
58421
|
-
if (!allowRequired) {
|
|
58422
|
-
if (annotatedType.isNotRequired) {
|
|
58423
|
-
evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.notRequiredNotInTypedDict(), decl.typeAnnotationNode);
|
|
58424
|
-
}
|
|
58425
|
-
return false;
|
|
58426
|
-
}
|
|
58427
58627
|
return !!annotatedType.isNotRequired;
|
|
58428
58628
|
});
|
|
58429
58629
|
}
|
|
@@ -58434,7 +58634,8 @@ var require_typedDicts = __commonJS({
|
|
|
58434
58634
|
}
|
|
58435
58635
|
const annotatedType = evaluator.getTypeOfExpressionExpectingType(decl.typeAnnotationNode, {
|
|
58436
58636
|
allowFinal: true,
|
|
58437
|
-
allowRequired: true
|
|
58637
|
+
allowRequired: true,
|
|
58638
|
+
allowReadOnly: true
|
|
58438
58639
|
});
|
|
58439
58640
|
return !!annotatedType.isReadOnly;
|
|
58440
58641
|
});
|
|
@@ -59886,15 +60087,15 @@ var require_typeGuards = __commonJS({
|
|
|
59886
60087
|
/* options */
|
|
59887
60088
|
void 0,
|
|
59888
60089
|
(subtype, unexpandedSubtype) => {
|
|
59889
|
-
var _a;
|
|
60090
|
+
var _a, _b;
|
|
59890
60091
|
if ((0, types_1.isClassInstance)(subtype)) {
|
|
59891
60092
|
const matches = types_1.ClassType.isDerivedFrom(classType, types_1.ClassType.cloneAsInstantiable(subtype));
|
|
59892
60093
|
if (isPositiveTest) {
|
|
59893
60094
|
if (matches) {
|
|
59894
60095
|
if (types_1.ClassType.isSameGenericClass(subtype, classType)) {
|
|
59895
|
-
return subtype;
|
|
60096
|
+
return (0, typeUtils_1.addConditionToType)(subtype, (_a = classType.props) === null || _a === void 0 ? void 0 : _a.condition);
|
|
59896
60097
|
}
|
|
59897
|
-
return (0, typeUtils_1.addConditionToType)(types_1.ClassType.cloneAsInstance(classType), (
|
|
60098
|
+
return (0, typeUtils_1.addConditionToType)(types_1.ClassType.cloneAsInstance(classType), (_b = subtype.props) === null || _b === void 0 ? void 0 : _b.condition);
|
|
59898
60099
|
}
|
|
59899
60100
|
if (!classType.priv.includeSubclasses) {
|
|
59900
60101
|
return void 0;
|
|
@@ -61172,7 +61373,7 @@ var require_importResolver = __commonJS({
|
|
|
61172
61373
|
var stringUtils_1 = require_stringUtils();
|
|
61173
61374
|
var uri_1 = require_uri();
|
|
61174
61375
|
var uriUtils_1 = require_uriUtils();
|
|
61175
|
-
var
|
|
61376
|
+
var tokenizer_1 = require_tokenizer();
|
|
61176
61377
|
var importStatementUtils_1 = require_importStatementUtils();
|
|
61177
61378
|
var parentDirectoryCache_1 = require_parentDirectoryCache();
|
|
61178
61379
|
var pyTypedUtils_1 = require_pyTypedUtils();
|
|
@@ -62967,7 +63168,7 @@ var require_importResolver = __commonJS({
|
|
|
62967
63168
|
if (parts[0].endsWith(pathConsts_1.stubsSuffix)) {
|
|
62968
63169
|
parts[0] = parts[0].substr(0, parts[0].length - pathConsts_1.stubsSuffix.length);
|
|
62969
63170
|
}
|
|
62970
|
-
const containsInvalidCharacters = parts.some((p) => !
|
|
63171
|
+
const containsInvalidCharacters = parts.some((p) => !tokenizer_1.Tokenizer.isPythonIdentifier(p));
|
|
62971
63172
|
return {
|
|
62972
63173
|
moduleName: parts.join("."),
|
|
62973
63174
|
containsInvalidCharacters
|
|
@@ -62979,14 +63180,6 @@ var require_importResolver = __commonJS({
|
|
|
62979
63180
|
function _isDefaultWorkspace(uri) {
|
|
62980
63181
|
return !uri || uri.isEmpty() || uri_1.Uri.isDefaultWorkspace(uri);
|
|
62981
63182
|
}
|
|
62982
|
-
function _isIdentifier(value) {
|
|
62983
|
-
for (let i = 0; i < value.length; i++) {
|
|
62984
|
-
if (i === 0 ? !(0, characters_1.isIdentifierStartChar)(value.charCodeAt(i)) : !(0, characters_1.isIdentifierChar)(value.charCodeAt(i))) {
|
|
62985
|
-
return false;
|
|
62986
|
-
}
|
|
62987
|
-
}
|
|
62988
|
-
return true;
|
|
62989
|
-
}
|
|
62990
63183
|
}
|
|
62991
63184
|
});
|
|
62992
63185
|
|
|
@@ -63025,6 +63218,7 @@ var require_patternMatching = __commonJS({
|
|
|
63025
63218
|
"builtins.str",
|
|
63026
63219
|
"builtins.tuple"
|
|
63027
63220
|
];
|
|
63221
|
+
var maxSequencePatternTupleExpansionSubtypes = 128;
|
|
63028
63222
|
function narrowTypeBasedOnPattern(evaluator, type, pattern, isPositiveTest) {
|
|
63029
63223
|
switch (pattern.nodeType) {
|
|
63030
63224
|
case 65: {
|
|
@@ -63090,6 +63284,7 @@ var require_patternMatching = __commonJS({
|
|
|
63090
63284
|
}
|
|
63091
63285
|
}
|
|
63092
63286
|
function narrowTypeBasedOnSequencePattern(evaluator, type, pattern, isPositiveTest) {
|
|
63287
|
+
let usingTupleExpansion = false;
|
|
63093
63288
|
type = (0, typeUtils_1.transformPossibleRecursiveTypeAlias)(type);
|
|
63094
63289
|
let sequenceInfo = getSequencePatternInfo(evaluator, pattern, type);
|
|
63095
63290
|
sequenceInfo = sequenceInfo.filter((entry) => {
|
|
@@ -63194,6 +63389,7 @@ var require_patternMatching = __commonJS({
|
|
|
63194
63389
|
return { type: t, isUnbounded: false };
|
|
63195
63390
|
})));
|
|
63196
63391
|
}));
|
|
63392
|
+
usingTupleExpansion = true;
|
|
63197
63393
|
}
|
|
63198
63394
|
}
|
|
63199
63395
|
return true;
|
|
@@ -63222,7 +63418,7 @@ var require_patternMatching = __commonJS({
|
|
|
63222
63418
|
}
|
|
63223
63419
|
return isPlausibleMatch;
|
|
63224
63420
|
});
|
|
63225
|
-
return (0, types_1.combineTypes)(sequenceInfo.map((entry) => entry.subtype));
|
|
63421
|
+
return (0, types_1.combineTypes)(sequenceInfo.map((entry) => entry.subtype), { maxSubtypeCount: usingTupleExpansion ? maxSequencePatternTupleExpansionSubtypes : void 0 });
|
|
63226
63422
|
}
|
|
63227
63423
|
function narrowTypeBasedOnAsPattern(evaluator, type, pattern, isPositiveTest) {
|
|
63228
63424
|
let remainingType = type;
|
|
@@ -63846,7 +64042,7 @@ var require_patternMatching = __commonJS({
|
|
|
63846
64042
|
const typeArgs = (_a = specializedSequence.priv.tupleTypeArgs) !== null && _a !== void 0 ? _a : [
|
|
63847
64043
|
{ type: types_1.UnknownType.create(), isUnbounded: true }
|
|
63848
64044
|
];
|
|
63849
|
-
const tupleIndeterminateIndex = typeArgs.findIndex((t) => t.isUnbounded || (0, types_1.isUnpackedTypeVarTuple)(t.type));
|
|
64045
|
+
const tupleIndeterminateIndex = typeArgs.findIndex((t) => t.isUnbounded || (0, types_1.isUnpackedTypeVarTuple)(t.type) || (0, types_1.isUnpackedTypeVar)(t.type));
|
|
63850
64046
|
let tupleDeterminateEntryCount = typeArgs.length;
|
|
63851
64047
|
if (tupleIndeterminateIndex >= 0) {
|
|
63852
64048
|
tupleDeterminateEntryCount--;
|
|
@@ -63862,7 +64058,7 @@ var require_patternMatching = __commonJS({
|
|
|
63862
64058
|
const removedEntries = typeArgs.splice(patternStarEntryIndex, entriesToCombine);
|
|
63863
64059
|
typeArgs.splice(patternStarEntryIndex, 0, {
|
|
63864
64060
|
type: (0, types_1.combineTypes)(removedEntries.map((t) => t.type)),
|
|
63865
|
-
isUnbounded: removedEntries.every((t) => t.isUnbounded || (0, types_1.isUnpackedTypeVarTuple)(t.type))
|
|
64061
|
+
isUnbounded: removedEntries.every((t) => t.isUnbounded || (0, types_1.isUnpackedTypeVarTuple)(t.type) || (0, types_1.isUnpackedTypeVar)(t.type))
|
|
63866
64062
|
});
|
|
63867
64063
|
}
|
|
63868
64064
|
if (typeArgs.length === patternEntryCount) {
|
|
@@ -64770,25 +64966,25 @@ var require_protocols = __commonJS({
|
|
|
64770
64966
|
var maxProtocolCompatibilityCacheEntries = 64;
|
|
64771
64967
|
function assignClassToProtocol(evaluator, destType, srcType, diag, constraints, flags, recursionCount) {
|
|
64772
64968
|
(0, debug_1.assert)((0, types_1.isInstantiableClass)(destType) && types_1.ClassType.isProtocolClass(destType));
|
|
64969
|
+
if (srcType.priv.literalValue !== void 0) {
|
|
64970
|
+
srcType = evaluator.stripLiteralValue(srcType);
|
|
64971
|
+
}
|
|
64773
64972
|
const enforceInvariance = (flags & 1) !== 0;
|
|
64774
64973
|
if (protocolAssignmentStack.some((entry) => {
|
|
64775
64974
|
return (0, types_1.isTypeSame)(entry.srcType, srcType) && (0, types_1.isTypeSame)(entry.destType, destType);
|
|
64776
64975
|
})) {
|
|
64777
64976
|
return !enforceInvariance;
|
|
64778
64977
|
}
|
|
64779
|
-
|
|
64780
|
-
|
|
64781
|
-
if (
|
|
64782
|
-
if (
|
|
64783
|
-
|
|
64784
|
-
return true;
|
|
64785
|
-
}
|
|
64786
|
-
}
|
|
64787
|
-
if (!compatibility) {
|
|
64788
|
-
if (!diag || diag.getNestLevel() > diagnostic_1.defaultMaxDiagnosticDepth) {
|
|
64789
|
-
return false;
|
|
64790
|
-
}
|
|
64978
|
+
const compat = getProtocolCompatibility(destType, srcType, flags, constraints);
|
|
64979
|
+
if (compat !== void 0) {
|
|
64980
|
+
if (compat.isCompatible) {
|
|
64981
|
+
if (compat.postConstraints) {
|
|
64982
|
+
constraints === null || constraints === void 0 ? void 0 : constraints.copyFromClone(compat.postConstraints);
|
|
64791
64983
|
}
|
|
64984
|
+
return true;
|
|
64985
|
+
}
|
|
64986
|
+
if (!diag || diag.getNestLevel() > diagnostic_1.defaultMaxDiagnosticDepth) {
|
|
64987
|
+
return false;
|
|
64792
64988
|
}
|
|
64793
64989
|
}
|
|
64794
64990
|
protocolAssignmentStack.push({ srcType, destType });
|
|
@@ -64801,7 +64997,9 @@ var require_protocols = __commonJS({
|
|
|
64801
64997
|
throw e;
|
|
64802
64998
|
}
|
|
64803
64999
|
protocolAssignmentStack.pop();
|
|
64804
|
-
|
|
65000
|
+
if (!compat) {
|
|
65001
|
+
setProtocolCompatibility(evaluator, destType, srcType, flags, clonedConstraints, constraints === null || constraints === void 0 ? void 0 : constraints.clone(), isCompatible, recursionCount);
|
|
65002
|
+
}
|
|
64805
65003
|
return isCompatible;
|
|
64806
65004
|
}
|
|
64807
65005
|
function assignModuleToProtocol(evaluator, destType, srcType, diag, constraints, flags, recursionCount) {
|
|
@@ -64856,12 +65054,23 @@ var require_protocols = __commonJS({
|
|
|
64856
65054
|
if (entries === void 0) {
|
|
64857
65055
|
return void 0;
|
|
64858
65056
|
}
|
|
64859
|
-
const entry
|
|
64860
|
-
|
|
64861
|
-
|
|
64862
|
-
|
|
65057
|
+
for (const entry of entries) {
|
|
65058
|
+
if (entry.flags !== flags) {
|
|
65059
|
+
continue;
|
|
65060
|
+
}
|
|
65061
|
+
if (entry.srcType === void 0) {
|
|
65062
|
+
if (types_1.ClassType.isSameGenericClass(entry.destType, destType)) {
|
|
65063
|
+
return entry;
|
|
65064
|
+
}
|
|
65065
|
+
continue;
|
|
65066
|
+
}
|
|
65067
|
+
if ((0, types_1.isTypeSame)(entry.destType, destType, { honorIsTypeArgExplicit: true, honorTypeForm: true }) && (0, types_1.isTypeSame)(entry.srcType, srcType, { honorIsTypeArgExplicit: true, honorTypeForm: true }) && isConstraintTrackerSame(constraints, entry.preConstraints)) {
|
|
65068
|
+
return entry;
|
|
65069
|
+
}
|
|
65070
|
+
}
|
|
65071
|
+
return void 0;
|
|
64863
65072
|
}
|
|
64864
|
-
function setProtocolCompatibility(destType, srcType, flags,
|
|
65073
|
+
function setProtocolCompatibility(evaluator, destType, srcType, flags, preConstraints, postConstraints, isCompatible, recursionCount) {
|
|
64865
65074
|
let map = srcType.shared.protocolCompatibility;
|
|
64866
65075
|
if (!map) {
|
|
64867
65076
|
map = /* @__PURE__ */ new Map();
|
|
@@ -64872,13 +65081,33 @@ var require_protocols = __commonJS({
|
|
|
64872
65081
|
entries = [];
|
|
64873
65082
|
map.set(destType.shared.fullName, entries);
|
|
64874
65083
|
}
|
|
64875
|
-
|
|
65084
|
+
let isAlwaysIncompatible = false;
|
|
65085
|
+
if (!isCompatible && !entries.some((entry) => entry.flags === flags && types_1.ClassType.isSameGenericClass(entry.destType, destType))) {
|
|
65086
|
+
const genericDestType = (0, typeUtils_1.requiresTypeArgs)(destType) ? (0, typeUtils_1.selfSpecializeClass)(destType, { overrideTypeArgs: true }) : destType;
|
|
65087
|
+
const genericSrcType = (0, typeUtils_1.requiresTypeArgs)(srcType) ? (0, typeUtils_1.selfSpecializeClass)(srcType, { overrideTypeArgs: true }) : srcType;
|
|
65088
|
+
if (!assignToProtocolInternal(
|
|
65089
|
+
evaluator,
|
|
65090
|
+
genericDestType,
|
|
65091
|
+
genericSrcType,
|
|
65092
|
+
/* diag */
|
|
65093
|
+
void 0,
|
|
65094
|
+
/* constraints */
|
|
65095
|
+
void 0,
|
|
65096
|
+
flags,
|
|
65097
|
+
recursionCount
|
|
65098
|
+
)) {
|
|
65099
|
+
isAlwaysIncompatible = true;
|
|
65100
|
+
}
|
|
65101
|
+
}
|
|
65102
|
+
const newEntry = {
|
|
64876
65103
|
destType,
|
|
64877
|
-
srcType,
|
|
65104
|
+
srcType: isAlwaysIncompatible ? void 0 : srcType,
|
|
64878
65105
|
flags,
|
|
64879
|
-
|
|
65106
|
+
preConstraints,
|
|
65107
|
+
postConstraints,
|
|
64880
65108
|
isCompatible
|
|
64881
|
-
}
|
|
65109
|
+
};
|
|
65110
|
+
entries.push(newEntry);
|
|
64882
65111
|
if (entries.length > maxProtocolCompatibilityCacheEntries) {
|
|
64883
65112
|
entries.shift();
|
|
64884
65113
|
}
|
|
@@ -66779,7 +67008,7 @@ var require_codeFlowEngine = __commonJS({
|
|
|
66779
67008
|
} else {
|
|
66780
67009
|
const callResult = evaluator2.validateOverloadedArgTypes(
|
|
66781
67010
|
node,
|
|
66782
|
-
node.d.args.map((arg) =>
|
|
67011
|
+
node.d.args.map((arg) => evaluator2.convertNodeToArg(arg)),
|
|
66783
67012
|
{ type: callSubtype, isIncomplete: callTypeResult.isIncomplete },
|
|
66784
67013
|
/* constraints */
|
|
66785
67014
|
void 0,
|
|
@@ -68372,12 +68601,163 @@ var require_tuples = __commonJS({
|
|
|
68372
68601
|
"node_modules/@zzzen/pyright-internal/dist/analyzer/tuples.js"(exports2) {
|
|
68373
68602
|
"use strict";
|
|
68374
68603
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
68604
|
+
exports2.makeTupleObject = makeTupleObject;
|
|
68605
|
+
exports2.getTypeOfTuple = getTypeOfTuple;
|
|
68606
|
+
exports2.getTypeOfTupleWithContext = getTypeOfTupleWithContext;
|
|
68607
|
+
exports2.getTypeOfTupleInferred = getTypeOfTupleInferred;
|
|
68375
68608
|
exports2.assignTupleTypeArgs = assignTupleTypeArgs;
|
|
68376
68609
|
exports2.adjustTupleTypeArgs = adjustTupleTypeArgs;
|
|
68377
68610
|
exports2.getSlicedTupleType = getSlicedTupleType;
|
|
68611
|
+
var diagnostic_1 = require_diagnostic();
|
|
68612
|
+
var diagnosticRules_1 = require_diagnosticRules();
|
|
68378
68613
|
var localize_1 = require_localize();
|
|
68614
|
+
var constraintSolver_1 = require_constraintSolver();
|
|
68615
|
+
var constraintTracker_1 = require_constraintTracker();
|
|
68616
|
+
var parseTreeUtils_1 = require_parseTreeUtils();
|
|
68617
|
+
var typeEvaluatorTypes_1 = require_typeEvaluatorTypes();
|
|
68379
68618
|
var types_1 = require_types();
|
|
68380
68619
|
var typeUtils_1 = require_typeUtils();
|
|
68620
|
+
var maxInferredTupleEntryCount = 256;
|
|
68621
|
+
function makeTupleObject(evaluator, typeArgs, isUnpacked = false) {
|
|
68622
|
+
const tupleClass = evaluator.getTupleClassType();
|
|
68623
|
+
if (tupleClass && (0, types_1.isInstantiableClass)(tupleClass)) {
|
|
68624
|
+
return (0, typeUtils_1.convertToInstance)((0, typeUtils_1.specializeTupleClass)(
|
|
68625
|
+
tupleClass,
|
|
68626
|
+
typeArgs,
|
|
68627
|
+
/* isTypeArgExplicit */
|
|
68628
|
+
true,
|
|
68629
|
+
isUnpacked
|
|
68630
|
+
));
|
|
68631
|
+
}
|
|
68632
|
+
return types_1.UnknownType.create();
|
|
68633
|
+
}
|
|
68634
|
+
function getTypeOfTuple(evaluator, node, flags, inferenceContext) {
|
|
68635
|
+
var _a;
|
|
68636
|
+
if ((flags & 256) !== 0 && ((_a = node.parent) === null || _a === void 0 ? void 0 : _a.nodeType) !== 1) {
|
|
68637
|
+
const diag = new diagnostic_1.DiagnosticAddendum();
|
|
68638
|
+
diag.addMessage(localize_1.LocAddendum.useTupleInstead());
|
|
68639
|
+
evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportInvalidTypeForm, localize_1.LocMessage.tupleInAnnotation() + diag.getString(), node);
|
|
68640
|
+
return { type: types_1.UnknownType.create() };
|
|
68641
|
+
}
|
|
68642
|
+
if ((flags & 128) !== 0 && node.d.items.length === 0 && !inferenceContext) {
|
|
68643
|
+
return { type: makeTupleObject(evaluator, []), isEmptyTupleShorthand: true };
|
|
68644
|
+
}
|
|
68645
|
+
flags &= ~(256 | 8 | 128);
|
|
68646
|
+
let expectedType = inferenceContext === null || inferenceContext === void 0 ? void 0 : inferenceContext.expectedType;
|
|
68647
|
+
let expectedTypeContainsAny = inferenceContext && (0, types_1.isAny)(inferenceContext.expectedType);
|
|
68648
|
+
if (inferenceContext && (0, types_1.isUnion)(inferenceContext.expectedType)) {
|
|
68649
|
+
let matchingSubtype;
|
|
68650
|
+
(0, typeUtils_1.doForEachSubtype)(
|
|
68651
|
+
inferenceContext.expectedType,
|
|
68652
|
+
(subtype) => {
|
|
68653
|
+
if ((0, types_1.isAny)(subtype)) {
|
|
68654
|
+
expectedTypeContainsAny = true;
|
|
68655
|
+
}
|
|
68656
|
+
if (!matchingSubtype) {
|
|
68657
|
+
const subtypeResult = evaluator.useSpeculativeMode(node, () => {
|
|
68658
|
+
return getTypeOfTupleWithContext(evaluator, node, flags, (0, typeUtils_1.makeInferenceContext)(subtype));
|
|
68659
|
+
});
|
|
68660
|
+
if (subtypeResult && evaluator.assignType(subtype, subtypeResult.type)) {
|
|
68661
|
+
matchingSubtype = subtype;
|
|
68662
|
+
}
|
|
68663
|
+
}
|
|
68664
|
+
},
|
|
68665
|
+
/* sortSubtypes */
|
|
68666
|
+
true
|
|
68667
|
+
);
|
|
68668
|
+
expectedType = matchingSubtype;
|
|
68669
|
+
}
|
|
68670
|
+
let expectedTypeDiagAddendum;
|
|
68671
|
+
if (expectedType) {
|
|
68672
|
+
const result = getTypeOfTupleWithContext(evaluator, node, flags, (0, typeUtils_1.makeInferenceContext)(expectedType));
|
|
68673
|
+
if (result && !result.typeErrors) {
|
|
68674
|
+
return result;
|
|
68675
|
+
}
|
|
68676
|
+
expectedTypeDiagAddendum = result === null || result === void 0 ? void 0 : result.expectedTypeDiagAddendum;
|
|
68677
|
+
}
|
|
68678
|
+
const typeResult = getTypeOfTupleInferred(evaluator, node, flags);
|
|
68679
|
+
if (expectedTypeContainsAny) {
|
|
68680
|
+
typeResult.type = types_1.AnyType.create();
|
|
68681
|
+
}
|
|
68682
|
+
return { ...typeResult, expectedTypeDiagAddendum };
|
|
68683
|
+
}
|
|
68684
|
+
function getTypeOfTupleWithContext(evaluator, node, flags, inferenceContext) {
|
|
68685
|
+
inferenceContext.expectedType = (0, typeUtils_1.transformPossibleRecursiveTypeAlias)(inferenceContext.expectedType);
|
|
68686
|
+
if (!(0, types_1.isClassInstance)(inferenceContext.expectedType)) {
|
|
68687
|
+
return void 0;
|
|
68688
|
+
}
|
|
68689
|
+
const tupleClass = evaluator.getTupleClassType();
|
|
68690
|
+
if (!tupleClass || !(0, types_1.isInstantiableClass)(tupleClass)) {
|
|
68691
|
+
return void 0;
|
|
68692
|
+
}
|
|
68693
|
+
let expectedTypes = [];
|
|
68694
|
+
if ((0, typeUtils_1.isTupleClass)(inferenceContext.expectedType) && inferenceContext.expectedType.priv.tupleTypeArgs) {
|
|
68695
|
+
expectedTypes = inferenceContext.expectedType.priv.tupleTypeArgs.map((t) => (0, typeUtils_1.transformPossibleRecursiveTypeAlias)(t.type));
|
|
68696
|
+
const unboundedIndex = inferenceContext.expectedType.priv.tupleTypeArgs.findIndex((t) => t.isUnbounded);
|
|
68697
|
+
if (unboundedIndex >= 0) {
|
|
68698
|
+
if (expectedTypes.length > node.d.items.length) {
|
|
68699
|
+
expectedTypes.splice(unboundedIndex, 1);
|
|
68700
|
+
} else {
|
|
68701
|
+
while (expectedTypes.length < node.d.items.length) {
|
|
68702
|
+
expectedTypes.splice(unboundedIndex, 0, expectedTypes[unboundedIndex]);
|
|
68703
|
+
}
|
|
68704
|
+
}
|
|
68705
|
+
}
|
|
68706
|
+
} else {
|
|
68707
|
+
const tupleConstraints = new constraintTracker_1.ConstraintTracker();
|
|
68708
|
+
if (!(0, constraintSolver_1.addConstraintsForExpectedType)(evaluator, types_1.ClassType.cloneAsInstance(tupleClass), inferenceContext.expectedType, tupleConstraints, (0, parseTreeUtils_1.getTypeVarScopesForNode)(node), node.start)) {
|
|
68709
|
+
return void 0;
|
|
68710
|
+
}
|
|
68711
|
+
const specializedTuple = evaluator.solveAndApplyConstraints(tupleClass, tupleConstraints);
|
|
68712
|
+
if (!specializedTuple.priv.typeArgs || specializedTuple.priv.typeArgs.length !== 1) {
|
|
68713
|
+
return void 0;
|
|
68714
|
+
}
|
|
68715
|
+
const homogenousType = (0, typeUtils_1.transformPossibleRecursiveTypeAlias)(specializedTuple.priv.typeArgs[0]);
|
|
68716
|
+
for (let i = 0; i < node.d.items.length; i++) {
|
|
68717
|
+
expectedTypes.push(homogenousType);
|
|
68718
|
+
}
|
|
68719
|
+
}
|
|
68720
|
+
const entryTypeResults = node.d.items.map((expr, index) => evaluator.getTypeOfExpression(expr, flags | 268435456, (0, typeUtils_1.makeInferenceContext)(index < expectedTypes.length ? expectedTypes[index] : void 0, inferenceContext.isTypeIncomplete)));
|
|
68721
|
+
const isIncomplete = entryTypeResults.some((result) => result.isIncomplete);
|
|
68722
|
+
let expectedTypeDiagAddendum;
|
|
68723
|
+
if (entryTypeResults.some((result) => result.expectedTypeDiagAddendum)) {
|
|
68724
|
+
expectedTypeDiagAddendum = new diagnostic_1.DiagnosticAddendum();
|
|
68725
|
+
entryTypeResults.forEach((result) => {
|
|
68726
|
+
if (result.expectedTypeDiagAddendum) {
|
|
68727
|
+
expectedTypeDiagAddendum.addAddendum(result.expectedTypeDiagAddendum);
|
|
68728
|
+
}
|
|
68729
|
+
});
|
|
68730
|
+
}
|
|
68731
|
+
let type;
|
|
68732
|
+
if (node.d.items.length > maxInferredTupleEntryCount && entryTypeResults.some((result) => result.typeErrors)) {
|
|
68733
|
+
type = makeTupleObject(evaluator, [{ type: types_1.UnknownType.create(), isUnbounded: true }]);
|
|
68734
|
+
} else {
|
|
68735
|
+
type = makeTupleObject(evaluator, evaluator.buildTupleTypesList(
|
|
68736
|
+
entryTypeResults,
|
|
68737
|
+
/* stripLiterals */
|
|
68738
|
+
false
|
|
68739
|
+
));
|
|
68740
|
+
}
|
|
68741
|
+
return { type, expectedTypeDiagAddendum, isIncomplete };
|
|
68742
|
+
}
|
|
68743
|
+
function getTypeOfTupleInferred(evaluator, node, flags) {
|
|
68744
|
+
const entryTypeResults = node.d.items.map((expr) => evaluator.getTypeOfExpression(
|
|
68745
|
+
expr,
|
|
68746
|
+
flags | 268435456
|
|
68747
|
+
/* EvalFlags.StripTupleLiterals */
|
|
68748
|
+
));
|
|
68749
|
+
const isIncomplete = entryTypeResults.some((result) => result.isIncomplete);
|
|
68750
|
+
if (node.d.items.length > maxInferredTupleEntryCount) {
|
|
68751
|
+
return { type: makeTupleObject(evaluator, [{ type: types_1.UnknownType.create(), isUnbounded: true }]) };
|
|
68752
|
+
}
|
|
68753
|
+
const type = makeTupleObject(evaluator, evaluator.buildTupleTypesList(entryTypeResults, (flags & 268435456) !== 0));
|
|
68754
|
+
if (isIncomplete) {
|
|
68755
|
+
if ((0, typeUtils_1.getContainerDepth)(type) > typeEvaluatorTypes_1.maxInferredContainerDepth) {
|
|
68756
|
+
return { type: types_1.UnknownType.create() };
|
|
68757
|
+
}
|
|
68758
|
+
}
|
|
68759
|
+
return { type, isIncomplete };
|
|
68760
|
+
}
|
|
68381
68761
|
function assignTupleTypeArgs(evaluator, destType, srcType, diag, constraints, flags, recursionCount) {
|
|
68382
68762
|
var _a, _b;
|
|
68383
68763
|
const destTypeArgs = [...(_a = destType.priv.tupleTypeArgs) !== null && _a !== void 0 ? _a : []];
|
|
@@ -68429,9 +68809,9 @@ var require_tuples = __commonJS({
|
|
|
68429
68809
|
return true;
|
|
68430
68810
|
}
|
|
68431
68811
|
function adjustTupleTypeArgs(evaluator, destTypeArgs, srcTypeArgs, flags) {
|
|
68432
|
-
const destUnboundedOrVariadicIndex = destTypeArgs.findIndex((t) => t.isUnbounded || (0, types_1.
|
|
68812
|
+
const destUnboundedOrVariadicIndex = destTypeArgs.findIndex((t) => t.isUnbounded || (0, types_1.isUnpackedTypeVarTuple)(t.type) || (0, types_1.isUnpackedTypeVar)(t.type));
|
|
68433
68813
|
const srcUnboundedIndex = srcTypeArgs.findIndex((t) => t.isUnbounded);
|
|
68434
|
-
const srcVariadicIndex = srcTypeArgs.findIndex((t) => (0, types_1.
|
|
68814
|
+
const srcVariadicIndex = srcTypeArgs.findIndex((t) => (0, types_1.isUnpackedTypeVarTuple)(t.type) || (0, types_1.isUnpackedTypeVar)(t.type));
|
|
68435
68815
|
if (srcUnboundedIndex >= 0) {
|
|
68436
68816
|
if ((0, types_1.isAnyOrUnknown)(srcTypeArgs[srcUnboundedIndex].type)) {
|
|
68437
68817
|
const typeToReplicate = srcTypeArgs.length > 0 ? srcTypeArgs[srcUnboundedIndex].type : types_1.AnyType.create();
|
|
@@ -68858,6 +69238,7 @@ var require_typePrinter = __commonJS({
|
|
|
68858
69238
|
PrintTypeFlags2[PrintTypeFlags2["ExpandTypedDictArgs"] = 1024] = "ExpandTypedDictArgs";
|
|
68859
69239
|
PrintTypeFlags2[PrintTypeFlags2["PrintTypeVarVariance"] = 2048] = "PrintTypeVarVariance";
|
|
68860
69240
|
PrintTypeFlags2[PrintTypeFlags2["UseFullyQualifiedNames"] = 4096] = "UseFullyQualifiedNames";
|
|
69241
|
+
PrintTypeFlags2[PrintTypeFlags2["OmitTypeVarScopes"] = 8192] = "OmitTypeVarScopes";
|
|
68861
69242
|
})(PrintTypeFlags || (exports2.PrintTypeFlags = PrintTypeFlags = {}));
|
|
68862
69243
|
function printType(type, printTypeFlags, returnTypeCallback) {
|
|
68863
69244
|
const uniqueNameMap = new UniqueNameMap(printTypeFlags, returnTypeCallback);
|
|
@@ -69107,10 +69488,10 @@ var require_typePrinter = __commonJS({
|
|
|
69107
69488
|
if (types_1.TypeVarType.isSelf(type) && type.shared.boundType) {
|
|
69108
69489
|
let boundTypeString = printTypeInternal(type.shared.boundType, printTypeFlags & ~32, returnTypeCallback, uniqueNameMap, recursionTypes, recursionCount);
|
|
69109
69490
|
if (!(0, types_1.isAnyOrUnknown)(type.shared.boundType)) {
|
|
69110
|
-
if (printTypeFlags & 256) {
|
|
69111
|
-
boundTypeString = `Self`;
|
|
69112
|
-
} else {
|
|
69491
|
+
if ((printTypeFlags & 256) === 0 && (printTypeFlags & 8192) === 0) {
|
|
69113
69492
|
boundTypeString = `Self@${boundTypeString}`;
|
|
69493
|
+
} else {
|
|
69494
|
+
boundTypeString = `Self`;
|
|
69114
69495
|
}
|
|
69115
69496
|
}
|
|
69116
69497
|
if (types_1.TypeBase.isInstantiable(type)) {
|
|
@@ -69121,20 +69502,18 @@ var require_typePrinter = __commonJS({
|
|
|
69121
69502
|
return (printTypeFlags & (1 | 256)) !== 0 ? "Any" : "Unknown";
|
|
69122
69503
|
}
|
|
69123
69504
|
if ((0, types_1.isParamSpec)(type)) {
|
|
69124
|
-
const paramSpecText = _getReadableTypeVarName(type, (printTypeFlags & 256)
|
|
69505
|
+
const paramSpecText = _getReadableTypeVarName(type, (printTypeFlags & 256) === 0 && (printTypeFlags & 8192) === 0);
|
|
69125
69506
|
if (type.priv.paramSpecAccess) {
|
|
69126
69507
|
return `${paramSpecText}.${type.priv.paramSpecAccess}`;
|
|
69127
69508
|
}
|
|
69128
69509
|
return paramSpecText;
|
|
69129
69510
|
}
|
|
69130
|
-
let typeVarName = _getReadableTypeVarName(type, (printTypeFlags & 256)
|
|
69131
|
-
if (
|
|
69132
|
-
|
|
69133
|
-
|
|
69134
|
-
|
|
69135
|
-
|
|
69136
|
-
typeVarName = `Union[${typeVarName}]`;
|
|
69137
|
-
}
|
|
69511
|
+
let typeVarName = _getReadableTypeVarName(type, (printTypeFlags & 256) === 0 && (printTypeFlags & 8192) === 0);
|
|
69512
|
+
if (type.priv.isUnpacked) {
|
|
69513
|
+
typeVarName = _printUnpack(typeVarName, printTypeFlags);
|
|
69514
|
+
}
|
|
69515
|
+
if ((0, types_1.isTypeVarTuple)(type) && type.priv.isInUnion) {
|
|
69516
|
+
typeVarName = `Union[${typeVarName}]`;
|
|
69138
69517
|
}
|
|
69139
69518
|
if (types_1.TypeBase.isInstantiable(type)) {
|
|
69140
69519
|
typeVarName = `${_printNestedInstantiable(type, typeVarName)}`;
|
|
@@ -69539,11 +69918,8 @@ var require_typePrinter = __commonJS({
|
|
|
69539
69918
|
}
|
|
69540
69919
|
return textToWrap;
|
|
69541
69920
|
}
|
|
69542
|
-
function _getReadableTypeVarName(type,
|
|
69543
|
-
|
|
69544
|
-
return type.shared.name;
|
|
69545
|
-
}
|
|
69546
|
-
return types_1.TypeVarType.getReadableName(type);
|
|
69921
|
+
function _getReadableTypeVarName(type, includeScope) {
|
|
69922
|
+
return types_1.TypeVarType.getReadableName(type, includeScope);
|
|
69547
69923
|
}
|
|
69548
69924
|
function _getTypeVarVarianceText(type) {
|
|
69549
69925
|
var _a;
|
|
@@ -69794,9 +70170,8 @@ var require_typeEvaluator = __commonJS({
|
|
|
69794
70170
|
var maxEffectiveTypeEvaluationAttempts = 16;
|
|
69795
70171
|
var maxOverloadUnionExpansionCount = 64;
|
|
69796
70172
|
var maxInferFunctionReturnRecursionCount = 12;
|
|
69797
|
-
var maxInferredContainerDepth = 8;
|
|
69798
|
-
var maxInferredTupleEntryCount = 256;
|
|
69799
70173
|
var maxRecursiveTypeAliasRecursionCount = 10;
|
|
70174
|
+
var maxTypedDeclsPerSymbol = 16;
|
|
69800
70175
|
var verifyTypeCacheEvaluatorFlags = false;
|
|
69801
70176
|
var printExpressionTypes = false;
|
|
69802
70177
|
exports2.maxCodeComplexity = 768;
|
|
@@ -70209,7 +70584,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
70209
70584
|
break;
|
|
70210
70585
|
}
|
|
70211
70586
|
case 52: {
|
|
70212
|
-
typeResult = getTypeOfTuple(node, flags, inferenceContext);
|
|
70587
|
+
typeResult = (0, tuples_1.getTypeOfTuple)(evaluatorInterface, node, flags, inferenceContext);
|
|
70213
70588
|
break;
|
|
70214
70589
|
}
|
|
70215
70590
|
case 14: {
|
|
@@ -70433,8 +70808,13 @@ var require_typeEvaluator = __commonJS({
|
|
|
70433
70808
|
true
|
|
70434
70809
|
) };
|
|
70435
70810
|
} else {
|
|
70436
|
-
|
|
70437
|
-
|
|
70811
|
+
if ((flags & 256) !== 0 && (flags & 65536) === 0) {
|
|
70812
|
+
addDiagnostic(diagnosticRules_1.DiagnosticRule.reportInvalidTypeForm, localize_1.LocMessage.ellipsisContext(), node);
|
|
70813
|
+
typeResult = { type: types_1.UnknownType.create() };
|
|
70814
|
+
} else {
|
|
70815
|
+
const ellipsisType = (_b = (_a = getBuiltInObject(node, "EllipsisType")) !== null && _a !== void 0 ? _a : getBuiltInObject(node, "ellipsis")) !== null && _b !== void 0 ? _b : types_1.AnyType.create();
|
|
70816
|
+
typeResult = { type: ellipsisType };
|
|
70817
|
+
}
|
|
70438
70818
|
}
|
|
70439
70819
|
return typeResult;
|
|
70440
70820
|
}
|
|
@@ -70462,7 +70842,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
70462
70842
|
const iterType = iterTypeResult.type;
|
|
70463
70843
|
if ((flags & 64) === 0 && (0, types_1.isTypeVarTuple)(iterType) && !iterType.priv.isUnpacked) {
|
|
70464
70844
|
typeResult = { type: types_1.TypeVarType.cloneForUnpacked(iterType) };
|
|
70465
|
-
} else if ((flags &
|
|
70845
|
+
} else if ((flags & 4194304) !== 0 && (0, types_1.isInstantiableClass)(iterType) && types_1.ClassType.isBuiltIn(iterType, "tuple")) {
|
|
70466
70846
|
typeResult = { type: types_1.ClassType.cloneForUnpacked(iterType) };
|
|
70467
70847
|
} else if ((flags & 256) !== 0) {
|
|
70468
70848
|
addDiagnostic(diagnosticRules_1.DiagnosticRule.reportInvalidTypeForm, localize_1.LocMessage.unpackInAnnotation(), node, node.d.starToken);
|
|
@@ -70561,7 +70941,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
70561
70941
|
const reportTypeErrors = (flags & 8) !== 0;
|
|
70562
70942
|
let updatedFlags = flags | 4 | 128;
|
|
70563
70943
|
let typeResult;
|
|
70564
|
-
if ((flags &
|
|
70944
|
+
if ((flags & 16777216) === 0) {
|
|
70565
70945
|
updatedFlags |= 524288;
|
|
70566
70946
|
}
|
|
70567
70947
|
updatedFlags &= ~1073741824;
|
|
@@ -70660,7 +71040,6 @@ var require_typeEvaluator = __commonJS({
|
|
|
70660
71040
|
}
|
|
70661
71041
|
}
|
|
70662
71042
|
return (0, typeUtils_1.mapSubtypes)(type, (subtype) => {
|
|
70663
|
-
var _a2;
|
|
70664
71043
|
if ((0, types_1.isClass)(subtype)) {
|
|
70665
71044
|
if (subtype.priv.literalValue !== void 0) {
|
|
70666
71045
|
subtype = types_1.ClassType.cloneWithLiteral(
|
|
@@ -70672,9 +71051,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
70672
71051
|
if (types_1.ClassType.isBuiltIn(subtype, "LiteralString")) {
|
|
70673
71052
|
if (strClass && (0, types_1.isInstantiableClass)(strClass)) {
|
|
70674
71053
|
let strInstance = types_1.ClassType.cloneAsInstance(strClass);
|
|
70675
|
-
|
|
70676
|
-
strInstance = types_1.TypeBase.cloneForCondition(strInstance, (0, typeUtils_1.getTypeCondition)(subtype));
|
|
70677
|
-
}
|
|
71054
|
+
strInstance = types_1.TypeBase.cloneForCondition(strInstance, (0, typeUtils_1.getTypeCondition)(subtype));
|
|
70678
71055
|
return strInstance;
|
|
70679
71056
|
}
|
|
70680
71057
|
}
|
|
@@ -71021,10 +71398,6 @@ var require_typeEvaluator = __commonJS({
|
|
|
71021
71398
|
return void 0;
|
|
71022
71399
|
}
|
|
71023
71400
|
function getBoundMagicMethod(classType, memberName, selfType, diag, recursionCount = 0) {
|
|
71024
|
-
if (recursionCount > types_1.maxTypeRecursionCount) {
|
|
71025
|
-
return void 0;
|
|
71026
|
-
}
|
|
71027
|
-
recursionCount++;
|
|
71028
71401
|
const boundMethodResult = getTypeOfBoundMember(
|
|
71029
71402
|
/* errorNode */
|
|
71030
71403
|
void 0,
|
|
@@ -71044,6 +71417,10 @@ var require_typeEvaluator = __commonJS({
|
|
|
71044
71417
|
return boundMethodResult.type;
|
|
71045
71418
|
}
|
|
71046
71419
|
if ((0, types_1.isClassInstance)(boundMethodResult.type)) {
|
|
71420
|
+
if (recursionCount > types_1.maxTypeRecursionCount) {
|
|
71421
|
+
return void 0;
|
|
71422
|
+
}
|
|
71423
|
+
recursionCount++;
|
|
71047
71424
|
return getBoundMagicMethod(boundMethodResult.type, "__call__", selfType !== null && selfType !== void 0 ? selfType : types_1.ClassType.cloneAsInstance(classType), diag, recursionCount);
|
|
71048
71425
|
}
|
|
71049
71426
|
if ((0, types_1.isAnyOrUnknown)(boundMethodResult.type)) {
|
|
@@ -71799,7 +72176,10 @@ var require_typeEvaluator = __commonJS({
|
|
|
71799
72176
|
const isTypeAlias = !!declaredType && (0, types_1.isClassInstance)(declaredType) && types_1.ClassType.isBuiltIn(declaredType, "TypeAlias");
|
|
71800
72177
|
if (declaredType && !isTypeAlias) {
|
|
71801
72178
|
let diagAddendum = new diagnostic_1.DiagnosticAddendum();
|
|
71802
|
-
|
|
72179
|
+
const liveScopeIds = ParseTreeUtils.getTypeVarScopesForNode(nameNode);
|
|
72180
|
+
const boundDeclaredType = (0, typeUtils_1.makeTypeVarsBound)(declaredType, liveScopeIds);
|
|
72181
|
+
const srcType = (0, typeUtils_1.makeTypeVarsBound)(typeResult.type, liveScopeIds);
|
|
72182
|
+
if (!assignType(boundDeclaredType, srcType, diagAddendum)) {
|
|
71803
72183
|
if (expectedTypeDiagAddendum) {
|
|
71804
72184
|
diagAddendum = expectedTypeDiagAddendum;
|
|
71805
72185
|
}
|
|
@@ -72039,12 +72419,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
72039
72419
|
var _a, _b;
|
|
72040
72420
|
const tupleType = (0, typeUtils_1.getSpecializedTupleType)(subtype);
|
|
72041
72421
|
if (tupleType && tupleType.priv.tupleTypeArgs) {
|
|
72042
|
-
const sourceEntryTypes = tupleType.priv.tupleTypeArgs.map((t) => (0, typeUtils_1.addConditionToType)(
|
|
72043
|
-
t.type,
|
|
72044
|
-
(0, typeUtils_1.getTypeCondition)(subtype),
|
|
72045
|
-
/* skipSelfCondition */
|
|
72046
|
-
true
|
|
72047
|
-
));
|
|
72422
|
+
const sourceEntryTypes = tupleType.priv.tupleTypeArgs.map((t) => (0, typeUtils_1.addConditionToType)(t.type, (0, typeUtils_1.getTypeCondition)(subtype), { skipSelfCondition: true }));
|
|
72048
72423
|
const unboundedIndex = tupleType.priv.tupleTypeArgs.findIndex((t) => t.isUnbounded);
|
|
72049
72424
|
if (unboundedIndex >= 0) {
|
|
72050
72425
|
if (sourceEntryTypes.length < targetTypes.length) {
|
|
@@ -72150,7 +72525,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
72150
72525
|
var _a;
|
|
72151
72526
|
if ((0, types_1.isParamSpec)(subtype)) {
|
|
72152
72527
|
if (subtype.priv.paramSpecAccess === "args") {
|
|
72153
|
-
return makeTupleObject([{ type: getObjectType(), isUnbounded: true }]);
|
|
72528
|
+
return (0, tuples_1.makeTupleObject)(evaluatorInterface, [{ type: getObjectType(), isUnbounded: true }]);
|
|
72154
72529
|
} else if (subtype.priv.paramSpecAccess === "kwargs") {
|
|
72155
72530
|
if (dictClass && (0, types_1.isInstantiableClass)(dictClass) && strClass && (0, types_1.isInstantiableClass)(strClass)) {
|
|
72156
72531
|
return types_1.ClassType.cloneAsInstance(types_1.ClassType.specialize(dictClass, [(0, typeUtils_1.convertToInstance)(strClass), getObjectType()]));
|
|
@@ -72175,7 +72550,8 @@ var require_typeEvaluator = __commonJS({
|
|
|
72175
72550
|
}
|
|
72176
72551
|
return types_1.AnyType.create();
|
|
72177
72552
|
}
|
|
72178
|
-
return makeTupleObject(
|
|
72553
|
+
return (0, tuples_1.makeTupleObject)(
|
|
72554
|
+
evaluatorInterface,
|
|
72179
72555
|
[{ type: getObjectType(), isUnbounded: true }],
|
|
72180
72556
|
/* isUnpacked */
|
|
72181
72557
|
true
|
|
@@ -72211,6 +72587,9 @@ var require_typeEvaluator = __commonJS({
|
|
|
72211
72587
|
useBoundTypeVars: types_1.TypeVarType.isBound(subtype)
|
|
72212
72588
|
});
|
|
72213
72589
|
}
|
|
72590
|
+
if (subtype.priv.isUnpacked && (0, types_1.isClass)(boundType)) {
|
|
72591
|
+
boundType = types_1.ClassType.cloneForUnpacked(boundType);
|
|
72592
|
+
}
|
|
72214
72593
|
boundType = types_1.TypeBase.isInstantiable(subtype) ? (0, typeUtils_1.convertToInstantiable)(boundType) : boundType;
|
|
72215
72594
|
return (0, typeUtils_1.addConditionToType)(boundType, [{ typeVar: subtype, constraintIndex: 0 }]);
|
|
72216
72595
|
}
|
|
@@ -72381,11 +72760,15 @@ var require_typeEvaluator = __commonJS({
|
|
|
72381
72760
|
break;
|
|
72382
72761
|
}
|
|
72383
72762
|
case 54: {
|
|
72384
|
-
|
|
72763
|
+
let annotationType = getTypeOfAnnotation(target.d.annotation, {
|
|
72385
72764
|
varTypeAnnotation: true,
|
|
72386
72765
|
allowFinal: ParseTreeUtils.isFinalAllowedForAssignmentTarget(target.d.valueExpr),
|
|
72387
72766
|
allowClassVar: ParseTreeUtils.isClassVarAllowedForAssignmentTarget(target.d.valueExpr)
|
|
72388
72767
|
});
|
|
72768
|
+
if (annotationType) {
|
|
72769
|
+
const liveScopeIds = ParseTreeUtils.getTypeVarScopesForNode(target);
|
|
72770
|
+
annotationType = (0, typeUtils_1.makeTypeVarsBound)(annotationType, liveScopeIds);
|
|
72771
|
+
}
|
|
72389
72772
|
const isBareFinalOrClassVar = (0, types_1.isClassInstance)(annotationType) && (types_1.ClassType.isBuiltIn(annotationType, "Final") || types_1.ClassType.isBuiltIn(annotationType, "ClassVar"));
|
|
72390
72773
|
if (!isBareFinalOrClassVar) {
|
|
72391
72774
|
const isTypeAliasAnnotation = (0, types_1.isClassInstance)(annotationType) && types_1.ClassType.isBuiltIn(annotationType, "TypeAlias");
|
|
@@ -72657,6 +73040,9 @@ var require_typeEvaluator = __commonJS({
|
|
|
72657
73040
|
if ((flags & 256) !== 0) {
|
|
72658
73041
|
type = validateSymbolIsTypeExpression(node, type, !!effectiveTypeInfo.includesVariableDecl);
|
|
72659
73042
|
}
|
|
73043
|
+
if ((0, types_1.isTypeVar)(type) && !type.shared.isSynthesized) {
|
|
73044
|
+
type = validateTypeVarUsage(node, type, flags);
|
|
73045
|
+
}
|
|
72660
73046
|
type = addTypeFormForSymbol(node, type, flags, !!effectiveTypeInfo.includesVariableDecl);
|
|
72661
73047
|
} else {
|
|
72662
73048
|
if (name === "reveal_type" || name === "reveal_locals") {
|
|
@@ -72666,7 +73052,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
72666
73052
|
type = types_1.UnknownType.create();
|
|
72667
73053
|
}
|
|
72668
73054
|
}
|
|
72669
|
-
if ((0, types_1.isParamSpec)(type)) {
|
|
73055
|
+
if ((0, types_1.isParamSpec)(type) && type.priv.scopeId) {
|
|
72670
73056
|
if (flags & 32) {
|
|
72671
73057
|
addDiagnostic(diagnosticRules_1.DiagnosticRule.reportInvalidTypeForm, localize_1.LocMessage.paramSpecContext(), node);
|
|
72672
73058
|
type = types_1.UnknownType.create();
|
|
@@ -72683,9 +73069,6 @@ var require_typeEvaluator = __commonJS({
|
|
|
72683
73069
|
}
|
|
72684
73070
|
}
|
|
72685
73071
|
}
|
|
72686
|
-
if ((0, types_1.isTypeVar)(type) && !type.shared.isSynthesized) {
|
|
72687
|
-
type = validateTypeVarUsage(node, type, flags);
|
|
72688
|
-
}
|
|
72689
73072
|
return { type, isIncomplete };
|
|
72690
73073
|
}
|
|
72691
73074
|
function addTypeFormForSymbol(node, type, flags, includesVarDecl) {
|
|
@@ -72736,7 +73119,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
72736
73119
|
if ((0, typeUtils_1.isTypeAliasPlaceholder)(type)) {
|
|
72737
73120
|
return true;
|
|
72738
73121
|
}
|
|
72739
|
-
if ((0, types_1.isTypeVar)(type)
|
|
73122
|
+
if ((0, types_1.isTypeVar)(type)) {
|
|
72740
73123
|
return true;
|
|
72741
73124
|
}
|
|
72742
73125
|
if ((0, types_1.isClass)(type) && !type.priv.includeSubclasses && types_1.ClassType.isValidTypeAliasClass(type)) {
|
|
@@ -72926,7 +73309,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
72926
73309
|
if (type.priv.scopeId && !scopedTypeVarInfo.foundInterveningClass) {
|
|
72927
73310
|
return type;
|
|
72928
73311
|
}
|
|
72929
|
-
if (!type.shared.isSynthesized) {
|
|
73312
|
+
if (!type.shared.isSynthesized && (flags & 128) !== 0) {
|
|
72930
73313
|
const message = (0, types_1.isParamSpec)(type) ? localize_1.LocMessage.paramSpecNotUsedByOuterScope() : localize_1.LocMessage.typeVarNotUsedByOuterScope();
|
|
72931
73314
|
addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, message.format({ name: type.shared.name }), node);
|
|
72932
73315
|
}
|
|
@@ -72982,7 +73365,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
72982
73365
|
return type;
|
|
72983
73366
|
}
|
|
72984
73367
|
function findScopedTypeVar(node, type) {
|
|
72985
|
-
var _a;
|
|
73368
|
+
var _a, _b;
|
|
72986
73369
|
let curNode = node;
|
|
72987
73370
|
let nestedClassCount = 0;
|
|
72988
73371
|
(0, debug_1.assert)(types_1.TypeBase.isInstantiable(type));
|
|
@@ -73047,13 +73430,13 @@ var require_typeEvaluator = __commonJS({
|
|
|
73047
73430
|
}
|
|
73048
73431
|
if (leftType && scopeNode) {
|
|
73049
73432
|
if (leftType && (0, types_1.isTypeVar)(leftType) && leftType.shared.recursiveAlias) {
|
|
73050
|
-
if (typeAliasNode && !type.shared.isTypeParamSyntax) {
|
|
73433
|
+
if (typeAliasNode && !type.shared.isTypeParamSyntax && !((_a = type.props) === null || _a === void 0 ? void 0 : _a.typeAliasInfo)) {
|
|
73051
73434
|
addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.typeParameterNotDeclared().format({
|
|
73052
73435
|
name: type.shared.name,
|
|
73053
73436
|
container: typeAliasNode.d.name.d.value
|
|
73054
73437
|
}), node);
|
|
73055
73438
|
} else {
|
|
73056
|
-
const allowedTypeParams = (
|
|
73439
|
+
const allowedTypeParams = (_b = leftType.shared.recursiveAlias) === null || _b === void 0 ? void 0 : _b.typeParams;
|
|
73057
73440
|
if (allowedTypeParams) {
|
|
73058
73441
|
if (!allowedTypeParams.some((param) => param.shared.name === type.shared.name)) {
|
|
73059
73442
|
return { type, scopeNode, foundInterveningClass: false };
|
|
@@ -73296,12 +73679,10 @@ var require_typeEvaluator = __commonJS({
|
|
|
73296
73679
|
}
|
|
73297
73680
|
if (typeResult) {
|
|
73298
73681
|
if (!typeResult.typeErrors) {
|
|
73299
|
-
type = (0, typeUtils_1.addConditionToType)(
|
|
73300
|
-
|
|
73301
|
-
|
|
73302
|
-
|
|
73303
|
-
true
|
|
73304
|
-
);
|
|
73682
|
+
type = (0, typeUtils_1.addConditionToType)(typeResult.type, (0, typeUtils_1.getTypeCondition)(baseType), {
|
|
73683
|
+
skipSelfCondition: true,
|
|
73684
|
+
skipBoundTypeVars: true
|
|
73685
|
+
});
|
|
73305
73686
|
} else {
|
|
73306
73687
|
typeErrors = true;
|
|
73307
73688
|
}
|
|
@@ -73312,12 +73693,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
73312
73693
|
isIncomplete = true;
|
|
73313
73694
|
}
|
|
73314
73695
|
if (typeResult.narrowedTypeForSet) {
|
|
73315
|
-
narrowedTypeForSet = (0, typeUtils_1.addConditionToType)(
|
|
73316
|
-
typeResult.narrowedTypeForSet,
|
|
73317
|
-
(0, typeUtils_1.getTypeCondition)(baseType),
|
|
73318
|
-
/* skipSelfCondition */
|
|
73319
|
-
true
|
|
73320
|
-
);
|
|
73696
|
+
narrowedTypeForSet = (0, typeUtils_1.addConditionToType)(typeResult.narrowedTypeForSet, (0, typeUtils_1.getTypeCondition)(baseType), { skipSelfCondition: true, skipBoundTypeVars: true });
|
|
73321
73697
|
}
|
|
73322
73698
|
if (typeResult.memberAccessDeprecationInfo) {
|
|
73323
73699
|
memberAccessDeprecationInfo = typeResult.memberAccessDeprecationInfo;
|
|
@@ -73403,7 +73779,9 @@ var require_typeEvaluator = __commonJS({
|
|
|
73403
73779
|
(0, debug_1.assert)((0, types_1.isClassInstance)(subtype));
|
|
73404
73780
|
const typeResult2 = getTypeOfBoundMember(node.d.member, subtype, memberName, usage, diag);
|
|
73405
73781
|
if (typeResult2 && !typeResult2.typeErrors) {
|
|
73406
|
-
type = (0, typeUtils_1.addConditionToType)(typeResult2.type, (0, typeUtils_1.getTypeCondition)(baseType)
|
|
73782
|
+
type = (0, typeUtils_1.addConditionToType)(typeResult2.type, (0, typeUtils_1.getTypeCondition)(baseType), {
|
|
73783
|
+
skipBoundTypeVars: true
|
|
73784
|
+
});
|
|
73407
73785
|
if (typeResult2.isIncomplete) {
|
|
73408
73786
|
isIncomplete = true;
|
|
73409
73787
|
}
|
|
@@ -74176,7 +74554,8 @@ var require_typeEvaluator = __commonJS({
|
|
|
74176
74554
|
}
|
|
74177
74555
|
});
|
|
74178
74556
|
}
|
|
74179
|
-
const tupleObject = makeTupleObject(
|
|
74557
|
+
const tupleObject = (0, tuples_1.makeTupleObject)(
|
|
74558
|
+
evaluatorInterface,
|
|
74180
74559
|
variadicTypes,
|
|
74181
74560
|
/* isUnpacked */
|
|
74182
74561
|
true
|
|
@@ -74190,7 +74569,8 @@ var require_typeEvaluator = __commonJS({
|
|
|
74190
74569
|
} else if (!variadicTypeVar.shared.isDefaultExplicit) {
|
|
74191
74570
|
typeArgs.push({
|
|
74192
74571
|
node: errorNode,
|
|
74193
|
-
type: makeTupleObject(
|
|
74572
|
+
type: (0, tuples_1.makeTupleObject)(
|
|
74573
|
+
evaluatorInterface,
|
|
74194
74574
|
[],
|
|
74195
74575
|
/* isUnpacked */
|
|
74196
74576
|
true
|
|
@@ -74235,7 +74615,8 @@ var require_typeEvaluator = __commonJS({
|
|
|
74235
74615
|
}
|
|
74236
74616
|
});
|
|
74237
74617
|
} else if ((0, types_1.isTypeVarTuple)(param) && tupleClass && (0, types_1.isInstantiableClass)(tupleClass)) {
|
|
74238
|
-
defaultType = makeTupleObject(
|
|
74618
|
+
defaultType = (0, tuples_1.makeTupleObject)(
|
|
74619
|
+
evaluatorInterface,
|
|
74239
74620
|
[{ type: types_1.UnknownType.create(), isUnbounded: true }],
|
|
74240
74621
|
/* isUnpacked */
|
|
74241
74622
|
true
|
|
@@ -74278,18 +74659,13 @@ var require_typeEvaluator = __commonJS({
|
|
|
74278
74659
|
}
|
|
74279
74660
|
inferVarianceForTypeAlias(baseType);
|
|
74280
74661
|
const typeParams = aliasInfo.shared.typeParams;
|
|
74281
|
-
let typeArgs
|
|
74662
|
+
let typeArgs;
|
|
74663
|
+
typeArgs = adjustTypeArgsForTypeVarTuple(getTypeArgs(node, flags), typeParams, node);
|
|
74282
74664
|
let reportedError = false;
|
|
74283
|
-
|
|
74284
|
-
|
|
74285
|
-
|
|
74286
|
-
|
|
74287
|
-
type: types_1.UnknownType.create(),
|
|
74288
|
-
node: typeArgs.length > 0 ? typeArgs[0].node : node,
|
|
74289
|
-
typeList: typeArgs
|
|
74290
|
-
}
|
|
74291
|
-
];
|
|
74292
|
-
}
|
|
74665
|
+
typeArgs = transformTypeArgsForParamSpec(typeParams, typeArgs, node);
|
|
74666
|
+
if (!typeArgs) {
|
|
74667
|
+
typeArgs = [];
|
|
74668
|
+
reportedError = true;
|
|
74293
74669
|
}
|
|
74294
74670
|
let minTypeArgCount = typeParams.length;
|
|
74295
74671
|
const firstDefaultParamIndex = typeParams.findIndex((param) => !!param.shared.isDefaultExplicit);
|
|
@@ -74326,8 +74702,12 @@ var require_typeEvaluator = __commonJS({
|
|
|
74326
74702
|
65536
|
|
74327
74703
|
/* FunctionTypeFlags.ParamSpecValue */
|
|
74328
74704
|
);
|
|
74329
|
-
typeList.forEach((
|
|
74330
|
-
|
|
74705
|
+
typeList.forEach((paramTypeResult, paramIndex) => {
|
|
74706
|
+
let paramType = paramTypeResult.type;
|
|
74707
|
+
if (!validateTypeArg(paramTypeResult)) {
|
|
74708
|
+
paramType = types_1.UnknownType.create();
|
|
74709
|
+
}
|
|
74710
|
+
types_1.FunctionType.addParam(functionType, types_1.FunctionParam.create(0, (0, typeUtils_1.convertToInstance)(paramType), types_1.FunctionParamFlags.NameSynthesized | types_1.FunctionParamFlags.TypeDeclared, `__p${paramIndex}`));
|
|
74331
74711
|
});
|
|
74332
74712
|
if (typeList.length > 0) {
|
|
74333
74713
|
types_1.FunctionType.addPositionOnlyParamSeparator(functionType);
|
|
@@ -74659,13 +75039,14 @@ var require_typeEvaluator = __commonJS({
|
|
|
74659
75039
|
);
|
|
74660
75040
|
return usageVariances;
|
|
74661
75041
|
}
|
|
74662
|
-
function updateUsageVariancesRecursive(type, typeAliasTypeParams, usageVariances, varianceContext, recursionCount = 0) {
|
|
75042
|
+
function updateUsageVariancesRecursive(type, typeAliasTypeParams, usageVariances, varianceContext, pendingTypes = [], recursionCount = 0) {
|
|
74663
75043
|
if (recursionCount > types_1.maxTypeRecursionCount) {
|
|
74664
75044
|
return;
|
|
74665
75045
|
}
|
|
74666
75046
|
const transformedType = (0, typeUtils_1.transformPossibleRecursiveTypeAlias)(type);
|
|
74667
75047
|
if (transformedType !== type) {
|
|
74668
|
-
|
|
75048
|
+
const pendingOverlaps = pendingTypes.filter((pendingType) => (0, types_1.isTypeSame)(pendingType, type));
|
|
75049
|
+
if (pendingOverlaps.length > 1) {
|
|
74669
75050
|
return;
|
|
74670
75051
|
}
|
|
74671
75052
|
}
|
|
@@ -74676,7 +75057,9 @@ var require_typeEvaluator = __commonJS({
|
|
|
74676
75057
|
if (typeParamIndex >= 0) {
|
|
74677
75058
|
usageVariances[typeParamIndex] = (0, typeUtils_1.combineVariances)(usageVariances[typeParamIndex], variance);
|
|
74678
75059
|
} else {
|
|
74679
|
-
|
|
75060
|
+
pendingTypes.push(type2);
|
|
75061
|
+
updateUsageVariancesRecursive(subtype, typeAliasTypeParams, usageVariances, variance, pendingTypes, recursionCount);
|
|
75062
|
+
pendingTypes.pop();
|
|
74680
75063
|
}
|
|
74681
75064
|
});
|
|
74682
75065
|
}
|
|
@@ -74717,18 +75100,6 @@ var require_typeEvaluator = __commonJS({
|
|
|
74717
75100
|
}
|
|
74718
75101
|
});
|
|
74719
75102
|
}
|
|
74720
|
-
function makeTupleObject(typeArgs, isUnpacked = false) {
|
|
74721
|
-
if (tupleClass && (0, types_1.isInstantiableClass)(tupleClass)) {
|
|
74722
|
-
return (0, typeUtils_1.convertToInstance)((0, typeUtils_1.specializeTupleClass)(
|
|
74723
|
-
tupleClass,
|
|
74724
|
-
typeArgs,
|
|
74725
|
-
/* isTypeArgExplicit */
|
|
74726
|
-
true,
|
|
74727
|
-
isUnpacked
|
|
74728
|
-
));
|
|
74729
|
-
}
|
|
74730
|
-
return types_1.UnknownType.create();
|
|
74731
|
-
}
|
|
74732
75103
|
function getIndexAccessMagicMethodName(usage) {
|
|
74733
75104
|
if (usage.method === "get") {
|
|
74734
75105
|
return "__getitem__";
|
|
@@ -74802,7 +75173,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
74802
75173
|
isPositionalIndexTypeIncomplete = true;
|
|
74803
75174
|
}
|
|
74804
75175
|
} else if (positionalArgs.length === 0 && unpackedListArgs.length === 0) {
|
|
74805
|
-
positionalIndexType = makeTupleObject([]);
|
|
75176
|
+
positionalIndexType = (0, tuples_1.makeTupleObject)(evaluatorInterface, []);
|
|
74806
75177
|
} else {
|
|
74807
75178
|
const tupleTypeArgs = [];
|
|
74808
75179
|
positionalArgs.forEach((arg) => {
|
|
@@ -74826,7 +75197,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
74826
75197
|
)) === null || _a2 === void 0 ? void 0 : _a2.type) !== null && _b2 !== void 0 ? _b2 : types_1.UnknownType.create();
|
|
74827
75198
|
tupleTypeArgs.push({ type: iterableType, isUnbounded: true });
|
|
74828
75199
|
});
|
|
74829
|
-
positionalIndexType = makeTupleObject(tupleTypeArgs);
|
|
75200
|
+
positionalIndexType = (0, tuples_1.makeTupleObject)(evaluatorInterface, tupleTypeArgs);
|
|
74830
75201
|
}
|
|
74831
75202
|
const argList = [
|
|
74832
75203
|
{
|
|
@@ -74917,7 +75288,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
74917
75288
|
if (!(options === null || options === void 0 ? void 0 : options.isAnnotatedClass)) {
|
|
74918
75289
|
adjFlags |= 131072 | 16;
|
|
74919
75290
|
}
|
|
74920
|
-
adjFlags |=
|
|
75291
|
+
adjFlags |= 4194304 | 134217728;
|
|
74921
75292
|
}
|
|
74922
75293
|
const getTypeArgTypeResult = (expr, argIndex) => {
|
|
74923
75294
|
let typeResult;
|
|
@@ -74946,32 +75317,65 @@ var require_typeEvaluator = __commonJS({
|
|
|
74946
75317
|
typeArgs.push(getTypeArgTypeResult(item, index));
|
|
74947
75318
|
});
|
|
74948
75319
|
setTypeResultForNode(node.d.items[0].d.valueExpr, { type: types_1.UnknownType.create() });
|
|
74949
|
-
|
|
74950
|
-
|
|
74951
|
-
|
|
74952
|
-
|
|
74953
|
-
|
|
74954
|
-
|
|
74955
|
-
|
|
74956
|
-
|
|
74957
|
-
|
|
74958
|
-
|
|
74959
|
-
|
|
75320
|
+
return typeArgs;
|
|
75321
|
+
}
|
|
75322
|
+
node.d.items.forEach((arg, index) => {
|
|
75323
|
+
const typeResult = getTypeArgTypeResult(arg.d.valueExpr, index);
|
|
75324
|
+
if (arg.d.argCategory !== 0) {
|
|
75325
|
+
if (arg.d.argCategory === 1) {
|
|
75326
|
+
if (!(options === null || options === void 0 ? void 0 : options.isAnnotatedClass) || index === 0) {
|
|
75327
|
+
const unpackedType = applyUnpackToTupleLike(typeResult.type);
|
|
75328
|
+
if (unpackedType) {
|
|
75329
|
+
typeResult.type = unpackedType;
|
|
75330
|
+
} else {
|
|
75331
|
+
if ((flags & 256) !== 0) {
|
|
74960
75332
|
addDiagnostic(diagnosticRules_1.DiagnosticRule.reportInvalidTypeForm, localize_1.LocMessage.unpackNotAllowed(), arg.d.valueExpr);
|
|
75333
|
+
typeResult.typeErrors = true;
|
|
75334
|
+
} else {
|
|
75335
|
+
typeResult.type = types_1.UnknownType.create();
|
|
74961
75336
|
}
|
|
74962
75337
|
}
|
|
74963
75338
|
}
|
|
74964
75339
|
}
|
|
74965
|
-
|
|
75340
|
+
}
|
|
75341
|
+
if (arg.d.name) {
|
|
75342
|
+
if ((flags & 256) !== 0) {
|
|
74966
75343
|
addDiagnostic(diagnosticRules_1.DiagnosticRule.reportInvalidTypeForm, localize_1.LocMessage.keywordArgInTypeArgument(), arg.d.valueExpr);
|
|
75344
|
+
typeResult.typeErrors = true;
|
|
75345
|
+
} else {
|
|
75346
|
+
typeResult.type = types_1.UnknownType.create();
|
|
74967
75347
|
}
|
|
74968
|
-
|
|
74969
|
-
|
|
74970
|
-
|
|
74971
|
-
}
|
|
74972
|
-
}
|
|
75348
|
+
}
|
|
75349
|
+
if (arg.d.valueExpr.nodeType !== 0 || arg.d.valueExpr.d.category !== 3) {
|
|
75350
|
+
typeArgs.push(typeResult);
|
|
75351
|
+
}
|
|
75352
|
+
});
|
|
74973
75353
|
return typeArgs;
|
|
74974
75354
|
}
|
|
75355
|
+
function applyUnpackToTupleLike(type) {
|
|
75356
|
+
if ((0, types_1.isTypeVarTuple)(type)) {
|
|
75357
|
+
if (!type.priv.isUnpacked) {
|
|
75358
|
+
return types_1.TypeVarType.cloneForUnpacked(type);
|
|
75359
|
+
}
|
|
75360
|
+
return void 0;
|
|
75361
|
+
}
|
|
75362
|
+
if ((0, types_1.isParamSpec)(type)) {
|
|
75363
|
+
return void 0;
|
|
75364
|
+
}
|
|
75365
|
+
if ((0, types_1.isTypeVar)(type)) {
|
|
75366
|
+
const upperBound = type.shared.boundType;
|
|
75367
|
+
if (upperBound && (0, types_1.isClassInstance)(upperBound) && (0, typeUtils_1.isTupleClass)(upperBound)) {
|
|
75368
|
+
return types_1.TypeVarType.cloneForUnpacked(type);
|
|
75369
|
+
}
|
|
75370
|
+
return void 0;
|
|
75371
|
+
}
|
|
75372
|
+
if ((0, types_1.isInstantiableClass)(type) && !type.priv.includeSubclasses) {
|
|
75373
|
+
if ((0, typeUtils_1.isTupleClass)(type)) {
|
|
75374
|
+
return types_1.ClassType.cloneForUnpacked(type);
|
|
75375
|
+
}
|
|
75376
|
+
}
|
|
75377
|
+
return void 0;
|
|
75378
|
+
}
|
|
74975
75379
|
function getTypeArg(node, flags) {
|
|
74976
75380
|
let typeResult;
|
|
74977
75381
|
let adjustedFlags = flags | 128 | 1 | 8;
|
|
@@ -75001,132 +75405,6 @@ var require_typeEvaluator = __commonJS({
|
|
|
75001
75405
|
}
|
|
75002
75406
|
return typeResult;
|
|
75003
75407
|
}
|
|
75004
|
-
function getTypeOfTuple(node, flags, inferenceContext) {
|
|
75005
|
-
var _a;
|
|
75006
|
-
if ((flags & 256) !== 0 && ((_a = node.parent) === null || _a === void 0 ? void 0 : _a.nodeType) !== 1) {
|
|
75007
|
-
const diag = new diagnostic_1.DiagnosticAddendum();
|
|
75008
|
-
diag.addMessage(localize_1.LocAddendum.useTupleInstead());
|
|
75009
|
-
addDiagnostic(diagnosticRules_1.DiagnosticRule.reportInvalidTypeForm, localize_1.LocMessage.tupleInAnnotation() + diag.getString(), node);
|
|
75010
|
-
return { type: types_1.UnknownType.create() };
|
|
75011
|
-
}
|
|
75012
|
-
if ((flags & 128) !== 0 && node.d.items.length === 0 && !inferenceContext) {
|
|
75013
|
-
return { type: makeTupleObject([]), isEmptyTupleShorthand: true };
|
|
75014
|
-
}
|
|
75015
|
-
flags &= ~(256 | 8 | 128);
|
|
75016
|
-
let expectedType = inferenceContext === null || inferenceContext === void 0 ? void 0 : inferenceContext.expectedType;
|
|
75017
|
-
let expectedTypeContainsAny = inferenceContext && (0, types_1.isAny)(inferenceContext.expectedType);
|
|
75018
|
-
if (inferenceContext && (0, types_1.isUnion)(inferenceContext.expectedType)) {
|
|
75019
|
-
let matchingSubtype;
|
|
75020
|
-
(0, typeUtils_1.doForEachSubtype)(
|
|
75021
|
-
inferenceContext.expectedType,
|
|
75022
|
-
(subtype) => {
|
|
75023
|
-
if ((0, types_1.isAny)(subtype)) {
|
|
75024
|
-
expectedTypeContainsAny = true;
|
|
75025
|
-
}
|
|
75026
|
-
if (!matchingSubtype) {
|
|
75027
|
-
const subtypeResult = useSpeculativeMode(node, () => {
|
|
75028
|
-
return getTypeOfTupleWithContext(node, flags, (0, typeUtils_1.makeInferenceContext)(subtype));
|
|
75029
|
-
});
|
|
75030
|
-
if (subtypeResult && assignType(subtype, subtypeResult.type)) {
|
|
75031
|
-
matchingSubtype = subtype;
|
|
75032
|
-
}
|
|
75033
|
-
}
|
|
75034
|
-
},
|
|
75035
|
-
/* sortSubtypes */
|
|
75036
|
-
true
|
|
75037
|
-
);
|
|
75038
|
-
expectedType = matchingSubtype;
|
|
75039
|
-
}
|
|
75040
|
-
let expectedTypeDiagAddendum;
|
|
75041
|
-
if (expectedType) {
|
|
75042
|
-
const result = getTypeOfTupleWithContext(node, flags, (0, typeUtils_1.makeInferenceContext)(expectedType));
|
|
75043
|
-
if (result && !result.typeErrors) {
|
|
75044
|
-
return result;
|
|
75045
|
-
}
|
|
75046
|
-
expectedTypeDiagAddendum = result === null || result === void 0 ? void 0 : result.expectedTypeDiagAddendum;
|
|
75047
|
-
}
|
|
75048
|
-
const typeResult = getTypeOfTupleInferred(node, flags);
|
|
75049
|
-
if (expectedTypeContainsAny) {
|
|
75050
|
-
typeResult.type = types_1.AnyType.create();
|
|
75051
|
-
}
|
|
75052
|
-
return { ...typeResult, expectedTypeDiagAddendum };
|
|
75053
|
-
}
|
|
75054
|
-
function getTypeOfTupleWithContext(node, flags, inferenceContext) {
|
|
75055
|
-
inferenceContext.expectedType = (0, typeUtils_1.transformPossibleRecursiveTypeAlias)(inferenceContext.expectedType);
|
|
75056
|
-
if (!(0, types_1.isClassInstance)(inferenceContext.expectedType)) {
|
|
75057
|
-
return void 0;
|
|
75058
|
-
}
|
|
75059
|
-
if (!tupleClass || !(0, types_1.isInstantiableClass)(tupleClass)) {
|
|
75060
|
-
return void 0;
|
|
75061
|
-
}
|
|
75062
|
-
let expectedTypes = [];
|
|
75063
|
-
if ((0, typeUtils_1.isTupleClass)(inferenceContext.expectedType) && inferenceContext.expectedType.priv.tupleTypeArgs) {
|
|
75064
|
-
expectedTypes = inferenceContext.expectedType.priv.tupleTypeArgs.map((t) => (0, typeUtils_1.transformPossibleRecursiveTypeAlias)(t.type));
|
|
75065
|
-
const unboundedIndex = inferenceContext.expectedType.priv.tupleTypeArgs.findIndex((t) => t.isUnbounded);
|
|
75066
|
-
if (unboundedIndex >= 0) {
|
|
75067
|
-
if (expectedTypes.length > node.d.items.length) {
|
|
75068
|
-
expectedTypes.splice(unboundedIndex, 1);
|
|
75069
|
-
} else {
|
|
75070
|
-
while (expectedTypes.length < node.d.items.length) {
|
|
75071
|
-
expectedTypes.splice(unboundedIndex, 0, expectedTypes[unboundedIndex]);
|
|
75072
|
-
}
|
|
75073
|
-
}
|
|
75074
|
-
}
|
|
75075
|
-
} else {
|
|
75076
|
-
const tupleConstraints = new constraintTracker_1.ConstraintTracker();
|
|
75077
|
-
if (!(0, constraintSolver_1.addConstraintsForExpectedType)(evaluatorInterface, types_1.ClassType.cloneAsInstance(tupleClass), inferenceContext.expectedType, tupleConstraints, ParseTreeUtils.getTypeVarScopesForNode(node), node.start)) {
|
|
75078
|
-
return void 0;
|
|
75079
|
-
}
|
|
75080
|
-
const specializedTuple = solveAndApplyConstraints(tupleClass, tupleConstraints);
|
|
75081
|
-
if (!specializedTuple.priv.typeArgs || specializedTuple.priv.typeArgs.length !== 1) {
|
|
75082
|
-
return void 0;
|
|
75083
|
-
}
|
|
75084
|
-
const homogenousType = (0, typeUtils_1.transformPossibleRecursiveTypeAlias)(specializedTuple.priv.typeArgs[0]);
|
|
75085
|
-
for (let i = 0; i < node.d.items.length; i++) {
|
|
75086
|
-
expectedTypes.push(homogenousType);
|
|
75087
|
-
}
|
|
75088
|
-
}
|
|
75089
|
-
const entryTypeResults = node.d.items.map((expr, index) => getTypeOfExpression(expr, flags | 268435456, (0, typeUtils_1.makeInferenceContext)(index < expectedTypes.length ? expectedTypes[index] : void 0, inferenceContext.isTypeIncomplete)));
|
|
75090
|
-
const isIncomplete = entryTypeResults.some((result) => result.isIncomplete);
|
|
75091
|
-
let expectedTypeDiagAddendum;
|
|
75092
|
-
if (entryTypeResults.some((result) => result.expectedTypeDiagAddendum)) {
|
|
75093
|
-
expectedTypeDiagAddendum = new diagnostic_1.DiagnosticAddendum();
|
|
75094
|
-
entryTypeResults.forEach((result) => {
|
|
75095
|
-
if (result.expectedTypeDiagAddendum) {
|
|
75096
|
-
expectedTypeDiagAddendum.addAddendum(result.expectedTypeDiagAddendum);
|
|
75097
|
-
}
|
|
75098
|
-
});
|
|
75099
|
-
}
|
|
75100
|
-
let type;
|
|
75101
|
-
if (node.d.items.length > maxInferredTupleEntryCount && entryTypeResults.some((result) => result.typeErrors)) {
|
|
75102
|
-
type = makeTupleObject([{ type: types_1.UnknownType.create(), isUnbounded: true }]);
|
|
75103
|
-
} else {
|
|
75104
|
-
type = makeTupleObject(buildTupleTypesList(
|
|
75105
|
-
entryTypeResults,
|
|
75106
|
-
/* stripLiterals */
|
|
75107
|
-
false
|
|
75108
|
-
));
|
|
75109
|
-
}
|
|
75110
|
-
return { type, expectedTypeDiagAddendum, isIncomplete };
|
|
75111
|
-
}
|
|
75112
|
-
function getTypeOfTupleInferred(node, flags) {
|
|
75113
|
-
const entryTypeResults = node.d.items.map((expr) => getTypeOfExpression(
|
|
75114
|
-
expr,
|
|
75115
|
-
flags | 268435456
|
|
75116
|
-
/* EvalFlags.StripTupleLiterals */
|
|
75117
|
-
));
|
|
75118
|
-
const isIncomplete = entryTypeResults.some((result) => result.isIncomplete);
|
|
75119
|
-
if (node.d.items.length > maxInferredTupleEntryCount) {
|
|
75120
|
-
return { type: makeTupleObject([{ type: types_1.UnknownType.create(), isUnbounded: true }]) };
|
|
75121
|
-
}
|
|
75122
|
-
const type = makeTupleObject(buildTupleTypesList(entryTypeResults, (flags & 268435456) !== 0));
|
|
75123
|
-
if (isIncomplete) {
|
|
75124
|
-
if ((0, typeUtils_1.getContainerDepth)(type) > maxInferredContainerDepth) {
|
|
75125
|
-
return { type: types_1.UnknownType.create() };
|
|
75126
|
-
}
|
|
75127
|
-
}
|
|
75128
|
-
return { type, isIncomplete };
|
|
75129
|
-
}
|
|
75130
75408
|
function buildTupleTypesList(entryTypeResults, stripLiterals) {
|
|
75131
75409
|
const entryTypes = [];
|
|
75132
75410
|
for (const typeResult of entryTypeResults) {
|
|
@@ -75291,7 +75569,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
75291
75569
|
addDiagnostic(diagnosticRules_1.DiagnosticRule.reportCallIssue, localize_1.LocMessage.typeFormArgs(), node);
|
|
75292
75570
|
return { type: types_1.UnknownType.create() };
|
|
75293
75571
|
}
|
|
75294
|
-
const typeFormResult = getTypeOfArgExpectingType(
|
|
75572
|
+
const typeFormResult = getTypeOfArgExpectingType(convertNodeToArg(node.d.args[0]), {
|
|
75295
75573
|
typeFormArg: isTypeFormSupported(node),
|
|
75296
75574
|
noNonTypeSpecialForms: true,
|
|
75297
75575
|
typeExpression: true
|
|
@@ -75318,13 +75596,14 @@ var require_typeEvaluator = __commonJS({
|
|
|
75318
75596
|
true
|
|
75319
75597
|
), isIncomplete: true };
|
|
75320
75598
|
}
|
|
75321
|
-
const assertedType = (0, typeUtils_1.convertToInstance)(getTypeOfArgExpectingType(
|
|
75599
|
+
const assertedType = (0, typeUtils_1.convertToInstance)(getTypeOfArgExpectingType(convertNodeToArg(node.d.args[1]), {
|
|
75322
75600
|
typeExpression: true
|
|
75323
75601
|
}).type);
|
|
75324
75602
|
const arg0Type = stripTypeGuard(arg0TypeResult.type);
|
|
75325
75603
|
if (!(0, types_1.isTypeSame)(assertedType, arg0Type, {
|
|
75326
75604
|
treatAnySameAsUnknown: true,
|
|
75327
|
-
ignorePseudoGeneric: true
|
|
75605
|
+
ignorePseudoGeneric: true,
|
|
75606
|
+
ignoreConditions: true
|
|
75328
75607
|
})) {
|
|
75329
75608
|
const srcDestTypes = printSrcDestTypes(arg0TypeResult.type, assertedType, { expandTypeAlias: true });
|
|
75330
75609
|
addDiagnostic(diagnosticRules_1.DiagnosticRule.reportAssertTypeFailure, localize_1.LocMessage.assertTypeTypeMismatch().format({
|
|
@@ -75334,6 +75613,13 @@ var require_typeEvaluator = __commonJS({
|
|
|
75334
75613
|
}
|
|
75335
75614
|
return { type: arg0TypeResult.type };
|
|
75336
75615
|
}
|
|
75616
|
+
function convertNodeToArg(node) {
|
|
75617
|
+
return {
|
|
75618
|
+
argCategory: node.d.argCategory,
|
|
75619
|
+
name: node.d.name,
|
|
75620
|
+
valueExpression: node.d.valueExpr
|
|
75621
|
+
};
|
|
75622
|
+
}
|
|
75337
75623
|
function getTypeOfRevealType(node, inferenceContext) {
|
|
75338
75624
|
let arg0Value;
|
|
75339
75625
|
let expectedRevealTypeNode;
|
|
@@ -75357,7 +75643,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
75357
75643
|
}
|
|
75358
75644
|
} else if (arg.d.name.d.value === "expected_type") {
|
|
75359
75645
|
expectedRevealTypeNode = arg.d.valueExpr;
|
|
75360
|
-
expectedRevealType = (0, typeUtils_1.convertToInstance)(getTypeOfArgExpectingType(
|
|
75646
|
+
expectedRevealType = (0, typeUtils_1.convertToInstance)(getTypeOfArgExpectingType(convertNodeToArg(arg), {
|
|
75361
75647
|
typeExpression: true
|
|
75362
75648
|
}).type);
|
|
75363
75649
|
}
|
|
@@ -76462,7 +76748,9 @@ var require_typeEvaluator = __commonJS({
|
|
|
76462
76748
|
}
|
|
76463
76749
|
function evaluateCastCall(argList, errorNode) {
|
|
76464
76750
|
var _a;
|
|
76465
|
-
|
|
76751
|
+
let castToType = getTypeOfArgExpectingType(argList[0], { typeExpression: true }).type;
|
|
76752
|
+
const liveScopeIds = ParseTreeUtils.getTypeVarScopesForNode(errorNode);
|
|
76753
|
+
castToType = (0, typeUtils_1.makeTypeVarsBound)(castToType, liveScopeIds);
|
|
76466
76754
|
let castFromType = getTypeOfArg(
|
|
76467
76755
|
argList[1],
|
|
76468
76756
|
/* inferenceContext */
|
|
@@ -76503,7 +76791,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
76503
76791
|
argCategory: 1,
|
|
76504
76792
|
valueExpression: void 0,
|
|
76505
76793
|
typeResult: {
|
|
76506
|
-
type: makeTupleObject([tupleTypeArg])
|
|
76794
|
+
type: (0, tuples_1.makeTupleObject)(evaluatorInterface, [tupleTypeArg])
|
|
76507
76795
|
}
|
|
76508
76796
|
});
|
|
76509
76797
|
} else {
|
|
@@ -76669,7 +76957,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
76669
76957
|
const paramInfo = paramDetails.params[paramIndex];
|
|
76670
76958
|
const paramType = paramInfo.type;
|
|
76671
76959
|
const paramName = paramInfo.param.name;
|
|
76672
|
-
const isParamVariadic = paramInfo.param.category === 1 && (0, types_1.
|
|
76960
|
+
const isParamVariadic = paramInfo.param.category === 1 && (0, types_1.isUnpacked)(paramType);
|
|
76673
76961
|
if (argList[argIndex].argCategory === 1) {
|
|
76674
76962
|
let isArgCompatibleWithVariadic = false;
|
|
76675
76963
|
const argTypeResult = getTypeOfArg(
|
|
@@ -76773,7 +77061,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
76773
77061
|
if ((0, types_1.isUnpackedClass)(paramType) && paramType.priv.tupleTypeArgs && paramType.priv.tupleTypeArgs.length > 0) {
|
|
76774
77062
|
effectiveParamType = paramType.priv.tupleTypeArgs[0].type;
|
|
76775
77063
|
}
|
|
76776
|
-
paramCategory = (0, types_1.
|
|
77064
|
+
paramCategory = (0, types_1.isUnpacked)(effectiveParamType) ? 1 : 0;
|
|
76777
77065
|
if (remainingArgCount <= remainingParamCount) {
|
|
76778
77066
|
if (remainingArgCount < remainingParamCount) {
|
|
76779
77067
|
if (!canSkipDiagnosticForNode(errorNode) && !isTypeIncomplete) {
|
|
@@ -77162,7 +77450,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
77162
77450
|
if (paramDetails.argsIndex !== void 0 && paramDetails.argsIndex >= 0 && types_1.FunctionParam.isTypeDeclared(paramDetails.params[paramDetails.argsIndex].param) && !isTypeVarTupleFullyMatched) {
|
|
77163
77451
|
const paramType = paramDetails.params[paramDetails.argsIndex].type;
|
|
77164
77452
|
const variadicArgs = validateArgTypeParams.filter((argParam) => argParam.mapsToVarArgList);
|
|
77165
|
-
if ((0, types_1.
|
|
77453
|
+
if ((0, types_1.isUnpacked)(paramType) && (!(0, types_1.isTypeVarTuple)(paramType) || !paramType.priv.isInUnion)) {
|
|
77166
77454
|
const tupleTypeArgs = variadicArgs.map((argParam) => {
|
|
77167
77455
|
var _a2;
|
|
77168
77456
|
const argType = getTypeOfArg(
|
|
@@ -77183,18 +77471,23 @@ var require_typeEvaluator = __commonJS({
|
|
|
77183
77471
|
};
|
|
77184
77472
|
});
|
|
77185
77473
|
let specializedTuple;
|
|
77186
|
-
if (tupleTypeArgs.length === 1 && !tupleTypeArgs[0].isUnbounded
|
|
77187
|
-
|
|
77188
|
-
|
|
77189
|
-
|
|
77474
|
+
if (tupleTypeArgs.length === 1 && !tupleTypeArgs[0].isUnbounded) {
|
|
77475
|
+
const entryType = tupleTypeArgs[0].type;
|
|
77476
|
+
if ((0, types_1.isUnpacked)(entryType)) {
|
|
77477
|
+
specializedTuple = (0, typeUtils_1.makePacked)(entryType);
|
|
77478
|
+
}
|
|
77479
|
+
}
|
|
77480
|
+
if (!specializedTuple) {
|
|
77481
|
+
specializedTuple = (0, tuples_1.makeTupleObject)(
|
|
77482
|
+
evaluatorInterface,
|
|
77190
77483
|
tupleTypeArgs,
|
|
77191
77484
|
/* isUnpacked */
|
|
77192
|
-
|
|
77485
|
+
false
|
|
77193
77486
|
);
|
|
77194
77487
|
}
|
|
77195
77488
|
const combinedArg = {
|
|
77196
|
-
paramCategory:
|
|
77197
|
-
paramType,
|
|
77489
|
+
paramCategory: 0,
|
|
77490
|
+
paramType: (0, typeUtils_1.makePacked)(paramType),
|
|
77198
77491
|
requiresTypeVarMatching: true,
|
|
77199
77492
|
argument: {
|
|
77200
77493
|
argCategory: 0,
|
|
@@ -77482,7 +77775,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
77482
77775
|
eliminateUnsolvedInUnions
|
|
77483
77776
|
}
|
|
77484
77777
|
});
|
|
77485
|
-
specializedReturnType = (0, typeUtils_1.addConditionToType)(specializedReturnType, typeCondition);
|
|
77778
|
+
specializedReturnType = (0, typeUtils_1.addConditionToType)(specializedReturnType, typeCondition, { skipBoundTypeVars: true });
|
|
77486
77779
|
if (paramSpecConstraints.length > 0) {
|
|
77487
77780
|
paramSpecConstraints.forEach((paramSpecConstraints2) => {
|
|
77488
77781
|
if (paramSpecConstraints2) {
|
|
@@ -77492,11 +77785,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
77492
77785
|
});
|
|
77493
77786
|
}
|
|
77494
77787
|
if ((0, types_1.isUnpackedClass)(specializedReturnType)) {
|
|
77495
|
-
specializedReturnType = types_1.ClassType.
|
|
77496
|
-
specializedReturnType,
|
|
77497
|
-
/* isUnpacked */
|
|
77498
|
-
false
|
|
77499
|
-
);
|
|
77788
|
+
specializedReturnType = types_1.ClassType.cloneForPacked(specializedReturnType);
|
|
77500
77789
|
}
|
|
77501
77790
|
const liveTypeVarScopes = ParseTreeUtils.getTypeVarScopesForNode(errorNode);
|
|
77502
77791
|
specializedReturnType = adjustCallableReturnType(errorNode, specializedReturnType, liveTypeVarScopes);
|
|
@@ -77997,7 +78286,9 @@ var require_typeEvaluator = __commonJS({
|
|
|
77997
78286
|
addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.typeVarFirstArg(), firstArg.valueExpression || errorNode);
|
|
77998
78287
|
}
|
|
77999
78288
|
const typeVar = types_1.TypeBase.cloneAsSpecialForm(types_1.TypeVarType.createInstantiable(typeVarName, types_1.TypeVarKind.TypeVarTuple), types_1.ClassType.cloneAsInstance(classType));
|
|
78000
|
-
typeVar.shared.defaultType =
|
|
78289
|
+
typeVar.shared.defaultType = (0, tuples_1.makeTupleObject)(evaluatorInterface, [
|
|
78290
|
+
{ type: types_1.UnknownType.create(), isUnbounded: true }
|
|
78291
|
+
]);
|
|
78001
78292
|
for (let i = 1; i < argList.length; i++) {
|
|
78002
78293
|
const paramNameNode = argList[i].name;
|
|
78003
78294
|
const paramName = paramNameNode ? paramNameNode.d.value : void 0;
|
|
@@ -78122,6 +78413,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
78122
78413
|
const typeResult = getTypeOfExpressionExpectingType(node, {
|
|
78123
78414
|
allowParamSpec: true,
|
|
78124
78415
|
allowTypeVarsWithoutScopeId: true,
|
|
78416
|
+
allowEllipsis: true,
|
|
78125
78417
|
typeExpression: true
|
|
78126
78418
|
});
|
|
78127
78419
|
if (typeResult.typeErrors) {
|
|
@@ -78702,7 +78994,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
78702
78994
|
isEmptyContainer
|
|
78703
78995
|
)) : types_1.UnknownType.create();
|
|
78704
78996
|
if (isIncomplete) {
|
|
78705
|
-
if ((0, typeUtils_1.getContainerDepth)(type) > maxInferredContainerDepth) {
|
|
78997
|
+
if ((0, typeUtils_1.getContainerDepth)(type) > typeEvaluatorTypes_1.maxInferredContainerDepth) {
|
|
78706
78998
|
return { type: types_1.UnknownType.create() };
|
|
78707
78999
|
}
|
|
78708
79000
|
}
|
|
@@ -79085,7 +79377,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
79085
79377
|
isEmptyContainer
|
|
79086
79378
|
)) : types_1.UnknownType.create();
|
|
79087
79379
|
if (isIncomplete) {
|
|
79088
|
-
if ((0, typeUtils_1.getContainerDepth)(type) > maxInferredContainerDepth) {
|
|
79380
|
+
if ((0, typeUtils_1.getContainerDepth)(type) > typeEvaluatorTypes_1.maxInferredContainerDepth) {
|
|
79089
79381
|
return { type: types_1.UnknownType.create() };
|
|
79090
79382
|
}
|
|
79091
79383
|
}
|
|
@@ -79472,7 +79764,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
79472
79764
|
if (!expectedValueOrElementType || !(0, typeUtils_1.containsLiteralType)(expectedValueOrElementType)) {
|
|
79473
79765
|
valueType = stripLiteralValue(valueType);
|
|
79474
79766
|
}
|
|
79475
|
-
type = makeTupleObject([
|
|
79767
|
+
type = (0, tuples_1.makeTupleObject)(evaluatorInterface, [
|
|
79476
79768
|
{ type: keyType, isUnbounded: false },
|
|
79477
79769
|
{ type: valueType, isUnbounded: false }
|
|
79478
79770
|
]);
|
|
@@ -79715,15 +80007,22 @@ var require_typeEvaluator = __commonJS({
|
|
|
79715
80007
|
return types_1.UnknownType.create();
|
|
79716
80008
|
}
|
|
79717
80009
|
const literalTypes = [];
|
|
80010
|
+
let isValidTypeForm = true;
|
|
79718
80011
|
for (const item of node.d.items) {
|
|
79719
80012
|
let type;
|
|
79720
80013
|
const itemExpr = item.d.valueExpr;
|
|
79721
80014
|
if (item.d.argCategory !== 0) {
|
|
79722
|
-
|
|
79723
|
-
|
|
80015
|
+
if ((flags & 256) !== 0) {
|
|
80016
|
+
addDiagnostic(diagnosticRules_1.DiagnosticRule.reportInvalidTypeForm, localize_1.LocMessage.unpackedArgInTypeArgument(), itemExpr);
|
|
80017
|
+
type = types_1.UnknownType.create();
|
|
80018
|
+
isValidTypeForm = false;
|
|
80019
|
+
}
|
|
79724
80020
|
} else if (item.d.name) {
|
|
79725
|
-
|
|
79726
|
-
|
|
80021
|
+
if ((flags & 256) !== 0) {
|
|
80022
|
+
addDiagnostic(diagnosticRules_1.DiagnosticRule.reportInvalidTypeForm, localize_1.LocMessage.keywordArgInTypeArgument(), itemExpr);
|
|
80023
|
+
type = types_1.UnknownType.create();
|
|
80024
|
+
isValidTypeForm = false;
|
|
80025
|
+
}
|
|
79727
80026
|
} else if (itemExpr.nodeType === 48) {
|
|
79728
80027
|
const isBytes = (itemExpr.d.strings[0].d.token.flags & 32) !== 0;
|
|
79729
80028
|
const value = itemExpr.d.strings.map((s) => s.d.value).join("");
|
|
@@ -79732,11 +80031,14 @@ var require_typeEvaluator = __commonJS({
|
|
|
79732
80031
|
} else {
|
|
79733
80032
|
type = cloneBuiltinClassWithLiteral(node, classType, "str", value);
|
|
79734
80033
|
}
|
|
79735
|
-
|
|
79736
|
-
|
|
79737
|
-
|
|
79738
|
-
|
|
79739
|
-
|
|
80034
|
+
if ((flags & 256) !== 0) {
|
|
80035
|
+
itemExpr.d.strings.forEach((stringNode) => {
|
|
80036
|
+
if ((stringNode.d.token.flags & 512) !== 0) {
|
|
80037
|
+
addDiagnostic(diagnosticRules_1.DiagnosticRule.reportInvalidTypeForm, localize_1.LocMessage.literalNamedUnicodeEscape(), stringNode);
|
|
80038
|
+
isValidTypeForm = false;
|
|
80039
|
+
}
|
|
80040
|
+
});
|
|
80041
|
+
}
|
|
79740
80042
|
} else if (itemExpr.nodeType === 40) {
|
|
79741
80043
|
if (!itemExpr.d.isImaginary && itemExpr.d.isInteger) {
|
|
79742
80044
|
type = cloneBuiltinClassWithLiteral(node, classType, "int", itemExpr.d.value);
|
|
@@ -79784,6 +80086,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
79784
80086
|
if ((flags & 256) !== 0) {
|
|
79785
80087
|
addDiagnostic(diagnosticRules_1.DiagnosticRule.reportInvalidTypeForm, localize_1.LocMessage.literalUnsupportedType(), item);
|
|
79786
80088
|
type = types_1.UnknownType.create();
|
|
80089
|
+
isValidTypeForm = false;
|
|
79787
80090
|
} else {
|
|
79788
80091
|
return types_1.ClassType.cloneAsInstance(classType);
|
|
79789
80092
|
}
|
|
@@ -79794,7 +80097,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
79794
80097
|
if ((0, types_1.isUnion)(result) && unionTypeClass && (0, types_1.isInstantiableClass)(unionTypeClass)) {
|
|
79795
80098
|
result = types_1.TypeBase.cloneAsSpecialForm(result, types_1.ClassType.cloneAsInstance(unionTypeClass));
|
|
79796
80099
|
}
|
|
79797
|
-
if (isTypeFormSupported(node)) {
|
|
80100
|
+
if (isTypeFormSupported(node) && isValidTypeForm) {
|
|
79798
80101
|
result = types_1.TypeBase.cloneWithTypeForm(result, (0, typeUtils_1.convertToInstance)(result));
|
|
79799
80102
|
}
|
|
79800
80103
|
return result;
|
|
@@ -79950,18 +80253,21 @@ var require_typeEvaluator = __commonJS({
|
|
|
79950
80253
|
isUsageLegal = true;
|
|
79951
80254
|
}
|
|
79952
80255
|
}
|
|
79953
|
-
if ((flags & 1048576) !== 0) {
|
|
79954
|
-
isUsageLegal = true;
|
|
79955
|
-
}
|
|
79956
80256
|
let isReadOnly = typeArgs[0].isReadOnly;
|
|
79957
80257
|
let isRequired = typeArgs[0].isRequired;
|
|
79958
80258
|
let isNotRequired = typeArgs[0].isNotRequired;
|
|
79959
80259
|
if (classType.shared.name === "ReadOnly") {
|
|
80260
|
+
if ((flags & 2097152) !== 0) {
|
|
80261
|
+
isUsageLegal = true;
|
|
80262
|
+
}
|
|
79960
80263
|
if (typeArgs[0].isReadOnly) {
|
|
79961
80264
|
isUsageLegal = false;
|
|
79962
80265
|
}
|
|
79963
80266
|
isReadOnly = true;
|
|
79964
80267
|
} else {
|
|
80268
|
+
if ((flags & 1048576) !== 0) {
|
|
80269
|
+
isUsageLegal = true;
|
|
80270
|
+
}
|
|
79965
80271
|
if (typeArgs[0].isRequired || typeArgs[0].isNotRequired) {
|
|
79966
80272
|
isUsageLegal = false;
|
|
79967
80273
|
}
|
|
@@ -79983,16 +80289,11 @@ var require_typeEvaluator = __commonJS({
|
|
|
79983
80289
|
}
|
|
79984
80290
|
return classType;
|
|
79985
80291
|
}
|
|
79986
|
-
|
|
79987
|
-
if ((
|
|
79988
|
-
|
|
79989
|
-
|
|
79990
|
-
|
|
79991
|
-
if ((0, types_1.isInstantiableClass)(typeArgType) && !typeArgType.priv.includeSubclasses && (0, typeUtils_1.isTupleClass)(typeArgType)) {
|
|
79992
|
-
return types_1.ClassType.cloneForUnpacked(typeArgType);
|
|
79993
|
-
}
|
|
79994
|
-
if ((0, types_1.isTypeVarTuple)(typeArgType) && !typeArgType.priv.isUnpacked) {
|
|
79995
|
-
return types_1.TypeVarType.cloneForUnpacked(typeArgType);
|
|
80292
|
+
const typeArgType = typeArgs[0].type;
|
|
80293
|
+
if ((flags & 4194304) !== 0) {
|
|
80294
|
+
const unpackedType = applyUnpackToTupleLike(typeArgType);
|
|
80295
|
+
if (unpackedType) {
|
|
80296
|
+
return unpackedType;
|
|
79996
80297
|
}
|
|
79997
80298
|
if ((flags & 256) === 0) {
|
|
79998
80299
|
return classType;
|
|
@@ -80000,7 +80301,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
80000
80301
|
addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.unpackExpectedTypeVarTuple(), errorNode);
|
|
80001
80302
|
return types_1.UnknownType.create();
|
|
80002
80303
|
}
|
|
80003
|
-
if ((flags &
|
|
80304
|
+
if ((flags & 8388608) !== 0) {
|
|
80004
80305
|
if ((0, types_1.isInstantiableClass)(typeArgType) && types_1.ClassType.isTypedDictClass(typeArgType)) {
|
|
80005
80306
|
return types_1.ClassType.cloneForUnpacked(typeArgType);
|
|
80006
80307
|
}
|
|
@@ -80105,51 +80406,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
80105
80406
|
return baseType;
|
|
80106
80407
|
}
|
|
80107
80408
|
function validateTypeMetadata(errorNode, baseType, metaArg) {
|
|
80108
|
-
|
|
80109
|
-
if (!AnalyzerNodeInfo.getFileInfo(errorNode).diagnosticRuleSet.enableExperimentalFeatures) {
|
|
80110
|
-
return true;
|
|
80111
|
-
}
|
|
80112
|
-
if (!(0, types_1.isClass)(metaArg.type)) {
|
|
80113
|
-
return true;
|
|
80114
|
-
}
|
|
80115
|
-
const supportsTypeMethod = (_a = getTypeOfBoundMember(
|
|
80116
|
-
/* errorNode */
|
|
80117
|
-
void 0,
|
|
80118
|
-
metaArg.type,
|
|
80119
|
-
"__supports_type__"
|
|
80120
|
-
)) === null || _a === void 0 ? void 0 : _a.type;
|
|
80121
|
-
if (!supportsTypeMethod) {
|
|
80122
|
-
return true;
|
|
80123
|
-
}
|
|
80124
|
-
const callResult = useSpeculativeMode(errorNode, () => validateCallArgs(
|
|
80125
|
-
errorNode,
|
|
80126
|
-
[
|
|
80127
|
-
{
|
|
80128
|
-
argCategory: 0,
|
|
80129
|
-
typeResult: { type: (0, typeUtils_1.convertToInstance)(baseType) }
|
|
80130
|
-
}
|
|
80131
|
-
],
|
|
80132
|
-
{ type: supportsTypeMethod },
|
|
80133
|
-
/* constraints */
|
|
80134
|
-
void 0,
|
|
80135
|
-
/* skipUnknownArgCheck */
|
|
80136
|
-
true,
|
|
80137
|
-
/* inferenceContext */
|
|
80138
|
-
void 0
|
|
80139
|
-
));
|
|
80140
|
-
if (!callResult.returnType) {
|
|
80141
|
-
return true;
|
|
80142
|
-
}
|
|
80143
|
-
if (!callResult.argumentErrors && canBeTruthy(callResult.returnType)) {
|
|
80144
|
-
return true;
|
|
80145
|
-
}
|
|
80146
|
-
if (!callResult.isTypeIncomplete) {
|
|
80147
|
-
addDiagnostic(diagnosticRules_1.DiagnosticRule.reportInvalidTypeArguments, localize_1.LocMessage.annotatedMetadataInconsistent().format({
|
|
80148
|
-
metadataType: printType(metaArg.type),
|
|
80149
|
-
type: printType((0, typeUtils_1.convertToInstance)(baseType))
|
|
80150
|
-
}), metaArg.node);
|
|
80151
|
-
}
|
|
80152
|
-
return false;
|
|
80409
|
+
return true;
|
|
80153
80410
|
}
|
|
80154
80411
|
function createSpecialType(classType, typeArgs, paramLimit, allowParamSpec = false, isSpecialForm = true) {
|
|
80155
80412
|
const isTupleTypeParam = types_1.ClassType.isTupleClass(classType);
|
|
@@ -80281,7 +80538,9 @@ var require_typeEvaluator = __commonJS({
|
|
|
80281
80538
|
types2.push(typeArgType);
|
|
80282
80539
|
}
|
|
80283
80540
|
if (types2.length === 1 && !allowSingleTypeArg && !(0, typeUtils_1.isNoneInstance)(types2[0])) {
|
|
80284
|
-
|
|
80541
|
+
if ((flags & 256) !== 0) {
|
|
80542
|
+
addDiagnostic(diagnosticRules_1.DiagnosticRule.reportInvalidTypeArguments, localize_1.LocMessage.unionTypeArgCount(), errorNode);
|
|
80543
|
+
}
|
|
80285
80544
|
isValidTypeForm = false;
|
|
80286
80545
|
}
|
|
80287
80546
|
let unionType = (0, types_1.combineTypes)(types2, { skipElideRedundantLiterals: true });
|
|
@@ -80335,9 +80594,6 @@ var require_typeEvaluator = __commonJS({
|
|
|
80335
80594
|
}
|
|
80336
80595
|
function transformTypeForTypeAlias(type, errorNode, typeAliasPlaceholder, isPep695TypeVarType, typeParamNodes) {
|
|
80337
80596
|
var _a;
|
|
80338
|
-
if (!types_1.TypeBase.isInstantiable(type)) {
|
|
80339
|
-
return type;
|
|
80340
|
-
}
|
|
80341
80597
|
if ((0, typeUtils_1.isTypeAliasPlaceholder)(type)) {
|
|
80342
80598
|
return type;
|
|
80343
80599
|
}
|
|
@@ -80391,6 +80647,9 @@ var require_typeEvaluator = __commonJS({
|
|
|
80391
80647
|
}), errorNode);
|
|
80392
80648
|
}
|
|
80393
80649
|
}
|
|
80650
|
+
if (!types_1.TypeBase.isInstantiable(type)) {
|
|
80651
|
+
return type;
|
|
80652
|
+
}
|
|
80394
80653
|
sharedInfo.typeParams = typeParams.length > 0 ? typeParams : void 0;
|
|
80395
80654
|
let typeAlias = types_1.TypeBase.cloneForTypeAlias(type, {
|
|
80396
80655
|
shared: sharedInfo,
|
|
@@ -80645,7 +80904,6 @@ var require_typeEvaluator = __commonJS({
|
|
|
80645
80904
|
}
|
|
80646
80905
|
}
|
|
80647
80906
|
if (!rightHandType) {
|
|
80648
|
-
const declaredType = getDeclaredTypeForExpression(node.d.leftExpr, { method: "set" });
|
|
80649
80907
|
let typeAliasNameNode;
|
|
80650
80908
|
let typeAliasPlaceholder;
|
|
80651
80909
|
let isSpeculativeTypeAlias = false;
|
|
@@ -80706,6 +80964,11 @@ var require_typeEvaluator = __commonJS({
|
|
|
80706
80964
|
);
|
|
80707
80965
|
}
|
|
80708
80966
|
}
|
|
80967
|
+
let declaredType = getDeclaredTypeForExpression(node.d.leftExpr, { method: "set" });
|
|
80968
|
+
if (declaredType) {
|
|
80969
|
+
const liveTypeVarScopes = ParseTreeUtils.getTypeVarScopesForNode(node);
|
|
80970
|
+
declaredType = (0, typeUtils_1.makeTypeVarsBound)(declaredType, liveTypeVarScopes);
|
|
80971
|
+
}
|
|
80709
80972
|
const srcTypeResult = getTypeOfExpression(node.d.rightExpr, flags, (0, typeUtils_1.makeInferenceContext)(declaredType));
|
|
80710
80973
|
rightHandType = srcTypeResult.type;
|
|
80711
80974
|
expectedTypeDiagAddendum = srcTypeResult.expectedTypeDiagAddendum;
|
|
@@ -81140,6 +81403,17 @@ var require_typeEvaluator = __commonJS({
|
|
|
81140
81403
|
} else if (arg.d.name.d.value === "closed" && constArgValue) {
|
|
81141
81404
|
if (AnalyzerNodeInfo.getFileInfo(node).diagnosticRuleSet.enableExperimentalFeatures) {
|
|
81142
81405
|
classType.shared.flags |= 8 | 16;
|
|
81406
|
+
if (classType.shared.typedDictExtraItemsExpr) {
|
|
81407
|
+
addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.typedDictExtraItemsClosed(), classType.shared.typedDictExtraItemsExpr);
|
|
81408
|
+
}
|
|
81409
|
+
}
|
|
81410
|
+
}
|
|
81411
|
+
} else if (arg.d.name.d.value === "extra_items") {
|
|
81412
|
+
if (AnalyzerNodeInfo.getFileInfo(node).diagnosticRuleSet.enableExperimentalFeatures) {
|
|
81413
|
+
classType.shared.typedDictExtraItemsExpr = arg.d.valueExpr;
|
|
81414
|
+
classType.shared.flags |= 16;
|
|
81415
|
+
if (types_1.ClassType.isTypedDictMarkedClosed(classType)) {
|
|
81416
|
+
addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.typedDictExtraItemsClosed(), classType.shared.typedDictExtraItemsExpr);
|
|
81143
81417
|
}
|
|
81144
81418
|
}
|
|
81145
81419
|
} else {
|
|
@@ -82187,20 +82461,16 @@ var require_typeEvaluator = __commonJS({
|
|
|
82187
82461
|
return type;
|
|
82188
82462
|
}
|
|
82189
82463
|
if ((0, types_1.isUnpackedClass)(type)) {
|
|
82190
|
-
return types_1.ClassType.
|
|
82191
|
-
type,
|
|
82192
|
-
/* isUnpacked */
|
|
82193
|
-
false
|
|
82194
|
-
);
|
|
82464
|
+
return types_1.ClassType.cloneForPacked(type);
|
|
82195
82465
|
}
|
|
82196
|
-
return makeTupleObject([{ type, isUnbounded: !(0, types_1.isTypeVarTuple)(type) }]);
|
|
82466
|
+
return (0, tuples_1.makeTupleObject)(evaluatorInterface, [{ type, isUnbounded: !(0, types_1.isTypeVarTuple)(type) }]);
|
|
82197
82467
|
}
|
|
82198
82468
|
case 2: {
|
|
82199
82469
|
if ((0, types_1.isParamSpec)(type) && type.priv.paramSpecAccess) {
|
|
82200
82470
|
return type;
|
|
82201
82471
|
}
|
|
82202
82472
|
if ((0, types_1.isClassInstance)(type) && types_1.ClassType.isTypedDictClass(type) && type.priv.isUnpacked) {
|
|
82203
|
-
return type;
|
|
82473
|
+
return types_1.ClassType.cloneForPacked(type);
|
|
82204
82474
|
}
|
|
82205
82475
|
const dictType = getBuiltInType(node, "dict");
|
|
82206
82476
|
const strType = getBuiltInObject(node, "str");
|
|
@@ -82217,7 +82487,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
82217
82487
|
if (functionType.shared.declaredReturnType) {
|
|
82218
82488
|
awaitableFunctionType.shared.declaredReturnType = createAwaitableReturnType(node, functionType.shared.declaredReturnType, types_1.FunctionType.isGenerator(functionType));
|
|
82219
82489
|
} else {
|
|
82220
|
-
awaitableFunctionType.priv.inferredReturnType = createAwaitableReturnType(node,
|
|
82490
|
+
awaitableFunctionType.priv.inferredReturnType = createAwaitableReturnType(node, getInferredReturnType(functionType), types_1.FunctionType.isGenerator(functionType));
|
|
82221
82491
|
}
|
|
82222
82492
|
return awaitableFunctionType;
|
|
82223
82493
|
}
|
|
@@ -83622,29 +83892,9 @@ var require_typeEvaluator = __commonJS({
|
|
|
83622
83892
|
}
|
|
83623
83893
|
let typeArgTypes = [];
|
|
83624
83894
|
const fullTypeParams = types_1.ClassType.getTypeParams(classType);
|
|
83625
|
-
|
|
83626
|
-
|
|
83627
|
-
|
|
83628
|
-
typeArgs = typeArgs.length > 0 ? [
|
|
83629
|
-
{
|
|
83630
|
-
type: types_1.UnknownType.create(),
|
|
83631
|
-
node: typeArgs[0].node,
|
|
83632
|
-
typeList: typeArgs
|
|
83633
|
-
}
|
|
83634
|
-
] : [];
|
|
83635
|
-
}
|
|
83636
|
-
} else if (typeArgs.length > 1) {
|
|
83637
|
-
const paramSpecTypeArg = typeArgs.find((typeArg) => (0, types_1.isParamSpec)(typeArg.type));
|
|
83638
|
-
if (paramSpecTypeArg) {
|
|
83639
|
-
isValidTypeForm = false;
|
|
83640
|
-
addDiagnostic(diagnosticRules_1.DiagnosticRule.reportInvalidTypeForm, localize_1.LocMessage.paramSpecContext(), paramSpecTypeArg.node);
|
|
83641
|
-
}
|
|
83642
|
-
const listTypeArg = typeArgs.find((typeArg) => !!typeArg.typeList);
|
|
83643
|
-
if (listTypeArg) {
|
|
83644
|
-
isValidTypeForm = false;
|
|
83645
|
-
addDiagnostic(diagnosticRules_1.DiagnosticRule.reportInvalidTypeForm, localize_1.LocMessage.typeArgListNotAllowed(), listTypeArg.node);
|
|
83646
|
-
}
|
|
83647
|
-
}
|
|
83895
|
+
typeArgs = transformTypeArgsForParamSpec(fullTypeParams, typeArgs, errorNode);
|
|
83896
|
+
if (!typeArgs) {
|
|
83897
|
+
isValidTypeForm = false;
|
|
83648
83898
|
}
|
|
83649
83899
|
const constraints = new constraintTracker_1.ConstraintTracker();
|
|
83650
83900
|
fullTypeParams.forEach((typeParam, index) => {
|
|
@@ -83747,6 +83997,50 @@ var require_typeEvaluator = __commonJS({
|
|
|
83747
83997
|
}
|
|
83748
83998
|
return { type: specializedClass };
|
|
83749
83999
|
}
|
|
84000
|
+
function transformTypeArgsForParamSpec(typeParams, typeArgs, errorNode) {
|
|
84001
|
+
if (typeParams.length !== 1 || !(0, types_1.isParamSpec)(typeParams[0]) || !typeArgs) {
|
|
84002
|
+
return typeArgs;
|
|
84003
|
+
}
|
|
84004
|
+
if (typeArgs.length > 1) {
|
|
84005
|
+
for (const typeArg of typeArgs) {
|
|
84006
|
+
if ((0, types_1.isParamSpec)(typeArg.type)) {
|
|
84007
|
+
addDiagnostic(diagnosticRules_1.DiagnosticRule.reportInvalidTypeForm, localize_1.LocMessage.paramSpecContext(), typeArg.node);
|
|
84008
|
+
return void 0;
|
|
84009
|
+
}
|
|
84010
|
+
if ((0, typeUtils_1.isEllipsisType)(typeArg.type)) {
|
|
84011
|
+
addDiagnostic(diagnosticRules_1.DiagnosticRule.reportInvalidTypeForm, localize_1.LocMessage.ellipsisContext(), typeArg.node);
|
|
84012
|
+
return void 0;
|
|
84013
|
+
}
|
|
84014
|
+
if ((0, types_1.isInstantiableClass)(typeArg.type) && types_1.ClassType.isBuiltIn(typeArg.type, "Concatenate")) {
|
|
84015
|
+
addDiagnostic(diagnosticRules_1.DiagnosticRule.reportInvalidTypeForm, localize_1.LocMessage.concatenateContext(), typeArg.node);
|
|
84016
|
+
return void 0;
|
|
84017
|
+
}
|
|
84018
|
+
if (typeArg.typeList) {
|
|
84019
|
+
addDiagnostic(diagnosticRules_1.DiagnosticRule.reportInvalidTypeForm, localize_1.LocMessage.typeArgListNotAllowed(), typeArg.node);
|
|
84020
|
+
return void 0;
|
|
84021
|
+
}
|
|
84022
|
+
}
|
|
84023
|
+
}
|
|
84024
|
+
if (typeArgs.length === 1) {
|
|
84025
|
+
if (typeArgs[0].typeList) {
|
|
84026
|
+
return typeArgs;
|
|
84027
|
+
}
|
|
84028
|
+
const typeArgType = typeArgs[0].type;
|
|
84029
|
+
if ((0, types_1.isParamSpec)(typeArgType) || (0, typeUtils_1.isEllipsisType)(typeArgType)) {
|
|
84030
|
+
return typeArgs;
|
|
84031
|
+
}
|
|
84032
|
+
if ((0, types_1.isInstantiableClass)(typeArgType) && types_1.ClassType.isBuiltIn(typeArgType, "Concatenate")) {
|
|
84033
|
+
return typeArgs;
|
|
84034
|
+
}
|
|
84035
|
+
}
|
|
84036
|
+
return [
|
|
84037
|
+
{
|
|
84038
|
+
type: types_1.UnknownType.create(),
|
|
84039
|
+
node: typeArgs.length > 0 ? typeArgs[0].node : errorNode,
|
|
84040
|
+
typeList: typeArgs
|
|
84041
|
+
}
|
|
84042
|
+
];
|
|
84043
|
+
}
|
|
83750
84044
|
function getTypeOfArg(arg, inferenceContext) {
|
|
83751
84045
|
var _a, _b;
|
|
83752
84046
|
if (arg.typeResult) {
|
|
@@ -83785,7 +84079,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
83785
84079
|
if ((0, analyzerFileInfo_1.isAnnotationEvaluationPostponed)(fileInfo) || (options === null || options === void 0 ? void 0 : options.forwardRefs)) {
|
|
83786
84080
|
flags |= 4;
|
|
83787
84081
|
} else if (options === null || options === void 0 ? void 0 : options.parsesStringLiteral) {
|
|
83788
|
-
flags |=
|
|
84082
|
+
flags |= 16777216;
|
|
83789
84083
|
}
|
|
83790
84084
|
if (!(options === null || options === void 0 ? void 0 : options.allowFinal)) {
|
|
83791
84085
|
flags |= 16;
|
|
@@ -83793,13 +84087,16 @@ var require_typeEvaluator = __commonJS({
|
|
|
83793
84087
|
if (options === null || options === void 0 ? void 0 : options.allowRequired) {
|
|
83794
84088
|
flags |= 1048576 | 256;
|
|
83795
84089
|
}
|
|
84090
|
+
if (options === null || options === void 0 ? void 0 : options.allowReadOnly) {
|
|
84091
|
+
flags |= 2097152 | 256;
|
|
84092
|
+
}
|
|
83796
84093
|
if (options === null || options === void 0 ? void 0 : options.allowUnpackedTuple) {
|
|
83797
|
-
flags |=
|
|
84094
|
+
flags |= 4194304;
|
|
83798
84095
|
} else {
|
|
83799
84096
|
flags |= 64;
|
|
83800
84097
|
}
|
|
83801
84098
|
if (options === null || options === void 0 ? void 0 : options.allowUnpackedTypedDict) {
|
|
83802
|
-
flags |=
|
|
84099
|
+
flags |= 8388608;
|
|
83803
84100
|
}
|
|
83804
84101
|
if (!(options === null || options === void 0 ? void 0 : options.allowParamSpec)) {
|
|
83805
84102
|
flags |= 32;
|
|
@@ -83810,6 +84107,9 @@ var require_typeEvaluator = __commonJS({
|
|
|
83810
84107
|
if (options === null || options === void 0 ? void 0 : options.convertEllipsisToAny) {
|
|
83811
84108
|
flags |= 1;
|
|
83812
84109
|
}
|
|
84110
|
+
if (options === null || options === void 0 ? void 0 : options.allowEllipsis) {
|
|
84111
|
+
flags |= 65536;
|
|
84112
|
+
}
|
|
83813
84113
|
if (options === null || options === void 0 ? void 0 : options.noNonTypeSpecialForms) {
|
|
83814
84114
|
flags |= 67108864;
|
|
83815
84115
|
}
|
|
@@ -84171,7 +84471,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
84171
84471
|
const paramDecl = getDeclarationFromKeywordParam(initMethodType, paramName);
|
|
84172
84472
|
if (paramDecl) {
|
|
84173
84473
|
declarations.push(paramDecl);
|
|
84174
|
-
} else if (types_1.ClassType.isDataClass(baseType) || types_1.ClassType.isTypedDictClass(baseType)) {
|
|
84474
|
+
} else if (types_1.ClassType.isDataClass(baseType) || types_1.ClassType.isTypedDictClass(baseType) || types_1.ClassType.hasNamedTupleEntry(baseType, paramName)) {
|
|
84175
84475
|
const lookupResults = (0, typeUtils_1.lookUpClassMember)(baseType, paramName);
|
|
84176
84476
|
if (lookupResults) {
|
|
84177
84477
|
(0, collectionUtils_1.appendArray)(declarations, lookupResults.symbol.getDeclarations());
|
|
@@ -84296,7 +84596,8 @@ var require_typeEvaluator = __commonJS({
|
|
|
84296
84596
|
if (declaration.isRuntimeTypeExpression) {
|
|
84297
84597
|
declaredType = (0, typeUtils_1.convertToInstance)(getTypeOfExpressionExpectingType(typeAnnotationNode, {
|
|
84298
84598
|
allowFinal: true,
|
|
84299
|
-
allowRequired: true
|
|
84599
|
+
allowRequired: true,
|
|
84600
|
+
allowReadOnly: true
|
|
84300
84601
|
}).type);
|
|
84301
84602
|
} else {
|
|
84302
84603
|
const declNode = declaration.isDefinedByMemberAccess && ((_c = declaration.node.parent) === null || _c === void 0 ? void 0 : _c.nodeType) === 35 ? declaration.node.parent : declaration.node;
|
|
@@ -84305,6 +84606,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
84305
84606
|
allowClassVar: ParseTreeUtils.isClassVarAllowedForAssignmentTarget(declNode),
|
|
84306
84607
|
allowFinal: ParseTreeUtils.isFinalAllowedForAssignmentTarget(declNode),
|
|
84307
84608
|
allowRequired: ParseTreeUtils.isRequiredAllowedForAssignmentTarget(declNode),
|
|
84609
|
+
allowReadOnly: ParseTreeUtils.isRequiredAllowedForAssignmentTarget(declNode),
|
|
84308
84610
|
enforceClassTypeVarScope: declaration.isDefinedByMemberAccess
|
|
84309
84611
|
});
|
|
84310
84612
|
}
|
|
@@ -84424,7 +84726,9 @@ var require_typeEvaluator = __commonJS({
|
|
|
84424
84726
|
typeVar.shared.defaultType = defaultType;
|
|
84425
84727
|
typeVar.shared.isDefaultExplicit = true;
|
|
84426
84728
|
} else {
|
|
84427
|
-
typeVar.shared.defaultType =
|
|
84729
|
+
typeVar.shared.defaultType = (0, tuples_1.makeTupleObject)(evaluatorInterface, [
|
|
84730
|
+
{ type: types_1.UnknownType.create(), isUnbounded: true }
|
|
84731
|
+
]);
|
|
84428
84732
|
}
|
|
84429
84733
|
} else {
|
|
84430
84734
|
const defaultType = node.d.defaultExpr ? (0, typeUtils_1.convertToInstance)(getTypeOfExpressionExpectingType(node.d.defaultExpr, {
|
|
@@ -84446,7 +84750,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
84446
84750
|
let scopeType;
|
|
84447
84751
|
if (scopeNode.nodeType === 10) {
|
|
84448
84752
|
scopeType = 0;
|
|
84449
|
-
typeVar.shared.declaredVariance = 0;
|
|
84753
|
+
typeVar.shared.declaredVariance = (0, types_1.isParamSpec)(typeVar) || (0, types_1.isTypeVarTuple)(typeVar) ? 2 : 0;
|
|
84450
84754
|
} else if (scopeNode.nodeType === 31) {
|
|
84451
84755
|
scopeType = 1;
|
|
84452
84756
|
} else {
|
|
@@ -84455,7 +84759,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
84455
84759
|
/* ParseNodeType.TypeAlias */
|
|
84456
84760
|
);
|
|
84457
84761
|
scopeType = 2;
|
|
84458
|
-
typeVar.shared.declaredVariance = 0;
|
|
84762
|
+
typeVar.shared.declaredVariance = (0, types_1.isParamSpec)(typeVar) || (0, types_1.isTypeVarTuple)(typeVar) ? 2 : 0;
|
|
84459
84763
|
}
|
|
84460
84764
|
typeVar = types_1.TypeVarType.cloneForScopeId(typeVar, ParseTreeUtils.getScopeIdForNode(scopeNode.nodeType === 77 ? scopeNode.d.name : scopeNode), scopeNode.d.name.d.value, scopeType);
|
|
84461
84765
|
}
|
|
@@ -84890,27 +85194,31 @@ var require_typeEvaluator = __commonJS({
|
|
|
84890
85194
|
return { type: void 0 };
|
|
84891
85195
|
}
|
|
84892
85196
|
if (usageNode && typedDecls.length > 1) {
|
|
84893
|
-
|
|
84894
|
-
|
|
84895
|
-
|
|
84896
|
-
|
|
84897
|
-
if (
|
|
84898
|
-
|
|
84899
|
-
|
|
84900
|
-
|
|
84901
|
-
|
|
84902
|
-
|
|
84903
|
-
|
|
84904
|
-
|
|
85197
|
+
if (typedDecls.length > maxTypedDeclsPerSymbol) {
|
|
85198
|
+
typedDecls = [typedDecls[typedDecls.length - 1]];
|
|
85199
|
+
} else {
|
|
85200
|
+
const filteredTypedDecls = typedDecls.filter((decl) => {
|
|
85201
|
+
if (decl.type !== 8) {
|
|
85202
|
+
const usageScope = ParseTreeUtils.getExecutionScopeNode(usageNode);
|
|
85203
|
+
const declScope = ParseTreeUtils.getExecutionScopeNode(decl.node);
|
|
85204
|
+
if (usageScope === declScope) {
|
|
85205
|
+
if (!isFlowPathBetweenNodes(
|
|
85206
|
+
decl.node,
|
|
85207
|
+
usageNode,
|
|
85208
|
+
/* allowSelf */
|
|
85209
|
+
false
|
|
85210
|
+
)) {
|
|
85211
|
+
return false;
|
|
85212
|
+
}
|
|
84905
85213
|
}
|
|
84906
85214
|
}
|
|
85215
|
+
return true;
|
|
85216
|
+
});
|
|
85217
|
+
if (filteredTypedDecls.length === 0) {
|
|
85218
|
+
return { type: types_1.UnboundType.create() };
|
|
84907
85219
|
}
|
|
84908
|
-
|
|
84909
|
-
});
|
|
84910
|
-
if (filteredTypedDecls.length === 0) {
|
|
84911
|
-
return { type: types_1.UnboundType.create() };
|
|
85220
|
+
typedDecls = filteredTypedDecls;
|
|
84912
85221
|
}
|
|
84913
|
-
typedDecls = filteredTypedDecls;
|
|
84914
85222
|
}
|
|
84915
85223
|
let declIndex = typedDecls.length - 1;
|
|
84916
85224
|
while (declIndex >= 0) {
|
|
@@ -84959,7 +85267,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
84959
85267
|
return specializedReturnType;
|
|
84960
85268
|
}
|
|
84961
85269
|
if (!(options === null || options === void 0 ? void 0 : options.skipInferReturnType)) {
|
|
84962
|
-
return
|
|
85270
|
+
return getInferredReturnType(type, options === null || options === void 0 ? void 0 : options.callSiteInfo);
|
|
84963
85271
|
}
|
|
84964
85272
|
return types_1.UnknownType.create();
|
|
84965
85273
|
}
|
|
@@ -85457,7 +85765,8 @@ var require_typeEvaluator = __commonJS({
|
|
|
85457
85765
|
const typeParam = destType.shared.typeParams[i];
|
|
85458
85766
|
const variance = types_1.TypeVarType.getVariance(typeParam);
|
|
85459
85767
|
if (curSrcType.priv.tupleTypeArgs) {
|
|
85460
|
-
typeArgType = (0, typeUtils_1.convertToInstance)(makeTupleObject(
|
|
85768
|
+
typeArgType = (0, typeUtils_1.convertToInstance)((0, tuples_1.makeTupleObject)(
|
|
85769
|
+
evaluatorInterface,
|
|
85461
85770
|
curSrcType.priv.tupleTypeArgs,
|
|
85462
85771
|
/* isUnpacked */
|
|
85463
85772
|
true
|
|
@@ -85844,6 +86153,9 @@ var require_typeEvaluator = __commonJS({
|
|
|
85844
86153
|
}
|
|
85845
86154
|
let concreteSrcType = makeTopLevelTypeVarsConcrete(srcType);
|
|
85846
86155
|
if ((0, types_1.isClass)(concreteSrcType) && types_1.TypeBase.isInstance(concreteSrcType)) {
|
|
86156
|
+
if (!destType.priv.isUnpacked && concreteSrcType.priv.isUnpacked && concreteSrcType.priv.tupleTypeArgs) {
|
|
86157
|
+
return assignType(destType, (0, typeUtils_1.combineTupleTypeArgs)(concreteSrcType.priv.tupleTypeArgs), diag, constraints, flags, recursionCount);
|
|
86158
|
+
}
|
|
85847
86159
|
if (types_1.ClassType.isEnumClass(concreteSrcType) && concreteSrcType.priv.literalValue instanceof types_1.EnumLiteral && concreteSrcType.shared.mro.some((base) => (0, types_1.isClass)(base) && types_1.ClassType.isBuiltIn(base, ["int", "str", "bytes"])) && (0, types_1.isClassInstance)(concreteSrcType.priv.literalValue.itemType) && (0, typeUtils_1.isLiteralType)(concreteSrcType.priv.literalValue.itemType) && assignType(destType, concreteSrcType.priv.literalValue.itemType)) {
|
|
85848
86160
|
return true;
|
|
85849
86161
|
}
|
|
@@ -86669,7 +86981,8 @@ var require_typeEvaluator = __commonJS({
|
|
|
86669
86981
|
}
|
|
86670
86982
|
});
|
|
86671
86983
|
if (srcTupleTypes.length !== 1 || !(0, types_1.isTypeVarTuple)(srcTupleTypes[0].type)) {
|
|
86672
|
-
const srcPositionalsType = makeTupleObject(
|
|
86984
|
+
const srcPositionalsType = (0, tuples_1.makeTupleObject)(
|
|
86985
|
+
evaluatorInterface,
|
|
86673
86986
|
srcTupleTypes,
|
|
86674
86987
|
/* isUnpacked */
|
|
86675
86988
|
true
|
|
@@ -86737,9 +87050,9 @@ var require_typeEvaluator = __commonJS({
|
|
|
86737
87050
|
const destParamName = (_c = destParam.param.name) !== null && _c !== void 0 ? _c : "";
|
|
86738
87051
|
const srcParamName = (_d = srcParam.param.name) !== null && _d !== void 0 ? _d : "";
|
|
86739
87052
|
if (destParamName) {
|
|
86740
|
-
const isDestPositionalOnly = destParam.kind === parameterUtils_1.ParamKind.Positional;
|
|
87053
|
+
const isDestPositionalOnly = destParam.kind === parameterUtils_1.ParamKind.Positional || destParam.kind === parameterUtils_1.ParamKind.ExpandedArgs;
|
|
86741
87054
|
if (!isDestPositionalOnly && destParam.param.category !== 1 && srcParam.param.category !== 1) {
|
|
86742
|
-
if (srcParam.kind === parameterUtils_1.ParamKind.Positional) {
|
|
87055
|
+
if (srcParam.kind === parameterUtils_1.ParamKind.Positional || srcParam.kind === parameterUtils_1.ParamKind.ExpandedArgs) {
|
|
86743
87056
|
diag === null || diag === void 0 ? void 0 : diag.createAddendum().addMessage(localize_1.LocAddendum.functionParamPositionOnly().format({
|
|
86744
87057
|
name: destParamName
|
|
86745
87058
|
}));
|
|
@@ -86775,7 +87088,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
86775
87088
|
if ((flags & 512) === 0 || !(0, types_1.isTypeVar)(srcParamType) || !srcParamType.shared.isSynthesized) {
|
|
86776
87089
|
canAssign = false;
|
|
86777
87090
|
}
|
|
86778
|
-
} else if (destParam.kind !== parameterUtils_1.ParamKind.Positional && srcParam.kind === parameterUtils_1.ParamKind.Positional && srcParamDetails.kwargsIndex === void 0 && !srcParamDetails.params.some((p) => p.kind === parameterUtils_1.ParamKind.Keyword && p.param.category === 0 && p.param.name === destParam.param.name)) {
|
|
87091
|
+
} else if (destParam.kind !== parameterUtils_1.ParamKind.Positional && destParam.kind !== parameterUtils_1.ParamKind.ExpandedArgs && srcParam.kind === parameterUtils_1.ParamKind.Positional && srcParamDetails.kwargsIndex === void 0 && !srcParamDetails.params.some((p) => p.kind === parameterUtils_1.ParamKind.Keyword && p.param.category === 0 && p.param.name === destParam.param.name)) {
|
|
86779
87092
|
diag === null || diag === void 0 ? void 0 : diag.addMessage(localize_1.LocAddendum.namedParamMissingInSource().format({
|
|
86780
87093
|
name: (_e = destParam.param.name) !== null && _e !== void 0 ? _e : ""
|
|
86781
87094
|
}));
|
|
@@ -86842,7 +87155,8 @@ var require_typeEvaluator = __commonJS({
|
|
|
86842
87155
|
if (!assignParam(destParamType, srcArgsType, paramIndex, diag === null || diag === void 0 ? void 0 : diag.createAddendum(), constraints, flags, recursionCount)) {
|
|
86843
87156
|
canAssign = false;
|
|
86844
87157
|
}
|
|
86845
|
-
|
|
87158
|
+
const destParamKind = destParamDetails.params[paramIndex].kind;
|
|
87159
|
+
if (destParamKind !== parameterUtils_1.ParamKind.Positional && destParamKind !== parameterUtils_1.ParamKind.ExpandedArgs && srcParamDetails.kwargsIndex === void 0) {
|
|
86846
87160
|
diag === null || diag === void 0 ? void 0 : diag.addMessage(localize_1.LocAddendum.namedParamMissingInSource().format({
|
|
86847
87161
|
name: (_g = destParamDetails.params[paramIndex].param.name) !== null && _g !== void 0 ? _g : ""
|
|
86848
87162
|
}));
|
|
@@ -86873,14 +87187,16 @@ var require_typeEvaluator = __commonJS({
|
|
|
86873
87187
|
let destArgsType = destParamDetails.params[destParamDetails.argsIndex].type;
|
|
86874
87188
|
let srcArgsType = srcParamDetails.params[srcParamDetails.argsIndex].type;
|
|
86875
87189
|
if (!(0, types_1.isUnpacked)(destArgsType)) {
|
|
86876
|
-
destArgsType = makeTupleObject(
|
|
87190
|
+
destArgsType = (0, tuples_1.makeTupleObject)(
|
|
87191
|
+
evaluatorInterface,
|
|
86877
87192
|
[{ type: destArgsType, isUnbounded: true }],
|
|
86878
87193
|
/* isUnpacked */
|
|
86879
87194
|
true
|
|
86880
87195
|
);
|
|
86881
87196
|
}
|
|
86882
87197
|
if (!(0, types_1.isUnpacked)(srcArgsType)) {
|
|
86883
|
-
srcArgsType = makeTupleObject(
|
|
87198
|
+
srcArgsType = (0, tuples_1.makeTupleObject)(
|
|
87199
|
+
evaluatorInterface,
|
|
86884
87200
|
[{ type: srcArgsType, isUnbounded: true }],
|
|
86885
87201
|
/* isUnpacked */
|
|
86886
87202
|
true
|
|
@@ -86901,7 +87217,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
86901
87217
|
if (destParamDetails.firstKeywordOnlyIndex !== void 0) {
|
|
86902
87218
|
destParamDetails.params.forEach((param, index) => {
|
|
86903
87219
|
if (index >= destParamDetails.firstKeywordOnlyIndex) {
|
|
86904
|
-
if (param.param.name && param.param.category === 0 && param.kind !== parameterUtils_1.ParamKind.Positional) {
|
|
87220
|
+
if (param.param.name && param.param.category === 0 && param.kind !== parameterUtils_1.ParamKind.Positional && param.kind !== parameterUtils_1.ParamKind.ExpandedArgs) {
|
|
86905
87221
|
destParamMap.set(param.param.name, param);
|
|
86906
87222
|
}
|
|
86907
87223
|
}
|
|
@@ -87172,7 +87488,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
87172
87488
|
}
|
|
87173
87489
|
return assignedSubtype;
|
|
87174
87490
|
}
|
|
87175
|
-
if (!(0, types_1.isTypeVar)(declaredSubtype) && (0, types_1.isTypeVar)(assignedSubtype)) {
|
|
87491
|
+
if (!(0, types_1.isTypeVar)(declaredSubtype) && (0, types_1.isTypeVar)(assignedSubtype) && !types_1.TypeVarType.isBound(assignedSubtype)) {
|
|
87176
87492
|
return declaredSubtype;
|
|
87177
87493
|
}
|
|
87178
87494
|
if ((0, typeUtils_1.containsAnyRecursive)(
|
|
@@ -87394,7 +87710,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
87394
87710
|
}
|
|
87395
87711
|
}
|
|
87396
87712
|
} else if (i < overrideParamDetails.positionOnlyParamCount && i >= baseParamDetails.positionOnlyParamCount) {
|
|
87397
|
-
if (!types_1.FunctionParam.isNameSynthesized(baseParam) && baseParamDetails.params[i].kind !== parameterUtils_1.ParamKind.Positional) {
|
|
87713
|
+
if (!types_1.FunctionParam.isNameSynthesized(baseParam) && baseParamDetails.params[i].kind !== parameterUtils_1.ParamKind.Positional && baseParamDetails.params[i].kind !== parameterUtils_1.ParamKind.ExpandedArgs) {
|
|
87398
87714
|
diag === null || diag === void 0 ? void 0 : diag.addMessage(localize_1.LocAddendum.overrideParamNamePositionOnly().format({
|
|
87399
87715
|
index: i + 1,
|
|
87400
87716
|
baseName: baseParam.name || "*"
|
|
@@ -87974,7 +88290,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
87974
88290
|
function printControlFlowGraph(flowNode, reference, callName, logger) {
|
|
87975
88291
|
return codeFlowEngine.printControlFlowGraph(flowNode, reference, callName, logger);
|
|
87976
88292
|
}
|
|
87977
|
-
const
|
|
88293
|
+
const getInferredReturnType = wrapWithLogger(_getInferredReturnType);
|
|
87978
88294
|
const evaluatorInterface = {
|
|
87979
88295
|
runWithCancellationToken,
|
|
87980
88296
|
getType,
|
|
@@ -88020,6 +88336,8 @@ var require_typeEvaluator = __commonJS({
|
|
|
88020
88336
|
getTypeOfIterator,
|
|
88021
88337
|
getGetterTypeFromProperty,
|
|
88022
88338
|
getTypeOfArg,
|
|
88339
|
+
convertNodeToArg,
|
|
88340
|
+
buildTupleTypesList,
|
|
88023
88341
|
markNamesAccessed,
|
|
88024
88342
|
expandPromotionTypes,
|
|
88025
88343
|
makeTopLevelTypeVarsConcrete,
|
|
@@ -88031,8 +88349,8 @@ var require_typeEvaluator = __commonJS({
|
|
|
88031
88349
|
getEffectiveTypeOfSymbolForUsage,
|
|
88032
88350
|
getInferredTypeOfDeclaration,
|
|
88033
88351
|
getDeclaredTypeForExpression,
|
|
88034
|
-
|
|
88035
|
-
|
|
88352
|
+
getDeclaredReturnType,
|
|
88353
|
+
getInferredReturnType,
|
|
88036
88354
|
getBestOverloadForArgs,
|
|
88037
88355
|
getBuiltInType,
|
|
88038
88356
|
getTypeOfMember,
|
|
@@ -88584,7 +88902,7 @@ var require_checker = __commonJS({
|
|
|
88584
88902
|
let returnTypeResult;
|
|
88585
88903
|
let returnType;
|
|
88586
88904
|
const enclosingFunctionNode = ParseTreeUtils.getEnclosingFunction(node);
|
|
88587
|
-
let declaredReturnType = enclosingFunctionNode ? this._evaluator.
|
|
88905
|
+
let declaredReturnType = enclosingFunctionNode ? this._evaluator.getDeclaredReturnType(enclosingFunctionNode) : void 0;
|
|
88588
88906
|
if (node.d.expr) {
|
|
88589
88907
|
returnTypeResult = (_a = this._evaluator.getTypeResult(node.d.expr)) !== null && _a !== void 0 ? _a : { type: types_1.UnknownType.create() };
|
|
88590
88908
|
} else {
|
|
@@ -88803,10 +89121,6 @@ var require_checker = __commonJS({
|
|
|
88803
89121
|
return true;
|
|
88804
89122
|
}
|
|
88805
89123
|
visitBinaryOperation(node) {
|
|
88806
|
-
if (node.d.operator === 36 || node.d.operator === 37) {
|
|
88807
|
-
this._validateConditionalIsBool(node.d.leftExpr);
|
|
88808
|
-
this._validateConditionalIsBool(node.d.rightExpr);
|
|
88809
|
-
}
|
|
88810
89124
|
if (node.d.operator === 12 || node.d.operator === 28) {
|
|
88811
89125
|
if (!ParseTreeUtils.isWithinAssertExpression(node)) {
|
|
88812
89126
|
this._validateComparisonTypes(node);
|
|
@@ -89809,8 +90123,8 @@ var require_checker = __commonJS({
|
|
|
89809
90123
|
64 | 2 | 512
|
|
89810
90124
|
/* AssignTypeFlags.SkipSelfClsTypeCheck */
|
|
89811
90125
|
);
|
|
89812
|
-
const overloadReturnType = this._evaluator.solveAndApplyConstraints((_d = types_1.FunctionType.getEffectiveReturnType(overloadBound)) !== null && _d !== void 0 ? _d : this._evaluator.
|
|
89813
|
-
const implReturnType = this._evaluator.solveAndApplyConstraints((_e = types_1.FunctionType.getEffectiveReturnType(implBound)) !== null && _e !== void 0 ? _e : this._evaluator.
|
|
90126
|
+
const overloadReturnType = this._evaluator.solveAndApplyConstraints((_d = types_1.FunctionType.getEffectiveReturnType(overloadBound)) !== null && _d !== void 0 ? _d : this._evaluator.getInferredReturnType(overloadBound), constraints);
|
|
90127
|
+
const implReturnType = this._evaluator.solveAndApplyConstraints((_e = types_1.FunctionType.getEffectiveReturnType(implBound)) !== null && _e !== void 0 ? _e : this._evaluator.getInferredReturnType(implBound), constraints);
|
|
89814
90128
|
const returnDiag = new diagnostic_1.DiagnosticAddendum();
|
|
89815
90129
|
if (!(0, types_1.isNever)(overloadReturnType) && !this._evaluator.assignType(
|
|
89816
90130
|
implReturnType,
|
|
@@ -90295,14 +90609,14 @@ var require_checker = __commonJS({
|
|
|
90295
90609
|
const primaryType = (_a = this._evaluator.getTypeForDeclaration(primaryDecl)) === null || _a === void 0 ? void 0 : _a.type;
|
|
90296
90610
|
let duplicateIsOk = false;
|
|
90297
90611
|
if (primaryType && (0, types_1.isFunction)(primaryType)) {
|
|
90298
|
-
this._evaluator.
|
|
90612
|
+
this._evaluator.getInferredReturnType(primaryType);
|
|
90299
90613
|
}
|
|
90300
90614
|
const otherType = (_b = this._evaluator.getTypeForDeclaration(otherDecl)) === null || _b === void 0 ? void 0 : _b.type;
|
|
90301
90615
|
const suite1 = ParseTreeUtils.getEnclosingSuite(primaryDecl.node);
|
|
90302
90616
|
const suite2 = ParseTreeUtils.getEnclosingSuite(otherDecl.node);
|
|
90303
90617
|
const isInSameStatementList = suite1 === suite2;
|
|
90304
90618
|
if (otherType && (0, types_1.isFunction)(otherType)) {
|
|
90305
|
-
this._evaluator.
|
|
90619
|
+
this._evaluator.getInferredReturnType(otherType);
|
|
90306
90620
|
}
|
|
90307
90621
|
if (!isInSameStatementList && primaryType && otherType && (0, types_1.isTypeSame)(primaryType, otherType)) {
|
|
90308
90622
|
duplicateIsOk = true;
|
|
@@ -91088,7 +91402,7 @@ var require_checker = __commonJS({
|
|
|
91088
91402
|
this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.initMustReturnNone(), returnAnnotation);
|
|
91089
91403
|
}
|
|
91090
91404
|
} else {
|
|
91091
|
-
const inferredReturnType = this._evaluator.
|
|
91405
|
+
const inferredReturnType = this._evaluator.getInferredReturnType(functionType);
|
|
91092
91406
|
if (!(0, types_1.isNever)(inferredReturnType) && !(0, typeUtils_1.isNoneInstance)(inferredReturnType) && !(0, types_1.isAnyOrUnknown)(inferredReturnType)) {
|
|
91093
91407
|
this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.initMustReturnNone(), node.d.name);
|
|
91094
91408
|
}
|
|
@@ -91132,7 +91446,7 @@ var require_checker = __commonJS({
|
|
|
91132
91446
|
}
|
|
91133
91447
|
}
|
|
91134
91448
|
} else {
|
|
91135
|
-
const inferredReturnType = this._evaluator.
|
|
91449
|
+
const inferredReturnType = this._evaluator.getInferredReturnType(functionType);
|
|
91136
91450
|
this._reportUnknownReturnResult(node, inferredReturnType);
|
|
91137
91451
|
this._validateReturnTypeIsNotContravariant(inferredReturnType, node.d.name);
|
|
91138
91452
|
}
|
|
@@ -92126,7 +92440,7 @@ var require_checker = __commonJS({
|
|
|
92126
92440
|
/* AssignTypeFlags.Default */
|
|
92127
92441
|
)) {
|
|
92128
92442
|
diag.addMessage(localize_1.LocAddendum.typedDictClosedExtraTypeMismatch().format({
|
|
92129
|
-
name: "
|
|
92443
|
+
name: "extra_items",
|
|
92130
92444
|
type: this._evaluator.printType(typedDictEntries.extraItems.valueType)
|
|
92131
92445
|
}));
|
|
92132
92446
|
}
|
|
@@ -92381,12 +92695,7 @@ var require_checker = __commonJS({
|
|
|
92381
92695
|
}
|
|
92382
92696
|
}
|
|
92383
92697
|
if (childClassType.shared.typedDictEntries) {
|
|
92384
|
-
|
|
92385
|
-
overrideTDEntry = overriddenTDEntry;
|
|
92386
|
-
overrideType = baseType;
|
|
92387
|
-
} else {
|
|
92388
|
-
overrideTDEntry = (_g = (_f = childClassType.shared.typedDictEntries.knownItems.get(memberName)) !== null && _f !== void 0 ? _f : childClassType.shared.typedDictEntries.extraItems) !== null && _g !== void 0 ? _g : (0, typedDicts_1.getEffectiveExtraItemsEntryType)(this._evaluator, childClassType);
|
|
92389
|
-
}
|
|
92698
|
+
overrideTDEntry = (_g = (_f = childClassType.shared.typedDictEntries.knownItems.get(memberName)) !== null && _f !== void 0 ? _f : childClassType.shared.typedDictEntries.extraItems) !== null && _g !== void 0 ? _g : (0, typedDicts_1.getEffectiveExtraItemsEntryType)(this._evaluator, childClassType);
|
|
92390
92699
|
}
|
|
92391
92700
|
}
|
|
92392
92701
|
let diagAddendum = new diagnostic_1.DiagnosticAddendum();
|