@artel/artc 0.6.25296 → 0.6.25297

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/Cli.js CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  CommandLineCompiler
4
- } from "./chunk-ZTJ2IUQN.js";
5
- import "./chunk-CLTCG3EC.js";
4
+ } from "./chunk-B3ILQ5YL.js";
5
+ import "./chunk-BRNC4VYQ.js";
6
6
  import {
7
7
  __async
8
- } from "./chunk-MPZ5LBXG.js";
8
+ } from "./chunk-DUXHWL3M.js";
9
9
 
10
10
  // source/Cli.ts
11
11
  function main() {
package/build/api/Api.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Compiler
3
- } from "../chunk-CLTCG3EC.js";
3
+ } from "../chunk-BRNC4VYQ.js";
4
4
  import {
5
5
  AccessKind,
6
6
  AccessedFunctionParameter,
@@ -347,7 +347,7 @@ import {
347
347
  withoutQuotes,
348
348
  withoutTemplateQuotes,
349
349
  yieldTask
350
- } from "../chunk-MPZ5LBXG.js";
350
+ } from "../chunk-DUXHWL3M.js";
351
351
  export {
352
352
  AccessKind,
353
353
  AccessedFunctionParameter,
@@ -6,9 +6,9 @@ import {
6
6
  PhysicalFileSystem,
7
7
  PhysicalTypeScriptLibrariesProvider,
8
8
  PrintingDiagnosticAcceptor
9
- } from "../chunk-ZTJ2IUQN.js";
10
- import "../chunk-CLTCG3EC.js";
11
- import "../chunk-MPZ5LBXG.js";
9
+ } from "../chunk-B3ILQ5YL.js";
10
+ import "../chunk-BRNC4VYQ.js";
11
+ import "../chunk-DUXHWL3M.js";
12
12
  export {
13
13
  CommandLineCompiler,
14
14
  FileSystemUri,
@@ -183,7 +183,7 @@ import {
183
183
  unwrapParenthesizedExpressions,
184
184
  visitChildren,
185
185
  yieldTask
186
- } from "../chunk-MPZ5LBXG.js";
186
+ } from "../chunk-DUXHWL3M.js";
187
187
 
188
188
  // source/services/CustomRequests.ts
189
189
  import * as ls from "vscode-languageserver";
@@ -3577,13 +3577,6 @@ var CompletionService = class {
3577
3577
  const standardTypes = this.analyzer.getLocalizedStandardTypes(role.errorStatement.locale);
3578
3578
  return { targetTypes: [standardTypes.error, standardTypes.text], targetSignaturesParameters: void 0 };
3579
3579
  }
