@artel/artc 0.6.25295 → 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-Q6RADCFY.js";
5
- import "./chunk-MODTG45P.js";
4
+ } from "./chunk-B3ILQ5YL.js";
5
+ import "./chunk-BRNC4VYQ.js";
6
6
  import {
7
7
  __async
8
- } from "./chunk-YD2DEVJP.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-MODTG45P.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-YD2DEVJP.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-Q6RADCFY.js";
10
- import "../chunk-MODTG45P.js";
11
- import "../chunk-YD2DEVJP.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-YD2DEVJP.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 };
@@ -9542,7 +9521,9 @@ var CompilationController = class extends SxObject2 {
9542
9521
  });
9543
9522
  }
9544
9523
  dispose() {
9545
- Query.from(this.configurationControllerByPackageUri_.values()).map((c) => c.dispose());
9524
+ for (const controller of this.configurationControllerByPackageUri_.values()) {
9525
+ controller.dispose();
9526
+ }
9546
9527
  disposeSignallingObject2(this);
9547
9528
  }
9548
9529
  reloadMainCompilation() {
@@ -9568,8 +9549,8 @@ var CompilationController = class extends SxObject2 {
9568
9549
  provideConfiguration: configurationProvider,
9569
9550
  userStandardPackagesUri: this.config.standardPackagesUri,
9570
9551
  builtInStandardPackagesUri: this.config.builtInStandardPackagesUri,
9571
- enableLogging: this.previousCompilationLoadResult === void 0,
9572
9552
  // Включаем логирование только при первой загрузке.
9553
+ enableLogging: this.config.enableLogging === true && this.previousCompilationLoadResult === void 0,
9573
9554
  additionalPackageContents: this.config.additionalPackageContents
9574
9555
  };
9575
9556
  const currentTransaction = Transaction.current;
@@ -11439,7 +11420,8 @@ var _Workspace = class _Workspace extends SxObject6 {
11439
11420
  standardPackagesUri: config.standardPackagesUri,
11440
11421
  showErrorMessage: config.showErrorMessage,
11441
11422
  builtInStandardPackagesUri: config.builtInStandardPackagesUri,
11442
- additionalPackageContents: config.additionalPackageContents
11423
+ additionalPackageContents: config.additionalPackageContents,
11424
+ enableLogging: config.enableLogging ?? false
11443
11425
  };
11444
11426
  const workspace = new _Workspace(configInternal);
11445
11427
  return workspace;
@@ -11624,7 +11606,8 @@ var _Workspace = class _Workspace extends SxObject6 {
11624
11606
  showErrorMessage: this.config.showErrorMessage,
11625
11607
  builtInStandardPackagesUri: this.config.builtInStandardPackagesUri,
11626
11608
  additionalPackageContents: this.config.additionalPackageContents,
11627
- tsInteropInputsCache: this.tsInteropInputsCache
11609
+ tsInteropInputsCache: this.tsInteropInputsCache,
11610
+ enableLogging: this.config.enableLogging
11628
11611
  };
11629
11612
  return new CompilationController(config);
11630
11613
  }
@@ -13264,7 +13247,9 @@ var _LanguageServer = class _LanguageServer {
13264
13247
  this.connection.listen();
13265
13248
  }
13266
13249
  dispose() {
13267
- this.disposables.forEach((d) => d.dispose());
13250
+ this.disposables.forEach((d) => {
13251
+ d.dispose();
13252
+ });
13268
13253
  this.workspace.dispose();
13269
13254
  this.connection.dispose();
13270
13255
  }
@@ -13325,7 +13310,8 @@ var _LanguageServer = class _LanguageServer {
13325
13310
  this.connection.window.showErrorMessage(message);
13326
13311
  }),
13327
13312
  builtInStandardPackagesUri,
13328
- additionalPackageContents: this.config.additionalPackageContents
13313
+ additionalPackageContents: this.config.additionalPackageContents,
13314
+ enableLogging: params.initializationOptions?.enableLogging
13329
13315
  };
13330
13316
  this.workspace = yield runTransactional2(() => Workspace.create(config));
