@artel/artc 0.6.25219 → 0.6.25221

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.
@@ -165,6 +165,7 @@ import {
165
165
  getParentSkippingParenthesizedExpressions,
166
166
  isComputedVariableEntity,
167
167
  isIdentifier,
168
+ isNarrowableReferenceExpression,
168
169
  isNonEmptyArray,
169
170
  isSourceOrConfigurationFileName,
170
171
  isTypeEntity,
@@ -180,7 +181,7 @@ import {
180
181
  unwrapParenthesizedExpressions,
181
182
  visitChildren,
182
183
  yieldExecution
183
- } from "../chunk-IYSH7MAQ.js";
184
+ } from "../chunk-X7TMUZ4C.js";
184
185
 
185
186
  // source/services/CustomCommand.ts
186
187
  import * as ls from "vscode-languageserver";
@@ -376,10 +377,11 @@ var AddPropertyAssignmentService = class {
376
377
  case 106 /* ForStatement */:
377
378
  case 107 /* IfStatement */:
378
379
  case 109 /* ElseIfClause */:
379
- case 113 /* LoopStatement */:
380
- case 118 /* SwitchStatementCaseClause */:
381
- case 119 /* WhileStatement */:
382
- return this.getContainingSubprogram(parent)?.body;
380
+ case 110 /* ElseClause */:
381
+ case 114 /* LoopStatement */:
382
+ case 119 /* CaseClause */:
383
+ case 120 /* WhileStatement */:
384
+ return this.getContainingSubprogram(parent)?.block;
383
385
  default:
384
386
  Debug.never(parent);
385
387
  }
