@artel/artc 0.6.25226 → 0.6.25228

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.
Files changed (68) hide show
  1. package/build/Cli.js +3 -3
  2. package/build/api/Api.js +12 -56
  3. package/build/api/ApiNodeJS.js +3 -3
  4. package/build/api/ApiServices.js +204 -109
  5. package/build/{chunk-VRQPLLYS.js → chunk-5GSDYTF6.js} +6405 -5358
  6. package/build/{chunk-YNR2KYMJ.js → chunk-F5OW64UA.js} +3 -3
  7. package/build/{chunk-MHPX52MT.js → chunk-FHJJX7JY.js} +3 -3
  8. package/build/types/analysis/Analyzer.d.ts +32 -71
  9. package/build/types/analysis/AssignmentChecker.d.ts +11 -0
  10. package/build/types/analysis/CallExpressionMeaning.d.ts +2 -0
  11. package/build/types/analysis/DeclarationsUsageCounter.d.ts +8 -3
  12. package/build/types/analysis/DiagnosticCollector.d.ts +15 -5
  13. package/build/types/analysis/IdentifierExpressionMeaning.d.ts +6 -6
  14. package/build/types/analysis/IndexedAccessExpressionMeaning.d.ts +3 -3
  15. package/build/types/analysis/MemberAccessExpressionMeaning.d.ts +9 -9
  16. package/build/types/analysis/NamedTypeResolver.d.ts +3 -2
  17. package/build/types/analysis/NamedTypeSpecifierResolver.d.ts +3 -2
  18. package/build/types/analysis/NodeTypeUtils.d.ts +3 -2
  19. package/build/types/analysis/PackageMemberNameConflictsValidator.d.ts +24 -0
  20. package/build/types/analysis/SourceFileMembers.d.ts +6 -1
  21. package/build/types/analysis/SourcePackageMembersCreator.d.ts +2 -1
  22. package/build/types/analysis/TagMeaning.d.ts +3 -2
  23. package/build/types/analysis/TypeInferrer.d.ts +2 -0
  24. package/build/types/analysis/TypeMemberLookup.d.ts +11 -11
  25. package/build/types/analysis/TypeNarrower.d.ts +0 -69
  26. package/build/types/analysis/control-flow/GraphBuilder.d.ts +6 -2
  27. package/build/types/analysis/control-flow/NarrowableReference.d.ts +73 -0
  28. package/build/types/analysis/control-flow/Nodes.d.ts +9 -0
  29. package/build/types/analysis/control-flow/index.d.ts +1 -0
  30. package/build/types/analysis/semantic-context/Declarations.d.ts +117 -0
  31. package/build/types/analysis/semantic-context/FieldWithInitializerSemanticContext.d.ts +22 -0
  32. package/build/types/analysis/semantic-context/SemanticContext.d.ts +13 -0
  33. package/build/types/analysis/semantic-context/SemanticContextBase.d.ts +168 -0
  34. package/build/types/analysis/semantic-context/SemanticContextBasedEntityHidingMatcher.d.ts +14 -0
  35. package/build/types/analysis/semantic-context/SemanticContextBuilder.d.ts +84 -0
  36. package/build/types/analysis/semantic-context/SemanticContextValidatingNameConflicts.d.ts +45 -0
  37. package/build/types/analysis/semantic-context/SemanticContextWithParent.d.ts +9 -0
  38. package/build/types/analysis/semantic-context/SourceFileSemanticContext.d.ts +42 -0
  39. package/build/types/analysis/semantic-context/SpecialLocalDeclarationsBuilder.d.ts +23 -0
  40. package/build/types/analysis/semantic-context/SubprogramBodyAndParametersSemanticContext.d.ts +89 -0
  41. package/build/types/analysis/semantic-context/SubprogramSemanticContext.d.ts +114 -0
  42. package/build/types/analysis/semantic-context/TypeSemanticContext.d.ts +94 -0
  43. package/build/types/analysis/semantic-context/index.d.ts +10 -0
  44. package/build/types/api/Api.d.ts +3 -5
  45. package/build/types/common/Cached.d.ts +1 -0
  46. package/build/types/common/Errors.d.ts +2 -0
  47. package/build/types/common/Lazy.d.ts +4 -0
  48. package/build/types/common/Query.d.ts +2 -1
  49. package/build/types/common/WithDiagnostics.d.ts +4 -3
  50. package/build/types/common/index.d.ts +1 -0
  51. package/build/types/diagnostic/DiagnosticCode.d.ts +89 -68
  52. package/build/types/emitter/IrBuilder.d.ts +1 -1
  53. package/build/types/emitter/Transformer.d.ts +1 -1
  54. package/build/types/entities/FunctionEntity.d.ts +2 -2
  55. package/build/types/entities/VariableEntity.d.ts +48 -19
  56. package/build/types/entities/index.d.ts +4 -0
  57. package/build/types/services/DefinitionService.d.ts +3 -0
  58. package/build/types/tree/KeywordKind.d.ts +31 -30
  59. package/build/types/tree/NodeKind.d.ts +1 -1
  60. package/build/types/tree/green/Nodes.d.ts +33 -29
  61. package/build/types/tree/red/Nodes.d.ts +25 -24
  62. package/build/types/types/TypeFactory.d.ts +0 -2
  63. package/package.json +1 -1
  64. package/build/types/analysis/Lookup.d.ts +0 -28
  65. package/build/types/analysis/Scope.d.ts +0 -205
  66. package/build/types/analysis/SemanticContext.d.ts +0 -367
  67. package/build/types/analysis/SemanticContextBuilder.d.ts +0 -59
  68. package/build/types/analysis/StatementBlockScopeBuilder.d.ts +0 -26
@@ -10,7 +10,7 @@ import {
10
10
  WellKnownDeclarationsLoadError,
11
11
  __async,
12
12
  createTsInteropInputsForCompilation
13
- } from "./chunk-VRQPLLYS.js";
13
+ } from "./chunk-5GSDYTF6.js";
14
14
 
15
15
  // source/executor/Compiler.ts