3580
- if (role.kind === "function-block-expression") {
3581
- const targetType = semanticContext.getContainingSubprogram()?.getReturnType();
3582
- if (targetType !== void 0 && !targetType.isNullType) {
3583
- return { targetTypes: [targetType], targetSignaturesParameters: void 0 };
3584
- }
3585
- return { targetTypes: void 0, targetSignaturesParameters: void 0 };
3586
- }
3587
3580
  if (role.kind === "other") {
3588
3581
  if (role.expressionForTargetType !== void 0) {
3589
3582
  const targetType = this.analyzer.getTargetTypeOfExpression(role.expressionForTargetType);
@@ -5029,12 +5022,6 @@ var ExpressionRole_errorValue = class {
5029
5022
  this.kind = "error-value";
5030
5023
  }
5031
5024
  };
5032
- var ExpressionRole_functionBlockExpression = class {
5033
- constructor(functionBlock) {
5034
- this.functionBlock = functionBlock;
5035
- this.kind = "function-block-expression";
5036
- }
5037
- };
5038
5025
  var ExpressionRole_other = class {
5039
5026
  constructor(expressionForTargetType) {
5040
5027
  this.expressionForTargetType = expressionForTargetType;
@@ -5158,18 +5145,10 @@ var SyntaxContextFactory = class {
5158
5145
  return { isExpressionContext: { expressionRole: new ExpressionRole_other(void 0) }, isStatementContext: true };
5159
5146
  }
5160
5147
  if (tokenOrKeyword.isToken(46 /* OpenBrace */) && tokenOrKeyword.parent.kind === 98 /* FunctionBlock */) {
5161
- const block = tokenOrKeyword.parent;
5162
- if (block.statementList.elements.length === 0) {
5163
- return {
5164
- isExpressionContext: { expressionRole: new ExpressionRole_functionBlockExpression(block) },
5165
- isStatementContext: true
5166
- };
5167
- } else {
5168
- return {
5169
- isExpressionContext: { expressionRole: new ExpressionRole_other(void 0) },
5170
- isStatementContext: true
5171
- };
5172
- }
5148
+ return {
5149
+ isExpressionContext: { expressionRole: new ExpressionRole_other(void 0) },
5150
+ isStatementContext: true
5151
+ };
5173
5152
  }
5174
5153
  if (tokenOrKeyword.isToken(58 /* Semicolon */) && tokenOrKeyword.parent.kind === 96 /* StatementList */) {
5175
5154
  return { isExpressionContext: { expressionRole: new ExpressionRole_other(void 0) }, isStatementContext: true };
@@ -9570,8 +9549,8 @@ var CompilationController = class extends SxObject2 {
9570
9549
  provideConfiguration: configurationProvider,
9571
9550
  userStandardPackagesUri: this.config.standardPackagesUri,
9572
9551
  builtInStandardPackagesUri: this.config.builtInStandardPackagesUri,
9573
- enableLogging: this.previousCompilationLoadResult === void 0,
9574
9552
  // Включаем логирование только при первой загрузке.
9553
+ enableLogging: this.config.enableLogging === true && this.previousCompilationLoadResult === void 0,
9575
9554
  additionalPackageContents: this.config.additionalPackageContents
9576
9555
  };
9577
9556
  const currentTransaction = Transaction.current;
@@ -11441,7 +11420,8 @@ var _Workspace = class _Workspace extends SxObject6 {
11441
11420
  standardPackagesUri: config.standardPackagesUri,
11442
11421
  showErrorMessage: config.showErrorMessage,
11443
11422
  builtInStandardPackagesUri: config.builtInStandardPackagesUri,
11444
- additionalPackageContents: config.additionalPackageContents
11423
+ additionalPackageContents: config.additionalPackageContents,
11424
+ enableLogging: config.enableLogging ?? false
11445
11425
  };
11446
11426
  const workspace = new _Workspace(configInternal);
11447
11427
  return workspace;
@@ -11626,7 +11606,8 @@ var _Workspace = class _Workspace extends SxObject6 {
11626
11606
  showErrorMessage: this.config.showErrorMessage,
11627
11607
  builtInStandardPackagesUri: this.config.builtInStandardPackagesUri,
11628
11608
  additionalPackageContents: this.config.additionalPackageContents,
11629
- tsInteropInputsCache: this.tsInteropInputsCache
11609
+ tsInteropInputsCache: this.tsInteropInputsCache,
11610
+ enableLogging: this.config.enableLogging
11630
11611
  };
11631
11612
  return new CompilationController(config);
11632
11613
  }
@@ -13329,7 +13310,8 @@ var _LanguageServer = class _LanguageServer {
13329
13310
  this.connection.window.showErrorMessage(message);
13330
13311
  }),
13331
13312
  builtInStandardPackagesUri,
13332
- additionalPackageContents: this.config.additionalPackageContents
13313
+ additionalPackageContents: this.config.additionalPackageContents,
13314
+ enableLogging: params.initializationOptions?.enableLogging
13333
13315
  };
13334
13316
  this.workspace = yield runTransactional2(() => Workspace.create(config));
13335
13317
  this.workspace.addWorkspaceFolders(workspaceFolderUris);
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Compiler
3
- } from "./chunk-CLTCG3EC.js";
3
+ } from "./chunk-BRNC4VYQ.js";
4
4
  import {
5
5
  ArtelVersion,
6
6
  Cached,
@@ -15,7 +15,7 @@ import {
15
15
  __async,
16
16
  performanceMeasurementStageNames,
17
17
  performanceMeasurementStages
18
- } from "./chunk-MPZ5LBXG.js";
18
+ } from "./chunk-DUXHWL3M.js";
19
19
 