@@ -1151,8 +1153,8 @@ var SyntaxToCode = class _SyntaxToCode {
1151
1153
  this.writeWhitespace();
1152
1154
  this.writeToken(node.name);
1153
1155
  this.writeTypeAnnotation(node.typeAnnotation, false);
1154
- if (node.body !== void 0) {
1155
- this.writeDeclarationBody(node.body);
1156
+ if (node.block !== void 0) {
1157
+ this.writeDeclarationBody(node.block);
1156
1158
  }
1157
1159
  }
1158
1160
  writePackageVariableSetterDeclaration(node) {
@@ -1161,8 +1163,8 @@ var SyntaxToCode = class _SyntaxToCode {
1161
1163
  this.writeKeyword(node.setKeyword);
1162
1164
  this.writeWhitespace();
1163
1165
  this.writeToken(node.name);
1164
- if (node.body !== void 0) {
1165
- this.writeDeclarationBody(node.body);
1166
+ if (node.block !== void 0) {
1167
+ this.writeDeclarationBody(node.block);
1166
1168
  }
1167
1169
  }
1168
1170
  writePackageMethodDeclaration(node) {
@@ -1178,8 +1180,8 @@ var SyntaxToCode = class _SyntaxToCode {
1178
1180
  if (node.returnTypeAnnotation !== void 0) {
1179
1181
  this.writeTypeAnnotation(node.returnTypeAnnotation, true);
1180
1182
  }
1181
- if (node.body !== void 0) {
1182
- this.writeDeclarationBody(node.body);
1183
+ if (node.block !== void 0) {
1184
+ this.writeDeclarationBody(node.block);
1183
1185
  }
1184
1186
  }
1185
1187
  writePackageStructuredTypeDeclaration(node) {
@@ -1258,13 +1260,13 @@ var SyntaxToCode = class _SyntaxToCode {
1258
1260
  this.writeDeclarationTags(node.tagList);
1259
1261
  this.writeDeclarationModifiers(node.modifierList);
1260
1262
  this.writeKeyword(node.creationKeyword);
1261
- this.writeDeclarationBody(node.body);
1263
+ this.writeDeclarationBody(node.block);
1262
1264
  }
1263
1265
  writePackageEntryPointDeclaration(node) {
1264
1266
  this.writeDeclarationTags(node.tagList);
1265
1267
  this.writeDeclarationModifiers(node.modifierList);
1266
1268
  this.writeKeyword(node.runKeyword);
1267
- this.writeDeclarationBody(node.body);
1269
+ this.writeDeclarationBody(node.block);
1268
1270
  }
1269
1271
  writeStructuredTypeDeclarationBody(node) {
1270
1272
  this.writeKeyword(node.structuredTypeKindKeyword);
@@ -1328,8 +1330,8 @@ var SyntaxToCode = class _SyntaxToCode {
1328
1330
  this.writeWhitespace();
1329
1331
  this.writeToken(node.name);
1330
1332
  this.writeTypeAnnotation(node.typeAnnotation, false);
1331
- if (node.body !== void 0) {
1332
- this.writeDeclarationBody(node.body);
1333
+ if (node.block !== void 0) {
1334
+ this.writeDeclarationBody(node.block);
1333
1335
  }
1334
1336
  }
1335
1337
  writeTypeVariableSetterDeclaration(node) {
@@ -1338,8 +1340,8 @@ var SyntaxToCode = class _SyntaxToCode {
1338
1340
  this.writeKeyword(node.setKeyword);
1339
1341
  this.writeWhitespace();
1340
1342
  this.writeToken(node.name);
1341
- if (node.body !== void 0) {
1342
- this.writeDeclarationBody(node.body);
1343
+ if (node.block !== void 0) {
1344
+ this.writeDeclarationBody(node.block);
1343
1345
  }
1344
1346
  }
1345
1347
  writeTypeMethodDeclaration(node) {
@@ -1355,8 +1357,8 @@ var SyntaxToCode = class _SyntaxToCode {
1355
1357
  if (node.returnTypeAnnotation !== void 0) {
1356
1358
  this.writeTypeAnnotation(node.returnTypeAnnotation, true);
1357
1359
  }
1358
- if (node.body !== void 0) {
1359
- this.writeDeclarationBody(node.body);
1360
+ if (node.block !== void 0) {
1361
+ this.writeDeclarationBody(node.block);
1360
1362
  }
1361
1363
  }
1362
1364
  writeOperatorDeclaration(node) {
@@ -1369,8 +1371,8 @@ var SyntaxToCode = class _SyntaxToCode {
1369
1371
  if (node.returnTypeAnnotation !== void 0) {
1370
1372
  this.writeTypeAnnotation(node.returnTypeAnnotation, true);
1371
1373
  }
1372
- if (node.body !== void 0) {
1373
- this.writeDeclarationBody(node.body);
1374
+ if (node.block !== void 0) {
1375
+ this.writeDeclarationBody(node.block);
1374
1376
  }
1375
1377
  }
1376
1378
  writeTypeConstructorDeclaration(node) {
@@ -1378,8 +1380,8 @@ var SyntaxToCode = class _SyntaxToCode {
1378
1380
  this.writeDeclarationModifiers(node.modifierList);
1379
1381
  this.writeKeyword(node.creationKeyword);
1380
1382
  this.writeParameterClause(node.parameterClause);
1381
- if (node.body !== void 0) {
1382
- this.writeDeclarationBody(node.body);
1383
+ if (node.block !== void 0) {
1384
+ this.writeDeclarationBody(node.block);
1383
1385
  }
1384
1386
  }
1385
1387
  writeTypeDestructorDeclaration(node) {
@@ -1387,8 +1389,8 @@ var SyntaxToCode = class _SyntaxToCode {
1387
1389
  this.writeDeclarationModifiers(node.modifierList);
1388
1390
  this.writeKeyword(node.destructionKeyword);
1389
1391
  this.writeParameterClause(node.parameterClause);
1390
- if (node.body !== void 0) {
1391
- this.writeDeclarationBody(node.body);
1392
+ if (node.block !== void 0) {
1393
+ this.writeDeclarationBody(node.block);
1392
1394
  }
1393
1395
  }
1394
1396
  writeTypeIndexedGetterDeclaration(node) {
@@ -1400,8 +1402,8 @@ var SyntaxToCode = class _SyntaxToCode {
1400
1402
  this.writeParameterList(node.parameterClause.parameterList);
1401
1403
  this.writeToken(node.parameterClause.closeSquareBracketToken);
1402
1404
  this.writeTypeAnnotation(node.typeAnnotation, false);
1403
- if (node.body !== void 0) {
1404
- this.writeDeclarationBody(node.body);
1405
+ if (node.block !== void 0) {
1406
+ this.writeDeclarationBody(node.block);
1405
1407
  }
1406
1408
  }
1407
1409
  writeTypeIndexedSetterDeclaration(node) {
@@ -1412,8 +1414,8 @@ var SyntaxToCode = class _SyntaxToCode {
1412
1414
  this.writeToken(node.parameterClause.openSquareBracketToken);
1413
1415
  this.writeParameterList(node.parameterClause.parameterList);
1414
1416
  this.writeToken(node.parameterClause.closeSquareBracketToken);
1415
- if (node.body !== void 0) {
1416
- this.writeDeclarationBody(node.body);
1417
+ if (node.block !== void 0) {
1418
+ this.writeDeclarationBody(node.block);
1417
1419
  }
1418
1420
  }
1419
1421
  writeTypeDereferencedVariableGetterDeclaration(node) {
@@ -1423,8 +1425,8 @@ var SyntaxToCode = class _SyntaxToCode {
1423
1425
  this.writeWhitespace();
1424
1426
  this.writeToken(node.caretToken);
1425
1427
  this.writeTypeAnnotation(node.typeAnnotation, false);
1426
- if (node.body !== void 0) {
1427
- this.writeDeclarationBody(node.body);
1428
+ if (node.block !== void 0) {
1429
+ this.writeDeclarationBody(node.block);
1428
1430
  }
1429
1431
  }
1430
1432
  writeTypeDereferencedVariableSetterDeclaration(node) {
@@ -1433,8 +1435,8 @@ var SyntaxToCode = class _SyntaxToCode {
1433
1435
  this.writeKeyword(node.setKeyword);
1434
1436
  this.writeWhitespace();
1435
1437
  this.writeToken(node.caretToken);
1436
- if (node.body !== void 0) {
1437
- this.writeDeclarationBody(node.body);
1438
+ if (node.block !== void 0) {
1439
+ this.writeDeclarationBody(node.block);
1438
1440
  }
1439
1441
  }
1440
1442
  writeVariantDeclaration(node) {
@@ -1995,17 +1997,17 @@ var SyntaxToCode = class _SyntaxToCode {
1995
1997
  [55 /* TypeVariableGetterDeclaration */]: this.prototype.writeTypeVariableGetterDeclaration,
1996
1998
  [56 /* TypeVariableSetterDeclaration */]: this.prototype.writeTypeVariableSetterDeclaration,
1997
1999
  [93 /* StatementBlock */]: this.prototype.writeStatementBlock,
1998
- [132 /* QualifiedName */]: this.prototype.writeQualifiedName,
1999
- [139 /* VariantDeclaration */]: this.prototype.writeVariantDeclaration,
2000
- [140 /* TypeParameterDeclaration */]: this.prototype.writeTypeParameterDeclaration,
2001
- [141 /* ParameterDeclaration */]: this.prototype.writeParameterDeclaration,
2002
- [142 /* Argument */]: this.prototype.writeArgument,
2003
- [144 /* Tag */]: this.prototype.writeTag,
2004
- [146 /* Modifier */]: this.prototype.writeModifier,
2005
- [147 /* ParameterClause */]: this.prototype.writeParameterClause,
2006
- [148 /* ParameterList */]: this.prototype.writeParameterList,
2007
- [149 /* TypeArgumentClause */]: this.prototype.writeTypeArgumentClause,
2008
- [151 /* TypeParameterClause */]: this.prototype.writeTypeParameterClause,
2000
+ [133 /* QualifiedName */]: this.prototype.writeQualifiedName,
2001
+ [140 /* VariantDeclaration */]: this.prototype.writeVariantDeclaration,
2002
+ [141 /* TypeParameterDeclaration */]: this.prototype.writeTypeParameterDeclaration,
2003
+ [142 /* ParameterDeclaration */]: this.prototype.writeParameterDeclaration,
2004
+ [143 /* Argument */]: this.prototype.writeArgument,
2005
+ [145 /* Tag */]: this.prototype.writeTag,
2006
+ [147 /* Modifier */]: this.prototype.writeModifier,
2007
+ [148 /* ParameterClause */]: this.prototype.writeParameterClause,
2008
+ [149 /* ParameterList */]: this.prototype.writeParameterList,
2009
+ [150 /* TypeArgumentClause */]: this.prototype.writeTypeArgumentClause,
2010
+ [152 /* TypeParameterClause */]: this.prototype.writeTypeParameterClause,
2009
2011
  [17 /* AnonymousMethodTypeDeclaration */]: this.prototype.writeAnonymousMethodTypeDeclaration,
2010
2012
  [18 /* AnonymousStructuredTypeDeclaration */]: this.prototype.writeAnonymousStructuredTypeDeclaration,
2011
2013
  [19 /* AnonymousVariantTypeDeclaration */]: this.prototype.writeAnonymousVariantTypeDeclaration,
@@ -2074,39 +2076,40 @@ var SyntaxToCode = class _SyntaxToCode {
2074
2076
  [107 /* IfStatement */]: this.prototype.writeNodeDefault,
2075
2077
  [108 /* ElseIfClauseList */]: this.prototype.writeNodeDefault,
2076
2078
  [109 /* ElseIfClause */]: this.prototype.writeNodeDefault,
2077
- [110 /* InvalidStatement */]: this.prototype.writeNodeDefault,
2078
- [111 /* NestedMethodDeclarationStatement */]: this.prototype.writeNodeDefault,
2079
- [112 /* LocalVariableDeclarationStatement */]: this.prototype.writeNodeDefault,
2080
- [113 /* LoopStatement */]: this.prototype.writeNodeDefault,
2081
- [114 /* ReturnStatement */]: this.prototype.writeNodeDefault,
2082
- [115 /* CaseClauseList */]: this.prototype.writeNodeDefault,
2083
- [116 /* SwitchStatement */]: this.prototype.writeNodeDefault,
2084
- [117 /* MatchExpressionList */]: this.prototype.writeNodeDefault,
2085
- [118 /* SwitchStatementCaseClause */]: this.prototype.writeNodeDefault,
2086
- [119 /* WhileStatement */]: this.prototype.writeNodeDefault,
2087
- [120 /* YieldStatement */]: this.prototype.writeNodeDefault,
2088
- [121 /* TranslationParameterList */]: this.prototype.writeNodeDefault,
2089
- [122 /* TranslationParameterClause */]: this.prototype.writeTranslationParameterClause,
2090
- [123 /* ConstructorTranslation */]: this.prototype.writeConstructorTranslation,
2091
- [124 /* IndexerTranslationParameterClause */]: this.prototype.writeIndexerTranslationParameterClause,
2092
- [125 /* IndexerTranslation */]: this.prototype.writeIndexerTranslation,
2093
- [126 /* TranslationTypeParameterList */]: this.prototype.writeNodeDefault,
2094
- [127 /* TranslationTypeParameterClause */]: this.prototype.writeTranslationTypeParameterClause,
2095
- [128 /* PackageMethodTranslation */]: this.prototype.writePackageMethodTranslation,
2096
- [129 /* TypeMethodTranslation */]: this.prototype.writeTypeMethodTranslation,
2097
- [130 /* MethodTypeTranslation */]: this.prototype.writeMethodTypeTranslation,
2098
- [131 /* PackageImportTranslation */]: this.prototype.writePackageImportTranslation,
2099
- [133 /* PackageVariableTranslation */]: this.prototype.writePackageVariableTranslation,
2100
- [134 /* TypeVariableOrVariantTranslation */]: this.prototype.writeTypeVariableOrVariantTranslation,
2101
- [135 /* TypeMemberTranslationList */]: this.prototype.writeNodeDefault,
2102
- [136 /* TypeTranslation */]: this.prototype.writeTypeTranslation,
2103
- [137 /* TextLiteralTranslation */]: this.prototype.writeNodeDefault,
2104
- [138 /* TextTemplateLiteralTranslation */]: this.prototype.writeNodeDefault,
2105
- [143 /* TagList */]: this.prototype.writeNodeDefault,
2106
- [145 /* ModifierList */]: this.prototype.writeNodeDefault,
2107
- [150 /* TypeArgumentList */]: this.prototype.writeNodeDefault,
2108
- [152 /* TypeParameterList */]: this.prototype.writeNodeDefault,
2109
- [153 /* TypeAnnotation */]: this.prototype.writeNodeDefault
2079
+ [110 /* ElseClause */]: this.prototype.writeNodeDefault,
2080
+ [111 /* InvalidStatement */]: this.prototype.writeNodeDefault,
2081
+ [112 /* NestedMethodDeclarationStatement */]: this.prototype.writeNodeDefault,
2082
+ [113 /* LocalVariableDeclarationStatement */]: this.prototype.writeNodeDefault,
2083
+ [114 /* LoopStatement */]: this.prototype.writeNodeDefault,
2084
+ [115 /* ReturnStatement */]: this.prototype.writeNodeDefault,
2085
+ [116 /* CaseClauseList */]: this.prototype.writeNodeDefault,
2086
+ [117 /* SwitchStatement */]: this.prototype.writeNodeDefault,
2087
+ [118 /* MatchExpressionList */]: this.prototype.writeNodeDefault,
2088
+ [119 /* CaseClause */]: this.prototype.writeNodeDefault,
2089
+ [120 /* WhileStatement */]: this.prototype.writeNodeDefault,
2090
+ [121 /* YieldStatement */]: this.prototype.writeNodeDefault,
2091
+ [122 /* TranslationParameterList */]: this.prototype.writeNodeDefault,
2092
+ [123 /* TranslationParameterClause */]: this.prototype.writeTranslationParameterClause,
2093
+ [124 /* ConstructorTranslation */]: this.prototype.writeConstructorTranslation,
2094
+ [125 /* IndexerTranslationParameterClause */]: this.prototype.writeIndexerTranslationParameterClause,
2095
+ [126 /* IndexerTranslation */]: this.prototype.writeIndexerTranslation,
2096
+ [127 /* TranslationTypeParameterList */]: this.prototype.writeNodeDefault,
2097
+ [128 /* TranslationTypeParameterClause */]: this.prototype.writeTranslationTypeParameterClause,
2098
+ [129 /* PackageMethodTranslation */]: this.prototype.writePackageMethodTranslation,
2099
+ [130 /* TypeMethodTranslation */]: this.prototype.writeTypeMethodTranslation,
2100
+ [131 /* MethodTypeTranslation */]: this.prototype.writeMethodTypeTranslation,
2101
+ [132 /* PackageImportTranslation */]: this.prototype.writePackageImportTranslation,
2102
+ [134 /* PackageVariableTranslation */]: this.prototype.writePackageVariableTranslation,
2103
+ [135 /* TypeVariableOrVariantTranslation */]: this.prototype.writeTypeVariableOrVariantTranslation,
2104
+ [136 /* TypeMemberTranslationList */]: this.prototype.writeNodeDefault,
2105
+ [137 /* TypeTranslation */]: this.prototype.writeTypeTranslation,
2106
+ [138 /* TextLiteralTranslation */]: this.prototype.writeNodeDefault,
2107
+ [139 /* TextTemplateLiteralTranslation */]: this.prototype.writeNodeDefault,
2108
+ [144 /* TagList */]: this.prototype.writeNodeDefault,
2109
+ [146 /* ModifierList */]: this.prototype.writeNodeDefault,
2110
+ [151 /* TypeArgumentList */]: this.prototype.writeNodeDefault,
2111
+ [153 /* TypeParameterList */]: this.prototype.writeNodeDefault,
2112
+ [154 /* TypeAnnotation */]: this.prototype.writeNodeDefault
2110
2113
  };
2111
2114
  return writeFunctions;
2112
2115
  }
@@ -2292,7 +2295,7 @@ var TranslationsGenerationService = class {
2292
2295
  return void 0;
2293
2296
  }
2294
2297
  let result;
2295
- if (tokenOrKeyword.isToken(63 /* Identifier */) && tokenOrKeyword.parent.kind === 136 /* TypeTranslation */ && tokenOrKeyword.value === tokenOrKeyword.parent.sourceName) {
2298
+ if (tokenOrKeyword.isToken(63 /* Identifier */) && tokenOrKeyword.parent.kind === 137 /* TypeTranslation */ && tokenOrKeyword.value === tokenOrKeyword.parent.sourceName) {
2296
2299
  const translationPackage = analyzer.getAnalyzedTranslationPackageIfTargetResolved(sourceFile.package);
2297
2300
  if (translationPackage !== void 0) {
2298
2301
  const generator = new TranslationsGenerator(
@@ -2338,7 +2341,7 @@ var TranslationsGenerationService = class {
2338
2341
  return false;
2339
2342
  }
2340
2343
  const generator = new TranslationsGenerator(analyzer, sourceFile, translationPackage, sourceFile.package.dialect);
2341
- return Query.from(tokenOrKeyword.parent.translationList.translationDeclarations).filter((t) => t.kind === 136 /* TypeTranslation */).mapAndFilter((t) => translationPackage.getTypeTranslationTarget(t).target).any((t) => generator.collectNotTranslatedTypeMembers(t).length > 0);
2344
+ return Query.from(tokenOrKeyword.parent.translationList.translationDeclarations).filter((t) => t.kind === 137 /* TypeTranslation */).mapAndFilter((t) => translationPackage.getTypeTranslationTarget(t).target).any((t) => generator.collectNotTranslatedTypeMembers(t).length > 0);
2342
2345
  }
2343
2346
  };
2344
2347
  var TranslationsGenerator = class _TranslationsGenerator {
@@ -2365,7 +2368,7 @@ var TranslationsGenerator = class _TranslationsGenerator {
2365
2368
  };
2366
2369
  const memberTranslationsCode = Query.from(memberEntities).mapAndFilter((m) => this.createPackageMemberTranslationNode(m)).uniqueWithComparator(compareNodes).map((n) => {
2367
2370
  const code = new SyntaxToCode(n, syntaxToCodeOptions).convert();
2368
- if (n.kind === 136 /* TypeTranslation */) {
2371
+ if (n.kind === 137 /* TypeTranslation */) {
2369
2372
  const startOffset = Math.max(code.indexOf(newLine), 0);
2370
2373
  return this.addNewLineBeforeArrowsInTranslation(
2371
2374
  code,
@@ -2397,7 +2400,7 @@ var TranslationsGenerator = class _TranslationsGenerator {
2397
2400
  generateMissingTranslationsForPartiallyTranslatedTypes(translationsDeclaration) {
2398
2401
  const result = new Array();
2399
2402
  for (const translation of translationsDeclaration.translationList.translationDeclarations) {
2400
- if (translation.kind === 136 /* TypeTranslation */) {
2403
+ if (translation.kind === 137 /* TypeTranslation */) {
2401
2404
  const edits = this.generateMissingTypeMemberTranslations(translation);
2402
2405
  if (edits !== void 0) {
2403
2406
  result.push(...edits);
@@ -2494,13 +2497,13 @@ var TranslationsGenerator = class _TranslationsGenerator {
2494
2497
  }
2495
2498
  detectIndentationStepForTypeMemberTranslations(node) {
2496
2499
  let indentationStepSize;
2497
- if (node.kind === 136 /* TypeTranslation */) {
2500
+ if (node.kind === 137 /* TypeTranslation */) {
2498
2501
  indentationStepSize = tryDetectIndentationStepSizeUsingTypeTranslation(node, this._sourceFile);
2499
2502
  }
2500
2503
  if (indentationStepSize === void 0) {
2501
2504
  const translationsDeclarations = node.kind === 21 /* TranslationsDeclaration */ ? node : node.parent.parent;
2502
2505
  for (const member of translationsDeclarations.translationList.translationDeclarations) {
2503
- if (member.kind === 136 /* TypeTranslation */) {
2506
+ if (member.kind === 137 /* TypeTranslation */) {
2504
2507
  indentationStepSize = tryDetectIndentationStepSizeUsingTypeTranslation(member, this._sourceFile);
2505
2508
  if (indentationStepSize !== void 0) {
2506
2509
  break;
@@ -2682,7 +2685,7 @@ var CodeActionsService = class {
2682
2685
  }
2683
2686
  const result = new Array();
2684
2687
  const diagnosticCodeSet = new Set(diagnosticCodes);
2685
- if (diagnosticCodeSet.has(104 /* TheFollowingDeclarationsAreNotTranslated0 */) || diagnosticCodeSet.has(105 /* TheFollowingDeclarationAreNotTranslated0And1More */)) {
2688
+ if (diagnosticCodeSet.has(109 /* TheFollowingDeclarationsAreNotTranslated0 */) || diagnosticCodeSet.has(110 /* TheFollowingDeclarationAreNotTranslated0And1More */)) {
2686
2689
  const data = { onlyTypeMembers: false };
2687
2690
  result.push(CodeAction.unresolved(
2688
2691
  "\u0421\u0433\u0435\u043D\u0435\u0440\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u043D\u0435\u0434\u043E\u0441\u0442\u0430\u044E\u0449\u0438\u0435 \u043F\u0435\u0440\u0435\u0432\u043E\u0434\u044B.",
@@ -2787,7 +2790,7 @@ var SignatureForNode = class _SignatureForNode {
2787
2790
  return _SignatureForNode.getSignaturesForAutotypeCallExpression(analyzer, node);
2788
2791
  case 71 /* IndexedAccessExpression */:
2789
2792
  return _SignatureForNode.getSignaturesForIndexedAccessExpression(analyzer, node);
2790
- case 144 /* Tag */:
2793
+ case 145 /* Tag */:
2791
2794
  return _SignatureForNode.getSignaturesForTag(analyzer, node);
2792
2795
  default:
2793
2796
  Debug.never(node);
@@ -3222,7 +3225,7 @@ var CompletionService = class {
3222
3225
  typeExtensionLookup
3223
3226
  );
3224
3227
  }
3225
- if (tokenOrKeyword.isToken(26 /* Dot */) && tokenOrKeyword.parent.kind === 132 /* QualifiedName */ && tokenOrKeyword.parent.parent.kind === 10 /* NamedTypeSpecifier */) {
3228
+ if (tokenOrKeyword.isToken(26 /* Dot */) && tokenOrKeyword.parent.kind === 133 /* QualifiedName */ && tokenOrKeyword.parent.parent.kind === 10 /* NamedTypeSpecifier */) {
3226
3229
  const namedTypeSpecifier = tokenOrKeyword.parent.parent;
3227
3230
  const resolutionResult = this._analyzer.resolveNamedTypeSpecifier(namedTypeSpecifier);
3228
3231
  const segmentIndex = Math.floor(
@@ -3264,7 +3267,7 @@ var CompletionService = class {
3264
3267
  }
3265
3268
  return { kind: "none" };
3266
3269
  }
3267
- if (tokenOrKeyword.isToken(26 /* Dot */) && tokenOrKeyword.parent.kind === 132 /* QualifiedName */ && tokenOrKeyword.parent.parent.kind === 144 /* Tag */) {
3270
+ if (tokenOrKeyword.isToken(26 /* Dot */) && tokenOrKeyword.parent.kind === 133 /* QualifiedName */ && tokenOrKeyword.parent.parent.kind === 145 /* Tag */) {
3268
3271
  const tag = tokenOrKeyword.parent.parent;
3269
3272
  const resolutionResult = this._analyzer.resolveTag(tag);
3270
3273
  const segmentIndex = Math.floor(
@@ -3357,17 +3360,17 @@ var CompletionService = class {
3357
3360
  translationKind = 0 /* Any */;
3358
3361
  hasPrecedingKeyword = false;
3359
3362
  }
3360
- if (tokenOrKeyword.isKeyword(18 /* Import */) && tokenOrKeyword.parent.kind === 131 /* PackageImportTranslation */) {
3363
+ if (tokenOrKeyword.isKeyword(18 /* Import */) && tokenOrKeyword.parent.kind === 132 /* PackageImportTranslation */) {
3361
3364
  translationsDeclaration = tokenOrKeyword.parent.parent.parent;
3362
3365
  translationKind = 1 /* PackageImport */;
3363
3366
  hasPrecedingKeyword = true;
3364
3367
  }
3365
- if (tokenOrKeyword.isKeyword(16 /* Type */) && (tokenOrKeyword.parent.kind === 136 /* TypeTranslation */ || tokenOrKeyword.parent.kind === 130 /* MethodTypeTranslation */)) {
3368
+ if (tokenOrKeyword.isKeyword(16 /* Type */) && (tokenOrKeyword.parent.kind === 137 /* TypeTranslation */ || tokenOrKeyword.parent.kind === 131 /* MethodTypeTranslation */)) {
3366
3369
  translationsDeclaration = tokenOrKeyword.parent.parent.parent;
3367
3370
  translationKind = 3 /* Type */;
3368
3371
  hasPrecedingKeyword = true;
3369
3372
  }
3370
- if (tokenOrKeyword.isKeyword(12 /* Function */) && tokenOrKeyword.parent.kind === 128 /* PackageMethodTranslation */) {
3373
+ if (tokenOrKeyword.isKeyword(12 /* Function */) && tokenOrKeyword.parent.kind === 129 /* PackageMethodTranslation */) {
3371
3374
  translationsDeclaration = tokenOrKeyword.parent.parent.parent;
3372
3375
  translationKind = 2 /* Method */;
3373
3376
  hasPrecedingKeyword = true;
@@ -3387,9 +3390,9 @@ var CompletionService = class {
3387
3390
  hasPrecedingKeyword
3388
3391
  );
3389
3392
  }
3390
- if (tokenOrKeyword.isToken(26 /* Dot */) && tokenOrKeyword.parent.kind === 132 /* QualifiedName */) {
3393
+ if (tokenOrKeyword.isToken(26 /* Dot */) && tokenOrKeyword.parent.kind === 133 /* QualifiedName */) {
3391
3394
  const qualifiedName = tokenOrKeyword.parent;
3392
- if (qualifiedName.parent.kind === 131 /* PackageImportTranslation */ && qualifiedName === qualifiedName.parent.sourceName) {
3395
+ if (qualifiedName.parent.kind === 132 /* PackageImportTranslation */ && qualifiedName === qualifiedName.parent.sourceName) {
3393
3396
  const precedingSegmentNames = qualifiedName.qualifiers.takeWhile((s) => s.rangeStart < tokenOrKeyword.value.rangeStart).map((p) => this._analyzer.createNameFromIdentifier(p)).toArray();
3394
3397
  const sourceLocale = translationPackage.getTranslatedPackage().getLocale();
3395
3398
  return new PackageImportCompletionContext(precedingSegmentNames, { sourceLocale });
@@ -3414,12 +3417,12 @@ var CompletionService = class {
3414
3417
  translationKind = 0 /* Any */;
3415
3418
  hasPrecedingKeyword = false;
3416
3419
  }
3417
- if (tokenOrKeyword.isKeyword(12 /* Function */) && tokenOrKeyword.parent.kind === 129 /* TypeMethodTranslation */) {
3420
+ if (tokenOrKeyword.isKeyword(12 /* Function */) && tokenOrKeyword.parent.kind === 130 /* TypeMethodTranslation */) {
3418
3421
  typeTranslation = tokenOrKeyword.parent.parent.parent;
3419
3422
  translationKind = 1 /* Method */;
3420
3423
  hasPrecedingKeyword = true;
3421
3424
  }
3422
- if (tokenOrKeyword.isKeyword(29 /* Creation */) && tokenOrKeyword.parent.kind === 123 /* ConstructorTranslation */) {
3425
+ if (tokenOrKeyword.isKeyword(29 /* Creation */) && tokenOrKeyword.parent.kind === 124 /* ConstructorTranslation */) {
3423
3426
  typeTranslation = tokenOrKeyword.parent.parent.parent;
3424
3427
  translationKind = 3 /* Constructor */;
3425
3428
  hasPrecedingKeyword = true;
@@ -3459,7 +3462,7 @@ var CompletionService = class {
3459
3462
  role.argumentList.parent
3460
3463
  );
3461
3464
  break;
3462
- case 144 /* Tag */:
3465
+ case 145 /* Tag */:
3463
3466
  signatures = SignatureForNode.getSignaturesForTag(this._analyzer, role.argumentList.parent);
3464
3467
  valueArguments = ValueArgumentFactory.createValueArgumentsOfTag(role.argumentList.parent);
3465
3468
  break;
@@ -3601,7 +3604,7 @@ var CompletionService = class {
3601
3604
  kinds.add(29 /* Creation */).add(12 /* Function */).add(46 /* Destruction */).add(57 /* Get */).add(58 /* Set */);
3602
3605
  }
3603
3606
  if (syntaxContext.isStatementContext) {
3604
- kinds.add(7 /* Run */).add(33 /* For */).add(24 /* While */).add(25 /* Loop */).add(15 /* Return */).add(19 /* Error */).add(27 /* Yield */).add(31 /* BreakLoop */).add(32 /* ContinueLoop */).add(13 /* If */).add(43 /* Switch */).add(1 /* Let */).add(34 /* Const */).add(45 /* Dispose */).add(12 /* Function */).add(39 /* Async */);
3607
+ kinds.add(7 /* Run */).add(33 /* For */).add(24 /* While */).add(25 /* Loop */).add(15 /* Return */).add(19 /* Error */).add(27 /* Yield */).add(31 /* BreakLoop */).add(32 /* ContinueLoop */).add(13 /* If */).add(43 /* Switch */).add(1 /* Let */).add(34 /* Const */).add(45 /* Dispose */).add(8 /* Try */).add(12 /* Function */).add(39 /* Async */);
3605
3608
  }
3606
3609
  if (this.isFromKeywordContext(positionDescription)) {
3607
3610
  kinds.add(9 /* From */);
@@ -3627,8 +3630,11 @@ var CompletionService = class {
3627
3630
  if (this.isCaseKeywordContext(positionDescription, syntaxContext)) {
3628
3631
  kinds.add(44 /* Case */);
3629
3632
  }
3630
- if (this.isRunStatementAccessorListContext(positionDescription)) {
3631
- kinds.add(30 /* Catch */).add(20 /* Finally */);
3633
+ if (this.isCatchKeywordContext(positionDescription)) {
3634
+ kinds.add(30 /* Catch */);
3635
+ }
3636
+ if (this.isFinallyKeywordContext(positionDescription)) {
3637
+ kinds.add(20 /* Finally */);
3632
3638
  }
3633
3639
  if (this.isElseOrElseIfKeywordContext(positionDescription)) {
3634
3640
  kinds.add(10 /* Else */).add(11 /* ElseIf */);
@@ -3657,28 +3663,35 @@ var CompletionService = class {
3657
3663
  return false;
3658
3664
  }
3659
3665
  const tokenOrKeyword = positionDescription.tokenOrKeyword;
3660
- return tokenOrKeyword.isToken(20 /* CloseBrace */) && tokenOrKeyword.parent.kind === 93 /* StatementBlock */ && tokenOrKeyword.parent.parent.kind === 113 /* LoopStatement */;
3666
+ return tokenOrKeyword.isToken(20 /* CloseBrace */) && tokenOrKeyword.parent.kind === 93 /* StatementBlock */ && tokenOrKeyword.parent.parent.kind === 114 /* LoopStatement */;
3661
3667
  }
3662
3668
  isModifierLevelContext(positionDescription) {
3663
3669
  if (positionDescription.kind !== "after-token-or-keyword") {
3664
3670
  return false;
3665
3671
  }
3666
3672
  const tokenOrKeyword = positionDescription.tokenOrKeyword;
3667
- return tokenOrKeyword.isToken(44 /* OpenParenthesis */) && tokenOrKeyword.parent.kind === 146 /* Modifier */;
3673
+ return tokenOrKeyword.isToken(44 /* OpenParenthesis */) && tokenOrKeyword.parent.kind === 147 /* Modifier */;
3668
3674
  }
3669
3675
  isElseOrElseIfKeywordContext(positionDescription) {
3670
3676
  if (positionDescription.kind !== "after-token-or-keyword") {
3671
3677
  return false;
3672
3678
  }
3673
3679
  const tokenOrKeyword = positionDescription.tokenOrKeyword;
3674
- return tokenOrKeyword.isToken(20 /* CloseBrace */) && tokenOrKeyword.parent.kind === 93 /* StatementBlock */ && (tokenOrKeyword.parent.parent.kind === 107 /* IfStatement */ && tokenOrKeyword.parent === tokenOrKeyword.parent.parent.thenBlock || tokenOrKeyword.parent.parent.kind === 109 /* ElseIfClause */);
3680
+ return tokenOrKeyword.isToken(20 /* CloseBrace */) && tokenOrKeyword.parent.kind === 93 /* StatementBlock */ && (tokenOrKeyword.parent.parent.kind === 107 /* IfStatement */ && tokenOrKeyword.parent === tokenOrKeyword.parent.parent.block || tokenOrKeyword.parent.parent.kind === 109 /* ElseIfClause */);
3675
3681
  }
3676
- isRunStatementAccessorListContext(positionDescription) {
3682
+ isCatchKeywordContext(positionDescription) {
3677
3683
  if (positionDescription.kind !== "after-token-or-keyword") {
3678
3684
  return false;
3679
3685
  }
3680
3686
  const tokenOrKeyword = positionDescription.tokenOrKeyword;
3681
- return tokenOrKeyword.isToken(20 /* CloseBrace */) && tokenOrKeyword.parent.kind === 93 /* StatementBlock */ && (tokenOrKeyword.parent.parent.kind === 97 /* RunStatement */ || tokenOrKeyword.parent.parent.kind === 99 /* CatchClause */ || tokenOrKeyword.parent.parent.kind === 101 /* FinallyClause */);
3687
+ return tokenOrKeyword.isToken(20 /* CloseBrace */) && tokenOrKeyword.parent.kind === 93 /* StatementBlock */ && tokenOrKeyword.parent.parent.kind === 98 /* TryStatement */;
3688
+ }
3689
+ isFinallyKeywordContext(positionDescription) {
3690
+ if (positionDescription.kind !== "after-token-or-keyword") {
3691
+ return false;
3692
+ }
3693
+ const tokenOrKeyword = positionDescription.tokenOrKeyword;
3694
+ return tokenOrKeyword.isToken(20 /* CloseBrace */) && tokenOrKeyword.parent.kind === 93 /* StatementBlock */ && (tokenOrKeyword.parent.parent.kind === 98 /* TryStatement */ || tokenOrKeyword.parent.parent.kind === 99 /* CatchClause */);
3682
3695
  }
3683
3696
  isTypeKindCompletionContext(positionDescription) {
3684
3697
  return positionDescription.kind === "after-token-or-keyword" && positionDescription.tokenOrKeyword.isToken(57 /* Equals */) && NodeTypeUtils.isPackageTypeDeclaration(positionDescription.tokenOrKeyword.parent);
@@ -3695,10 +3708,10 @@ var CompletionService = class {
3695
3708
  return false;
3696
3709
  }
3697
3710
  const tokenOrKeyword = positionDescription.tokenOrKeyword;
3698
- if (tokenOrKeyword.isToken(20 /* CloseBrace */) && tokenOrKeyword.parent.kind === 93 /* StatementBlock */ && tokenOrKeyword.parent.parent.kind === 118 /* SwitchStatementCaseClause */) {
3711
+ if (tokenOrKeyword.isToken(20 /* CloseBrace */) && tokenOrKeyword.parent.kind === 93 /* StatementBlock */ && tokenOrKeyword.parent.parent.kind === 119 /* CaseClause */) {
3699
3712
  return true;
3700
3713
  }
3701
- if (syntaxContext.precedingExpression !== void 0 && syntaxContext.precedingExpression.parent.kind === 116 /* SwitchStatement */) {
3714
+ if (syntaxContext.precedingExpression !== void 0 && syntaxContext.precedingExpression.parent.kind === 117 /* SwitchStatement */) {
3702
3715
  return true;
3703
3716
  }
3704
3717
  return false;
@@ -4366,7 +4379,7 @@ function isInvalidNode(node) {
4366
4379
  switch (node.kind) {
4367
4380
  case 72 /* InvalidExpression */:
4368
4381
  case 43 /* InvalidPackageMemberDeclaration */:
4369
- case 110 /* InvalidStatement */:
4382
+ case 111 /* InvalidStatement */:
4370
4383
  case 57 /* InvalidTypeMemberDeclaration */:
4371
4384
  case 16 /* InvalidTypeSpecifier */:
4372
4385
  return true;
@@ -5186,7 +5199,7 @@ var SyntaxContextFactory = class {
5186
5199
  if (positionDescription.kind === "after-token-or-keyword") {
5187
5200
  isUnqualifiedTypeContext = this.isUnqualifiedTypeContext(positionDescription.tokenOrKeyword);
5188
5201
  }
5189
- const isUnqualifiedTagNameCompletionContext = positionDescription.kind === "after-token-or-keyword" && positionDescription.tokenOrKeyword.isToken(35 /* HashSign */) && positionDescription.tokenOrKeyword.parent.kind === 144 /* Tag */;
5202
+ const isUnqualifiedTagNameCompletionContext = positionDescription.kind === "after-token-or-keyword" && positionDescription.tokenOrKeyword.isToken(35 /* HashSign */) && positionDescription.tokenOrKeyword.parent.kind === 145 /* Tag */;
5190
5203
  let isTopLevelTranslationListContext;
5191
5204
  if (positionDescription.kind === "after-token-or-keyword") {
5192
5205
  isTopLevelTranslationListContext = this.isTopLevelTranslationListContext(positionDescription.tokenOrKeyword);
@@ -5228,15 +5241,15 @@ var SyntaxContextFactory = class {
5228
5241
  const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.initializer);
5229
5242
  return { isExpressionContext: { expressionRole }, isStatementContext: false };
5230
5243
  }
5231
- if (tokenOrKeyword.parent.kind === 141 /* ParameterDeclaration */) {
5244
+ if (tokenOrKeyword.parent.kind === 142 /* ParameterDeclaration */) {
5232
5245
  const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.defaultValue);
5233
5246
  return { isExpressionContext: { expressionRole }, isStatementContext: false };
5234
5247
  }
5235
- if (tokenOrKeyword.parent.kind === 142 /* Argument */) {
5248
+ if (tokenOrKeyword.parent.kind === 143 /* Argument */) {
5236
5249
  const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.value);
5237
5250
  return { isExpressionContext: { expressionRole }, isStatementContext: false };
5238
5251
  }
5239
- if (tokenOrKeyword.parent.kind === 139 /* VariantDeclaration */) {
5252
+ if (tokenOrKeyword.parent.kind === 140 /* VariantDeclaration */) {
5240
5253
  const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.value);
5241
5254
  return { isExpressionContext: { expressionRole }, isStatementContext: false };
5242
5255
  }
@@ -5292,7 +5305,7 @@ var SyntaxContextFactory = class {
5292
5305
  const expressionRole = new ExpressionRole_argument(tokenOrKeyword.parent.argumentList, 0);
5293
5306
  return { isExpressionContext: { expressionRole }, isStatementContext: false };
5294
5307
  }
5295
- if (tokenOrKeyword.parent.kind === 144 /* Tag */) {
5308
+ if (tokenOrKeyword.parent.kind === 145 /* Tag */) {
5296
5309
  const argumentList = tokenOrKeyword.parent.argumentList;
5297
5310
  if (argumentList !== void 0) {
5298
5311
  const expressionRole = new ExpressionRole_argument(argumentList, 0);
@@ -5323,7 +5336,7 @@ var SyntaxContextFactory = class {
5323
5336
  const expressionRole = new ExpressionRole_argument(argumentList, index);
5324
5337
  return { isExpressionContext: { expressionRole }, isStatementContext: false };
5325
5338
  }
5326
- if (tokenOrKeyword.parent.kind === 117 /* MatchExpressionList */) {
5339
+ if (tokenOrKeyword.parent.kind === 118 /* MatchExpressionList */) {
5327
5340
  const expressionRole = new ExpressionRole_matchListElement(tokenOrKeyword.parent.parent.parent.parent);
5328
5341
  return { isExpressionContext: { expressionRole }, isStatementContext: false };
5329
5342
  }
@@ -5332,15 +5345,15 @@ var SyntaxContextFactory = class {
5332
5345
  return { isExpressionContext: { expressionRole }, isStatementContext: false };
5333
5346
  }
5334
5347
  }
5335
- if (tokenOrKeyword.isKeyword(44 /* Case */) && tokenOrKeyword.parent.kind === 118 /* SwitchStatementCaseClause */) {
5348
+ if (tokenOrKeyword.isKeyword(44 /* Case */) && tokenOrKeyword.parent.kind === 119 /* CaseClause */) {
5336
5349
  const expressionRole = new ExpressionRole_matchListElement(tokenOrKeyword.parent.parent.parent);
5337
5350
  return { isExpressionContext: { expressionRole }, isStatementContext: false };
5338
5351
  }
5339
- if (tokenOrKeyword.isKeyword(15 /* Return */) && tokenOrKeyword.parent.kind === 114 /* ReturnStatement */) {
5352
+ if (tokenOrKeyword.isKeyword(15 /* Return */) && tokenOrKeyword.parent.kind === 115 /* ReturnStatement */) {
5340
5353
  const expressionRole = new ExpressionRole_returnedValue(tokenOrKeyword.parent);
5341
5354
  return { isExpressionContext: { expressionRole }, isStatementContext: false };
5342
5355
  }
5343
- if (tokenOrKeyword.isKeyword(43 /* Switch */) && tokenOrKeyword.parent.kind === 116 /* SwitchStatement */) {
5356
+ if (tokenOrKeyword.isKeyword(43 /* Switch */) && tokenOrKeyword.parent.kind === 117 /* SwitchStatement */) {
5344
5357
  const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.expression);
5345
5358
  return { isExpressionContext: { expressionRole }, isStatementContext: false };
5346
5359
  }
@@ -5356,15 +5369,15 @@ var SyntaxContextFactory = class {
5356
5369
  const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.enumeratedExpression);
5357
5370
  return { isExpressionContext: { expressionRole }, isStatementContext: false };
5358
5371
  }
5359
- if (tokenOrKeyword.isKeyword(24 /* While */) && tokenOrKeyword.parent.kind === 119 /* WhileStatement */) {
5372
+ if (tokenOrKeyword.isKeyword(24 /* While */) && tokenOrKeyword.parent.kind === 120 /* WhileStatement */) {
5360
5373
  const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.condition);
5361
5374
  return { isExpressionContext: { expressionRole }, isStatementContext: false };
5362
5375
  }
5363
- if (tokenOrKeyword.isKeyword(26 /* RepeatWhile */) && tokenOrKeyword.parent.kind === 113 /* LoopStatement */) {
5376
+ if (tokenOrKeyword.isKeyword(26 /* RepeatWhile */) && tokenOrKeyword.parent.kind === 114 /* LoopStatement */) {
5364
5377
  const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.condition);
5365
5378
  return { isExpressionContext: { expressionRole }, isStatementContext: false };
5366
5379
  }
5367
- if (tokenOrKeyword.isKeyword(27 /* Yield */) && tokenOrKeyword.parent.kind === 120 /* YieldStatement */) {
5380
+ if (tokenOrKeyword.isKeyword(27 /* Yield */) && tokenOrKeyword.parent.kind === 121 /* YieldStatement */) {
5368
5381
  const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.expression);
5369
5382
  return { isExpressionContext: { expressionRole }, isStatementContext: false };
5370
5383
  }
@@ -5406,10 +5419,10 @@ var SyntaxContextFactory = class {
5406
5419
  ) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 37 /* PackageVariableSetterDeclaration */)) {
5407
5420
  return true;
5408
5421
  }
5409
- if (tokenOrKeyword.isKeyword() && tokenOrKeyword.parent.kind === 146 /* Modifier */ && tokenOrKeyword.value === tokenOrKeyword.parent.value && tokenOrKeyword.parent.openParenthesisToken === void 0 && NodeTypeUtils.isPackageMemberDeclaration(tokenOrKeyword.parent.parent.parent)) {
5422
+ if (tokenOrKeyword.isKeyword() && tokenOrKeyword.parent.kind === 147 /* Modifier */ && tokenOrKeyword.value === tokenOrKeyword.parent.value && tokenOrKeyword.parent.openParenthesisToken === void 0 && NodeTypeUtils.isPackageMemberDeclaration(tokenOrKeyword.parent.parent.parent)) {
5410
5423
  return true;
5411
5424
  }
5412
- if (tokenOrKeyword.isToken(21 /* CloseParenthesis */) && tokenOrKeyword.parent.kind === 146 /* Modifier */ && NodeTypeUtils.isPackageMemberDeclaration(tokenOrKeyword.parent.parent.parent)) {
5425
+ if (tokenOrKeyword.isToken(21 /* CloseParenthesis */) && tokenOrKeyword.parent.kind === 147 /* Modifier */ && NodeTypeUtils.isPackageMemberDeclaration(tokenOrKeyword.parent.parent.parent)) {
5413
5426
  return true;
5414
5427
  }
5415
5428
  return false;
@@ -5430,13 +5443,13 @@ var SyntaxContextFactory = class {
5430
5443
  ) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(
5431
5444
  tokenOrKeyword,
5432
5445
  51 /* TypeDereferencedVariableSetterDeclaration */
5433
- ) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 52 /* TypeMethodDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 53 /* OperatorDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 45 /* TypeConstructorDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 46 /* TypeDestructorDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 139 /* VariantDeclaration */)) {
5446
+ ) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 52 /* TypeMethodDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 53 /* OperatorDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 45 /* TypeConstructorDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 46 /* TypeDestructorDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 140 /* VariantDeclaration */)) {
5434
5447
  return true;
5435
5448
  }
5436
- if (tokenOrKeyword.isKeyword() && tokenOrKeyword.parent.kind === 146 /* Modifier */ && tokenOrKeyword.value === tokenOrKeyword.parent.value && tokenOrKeyword.parent.openParenthesisToken === void 0 && NodeTypeUtils.isTypeMemberDeclaration(tokenOrKeyword.parent.parent.parent)) {
5449
+ if (tokenOrKeyword.isKeyword() && tokenOrKeyword.parent.kind === 147 /* Modifier */ && tokenOrKeyword.value === tokenOrKeyword.parent.value && tokenOrKeyword.parent.openParenthesisToken === void 0 && NodeTypeUtils.isTypeMemberDeclaration(tokenOrKeyword.parent.parent.parent)) {
5437
5450
  return true;
5438
5451
  }
5439
- if (tokenOrKeyword.isToken(21 /* CloseParenthesis */) && tokenOrKeyword.parent.kind === 146 /* Modifier */ && NodeTypeUtils.isTypeMemberDeclaration(tokenOrKeyword.parent.parent.parent)) {
5452
+ if (tokenOrKeyword.isToken(21 /* CloseParenthesis */) && tokenOrKeyword.parent.kind === 147 /* Modifier */ && NodeTypeUtils.isTypeMemberDeclaration(tokenOrKeyword.parent.parent.parent)) {
5440
5453
  return true;
5441
5454
  }
5442
5455
  return false;
@@ -5473,7 +5486,7 @@ var SyntaxContextFactory = class {
5473
5486
  return result;
5474
5487
  }
5475
5488
  static isUnqualifiedTypeContext(tokenOrKeyword) {
5476
- if (tokenOrKeyword.isToken(23 /* Colon */) && tokenOrKeyword.parent.kind === 153 /* TypeAnnotation */) {
5489
+ if (tokenOrKeyword.isToken(23 /* Colon */) && tokenOrKeyword.parent.kind === 154 /* TypeAnnotation */) {
5477
5490
  return { allowsAnonymousTypes: true };
5478
5491
  }
5479
5492
  if ((tokenOrKeyword.isKeyword(4 /* Object */) || tokenOrKeyword.isKeyword(5 /* PlainObject */) || tokenOrKeyword.isKeyword(3 /* Aspect */)) && tokenOrKeyword.parent.kind === 34 /* StructuredTypeDeclarationBody */) {
@@ -5482,16 +5495,16 @@ var SyntaxContextFactory = class {
5482
5495
  if (tokenOrKeyword.isKeyword(16 /* Type */) && (NodeTypeUtils.isPackageTypeDeclaration(tokenOrKeyword.parent) || tokenOrKeyword.parent.kind === 40 /* TypeExtensionDeclaration */)) {
5483
5496
  return { allowsAnonymousTypes: false };
5484
5497
  }
5485
- if (tokenOrKeyword.isToken(36 /* LessThan */) && tokenOrKeyword.parent.kind === 149 /* TypeArgumentClause */) {
5498
+ if (tokenOrKeyword.isToken(36 /* LessThan */) && tokenOrKeyword.parent.kind === 150 /* TypeArgumentClause */) {
5486
5499
  return { allowsAnonymousTypes: true };
5487
5500
  }
5488
- if (tokenOrKeyword.isToken(24 /* Comma */) && (tokenOrKeyword.parent.kind === 30 /* BaseTypeList */ || tokenOrKeyword.parent.kind === 150 /* TypeArgumentList */)) {
5489
- return { allowsAnonymousTypes: tokenOrKeyword.parent.kind === 150 /* TypeArgumentList */ };
5501
+ if (tokenOrKeyword.isToken(24 /* Comma */) && (tokenOrKeyword.parent.kind === 30 /* BaseTypeList */ || tokenOrKeyword.parent.kind === 151 /* TypeArgumentList */)) {
5502
+ return { allowsAnonymousTypes: tokenOrKeyword.parent.kind === 151 /* TypeArgumentList */ };
5490
5503
  }
5491
- if (tokenOrKeyword.isToken(35 /* HashSign */) && tokenOrKeyword.parent.kind === 144 /* Tag */) {
5504
+ if (tokenOrKeyword.isToken(35 /* HashSign */) && tokenOrKeyword.parent.kind === 145 /* Tag */) {
5492
5505
  return { allowsAnonymousTypes: false };
5493
5506
  }
5494
- if ((tokenOrKeyword.isToken(23 /* Colon */) || tokenOrKeyword.isToken(57 /* Equals */)) && tokenOrKeyword.parent.kind === 140 /* TypeParameterDeclaration */) {
5507
+ if ((tokenOrKeyword.isToken(23 /* Colon */) || tokenOrKeyword.isToken(57 /* Equals */)) && tokenOrKeyword.parent.kind === 141 /* TypeParameterDeclaration */) {
5495
5508
  return { allowsAnonymousTypes: false };
5496
5509
  }
5497
5510
  if (tokenOrKeyword.isToken(57 /* Equals */) && tokenOrKeyword.parent.kind === 22 /* PackageAliasTypeDeclaration */) {
@@ -5506,6 +5519,9 @@ var SyntaxContextFactory = class {
5506
5519
  if (tokenOrKeyword.isToken(17 /* Bar */) && tokenOrKeyword.parent.kind === 12 /* UnionTypeSpecifierTypeList */) {
5507
5520
  return { allowsAnonymousTypes: false };
5508
5521
  }
5522
+ if (tokenOrKeyword.isToken(44 /* OpenParenthesis */) && tokenOrKeyword.parent.kind === 13 /* ParenthesizedTypeSpecifier */) {
5523
+ return { allowsAnonymousTypes: true };
5524
+ }
5509
5525
  return void 0;
5510
5526
  }
5511
5527
  static isTopLevelTranslationListContext(tokenOrKeyword) {
@@ -5517,32 +5533,32 @@ var SyntaxContextFactory = class {
5517
5533
  }
5518
5534
  const packageImport = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(
5519
5535
  tokenOrKeyword,
5520
- 131 /* PackageImportTranslation */
5536
+ 132 /* PackageImportTranslation */
5521
5537
  );
5522
5538
  if (packageImport !== void 0) {
5523
5539
  return { translationsDeclaration: packageImport.parent.parent };
5524
5540
  }
5525
- const type = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(tokenOrKeyword, 136 /* TypeTranslation */);
5541
+ const type = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(tokenOrKeyword, 137 /* TypeTranslation */);
5526
5542
  if (type !== void 0) {
5527
5543
  return { translationsDeclaration: type.parent.parent };
5528
5544
  }
5529
5545
  const methodType = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(
5530
5546
  tokenOrKeyword,
5531
- 130 /* MethodTypeTranslation */
5547
+ 131 /* MethodTypeTranslation */
5532
5548
  );
5533
5549
  if (methodType !== void 0) {
5534
5550
  return { translationsDeclaration: methodType.parent.parent };
5535
5551
  }
5536
5552
  const variable = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(
5537
5553
  tokenOrKeyword,
5538
- 133 /* PackageVariableTranslation */
5554
+ 134 /* PackageVariableTranslation */
5539
5555
  );
5540
5556
  if (variable !== void 0) {
5541
5557
  return { translationsDeclaration: variable.parent.parent };
5542
5558
  }
5543
5559
  const method = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(
5544
5560
  tokenOrKeyword,
5545
- 128 /* PackageMethodTranslation */
5561
+ 129 /* PackageMethodTranslation */
5546
5562
  );
5547
5563
  if (method !== void 0) {
5548
5564
  return { translationsDeclaration: method.parent.parent };
@@ -5550,33 +5566,33 @@ var SyntaxContextFactory = class {
5550
5566
  return void 0;
5551
5567
  }
5552
5568
  static isTypeMemberTranslationListContext(tokenOrKeyword) {
5553
- if (tokenOrKeyword.isToken(51 /* Semicolon */) && tokenOrKeyword.parent.kind === 135 /* TypeMemberTranslationList */) {
5569
+ if (tokenOrKeyword.isToken(51 /* Semicolon */) && tokenOrKeyword.parent.kind === 136 /* TypeMemberTranslationList */) {
5554
5570
  return { typeTranslation: tokenOrKeyword.parent.parent };
5555
5571
  }
5556
- if (tokenOrKeyword.isToken(43 /* OpenBrace */) && tokenOrKeyword.parent.kind === 136 /* TypeTranslation */) {
5572
+ if (tokenOrKeyword.isToken(43 /* OpenBrace */) && tokenOrKeyword.parent.kind === 137 /* TypeTranslation */) {
5557
5573
  return { typeTranslation: tokenOrKeyword.parent };
5558
5574
  }
5559
- const indexer = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(tokenOrKeyword, 125 /* IndexerTranslation */);
5575
+ const indexer = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(tokenOrKeyword, 126 /* IndexerTranslation */);
5560
5576
  if (indexer !== void 0) {
5561
5577
  return { typeTranslation: indexer.parent.parent };
5562
5578
  }
5563
5579
  const constructor = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(
5564
5580
  tokenOrKeyword,
5565
- 123 /* ConstructorTranslation */
5581
+ 124 /* ConstructorTranslation */
5566
5582
  );
5567
5583
  if (constructor !== void 0) {
5568
5584
  return { typeTranslation: constructor.parent.parent };
5569
5585
  }
5570
5586
  const variableOrVariant = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(
5571
5587
  tokenOrKeyword,
5572
- 134 /* TypeVariableOrVariantTranslation */
5588
+ 135 /* TypeVariableOrVariantTranslation */
5573
5589
  );
5574
5590
  if (variableOrVariant !== void 0) {
5575
5591
  return { typeTranslation: variableOrVariant.parent.parent };
5576
5592
  }
5577
5593
  const method = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(
5578
5594
  tokenOrKeyword,
5579
- 129 /* TypeMethodTranslation */
5595
+ 130 /* TypeMethodTranslation */
5580
5596
  );
5581
5597
  if (method !== void 0) {
5582
5598
  return { typeTranslation: method.parent.parent };
@@ -5724,11 +5740,11 @@ var NodeSemanticInfoService = class {
5724
5740
  let result;
5725
5741
  const parent = node.parent;
5726
5742
  switch (parent.kind) {
5727
- case 126 /* TranslationTypeParameterList */:
5743
+ case 127 /* TranslationTypeParameterList */:
5728
5744
  break;
5729
- case 121 /* TranslationParameterList */:
5745
+ case 122 /* TranslationParameterList */:
5730
5746
  break;
5731
- case 142 /* Argument */: {
5747
+ case 143 /* Argument */: {
5732
5748
  const respectiveParameter = analyzer.getRespectiveParameter(parent);
5733
5749
  if (respectiveParameter !== void 0) {
5734
5750
  const target = new SimpleWithLocalization(
@@ -5775,10 +5791,10 @@ var NodeSemanticInfoService = class {
5775
5791
  case 59 /* LocalVariableDeclaration */:
5776
5792
  result = new DefinitionNodeSemanticInfo(analyzer.entity.ofLocalVariableDeclaration(parent));
5777
5793
  break;
5778
- case 132 /* QualifiedName */:
5794
+ case 133 /* QualifiedName */:
5779
5795
  result = this.ofQualifiedNameQualifier(analyzer, parent, node, options6);
5780
5796
  break;
5781
- case 133 /* PackageVariableTranslation */: {
5797
+ case 134 /* PackageVariableTranslation */: {
5782
5798
  const translationPackage = this.getContainingTranslationPackage(analyzer, node);
5783
5799
  const getTargetResult = translationPackage?.getPackageVariableTranslationTarget(parent);
5784
5800
  if (translationPackage !== void 0 && getTargetResult?.target !== void 0) {
@@ -5798,7 +5814,7 @@ var NodeSemanticInfoService = class {
5798
5814
  }
5799
5815
  break;
5800
5816
  }
5801
- case 134 /* TypeVariableOrVariantTranslation */: {
5817
+ case 135 /* TypeVariableOrVariantTranslation */: {
5802
5818
  const translationPackage = this.getContainingTranslationPackage(analyzer, node);
5803
5819
  const getTargetsResult = translationPackage?.getTypeVariableOrVariantTranslationTargets(parent);
5804
5820
  if (translationPackage !== void 0 && isNonEmptyArray(getTargetsResult?.targets)) {
@@ -5822,7 +5838,7 @@ var NodeSemanticInfoService = class {
5822
5838
  }
5823
5839
  break;
5824
5840
  }
5825
- case 128 /* PackageMethodTranslation */: {
5841
+ case 129 /* PackageMethodTranslation */: {
5826
5842
  const translationPackage = this.getContainingTranslationPackage(analyzer, node);
5827
5843
  const getTargetsResult = translationPackage?.getPackageMethodTranslationTargets(parent);
5828
5844
  if (translationPackage !== void 0 && isNonEmptyArray(getTargetsResult?.targets)) {
@@ -5846,7 +5862,7 @@ var NodeSemanticInfoService = class {
5846
5862
  }
5847
5863
  break;
5848
5864
  }
5849
- case 129 /* TypeMethodTranslation */: {
5865
+ case 130 /* TypeMethodTranslation */: {
5850
5866
  const translationPackage = this.getContainingTranslationPackage(analyzer, node);
5851
5867
  const getTargetsResult = translationPackage?.getTypeMethodTranslationTargets(parent);
5852
5868
  if (translationPackage !== void 0 && isNonEmptyArray(getTargetsResult?.targets)) {
@@ -5870,7 +5886,7 @@ var NodeSemanticInfoService = class {
5870
5886
  }
5871
5887
  break;
5872
5888
  }
5873
- case 136 /* TypeTranslation */: {
5889
+ case 137 /* TypeTranslation */: {
5874
5890
  const translationPackage = this.getContainingTranslationPackage(analyzer, node);
5875
5891
  const getTargetResult = translationPackage?.getTypeTranslationTarget(parent);
5876
5892
  if (translationPackage !== void 0 && getTargetResult?.target !== void 0) {
@@ -5890,7 +5906,7 @@ var NodeSemanticInfoService = class {
5890
5906
  }
5891
5907
  break;
5892
5908
  }
5893
- case 130 /* MethodTypeTranslation */: {
5909
+ case 131 /* MethodTypeTranslation */: {
5894
5910
  const translationPackage = this.getContainingTranslationPackage(analyzer, node);
5895
5911
  const getTargetResult = translationPackage?.getMethodTypeTranslationTarget(parent);
5896
5912
  if (translationPackage !== void 0 && getTargetResult?.target !== void 0) {
@@ -5910,7 +5926,7 @@ var NodeSemanticInfoService = class {
5910
5926
  }
5911
5927
  break;
5912
5928
  }
5913
- case 141 /* ParameterDeclaration */:
5929
+ case 142 /* ParameterDeclaration */:
5914
5930
  result = new DefinitionNodeSemanticInfo(analyzer.entity.ofParameterDeclaration(parent));
5915
5931
  break;
5916
5932
  case 8 /* PackageImport */:
@@ -5931,10 +5947,10 @@ var NodeSemanticInfoService = class {
5931
5947
  case 54 /* TypeVariableDeclaration */:
5932
5948
  result = new DefinitionNodeSemanticInfo(analyzer.entity.ofTypeVariableDeclaration(parent));
5933
5949
  break;
5934
- case 140 /* TypeParameterDeclaration */:
5950
+ case 141 /* TypeParameterDeclaration */:
5935
5951
  result = new DefinitionNodeSemanticInfo(analyzer.entity.ofTypeParameterDeclaration(parent));
5936
5952
  break;
5937
- case 139 /* VariantDeclaration */:
5953
+ case 140 /* VariantDeclaration */:
5938
5954
  result = new DefinitionNodeSemanticInfo(analyzer.entity.ofVariantDeclaration(parent));
5939
5955
  break;
5940
5956
  case 36 /* PackageVariableGetterDeclaration */:
@@ -5958,25 +5974,40 @@ var NodeSemanticInfoService = class {
5958
5974
  const meaning = analyzer.resolvePropertyAccessExpression(node).meaning;
5959
5975
  switch (meaning.kind) {
5960
5976
  case "instance-variable-access": {
5977
+ let narrowedType;
5978
+ if (isNarrowableReferenceExpression(node)) {
5979
+ narrowedType = analyzer.type.ofExpression(node);
5980
+ }
5961
5981
  const target = new SimpleWithLocalization(new TypeVariableReferenceTarget(
5962
5982
  meaning.variable.value,
5963
- meaning.accessKind
5983
+ meaning.accessKind,
5984
+ narrowedType
5964
5985
  ), meaning.variable.localization);
5965
5986
  result = new ReferenceNodeSemanticInfo([target], false);
5966
5987
  break;
5967
5988
  }
5968
5989
  case "static-variable-access": {
5990
+ let narrowedType;
5991
+ if (isNarrowableReferenceExpression(node)) {
5992
+ narrowedType = analyzer.type.ofExpression(node);
5993
+ }
5969
5994
  const target = new SimpleWithLocalization(new TypeVariableReferenceTarget(
5970
5995
  meaning.variable.value,
5971
- meaning.accessKind
5996
+ meaning.accessKind,
5997
+ narrowedType
5972
5998
  ), meaning.variable.localization);
5973
5999
  result = new ReferenceNodeSemanticInfo([target], false);
5974
6000
  break;
5975
6001
  }
5976
6002
  case "package-variable-access": {
6003
+ let narrowedType;
6004
+ if (isNarrowableReferenceExpression(node)) {
6005
+ narrowedType = analyzer.type.ofExpression(node);
6006
+ }
5977
6007
  const target = new SimpleWithLocalization(new EntityReferenceTarget(
5978
6008
  meaning.variable.value,
5979
- meaning.accessKind
6009
+ meaning.accessKind,
6010
+ narrowedType
5980
6011
  ), meaning.variable.localization);
5981
6012
  result = new ReferenceNodeSemanticInfo([target], false);
5982
6013
  break;
@@ -6045,10 +6076,10 @@ var NodeSemanticInfoService = class {
6045
6076
  switch (node.parent.kind) {
6046
6077
  case 10 /* NamedTypeSpecifier */:
6047
6078
  return this.ofNamedTypeSpecifierNameQualifier(analyzer, node.parent, qualifier, options6);
6048
- case 144 /* Tag */:
6079
+ case 145 /* Tag */:
6049
6080
  return this.ofTagNameQualifier(analyzer, node.parent, qualifier, options6);
6050
6081
  case 42 /* ExtendedTypeClause */:
6051
- case 131 /* PackageImportTranslation */:
6082
+ case 132 /* PackageImportTranslation */:
6052
6083
  return void 0;
6053
6084
  default:
6054
6085
  Debug.never(node.parent);
@@ -6198,16 +6229,20 @@ var NodeSemanticInfoService = class {
6198
6229
  break;
6199
6230
  }
6200
6231
  case "variable-access": {
6232
+ let narrowedType;
6233
+ if (isNarrowableReferenceExpression(node)) {
6234
+ narrowedType = analyzer.type.ofExpression(node);
6235
+ }
6201
6236
  const variable = meaning.variable;
6202
6237
  if (variable.value.kind === "entity") {
6203
6238
  const target = new SimpleWithLocalization(
6204
- new EntityReferenceTarget(variable.value.value, meaning.accessKind),
6239
+ new EntityReferenceTarget(variable.value.value, meaning.accessKind, narrowedType),
6205
6240
  variable.localization
6206
6241
  );
6207
6242
  result = new ReferenceNodeSemanticInfo([target], false);
6208
6243
  } else if (variable.value.kind === "type-member") {
6209
6244
  const target = new SimpleWithLocalization(
6210
- new TypeVariableReferenceTarget(variable.value.value, meaning.accessKind),
6245
+ new TypeVariableReferenceTarget(variable.value.value, meaning.accessKind, narrowedType),
6211
6246
  variable.localization
6212
6247
  );
6213
6248
  result = new ReferenceNodeSemanticInfo([target], false);
@@ -6412,8 +6447,9 @@ var NodeSemanticInfoService = class {
6412
6447
  }
6413
6448
  case "object-access": {
6414
6449
  const locale = TreeQuery.fromNode(node).packageEntity(analyzer).getLocale();
6450
+ const type = analyzer.type.ofExpression(node);
6415
6451
  const target = new SimpleWithLocalization(
6416
- new TypeContextReferenceTarget(meaning.type, "object"),
6452
+ new TypeContextReferenceTarget(type, "object"),
6417
6453
  new Localization.Original(locale)
6418
6454
  );
6419
6455
  result = new ReferenceNodeSemanticInfo([target], false);
@@ -6625,16 +6661,18 @@ var ReferenceNodeSemanticInfo = class {
6625
6661
  }
6626
6662
  };
6627
6663
  var EntityReferenceTarget = class {
6628
- constructor(entity, accessKind) {
6664
+ constructor(entity, accessKind, narrowedType) {
6629
6665
  this.entity = entity;
6630
6666
  this.accessKind = accessKind;
6667
+ this.narrowedType = narrowedType;
6631
6668
  this.kind = "entity";
6632
6669
  }
6633
6670
  };
6634
6671
  var TypeVariableReferenceTarget = class {
6635
- constructor(variable, accessKind) {
6672
+ constructor(variable, accessKind, narrowedType) {
6636
6673
  this.variable = variable;
6637
6674
  this.accessKind = accessKind;
6675
+ this.narrowedType = narrowedType;
6638
6676
  this.kind = "type-variable";
6639
6677
  }
6640
6678
  };
@@ -6782,7 +6820,7 @@ function getEntitySourceLocations(analyzer, entity) {
6782
6820
  case 38 /* PackageVariantTypeDeclaration */:
6783
6821
  case 58 /* NestedMethodDeclaration */:
6784
6822
  case 52 /* TypeMethodDeclaration */:
6785
- case 140 /* TypeParameterDeclaration */:
6823
+ case 141 /* TypeParameterDeclaration */:
6786
6824
  case 53 /* OperatorDeclaration */:
6787
6825
  range = node.name.rangeWithoutTrivia;
6788
6826
  break;
@@ -7623,15 +7661,15 @@ var EvaluatableExpressionService = class {
7623
7661
  return { nameIdentifier: node.name };
7624
7662
  case 59 /* LocalVariableDeclaration */:
7625
7663
  return { nameIdentifier: node.name };
7626
- case 141 /* ParameterDeclaration */:
7664
+ case 142 /* ParameterDeclaration */:
7627
7665
  return { nameIdentifier: node.name };
7628
7666
  case 52 /* TypeMethodDeclaration */:
7629
7667
  return { nameIdentifier: node.name };
7630
7668
  case 54 /* TypeVariableDeclaration */:
7631
7669
  return { nameIdentifier: node.name };
7632
- case 140 /* TypeParameterDeclaration */:
7670
+ case 141 /* TypeParameterDeclaration */:
7633
7671
  return { nameIdentifier: node.name };
7634
- case 139 /* VariantDeclaration */:
7672
+ case 140 /* VariantDeclaration */:
7635
7673
  return { nameIdentifier: node.name };
7636
7674
  case 100 /* ErrorVariableDeclaration */:
7637
7675
  return { nameIdentifier: node.name };
@@ -7714,13 +7752,19 @@ var HoverService = class {
7714
7752
  );
7715
7753
  switch (semanticInfo.kind) {
7716
7754
  case "definition":
7717
- return this.createHoverForEntity(semanticInfo.entity, void 0, tokenOrKeyword.value.rangeWithoutTrivia);
7755
+ return this.createHoverForEntity(
7756
+ semanticInfo.entity,
7757
+ void 0,
7758
+ void 0,
7759
+ tokenOrKeyword.value.rangeWithoutTrivia
7760
+ );
7718
7761
  case "reference":
7719
7762
  return this.createHoverAtReference(semanticInfo, tokenOrKeyword.value.rangeWithoutTrivia);
7720
7763
  case "name-translation":
7721
7764
  return this.createHoverForEntity(
7722
7765
  semanticInfo.firstTarget,
7723
7766
  new Localization.Translated(semanticInfo.translation),
7767
+ void 0,
7724
7768
  tokenOrKeyword.value.rangeWithoutTrivia
7725
7769
  );
7726
7770
  case "default-switch-match":
@@ -7732,18 +7776,34 @@ var HoverService = class {
7732
7776
  Debug.never(semanticInfo);
7733
7777
  }
7734
7778
  }
7735
- createHoverForEntity(entity, localization, range) {
7736
- return new Hover(this._displayService.displayEntity(entity, localization), range);
7779
+ createHoverForEntity(entity, localization, narrowedType, range) {
7780
+ if (entity.kind === 0 /* Variable */) {
7781
+ localization ??= Localization.Original.ofEntity(entity);
7782
+ const declaration = new VariableDeclaration_entity(
7783
+ entity,
7784
+ localization,
7785
+ narrowedType
7786
+ );
7787
+ return new Hover(this._displayService.displayVariableDeclaration(declaration), range);
7788
+ } else {
7789
+ return new Hover(this._displayService.displayEntity(entity, localization), range);
7790
+ }
7737
7791
  }
7738
7792
  createHoverAtReference(reference, range) {
7739
7793
  const firstTarget = reference.firstTarget;
7740
7794
  switch (firstTarget.value.kind) {
7741
7795
  case "entity":
7742
- return this.createHoverForEntity(firstTarget.value.entity, firstTarget.localization, range);
7796
+ return this.createHoverForEntity(
7797
+ firstTarget.value.entity,
7798
+ firstTarget.localization,
7799
+ firstTarget.value.narrowedType,
7800
+ range
7801
+ );
7743
7802
  case "type-variable": {
7744
7803
  const declaration = new VariableDeclaration_typeMember(
7745
7804
  firstTarget.value.variable,
7746
- firstTarget.localization
7805
+ firstTarget.localization,
7806
+ firstTarget.value.narrowedType
7747
7807
  );
7748
7808
  return new Hover(this._displayService.displayVariableDeclaration(declaration), range);
7749
7809
  }
@@ -8046,7 +8106,7 @@ var SourceFileItemsService = class {
8046
8106
  );
8047
8107
  break;
8048
8108
  }
8049
- case 139 /* VariantDeclaration */: {
8109
+ case 140 /* VariantDeclaration */: {
8050
8110
  result.push(
8051
8111
  this.createItem(
8052
8112
  9 /* Variant */,
@@ -8058,7 +8118,7 @@ var SourceFileItemsService = class {
8058
8118
  );
8059
8119
  break;
8060
8120
  }
8061
- case 140 /* TypeParameterDeclaration */: {
8121
+ case 141 /* TypeParameterDeclaration */: {
8062
8122
  result.push(
8063
8123
  this.createItem(
8064
8124
  18 /* TypeParameter */,
@@ -8283,8 +8343,12 @@ var SelectionRangeService = class {
8283
8343
  let result = new SelectionRange(new Range(0, sourceFile.text.length), void 0);
8284
8344
  let nodeWithChildren = sourceFile.getSyntaxNode();
8285
8345
  while (true) {
8286
- const child = nodeWithChildren.children.find((c) => c !== void 0 && this.nodeContainsOffset(c, offset));
8346
+ const child = nodeWithChildren.children.find((c) => c !== void 0 && this.nodeContainsOffset(c, offset, false));
8287
8347
  if (child === void 0) {
8348
+ const trivia = getTriviaAtOffset(sourceFile.getSyntaxNode(), offset);
8349
+ if (trivia?.kind === 3 /* MultiLineComment */ || trivia?.kind === 2 /* SingleLineComment */) {
8350
+ result = new SelectionRange(trivia.range, result);
8351
+ }
8288
8352
  break;
8289
8353
  }
8290
8354
  if (!this.nodeShouldBeSkipped(child) && !child.rangeWithoutTrivia.equals(result.range)) {
@@ -8301,8 +8365,8 @@ var SelectionRangeService = class {
8301
8365
  }
8302
8366
  return result;
8303
8367
  }
8304
- nodeContainsOffset(node, offset) {
8305
- const range = node.rangeWithoutTrivia;
8368
+ nodeContainsOffset(node, offset, searchInTrivia) {
8369
+ const range = searchInTrivia ? node.rangeWithTrivia : node.rangeWithoutTrivia;
8306
8370
  if (node.kind === 0 /* Token */ && node.tokenKind === 63 /* Identifier */ || node.kind === 3 /* Keyword */) {
8307
8371
  return offset >= range.start && offset <= range.end;
8308
8372
  } else {
@@ -8321,7 +8385,7 @@ var SelectionRangeService = class {
8321
8385
  }
8322
8386
  }
8323
8387
  switch (node.kind) {
8324
- case 153 /* TypeAnnotation */:
8388
+ case 154 /* TypeAnnotation */:
8325
8389
  case 34 /* StructuredTypeDeclarationBody */:
8326
8390
  case 39 /* VariantTypeDeclarationBody */:
8327
8391
  case 23 /* AliasTypeDeclarationBody */:
@@ -8465,7 +8529,7 @@ var SemanticTokensService = class {
8465
8529
  ));
8466
8530
  }
8467
8531
  }
8468
- if (node.kind === 139 /* VariantDeclaration */) {
8532
+ if (node.kind === 140 /* VariantDeclaration */) {
8469
8533
  result.push(
8470
8534
  new SemanticToken(
8471
8535
  node.name.rangeWithoutTrivia,
@@ -8649,7 +8713,7 @@ var TypeParameterSignatureHelpProvider = class {
8649
8713
  }
8650
8714
  let node = token.parent;
8651
8715
  while (node !== void 0) {
8652
- if (node.kind === 149 /* TypeArgumentClause */ && this._offset >= node.lessThanToken.rangeWithoutTrivia.end && (node.greaterThanToken.rangeWithoutTrivia.isEmpty || this._offset <= node.greaterThanToken.rangeWithoutTrivia.start)) {
8716
+ if (node.kind === 150 /* TypeArgumentClause */ && this._offset >= node.lessThanToken.rangeWithoutTrivia.end && (node.greaterThanToken.rangeWithoutTrivia.isEmpty || this._offset <= node.greaterThanToken.rangeWithoutTrivia.start)) {
8653
8717
  const argumentIndex = this.getArgumentIndex(node.typeArgumentList, this._offset);
8654
8718
  const argumentCount = this.countArguments(node.typeArgumentList);
8655
8719
  return new NodeWithTypeArgumentsInfo(node.parent, argumentIndex, argumentCount);
@@ -8696,7 +8760,7 @@ var TypeParameterSignatureHelpProvider = class {
8696
8760
  return this.getSignaturesForNamedTypeSpecifier(node);
8697
8761
  case 89 /* GenericSpecializationExpression */:
8698
8762
  return this.getSignaturesForGenericSpecializationExpression(node);
8699
- case 144 /* Tag */:
8763
+ case 145 /* Tag */:
8700
8764
  return this.getSignaturesForTag(node);
8701
8765
  default:
8702
8766
  Debug.never(node);
@@ -9027,7 +9091,7 @@ var ValueParametersSignatureHelpProvider = class {
9027
9091
  }
9028
9092
  break;
9029
9093
  }
9030
- case 144 /* Tag */: {
9094
+ case 145 /* Tag */: {
9031
9095
  if (node.openParenthesisToken !== void 0 && this._offset >= node.openParenthesisToken.rangeWithoutTrivia.end && node.argumentList !== void 0 && (node.closeParenthesisToken === void 0 || node.closeParenthesisToken.rangeWithoutTrivia.isEmpty || this._offset <= node.closeParenthesisToken.rangeWithoutTrivia.start)) {
9032
9096
  const argumentIndex = this.getArgumentIndexInList(node.argumentList.elements, this._offset);
9033
9097
  const valueArguments = ValueArgumentFactory.createValueArgumentsOfTag(node);
@@ -13138,11 +13202,11 @@ var LanguageServer = class {
13138
13202
  Debug.never(diagnostic.data.kind);
13139
13203
  }
13140
13204
  let tags;
13141
- if ((diagnostic.data.flags & 1 /* Unused */) !== 0) {
13205
+ if ((diagnostic.data.flags & (1 /* Unused */ | 2 /* Unreachable */)) !== 0) {
13142
13206
  tags ??= [];
13143
13207
  tags.push(ls3.DiagnosticTag.Unnecessary);
13144
13208
  }
13145
- if ((diagnostic.data.flags & 2 /* Deprecated */) !== 0) {
13209
+ if ((diagnostic.data.flags & 4 /* Deprecated */) !== 0) {
13146
13210
  tags ??= [];
13147
13211
  tags.push(ls3.DiagnosticTag.Deprecated);
13148
13212
  }