16
16
  var Compiler = class {
@@ -69,7 +69,7 @@ var Compiler = class {
69
69
  return __async(this, null, function* () {
70
70
  if (analyzer.compilation.mainPackage === void 0) {
71
71
  _diagnostics?.addDiagnostic(new Diagnostic(DiagnosticData.withCode(
72
- 303 /* ProgramWithoutMainPackageCanNotBeCompiled */
72
+ 403 /* ProgramWithoutMainPackageCannotBeCompiled */
73
73
  ), void 0));
74
74
  return void 0;
75
75
  }
@@ -83,7 +83,7 @@ var Compiler = class {
83
83
  return __async(this, null, function* () {
84
84
  if (analyzer.compilation.mainPackage === void 0) {
85
85
  _diagnostics?.addDiagnostic(new Diagnostic(DiagnosticData.withCode(
86
- 303 /* ProgramWithoutMainPackageCanNotBeCompiled */
86
+ 403 /* ProgramWithoutMainPackageCannotBeCompiled */
87
87
  ), void 0));
88
88
  return "";
89
89
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Compiler
3
- } from "./chunk-YNR2KYMJ.js";
3
+ } from "./chunk-F5OW64UA.js";
4
4
  import {
5
5
  ArtelVersion,
6
6
  Cached,
@@ -14,7 +14,7 @@ import {
14
14
  __async,
15
15
  performanceMeasurementStageNames,
16
16
  performanceMeasurementStages
17
- } from "./chunk-VRQPLLYS.js";
17
+ } from "./chunk-5GSDYTF6.js";
18
18
 
19
19
  // source/executor/FileSystemUri.ts
20
20
  import { platform } from "os";
@@ -216,7 +216,7 @@ var NodeCompiler = class {
216
216
  const standardLibraryUri = yield this.findStandardTypeScriptLibrary(nodeModulesSearchPaths, defaultTsLibraryPath);
217
217
  if (standardLibraryUri === void 0) {
218
218
  const diagnostic = new Diagnostic(DiagnosticData.withCode(
219
- 301 /* CanNotFindTsLibDirectoryBaseSearchPaths0 */,
219
+ 401 /* CannotFindTsLibDirectoryBaseSearchPaths0 */,
220
220
  [nodeModulesSearchPaths.map((p) => `'${p}'`).join(", ")]
221
221
  ), void 0);
222
222
  diagnostics?.addDiagnostic(diagnostic);
@@ -1,5 +1,5 @@
1
1
  import ts from 'typescript';
2
- import { CancellationToken, Name, PackageLocale, Range, SearchName, WithDiagnostics } from '../common/index.js';
2
+ import { CancellationToken, Lazy, Name, PackageLocale, Range, SearchName, WithDiagnostics } from '../common/index.js';
3
3
  import { Diagnostic, DiagnosticAcceptor, DiagnosticLocation } from '../diagnostic/Diagnostic.js';
4
4
  import { DiagnosticCode } from '../diagnostic/DiagnosticCode.js';
5
5
  import { DiagnosticFlags, DiagnosticKind } from '../diagnostic/DiagnosticData.js';
@@ -35,8 +35,6 @@ import { NamedTypeSpecifierResolutionResult } from './NamedTypeSpecifierResolver
35
35
  import { DereferencedVariableAccessorDeclaration, FieldAccessorDeclaration, FunctionTypeDeclaration, GetterDeclaration, IndexedElementAccessorDeclaration, PackageVariableAccessorDeclaration, SetterDeclaration, StructuredTypeDeclaration, VariantTypeDeclaration } from './NodeTypeUtils.js';
36
36
  import * as objectExpressionMeaning from './ObjectExpressionMeaning.js';
37
37
  import * as operationOverloadResolver from './OperationOverloadResolver.js';
38
- import * as scope from './Scope.js';
39
- import { SemanticContextBuilder } from './SemanticContextBuilder.js';
40
38
  import { SourceFileMembers as ActualSourceFileMembers } from './SourceFileMembers.js';
41
39
  import * as tagMeaning from './TagMeaning.js';
42
40
  import * as tags from './Tags.js';
@@ -44,6 +42,7 @@ import { TargetTypeHint } from './TargetTypeHint.js';
44
42
  import * as typeOverloadResolver from './TypeOverloadResolver.js';
45
43
  import * as controlFlow from './control-flow/index.js';
46
44
  import { WellKnownDeclarations } from './index.js';
45
+ import * as semanticContext from './semantic-context/index.js';
47
46
  export declare class Analyzer {
48
47
  static readonly enumeratorMethodName = "\u043F\u0435\u0440\u0435\u0431\u043E\u0440";
49
48
  static readonly functionTypeInvokeMethodName = "\u0432\u044B\u043F\u043E\u043B\u043D\u0438\u0442\u044C";
@@ -60,8 +59,7 @@ export declare class Analyzer {
60
59
  readonly entity: Entity;
61
60
  readonly resultLocalVariableEntity: ResultLocalVariableEntity;
62
61
  readonly valueLocalVariableEntity: ValueLocalVariableEntity;
63
- readonly scope: Scope;
64
- readonly semanticContext: SemanticContextBuilder;
62
+ readonly semanticContext: semanticContext.SemanticContextBuilder;
65
63
  readonly argumentToParameterMatchResult: ArgumentToParameterMatchResult;
66
64
  readonly defaultConstructors: DefaultConstructors;
67
65
  readonly overriddenMember: OverriddenMember;
@@ -96,6 +94,9 @@ export declare class Analyzer {
96
94
  private readonly _functionBlockWithYieldStatementCheckResults;
97
95
  private readonly _namedDeclarationsUsageCountResults;
98
96
  private readonly _controlFlowGraphs;
97
+ private readonly _diagnosticsComputedLazily;
98
+ private readonly _diagnosticsComputedLazilyAcceptor;
99
+ private readonly _sourcePackageMemberConflictsDiagnostics;
99
100
  get tsInterop(): TsInteropContext;
100
101
  constructor(compilation: project.Compilation, tsInteropInputs: TsInteropInputs);
101
102
  getProjectSourceFile(node: tree.SourceFile): project.SourceFile;
@@ -124,6 +125,7 @@ export declare class Analyzer {
124
125
  enumeratePackageImports(packageImportDirectives: Iterable<tree.PackageImportDirective>): Iterable<tree.PackageImport>;
125
126
  getSourceFileMembers(node: tree.SourceFile): ActualSourceFileMembers;
126
127
  getCallExpressionMeaning(node: tree.CallExpression): callExpressionMeaning.Meaning;
128
+ getCallExpressionType(node: tree.CallExpression): types.Type;
127
129
  getRespectiveParameter(node: tree.Argument): MatchResultValueParameter | undefined;
128
130
  resolveIndexedAccessExpression(node: tree.IndexedAccessExpression): indexedAccessExpressionMeaning.ResolutionResult;
129
131
  getDereferenceExpressionMeaning(node: tree.DereferenceExpression): dereferenceExpressionMeaning.Meaning;
@@ -157,7 +159,7 @@ export declare class Analyzer {
157
159
  * а?[1]
158
160
  * а?^
159
161
  * а?()
160
- * (а)?.б
162
+ * (а?.б)
161
163
  * ```
162
164
  */
163
165
  isExpressionOptionalChainingSyntactically(node: tree.Expression): boolean;
@@ -237,7 +239,7 @@ export declare class Analyzer {
237
239
  isValueParameterVariadic(entity: e.VariableEntity): boolean;
238
240
  getDefaultTypeParameterConstraint(): types.Type;
239
241
  getOriginalSignatureTypeOfFunctionEntity(entity: e.FunctionEntity): types.FunctionType;
240
- getFunctionBlockLiteralValueParameters(node: tree.FunctionBlockLiteral): readonly e.VariableEntity[];
242
+ getFunctionBlockLiteralValueParameters(node: tree.FunctionBlockLiteral): readonly e.ParameterVariableEntity[];
241
243
  getExtendedType(node: tree.TypeExtensionDeclaration): WithDiagnostics<e.NamedTypeEntity>;
242
244
  getAnalyzedTranslationPackageIfTargetResolved(package_: project.TranslationPackage): AnalyzedTranslationPackage | undefined;
243
245
  getAnalyzedTranslationPackageForPackage(entity: e.PackageEntity, locale: PackageLocale): AnalyzedTranslationPackage | undefined;
@@ -265,9 +267,17 @@ export declare class Analyzer {
265
267
  } | undefined;
266
268
  getControlFlowGraph(sourceFile: project.SourceFile): controlFlow.GraphBuildResult;
267
269
  createAmbiguousEntityAccessDiagnostic(entities: readonly WithLocalization<e.Entity>[], lctx: LocalizationContext, node: tree.Node): Diagnostic;
270
+ createAmbiguousEntityAccessLazyDiagnostic(entities: readonly WithLocalization<e.Entity>[], lctx: LocalizationContext, node: tree.Node): Lazy<Diagnostic>;
268
271
  createAmbiguousFunctionAccessDiagnostic(functions: readonly WithLocalization<AccessedFunction>[], lctx: LocalizationContext, node: tree.Node): Diagnostic;
272
+ createAmbiguousFunctionAccessLazyDiagnostic(functions: readonly WithLocalization<AccessedFunction>[], lctx: LocalizationContext, node: tree.Node): Lazy<Diagnostic>;
269
273
  createAmbiguousTypeMemberAccessDiagnostic(members: readonly WithLocalization<types.TypeMember>[], lctx: LocalizationContext, node: tree.Node): Diagnostic;
270
- createAmbiguousNamedScopeDeclarationAccessDiagnostic(declarations: readonly WithLocalization<scope.NamedDeclaration>[], lctx: LocalizationContext, node: tree.Node): Diagnostic;
274
+ createAmbiguousTypeMemberAccessLazyDiagnostic(members: readonly WithLocalization<types.TypeMember>[], lctx: LocalizationContext, node: tree.Node): Lazy<Diagnostic>;
275
+ createAmbiguousNamedScopeDeclarationAccessDiagnostic(declarations: readonly WithLocalization<semanticContext.NamedDeclaration>[], lctx: LocalizationContext, node: tree.Node): Diagnostic;
276
+ createAmbiguousNamedScopeDeclarationAccessLazyDiagnostic(declarations: readonly WithLocalization<semanticContext.NamedDeclaration>[], lctx: LocalizationContext, node: tree.Node): Lazy<Diagnostic>;
277
+ addDiagnosticComputedLazily(diagnostic: Diagnostic): void;
278
+ getAcceptorForDiagnosticsComputedLazily(): DiagnosticAcceptor;
279
+ getDiagnosticsComputedLazily(sourceFile: project.SourceFile): readonly Diagnostic[];
280
+ validateSourcePackageMemberConflicts(pkg: project.ProgramPackage): readonly Diagnostic[];
271
281
  private createTsInterop;
272
282
  }
273
283
  export declare class TsInteropInputs {
@@ -321,7 +331,7 @@ declare class Type {
321
331
  private ofMemberAccessExpression;
322
332
  private ofReferenceExpression;
323
333
  private ofDereferenceExpression;
324
- private ofWhenTernaryExpression;
334
+ private ofConditionalExpression;
325
335
  private ofTextTemplateLiteral;
326
336
  private ofIdentifierExpression;
327
337
  private ofTokenExpression;
@@ -353,6 +363,10 @@ declare class ReturnType {
353
363
  ofFunctionLiteral(node: tree.FunctionLiteral): types.Type;
354
364
  ofMethodDeclaration(node: tree.MethodDeclaration): types.Type;
355
365
  ofOperatorDeclaration(node: tree.OperatorDeclaration): types.Type;
366
+ ofPackageVariableGetterDeclaration(node: tree.PackageVariableGetterDeclaration): types.Type;
367
+ ofFieldGetterDeclaration(node: tree.FieldGetterDeclaration): types.Type;
368
+ ofDereferencedVariableGetterDeclaration(node: tree.DereferencedVariableGetterDeclaration): types.Type;
369
+ ofIndexedElementGetterDeclaration(node: tree.IndexedElementGetterDeclaration): types.Type;
356
370
  }
357
371
  declare class Entity {
358
372
  private readonly _analyzer;
@@ -452,66 +466,10 @@ declare class ValueLocalVariableEntity {
452
466
  private readonly _analyzer;
453
467
  private readonly _entities;
454
468
  constructor(_analyzer: Analyzer);
455
- ofPackageVariableSetterDeclaration(node: tree.PackageVariableSetterDeclaration): e.VariableEntity;
456
- ofFieldSetterDeclaration(node: tree.FieldSetterDeclaration): e.VariableEntity;
457
- ofIndexedElementSetterDeclaration(node: tree.IndexedElementSetterDeclaration): e.VariableEntity;
458
- ofDereferencedVariableSetterDeclaration(node: tree.DereferencedVariableSetterDeclaration): e.VariableEntity;
459
- }
460
- declare class Scope {
461
- private readonly _analyzer;
462
- private readonly _sourceFileScopes;
463
- private readonly _functionBlockLiteralScopes;
464
- private readonly _packageFunctionDeclarationTypeParametersScopes;
465
- private readonly _packageFunctionDeclarationValueParametersScopes;
466
- private readonly _structuredMethodDeclarationTypeParametersScopes;
467
- private readonly _structuredMethodDeclarationValueParametersScopes;
468
- private readonly _nestedFunctionDeclarationTypeParametersScopes;
469
- private readonly _nestedFunctionDeclarationValueParametersScopes;
470
- private readonly _functionLiteralScopes;
471
- private readonly _functionBlockScopes;
472
- private readonly _statementBlockScopes;
473
- private readonly _forEachStatementScopes;
474
- private readonly _catchClauseScopes;
475
- private readonly _packageStructuredTypeDeclarationTypeParametersScopes;
476
- private readonly _structuredTypeDeclarationBodyScopes;
477
- private readonly _packageFunctionTypeDeclarationTypeParametersScopes;
478
- private readonly _functionTypeDeclarationBodyScopes;
479
- private readonly _packageVariantTypeDeclarationTypeParametersScopes;
480
- private readonly _variantTypeDeclarationBodyScopes;
481
- private readonly _aliasTypeDeclarationBodyScopes;
482
- private readonly _packageAliasTypeDeclarationTypeParametersScopes;
483
- private readonly _operatorDeclarationScopes;
484
- private readonly _structuredConstructorDeclarationScopes;
485
- private readonly _structuredDestructorDeclarationScopes;
486
- private readonly _indexedElementAccessorDeclarationParametersScopes;
487
- private readonly _typeExtensionDeclarationScopes;
488
- constructor(_analyzer: Analyzer);
489
- ofSourceFile(node: tree.SourceFile): scope.IScope;
490
- ofFunctionBlockLiteral(node: tree.FunctionBlockLiteral): scope.IScope;
491
- ofPackageFunctionDeclarationTypeParameters(node: tree.PackageFunctionDeclaration): scope.IScope;
492
- ofPackageFunctionDeclarationValueParameters(node: tree.PackageFunctionDeclaration): scope.IScope;
493
- ofMethodDeclarationTypeParameters(node: tree.MethodDeclaration): scope.IScope;
494
- ofMethodDeclarationValueParameters(node: tree.MethodDeclaration): scope.IScope;
495
- ofNestedFunctionDeclarationTypeParameters(node: tree.NestedFunctionDeclaration): scope.IScope;
496
- ofNestedFunctionDeclarationValueParameters(node: tree.NestedFunctionDeclaration): scope.IScope;
497
- ofFunctionLiteral(node: tree.FunctionLiteral): scope.IScope;
498
- ofFunctionBlock(node: tree.FunctionBlock): scope.IScope;
499
- ofStatementBlock(node: tree.StatementBlock): scope.IScope;
500
- ofForStatement(node: tree.ForStatement): scope.IScope;
501
- ofCatchClause(node: tree.CatchClause): scope.IScope;
502
- ofPackageStructuredTypeDeclarationTypeParameters(node: tree.PackageStructuredTypeDeclaration): scope.IScope;
503
- ofStructuredTypeDeclarationBody(node: tree.StructuredTypeDeclarationBody): scope.IScope;
504
- ofPackageFunctionTypeDeclarationTypeParameters(node: tree.PackageFunctionTypeDeclaration): scope.IScope;
505
- ofFunctionTypeDeclarationBody(node: tree.FunctionTypeDeclarationBody): scope.IScope;
506
- ofPackageVariantTypeDeclarationTypeParameters(node: tree.PackageVariantTypeDeclaration): scope.IScope;
507
- ofVariantTypeDeclarationBody(node: tree.VariantTypeDeclarationBody): scope.IScope;
508
- ofAliasTypeDeclarationBody(node: tree.AliasTypeDeclarationBody): scope.IScope;
509
- ofPackageAliasTypeDeclarationTypeParameters(node: tree.PackageAliasTypeDeclaration): scope.IScope;
510
- ofOperatorDeclaration(node: tree.OperatorDeclaration): scope.IScope;
511
- ofConstructorDeclaration(node: tree.ConstructorDeclaration): scope.IScope;
512
- ofDestructorDeclaration(node: tree.DestructorDeclaration): scope.IScope;
513
- ofIndexedElementAccessorDeclarationParameters(node: IndexedElementAccessorDeclaration): scope.IScope;
514
- ofTypeExtensionDeclaration(node: tree.TypeExtensionDeclaration): scope.IScope;
469
+ ofPackageVariableSetterDeclaration(node: tree.PackageVariableSetterDeclaration): e.LocalVariableEntity;
470
+ ofFieldSetterDeclaration(node: tree.FieldSetterDeclaration): e.LocalVariableEntity;
471
+ ofIndexedElementSetterDeclaration(node: tree.IndexedElementSetterDeclaration): e.LocalVariableEntity;
472
+ ofDereferencedVariableSetterDeclaration(node: tree.DereferencedVariableSetterDeclaration): e.LocalVariableEntity;
515
473
  }
516
474
  declare class DefaultConstructors {
517
475
  private readonly _analyzer;
@@ -662,10 +620,13 @@ export declare class TypeUtils {
662
620
  private readonly _analyzer;
663
621
  constructor(_analyzer: Analyzer);
664
622
  getCommonObjectAndAspectTypesOfUnion(unionType: types.UnionType): readonly types.StructuredType[];
665
- private getTypesForCommonTypesSearch;
623
+ removeBaseTypesInPlace(types: types.Type[]): void;
624
+ removeDerivedTypesInPlace(types: types.Type[]): void;
625
+ private getBaseTypesForCommonTypesSearch;
666
626
  private addTypeAndCollectAllBaseTypes;
667
627
  private addTypeIfUnique;
668
- private removeBaseTypes;
628
+ private getFlattenedConstituentTypesForCommonTypesSearch;
629
+ private flattenTypeParameterConstraint;
669
630
  }
670
631
  export declare class ExpressionDenotesFunctionCheckResult {
671
632
  readonly candidates: readonly WithLocalization<AccessedFunction>[];
@@ -0,0 +1,11 @@
1
+ import { Analyzer } from './Analyzer.js';
2
+ import * as controlFlow from './control-flow/index.js';
3
+ export declare class AssignmentChecker {
4
+ private readonly _analyzer;
5
+ private readonly _variableReference;
6
+ private readonly _controlFlowNode;
7
+ private readonly _checkResults;
8
+ constructor(analyzer: Analyzer, variableReference: controlFlow.NarrowableReference, controlFlowNode: controlFlow.Node);
9
+ checkVariableIsAssigned(): boolean;
10
+ private checkVariableIsAssignedAtNode;
11
+ }
@@ -11,8 +11,10 @@ export declare class Resolver {
11
11
  constructor(_analyzer: Analyzer, _node: CallExpression);
12
12
  private get callee();
13
13
  resolve(): Meaning;
14
+ resolveType(meaning: Meaning | undefined): types.Type;
14
15
  private resolveConstructorCallExpressionMeaning;
15
16
  private getNodeForDiagnostics;
17
+ private getTypeFromMeaning;
16
18
  }
17
19
  export type Meaning = Meaning_functionCall | Meaning_operatorCall | Meaning_objectFunctionCall | Meaning_constructorCall | Meaning_unresolved;
18
20
  declare class Meaning_functionCall {
@@ -7,12 +7,17 @@ export declare class DeclarationsUsageCounter {
7
7
  private readonly _analyzer;
8
8
  private readonly _sourceFile;
9
9
  private readonly _cancellationToken;
10
- private readonly _usageCountByEntity;
10
+ private readonly _usageInfoByEntity;
11
11
  constructor(analyzer: Analyzer, sourceFile: tree.SourceFile, cancellationToken: CancellationToken | undefined);
12
12
  count(): Promise<DeclarationsUsageCountResult>;
13
+ private recordUsage;
13
14
  }
14
15
  export declare class DeclarationsUsageCountResult {
15
16
  private readonly _usageCountByEntity;
16
- constructor(_usageCountByEntity: ReadonlyMap<Entity, number>);
17
- getUsageCount(entity: NamedEntity): number;
17
+ constructor(_usageCountByEntity: ReadonlyMap<Entity, DeclarationUsageInfo>);
18
+ getUsageInfo(entity: NamedEntity): DeclarationUsageInfo;
19
+ }
20
+ export interface DeclarationUsageInfo {
21
+ readonly usageCount: number;
22
+ readonly hasGetAccess: boolean;
18
23
  }
@@ -18,6 +18,8 @@ export declare class DiagnosticCollector {
18
18
  constructor(analyzer: Analyzer, sourceFile: project.SourceFile, cancellationToken: CancellationToken | undefined);
19
19
  collect(): Promise<Diagnostic[]>;
20
20
  private collectNodeDiagnostics;
21
+ private checkFunctionLiteral;
22
+ private checkFunctionBlockLiteral;
21
23
  private checkDereferenceExpression;
22
24
  private checkIndexedAccessExpression;
23
25
  private checkCallExpression;
@@ -44,13 +46,16 @@ export declare class DiagnosticCollector {
44
46
  private checkPossibleGeneratorFunctionReturnType;
45
47
  private checkReturnStatement;
46
48
  private checkYieldStatement;
49
+ private checkPackageMemberBodyPresence;
50
+ private getPackageMemberBodyRequirementReason;
47
51
  private checkTypeMemberBodyPresence;
48
- private tryGetTypeMemberDeclarationEntity;
49
- private isAspectTypeMemberDeclaration;
50
- private collectIdentifierExpressionDiagnostics;
51
- private collectMemberAccessExpressionDiagnostics;
52
+ private getTypeMemberBodyRequirementReason;
53
+ private isRedefinableEntity;
54
+ private checkIdentifierExpression;
55
+ private checkLocalVariableUsedBeforeDeclaration;
56
+ private checkLocalVariableIsUsedBeforeBeingAssigned;
57
+ private checkMemberAccessExpression;
52
58
  private addDiagnosticsFromMatchResult;
53
- private checkStatementForVariablesUsedBeforeBeingAssigned;
54
59
  private checkExpressionTypeAssignableToTargetType;
55
60
  private addTypeAssignabilityDiagnosticIfBothTypesResolved;
56
61
  private checkAssignmentIsValid;
@@ -73,6 +78,11 @@ export declare class DiagnosticCollector {
73
78
  private checkTypeArgumentCount;
74
79
  private checkParameterDeclaration;
75
80
  private checkIfVariableIsUnused;
81
+ private checkIfNestedFunctionIsUnused;
82
+ private checkIfTypeParameterIsUnused;
83
+ private checkAllCodePathsReturnOrResultVariableIsAssigned;
76
84
  private addDiagnostic;
77
85
  private addDiagnostics;
86
+ private addMaybeLazyDiagnostic;
87
+ private addMaybeLazyDiagnostics;
78
88
  }
@@ -1,4 +1,4 @@
1
- import { AccessKind, Name } from '../common/index.js';
1
+ import { AccessKind, MaybeLazy, Name } from '../common/index.js';
2
2
  import { Diagnostic } from '../diagnostic/Diagnostic.js';
3
3
  import { NamedTypeEntity, PackageAliasEntity, VariableEntity } from '../entities/index.js';
4
4
  import * as tree from '../tree/index.js';
@@ -6,8 +6,8 @@ import * as types from '../types/index.js';
6
6
  import { AccessedFunction } from './AccessedFunction.js';
7
7
  import { FoundAnonymousDeclaration, FoundNamedDeclaration } from './FoundDeclaration.js';
8
8
  import { PackageNameTreeNode } from './ImportedPackageNameTree.js';
9
- import * as scope from './Scope.js';
10
9
  import { Analyzer, TargetTypeHint } from './index.js';
10
+ import { NamedDeclaration } from './semantic-context/index.js';
11
11
  export declare class Resolver {
12
12
  private readonly _semanticContext;
13
13
  private readonly _analyzer;
@@ -23,12 +23,12 @@ export declare class Resolver {
23
23
  }
24
24
  export declare class ResolutionResult {
25
25
  readonly meaning: Meaning;
26
- readonly diagnostic?: Diagnostic | undefined;
26
+ readonly diagnostic?: MaybeLazy<Diagnostic> | undefined;
27
27
  /**
28
28
  * Может ли измениться результат, если посчитать его с другим целевым типом?
29
29
  */
30
30
  readonly dependsOnTargetType: boolean;
31
- constructor(meaning: Meaning, diagnostic?: Diagnostic | undefined,
31
+ constructor(meaning: Meaning, diagnostic?: MaybeLazy<Diagnostic> | undefined,
32
32
  /**
33
33
  * Может ли измениться результат, если посчитать его с другим целевым типом?
34
34
  */
@@ -73,9 +73,9 @@ declare class Meaning_typeAccess {
73
73
  constructor(candidates: readonly FoundNamedDeclaration<NamedTypeEntity>[], suitableTypes: readonly FoundNamedDeclaration<types.Type>[]);
74
74
  }
75
75
  declare class Meaning_mixedAmbiguousAccess {
76
- readonly declarations: readonly FoundNamedDeclaration<scope.NamedDeclaration>[];
76
+ readonly declarations: readonly FoundNamedDeclaration<NamedDeclaration>[];
77
77
  readonly kind = "mixed-ambiguous-access";
78
- constructor(declarations: readonly FoundNamedDeclaration<scope.NamedDeclaration>[]);
78
+ constructor(declarations: readonly FoundNamedDeclaration<NamedDeclaration>[]);
79
79
  }
80
80
  declare class Meaning_unresolved {
81
81
  readonly kind = "unresolved";
@@ -1,4 +1,4 @@
1
- import { AccessKind } from '../common/index.js';
1
+ import { AccessKind, MaybeLazy } from '../common/index.js';
2
2
  import { Diagnostic } from '../diagnostic/Diagnostic.js';
3
3
  import { IndexedAccessExpression } from '../tree/index.js';
4
4
  import * as types from '../types/index.js';
@@ -16,8 +16,8 @@ export declare class Resolver {
16
16
  }
17
17
  export declare class ResolutionResult {
18
18
  readonly meaning: Meaning;
19
- readonly diagnostic?: Diagnostic | undefined;
20
- constructor(meaning: Meaning, diagnostic?: Diagnostic | undefined);
19
+ readonly diagnostic?: MaybeLazy<Diagnostic> | undefined;
20
+ constructor(meaning: Meaning, diagnostic?: MaybeLazy<Diagnostic> | undefined);
21
21
  }
22
22
  export type Meaning = Meaning_resolved | Meaning_unresolved;
23
23
  declare class Meaning_resolved {
@@ -1,4 +1,4 @@
1
- import { AccessKind } from '../common/index.js';
1
+ import { AccessKind, MaybeLazy } from '../common/index.js';
2
2
  import { Diagnostic } from '../diagnostic/Diagnostic.js';
3
3
  import { Entity, PackageTypeEntity, PackageVariableEntity } from '../entities/index.js';
4
4
  import * as tree from '../tree/index.js';
@@ -6,8 +6,8 @@ import * as types from '../types/index.js';
6
6
  import { AccessedFunction } from './AccessedFunction.js';
7
7
  import { FoundAnonymousDeclaration, FoundNamedDeclaration } from './FoundDeclaration.js';
8
8
  import { PackageNameTreeNode } from './ImportedPackageNameTree.js';
9
- import { WithLocalization } from './Localization.js';
10
9
  import { Analyzer, TargetTypeHint } from './index.js';
10
+ import { WithLocalization } from './Localization.js';
11
11
  export declare class Resolver {
12
12
  private readonly _semanticContext;
13
13
  private readonly _analyzer;
@@ -31,18 +31,18 @@ export declare class Resolver {
31
31
  }
32
32
  export declare class ResolutionResult {
33
33
  readonly meaning: Meaning;
34
- readonly diagnostic?: Diagnostic | undefined;
34
+ readonly diagnostic?: MaybeLazy<Diagnostic> | undefined;
35
35
  /**
36
36
  * Может ли измениться результат, если посчитать его с другим целевым типом?
37
37
  */
38
38
  readonly dependsOnTargetType: boolean;
39
- constructor(meaning: Meaning, diagnostic?: Diagnostic | undefined,
39
+ constructor(meaning: Meaning, diagnostic?: MaybeLazy<Diagnostic> | undefined,
40
40
  /**
41
41
  * Может ли измениться результат, если посчитать его с другим целевым типом?
42
42
  */
43
43
  dependsOnTargetType?: boolean);
44
44
  }
45
- export type Meaning = Meaning_packageVariableAccess | Meaning_packageFunctionAccess | Meaning_packageTypeAccess | Meaning_packageNameSegmentAccess | Meaning_staticVariableAccess | Meaning_staticMethodAccess | Meaning_instanceVariableAccess | Meaning_instanceMethodAccess | Meaning_operatorAccess | Meaning_mixedAmbiguousAccess | Meaning_unresolved;
45
+ export type Meaning = Meaning_packageVariableAccess | Meaning_packageFunctionAccess | Meaning_packageTypeAccess | Meaning_packageNameSegmentAccess | Meaning_staticFieldAccess | Meaning_staticMethodAccess | Meaning_instanceFieldAccess | Meaning_instanceMethodAccess | Meaning_operatorAccess | Meaning_mixedAmbiguousAccess | Meaning_unresolved;
46
46
  declare class Meaning_packageVariableAccess {
47
47
  readonly variable: FoundNamedDeclaration<PackageVariableEntity>;
48
48
  readonly accessKind: AccessKind;
@@ -68,11 +68,11 @@ declare class Meaning_packageNameSegmentAccess {
68
68
  readonly kind = "package-name-segment-access";
69
69
  constructor(packageTreeNode: PackageNameTreeNode);
70
70
  }
71
- declare class Meaning_staticVariableAccess {
71
+ declare class Meaning_staticFieldAccess {
72
72
  readonly type: types.Type;
73
73
  readonly variable: FoundNamedDeclaration<types.Variable>;
74
74
  readonly accessKind: AccessKind;
75
- readonly kind = "static-variable-access";
75
+ readonly kind = "static-field-access";
76
76
  constructor(type: types.Type, variable: FoundNamedDeclaration<types.Variable>, accessKind: AccessKind);
77
77
  }
78
78
  declare class Meaning_staticMethodAccess {
@@ -83,10 +83,10 @@ declare class Meaning_staticMethodAccess {
83
83
  get singleSuitableFunction(): FoundNamedDeclaration<AccessedFunction> | undefined;
84
84
  constructor(type: types.Type, candidates: readonly FoundNamedDeclaration<AccessedFunction>[], suitableFunctions: readonly FoundNamedDeclaration<AccessedFunction>[]);
85
85
  }
86
- declare class Meaning_instanceVariableAccess {
86
+ declare class Meaning_instanceFieldAccess {
87
87
  readonly variable: FoundNamedDeclaration<types.Variable>;
88
88
  readonly accessKind: AccessKind;
89
- readonly kind = "instance-variable-access";
89
+ readonly kind = "instance-field-access";
90
90
  constructor(variable: FoundNamedDeclaration<types.Variable>, accessKind: AccessKind);
91
91
  }
92
92
  declare class Meaning_instanceMethodAccess {
@@ -1,3 +1,4 @@
1
+ import { MaybeLazy } from '../common/index.js';
1
2
  import { Diagnostic } from '../diagnostic/Diagnostic.js';
2
3
  import { NamedTypeEntity, PackageAliasEntity } from '../entities/index.js';
3
4
  import { QualifiedName } from '../tree/index.js';
@@ -23,9 +24,9 @@ export declare class NamedTypeResolver {
23
24
  export declare class NamedTypeResolutionResult {
24
25
  readonly types: readonly FoundNamedDeclaration<NamedTypeEntity>[];
25
26
  readonly resolvedQualifiers: readonly ResolvedQualifier[];
26
- readonly diagnostics: readonly Diagnostic[];
27
+ readonly diagnostics: readonly MaybeLazy<Diagnostic>[];
27
28
  readonly ambiguousDeclarations: readonly WithLocalization<EntityOrPackageNameTreeNode>[] | undefined;
28
- constructor(types: readonly FoundNamedDeclaration<NamedTypeEntity>[], resolvedQualifiers: readonly ResolvedQualifier[], diagnostics: readonly Diagnostic[], ambiguousDeclarations: readonly WithLocalization<EntityOrPackageNameTreeNode>[] | undefined);
29
+ constructor(types: readonly FoundNamedDeclaration<NamedTypeEntity>[], resolvedQualifiers: readonly ResolvedQualifier[], diagnostics: readonly MaybeLazy<Diagnostic>[], ambiguousDeclarations: readonly WithLocalization<EntityOrPackageNameTreeNode>[] | undefined);
29
30
  }
30
31
  export type ResolvedQualifier = ResolvedQualifier_packageNameSegment | ResolvedQualifier_packageAlias | ResolvedQualifier_type;
31
32
  export declare class ResolvedQualifier_packageNameSegment {
@@ -1,3 +1,4 @@
1
+ import { MaybeLazy } from '../common/index.js';
1
2
  import { Diagnostic } from '../diagnostic/Diagnostic.js';
2
3
  import { NamedTypeSpecifier } from '../tree/index.js';
3
4
  import * as types from '../types/index.js';
@@ -16,7 +17,7 @@ export declare class NamedTypeSpecifierResolver {
16
17
  export declare class NamedTypeSpecifierResolutionResult {
17
18
  readonly type: FoundNamedDeclaration<types.Type> | undefined;
18
19
  readonly resolvedQualifiers: readonly ResolvedQualifier[];
19
- readonly diagnostics: readonly Diagnostic[];
20
+ readonly diagnostics: readonly MaybeLazy<Diagnostic>[];
20
21
  readonly ambiguousDeclarations: readonly WithLocalization<EntityOrPackageNameTreeNode>[] | undefined;
21
- constructor(type: FoundNamedDeclaration<types.Type> | undefined, resolvedQualifiers: readonly ResolvedQualifier[], diagnostics: readonly Diagnostic[], ambiguousDeclarations: readonly WithLocalization<EntityOrPackageNameTreeNode>[] | undefined);
22
+ constructor(type: FoundNamedDeclaration<types.Type> | undefined, resolvedQualifiers: readonly ResolvedQualifier[], diagnostics: readonly MaybeLazy<Diagnostic>[], ambiguousDeclarations: readonly WithLocalization<EntityOrPackageNameTreeNode>[] | undefined);
22
23
  }
@@ -12,8 +12,8 @@ export declare class NodeTypeUtils {
12
12
  static isFunctionDeclaration(node: tree.Node): node is FunctionDeclaration;
13
13
  static isVariableDeclaration(node: tree.Node): node is VariableDeclaration;
14
14
  static isVariantTypeDeclaration(node: tree.Node): node is VariantTypeDeclaration;
15
- static isSubprogramDeclaration(node: tree.Node): node is SubprogramDeclaration;
16
15
  static isNoneLiteral(node: tree.Node): boolean;
16
+ static isSubprogramDeclarationOrLiteral(node: tree.Node): node is SubprogramDeclarationOrLiteral;
17
17
  }
18
18
  export type PackageTypeDeclaration = tree.PackageAliasTypeDeclaration | tree.PackageFunctionTypeDeclaration | tree.PackageStructuredTypeDeclaration | tree.PackageVariantTypeDeclaration;
19
19
  export type StructuredTypeDeclaration = tree.PackageStructuredTypeDeclaration | tree.AnonymousStructuredTypeDeclaration;
@@ -29,4 +29,5 @@ export type PackageVariableAccessorDeclaration = tree.PackageVariableGetterDecla
29
29
  export type FieldAccessorDeclaration = tree.FieldGetterDeclaration | tree.FieldSetterDeclaration;
30
30
  export type IndexedElementAccessorDeclaration = tree.IndexedElementGetterDeclaration | tree.IndexedElementSetterDeclaration;
31
31
  export type DereferencedVariableAccessorDeclaration = tree.DereferencedVariableGetterDeclaration | tree.DereferencedVariableSetterDeclaration;
32
- export type SubprogramDeclaration = tree.FunctionBlockParent | tree.FunctionLiteral | tree.FunctionBlockLiteral;
32
+ export type RegularOrBlockFunctionLiteral = tree.FunctionLiteral | tree.FunctionBlockLiteral;
33
+ export type SubprogramDeclarationOrLiteral = tree.FunctionBlockParent;
@@ -0,0 +1,24 @@
1
+ import { Diagnostic } from '../diagnostic/Diagnostic.js';
2
+ import { OriginalPackageMembers } from '../entities/PackageMembers.js';
3
+ import { ProgramPackage } from '../project/SourcePackage.js';
4
+ import { Analyzer } from './Analyzer.js';
5
+ export declare class PackageMemberNameConflictsValidator {
6
+ private readonly _analyzer;
7
+ private readonly _members;
8
+ private readonly _diagnostics;
9
+ constructor(_analyzer: Analyzer, _members: OriginalPackageMembers);
10
+ validate(): readonly Diagnostic[];
11
+ private validateFunctionNameConflicts;
12
+ private areFunctionSignaturesEqual;
13
+ private validateTypeNameConflicts;
14
+ private typeParameterCountsIntersect;
15
+ private createAndAddNameConflictDiagnosticsForAllEntities;
16
+ private createAndAddNameConflictDiagnostic;
17
+ private getDiagnosticLocation;
18
+ }
19
+ export declare class SourcePackageMemberConflictsValidator {
20
+ private readonly _analyzer;
21
+ private readonly _package;
22
+ constructor(_analyzer: Analyzer, _package: ProgramPackage);
23
+ validate(): readonly Diagnostic[];
24
+ }
@@ -1,15 +1,20 @@
1
1
  import { SearchName } from '../common/index.js';
2
+ import { DiagnosticAcceptor } from '../diagnostic/Diagnostic.js';
2
3
  import { PackageAliasEntity, PackageFunctionEntity, PackageTypeEntity, PackageVariableEntity, TypeExtensionEntity } from '../entities/index.js';
4
+ import { Analyzer } from './Analyzer.js';
3
5
  export declare class SourceFileMembers {
6
+ private readonly _analyzer;
4
7
  private readonly _namedMembers;
5
8
  private readonly _typeExtensions;
6
9
  private readonly _declarationsByName;
7
10
  get declarationsByName(): ReadonlyMap<string, readonly NamedSourceFileMemberEntity[]>;
8
- constructor(namedMembers: readonly NamedSourceFileMemberEntity[], typeExtensions: readonly TypeExtensionEntity[]);
11
+ constructor(analyzer: Analyzer, namedMembers: readonly NamedSourceFileMemberEntity[], typeExtensions: readonly TypeExtensionEntity[]);
9
12
  getNamedDeclarations(): readonly NamedSourceFileMemberEntity[];
10
13
  getNamedDeclarationsByName(name: SearchName): readonly NamedSourceFileMemberEntity[];
11
14
  getPackageAliases(): readonly PackageAliasEntity[];
12
15
  getPackageAliasesByName(name: SearchName): readonly PackageAliasEntity[];
13
16
  getTypeExtensions(): readonly TypeExtensionEntity[];
17
+ validateNameConflicts(diagnostics: DiagnosticAcceptor): void;
18
+ private getDiagnosticLocation;
14
19
  }
15
20
  export type NamedSourceFileMemberEntity = PackageTypeEntity | PackageVariableEntity | PackageFunctionEntity | PackageAliasEntity;
@@ -1,6 +1,7 @@
1
+ import { DiagnosticAcceptor } from '../diagnostic/Diagnostic.js';
1
2
  import { PackageVariableEntity } from '../entities/VariableEntity.js';
2
3
  import * as tree from '../tree/index.js';
3
4
  import { Analyzer } from './Analyzer.js';
4
5
  export declare class SourcePackageMembersCreator {
5
- static createMembersWithCompoundDeclarations(analyzer: Analyzer, memberList: tree.PackageMemberDeclarationList, resultingComputedVariables: Map<tree.Node, PackageVariableEntity>): void;
6
+ static createMembersWithCompoundDeclarations(analyzer: Analyzer, memberList: tree.PackageMemberDeclarationList, resultingComputedVariables: Map<tree.Node, PackageVariableEntity>, diagnostics: DiagnosticAcceptor | undefined): void;
6
7
  }
@@ -1,3 +1,4 @@
1
+ import { MaybeLazy } from '../common/index.js';
1
2
  import { Diagnostic } from '../diagnostic/Diagnostic.js';
2
3
  import { FunctionEntity, NamedTypeEntity, PackageAliasEntity } from '../entities/index.js';
3
4
  import { Tag } from '../tree/index.js';
@@ -26,9 +27,9 @@ export declare class Resolver {
26
27
  export declare class ResolutionResult {
27
28
  readonly meaning: Meaning;
28
29
  readonly resolvedQualifiers: readonly ResolvedQualifier[];
29
- readonly diagnostic?: Diagnostic | undefined;
30
+ readonly diagnostic?: MaybeLazy<Diagnostic> | undefined;
30
31
  readonly ambiguousDeclarations?: readonly WithLocalization<EntityOrPackageNameTreeNode>[] | undefined;
31
- constructor(meaning: Meaning, resolvedQualifiers: readonly ResolvedQualifier[], diagnostic?: Diagnostic | undefined, ambiguousDeclarations?: readonly WithLocalization<EntityOrPackageNameTreeNode>[] | undefined);
32
+ constructor(meaning: Meaning, resolvedQualifiers: readonly ResolvedQualifier[], diagnostic?: MaybeLazy<Diagnostic> | undefined, ambiguousDeclarations?: readonly WithLocalization<EntityOrPackageNameTreeNode>[] | undefined);
32
33
  }
33
34
  export type Meaning = Meaning_tagType | Meaning_tagFunction | Meaning_unresolved;
34
35
  declare class Meaning_tagType {
@@ -4,6 +4,8 @@ export declare class TypeInferrer {
4
4
  private readonly _analyzer;
5
5
  private _getType;
6
6
  private _typeInferringState;
7
+ private _hasDetectedInferenceCycle;
8
+ get hasDetectedInferenceCycle(): boolean;
7
9
  constructor(analyzer: Analyzer, getType: () => types.Type);
8
10
  inferType(): types.Type;
9
11
  }