13331
13317
  this.workspace.addWorkspaceFolders(workspaceFolderUris);
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Compiler
3
- } from "./chunk-MODTG45P.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-YD2DEVJP.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-YD2DEVJP.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.25295" : "";
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() {
@@ -13378,6 +13378,7 @@ var DiagnosticCode = /* @__PURE__ */ ((DiagnosticCode2) => {
13378
13378
  DiagnosticCode2[DiagnosticCode2["PlainObjectFieldsMustBeConstant"] = 2218] = "PlainObjectFieldsMustBeConstant";
13379
13379
  DiagnosticCode2[DiagnosticCode2["PlainObjectFieldsMustBeConstantAutomaticallyCreatedStoredFieldIsNotConstant"] = 2219] = "PlainObjectFieldsMustBeConstantAutomaticallyCreatedStoredFieldIsNotConstant";
13380
13380
  DiagnosticCode2[DiagnosticCode2["FieldTypeCausesRecursivePlainObjectLayout"] = 2220] = "FieldTypeCausesRecursivePlainObjectLayout";
13381
+ DiagnosticCode2[DiagnosticCode2["QuestionOperatorCanBeUsedOnlyInSpecificExpressions"] = 2221] = "QuestionOperatorCanBeUsedOnlyInSpecificExpressions";
13381
13382
  DiagnosticCode2[DiagnosticCode2["CannotFindTsLibDirectoryBaseSearchPaths0"] = 3e3] = "CannotFindTsLibDirectoryBaseSearchPaths0";
13382
13383
  DiagnosticCode2[DiagnosticCode2["SourceFile0IsNotPartOfThePackageAndWontBeLoaded"] = 3001] = "SourceFile0IsNotPartOfThePackageAndWontBeLoaded";
13383
13384
  DiagnosticCode2[DiagnosticCode2["ProgramWithoutMainPackageCannotBeCompiled"] = 3002] = "ProgramWithoutMainPackageCannotBeCompiled";
@@ -13702,6 +13703,7 @@ var englishErrorMessages = {
13702
13703
  [2218 /* PlainObjectFieldsMustBeConstant */]: "Plain object fields must be constant.",
13703
13704
  [2219 /* PlainObjectFieldsMustBeConstantAutomaticallyCreatedStoredFieldIsNotConstant */]: "Plain object fields must be constant. Automatically created stored field is not constant.",
13704
13705
  [2220 /* FieldTypeCausesRecursivePlainObjectLayout */]: "Field type causes recursive plain object layout.",
13706
+ [2221 /* QuestionOperatorCanBeUsedOnlyInSpecificExpressions */]: "Question operator can be used only in member access, indexed access, dereference or call expressions.",
13705
13707
  [3e3 /* CannotFindTsLibDirectoryBaseSearchPaths0 */]: "Can not find directory with TypeScript library. Base search paths: {0}.",
13706
13708
  [3001 /* SourceFile0IsNotPartOfThePackageAndWontBeLoaded */]: "Source file '{0}' is not part of the package and won't be loaded.",
13707
13709
  [3002 /* ProgramWithoutMainPackageCannotBeCompiled */]: "Program without main package cannot be compiled.",
@@ -13980,6 +13982,7 @@ var russianErrorMessages = {
13980
13982
  [2218 /* PlainObjectFieldsMustBeConstant */]: "\u041F\u043E\u043B\u044F \u043F\u0440\u043E\u0441\u0442\u043E\u0433\u043E \u043E\u0431\u044A\u0435\u043A\u0442\u0430 \u0434\u043E\u043B\u0436\u043D\u044B \u0431\u044B\u0442\u044C \u043A\u043E\u043D\u0441\u0442\u0430\u043D\u0442\u043D\u044B\u043C\u0438.",
13981
13983
  [2219 /* PlainObjectFieldsMustBeConstantAutomaticallyCreatedStoredFieldIsNotConstant */]: "\u041F\u043E\u043B\u044F \u043F\u0440\u043E\u0441\u0442\u043E\u0433\u043E \u043E\u0431\u044A\u0435\u043A\u0442\u0430 \u0434\u043E\u043B\u0436\u043D\u044B \u0431\u044B\u0442\u044C \u043A\u043E\u043D\u0441\u0442\u0430\u043D\u0442\u043D\u044B\u043C\u0438. \u0410\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0438 \u0441\u043E\u0437\u0434\u0430\u043D\u043D\u043E\u0435 \u0445\u0440\u0430\u043D\u0438\u043C\u043E\u0435 \u043F\u043E\u043B\u0435 \u043D\u0435 \u044F\u0432\u043B\u044F\u0435\u0442\u0441\u044F \u043A\u043E\u043D\u0441\u0442\u0430\u043D\u0442\u043D\u044B\u043C.",
13982
13984
  [2220 /* FieldTypeCausesRecursivePlainObjectLayout */]: "\u0422\u0438\u043F \u043F\u043E\u043B\u044F \u043F\u0440\u0438\u0432\u043E\u0434\u0438\u0442 \u043A \u0440\u0435\u043A\u0443\u0440\u0441\u0438\u0432\u043D\u043E\u0439 \u0441\u0442\u0440\u0443\u043A\u0442\u0443\u0440\u0435 \u043F\u0440\u043E\u0441\u0442\u043E\u0433\u043E \u043E\u0431\u044A\u0435\u043A\u0442\u0430.",
13985
+ [2221 /* QuestionOperatorCanBeUsedOnlyInSpecificExpressions */]: "\u041E\u043F\u0435\u0440\u0430\u0442\u043E\u0440 '?' \u043C\u043E\u0436\u0435\u0442 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C\u0441\u044F \u0442\u043E\u043B\u044C\u043A\u043E \u0432 \u0432\u044B\u0440\u0430\u0436\u0435\u043D\u0438\u044F\u0445 \u0434\u043E\u0441\u0442\u0443\u043F\u0430 \u043F\u043E \u0438\u043C\u0435\u043D\u0438, \u0434\u043E\u0441\u0442\u0443\u043F\u0430 \u043F\u043E \u0438\u043D\u0434\u0435\u043A\u0441\u0443, \u0434\u043E\u0441\u0442\u0443\u043F\u0430 \u043F\u043E \u0441\u0441\u044B\u043B\u043A\u0435 \u0438 \u0432\u044B\u0437\u043E\u0432\u0430.",
13983
13986
  [3e3 /* CannotFindTsLibDirectoryBaseSearchPaths0 */]: "\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043D\u0430\u0439\u0442\u0438 \u043F\u0430\u043F\u043A\u0443 \u0441\u043E \u0441\u0442\u0430\u043D\u0434\u0430\u0440\u0442\u043D\u043E\u0439 \u0431\u0438\u0431\u043B\u0438\u043E\u0442\u0435\u043A\u043E\u0439 TypeScript. \u041F\u0443\u0442\u0438, \u043E\u0442\u043D\u043E\u0441\u0438\u0442\u0435\u043B\u044C\u043D\u043E \u043A\u043E\u0442\u043E\u0440\u044B\u0445 \u043E\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043B\u044F\u043B\u0441\u044F \u043F\u043E\u0438\u0441\u043A: {0}.",
13984
13987
  [3001 /* SourceFile0IsNotPartOfThePackageAndWontBeLoaded */]: "\u0418\u0441\u0445\u043E\u0434\u043D\u044B\u0439 \u0444\u0430\u0439\u043B '{0}' \u043D\u0435 \u044F\u0432\u043B\u044F\u0435\u0442\u0441\u044F \u0447\u0430\u0441\u0442\u044C\u044E \u043F\u0430\u043A\u0435\u0442\u0430 \u0438 \u043D\u0435 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043D.",
13985
13988
  [3002 /* ProgramWithoutMainPackageCannotBeCompiled */]: "\u041F\u0440\u043E\u0433\u0440\u0430\u043C\u043C\u0430 \u0431\u0435\u0437 \u0433\u043B\u0430\u0432\u043D\u043E\u0433\u043E \u043F\u0430\u043A\u0435\u0442\u0430 \u043D\u0435 \u043C\u043E\u0436\u0435\u0442 \u0431\u044B\u0442\u044C \u0441\u043A\u043E\u043C\u043F\u0438\u043B\u0438\u0440\u043E\u0432\u0430\u043D\u0430.",
@@ -33488,9 +33491,11 @@ var Resolver6 = class {
33488
33491
  }
33489
33492
  }
33490
33493
  const calleeType = this.analyzer.type.ofExpression(callee);
33491
- const essentialCalleeType = unaliasType(this.analyzer.excludeNullFromType(calleeType));
33494
+ const calleeTypeWithoutNull = this.analyzer.excludeNullFromType(calleeType);
33495
+ const essentialCalleeType = unaliasType(calleeTypeWithoutNull);
33492
33496
  if (essentialCalleeType.kind === "function") {
33493
- return this.resolveObjectFunctionCallExpression(essentialCalleeType);
33497
+ const isOriginalCalleeTypeNullable = !calleeTypeWithoutNull.equals(calleeType);
33498
+ return this.resolveObjectFunctionCallExpression(essentialCalleeType, isOriginalCalleeTypeNullable);
33494
33499
  }
33495
33500
  if (calleeType.kind !== "unresolved" && this.diagnostics !== void 0) {
33496
33501
  let nodeForDiagnostic = callee;
@@ -33631,7 +33636,13 @@ var Resolver6 = class {
33631
33636
  resolved.singleNotSuitableSubstitutedCandidate
33632
33637
  );
33633
33638
  }
33634
- 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
+ }
33635
33646
  const signature = new FunctionTypeMatcherSignature2(this.analyzer, type);
33636
33647
  const args = this.node.argumentList.arguments.map((a) => new SourceArgument(this.analyzer, a)).toArray();
33637
33648
  const matcher_ = new ArgumentToParameterMatcher(this.analyzer, signature, args, this.diagnostics, this.node.argumentList);
@@ -33895,7 +33906,14 @@ var Resolver7 = class {
33895
33906
  }
33896
33907
  resolve() {
33897
33908
  let receiverType = this.analyzer.type.ofExpression(this.node.expression);
33898
- 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
+ }
33899
33917
  if (receiverType.kind === "unresolved") {
33900
33918
  return new Meaning_unresolved4();
33901
33919
  }
@@ -34418,7 +34436,14 @@ var Resolver8 = class {
34418
34436
  }
34419
34437
  resolve() {
34420
34438
  let receiverType = this.analyzer.type.ofExpression(this.node.expression);
34421
- 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
+ }
34422
34447
  if (receiverType.kind === "unresolved") {
34423
34448
  return new Meaning_unresolved6();
34424
34449
  }
@@ -34780,7 +34805,14 @@ var FirstStageResolver3 = class {
34780
34805
  }
34781
34806
  }
34782
34807
  resolveInstanceMemberAccessMeaning(type) {
34783
- 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
+ }
34784
34816
  if (type.kind === "unresolved") {
34785
34817
  return new Meaning_unresolved7();
34786
34818
  }
@@ -50023,9 +50055,28 @@ var SourceFileAnalyzer = class {
50023
50055
  this.analyzer.resolveOwnConstructorCallExpression(node);
50024
50056
  break;
50025
50057
  }
50058
+ case 64 /* AssumptionExpression */: {
50059
+ this.checkAssumptionExpression(node);
50060
+ break;
50061
+ }
50026
50062
  }
50027
50063
  return void 0;
50028
50064
  }