20
20
  // source/executor/FileSystemUri.ts
21
21
  import { platform } from "os";
@@ -10,7 +10,7 @@ import {
10
10
  WellKnownDeclarationsLoadError,
11
11
  __async,
12
12
  createTsInteropInputsForCompilation
13
- } from "./chunk-MPZ5LBXG.js";
13
+ } from "./chunk-DUXHWL3M.js";
14
14
 
15
15
  // source/executor/Compiler.ts
16
16
  var Compiler = class {
@@ -764,7 +764,7 @@ var UniqueWithComparatorQuery = class extends Query {
764
764
  };
765
765
 
766
766
  // source/common/Constants.ts
767
- var ArtelVersion = true ? "0.6.25296" : "";
767
+ var ArtelVersion = true ? "0.6.25297" : "";
768
768
  var ArtelSourceFileExtensions = [".\u0430\u0440\u0442", ".\u0430\u0440\u0442\u0435\u043B\u044C", ".art", ".artel", ".\u0430\u0440\u0442\u043C", ".\u0430\u0440\u0442\u0435\u043B\u044C\u043C", ".artm", ".artelm"];
769
769
  var ArtelSourceFileExtensionSet = new Set(ArtelSourceFileExtensions);
770
770
  var ArtelSourceAndConfigurationFileExtensionSet = new Set(ArtelSourceFileExtensionSet).add(".json");
@@ -6975,8 +6975,8 @@ var russianKeywords = new Lazy(() => [
6975
6975
  { keyword: "\u0441\u043E\u0437\u0434\u0430\u043D\u0438\u0435", kind: 32 /* Creation */, flags: 12290 /* SingularNeuNoun */, dialects: [0 /* ArtelA */] },
6976
6976
  { keyword: "\u0441\u0441\u044B\u043B\u043A\u0430", kind: 55 /* Reference */, flags: 0 /* None */, dialects: [0 /* ArtelA */] },
6977
6977
  { keyword: "\u0442\u0438\u043F", kind: 17 /* Type */, flags: 9218 /* SingularMasNoun */, dialects: [0 /* ArtelA */, 1 /* ArtelM */] },
6978
- { keyword: "\u0443\u043D\u0438\u0447\u0442\u043E\u0436\u0438\u0442\u044C", kind: 47 /* Dispose */, flags: 0 /* None */, dialects: [0 /* ArtelA */] },
6979
- { keyword: "\u0443\u043D\u0438\u0447\u0442\u043E\u0436\u0435\u043D\u0438\u0435", kind: 48 /* Destruction */, flags: 12290 /* SingularNeuNoun */, dialects: [0 /* ArtelA */] },
6978
+ { keyword: "\u0440\u0430\u0437\u0440\u0443\u0448\u0438\u0442\u044C", kind: 47 /* Dispose */, flags: 0 /* None */, dialects: [0 /* ArtelA */] },
6979
+ { keyword: "\u0440\u0430\u0437\u0440\u0443\u0448\u0435\u043D\u0438\u0435", kind: 48 /* Destruction */, flags: 12290 /* SingularNeuNoun */, dialects: [0 /* ArtelA */] },
6980
6980
  { keyword: "\u0443\u0441\u043B", kind: 31 /* Cond */, flags: 0 /* None */, dialects: [1 /* ArtelM */] },
6981
6981
  { keyword: "\u0443\u0441\u043B\u043E\u0432\u043D\u043E", kind: 31 /* Cond */, flags: 0 /* None */, dialects: [0 /* ArtelA */] },
6982
6982
  { keyword: "\u0444\u0443\u043D\u043A\u0446\u0438\u044F", kind: 13 /* Function */, flags: 10242 /* SingularFemNoun */, dialects: [0 /* ArtelA */] },
@@ -9769,7 +9769,7 @@ var StructuredType2 = class {
9769
9769
  return this.entity.isAbstract();
9770
9770
  }
9771
9771
  equals(other, considerLocale = false) {
9772
- return this === other || other.kind === "structured" && (considerLocale ? this.entity === other.entity : this.entity.getOriginalEntity() === other.entity.getOriginalEntity()) && this.substitutions.equals(other.getSubstitutions());
9772
+ return this === other || other.kind === "structured" && (considerLocale ? this.entity === other.entity : this.entity.getOriginalEntity() === other.entity.getOriginalEntity()) && this.substitutions.equals(other.getSubstitutions(), considerLocale);
9773
9773
  }
9774
9774
  getEntity() {
9775
9775
  return this.entity;
@@ -10355,7 +10355,7 @@ var UnresolvedType2 = class {
10355
10355
  get debuggerDisplay() {
10356
10356
  return this.toString();
10357
10357
  }
10358
- equals(other) {
10358
+ equals(other, _considerLocale = false) {
10359
10359
  return other.kind === "unresolved";
10360
10360
  }
10361
10361
  getSubstitutions() {
@@ -33491,9 +33491,11 @@ var Resolver6 = class {
33491
33491
  }
33492
33492
  }
33493
33493
  const calleeType = this.analyzer.type.ofExpression(callee);
33494
- const essentialCalleeType = unaliasType(this.analyzer.excludeNullFromType(calleeType));
33494
+ const calleeTypeWithoutNull = this.analyzer.excludeNullFromType(calleeType);
33495
+ const essentialCalleeType = unaliasType(calleeTypeWithoutNull);
33495
33496
  if (essentialCalleeType.kind === "function") {
33496
- return this.resolveObjectFunctionCallExpression(essentialCalleeType);
33497
+ const isOriginalCalleeTypeNullable = !calleeTypeWithoutNull.equals(calleeType);
33498
+ return this.resolveObjectFunctionCallExpression(essentialCalleeType, isOriginalCalleeTypeNullable);
33497
33499
  }
33498
33500
  if (calleeType.kind !== "unresolved" && this.diagnostics !== void 0) {
33499
33501
  let nodeForDiagnostic = callee;
@@ -33634,7 +33636,13 @@ var Resolver6 = class {
33634
33636
  resolved.singleNotSuitableSubstitutedCandidate
33635
33637
  );
33636
33638
  }
33637
- resolveObjectFunctionCallExpression(type) {
33639
+ resolveObjectFunctionCallExpression(type, isOriginalCalleeTypeNullable) {
33640
+ if (isOriginalCalleeTypeNullable) {
33641
+ this.diagnostics?.addDiagnostic(this.analyzer.createDiagnostic(
33642
+ 2102 /* ExpressionCanBeNull */,
33643
+ this.node.expression
33644
+ ));
33645
+ }
33638
33646
  const signature = new FunctionTypeMatcherSignature2(this.analyzer, type);
33639
33647
  const args = this.node.argumentList.arguments.map((a) => new SourceArgument(this.analyzer, a)).toArray();
33640
33648
  const matcher_ = new ArgumentToParameterMatcher(this.analyzer, signature, args, this.diagnostics, this.node.argumentList);
@@ -33898,7 +33906,14 @@ var Resolver7 = class {
33898
33906
  }
33899
33907
  resolve() {
33900
33908
  let receiverType = this.analyzer.type.ofExpression(this.node.expression);
33901
- receiverType = this.analyzer.excludeNullFromType(receiverType);
33909
+ const receiverTypeWithoutNull = this.analyzer.excludeNullFromType(receiverType);
33910
+ if (!receiverTypeWithoutNull.equals(receiverType)) {
33911
+ this.diagnostics?.addDiagnostic(this.analyzer.createDiagnostic(
33912
+ 2102 /* ExpressionCanBeNull */,
33913
+ this.node.expression
33914
+ ));
33915
+ receiverType = receiverTypeWithoutNull;
33916
+ }
33902
33917
  if (receiverType.kind === "unresolved") {
33903
33918
  return new Meaning_unresolved4();
33904
33919
  }
@@ -34421,7 +34436,14 @@ var Resolver8 = class {
34421
34436
  }
34422
34437
  resolve() {
34423
34438
  let receiverType = this.analyzer.type.ofExpression(this.node.expression);
34424
- receiverType = this.analyzer.excludeNullFromType(receiverType);
34439
+ const receiverTypeWithoutNull = this.analyzer.excludeNullFromType(receiverType);
34440
+ if (!receiverTypeWithoutNull.equals(receiverType)) {
34441
+ this.diagnostics?.addDiagnostic(this.analyzer.createDiagnostic(
34442
+ 2102 /* ExpressionCanBeNull */,
34443
+ this.node.expression
34444
+ ));
34445
+ receiverType = receiverTypeWithoutNull;
34446
+ }
34425
34447
  if (receiverType.kind === "unresolved") {
34426
34448
  return new Meaning_unresolved6();
34427
34449
  }
@@ -34783,7 +34805,14 @@ var FirstStageResolver3 = class {
34783
34805
  }
34784
34806
  }
34785
34807
  resolveInstanceMemberAccessMeaning(type) {
34786
- type = this.analyzer.excludeNullFromType(type);
34808
+ const typeWithoutNull = this.analyzer.excludeNullFromType(type);
34809
+ if (!typeWithoutNull.equals(type)) {
34810
+ this.diagnostics?.addDiagnostic(this.analyzer.createDiagnostic(
34811
+ 2102 /* ExpressionCanBeNull */,
34812
+ this.receiver
34813
+ ));
34814
+ type = typeWithoutNull;
34815
+ }
34787
34816
  if (type.kind === "unresolved") {
34788
34817
  return new Meaning_unresolved7();
34789
34818
  }
@@ -50499,10 +50528,6 @@ var SourceFileAnalyzer = class {
50499
50528
  checkDereferenceExpression(node) {
50500
50529
  const meaning = this.analyzer.resolveDereferenceExpression(node);
50501
50530
  if (meaning.kind === "resolved") {
50502
- const receiverType = this.analyzer.type.ofExpression(node.expression);
50503
- if (this.analyzer.canTypeBeNull(receiverType)) {
50504
- this.addDiagnostic(this.analyzer.createDiagnostic(2102 /* ExpressionCanBeNull */, node.expression));
50505
- }
50506
50531
  const entity = meaning.operator.getEntity();
50507
50532
  if (this.isReceiverBaseAutoVariableAccess(node.expression) && TypeMemberEntity.isAbstract(entity)) {
50508
50533
  this.addDiagnostic(this.analyzer.createDiagnostic(
@@ -50515,10 +50540,6 @@ var SourceFileAnalyzer = class {
50515
50540
  checkIndexedAccessExpression(node) {
50516
50541
  const meaning = this.analyzer.resolveIndexedAccessExpression(node);
50517
50542
  if (meaning.kind !== "unresolved") {
50518
- const receiverType = this.analyzer.type.ofExpression(node.expression);
50519
- if (this.analyzer.canTypeBeNull(receiverType)) {
50520
- this.addDiagnostic(this.analyzer.createDiagnostic(2102 /* ExpressionCanBeNull */, node.expression));
50521
- }
50522
50543
  const entity = meaning.singleIndexer?.getEntity();
50523
50544
  if (entity !== void 0 && this.isReceiverBaseAutoVariableAccess(node.expression) && TypeMemberEntity.isAbstract(entity)) {
50524
50545
  const range = new Range(
@@ -50552,12 +50573,6 @@ var SourceFileAnalyzer = class {
50552
50573
  ));
50553
50574
  }
50554
50575
  }
50555
- if (meaning.kind === "object-function-call") {
50556
- const calleeType = this.analyzer.type.ofExpression(node.expression);
50557
- if (this.analyzer.canTypeBeNull(calleeType)) {
50558
- this.addDiagnostic(this.analyzer.createDiagnostic(2102 /* ExpressionCanBeNull */, node.expression));
50559
- }
50560
- }
50561
50576
  }
50562
50577
  addNotTranslatedTextsDiagnostics(translationPackage, diagnosticLocation) {
50563
50578
  const notTranslatedEntities = this.collectNotTranslatedTexts(translationPackage);
@@ -51248,12 +51263,6 @@ var SourceFileAnalyzer = class {
51248
51263
  default:
51249
51264
  Debug.never(meaning);
51250
51265
  }
51251
- if (meaning.kind === "instance-field-access" || meaning.kind === "instance-method-access" || meaning.kind === "operator-access") {
51252
- const receiverType = this.analyzer.type.ofExpression(node.expression);
51253
- if (this.analyzer.canTypeBeNull(receiverType)) {
51254
- this.addDiagnostic(this.analyzer.createDiagnostic(2102 /* ExpressionCanBeNull */, node.expression));
51255
- }
51256
- }
51257
51266
  }
51258
51267
  checkExpressionTypeIsAssignableToTargetType(node, targetType, diagnosticCode = 2032 /* Type0IsNotAssignableToType1 */) {
51259
51268
  if (targetType === void 0) {
@@ -127,6 +127,7 @@ export interface ArtelServerInitializationOptions {
127
127
  workspaceFoldersOverride?: ls.WorkspaceFolder[];
128
128
  localeOverride?: string;
129
129
  standardPackagesUri?: ls.URI;
130
+ enableLogging?: boolean;
130
131
  }
131
132
  export declare class ClientCancellationToken implements CancellationToken {
132
133
  private readonly token;
@@ -65,6 +65,7 @@ export interface CompilationControllerConfig {
65
65
  readonly builtInStandardPackagesUri?: Uri;
66
66
  readonly additionalPackageContents?: readonly PackageContent[];
67
67
  readonly tsInteropInputsCache?: TsInteropInputsCache;
68
+ readonly enableLogging?: boolean;
68
69
  }
69
70
  export declare enum CompilationControllerState {
70
71
  Created = 0,
@@ -60,4 +60,5 @@ export interface WorkspaceConfig {
60
60
  readonly showErrorMessage?: (message: string) => Promise<void>;
61
61
  readonly builtInStandardPackagesUri?: Uri;
62
62
  readonly additionalPackageContents?: readonly PackageContent[];
63
+ readonly enableLogging?: boolean;
63
64
  }
@@ -8,7 +8,7 @@ export declare class UnresolvedType implements IType {
8
8
  get isNullType(): boolean;
9
9
  get debuggerDisplay(): string;
10
10
  constructor(analyzer: Analyzer);
11
- equals(other: Type): boolean;
11
+ equals(other: Type, _considerLocale?: boolean): boolean;
12
12
  getSubstitutions(): Substitutions;
13
13
  applySubstitutions(_substitutions: Substitutions): Type;
14
14
  getEntity(): TypeEntity | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artel/artc",
3
- "version": "0.6.25296",
3
+ "version": "0.6.25297",
4
4
  "description": "Артель Компилятор | Artel Compiler",
5
5
  "author": "Nezaboodka Team <contact@nezaboodka.com>",
6
6
  "license": "LGPL-3.0-or-later",