coc-pyright 1.1.398 → 1.1.400
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 +382 -233
- package/package.json +4 -4
package/lib/index.js
CHANGED
|
@@ -16099,8 +16099,8 @@ var require_serviceProviderExtensions = __commonJS({
|
|
|
16099
16099
|
return result;
|
|
16100
16100
|
};
|
|
16101
16101
|
var DefaultSourceFileFactory = {
|
|
16102
|
-
createSourceFile(serviceProvider, fileUri, moduleName, isThirdPartyImport, isThirdPartyPyTypedPresent,
|
|
16103
|
-
return new sourceFile_1.SourceFile(serviceProvider, fileUri, moduleName, isThirdPartyImport, isThirdPartyPyTypedPresent,
|
|
16102
|
+
createSourceFile(serviceProvider, fileUri, moduleName, isThirdPartyImport, isThirdPartyPyTypedPresent, editMode, console2, logTracker, ipythonMode) {
|
|
16103
|
+
return new sourceFile_1.SourceFile(serviceProvider, fileUri, moduleName, isThirdPartyImport, isThirdPartyPyTypedPresent, editMode, console2, logTracker, ipythonMode);
|
|
16104
16104
|
}
|
|
16105
16105
|
};
|
|
16106
16106
|
}
|
|
@@ -16943,6 +16943,7 @@ var require_package_nls_cs = __commonJS({
|
|
|
16943
16943
|
kwargsParamMissing: "Parametr \u201E**{paramName}\u201C nem\xE1 \u017E\xE1dn\xFD odpov\xEDdaj\xEDc\xED parametr",
|
|
16944
16944
|
listAssignmentMismatch: "Typ {type} nen\xED kompatibiln\xED s c\xEDlov\xFDm seznamem",
|
|
16945
16945
|
literalAssignmentMismatch: "{sourceType} se ned\xE1 p\u0159i\u0159adit k typu {destType}.",
|
|
16946
|
+
literalNotAllowed: '"Literal" special form cannot be used with instance and class checks',
|
|
16946
16947
|
matchIsNotExhaustiveHint: "Pokud nen\xED zam\xFD\u0161leno vy\u010Derp\xE1vaj\xEDc\xED zpracov\xE1n\xED, p\u0159idejte case _: pass",
|
|
16947
16948
|
matchIsNotExhaustiveType: "Nezpracovan\xFD typ: {type}",
|
|
16948
16949
|
memberAssignment: "V\xFDraz typu {type} nelze p\u0159i\u0159adit k atributu {name} t\u0159\xEDdy {classType}.",
|
|
@@ -17784,6 +17785,7 @@ var require_package_nls_de = __commonJS({
|
|
|
17784
17785
|
kwargsParamMissing: 'Der Parameter "**{paramName}" weist keinen entsprechenden Parameter auf.',
|
|
17785
17786
|
listAssignmentMismatch: 'Der Typ "{type}" ist nicht mit der Zielliste kompatibel.',
|
|
17786
17787
|
literalAssignmentMismatch: "\u201E{sourceType}\u201C kann dem Typ \u201E{destType}\u201C nicht zugewiesen werden.",
|
|
17788
|
+
literalNotAllowed: '"Literal" special form cannot be used with instance and class checks',
|
|
17787
17789
|
matchIsNotExhaustiveHint: 'Wenn keine ausf\xFChrliche Behandlung beabsichtigt ist, f\xFCgen Sie "case _: pass" hinzu.',
|
|
17788
17790
|
matchIsNotExhaustiveType: 'Unbehandelter Typ: "{type}"',
|
|
17789
17791
|
memberAssignment: "Ein Ausdruck vom Typ \u201E{type}\u201C kann dem Attribut \u201E{name}\u201C der Klasse \u201E{classType}\u201C nicht zugewiesen werden",
|
|
@@ -18407,6 +18409,18 @@ var require_package_nls_en_us = __commonJS({
|
|
|
18407
18409
|
message: 'A "Final" variable cannot be assigned within a loop',
|
|
18408
18410
|
comment: "{Locked='Final'}"
|
|
18409
18411
|
},
|
|
18412
|
+
finallyBreak: {
|
|
18413
|
+
message: 'A "break" cannot be used to exit a "finally" block',
|
|
18414
|
+
comment: "{Locked='break', 'finally'}"
|
|
18415
|
+
},
|
|
18416
|
+
finallyContinue: {
|
|
18417
|
+
message: 'A "continue" cannot be used to exit a "finally" block',
|
|
18418
|
+
comment: "{Locked='continue', 'finally'}"
|
|
18419
|
+
},
|
|
18420
|
+
finallyReturn: {
|
|
18421
|
+
message: 'A "return" cannot be used to exit a "finally" block',
|
|
18422
|
+
comment: "{Locked='return', 'finally'}"
|
|
18423
|
+
},
|
|
18410
18424
|
finalMethodOverride: {
|
|
18411
18425
|
message: 'Method "{name}" cannot override final method defined in class "{className}"',
|
|
18412
18426
|
comment: "{Locked='final'}"
|
|
@@ -18684,6 +18698,10 @@ var require_package_nls_en_us = __commonJS({
|
|
|
18684
18698
|
message: 'Cannot override "{name}" because parent class "{className}" is a named tuple',
|
|
18685
18699
|
comment: "{Locked='tuple'}"
|
|
18686
18700
|
},
|
|
18701
|
+
namedTupleFieldUnderscore: {
|
|
18702
|
+
message: "Named tuple field names cannot start with an underscore",
|
|
18703
|
+
comment: "{Locked='Named','tuple'}"
|
|
18704
|
+
},
|
|
18687
18705
|
namedTupleFirstArg: {
|
|
18688
18706
|
message: "Expected named tuple class name as first argument",
|
|
18689
18707
|
comment: "{Locked='tuple'}"
|
|
@@ -18703,7 +18721,7 @@ var require_package_nls_en_us = __commonJS({
|
|
|
18703
18721
|
},
|
|
18704
18722
|
namedTupleNoTypes: {
|
|
18705
18723
|
message: '"namedtuple" provides no types for tuple entries; use "NamedTuple" instead',
|
|
18706
|
-
comment:
|
|
18724
|
+
comment: "{Locked='namedtuple','tuple','NamedTuple'}"
|
|
18707
18725
|
},
|
|
18708
18726
|
namedTupleSecondArg: {
|
|
18709
18727
|
message: "Expected named tuple entry list as second argument",
|
|
@@ -19765,6 +19783,10 @@ var require_package_nls_en_us = __commonJS({
|
|
|
19765
19783
|
kwargsParamMissing: 'Parameter "**{paramName}" has no corresponding parameter',
|
|
19766
19784
|
listAssignmentMismatch: 'Type "{type}" is incompatible with target list',
|
|
19767
19785
|
literalAssignmentMismatch: '"{sourceType}" is not assignable to type "{destType}"',
|
|
19786
|
+
literalNotAllowed: {
|
|
19787
|
+
message: '"Literal" special form cannot be used with instance and class checks',
|
|
19788
|
+
comment: "{Locked='Literal'}"
|
|
19789
|
+
},
|
|
19768
19790
|
matchIsNotExhaustiveHint: {
|
|
19769
19791
|
message: 'If exhaustive handling is not intended, add "case _: pass"',
|
|
19770
19792
|
comment: "{Locked='case _: pass'}"
|
|
@@ -20741,6 +20763,7 @@ var require_package_nls_es = __commonJS({
|
|
|
20741
20763
|
kwargsParamMissing: 'El par\xE1metro "**{paramName}" no tiene ning\xFAn par\xE1metro correspondiente.',
|
|
20742
20764
|
listAssignmentMismatch: 'El tipo "{type}" es incompatible con la lista de objetivos',
|
|
20743
20765
|
literalAssignmentMismatch: '"{sourceType}" no se puede asignar al tipo "{destType}"',
|
|
20766
|
+
literalNotAllowed: '"Literal" special form cannot be used with instance and class checks',
|
|
20744
20767
|
matchIsNotExhaustiveHint: 'Si no se pretende un tratamiento exhaustivo, agregue "case _: pass"',
|
|
20745
20768
|
matchIsNotExhaustiveType: 'Tipo no manejado: "{type}"',
|
|
20746
20769
|
memberAssignment: 'La expresi\xF3n de tipo "{type}" no se puede asignar al atributo "{name}" de la clase "{classType}"',
|
|
@@ -21582,6 +21605,7 @@ var require_package_nls_fr = __commonJS({
|
|
|
21582
21605
|
kwargsParamMissing: `Le param\xE8tre "**{paramName}" n'a pas de param\xE8tre correspondant`,
|
|
21583
21606
|
listAssignmentMismatch: "Le type \xAB\xA0{type}\xA0\xBB n\u2019est pas compatible avec la liste cible",
|
|
21584
21607
|
literalAssignmentMismatch: "\xAB\xA0{sourceType}\xA0\xBB n\u2019est pas assignable au type \xAB\xA0{destType}\xA0\xBB",
|
|
21608
|
+
literalNotAllowed: '"Literal" special form cannot be used with instance and class checks',
|
|
21585
21609
|
matchIsNotExhaustiveHint: "Si la gestion exhaustive n\u2019est pas pr\xE9vue, ajoutez \xAB case _: pass \xBB",
|
|
21586
21610
|
matchIsNotExhaustiveType: "Type non g\xE9r\xE9 : \xAB\xA0{type}\xA0\xBB",
|
|
21587
21611
|
memberAssignment: "L'expression de type \xAB\xA0{type}\xA0\xBB ne peut pas \xEAtre attribu\xE9e \xE0 l\u2019attribut \xAB\xA0{name}\xA0\xBB de la classe \xAB\xA0{classType}\xA0\xBB",
|
|
@@ -22423,6 +22447,7 @@ var require_package_nls_it = __commonJS({
|
|
|
22423
22447
|
kwargsParamMissing: 'Il parametro "**{paramName}" non ha un parametro corrispondente',
|
|
22424
22448
|
listAssignmentMismatch: `Il tipo "{type}" non \xE8 compatibile con l'elenco di destinazione`,
|
|
22425
22449
|
literalAssignmentMismatch: '"{sourceType}" non \xE8 assegnabile al tipo "{destType}"',
|
|
22450
|
+
literalNotAllowed: '"Literal" special form cannot be used with instance and class checks',
|
|
22426
22451
|
matchIsNotExhaustiveHint: 'Se la gestione completa non \xE8 prevista, aggiungere "case _: pass"',
|
|
22427
22452
|
matchIsNotExhaustiveType: 'Tipo non gestito: "{type}"',
|
|
22428
22453
|
memberAssignment: `L'espressione di tipo "{type}" non pu\xF2 essere assegnata all'attributo "{name}" della classe "{classType}".`,
|
|
@@ -23264,6 +23289,7 @@ var require_package_nls_ja = __commonJS({
|
|
|
23264
23289
|
kwargsParamMissing: '\u30D1\u30E9\u30E1\u30FC\u30BF\u30FC "**{paramName}" \u306B\u5BFE\u5FDC\u3059\u308B\u30D1\u30E9\u30E1\u30FC\u30BF\u30FC\u304C\u3042\u308A\u307E\u305B\u3093',
|
|
23265
23290
|
listAssignmentMismatch: '\u578B "{type}" \u306F\u30BF\u30FC\u30B2\u30C3\u30C8 \u30EA\u30B9\u30C8\u3068\u4E92\u63DB\u6027\u304C\u3042\u308A\u307E\u305B\u3093',
|
|
23266
23291
|
literalAssignmentMismatch: '"{sourceType}" \u306F\u578B "{destType}" \u306B\u5272\u308A\u5F53\u3066\u3067\u304D\u307E\u305B\u3093',
|
|
23292
|
+
literalNotAllowed: '"Literal" special form cannot be used with instance and class checks',
|
|
23267
23293
|
matchIsNotExhaustiveHint: '\u5B8C\u5168\u306A\u51E6\u7406\u304C\u610F\u56F3\u3055\u308C\u3066\u3044\u306A\u3044\u5834\u5408\u306F\u3001"case _: pass" \u3092\u8FFD\u52A0\u3057\u307E\u3059',
|
|
23268
23294
|
matchIsNotExhaustiveType: '\u30CF\u30F3\u30C9\u30EB\u3055\u308C\u306A\u3044\u578B: "{type}"',
|
|
23269
23295
|
memberAssignment: '\u578B "{type}" \u306E\u5F0F\u3092\u30AF\u30E9\u30B9 "{classType}" \u306E\u5C5E\u6027 "{name}" \u306B\u5272\u308A\u5F53\u3066\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093',
|
|
@@ -24105,6 +24131,7 @@ var require_package_nls_ko = __commonJS({
|
|
|
24105
24131
|
kwargsParamMissing: "\u2018**{paramName}\u2019 \uB9E4\uAC1C \uBCC0\uC218\uC5D0 \uD574\uB2F9\uD558\uB294 \uB9E4\uAC1C \uBCC0\uC218\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.",
|
|
24106
24132
|
listAssignmentMismatch: '"{type}" \uD615\uC2DD\uC774 \uB300\uC0C1 \uBAA9\uB85D\uACFC \uD638\uD658\uB418\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.',
|
|
24107
24133
|
literalAssignmentMismatch: '"{sourceType}"\uC740 \uD615\uC2DD "{destType}"\uC5D0 \uD560\uB2F9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.',
|
|
24134
|
+
literalNotAllowed: '"Literal" special form cannot be used with instance and class checks',
|
|
24108
24135
|
matchIsNotExhaustiveHint: '\uC804\uCCB4 \uCC98\uB9AC\uAC00 \uC758\uB3C4\uB418\uC9C0 \uC54A\uC740 \uACBD\uC6B0 "case _: pass"\uB97C \uCD94\uAC00\uD569\uB2C8\uB2E4.',
|
|
24109
24136
|
matchIsNotExhaustiveType: '\uCC98\uB9AC\uB418\uC9C0 \uC54A\uC740 \uD615\uC2DD: "{type}"',
|
|
24110
24137
|
memberAssignment: '"{type}" \uD615\uC2DD\uC758 \uC2DD\uC744 "{classType}" \uD074\uB798\uC2A4\uC758 "{name}" \uD2B9\uC131\uC5D0 \uD560\uB2F9\uD560 \uC218 \uC5C6\uC74C',
|
|
@@ -24946,6 +24973,7 @@ var require_package_nls_pl = __commonJS({
|
|
|
24946
24973
|
kwargsParamMissing: "Parametr \u201E**{paramName}\u201D nie ma odpowiadaj\u0105cego mu parametru",
|
|
24947
24974
|
listAssignmentMismatch: "Typ \u201E{type}\u201D jest niezgodny z list\u0105 docelow\u0105",
|
|
24948
24975
|
literalAssignmentMismatch: "Nie mo\u017Cna przypisa\u0107 typu \u201E{sourceType}\u201D do typu \u201E{destType}\u201D",
|
|
24976
|
+
literalNotAllowed: '"Literal" special form cannot be used with instance and class checks',
|
|
24949
24977
|
matchIsNotExhaustiveHint: "Je\u015Bli kompleksowa obs\u0142uga nie jest zamierzona, dodaj \u201Ecase _: pass\u201D",
|
|
24950
24978
|
matchIsNotExhaustiveType: "Nieobs\u0142ugiwany typ: \u201E{type}\u201D",
|
|
24951
24979
|
memberAssignment: "Wyra\u017Cenia typu \u201E{type}\u201D nie mo\u017Cna przypisa\u0107 do atrybutu \u201E{name}\u201D klasy \u201E{classType}\u201D",
|
|
@@ -25787,6 +25815,7 @@ var require_package_nls_pt_br = __commonJS({
|
|
|
25787
25815
|
kwargsParamMissing: 'O par\xE2metro "**{paramName}" n\xE3o tem nenhum par\xE2metro correspondente',
|
|
25788
25816
|
listAssignmentMismatch: 'O tipo "{type}" \xE9 incompat\xEDvel com a lista de destino',
|
|
25789
25817
|
literalAssignmentMismatch: '"{sourceType}" n\xE3o pode ser atribu\xEDdo a o tipo"{destType}"',
|
|
25818
|
+
literalNotAllowed: '"Literal" special form cannot be used with instance and class checks',
|
|
25790
25819
|
matchIsNotExhaustiveHint: 'Se n\xE3o pretende usar a manipula\xE7\xE3o exaustiva, adicione "case _: pass"',
|
|
25791
25820
|
matchIsNotExhaustiveType: 'Tipo sem tratamento: "{type}"',
|
|
25792
25821
|
memberAssignment: 'A express\xE3o do tipo "{type}" n\xE3o pode ser atribu\xEDda ao atributo "{name}" da classe "{classType}"',
|
|
@@ -26628,6 +26657,7 @@ var require_package_nls_qps_ploc = __commonJS({
|
|
|
26628
26657
|
kwargsParamMissing: '[KHgb2][\u0E19\u0E31\u0E49P\xE6r\xE6m\xEBt\xEBr "**{p\xE6r\xE6m\xD1\xE6m\xEB}" h\xE6s \xF1\xF8 \xE7\xF8rr\xEBsp\xF8\xF1\xF0\xEF\xF1g 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]',
|
|
26629
26658
|
listAssignmentMismatch: '[fERKI][\u0E19\u0E31\u0E49T\xFFp\xEB "{t\xFFp\xEB}" \xEFs \xEF\xF1\xE7\xF8mp\xE6t\xEF\xFEl\xEB w\xEFth t\xE6rg\xEBt l\xEFst\u1EA4\u011F\u502A\u0130\u0402\u04B0\u0915\u094D\u0930\u094D\u0924\u093F\u0943\u307E\u1EA4\u011F\u502A\u0130\u0E19\u0E31\u0E49\u0922\u0942\u0901]',
|
|
26630
26659
|
literalAssignmentMismatch: '[17LiQ][\u0E19\u0E31\u0E49"{s\xF8\xB5r\xE7\xEBT\xFFp\xEB}" \xEFs \xF1\xF8t \xE6ss\xEFg\xF1\xE6\xFEl\xEB t\xF8 t\xFFp\xEB "{\xF0\xEBstT\xFFp\xEB}"\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
|
+
literalNotAllowed: '[kRsub][\u0E19\u0E31\u0E49"Literal" sp\xEB\xE7\xEF\xE6l f\xF8rm \xE7\xE6\xF1\xF1\xF8t \xFE\xEB \xB5s\xEB\xF0 w\xEFth \xEF\xF1st\xE6\xF1\xE7\xEB \xE6\xF1\xF0 \xE7l\xE6ss \xE7h\xEB\xE7ks\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]',
|
|
26631
26661
|
matchIsNotExhaustiveHint: '[3NR39][\u0E19\u0E31\u0E49\xCFf \xEBxh\xE6\xB5st\xEFv\xEB h\xE6\xF1\xF0l\xEF\xF1g \xEFs \xF1\xF8t \xEF\xF1t\xEB\xF1\xF0\xEB\xF0, \xE6\xF0\xF0 "case _: pass"\u1EA4\u011F\u502A\u0130\u0402\u04B0\u0915\u094D\u0930\u094D\u0924\u093F\u0943\u307E\u1EA4\u011F\u502A\u0130\u0402\u04B0\u0915\u094D\u0930\u094D\u0E19\u0E31\u0E49\u0922\u0942\u0901]',
|
|
26632
26662
|
matchIsNotExhaustiveType: '[9RN1P][\u0E19\u0E31\u0E49\xDC\xF1h\xE6\xF1\xF0l\xEB\xF0 t\xFFp\xEB: "{t\xFFp\xEB}"\u1EA4\u011F\u502A\u0130\u0402\u04B0\u0915\u094D\u0930\u094D\u0E19\u0E31\u0E49\u0922\u0942\u0901]',
|
|
26633
26663
|
memberAssignment: '[1WFCt][\u0E19\u0E31\u0E49\xCBxpr\xEBss\xEF\xF8\xF1 \xF8f t\xFFp\xEB "{t\xFFp\xEB}" \xE7\xE6\xF1\xF1\xF8t \xFE\xEB \xE6ss\xEFg\xF1\xEB\xF0 t\xF8 \xE6ttr\xEF\xFE\xB5t\xEB "{\xF1\xE6m\xEB}" \xF8f \xE7l\xE6ss "{\xE7l\xE6ssT\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\u502A\u0130\u0402\u04B0\u0915\u094D\u0E19\u0E31\u0E49\u0922\u0942\u0901]',
|
|
@@ -27469,6 +27499,7 @@ var require_package_nls_ru = __commonJS({
|
|
|
27469
27499
|
kwargsParamMissing: '\u0423 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u0430 "**{paramName}" \u043D\u0435\u0442 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044E\u0449\u0435\u0433\u043E \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u0430',
|
|
27470
27500
|
listAssignmentMismatch: '\u0422\u0438\u043F "{type}" \u043D\u0435\u0441\u043E\u0432\u043C\u0435\u0441\u0442\u0438\u043C \u0441 \u0446\u0435\u043B\u0435\u0432\u044B\u043C \u0441\u043F\u0438\u0441\u043A\u043E\u043C',
|
|
27471
27501
|
literalAssignmentMismatch: '"{sourceType}" \u043D\u0435\u0432\u043E\u0437\u043C\u043E\u0436\u043D\u043E \u043D\u0430\u0437\u043D\u0430\u0447\u0438\u0442\u044C \u0442\u0438\u043F "{destType}"',
|
|
27502
|
+
literalNotAllowed: '"Literal" special form cannot be used with instance and class checks',
|
|
27472
27503
|
matchIsNotExhaustiveHint: '\u0415\u0441\u043B\u0438 \u043D\u0435 \u043F\u0440\u0435\u0434\u043F\u043E\u043B\u0430\u0433\u0430\u0435\u0442\u0441\u044F \u0438\u0441\u0447\u0435\u0440\u043F\u044B\u0432\u0430\u044E\u0449\u0430\u044F \u043E\u0431\u0440\u0430\u0431\u043E\u0442\u043A\u0430, \u0434\u043E\u0431\u0430\u0432\u044C\u0442\u0435 "case _: pass"',
|
|
27473
27504
|
matchIsNotExhaustiveType: '\u0422\u0438\u043F "{type}" \u043D\u0435 \u043E\u0431\u0440\u0430\u0431\u0430\u0442\u044B\u0432\u0430\u0435\u0442\u0441\u044F',
|
|
27474
27505
|
memberAssignment: '\u0412\u044B\u0440\u0430\u0436\u0435\u043D\u0438\u0435 \u0442\u0438\u043F\u0430 "{type}" \u043D\u0435 \u043C\u043E\u0436\u0435\u0442 \u0431\u044B\u0442\u044C \u043D\u0430\u0437\u043D\u0430\u0447\u0435\u043D\u043E \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0443 "{name}" \u043A\u043B\u0430\u0441\u0441\u0430 "{classType}"',
|
|
@@ -28310,6 +28341,7 @@ var require_package_nls_tr = __commonJS({
|
|
|
28310
28341
|
kwargsParamMissing: '"**{paramName}" parametresine kar\u015F\u0131l\u0131k gelen bir parametre yok',
|
|
28311
28342
|
listAssignmentMismatch: '"{type}" t\xFCr\xFC hedef listeyle uyumsuz',
|
|
28312
28343
|
literalAssignmentMismatch: '"{sourceType}" "{destType}" t\xFCr\xFCne atanamaz',
|
|
28344
|
+
literalNotAllowed: '"Literal" special form cannot be used with instance and class checks',
|
|
28313
28345
|
matchIsNotExhaustiveHint: 'T\xFCmlemeli i\u015Fleme ama\xE7lanmad\u0131ysa "case _: pass" ekleyin',
|
|
28314
28346
|
matchIsNotExhaustiveType: '"{type}" t\xFCr\xFC i\u015Flenmemi\u015F',
|
|
28315
28347
|
memberAssignment: '"{type}" t\xFCr\xFCndeki ifade, "{classType}" s\u0131n\u0131f\u0131n\u0131n "{name}" \xF6zniteli\u011Fine atanamaz',
|
|
@@ -29151,6 +29183,7 @@ var require_package_nls_zh_cn = __commonJS({
|
|
|
29151
29183
|
kwargsParamMissing: "\u53C2\u6570\u201C**{paramName}\u201D\u6CA1\u6709\u76F8\u5E94\u7684\u53C2\u6570",
|
|
29152
29184
|
listAssignmentMismatch: "\u7C7B\u578B\u201C{type}\u201D\u4E0E\u76EE\u6807\u5217\u8868\u4E0D\u517C\u5BB9",
|
|
29153
29185
|
literalAssignmentMismatch: "\u201C{sourceType}\u201D\u4E0D\u53EF\u5206\u914D\u7ED9\u7C7B\u578B\u201C{destType}\u201D",
|
|
29186
|
+
literalNotAllowed: '"Literal" special form cannot be used with instance and class checks',
|
|
29154
29187
|
matchIsNotExhaustiveHint: '\u5982\u679C\u672A\u8FDB\u884C\u8BE6\u5C3D\u5904\u7406\uFF0C\u8BF7\u6DFB\u52A0"case _: pass"',
|
|
29155
29188
|
matchIsNotExhaustiveType: '\u672A\u5904\u7406\u7684\u7C7B\u578B: "{type}"',
|
|
29156
29189
|
memberAssignment: "\u65E0\u6CD5\u5C06\u7C7B\u578B\u201C{type}\u201D\u7684\u8868\u8FBE\u5F0F\u5206\u914D\u7ED9\u7C7B\u201C{classType}\u201D\u7684\u5C5E\u6027\u201C{name}\u201D",
|
|
@@ -29992,6 +30025,7 @@ var require_package_nls_zh_tw = __commonJS({
|
|
|
29992
30025
|
kwargsParamMissing: '\u53C3\u6578 "**{paramName}" \u6C92\u6709\u5C0D\u61C9\u7684\u53C3\u6578',
|
|
29993
30026
|
listAssignmentMismatch: '\u985E\u578B "{type}" \u8207\u76EE\u6A19\u6E05\u55AE\u4E0D\u76F8\u5BB9',
|
|
29994
30027
|
literalAssignmentMismatch: '"{sourceType}" \u7121\u6CD5\u6307\u6D3E\u7D66\u578B\u5225 "{destType}"',
|
|
30028
|
+
literalNotAllowed: '"Literal" special form cannot be used with instance and class checks',
|
|
29995
30029
|
matchIsNotExhaustiveHint: '\u5982\u679C\u4E0D\u9700\u8981\u5FB9\u5E95\u8655\u7406\uFF0C\u8ACB\u65B0\u589E "case _: pass"',
|
|
29996
30030
|
matchIsNotExhaustiveType: '\u672A\u8655\u7406\u7684\u985E\u578B: "{type}"',
|
|
29997
30031
|
memberAssignment: '\u7121\u6CD5\u5C07\u578B\u5225 "{type}" \u7684\u904B\u7B97\u5F0F\u6307\u6D3E\u7D66\u985E\u5225 "{classType}" \u7684\u5C6C\u6027 "{name}"',
|
|
@@ -30489,6 +30523,9 @@ var require_localize = __commonJS({
|
|
|
30489
30523
|
Diagnostic4.finalClassIsAbstract = () => new ParameterizedString(getRawString("Diagnostic.finalClassIsAbstract"));
|
|
30490
30524
|
Diagnostic4.finalContext = () => getRawString("Diagnostic.finalContext");
|
|
30491
30525
|
Diagnostic4.finalInLoop = () => getRawString("Diagnostic.finalInLoop");
|
|
30526
|
+
Diagnostic4.finallyBreak = () => getRawString("Diagnostic.finallyBreak");
|
|
30527
|
+
Diagnostic4.finallyContinue = () => getRawString("Diagnostic.finallyContinue");
|
|
30528
|
+
Diagnostic4.finallyReturn = () => getRawString("Diagnostic.finallyReturn");
|
|
30492
30529
|
Diagnostic4.finalMethodOverride = () => new ParameterizedString(getRawString("Diagnostic.finalMethodOverride"));
|
|
30493
30530
|
Diagnostic4.finalNonMethod = () => new ParameterizedString(getRawString("Diagnostic.finalNonMethod"));
|
|
30494
30531
|
Diagnostic4.finalReassigned = () => new ParameterizedString(getRawString("Diagnostic.finalReassigned"));
|
|
@@ -30589,6 +30626,7 @@ var require_localize = __commonJS({
|
|
|
30589
30626
|
Diagnostic4.namedParamAfterParamSpecArgs = () => new ParameterizedString(getRawString("Diagnostic.namedParamAfterParamSpecArgs"));
|
|
30590
30627
|
Diagnostic4.namedTupleEmptyName = () => getRawString("Diagnostic.namedTupleEmptyName");
|
|
30591
30628
|
Diagnostic4.namedTupleEntryRedeclared = () => new ParameterizedString(getRawString("Diagnostic.namedTupleEntryRedeclared"));
|
|
30629
|
+
Diagnostic4.namedTupleFieldUnderscore = () => getRawString("Diagnostic.namedTupleFieldUnderscore");
|
|
30592
30630
|
Diagnostic4.namedTupleFirstArg = () => getRawString("Diagnostic.namedTupleFirstArg");
|
|
30593
30631
|
Diagnostic4.namedTupleMultipleInheritance = () => getRawString("Diagnostic.namedTupleMultipleInheritance");
|
|
30594
30632
|
Diagnostic4.namedTupleNameKeyword = () => getRawString("Diagnostic.namedTupleNameKeyword");
|
|
@@ -30974,6 +31012,7 @@ var require_localize = __commonJS({
|
|
|
30974
31012
|
DiagnosticAddendum2.kwargsParamMissing = () => new ParameterizedString(getRawString("DiagnosticAddendum.kwargsParamMissing"));
|
|
30975
31013
|
DiagnosticAddendum2.listAssignmentMismatch = () => new ParameterizedString(getRawString("DiagnosticAddendum.listAssignmentMismatch"));
|
|
30976
31014
|
DiagnosticAddendum2.literalAssignmentMismatch = () => new ParameterizedString(getRawString("DiagnosticAddendum.literalAssignmentMismatch"));
|
|
31015
|
+
DiagnosticAddendum2.literalNotAllowed = () => getRawString("DiagnosticAddendum.literalNotAllowed");
|
|
30977
31016
|
DiagnosticAddendum2.matchIsNotExhaustiveType = () => new ParameterizedString(getRawString("DiagnosticAddendum.matchIsNotExhaustiveType"));
|
|
30978
31017
|
DiagnosticAddendum2.matchIsNotExhaustiveHint = () => getRawString("DiagnosticAddendum.matchIsNotExhaustiveHint");
|
|
30979
31018
|
DiagnosticAddendum2.memberAssignment = () => new ParameterizedString(getRawString("DiagnosticAddendum.memberAssignment"));
|
|
@@ -35061,12 +35100,22 @@ var require_parseTreeUtils = __commonJS({
|
|
|
35061
35100
|
walker.walk(node);
|
|
35062
35101
|
return foundAwait;
|
|
35063
35102
|
}
|
|
35064
|
-
function isMatchingExpression(reference, expression) {
|
|
35103
|
+
function isMatchingExpression(reference, expression, compareName) {
|
|
35065
35104
|
if (reference.nodeType === 38) {
|
|
35105
|
+
let nameToCompare;
|
|
35066
35106
|
if (expression.nodeType === 38) {
|
|
35067
|
-
|
|
35107
|
+
nameToCompare = expression;
|
|
35068
35108
|
} else if (expression.nodeType === 4) {
|
|
35069
|
-
|
|
35109
|
+
nameToCompare = expression.d.name;
|
|
35110
|
+
}
|
|
35111
|
+
if (nameToCompare) {
|
|
35112
|
+
if (reference.d.value !== nameToCompare.d.value) {
|
|
35113
|
+
return false;
|
|
35114
|
+
}
|
|
35115
|
+
if (compareName) {
|
|
35116
|
+
return compareName(reference, nameToCompare);
|
|
35117
|
+
}
|
|
35118
|
+
return true;
|
|
35070
35119
|
}
|
|
35071
35120
|
return false;
|
|
35072
35121
|
} else if (reference.nodeType === 35 && expression.nodeType === 35) {
|
|
@@ -42460,8 +42509,6 @@ var require_tokenizer = __commonJS({
|
|
|
42460
42509
|
switch (prefix) {
|
|
42461
42510
|
case "rf":
|
|
42462
42511
|
case "fr":
|
|
42463
|
-
case "ur":
|
|
42464
|
-
case "ru":
|
|
42465
42512
|
case "br":
|
|
42466
42513
|
case "rb":
|
|
42467
42514
|
return 2;
|
|
@@ -43674,7 +43721,7 @@ var require_binder = __commonJS({
|
|
|
43674
43721
|
var _a;
|
|
43675
43722
|
const isBuiltInModule = this._fileInfo.builtinsScope === void 0;
|
|
43676
43723
|
this._addTypingImportAliasesFromBuiltinsScope();
|
|
43677
|
-
|
|
43724
|
+
this._createNewScope(
|
|
43678
43725
|
isBuiltInModule ? 5 : 4,
|
|
43679
43726
|
this._fileInfo.builtinsScope,
|
|
43680
43727
|
/* proxyScope */
|
|
@@ -43701,22 +43748,16 @@ var require_binder = __commonJS({
|
|
|
43701
43748
|
}
|
|
43702
43749
|
);
|
|
43703
43750
|
this._bindDeferred();
|
|
43704
|
-
|
|
43705
|
-
|
|
43706
|
-
|
|
43707
|
-
|
|
43708
|
-
|
|
43709
|
-
|
|
43710
|
-
|
|
43711
|
-
if (!((_a2 = this._dunderAllNames) == null ? void 0 : _a2.some((sym) => sym === name))) {
|
|
43712
|
-
if (this._fileInfo.isStubFile) {
|
|
43713
|
-
symbol.setIsExternallyHidden();
|
|
43714
|
-
} else {
|
|
43715
|
-
symbol.setPrivatePyTypedImport();
|
|
43716
|
-
}
|
|
43751
|
+
this._potentialHiddenSymbols.forEach((symbol, name) => {
|
|
43752
|
+
var _a2;
|
|
43753
|
+
if (!((_a2 = this._dunderAllNames) == null ? void 0 : _a2.some((sym) => sym === name))) {
|
|
43754
|
+
if (this._fileInfo.isStubFile) {
|
|
43755
|
+
symbol.setIsExternallyHidden();
|
|
43756
|
+
} else {
|
|
43757
|
+
symbol.setPrivatePyTypedImport();
|
|
43717
43758
|
}
|
|
43718
|
-
}
|
|
43719
|
-
}
|
|
43759
|
+
}
|
|
43760
|
+
});
|
|
43720
43761
|
this._potentialPrivateSymbols.forEach((symbol, name) => {
|
|
43721
43762
|
var _a2;
|
|
43722
43763
|
if (!((_a2 = this._dunderAllNames) == null ? void 0 : _a2.some((sym) => sym === name))) {
|
|
@@ -44409,6 +44450,7 @@ var require_binder = __commonJS({
|
|
|
44409
44450
|
this._targetFunctionDeclaration.returnStatements.push(node);
|
|
44410
44451
|
}
|
|
44411
44452
|
if (node.d.expr) {
|
|
44453
|
+
AnalyzerNodeInfo.setFlowNode(node.d.expr, this._currentFlowNode);
|
|
44412
44454
|
this.walk(node.d.expr);
|
|
44413
44455
|
}
|
|
44414
44456
|
AnalyzerNodeInfo.setFlowNode(node, this._currentFlowNode);
|
|
@@ -46836,6 +46878,7 @@ var require_types = __commonJS({
|
|
|
46836
46878
|
exports2.isUnpacked = isUnpacked;
|
|
46837
46879
|
exports2.isFunction = isFunction;
|
|
46838
46880
|
exports2.isOverloaded = isOverloaded;
|
|
46881
|
+
exports2.isFunctionOrOverloaded = isFunctionOrOverloaded;
|
|
46839
46882
|
exports2.getTypeAliasInfo = getTypeAliasInfo;
|
|
46840
46883
|
exports2.isTypeSame = isTypeSame;
|
|
46841
46884
|
exports2.removeUnknownFromUnion = removeUnknownFromUnion;
|
|
@@ -48814,6 +48857,9 @@ var require_types = __commonJS({
|
|
|
48814
48857
|
function isOverloaded(type) {
|
|
48815
48858
|
return type.category === 5;
|
|
48816
48859
|
}
|
|
48860
|
+
function isFunctionOrOverloaded(type) {
|
|
48861
|
+
return type.category === 4 || type.category === 5;
|
|
48862
|
+
}
|
|
48817
48863
|
function getTypeAliasInfo(type) {
|
|
48818
48864
|
var _a, _b;
|
|
48819
48865
|
if ((_a = type.props) == null ? void 0 : _a.typeAliasInfo) {
|
|
@@ -50215,7 +50261,10 @@ var require_typeUtils = __commonJS({
|
|
|
50215
50261
|
if (type === typeAliasPlaceholder) {
|
|
50216
50262
|
return true;
|
|
50217
50263
|
}
|
|
50218
|
-
|
|
50264
|
+
if (!(0, types_1.isUnbound)(type) && !isTypeAliasPlaceholder(type)) {
|
|
50265
|
+
return false;
|
|
50266
|
+
}
|
|
50267
|
+
return ((_a = type.props) == null ? void 0 : _a.typeAliasInfo) && type.props.typeAliasInfo.shared.name === ((_b = typeAliasPlaceholder.shared.recursiveAlias) == null ? void 0 : _b.name);
|
|
50219
50268
|
}
|
|
50220
50269
|
return (0, types_1.findSubtype)(type, (subtype) => (0, types_1.isTypeVar)(subtype) && subtype.shared === typeAliasPlaceholder.shared) !== void 0;
|
|
50221
50270
|
}
|
|
@@ -50464,7 +50513,7 @@ var require_typeUtils = __commonJS({
|
|
|
50464
50513
|
return (0, types_1.isClassInstance)(type) && types_1.ClassType.isPropertyClass(type);
|
|
50465
50514
|
}
|
|
50466
50515
|
function isCallableType(type) {
|
|
50467
|
-
if ((0, types_1.
|
|
50516
|
+
if ((0, types_1.isFunctionOrOverloaded)(type) || (0, types_1.isAnyOrUnknown)(type)) {
|
|
50468
50517
|
return true;
|
|
50469
50518
|
}
|
|
50470
50519
|
if (isEffectivelyInstantiable(type)) {
|
|
@@ -52319,7 +52368,7 @@ var require_typeUtils = __commonJS({
|
|
|
52319
52368
|
}
|
|
52320
52369
|
});
|
|
52321
52370
|
updatedSourceType = applySolvedTypeVars(sourceType, solution);
|
|
52322
|
-
(0, debug_1.assert)((0, types_1.
|
|
52371
|
+
(0, debug_1.assert)((0, types_1.isFunctionOrOverloaded)(updatedSourceType));
|
|
52323
52372
|
}
|
|
52324
52373
|
}
|
|
52325
52374
|
this._signatureTracker.addSignature(sourceType, this._expressionOffset);
|
|
@@ -56965,7 +57014,7 @@ var require_constructors = __commonJS({
|
|
|
56965
57014
|
0
|
|
56966
57015
|
/* MemberAccessFlags.Default */
|
|
56967
57016
|
)) == null ? void 0 : _a.type;
|
|
56968
|
-
if (!newMethodType || !(0, types_1.
|
|
57017
|
+
if (!newMethodType || !(0, types_1.isFunctionOrOverloaded)(newMethodType)) {
|
|
56969
57018
|
return { returnType: (0, typeUtils_1.convertToInstance)(type) };
|
|
56970
57019
|
}
|
|
56971
57020
|
return validateNewMethod(
|
|
@@ -57104,7 +57153,7 @@ var require_constructors = __commonJS({
|
|
|
57104
57153
|
return void 0;
|
|
57105
57154
|
}
|
|
57106
57155
|
const callType = evaluator.getTypeOfMember(callInfo);
|
|
57107
|
-
if (!(0, types_1.
|
|
57156
|
+
if (!(0, types_1.isFunctionOrOverloaded)(callType)) {
|
|
57108
57157
|
return void 0;
|
|
57109
57158
|
}
|
|
57110
57159
|
const boundCallType = evaluator.bindFunctionToClassOrObject(
|
|
@@ -57487,6 +57536,10 @@ var require_namedTuples = __commonJS({
|
|
|
57487
57536
|
entries.forEach((entryName, index) => {
|
|
57488
57537
|
entryName = entryName.trim();
|
|
57489
57538
|
if (entryName) {
|
|
57539
|
+
if (entryName.startsWith("_")) {
|
|
57540
|
+
evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.namedTupleFieldUnderscore(), entriesArg.valueExpression);
|
|
57541
|
+
return;
|
|
57542
|
+
}
|
|
57490
57543
|
entryName = renameKeyword(evaluator, entryName, allowRename, entriesArg.valueExpression, index);
|
|
57491
57544
|
const entryType = types_1.UnknownType.create();
|
|
57492
57545
|
const paramInfo = types_1.FunctionParam.create(0, entryType, types_1.FunctionParamFlags.TypeDeclared, entryName, index >= firstParamWithDefaultIndex ? entryType : void 0);
|
|
@@ -57537,6 +57590,10 @@ var require_namedTuples = __commonJS({
|
|
|
57537
57590
|
if (!entryName) {
|
|
57538
57591
|
evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.namedTupleEmptyName(), entryNameNode);
|
|
57539
57592
|
} else {
|
|
57593
|
+
if (entryName.startsWith("_")) {
|
|
57594
|
+
evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.namedTupleFieldUnderscore(), entryNameNode);
|
|
57595
|
+
return;
|
|
57596
|
+
}
|
|
57540
57597
|
entryName = renameKeyword(evaluator, entryName, allowRename, entryNameNode, index);
|
|
57541
57598
|
}
|
|
57542
57599
|
} else {
|
|
@@ -57856,7 +57913,7 @@ var require_dataClasses = __commonJS({
|
|
|
57856
57913
|
}
|
|
57857
57914
|
hasDefault = true;
|
|
57858
57915
|
defaultExpr = statement.d.rightExpr;
|
|
57859
|
-
if (statement.d.rightExpr.nodeType === 9) {
|
|
57916
|
+
if (!isNamedTuple && statement.d.rightExpr.nodeType === 9) {
|
|
57860
57917
|
const callTypeResult = evaluator.getTypeOfExpression(
|
|
57861
57918
|
statement.d.rightExpr.d.leftExpr,
|
|
57862
57919
|
2
|
|
@@ -57945,6 +58002,10 @@ var require_dataClasses = __commonJS({
|
|
|
57945
58002
|
}
|
|
57946
58003
|
if (variableNameNode && variableTypeEvaluator) {
|
|
57947
58004
|
const variableName = variableNameNode.d.value;
|
|
58005
|
+
if (isNamedTuple && variableName.startsWith("_")) {
|
|
58006
|
+
evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.namedTupleFieldUnderscore(), variableNameNode);
|
|
58007
|
+
return;
|
|
58008
|
+
}
|
|
57948
58009
|
const variableSymbol = types_1.ClassType.getSymbolTable(classType).get(variableName);
|
|
57949
58010
|
namedTupleEntries.add(variableName);
|
|
57950
58011
|
if (variableSymbol == null ? void 0 : variableSymbol.isClassVar()) {
|
|
@@ -58026,7 +58087,7 @@ var require_dataClasses = __commonJS({
|
|
|
58026
58087
|
if (!statement || statement.nodeType !== 3) {
|
|
58027
58088
|
return;
|
|
58028
58089
|
}
|
|
58029
|
-
if (statement.d.rightExpr.nodeType === 9) {
|
|
58090
|
+
if (!isNamedTuple && statement.d.rightExpr.nodeType === 9) {
|
|
58030
58091
|
const callType = evaluator.getTypeOfExpression(
|
|
58031
58092
|
statement.d.rightExpr.d.leftExpr,
|
|
58032
58093
|
2
|
|
@@ -58246,7 +58307,7 @@ var require_dataClasses = __commonJS({
|
|
|
58246
58307
|
targetFunction.shared.declaredReturnType = fieldType;
|
|
58247
58308
|
types_1.FunctionType.addParam(targetFunction, types_1.FunctionParam.create(0, typeVar, types_1.FunctionParamFlags.TypeDeclared | types_1.FunctionParamFlags.NameSynthesized, "__input"));
|
|
58248
58309
|
types_1.FunctionType.addPositionOnlyParamSeparator(targetFunction);
|
|
58249
|
-
if ((0, types_1.
|
|
58310
|
+
if ((0, types_1.isFunctionOrOverloaded)(converterType)) {
|
|
58250
58311
|
const acceptedTypes = [];
|
|
58251
58312
|
const diagAddendum = new diagnostic_1.DiagnosticAddendum();
|
|
58252
58313
|
(0, typeUtils_1.doForEachSignature)(converterType, (signature) => {
|
|
@@ -58292,7 +58353,7 @@ var require_dataClasses = __commonJS({
|
|
|
58292
58353
|
return fieldType;
|
|
58293
58354
|
}
|
|
58294
58355
|
function getConverterAsFunction(evaluator, converterType) {
|
|
58295
|
-
if ((0, types_1.
|
|
58356
|
+
if ((0, types_1.isFunctionOrOverloaded)(converterType)) {
|
|
58296
58357
|
return converterType;
|
|
58297
58358
|
}
|
|
58298
58359
|
if ((0, types_1.isClassInstance)(converterType)) {
|
|
@@ -58304,7 +58365,7 @@ var require_dataClasses = __commonJS({
|
|
|
58304
58365
|
if ((0, types_1.isUnion)(fromConstructor)) {
|
|
58305
58366
|
fromConstructor = fromConstructor.priv.subtypes[0];
|
|
58306
58367
|
}
|
|
58307
|
-
if ((0, types_1.
|
|
58368
|
+
if ((0, types_1.isFunctionOrOverloaded)(fromConstructor)) {
|
|
58308
58369
|
return fromConstructor;
|
|
58309
58370
|
}
|
|
58310
58371
|
}
|
|
@@ -58488,7 +58549,7 @@ var require_dataClasses = __commonJS({
|
|
|
58488
58549
|
case "field_descriptors":
|
|
58489
58550
|
case "field_specifiers": {
|
|
58490
58551
|
const valueType = evaluator.getTypeOfExpression(arg.d.valueExpr).type;
|
|
58491
|
-
if (!(0, types_1.isClassInstance)(valueType) || !types_1.ClassType.isBuiltIn(valueType, "tuple") || !valueType.priv.tupleTypeArgs || valueType.priv.tupleTypeArgs.some((entry) => !(0, types_1.isInstantiableClass)(entry.type) && !(0, types_1.
|
|
58552
|
+
if (!(0, types_1.isClassInstance)(valueType) || !types_1.ClassType.isBuiltIn(valueType, "tuple") || !valueType.priv.tupleTypeArgs || valueType.priv.tupleTypeArgs.some((entry) => !(0, types_1.isInstantiableClass)(entry.type) && !(0, types_1.isFunctionOrOverloaded)(entry.type))) {
|
|
58492
58553
|
evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.dataClassTransformFieldSpecifier().format({
|
|
58493
58554
|
type: evaluator.printType(valueType)
|
|
58494
58555
|
}), arg.d.valueExpr);
|
|
@@ -59076,12 +59137,12 @@ var require_typeGuards = __commonJS({
|
|
|
59076
59137
|
if (leftExpression.nodeType === 4) {
|
|
59077
59138
|
leftExpression = leftExpression.d.name;
|
|
59078
59139
|
}
|
|
59079
|
-
if (ParseTreeUtils.isMatchingExpression(reference, leftExpression)) {
|
|
59140
|
+
if (ParseTreeUtils.isMatchingExpression(reference, leftExpression, (ref, expr) => isNameSameScope(evaluator, ref, expr))) {
|
|
59080
59141
|
return (type) => {
|
|
59081
59142
|
return { type: narrowTypeForIsNone(evaluator, type, adjIsPositiveTest), isIncomplete: false };
|
|
59082
59143
|
};
|
|
59083
59144
|
}
|
|
59084
|
-
if (leftExpression.nodeType === 27 && ParseTreeUtils.isMatchingExpression(reference, leftExpression.d.leftExpr) && leftExpression.d.items.length === 1 && !leftExpression.d.trailingComma && leftExpression.d.items[0].d.argCategory === 0 && !leftExpression.d.items[0].d.name && leftExpression.d.items[0].d.valueExpr.nodeType === 40 && leftExpression.d.items[0].d.valueExpr.d.isInteger && !leftExpression.d.items[0].d.valueExpr.d.isImaginary) {
|
|
59145
|
+
if (leftExpression.nodeType === 27 && ParseTreeUtils.isMatchingExpression(reference, leftExpression.d.leftExpr, (ref, expr) => isNameSameScope(evaluator, ref, expr)) && leftExpression.d.items.length === 1 && !leftExpression.d.trailingComma && leftExpression.d.items[0].d.argCategory === 0 && !leftExpression.d.items[0].d.name && leftExpression.d.items[0].d.valueExpr.nodeType === 40 && leftExpression.d.items[0].d.valueExpr.d.isInteger && !leftExpression.d.items[0].d.valueExpr.d.isImaginary) {
|
|
59085
59146
|
const indexValue = leftExpression.d.items[0].d.valueExpr.d.value;
|
|
59086
59147
|
if (typeof indexValue === "number") {
|
|
59087
59148
|
return (type) => {
|
|
@@ -59098,7 +59159,7 @@ var require_typeGuards = __commonJS({
|
|
|
59098
59159
|
if (leftExpression.nodeType === 4) {
|
|
59099
59160
|
leftExpression = leftExpression.d.name;
|
|
59100
59161
|
}
|
|
59101
|
-
if (ParseTreeUtils.isMatchingExpression(reference, leftExpression)) {
|
|
59162
|
+
if (ParseTreeUtils.isMatchingExpression(reference, leftExpression, (ref, expr) => isNameSameScope(evaluator, ref, expr))) {
|
|
59102
59163
|
return (type) => {
|
|
59103
59164
|
return {
|
|
59104
59165
|
type: narrowTypeForIsEllipsis(evaluator, testExpression, type, adjIsPositiveTest),
|
|
@@ -59110,20 +59171,34 @@ var require_typeGuards = __commonJS({
|
|
|
59110
59171
|
if (testExpression.d.leftExpr.nodeType === 9) {
|
|
59111
59172
|
if (testExpression.d.leftExpr.d.args.length === 1 && testExpression.d.leftExpr.d.args[0].d.argCategory === 0) {
|
|
59112
59173
|
const arg0Expr = testExpression.d.leftExpr.d.args[0].d.valueExpr;
|
|
59113
|
-
if (ParseTreeUtils.isMatchingExpression(reference, arg0Expr)) {
|
|
59174
|
+
if (ParseTreeUtils.isMatchingExpression(reference, arg0Expr, (ref, expr) => isNameSameScope(evaluator, ref, expr))) {
|
|
59114
59175
|
const callType = evaluator.getTypeOfExpression(
|
|
59115
59176
|
testExpression.d.leftExpr.d.leftExpr,
|
|
59116
59177
|
2
|
|
59117
59178
|
/* EvalFlags.CallBaseDefaults */
|
|
59118
59179
|
).type;
|
|
59119
59180
|
if ((0, types_1.isInstantiableClass)(callType) && types_1.ClassType.isBuiltIn(callType, "type")) {
|
|
59120
|
-
const
|
|
59121
|
-
const
|
|
59122
|
-
|
|
59181
|
+
const rhsResult = evaluator.getTypeOfExpression(testExpression.d.rightExpr);
|
|
59182
|
+
const classTypes = [];
|
|
59183
|
+
let isClassType = true;
|
|
59184
|
+
evaluator.mapSubtypesExpandTypeVars(
|
|
59185
|
+
rhsResult.type,
|
|
59186
|
+
/* options */
|
|
59187
|
+
void 0,
|
|
59188
|
+
(expandedSubtype) => {
|
|
59189
|
+
if ((0, types_1.isInstantiableClass)(expandedSubtype)) {
|
|
59190
|
+
classTypes.push(expandedSubtype);
|
|
59191
|
+
} else {
|
|
59192
|
+
isClassType = false;
|
|
59193
|
+
}
|
|
59194
|
+
return void 0;
|
|
59195
|
+
}
|
|
59196
|
+
);
|
|
59197
|
+
if (isClassType && classTypes.length > 0) {
|
|
59123
59198
|
return (type) => {
|
|
59124
59199
|
return {
|
|
59125
|
-
type: narrowTypeForTypeIs(evaluator, type,
|
|
59126
|
-
isIncomplete: !!
|
|
59200
|
+
type: narrowTypeForTypeIs(evaluator, type, classTypes, adjIsPositiveTest),
|
|
59201
|
+
isIncomplete: !!rhsResult.isIncomplete
|
|
59127
59202
|
};
|
|
59128
59203
|
};
|
|
59129
59204
|
}
|
|
@@ -59132,7 +59207,7 @@ var require_typeGuards = __commonJS({
|
|
|
59132
59207
|
}
|
|
59133
59208
|
}
|
|
59134
59209
|
if (isOrIsNotOperator) {
|
|
59135
|
-
if (ParseTreeUtils.isMatchingExpression(reference, testExpression.d.leftExpr)) {
|
|
59210
|
+
if (ParseTreeUtils.isMatchingExpression(reference, testExpression.d.leftExpr, (ref, expr) => isNameSameScope(evaluator, ref, expr))) {
|
|
59136
59211
|
const rightTypeResult = evaluator.getTypeOfExpression(testExpression.d.rightExpr);
|
|
59137
59212
|
const rightType = rightTypeResult.type;
|
|
59138
59213
|
if ((0, types_1.isClassInstance)(rightType) && rightType.priv.literalValue !== void 0) {
|
|
@@ -59159,7 +59234,7 @@ var require_typeGuards = __commonJS({
|
|
|
59159
59234
|
};
|
|
59160
59235
|
}
|
|
59161
59236
|
}
|
|
59162
|
-
if (testExpression.d.leftExpr.nodeType === 27 && testExpression.d.leftExpr.d.items.length === 1 && !testExpression.d.leftExpr.d.trailingComma && testExpression.d.leftExpr.d.items[0].d.argCategory === 0 && ParseTreeUtils.isMatchingExpression(reference, testExpression.d.leftExpr.d.leftExpr)) {
|
|
59237
|
+
if (testExpression.d.leftExpr.nodeType === 27 && testExpression.d.leftExpr.d.items.length === 1 && !testExpression.d.leftExpr.d.trailingComma && testExpression.d.leftExpr.d.items[0].d.argCategory === 0 && ParseTreeUtils.isMatchingExpression(reference, testExpression.d.leftExpr.d.leftExpr, (ref, expr) => isNameSameScope(evaluator, ref, expr))) {
|
|
59163
59238
|
const indexTypeResult = evaluator.getTypeOfExpression(testExpression.d.leftExpr.d.items[0].d.valueExpr);
|
|
59164
59239
|
const indexType = indexTypeResult.type;
|
|
59165
59240
|
if ((0, types_1.isClassInstance)(indexType) && (0, typeUtils_1.isLiteralType)(indexType)) {
|
|
@@ -59198,7 +59273,7 @@ var require_typeGuards = __commonJS({
|
|
|
59198
59273
|
}
|
|
59199
59274
|
if (equalsOrNotEqualsOperator) {
|
|
59200
59275
|
const adjIsPositiveTest2 = testExpression.d.operator === 12 ? isPositiveTest : !isPositiveTest;
|
|
59201
|
-
if (ParseTreeUtils.isMatchingExpression(reference, testExpression.d.leftExpr)) {
|
|
59276
|
+
if (ParseTreeUtils.isMatchingExpression(reference, testExpression.d.leftExpr, (ref, expr) => isNameSameScope(evaluator, ref, expr))) {
|
|
59202
59277
|
const rightTypeResult = evaluator.getTypeOfExpression(testExpression.d.rightExpr);
|
|
59203
59278
|
const rightType = rightTypeResult.type;
|
|
59204
59279
|
if ((0, types_1.isClassInstance)(rightType) && rightType.priv.literalValue !== void 0) {
|
|
@@ -59217,7 +59292,7 @@ var require_typeGuards = __commonJS({
|
|
|
59217
59292
|
};
|
|
59218
59293
|
}
|
|
59219
59294
|
}
|
|
59220
|
-
if (testExpression.d.leftExpr.nodeType === 27 && testExpression.d.leftExpr.d.items.length === 1 && !testExpression.d.leftExpr.d.trailingComma && testExpression.d.leftExpr.d.items[0].d.argCategory === 0 && ParseTreeUtils.isMatchingExpression(reference, testExpression.d.leftExpr.d.leftExpr)) {
|
|
59295
|
+
if (testExpression.d.leftExpr.nodeType === 27 && testExpression.d.leftExpr.d.items.length === 1 && !testExpression.d.leftExpr.d.trailingComma && testExpression.d.leftExpr.d.items[0].d.argCategory === 0 && ParseTreeUtils.isMatchingExpression(reference, testExpression.d.leftExpr.d.leftExpr, (ref, expr) => isNameSameScope(evaluator, ref, expr))) {
|
|
59221
59296
|
const indexTypeResult = evaluator.getTypeOfExpression(testExpression.d.leftExpr.d.items[0].d.valueExpr);
|
|
59222
59297
|
const indexType = indexTypeResult.type;
|
|
59223
59298
|
if ((0, types_1.isClassInstance)(indexType) && (0, typeUtils_1.isLiteralType)(indexType)) {
|
|
@@ -59242,7 +59317,7 @@ var require_typeGuards = __commonJS({
|
|
|
59242
59317
|
}
|
|
59243
59318
|
}
|
|
59244
59319
|
}
|
|
59245
|
-
if (equalsOrNotEqualsOperator && testExpression.d.leftExpr.nodeType === 35 && ParseTreeUtils.isMatchingExpression(reference, testExpression.d.leftExpr.d.leftExpr)) {
|
|
59320
|
+
if (equalsOrNotEqualsOperator && testExpression.d.leftExpr.nodeType === 35 && ParseTreeUtils.isMatchingExpression(reference, testExpression.d.leftExpr.d.leftExpr, (ref, expr) => isNameSameScope(evaluator, ref, expr))) {
|
|
59246
59321
|
const rightTypeResult = evaluator.getTypeOfExpression(testExpression.d.rightExpr);
|
|
59247
59322
|
const rightType = rightTypeResult.type;
|
|
59248
59323
|
const memberName = testExpression.d.leftExpr.d.member;
|
|
@@ -59257,7 +59332,7 @@ var require_typeGuards = __commonJS({
|
|
|
59257
59332
|
}
|
|
59258
59333
|
}
|
|
59259
59334
|
}
|
|
59260
|
-
if (testExpression.d.leftExpr.nodeType === 35 && ParseTreeUtils.isMatchingExpression(reference, testExpression.d.leftExpr.d.leftExpr)) {
|
|
59335
|
+
if (testExpression.d.leftExpr.nodeType === 35 && ParseTreeUtils.isMatchingExpression(reference, testExpression.d.leftExpr.d.leftExpr, (ref, expr) => isNameSameScope(evaluator, ref, expr))) {
|
|
59261
59336
|
const rightTypeResult = evaluator.getTypeOfExpression(testExpression.d.rightExpr);
|
|
59262
59337
|
const rightType = rightTypeResult.type;
|
|
59263
59338
|
const memberName = testExpression.d.leftExpr.d.member;
|
|
@@ -59270,7 +59345,7 @@ var require_typeGuards = __commonJS({
|
|
|
59270
59345
|
};
|
|
59271
59346
|
}
|
|
59272
59347
|
}
|
|
59273
|
-
if (testExpression.d.leftExpr.nodeType === 35 && ParseTreeUtils.isMatchingExpression(reference, testExpression.d.leftExpr.d.leftExpr) && testExpression.d.rightExpr.nodeType === 14 && testExpression.d.rightExpr.d.constType === 26) {
|
|
59348
|
+
if (testExpression.d.leftExpr.nodeType === 35 && ParseTreeUtils.isMatchingExpression(reference, testExpression.d.leftExpr.d.leftExpr, (ref, expr) => isNameSameScope(evaluator, ref, expr)) && testExpression.d.rightExpr.nodeType === 14 && testExpression.d.rightExpr.d.constType === 26) {
|
|
59274
59349
|
const memberName = testExpression.d.leftExpr.d.member;
|
|
59275
59350
|
return (type) => {
|
|
59276
59351
|
return {
|
|
@@ -59282,7 +59357,7 @@ var require_typeGuards = __commonJS({
|
|
|
59282
59357
|
}
|
|
59283
59358
|
if (comparisonOperator && testExpression.d.leftExpr.nodeType === 9 && testExpression.d.leftExpr.d.args.length === 1) {
|
|
59284
59359
|
const arg0Expr = testExpression.d.leftExpr.d.args[0].d.valueExpr;
|
|
59285
|
-
if (ParseTreeUtils.isMatchingExpression(reference, arg0Expr)) {
|
|
59360
|
+
if (ParseTreeUtils.isMatchingExpression(reference, arg0Expr, (ref, expr) => isNameSameScope(evaluator, ref, expr))) {
|
|
59286
59361
|
const callTypeResult = evaluator.getTypeOfExpression(
|
|
59287
59362
|
testExpression.d.leftExpr.d.leftExpr,
|
|
59288
59363
|
2
|
|
@@ -59311,7 +59386,7 @@ var require_typeGuards = __commonJS({
|
|
|
59311
59386
|
}
|
|
59312
59387
|
}
|
|
59313
59388
|
if (testExpression.d.operator === 41 || testExpression.d.operator === 42) {
|
|
59314
|
-
if (ParseTreeUtils.isMatchingExpression(reference, testExpression.d.leftExpr)) {
|
|
59389
|
+
if (ParseTreeUtils.isMatchingExpression(reference, testExpression.d.leftExpr, (ref, expr) => isNameSameScope(evaluator, ref, expr))) {
|
|
59315
59390
|
const rightTypeResult = evaluator.getTypeOfExpression(testExpression.d.rightExpr);
|
|
59316
59391
|
const rightType = rightTypeResult.type;
|
|
59317
59392
|
const adjIsPositiveTest = testExpression.d.operator === 41 ? isPositiveTest : !isPositiveTest;
|
|
@@ -59322,7 +59397,7 @@ var require_typeGuards = __commonJS({
|
|
|
59322
59397
|
};
|
|
59323
59398
|
};
|
|
59324
59399
|
}
|
|
59325
|
-
if (ParseTreeUtils.isMatchingExpression(reference, testExpression.d.rightExpr)) {
|
|
59400
|
+
if (ParseTreeUtils.isMatchingExpression(reference, testExpression.d.rightExpr, (ref, expr) => isNameSameScope(evaluator, ref, expr))) {
|
|
59326
59401
|
const leftTypeResult = evaluator.getTypeOfExpression(testExpression.d.leftExpr);
|
|
59327
59402
|
const leftType = leftTypeResult.type;
|
|
59328
59403
|
if ((0, types_1.isClassInstance)(leftType) && types_1.ClassType.isBuiltIn(leftType, "str") && (0, typeUtils_1.isLiteralType)(leftType)) {
|
|
@@ -59341,7 +59416,7 @@ var require_typeGuards = __commonJS({
|
|
|
59341
59416
|
if (testExpression.d.args.length === 2) {
|
|
59342
59417
|
const arg0Expr = testExpression.d.args[0].d.valueExpr;
|
|
59343
59418
|
const arg1Expr = testExpression.d.args[1].d.valueExpr;
|
|
59344
|
-
if (ParseTreeUtils.isMatchingExpression(reference, arg0Expr)) {
|
|
59419
|
+
if (ParseTreeUtils.isMatchingExpression(reference, arg0Expr, (ref, expr) => isNameSameScope(evaluator, ref, expr))) {
|
|
59345
59420
|
const callTypeResult = evaluator.getTypeOfExpression(
|
|
59346
59421
|
testExpression.d.leftExpr,
|
|
59347
59422
|
2
|
|
@@ -59386,7 +59461,7 @@ var require_typeGuards = __commonJS({
|
|
|
59386
59461
|
}
|
|
59387
59462
|
}
|
|
59388
59463
|
if (testExpression.d.args.length === 1 && !testExpression.d.args[0].d.name) {
|
|
59389
|
-
if (ParseTreeUtils.isMatchingExpression(reference, testExpression.d.args[0].d.valueExpr)) {
|
|
59464
|
+
if (ParseTreeUtils.isMatchingExpression(reference, testExpression.d.args[0].d.valueExpr, (ref, expr) => isNameSameScope(evaluator, ref, expr))) {
|
|
59390
59465
|
const callTypeResult = evaluator.getTypeOfExpression(
|
|
59391
59466
|
testExpression.d.leftExpr,
|
|
59392
59467
|
2
|
|
@@ -59405,7 +59480,7 @@ var require_typeGuards = __commonJS({
|
|
|
59405
59480
|
}
|
|
59406
59481
|
if (testExpression.d.args.length >= 1) {
|
|
59407
59482
|
const arg0Expr = testExpression.d.args[0].d.valueExpr;
|
|
59408
|
-
if (ParseTreeUtils.isMatchingExpression(reference, arg0Expr)) {
|
|
59483
|
+
if (ParseTreeUtils.isMatchingExpression(reference, arg0Expr, (ref, expr) => isNameSameScope(evaluator, ref, expr))) {
|
|
59409
59484
|
let isPossiblyTypeGuard = false;
|
|
59410
59485
|
const isFunctionReturnTypeGuard = (type) => {
|
|
59411
59486
|
return type.shared.declaredReturnType && (0, types_1.isClassInstance)(type.shared.declaredReturnType) && types_1.ClassType.isBuiltIn(type.shared.declaredReturnType, ["TypeGuard", "TypeIs"]);
|
|
@@ -59441,7 +59516,7 @@ var require_typeGuards = __commonJS({
|
|
|
59441
59516
|
}
|
|
59442
59517
|
}
|
|
59443
59518
|
}
|
|
59444
|
-
if (ParseTreeUtils.isMatchingExpression(reference, testExpression)) {
|
|
59519
|
+
if (ParseTreeUtils.isMatchingExpression(reference, testExpression, (ref, expr) => isNameSameScope(evaluator, ref, expr))) {
|
|
59445
59520
|
return (type) => {
|
|
59446
59521
|
return {
|
|
59447
59522
|
type: narrowTypeForTruthiness(evaluator, type, isPositiveTest),
|
|
@@ -60109,7 +60184,7 @@ var require_typeGuards = __commonJS({
|
|
|
60109
60184
|
if ((0, types_1.isClass)(subtype)) {
|
|
60110
60185
|
return (0, types_1.combineTypes)(filterClassType(unexpandedSubtype, types_1.ClassType.cloneAsInstantiable(subtype), (0, typeUtils_1.getTypeCondition)(subtype), negativeFallback));
|
|
60111
60186
|
}
|
|
60112
|
-
if ((0, types_1.
|
|
60187
|
+
if ((0, types_1.isFunctionOrOverloaded)(subtype)) {
|
|
60113
60188
|
return (0, types_1.combineTypes)(filterFunctionType(subtype, unexpandedSubtype));
|
|
60114
60189
|
}
|
|
60115
60190
|
return isPositiveTest ? void 0 : negativeFallback;
|
|
@@ -60467,37 +60542,48 @@ var require_typeGuards = __commonJS({
|
|
|
60467
60542
|
return subtype;
|
|
60468
60543
|
});
|
|
60469
60544
|
}
|
|
60470
|
-
function narrowTypeForTypeIs(evaluator, type,
|
|
60471
|
-
|
|
60472
|
-
type
|
|
60473
|
-
|
|
60474
|
-
|
|
60475
|
-
(
|
|
60476
|
-
|
|
60477
|
-
|
|
60478
|
-
|
|
60479
|
-
|
|
60480
|
-
|
|
60481
|
-
|
|
60482
|
-
|
|
60545
|
+
function narrowTypeForTypeIs(evaluator, type, classTypes, isPositiveTest) {
|
|
60546
|
+
if (!isPositiveTest && classTypes.length > 1) {
|
|
60547
|
+
return type;
|
|
60548
|
+
}
|
|
60549
|
+
const typesToCombine = classTypes.map((classType) => {
|
|
60550
|
+
return evaluator.mapSubtypesExpandTypeVars(
|
|
60551
|
+
type,
|
|
60552
|
+
/* options */
|
|
60553
|
+
void 0,
|
|
60554
|
+
(subtype, unexpandedSubtype) => {
|
|
60555
|
+
var _a, _b;
|
|
60556
|
+
if ((0, types_1.isClassInstance)(subtype)) {
|
|
60557
|
+
const matches = types_1.ClassType.isDerivedFrom(classType, types_1.ClassType.cloneAsInstantiable(subtype));
|
|
60558
|
+
if (isPositiveTest) {
|
|
60559
|
+
if (matches) {
|
|
60560
|
+
if (types_1.ClassType.isSameGenericClass(types_1.ClassType.cloneAsInstantiable(subtype), classType)) {
|
|
60561
|
+
return (0, typeUtils_1.addConditionToType)(subtype, (0, typeUtils_1.getTypeCondition)(classType));
|
|
60562
|
+
}
|
|
60563
|
+
return (0, typeUtils_1.addConditionToType)(types_1.ClassType.cloneAsInstance(classType), (_a = subtype.props) == null ? void 0 : _a.condition);
|
|
60564
|
+
}
|
|
60565
|
+
if (!classType.priv.includeSubclasses) {
|
|
60566
|
+
return void 0;
|
|
60567
|
+
}
|
|
60568
|
+
if (!(0, types_1.isTypeVar)(unexpandedSubtype) || !types_1.TypeVarType.isSelf(unexpandedSubtype)) {
|
|
60569
|
+
return (0, typeUtils_1.addConditionToType)(subtype, (_b = classType.props) == null ? void 0 : _b.condition);
|
|
60483
60570
|
}
|
|
60484
|
-
return (0, typeUtils_1.addConditionToType)(types_1.ClassType.cloneAsInstance(classType), (_a = subtype.props) == null ? void 0 : _a.condition);
|
|
60485
60571
|
}
|
|
60486
60572
|
if (!classType.priv.includeSubclasses) {
|
|
60487
|
-
|
|
60488
|
-
|
|
60489
|
-
|
|
60490
|
-
|
|
60491
|
-
return void 0;
|
|
60573
|
+
if (matches && types_1.ClassType.isFinal(subtype)) {
|
|
60574
|
+
return void 0;
|
|
60575
|
+
}
|
|
60576
|
+
return subtype;
|
|
60492
60577
|
}
|
|
60493
|
-
return subtype;
|
|
60494
60578
|
}
|
|
60495
|
-
|
|
60496
|
-
|
|
60579
|
+
if ((0, types_1.isAnyOrUnknown)(subtype)) {
|
|
60580
|
+
return isPositiveTest ? types_1.ClassType.cloneAsInstance((0, typeUtils_1.addConditionToType)(classType, (0, typeUtils_1.getTypeCondition)(subtype))) : subtype;
|
|
60581
|
+
}
|
|
60582
|
+
return unexpandedSubtype;
|
|
60497
60583
|
}
|
|
60498
|
-
|
|
60499
|
-
|
|
60500
|
-
);
|
|
60584
|
+
);
|
|
60585
|
+
});
|
|
60586
|
+
return (0, types_1.combineTypes)(typesToCombine);
|
|
60501
60587
|
}
|
|
60502
60588
|
function narrowTypeForClassComparison(evaluator, referenceType, classType, isPositiveTest) {
|
|
60503
60589
|
return (0, typeUtils_1.mapSubtypes)(referenceType, (subtype) => {
|
|
@@ -60632,6 +60718,29 @@ var require_typeGuards = __commonJS({
|
|
|
60632
60718
|
}
|
|
60633
60719
|
return void 0;
|
|
60634
60720
|
}
|
|
60721
|
+
function isNameSameScope(evaluator, reference, expression) {
|
|
60722
|
+
const refSymbol = evaluator.lookUpSymbolRecursive(
|
|
60723
|
+
reference,
|
|
60724
|
+
reference.d.value,
|
|
60725
|
+
/* honorCodeFlow */
|
|
60726
|
+
false
|
|
60727
|
+
);
|
|
60728
|
+
const exprSymbol = evaluator.lookUpSymbolRecursive(
|
|
60729
|
+
expression,
|
|
60730
|
+
expression.d.value,
|
|
60731
|
+
/* honorCodeFlow */
|
|
60732
|
+
false
|
|
60733
|
+
);
|
|
60734
|
+
if (!refSymbol || !exprSymbol) {
|
|
60735
|
+
return true;
|
|
60736
|
+
}
|
|
60737
|
+
const refScope = refSymbol.scope;
|
|
60738
|
+
const exprScope = exprSymbol.scope;
|
|
60739
|
+
if (refScope === exprScope) {
|
|
60740
|
+
return true;
|
|
60741
|
+
}
|
|
60742
|
+
return (0, scopeUtils_1.isScopeContainedWithin)(refScope, exprScope);
|
|
60743
|
+
}
|
|
60635
60744
|
}
|
|
60636
60745
|
});
|
|
60637
60746
|
|
|
@@ -60898,7 +61007,7 @@ var require_enums = __commonJS({
|
|
|
60898
61007
|
if ((0, symbolNameUtils_1.isPrivateName)(memberName)) {
|
|
60899
61008
|
return void 0;
|
|
60900
61009
|
}
|
|
60901
|
-
if (!(0, types_1.findSubtype)(valueType, (subtype) => !(0, types_1.
|
|
61010
|
+
if (!(0, types_1.findSubtype)(valueType, (subtype) => !(0, types_1.isFunctionOrOverloaded)(subtype))) {
|
|
60902
61011
|
return void 0;
|
|
60903
61012
|
}
|
|
60904
61013
|
if (!assignedType && ((_f = nameNode.parent) == null ? void 0 : _f.nodeType) === 3 && nameNode.parent.d.leftExpr === nameNode) {
|
|
@@ -62357,7 +62466,6 @@ var require_importResolver = __commonJS({
|
|
|
62357
62466
|
importType: 2,
|
|
62358
62467
|
isStubFile: false,
|
|
62359
62468
|
isNativeLib: false,
|
|
62360
|
-
isModulePrivate: false,
|
|
62361
62469
|
implicitImports: /* @__PURE__ */ new Map(),
|
|
62362
62470
|
filteredImplicitImports: /* @__PURE__ */ new Map(),
|
|
62363
62471
|
nonStubImportResult: void 0
|
|
@@ -62442,7 +62550,6 @@ var require_importResolver = __commonJS({
|
|
|
62442
62550
|
let importType = 0;
|
|
62443
62551
|
let isLocalTypingsFile = false;
|
|
62444
62552
|
let isThirdPartyPyTypedPresent = false;
|
|
62445
|
-
const isModulePrivate = false;
|
|
62446
62553
|
let isTypeshedFile = false;
|
|
62447
62554
|
const importFailureInfo = [];
|
|
62448
62555
|
let moduleNameWithInvalidCharacters;
|
|
@@ -62461,8 +62568,7 @@ var require_importResolver = __commonJS({
|
|
|
62461
62568
|
importType,
|
|
62462
62569
|
isTypeshedFile: true,
|
|
62463
62570
|
isLocalTypingsFile,
|
|
62464
|
-
isThirdPartyPyTypedPresent
|
|
62465
|
-
isModulePrivate
|
|
62571
|
+
isThirdPartyPyTypedPresent
|
|
62466
62572
|
};
|
|
62467
62573
|
}
|
|
62468
62574
|
}
|
|
@@ -62561,14 +62667,7 @@ var require_importResolver = __commonJS({
|
|
|
62561
62667
|
}
|
|
62562
62668
|
}
|
|
62563
62669
|
if (moduleName) {
|
|
62564
|
-
return {
|
|
62565
|
-
moduleName,
|
|
62566
|
-
importType,
|
|
62567
|
-
isTypeshedFile,
|
|
62568
|
-
isLocalTypingsFile,
|
|
62569
|
-
isThirdPartyPyTypedPresent,
|
|
62570
|
-
isModulePrivate
|
|
62571
|
-
};
|
|
62670
|
+
return { moduleName, importType, isTypeshedFile, isLocalTypingsFile, isThirdPartyPyTypedPresent };
|
|
62572
62671
|
}
|
|
62573
62672
|
if (allowInvalidModuleName && moduleNameWithInvalidCharacters) {
|
|
62574
62673
|
return {
|
|
@@ -62576,8 +62675,7 @@ var require_importResolver = __commonJS({
|
|
|
62576
62675
|
isTypeshedFile,
|
|
62577
62676
|
importType,
|
|
62578
62677
|
isLocalTypingsFile,
|
|
62579
|
-
isThirdPartyPyTypedPresent
|
|
62580
|
-
isModulePrivate
|
|
62678
|
+
isThirdPartyPyTypedPresent
|
|
62581
62679
|
};
|
|
62582
62680
|
}
|
|
62583
62681
|
return {
|
|
@@ -62585,8 +62683,7 @@ var require_importResolver = __commonJS({
|
|
|
62585
62683
|
isTypeshedFile,
|
|
62586
62684
|
importType: 2,
|
|
62587
62685
|
isLocalTypingsFile,
|
|
62588
|
-
isThirdPartyPyTypedPresent
|
|
62589
|
-
isModulePrivate
|
|
62686
|
+
isThirdPartyPyTypedPresent
|
|
62590
62687
|
};
|
|
62591
62688
|
}
|
|
62592
62689
|
_invalidateFileSystemCache() {
|
|
@@ -62610,7 +62707,6 @@ var require_importResolver = __commonJS({
|
|
|
62610
62707
|
let implicitImports = /* @__PURE__ */ new Map();
|
|
62611
62708
|
let packageDirectory;
|
|
62612
62709
|
let pyTypedInfo;
|
|
62613
|
-
let isModulePrivate = false;
|
|
62614
62710
|
if (moduleDescriptor.nameParts.length === 0) {
|
|
62615
62711
|
const pyFilePath = dirPath.initPyUri;
|
|
62616
62712
|
const pyiFilePath = dirPath.initPyiUri;
|
|
@@ -62631,11 +62727,7 @@ var require_importResolver = __commonJS({
|
|
|
62631
62727
|
for (let i = 0; i < moduleDescriptor.nameParts.length; i++) {
|
|
62632
62728
|
const isFirstPart = i === 0;
|
|
62633
62729
|
const isLastPart = i === moduleDescriptor.nameParts.length - 1;
|
|
62634
|
-
|
|
62635
|
-
dirPath = dirPath.combinePaths(namePart);
|
|
62636
|
-
if (SymbolNameUtils.isProtectedName(namePart)) {
|
|
62637
|
-
isModulePrivate = true;
|
|
62638
|
-
}
|
|
62730
|
+
dirPath = dirPath.combinePaths(moduleDescriptor.nameParts[i]);
|
|
62639
62731
|
if (useStubPackage && isFirstPart) {
|
|
62640
62732
|
dirPath = dirPath.addPath(pathConsts_1.stubsSuffix);
|
|
62641
62733
|
isStubPackage = true;
|
|
@@ -62716,9 +62808,6 @@ var require_importResolver = __commonJS({
|
|
|
62716
62808
|
} else {
|
|
62717
62809
|
importFound = resolvedPaths.length >= moduleDescriptor.nameParts.length;
|
|
62718
62810
|
}
|
|
62719
|
-
if (!isStubFile && !pyTypedInfo) {
|
|
62720
|
-
isModulePrivate = false;
|
|
62721
|
-
}
|
|
62722
62811
|
return {
|
|
62723
62812
|
importName,
|
|
62724
62813
|
isRelative: false,
|
|
@@ -62735,7 +62824,6 @@ var require_importResolver = __commonJS({
|
|
|
62735
62824
|
isNativeLib,
|
|
62736
62825
|
implicitImports,
|
|
62737
62826
|
pyTypedInfo,
|
|
62738
|
-
isModulePrivate,
|
|
62739
62827
|
filteredImplicitImports: implicitImports,
|
|
62740
62828
|
packageDirectory
|
|
62741
62829
|
};
|
|
@@ -65606,7 +65694,7 @@ var require_protocols = __commonJS({
|
|
|
65606
65694
|
} else {
|
|
65607
65695
|
srcMemberType = types_1.UnknownType.create();
|
|
65608
65696
|
}
|
|
65609
|
-
if ((0, types_1.
|
|
65697
|
+
if ((0, types_1.isFunctionOrOverloaded)(srcMemberType)) {
|
|
65610
65698
|
if (isMemberFromMetaclass || (0, types_1.isInstantiableClass)(srcMemberInfo.classType)) {
|
|
65611
65699
|
let isInstanceMember = !srcMemberInfo.symbol.isClassMember();
|
|
65612
65700
|
if (types_1.ClassType.isDataClass(srcType)) {
|
|
@@ -65651,7 +65739,7 @@ var require_protocols = __commonJS({
|
|
|
65651
65739
|
srcMemberType = evaluator.getEffectiveTypeOfSymbol(srcSymbol);
|
|
65652
65740
|
}
|
|
65653
65741
|
destMemberType = (0, typeUtils_1.applySolvedTypeVars)(destMemberType, selfSolution);
|
|
65654
|
-
if (!destSymbol.isInstanceMember() && (
|
|
65742
|
+
if (!destSymbol.isInstanceMember() && (0, types_1.isFunctionOrOverloaded)(destMemberType)) {
|
|
65655
65743
|
let boundDeclaredType;
|
|
65656
65744
|
isDestReadOnly = true;
|
|
65657
65745
|
if ((0, types_1.isClass)(srcType)) {
|
|
@@ -67372,7 +67460,7 @@ var require_codeFlowEngine = __commonJS({
|
|
|
67372
67460
|
}
|
|
67373
67461
|
const newMethodResult = (0, constructors_1.getBoundNewMethod)(evaluator2, node, callSubtype);
|
|
67374
67462
|
if (newMethodResult) {
|
|
67375
|
-
if ((0, types_1.
|
|
67463
|
+
if ((0, types_1.isFunctionOrOverloaded)(newMethodResult.type)) {
|
|
67376
67464
|
callSubtype = newMethodResult.type;
|
|
67377
67465
|
}
|
|
67378
67466
|
}
|
|
@@ -68864,7 +68952,7 @@ var require_operations = __commonJS({
|
|
|
68864
68952
|
return true;
|
|
68865
68953
|
}
|
|
68866
68954
|
function convertFunctionToObject(evaluator, type) {
|
|
68867
|
-
if ((0, types_1.
|
|
68955
|
+
if ((0, types_1.isFunctionOrOverloaded)(type)) {
|
|
68868
68956
|
return evaluator.getObjectType();
|
|
68869
68957
|
}
|
|
68870
68958
|
return type;
|
|
@@ -71260,9 +71348,10 @@ var require_typeEvaluator = __commonJS({
|
|
|
71260
71348
|
false
|
|
71261
71349
|
) : void 0;
|
|
71262
71350
|
const exprTypeResult = getTypeOfExpression(node.d.expr, flags, (0, typeUtils_1.makeInferenceContext)(expectedType));
|
|
71351
|
+
const awaitableResult = getTypeOfAwaitable(exprTypeResult, node.d.expr);
|
|
71263
71352
|
const typeResult = {
|
|
71264
|
-
type:
|
|
71265
|
-
isIncomplete: exprTypeResult.isIncomplete,
|
|
71353
|
+
type: awaitableResult.type,
|
|
71354
|
+
isIncomplete: exprTypeResult.isIncomplete || awaitableResult.isIncomplete,
|
|
71266
71355
|
typeErrors: exprTypeResult.typeErrors
|
|
71267
71356
|
};
|
|
71268
71357
|
if (exprTypeResult.isIncomplete) {
|
|
@@ -71895,7 +71984,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
71895
71984
|
if (!boundMethodResult || boundMethodResult.typeErrors) {
|
|
71896
71985
|
return void 0;
|
|
71897
71986
|
}
|
|
71898
|
-
if ((0, types_1.
|
|
71987
|
+
if ((0, types_1.isFunctionOrOverloaded)(boundMethodResult.type)) {
|
|
71899
71988
|
return boundMethodResult.type;
|
|
71900
71989
|
}
|
|
71901
71990
|
if ((0, types_1.isClassInstance)(boundMethodResult.type)) {
|
|
@@ -71995,7 +72084,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
71995
72084
|
const constructorType = (0, constructors_1.createFunctionFromConstructor)(evaluatorInterface, subtype);
|
|
71996
72085
|
if (constructorType) {
|
|
71997
72086
|
(0, typeUtils_1.doForEachSubtype)(constructorType, (subtype2) => {
|
|
71998
|
-
if ((0, types_1.
|
|
72087
|
+
if ((0, types_1.isFunctionOrOverloaded)(subtype2)) {
|
|
71999
72088
|
addFunctionToSignature(subtype2);
|
|
72000
72089
|
}
|
|
72001
72090
|
});
|
|
@@ -72120,29 +72209,36 @@ var require_typeEvaluator = __commonJS({
|
|
|
72120
72209
|
).type;
|
|
72121
72210
|
const baseTypeConcrete = makeTopLevelTypeVarsConcrete(baseType);
|
|
72122
72211
|
let classMemberInfo;
|
|
72123
|
-
|
|
72124
|
-
|
|
72125
|
-
|
|
72126
|
-
|
|
72127
|
-
|
|
72128
|
-
|
|
72129
|
-
|
|
72130
|
-
|
|
72131
|
-
|
|
72132
|
-
|
|
72133
|
-
|
|
72134
|
-
|
|
72135
|
-
|
|
72136
|
-
|
|
72137
|
-
|
|
72138
|
-
|
|
72139
|
-
|
|
72140
|
-
|
|
72141
|
-
|
|
72142
|
-
|
|
72143
|
-
|
|
72144
|
-
|
|
72145
|
-
|
|
72212
|
+
(0, typeUtils_1.doForEachSubtype)(
|
|
72213
|
+
baseTypeConcrete,
|
|
72214
|
+
(baseSubtype) => {
|
|
72215
|
+
if ((0, types_1.isClassInstance)(baseSubtype)) {
|
|
72216
|
+
classMemberInfo = (0, typeUtils_1.lookUpObjectMember)(
|
|
72217
|
+
baseSubtype,
|
|
72218
|
+
expression.d.member.d.value,
|
|
72219
|
+
64
|
|
72220
|
+
/* MemberAccessFlags.DeclaredTypesOnly */
|
|
72221
|
+
);
|
|
72222
|
+
classOrObjectBase = baseSubtype;
|
|
72223
|
+
memberAccessClass = classMemberInfo == null ? void 0 : classMemberInfo.classType;
|
|
72224
|
+
if (classMemberInfo == null ? void 0 : classMemberInfo.isInstanceMember) {
|
|
72225
|
+
bindFunction = false;
|
|
72226
|
+
}
|
|
72227
|
+
useDescriptorSetterType = true;
|
|
72228
|
+
} else if ((0, types_1.isInstantiableClass)(baseSubtype)) {
|
|
72229
|
+
classMemberInfo = (0, typeUtils_1.lookUpClassMember)(
|
|
72230
|
+
baseSubtype,
|
|
72231
|
+
expression.d.member.d.value,
|
|
72232
|
+
16 | 64
|
|
72233
|
+
/* MemberAccessFlags.DeclaredTypesOnly */
|
|
72234
|
+
);
|
|
72235
|
+
classOrObjectBase = baseSubtype;
|
|
72236
|
+
memberAccessClass = classMemberInfo == null ? void 0 : classMemberInfo.classType;
|
|
72237
|
+
}
|
|
72238
|
+
},
|
|
72239
|
+
/* sortSubtypes */
|
|
72240
|
+
true
|
|
72241
|
+
);
|
|
72146
72242
|
if ((0, types_1.isTypeVar)(baseType)) {
|
|
72147
72243
|
selfType = baseType;
|
|
72148
72244
|
}
|
|
@@ -72209,7 +72305,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
72209
72305
|
if (memberAccessClass && (0, types_1.isInstantiableClass)(memberAccessClass)) {
|
|
72210
72306
|
declaredType = (0, typeUtils_1.partiallySpecializeType)(declaredType, memberAccessClass, getTypeClassType(), selfType);
|
|
72211
72307
|
}
|
|
72212
|
-
if ((0, types_1.
|
|
72308
|
+
if ((0, types_1.isFunctionOrOverloaded)(declaredType)) {
|
|
72213
72309
|
if (bindFunction) {
|
|
72214
72310
|
declaredType = bindFunctionToClassOrObject(
|
|
72215
72311
|
classOrObjectBase,
|
|
@@ -72228,12 +72324,13 @@ var require_typeEvaluator = __commonJS({
|
|
|
72228
72324
|
}
|
|
72229
72325
|
return void 0;
|
|
72230
72326
|
}
|
|
72231
|
-
function getTypeOfAwaitable(
|
|
72327
|
+
function getTypeOfAwaitable(typeResult, errorNode) {
|
|
72232
72328
|
if (!(prefetched == null ? void 0 : prefetched.awaitableClass) || !(0, types_1.isInstantiableClass)(prefetched.awaitableClass) || prefetched.awaitableClass.shared.typeParams.length !== 1) {
|
|
72233
|
-
return types_1.UnknownType.create();
|
|
72329
|
+
return { type: types_1.UnknownType.create(), isIncomplete: typeResult.isIncomplete };
|
|
72234
72330
|
}
|
|
72235
72331
|
const awaitableProtocolObj = types_1.ClassType.cloneAsInstance(prefetched.awaitableClass);
|
|
72236
|
-
|
|
72332
|
+
const isIncomplete = !!typeResult.isIncomplete;
|
|
72333
|
+
const type = (0, typeUtils_1.mapSubtypes)(typeResult.type, (subtype) => {
|
|
72237
72334
|
subtype = makeTopLevelTypeVarsConcrete(subtype);
|
|
72238
72335
|
if ((0, types_1.isAnyOrUnknown)(subtype)) {
|
|
72239
72336
|
return subtype;
|
|
@@ -72249,16 +72346,18 @@ var require_typeEvaluator = __commonJS({
|
|
|
72249
72346
|
return types_1.UnknownType.create();
|
|
72250
72347
|
}
|
|
72251
72348
|
}
|
|
72252
|
-
if (errorNode) {
|
|
72349
|
+
if (errorNode && !typeResult.isIncomplete) {
|
|
72253
72350
|
addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.typeNotAwaitable().format({ type: printType(subtype) }) + (diag == null ? void 0 : diag.getString()), errorNode);
|
|
72254
72351
|
}
|
|
72255
72352
|
return types_1.UnknownType.create();
|
|
72256
72353
|
});
|
|
72354
|
+
return { type, isIncomplete };
|
|
72257
72355
|
}
|
|
72258
72356
|
function getTypeOfIterator(typeResult, isAsync, errorNode, emitNotIterableError = true) {
|
|
72259
72357
|
const iterMethodName = isAsync ? "__aiter__" : "__iter__";
|
|
72260
72358
|
const nextMethodName = isAsync ? "__anext__" : "__next__";
|
|
72261
72359
|
let isValidIterator = true;
|
|
72360
|
+
let isIncomplete = typeResult.isIncomplete;
|
|
72262
72361
|
let type = (0, typeUtils_1.transformPossibleRecursiveTypeAlias)(typeResult.type);
|
|
72263
72362
|
type = makeTopLevelTypeVarsConcrete(type);
|
|
72264
72363
|
type = (0, types_1.removeUnbound)(type);
|
|
@@ -72319,7 +72418,11 @@ var require_typeEvaluator = __commonJS({
|
|
|
72319
72418
|
if (!isAsync) {
|
|
72320
72419
|
return nextReturnType;
|
|
72321
72420
|
}
|
|
72322
|
-
|
|
72421
|
+
const awaitableResult = getTypeOfAwaitable({ type: nextReturnType, isIncomplete: typeResult.isIncomplete }, errorNode);
|
|
72422
|
+
if (awaitableResult.isIncomplete) {
|
|
72423
|
+
isIncomplete = true;
|
|
72424
|
+
}
|
|
72425
|
+
return awaitableResult.type;
|
|
72323
72426
|
}
|
|
72324
72427
|
return void 0;
|
|
72325
72428
|
}
|
|
@@ -72330,13 +72433,13 @@ var require_typeEvaluator = __commonJS({
|
|
|
72330
72433
|
diag.addAddendum(iterReturnTypeDiag);
|
|
72331
72434
|
}
|
|
72332
72435
|
}
|
|
72333
|
-
if (!
|
|
72436
|
+
if (!isIncomplete && emitNotIterableError) {
|
|
72334
72437
|
addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.typeNotIterable().format({ type: printType(subtype) }) + diag.getString(), errorNode);
|
|
72335
72438
|
}
|
|
72336
72439
|
isValidIterator = false;
|
|
72337
72440
|
return void 0;
|
|
72338
72441
|
});
|
|
72339
|
-
return isValidIterator ? { type: iterableType, isIncomplete
|
|
72442
|
+
return isValidIterator ? { type: iterableType, isIncomplete } : void 0;
|
|
72340
72443
|
}
|
|
72341
72444
|
function getTypeOfIterable(typeResult, isAsync, errorNode, emitNotIterableError = true) {
|
|
72342
72445
|
const iterMethodName = isAsync ? "__aiter__" : "__iter__";
|
|
@@ -72725,7 +72828,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
72725
72828
|
}
|
|
72726
72829
|
}
|
|
72727
72830
|
if (!typeResult.isIncomplete) {
|
|
72728
|
-
reportPossibleUnknownAssignment(fileInfo.diagnosticRuleSet.reportUnknownVariableType, diagnosticRules_1.DiagnosticRule.reportUnknownVariableType, nameNode,
|
|
72831
|
+
reportPossibleUnknownAssignment(fileInfo.diagnosticRuleSet.reportUnknownVariableType, diagnosticRules_1.DiagnosticRule.reportUnknownVariableType, nameNode, typeResult.type, nameNode, ignoreEmptyContainers);
|
|
72729
72832
|
}
|
|
72730
72833
|
writeTypeCache(
|
|
72731
72834
|
nameNode,
|
|
@@ -73272,26 +73375,11 @@ var require_typeEvaluator = __commonJS({
|
|
|
73272
73375
|
break;
|
|
73273
73376
|
}
|
|
73274
73377
|
case 54: {
|
|
73275
|
-
|
|
73378
|
+
getTypeOfAnnotation(target.d.annotation, {
|
|
73276
73379
|
varTypeAnnotation: true,
|
|
73277
73380
|
allowFinal: isFinalAllowedForAssignmentTarget(target.d.valueExpr),
|
|
73278
73381
|
allowClassVar: isClassVarAllowedForAssignmentTarget(target.d.valueExpr)
|
|
73279
73382
|
});
|
|
73280
|
-
if (annotationType) {
|
|
73281
|
-
const liveScopeIds = ParseTreeUtils.getTypeVarScopesForNode(target);
|
|
73282
|
-
annotationType = (0, typeUtils_1.makeTypeVarsBound)(annotationType, liveScopeIds);
|
|
73283
|
-
}
|
|
73284
|
-
const isBareFinalOrClassVar = (0, types_1.isClassInstance)(annotationType) && (types_1.ClassType.isBuiltIn(annotationType, "Final") || types_1.ClassType.isBuiltIn(annotationType, "ClassVar"));
|
|
73285
|
-
if (!isBareFinalOrClassVar) {
|
|
73286
|
-
const isTypeAliasAnnotation = (0, types_1.isClassInstance)(annotationType) && types_1.ClassType.isBuiltIn(annotationType, "TypeAlias");
|
|
73287
|
-
if (!isTypeAliasAnnotation) {
|
|
73288
|
-
if (assignType(annotationType, typeResult.type)) {
|
|
73289
|
-
if (!(0, types_1.isClassInstance)(typeResult.type) || !types_1.ClassType.isEnumClass(typeResult.type)) {
|
|
73290
|
-
typeResult = narrowTypeBasedOnAssignment(annotationType, typeResult);
|
|
73291
|
-
}
|
|
73292
|
-
}
|
|
73293
|
-
}
|
|
73294
|
-
}
|
|
73295
73383
|
assignTypeToExpression(target.d.valueExpr, typeResult, srcExpr, ignoreEmptyContainers, allowAssignmentToFinalVar, expectedTypeDiagAddendum);
|
|
73296
73384
|
break;
|
|
73297
73385
|
}
|
|
@@ -74390,7 +74478,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
74390
74478
|
(0, debug_1.assertNever)(baseType);
|
|
74391
74479
|
}
|
|
74392
74480
|
if (!type) {
|
|
74393
|
-
const isFunctionRule = (0, types_1.
|
|
74481
|
+
const isFunctionRule = (0, types_1.isFunctionOrOverloaded)(baseType) || (0, types_1.isClassInstance)(baseType) && types_1.ClassType.isBuiltIn(baseType, "function");
|
|
74394
74482
|
if (!baseTypeResult.isIncomplete) {
|
|
74395
74483
|
let diagMessage = localize_1.LocMessage.memberAccess();
|
|
74396
74484
|
if (usage.method === "set") {
|
|
@@ -74398,7 +74486,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
74398
74486
|
} else if (usage.method === "del") {
|
|
74399
74487
|
diagMessage = localize_1.LocMessage.memberDelete();
|
|
74400
74488
|
}
|
|
74401
|
-
if (usage.setExpectedTypeDiag) {
|
|
74489
|
+
if (usage.setExpectedTypeDiag && !usage.setExpectedTypeDiag.isEmpty()) {
|
|
74402
74490
|
diag = usage.setExpectedTypeDiag;
|
|
74403
74491
|
}
|
|
74404
74492
|
if ((0, types_1.isClass)(baseType) && baseType.shared.typedDictEntries) {
|
|
@@ -74560,7 +74648,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
74560
74648
|
isDescriptorApplied = true;
|
|
74561
74649
|
}
|
|
74562
74650
|
resultType = descResult.type;
|
|
74563
|
-
} else if ((0, types_1.
|
|
74651
|
+
} else if ((0, types_1.isFunctionOrOverloaded)(concreteSubtype) && types_1.TypeBase.isInstance(concreteSubtype)) {
|
|
74564
74652
|
const typeResult = bindMethodForMemberAccess(subtype, concreteSubtype, memberInfo, classType, selfType, flags, memberName, usage, diag, recursionCount);
|
|
74565
74653
|
resultType = typeResult.type;
|
|
74566
74654
|
if (typeResult.typeErrors) {
|
|
@@ -74589,7 +74677,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
74589
74677
|
isDescriptorError = true;
|
|
74590
74678
|
}
|
|
74591
74679
|
return resultType;
|
|
74592
|
-
});
|
|
74680
|
+
}, { retainTypeAlias: true });
|
|
74593
74681
|
if (!isDescriptorError && usage.method === "set" && usage.setType) {
|
|
74594
74682
|
if (errorNode && memberInfo.symbol.hasTypedDeclarations()) {
|
|
74595
74683
|
narrowedTypeForSet = isDescriptorApplied ? usage.setType.type : narrowTypeBasedOnAssignment(type, usage.setType).type;
|
|
@@ -74666,7 +74754,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
74666
74754
|
}
|
|
74667
74755
|
return { type: types_1.UnknownType.create(), typeErrors: true };
|
|
74668
74756
|
}
|
|
74669
|
-
if (!(0, types_1.
|
|
74757
|
+
if (!(0, types_1.isFunctionOrOverloaded)(methodType)) {
|
|
74670
74758
|
if ((0, types_1.isAnyOrUnknown)(methodType)) {
|
|
74671
74759
|
return { type: methodType };
|
|
74672
74760
|
}
|
|
@@ -74698,7 +74786,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
74698
74786
|
);
|
|
74699
74787
|
accessMethodClass = solveAndApplyConstraints(accessMethodClass, constraints);
|
|
74700
74788
|
const specializedType = (0, typeUtils_1.partiallySpecializeType)(methodType, accessMethodClass, getTypeClassType(), selfType ? (0, typeUtils_1.convertToInstantiable)(selfType) : classType);
|
|
74701
|
-
if ((0, types_1.
|
|
74789
|
+
if ((0, types_1.isFunctionOrOverloaded)(specializedType)) {
|
|
74702
74790
|
methodType = specializedType;
|
|
74703
74791
|
}
|
|
74704
74792
|
}
|
|
@@ -74951,7 +75039,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
74951
75039
|
}
|
|
74952
75040
|
});
|
|
74953
75041
|
}
|
|
74954
|
-
if (!(0, types_1.
|
|
75042
|
+
if (!(0, types_1.isFunctionOrOverloaded)(accessMemberType)) {
|
|
74955
75043
|
if ((0, types_1.isAnyOrUnknown)(accessMemberType)) {
|
|
74956
75044
|
return { type: accessMemberType };
|
|
74957
75045
|
}
|
|
@@ -75054,13 +75142,25 @@ var require_typeEvaluator = __commonJS({
|
|
|
75054
75142
|
function adjustTypeArgsForTypeVarTuple(typeArgs, typeParams, errorNode) {
|
|
75055
75143
|
const variadicIndex = typeParams.findIndex((param) => (0, types_1.isTypeVarTuple)(param));
|
|
75056
75144
|
let srcUnboundedTupleType;
|
|
75057
|
-
|
|
75058
|
-
|
|
75059
|
-
|
|
75060
|
-
|
|
75145
|
+
const findUnboundedTupleIndex = (startArgIndex) => {
|
|
75146
|
+
return typeArgs.findIndex((arg, index) => {
|
|
75147
|
+
if (index < startArgIndex) {
|
|
75148
|
+
return false;
|
|
75149
|
+
}
|
|
75150
|
+
if ((0, types_1.isUnpackedClass)(arg.type) && arg.type.priv.tupleTypeArgs && arg.type.priv.tupleTypeArgs.length === 1 && arg.type.priv.tupleTypeArgs[0].isUnbounded) {
|
|
75151
|
+
srcUnboundedTupleType = arg.type.priv.tupleTypeArgs[0].type;
|
|
75152
|
+
return true;
|
|
75153
|
+
}
|
|
75154
|
+
return false;
|
|
75155
|
+
});
|
|
75156
|
+
};
|
|
75157
|
+
let srcUnboundedTupleIndex = findUnboundedTupleIndex(0);
|
|
75158
|
+
if (srcUnboundedTupleIndex >= 0) {
|
|
75159
|
+
const secondUnboundedTupleIndex = findUnboundedTupleIndex(srcUnboundedTupleIndex + 1);
|
|
75160
|
+
if (secondUnboundedTupleIndex >= 0) {
|
|
75161
|
+
addDiagnostic(diagnosticRules_1.DiagnosticRule.reportInvalidTypeForm, localize_1.LocMessage.variadicTypeArgsTooMany(), typeArgs[secondUnboundedTupleIndex].node);
|
|
75061
75162
|
}
|
|
75062
|
-
|
|
75063
|
-
});
|
|
75163
|
+
}
|
|
75064
75164
|
if (srcUnboundedTupleType && srcUnboundedTupleIndex >= 0 && variadicIndex >= 0 && typeArgs.length < typeParams.length) {
|
|
75065
75165
|
while (variadicIndex > srcUnboundedTupleIndex) {
|
|
75066
75166
|
typeArgs = [
|
|
@@ -78367,7 +78467,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
78367
78467
|
returnType = types_1.TypeBase.cloneForCondition(returnType, condition);
|
|
78368
78468
|
}
|
|
78369
78469
|
let eliminateUnsolvedInUnions = true;
|
|
78370
|
-
if ((0, types_1.
|
|
78470
|
+
if ((0, types_1.isFunctionOrOverloaded)(returnType)) {
|
|
78371
78471
|
eliminateUnsolvedInUnions = false;
|
|
78372
78472
|
}
|
|
78373
78473
|
let specializedReturnType = solveAndApplyConstraints(returnType, constraints, {
|
|
@@ -81066,7 +81166,6 @@ var require_typeEvaluator = __commonJS({
|
|
|
81066
81166
|
};
|
|
81067
81167
|
let reportedUnpackedError = false;
|
|
81068
81168
|
typeArgs.forEach((typeArg, index) => {
|
|
81069
|
-
var _a;
|
|
81070
81169
|
(0, debug_1.assert)(typeArgs !== void 0);
|
|
81071
81170
|
if ((0, typeUtils_1.isEllipsisType)(typeArg.type)) {
|
|
81072
81171
|
if (!isTupleTypeParam) {
|
|
@@ -81089,7 +81188,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
81089
81188
|
}
|
|
81090
81189
|
validateTypeVarTupleIsUnpacked(typeArg.type, typeArg.node);
|
|
81091
81190
|
} else if (paramLimit === void 0 && (0, types_1.isUnpackedClass)(typeArg.type)) {
|
|
81092
|
-
if ((
|
|
81191
|
+
if ((0, typeUtils_1.isUnboundedTupleClass)(typeArg.type)) {
|
|
81093
81192
|
noteSawUnpacked(typeArg);
|
|
81094
81193
|
}
|
|
81095
81194
|
validateTypeArg(typeArg, { allowUnpackedTuples: true });
|
|
@@ -83078,7 +83177,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
83078
83177
|
inferredParamType = (0, types_1.combineTypes)([defaultValueType, types_1.UnknownType.create()]);
|
|
83079
83178
|
} else {
|
|
83080
83179
|
let skipInference = false;
|
|
83081
|
-
if ((0, types_1.
|
|
83180
|
+
if ((0, types_1.isFunctionOrOverloaded)(defaultValueType)) {
|
|
83082
83181
|
skipInference = true;
|
|
83083
83182
|
} else if ((0, types_1.isClassInstance)(defaultValueType) && types_1.ClassType.isBuiltIn(defaultValueType, ["tuple", "list", "set", "dict"])) {
|
|
83084
83183
|
skipInference = true;
|
|
@@ -83446,6 +83545,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
83446
83545
|
return;
|
|
83447
83546
|
}
|
|
83448
83547
|
const exprTypeResult = getTypeOfExpression(node.d.expr);
|
|
83548
|
+
let isIncomplete = exprTypeResult.isIncomplete;
|
|
83449
83549
|
let exprType = exprTypeResult.type;
|
|
83450
83550
|
const isAsync = node.parent && node.parent.nodeType === 58 && !!node.parent.d.isAsync;
|
|
83451
83551
|
if ((0, typeUtils_1.isOptionalType)(exprType)) {
|
|
@@ -83471,7 +83571,17 @@ var require_typeEvaluator = __commonJS({
|
|
|
83471
83571
|
enterDiag.createAddendum()
|
|
83472
83572
|
);
|
|
83473
83573
|
if (enterTypeResult) {
|
|
83474
|
-
|
|
83574
|
+
if (isAsync) {
|
|
83575
|
+
if (enterTypeResult.isIncomplete) {
|
|
83576
|
+
isIncomplete = true;
|
|
83577
|
+
}
|
|
83578
|
+
const asyncResult = getTypeOfAwaitable({ type: enterTypeResult.type }, node.d.expr);
|
|
83579
|
+
if (asyncResult.isIncomplete) {
|
|
83580
|
+
isIncomplete = true;
|
|
83581
|
+
}
|
|
83582
|
+
return asyncResult.type;
|
|
83583
|
+
}
|
|
83584
|
+
return enterTypeResult.type;
|
|
83475
83585
|
}
|
|
83476
83586
|
if (!isAsync) {
|
|
83477
83587
|
if ((_a = getTypeOfMagicMethodCall(
|
|
@@ -83509,18 +83619,28 @@ var require_typeEvaluator = __commonJS({
|
|
|
83509
83619
|
exitDiag
|
|
83510
83620
|
);
|
|
83511
83621
|
if (exitTypeResult) {
|
|
83512
|
-
|
|
83622
|
+
if (exitTypeResult.isIncomplete) {
|
|
83623
|
+
isIncomplete = true;
|
|
83624
|
+
}
|
|
83625
|
+
if (isAsync) {
|
|
83626
|
+
const asyncResult = getTypeOfAwaitable({ type: exitTypeResult.type }, node.d.expr);
|
|
83627
|
+
if (asyncResult.isIncomplete) {
|
|
83628
|
+
isIncomplete = true;
|
|
83629
|
+
}
|
|
83630
|
+
return asyncResult.type;
|
|
83631
|
+
}
|
|
83632
|
+
return exitTypeResult.type;
|
|
83513
83633
|
}
|
|
83514
83634
|
}
|
|
83515
83635
|
addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.typeNotUsableWith().format({ type: printType(subtype), method: exitMethodName }) + exitDiag.getString(), node.d.expr);
|
|
83516
83636
|
return types_1.UnknownType.create();
|
|
83517
83637
|
});
|
|
83518
83638
|
if (node.d.target) {
|
|
83519
|
-
assignTypeToExpression(node.d.target, { type: scopedType, isIncomplete
|
|
83639
|
+
assignTypeToExpression(node.d.target, { type: scopedType, isIncomplete }, node.d.target);
|
|
83520
83640
|
}
|
|
83521
83641
|
writeTypeCache(
|
|
83522
83642
|
node,
|
|
83523
|
-
{ type: scopedType, isIncomplete
|
|
83643
|
+
{ type: scopedType, isIncomplete },
|
|
83524
83644
|
0
|
|
83525
83645
|
/* EvalFlags.None */
|
|
83526
83646
|
);
|
|
@@ -84466,7 +84586,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
84466
84586
|
if (fileInfo.isStubFile || pythonVersion_1.PythonVersion.isGreaterOrEqualTo(fileInfo.executionEnvironment.pythonVersion, pythonVersion_1.pythonVersion3_9) || (0, analyzerFileInfo_1.isAnnotationEvaluationPostponed)(AnalyzerNodeInfo.getFileInfo(errorNode)) || (flags & 4) !== 0) {
|
|
84467
84587
|
if (types_1.ClassType.isBuiltIn(classType, "type") && typeArgs) {
|
|
84468
84588
|
if (typeArgs.length >= 1) {
|
|
84469
|
-
if ((0, types_1.
|
|
84589
|
+
if ((0, types_1.isFunctionOrOverloaded)(typeArgs[0].type)) {
|
|
84470
84590
|
addDiagnostic(diagnosticRules_1.DiagnosticRule.reportInvalidTypeForm, localize_1.LocMessage.typeAnnotationWithCallable(), typeArgs[0].node);
|
|
84471
84591
|
return { type: types_1.UnknownType.create() };
|
|
84472
84592
|
}
|
|
@@ -84967,7 +85087,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
84967
85087
|
if (!tracker) {
|
|
84968
85088
|
return type;
|
|
84969
85089
|
}
|
|
84970
|
-
if ((0, types_1.
|
|
85090
|
+
if ((0, types_1.isFunctionOrOverloaded)(type)) {
|
|
84971
85091
|
return (0, typeUtils_1.ensureSignaturesAreUnique)(type, tracker, node.start);
|
|
84972
85092
|
}
|
|
84973
85093
|
return type;
|
|
@@ -86262,9 +86382,9 @@ var require_typeEvaluator = __commonJS({
|
|
|
86262
86382
|
typeResult.type = validateSymbolIsTypeExpression(errorNode, typeResult.type, !!typeResult.includesVariableDecl);
|
|
86263
86383
|
}
|
|
86264
86384
|
inferReturnTypeIfNecessary(typeResult.type);
|
|
86265
|
-
if (errorNode && selfClass && (0, types_1.isClass)(selfClass) && member.isInstanceMember && (0, types_1.isClass)(member.unspecializedClassType) && (flags & 1024) !== 0 && (0, typeUtils_1.requiresSpecialization)(typeResult.type, { ignoreSelf: true, ignoreImplicitTypeArgs: true })) {
|
|
86385
|
+
if (errorNode && selfClass && (0, types_1.isClass)(selfClass) && !selfClass.priv.includeSubclasses && member.isInstanceMember && (0, types_1.isClass)(member.unspecializedClassType) && (flags & 1024) !== 0 && (0, typeUtils_1.requiresSpecialization)(typeResult.type, { ignoreSelf: true, ignoreImplicitTypeArgs: true })) {
|
|
86266
86386
|
const specializedType = (0, typeUtils_1.partiallySpecializeType)(typeResult.type, member.unspecializedClassType, getTypeClassType(), (0, typeUtils_1.selfSpecializeClass)(selfClass, { overrideTypeArgs: true }));
|
|
86267
|
-
if ((0, types_1.findSubtype)(specializedType, (subtype) => !(0, types_1.
|
|
86387
|
+
if ((0, types_1.findSubtype)(specializedType, (subtype) => !(0, types_1.isFunctionOrOverloaded)(subtype) && (0, typeUtils_1.requiresSpecialization)(subtype, { ignoreSelf: true, ignoreImplicitTypeArgs: true }))) {
|
|
86268
86388
|
addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.genericInstanceVariableAccess(), errorNode);
|
|
86269
86389
|
}
|
|
86270
86390
|
}
|
|
@@ -86951,7 +87071,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
86951
87071
|
return false;
|
|
86952
87072
|
}
|
|
86953
87073
|
return true;
|
|
86954
|
-
} else if ((0, types_1.
|
|
87074
|
+
} else if ((0, types_1.isFunctionOrOverloaded)(concreteSrcType)) {
|
|
86955
87075
|
const destCallbackType = getCallbackProtocolType(destType, recursionCount);
|
|
86956
87076
|
if (destCallbackType) {
|
|
86957
87077
|
return assignType(destCallbackType, concreteSrcType, diag, constraints, flags, recursionCount);
|
|
@@ -86976,21 +87096,20 @@ var require_typeEvaluator = __commonJS({
|
|
|
86976
87096
|
}
|
|
86977
87097
|
const metaclass = concreteSrcType.shared.effectiveMetaclass;
|
|
86978
87098
|
if (metaclass) {
|
|
86979
|
-
if ((0, types_1.isAnyOrUnknown)(metaclass)) {
|
|
86980
|
-
|
|
86981
|
-
|
|
86982
|
-
|
|
86983
|
-
|
|
86984
|
-
|
|
86985
|
-
|
|
86986
|
-
|
|
86987
|
-
|
|
86988
|
-
|
|
86989
|
-
|
|
86990
|
-
|
|
86991
|
-
|
|
86992
|
-
|
|
86993
|
-
return true;
|
|
87099
|
+
if (!(0, types_1.isAnyOrUnknown)(metaclass)) {
|
|
87100
|
+
if (assignClass(
|
|
87101
|
+
types_1.ClassType.cloneAsInstantiable(destType),
|
|
87102
|
+
metaclass,
|
|
87103
|
+
/* diag */
|
|
87104
|
+
void 0,
|
|
87105
|
+
constraints,
|
|
87106
|
+
flags,
|
|
87107
|
+
recursionCount,
|
|
87108
|
+
/* reportErrorsUsingObjType */
|
|
87109
|
+
true
|
|
87110
|
+
)) {
|
|
87111
|
+
return true;
|
|
87112
|
+
}
|
|
86994
87113
|
}
|
|
86995
87114
|
}
|
|
86996
87115
|
} else if ((0, types_1.isAnyOrUnknown)(concreteSrcType) && !((_j = concreteSrcType.props) == null ? void 0 : _j.specialForm)) {
|
|
@@ -87247,10 +87366,8 @@ var require_typeEvaluator = __commonJS({
|
|
|
87247
87366
|
}
|
|
87248
87367
|
}
|
|
87249
87368
|
}
|
|
87250
|
-
if ((0, types_1.
|
|
87251
|
-
|
|
87252
|
-
return true;
|
|
87253
|
-
}
|
|
87369
|
+
if ((0, types_1.isFunctionOrOverloaded)(srcSubtype) && (0, types_1.isFunctionOrOverloaded)(destSubtype)) {
|
|
87370
|
+
return true;
|
|
87254
87371
|
}
|
|
87255
87372
|
return false;
|
|
87256
87373
|
});
|
|
@@ -87452,10 +87569,10 @@ var require_typeEvaluator = __commonJS({
|
|
|
87452
87569
|
if ((0, types_1.isModule)(leftType) || (0, types_1.isModule)(rightType)) {
|
|
87453
87570
|
return (0, types_1.isTypeSame)(leftType, rightType, { ignoreConditions: true });
|
|
87454
87571
|
}
|
|
87455
|
-
const isLeftCallable = (0, types_1.
|
|
87456
|
-
const isRightCallable = (0, types_1.
|
|
87457
|
-
if (isLeftCallable
|
|
87458
|
-
return
|
|
87572
|
+
const isLeftCallable = (0, types_1.isFunctionOrOverloaded)(leftType);
|
|
87573
|
+
const isRightCallable = (0, types_1.isFunctionOrOverloaded)(rightType);
|
|
87574
|
+
if (isLeftCallable || isRightCallable) {
|
|
87575
|
+
return true;
|
|
87459
87576
|
}
|
|
87460
87577
|
if ((0, types_1.isInstantiableClass)(leftType) || (0, types_1.isClassInstance)(leftType) && types_1.ClassType.isBuiltIn(leftType, "type")) {
|
|
87461
87578
|
if ((0, types_1.isInstantiableClass)(rightType) || (0, types_1.isClassInstance)(rightType) && types_1.ClassType.isBuiltIn(rightType, "type")) {
|
|
@@ -88336,7 +88453,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
88336
88453
|
return assignedSubtype;
|
|
88337
88454
|
}
|
|
88338
88455
|
if ((0, types_1.isClassInstance)(declaredSubtype) && types_1.ClassType.isProtocolClass(declaredSubtype)) {
|
|
88339
|
-
if ((0, types_1.
|
|
88456
|
+
if ((0, types_1.isFunctionOrOverloaded)(assignedSubtype)) {
|
|
88340
88457
|
return assignedSubtype;
|
|
88341
88458
|
}
|
|
88342
88459
|
}
|
|
@@ -88357,7 +88474,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
88357
88474
|
return { type: narrowedType, isIncomplete: assignedTypeResult.isIncomplete };
|
|
88358
88475
|
}
|
|
88359
88476
|
function validateOverrideMethod(baseMethod, overrideMethod, baseClass, diag, enforceParamNames = true) {
|
|
88360
|
-
if (!(0, types_1.
|
|
88477
|
+
if (!(0, types_1.isFunctionOrOverloaded)(baseMethod)) {
|
|
88361
88478
|
diag.addMessage(localize_1.LocAddendum.overrideType().format({ type: printType(baseMethod) }));
|
|
88362
88479
|
return false;
|
|
88363
88480
|
}
|
|
@@ -88884,7 +89001,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
88884
89001
|
constraints.setBounds(memberTypeFirstParamType, types_1.TypeBase.isInstantiable(memberTypeFirstParamType) ? (0, typeUtils_1.convertToInstance)(firstParamType) : firstParamType);
|
|
88885
89002
|
} else {
|
|
88886
89003
|
const subDiag = diag == null ? void 0 : diag.createAddendum();
|
|
88887
|
-
if ((0, types_1.
|
|
89004
|
+
if ((0, types_1.isFunctionOrOverloaded)(memberTypeFirstParamType)) {
|
|
88888
89005
|
if ((0, types_1.isClassInstance)(firstParamType) && types_1.ClassType.isProtocolClass(firstParamType)) {
|
|
88889
89006
|
if (subDiag) {
|
|
88890
89007
|
subDiag.addMessage(localize_1.LocMessage.bindTypeMismatch().format({
|
|
@@ -90413,7 +90530,7 @@ var require_checker = __commonJS({
|
|
|
90413
90530
|
let isCoroutine = true;
|
|
90414
90531
|
(0, typeUtils_1.doForEachSubtype)(exprTypeResult.type, (subtype) => {
|
|
90415
90532
|
subtype = this._evaluator.makeTopLevelTypeVarsConcrete(subtype);
|
|
90416
|
-
if (!(0, types_1.
|
|
90533
|
+
if (!(0, types_1.isFunctionOrOverloaded)(subtype)) {
|
|
90417
90534
|
isExprFunction = false;
|
|
90418
90535
|
}
|
|
90419
90536
|
if (!(0, types_1.isClassInstance)(subtype) || !types_1.ClassType.isBuiltIn(subtype, ["Coroutine", "CoroutineType"])) {
|
|
@@ -91816,7 +91933,7 @@ var require_checker = __commonJS({
|
|
|
91816
91933
|
_isTypeSupportedTypeForIsInstance(type, isInstanceCheck, diag) {
|
|
91817
91934
|
let isSupported = true;
|
|
91818
91935
|
(0, typeUtils_1.doForEachSubtype)(type, (subtype) => {
|
|
91819
|
-
var _a, _b;
|
|
91936
|
+
var _a, _b, _c;
|
|
91820
91937
|
subtype = this._evaluator.makeTopLevelTypeVarsConcrete(subtype);
|
|
91821
91938
|
subtype = (0, typeUtils_1.transformPossibleRecursiveTypeAlias)(subtype);
|
|
91822
91939
|
if (((_a = subtype.props) == null ? void 0 : _a.specialForm) && types_1.ClassType.isBuiltIn(subtype.props.specialForm, "TypeAliasType")) {
|
|
@@ -91857,6 +91974,9 @@ var require_checker = __commonJS({
|
|
|
91857
91974
|
} else if (((_b = subtype.props) == null ? void 0 : _b.specialForm) && (0, types_1.isClassInstance)(subtype.props.specialForm) && types_1.ClassType.isBuiltIn(subtype.props.specialForm, "Annotated")) {
|
|
91858
91975
|
diag.addMessage(localize_1.LocAddendum.annotatedNotAllowed());
|
|
91859
91976
|
isSupported = false;
|
|
91977
|
+
} else if (((_c = subtype.props) == null ? void 0 : _c.specialForm) && (0, types_1.isInstantiableClass)(subtype.props.specialForm) && types_1.ClassType.isBuiltIn(subtype.props.specialForm, "Literal")) {
|
|
91978
|
+
diag.addMessage(localize_1.LocAddendum.literalNotAllowed());
|
|
91979
|
+
isSupported = false;
|
|
91860
91980
|
}
|
|
91861
91981
|
break;
|
|
91862
91982
|
case 4:
|
|
@@ -92837,7 +92957,7 @@ var require_checker = __commonJS({
|
|
|
92837
92957
|
return;
|
|
92838
92958
|
}
|
|
92839
92959
|
let newMemberType = newMethodResult.type;
|
|
92840
|
-
if (!(0, types_1.
|
|
92960
|
+
if (!(0, types_1.isFunctionOrOverloaded)(newMemberType)) {
|
|
92841
92961
|
return;
|
|
92842
92962
|
}
|
|
92843
92963
|
if ((0, types_1.isOverloaded)(newMemberType)) {
|
|
@@ -92847,7 +92967,7 @@ var require_checker = __commonJS({
|
|
|
92847
92967
|
}
|
|
92848
92968
|
}
|
|
92849
92969
|
let initMemberType = initMethodResult.type;
|
|
92850
|
-
if (!(0, types_1.
|
|
92970
|
+
if (!(0, types_1.isFunctionOrOverloaded)(initMemberType)) {
|
|
92851
92971
|
return;
|
|
92852
92972
|
}
|
|
92853
92973
|
if ((0, types_1.isOverloaded)(initMemberType)) {
|
|
@@ -93018,9 +93138,9 @@ var require_checker = __commonJS({
|
|
|
93018
93138
|
let diag;
|
|
93019
93139
|
const overrideDecl = (0, symbolUtils_1.getLastTypedDeclarationForSymbol)(overrideClassAndSymbol.symbol);
|
|
93020
93140
|
const overriddenDecl = (0, symbolUtils_1.getLastTypedDeclarationForSymbol)(overriddenClassAndSymbol.symbol);
|
|
93021
|
-
if ((0, types_1.
|
|
93141
|
+
if ((0, types_1.isFunctionOrOverloaded)(overriddenType)) {
|
|
93022
93142
|
const diagAddendum = new diagnostic_1.DiagnosticAddendum();
|
|
93023
|
-
if ((0, types_1.
|
|
93143
|
+
if ((0, types_1.isFunctionOrOverloaded)(overrideType)) {
|
|
93024
93144
|
if (!this._evaluator.validateOverrideMethod(
|
|
93025
93145
|
overriddenType,
|
|
93026
93146
|
overrideType,
|
|
@@ -93475,15 +93595,15 @@ var require_checker = __commonJS({
|
|
|
93475
93595
|
return;
|
|
93476
93596
|
}
|
|
93477
93597
|
const baseClass = baseClassAndSymbol.classType;
|
|
93478
|
-
const baseClassSelf = types_1.ClassType.cloneAsInstance((0, typeUtils_1.selfSpecializeClass)(baseClass, { useBoundTypeVars: true }));
|
|
93479
93598
|
const childClassSelf = types_1.ClassType.cloneAsInstance((0, typeUtils_1.selfSpecializeClass)(childClassType, { useBoundTypeVars: true }));
|
|
93599
|
+
const baseClassSelf = types_1.ClassType.isProtocolClass(baseClass) ? childClassSelf : types_1.ClassType.cloneAsInstance((0, typeUtils_1.selfSpecializeClass)(baseClass, { useBoundTypeVars: true }));
|
|
93480
93600
|
let baseType = (0, typeUtils_1.partiallySpecializeType)(this._evaluator.getEffectiveTypeOfSymbol(baseClassAndSymbol.symbol), baseClass, this._evaluator.getTypeClassType(), baseClassSelf);
|
|
93481
93601
|
overrideType = (0, typeUtils_1.partiallySpecializeType)(overrideType, childClassType, this._evaluator.getTypeClassType(), childClassSelf);
|
|
93482
93602
|
if (childClassType.shared.typeVarScopeId) {
|
|
93483
93603
|
overrideType = (0, typeUtils_1.makeTypeVarsBound)(overrideType, [childClassType.shared.typeVarScopeId]);
|
|
93484
93604
|
baseType = (0, typeUtils_1.makeTypeVarsBound)(baseType, [childClassType.shared.typeVarScopeId]);
|
|
93485
93605
|
}
|
|
93486
|
-
if ((0, types_1.
|
|
93606
|
+
if ((0, types_1.isFunctionOrOverloaded)(baseType)) {
|
|
93487
93607
|
const diagAddendum = new diagnostic_1.DiagnosticAddendum();
|
|
93488
93608
|
if (this._isFinalFunction(memberName, baseType)) {
|
|
93489
93609
|
const decl = (0, symbolUtils_1.getLastTypedDeclarationForSymbol)(overrideSymbol);
|
|
@@ -93501,7 +93621,7 @@ var require_checker = __commonJS({
|
|
|
93501
93621
|
if (this._isMethodExemptFromLsp(memberName) || SymbolNameUtils.isPrivateName(memberName) || types_1.ClassType.isTypedDictClass(childClassType)) {
|
|
93502
93622
|
return;
|
|
93503
93623
|
}
|
|
93504
|
-
if ((0, types_1.
|
|
93624
|
+
if ((0, types_1.isFunctionOrOverloaded)(overrideType)) {
|
|
93505
93625
|
const enforceParamNameMatch = !SymbolNameUtils.isDunderName(memberName);
|
|
93506
93626
|
if (this._evaluator.validateOverrideMethod(baseType, overrideType, childClassType, diagAddendum, enforceParamNameMatch)) {
|
|
93507
93627
|
return;
|
|
@@ -94602,7 +94722,7 @@ var require_sourceFile = __commonJS({
|
|
|
94602
94722
|
}
|
|
94603
94723
|
};
|
|
94604
94724
|
var SourceFile = class {
|
|
94605
|
-
constructor(serviceProvider, uri, moduleName, isThirdPartyImport, isThirdPartyPyTypedPresent,
|
|
94725
|
+
constructor(serviceProvider, uri, moduleName, isThirdPartyImport, isThirdPartyPyTypedPresent, editMode, console2, logTracker, ipythonMode) {
|
|
94606
94726
|
this.serviceProvider = serviceProvider;
|
|
94607
94727
|
this._diagnosticRuleSet = (0, configOptions_1.getBasicDiagnosticRuleSet)();
|
|
94608
94728
|
this._ipythonMode = IPythonMode.None;
|
|
@@ -94616,7 +94736,6 @@ var require_sourceFile = __commonJS({
|
|
|
94616
94736
|
this._isStubFile = uri.hasExtension(".pyi");
|
|
94617
94737
|
this._isThirdPartyImport = isThirdPartyImport;
|
|
94618
94738
|
this._isThirdPartyPyTypedPresent = isThirdPartyPyTypedPresent;
|
|
94619
|
-
this._isModulePrivate = isModulePrivate;
|
|
94620
94739
|
const fileName = uri.fileName;
|
|
94621
94740
|
this._isTypingStubFile = this._isStubFile && (this._uri.pathEndsWith("stdlib/typing.pyi") || fileName === "typing_extensions.pyi");
|
|
94622
94741
|
this._isTypingExtensionsStubFile = this._isStubFile && fileName === "typing_extensions.pyi";
|
|
@@ -94926,7 +95045,8 @@ var require_sourceFile = __commonJS({
|
|
|
94926
95045
|
importedModules: [],
|
|
94927
95046
|
futureImports: /* @__PURE__ */ new Set(),
|
|
94928
95047
|
containsWildcardImport: false,
|
|
94929
|
-
typingSymbolAliases: /* @__PURE__ */ new Map()
|
|
95048
|
+
typingSymbolAliases: /* @__PURE__ */ new Map(),
|
|
95049
|
+
hasTypeAnnotations: false
|
|
94930
95050
|
};
|
|
94931
95051
|
this._writableData.tokenizerLines = new textRangeCollection_1.TextRangeCollection([]);
|
|
94932
95052
|
this._writableData.tokenizerOutput = {
|
|
@@ -95280,7 +95400,6 @@ var require_sourceFile = __commonJS({
|
|
|
95280
95400
|
isTypeshedStubFile: this._isTypeshedStubFile,
|
|
95281
95401
|
isBuiltInStubFile: this._isBuiltInStubFile,
|
|
95282
95402
|
isInPyTypedPackage: this._isThirdPartyPyTypedPresent,
|
|
95283
|
-
isModulePrivate: this._isModulePrivate,
|
|
95284
95403
|
ipythonMode: this._ipythonMode,
|
|
95285
95404
|
accessedSymbolSet: /* @__PURE__ */ new Set()
|
|
95286
95405
|
};
|
|
@@ -95463,6 +95582,8 @@ var require_parser = __commonJS({
|
|
|
95463
95582
|
this._isParsingTypeAnnotation = false;
|
|
95464
95583
|
this._isParsingIndexTrailer = false;
|
|
95465
95584
|
this._isParsingQuotedText = false;
|
|
95585
|
+
this._isInFinallyBlock = false;
|
|
95586
|
+
this._isInFinallyLoop = false;
|
|
95466
95587
|
this._futureImports = /* @__PURE__ */ new Set();
|
|
95467
95588
|
this._importedModules = [];
|
|
95468
95589
|
this._containsWildcardImport = false;
|
|
@@ -95470,8 +95591,10 @@ var require_parser = __commonJS({
|
|
|
95470
95591
|
this._typingImportAliases = [];
|
|
95471
95592
|
this._typingSymbolAliases = /* @__PURE__ */ new Map();
|
|
95472
95593
|
this._maxChildDepthMap = /* @__PURE__ */ new Map();
|
|
95594
|
+
this._hasTypeAnnotations = false;
|
|
95473
95595
|
}
|
|
95474
95596
|
parseSourceFile(fileContents, parseOptions, diagSink) {
|
|
95597
|
+
this._hasTypeAnnotations = false;
|
|
95475
95598
|
timing_1.timingStats.tokenizeFileTime.timeOperation(() => {
|
|
95476
95599
|
this._startNewParse(fileContents, 0, fileContents.length, parseOptions, diagSink);
|
|
95477
95600
|
});
|
|
@@ -95513,7 +95636,8 @@ var require_parser = __commonJS({
|
|
|
95513
95636
|
importedModules: this._importedModules,
|
|
95514
95637
|
futureImports: this._futureImports,
|
|
95515
95638
|
containsWildcardImport: this._containsWildcardImport,
|
|
95516
|
-
typingSymbolAliases: this._typingSymbolAliases
|
|
95639
|
+
typingSymbolAliases: this._typingSymbolAliases,
|
|
95640
|
+
hasTypeAnnotations: this._hasTypeAnnotations
|
|
95517
95641
|
},
|
|
95518
95642
|
tokenizerOutput: this._tokenizerOutput
|
|
95519
95643
|
};
|
|
@@ -96521,6 +96645,8 @@ var require_parser = __commonJS({
|
|
|
96521
96645
|
_parseLoopSuite() {
|
|
96522
96646
|
const wasInLoop = this._isInLoop;
|
|
96523
96647
|
this._isInLoop = true;
|
|
96648
|
+
const wasInFinallyLoop = this._isInFinallyLoop;
|
|
96649
|
+
this._isInFinallyLoop = false;
|
|
96524
96650
|
let typeComment;
|
|
96525
96651
|
const suite = this._parseSuite(
|
|
96526
96652
|
this._isInFunction,
|
|
@@ -96534,6 +96660,7 @@ var require_parser = __commonJS({
|
|
|
96534
96660
|
}
|
|
96535
96661
|
);
|
|
96536
96662
|
this._isInLoop = wasInLoop;
|
|
96663
|
+
this._isInFinallyLoop = wasInFinallyLoop;
|
|
96537
96664
|
if (typeComment) {
|
|
96538
96665
|
suite.d.typeComment = typeComment;
|
|
96539
96666
|
}
|
|
@@ -96961,7 +97088,13 @@ var require_parser = __commonJS({
|
|
|
96961
97088
|
16
|
|
96962
97089
|
/* KeywordType.Finally */
|
|
96963
97090
|
)) {
|
|
97091
|
+
const wasInFinallyBlock = this._isInFinallyBlock;
|
|
97092
|
+
const wasInFinallyLoop = this._isInFinallyLoop;
|
|
97093
|
+
this._isInFinallyBlock = true;
|
|
97094
|
+
this._isInFinallyLoop = this._isInLoop;
|
|
96964
97095
|
tryNode.d.finallySuite = this._parseSuite(this._isInFunction);
|
|
97096
|
+
this._isInFinallyBlock = wasInFinallyBlock;
|
|
97097
|
+
this._isInFinallyLoop = wasInFinallyLoop;
|
|
96965
97098
|
tryNode.d.finallySuite.parent = tryNode;
|
|
96966
97099
|
(0, parseNodes_1.extendRange)(tryNode, tryNode.d.finallySuite);
|
|
96967
97100
|
}
|
|
@@ -97023,6 +97156,10 @@ var require_parser = __commonJS({
|
|
|
97023
97156
|
let functionTypeAnnotationToken;
|
|
97024
97157
|
const wasInExceptionGroup = this._isInExceptionGroup;
|
|
97025
97158
|
this._isInExceptionGroup = false;
|
|
97159
|
+
const wasInFinallyBlock = this._isInFinallyBlock;
|
|
97160
|
+
const wasInFinallyLoop = this._isInFinallyLoop;
|
|
97161
|
+
this._isInFinallyBlock = false;
|
|
97162
|
+
this._isInFinallyLoop = false;
|
|
97026
97163
|
const suite = this._parseSuite(
|
|
97027
97164
|
/* isFunction */
|
|
97028
97165
|
true,
|
|
@@ -97034,6 +97171,8 @@ var require_parser = __commonJS({
|
|
|
97034
97171
|
}
|
|
97035
97172
|
);
|
|
97036
97173
|
this._isInExceptionGroup = wasInExceptionGroup;
|
|
97174
|
+
this._isInFinallyBlock = wasInFinallyBlock;
|
|
97175
|
+
this._isInFinallyLoop = wasInFinallyLoop;
|
|
97037
97176
|
const functionNode = parseNodes_1.FunctionNode.create(defToken, parseNodes_1.NameNode.create(nameToken), suite, typeParameters);
|
|
97038
97177
|
if (asyncToken) {
|
|
97039
97178
|
functionNode.d.isAsync = true;
|
|
@@ -97530,6 +97669,9 @@ var require_parser = __commonJS({
|
|
|
97530
97669
|
} else if (this._isInExceptionGroup) {
|
|
97531
97670
|
this._addSyntaxError(localize_1.LocMessage.breakInExceptionGroup(), breakToken);
|
|
97532
97671
|
}
|
|
97672
|
+
if (this._isInFinallyLoop && pythonVersion_1.PythonVersion.isGreaterOrEqualTo(this._getLanguageVersion(), pythonVersion_1.pythonVersion3_14)) {
|
|
97673
|
+
this._addSyntaxError(localize_1.LocMessage.finallyBreak(), breakToken);
|
|
97674
|
+
}
|
|
97533
97675
|
return parseNodes_1.BreakNode.create(breakToken);
|
|
97534
97676
|
}
|
|
97535
97677
|
_parseContinueStatement() {
|
|
@@ -97542,6 +97684,9 @@ var require_parser = __commonJS({
|
|
|
97542
97684
|
} else if (this._isInExceptionGroup) {
|
|
97543
97685
|
this._addSyntaxError(localize_1.LocMessage.continueInExceptionGroup(), continueToken);
|
|
97544
97686
|
}
|
|
97687
|
+
if (this._isInFinallyLoop && pythonVersion_1.PythonVersion.isGreaterOrEqualTo(this._getLanguageVersion(), pythonVersion_1.pythonVersion3_14)) {
|
|
97688
|
+
this._addSyntaxError(localize_1.LocMessage.finallyContinue(), continueToken);
|
|
97689
|
+
}
|
|
97545
97690
|
return parseNodes_1.ContinueNode.create(continueToken);
|
|
97546
97691
|
}
|
|
97547
97692
|
// return_stmt: 'return' [testlist]
|
|
@@ -97556,6 +97701,9 @@ var require_parser = __commonJS({
|
|
|
97556
97701
|
} else if (this._isInExceptionGroup) {
|
|
97557
97702
|
this._addSyntaxError(localize_1.LocMessage.returnInExceptionGroup(), returnToken);
|
|
97558
97703
|
}
|
|
97704
|
+
if (this._isInFinallyBlock && pythonVersion_1.PythonVersion.isGreaterOrEqualTo(this._getLanguageVersion(), pythonVersion_1.pythonVersion3_14)) {
|
|
97705
|
+
this._addSyntaxError(localize_1.LocMessage.finallyReturn(), returnToken);
|
|
97706
|
+
}
|
|
97559
97707
|
if (!this._isNextTokenNeverExpression()) {
|
|
97560
97708
|
const returnExpr = this._parseTestOrStarListAsExpression(
|
|
97561
97709
|
/* allowAssignmentExpression */
|
|
@@ -99548,6 +99696,7 @@ var require_parser = __commonJS({
|
|
|
99548
99696
|
result = parseNodes_1.UnpackNode.create(startToken, result);
|
|
99549
99697
|
}
|
|
99550
99698
|
this._isParsingTypeAnnotation = wasParsingTypeAnnotation;
|
|
99699
|
+
this._hasTypeAnnotations = true;
|
|
99551
99700
|
return result;
|
|
99552
99701
|
}
|
|
99553
99702
|
_reportStringTokenErrors(stringToken, unescapedResult) {
|