50065
+ checkAssumptionExpression(node) {
50066
+ const parent = getParentSkippingParenthesizedExpressions(node);
50067
+ switch (parent.kind) {
50068
+ case 78 /* MemberAccessExpression */:
50069
+ case 70 /* CallExpression */:
50070
+ case 72 /* IndexedAccessExpression */:
50071
+ case 80 /* DereferenceExpression */:
50072
+ break;
50073
+ default:
50074
+ this.addDiagnostic(this.analyzer.createDiagnostic(
50075
+ 2221 /* QuestionOperatorCanBeUsedOnlyInSpecificExpressions */,
50076
+ node.questionToken
50077
+ ));
50078
+ }
50079
+ }
50029
50080
  checkStatementBlock(node) {
50030
50081
  const semanticContext = this.analyzer.semanticContext.ofStatementBlock(node);
50031
50082
  semanticContext.validateNameConflicts(this.diagnosticAcceptor);
@@ -50477,10 +50528,6 @@ var SourceFileAnalyzer = class {
50477
50528
  checkDereferenceExpression(node) {
50478
50529
  const meaning = this.analyzer.resolveDereferenceExpression(node);
50479
50530
  if (meaning.kind === "resolved") {
50480
- const receiverType = this.analyzer.type.ofExpression(node.expression);
50481
- if (this.analyzer.canTypeBeNull(receiverType)) {
50482
- this.addDiagnostic(this.analyzer.createDiagnostic(2102 /* ExpressionCanBeNull */, node.expression));
50483
- }
50484
50531
  const entity = meaning.operator.getEntity();
50485
50532
  if (this.isReceiverBaseAutoVariableAccess(node.expression) && TypeMemberEntity.isAbstract(entity)) {
50486
50533
  this.addDiagnostic(this.analyzer.createDiagnostic(
@@ -50493,10 +50540,6 @@ var SourceFileAnalyzer = class {
50493
50540
  checkIndexedAccessExpression(node) {
50494
50541
  const meaning = this.analyzer.resolveIndexedAccessExpression(node);
50495
50542
  if (meaning.kind !== "unresolved") {
50496
- const receiverType = this.analyzer.type.ofExpression(node.expression);
50497
- if (this.analyzer.canTypeBeNull(receiverType)) {
50498
- this.addDiagnostic(this.analyzer.createDiagnostic(2102 /* ExpressionCanBeNull */, node.expression));
50499
- }
50500
50543
  const entity = meaning.singleIndexer?.getEntity();
50501
50544
  if (entity !== void 0 && this.isReceiverBaseAutoVariableAccess(node.expression) && TypeMemberEntity.isAbstract(entity)) {
50502
50545
  const range = new Range(
@@ -50530,12 +50573,6 @@ var SourceFileAnalyzer = class {
50530
50573
  ));
50531
50574
  }
50532
50575
  }
50533
- if (meaning.kind === "object-function-call") {
50534
- const calleeType = this.analyzer.type.ofExpression(node.expression);
50535
- if (this.analyzer.canTypeBeNull(calleeType)) {
50536
- this.addDiagnostic(this.analyzer.createDiagnostic(2102 /* ExpressionCanBeNull */, node.expression));
50537
- }
50538
- }
50539
50576
  }
50540
50577
  addNotTranslatedTextsDiagnostics(translationPackage, diagnosticLocation) {
50541
50578
  const notTranslatedEntities = this.collectNotTranslatedTexts(translationPackage);
@@ -51226,12 +51263,6 @@ var SourceFileAnalyzer = class {
51226
51263
  default:
51227
51264
  Debug.never(meaning);
51228
51265
  }
51229
- if (meaning.kind === "instance-field-access" || meaning.kind === "instance-method-access" || meaning.kind === "operator-access") {
51230
- const receiverType = this.analyzer.type.ofExpression(node.expression);
51231
- if (this.analyzer.canTypeBeNull(receiverType)) {
51232
- this.addDiagnostic(this.analyzer.createDiagnostic(2102 /* ExpressionCanBeNull */, node.expression));
51233
- }
51234
- }
51235
51266
  }
51236
51267
  checkExpressionTypeIsAssignableToTargetType(node, targetType, diagnosticCode = 2032 /* Type0IsNotAssignableToType1 */) {
51237
51268
  if (targetType === void 0) {
@@ -20,6 +20,7 @@ export declare class SourceFileAnalyzer {
20
20
  constructor(analyzer: Analyzer, sourceFile: project.SourceFile);
21
21
  analyze(taskController: TaskController): Promise<Diagnostic[]>;
22
22
  private analyzeNode;
23
+ private checkAssumptionExpression;
23
24
  private checkStatementBlock;
24
25
  private checkFunctionBlock;
25
26
  private checkPackageStructuredTypeDeclaration;
@@ -257,6 +257,7 @@ export declare enum DiagnosticCode {
257
257
  PlainObjectFieldsMustBeConstant = 2218,
258
258
  PlainObjectFieldsMustBeConstantAutomaticallyCreatedStoredFieldIsNotConstant = 2219,
259
259
  FieldTypeCausesRecursivePlainObjectLayout = 2220,
260
+ QuestionOperatorCanBeUsedOnlyInSpecificExpressions = 2221,
260
261
  CannotFindTsLibDirectoryBaseSearchPaths0 = 3000,
261
262
  SourceFile0IsNotPartOfThePackageAndWontBeLoaded = 3001,
262
263
  ProgramWithoutMainPackageCannotBeCompiled = 3002,
@@ -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.25295",
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",