@artel/artc 0.6.26021 → 0.6.26022
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 +3 -3
- package/build/api/Api.js +2 -2
- package/build/api/ApiNodeJS.js +3 -3
- package/build/api/ApiServices.js +5 -7
- package/build/{chunk-DWHH53A7.js → chunk-KCEJTV3Q.js} +153 -10
- package/build/{chunk-NKLHVPAI.js → chunk-PCY52KYM.js} +1 -1
- package/build/{chunk-BUGHCVWW.js → chunk-WXKN3LZG.js} +2 -2
- package/build/types/analysis/Analyzer.d.ts +9 -0
- package/build/types/analysis/a/SourceFileAnalyzer.d.ts +1 -0
- package/build/types/diagnostic/DiagnosticCode.d.ts +1 -0
- package/build/types/entities/Entity.d.ts +1 -1
- package/build/types/entities/interfaces/VariableEntity.d.ts +2 -2
- package/package.json +1 -1
package/build/Cli.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
CommandLineCompiler
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-WXKN3LZG.js";
|
|
5
|
+
import "./chunk-PCY52KYM.js";
|
|
6
6
|
import {
|
|
7
7
|
__async
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-KCEJTV3Q.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-
|
|
3
|
+
} from "../chunk-PCY52KYM.js";
|
|
4
4
|
import {
|
|
5
5
|
AccessKind,
|
|
6
6
|
AccessedFunction_entity,
|
|
@@ -281,7 +281,7 @@ import {
|
|
|
281
281
|
withoutQuotes,
|
|
282
282
|
withoutTemplateQuotes,
|
|
283
283
|
yieldTask
|
|
284
|
-
} from "../chunk-
|
|
284
|
+
} from "../chunk-KCEJTV3Q.js";
|
|
285
285
|
export {
|
|
286
286
|
AccessKind,
|
|
287
287
|
AccessedFunction_entity,
|
package/build/api/ApiNodeJS.js
CHANGED
|
@@ -6,9 +6,9 @@ import {
|
|
|
6
6
|
PhysicalFileSystem,
|
|
7
7
|
PhysicalTypeScriptLibrariesProvider,
|
|
8
8
|
PrintingDiagnosticAcceptor
|
|
9
|
-
} from "../chunk-
|
|
10
|
-
import "../chunk-
|
|
11
|
-
import "../chunk-
|
|
9
|
+
} from "../chunk-WXKN3LZG.js";
|
|
10
|
+
import "../chunk-PCY52KYM.js";
|
|
11
|
+
import "../chunk-KCEJTV3Q.js";
|
|
12
12
|
export {
|
|
13
13
|
CommandLineCompiler,
|
|
14
14
|
FileSystemUri,
|
package/build/api/ApiServices.js
CHANGED
|
@@ -110,7 +110,7 @@ import {
|
|
|
110
110
|
sortModifiers,
|
|
111
111
|
traverseTreeAsync,
|
|
112
112
|
yieldTask
|
|
113
|
-
} from "../chunk-
|
|
113
|
+
} from "../chunk-KCEJTV3Q.js";
|
|
114
114
|
|
|
115
115
|
// source/services/CustomRequests.ts
|
|
116
116
|
import * as ls from "vscode-languageserver";
|
|
@@ -10848,12 +10848,10 @@ var EntityFinder = class {
|
|
|
10848
10848
|
}
|
|
10849
10849
|
} else if (entity.subkind === "parameter") {
|
|
10850
10850
|
const originalContainingEntity = entity.getContainingEntity();
|
|
10851
|
-
|
|
10852
|
-
|
|
10853
|
-
|
|
10854
|
-
|
|
10855
|
-
return this.ifEntityWithParametersThenParameters(containingEntity)?.[index];
|
|
10856
|
-
}
|
|
10851
|
+
const index = originalContainingEntity.getParameters().indexOf(entity);
|
|
10852
|
+
const containingEntity = this.findEntity(originalContainingEntity);
|
|
10853
|
+
if (containingEntity !== void 0 && index >= 0) {
|
|
10854
|
+
return this.ifEntityWithParametersThenParameters(containingEntity)?.[index];
|
|
10857
10855
|
}
|
|
10858
10856
|
}
|
|
10859
10857
|
return void 0;
|
|
@@ -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.
|
|
767
|
+
var ArtelVersion = true ? "0.6.26022" : "";
|
|
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");
|
|
@@ -4482,7 +4482,7 @@ function isEntityWithTypeParameters(entity) {
|
|
|
4482
4482
|
return false;
|
|
4483
4483
|
}
|
|
4484
4484
|
function isEntityWithParameters(entity) {
|
|
4485
|
-
if (entity.kind === 1 /* Function */ || entity.kind === 2 /* Type */ && entity.typeEntityKind === 0 /* Function */ || entity.kind === 7 /* Constructor */ || entity.kind === 8 /* Destructor */ || entity.kind === 5 /* Indexer */) {
|
|
4485
|
+
if (entity.kind === 1 /* Function */ || entity.kind === 2 /* Type */ && entity.typeEntityKind === 0 /* Function */ || entity.kind === 7 /* Constructor */ || entity.kind === 8 /* Destructor */ || entity.kind === 5 /* Indexer */ || entity.kind === 13 /* TextTranslation */) {
|
|
4486
4486
|
return true;
|
|
4487
4487
|
}
|
|
4488
4488
|
Debug.typeIsAssignableTo();
|
|
@@ -12437,6 +12437,7 @@ var DiagnosticCode = /* @__PURE__ */ ((DiagnosticCode2) => {
|
|
|
12437
12437
|
DiagnosticCode2[DiagnosticCode2["OperatorCannotBeAsync"] = 2228] = "OperatorCannotBeAsync";
|
|
12438
12438
|
DiagnosticCode2[DiagnosticCode2["OperatorCannotContainTypeParameterDeclarations"] = 2229] = "OperatorCannotContainTypeParameterDeclarations";
|
|
12439
12439
|
DiagnosticCode2[DiagnosticCode2["TypeNameExpectedAtLastQualifier"] = 2230] = "TypeNameExpectedAtLastQualifier";
|
|
12440
|
+
DiagnosticCode2[DiagnosticCode2["ExpressionsWithTypes0And1CannotBeCompared"] = 2231] = "ExpressionsWithTypes0And1CannotBeCompared";
|
|
12440
12441
|
DiagnosticCode2[DiagnosticCode2["CannotFindTsLibDirectoryBaseSearchPaths0"] = 3e3] = "CannotFindTsLibDirectoryBaseSearchPaths0";
|
|
12441
12442
|
DiagnosticCode2[DiagnosticCode2["SourceFile0IsNotPartOfThePackageAndWontBeLoaded"] = 3001] = "SourceFile0IsNotPartOfThePackageAndWontBeLoaded";
|
|
12442
12443
|
DiagnosticCode2[DiagnosticCode2["ProgramWithoutMainPackageCannotBeCompiled"] = 3002] = "ProgramWithoutMainPackageCannotBeCompiled";
|
|
@@ -12771,6 +12772,7 @@ var englishErrorMessages = {
|
|
|
12771
12772
|
[2228 /* OperatorCannotBeAsync */]: "Operator cannot be async.",
|
|
12772
12773
|
[2229 /* OperatorCannotContainTypeParameterDeclarations */]: "Operator cannot contain type parameter declarations.",
|
|
12773
12774
|
[2230 /* TypeNameExpectedAtLastQualifier */]: "Type name expected.",
|
|
12775
|
+
[2231 /* ExpressionsWithTypes0And1CannotBeCompared */]: "Expressions with types '{0}' and '{1}' cannot be compared.",
|
|
12774
12776
|
[3e3 /* CannotFindTsLibDirectoryBaseSearchPaths0 */]: "Can not find directory with TypeScript library. Base search paths: {0}.",
|
|
12775
12777
|
[3001 /* SourceFile0IsNotPartOfThePackageAndWontBeLoaded */]: "Source file '{0}' is not part of the package and won't be loaded.",
|
|
12776
12778
|
[3002 /* ProgramWithoutMainPackageCannotBeCompiled */]: "Program without main package cannot be compiled.",
|
|
@@ -13059,6 +13061,7 @@ var russianErrorMessages = {
|
|
|
13059
13061
|
[2228 /* OperatorCannotBeAsync */]: "\u0424\u0443\u043D\u043A\u0446\u0438\u044F \u043E\u043F\u0435\u0440\u0430\u0446\u0438\u0438 \u043D\u0435 \u043C\u043E\u0436\u0435\u0442 \u0431\u044B\u0442\u044C \u0430\u0441\u0438\u043D\u0445\u0440\u043E\u043D\u043D\u043E\u0439.",
|
|
13060
13062
|
[2229 /* OperatorCannotContainTypeParameterDeclarations */]: "\u0424\u0443\u043D\u043A\u0446\u0438\u044F \u043E\u043F\u0435\u0440\u0430\u0446\u0438\u0438 \u043D\u0435 \u043C\u043E\u0436\u0435\u0442 \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0442\u044C \u043E\u0431\u044A\u044F\u0432\u043B\u0435\u043D\u0438\u044F \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u043E\u0432 \u0442\u0438\u043F\u0430.",
|
|
13061
13063
|
[2230 /* TypeNameExpectedAtLastQualifier */]: "\u041E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C \u0438\u043C\u044F \u0442\u0438\u043F\u0430.",
|
|
13064
|
+
[2231 /* ExpressionsWithTypes0And1CannotBeCompared */]: "\u041D\u0435\u043B\u044C\u0437\u044F \u0441\u0440\u0430\u0432\u043D\u0438\u0442\u044C \u0432\u044B\u0440\u0430\u0436\u0435\u043D\u0438\u044F \u0441 \u0442\u0438\u043F\u0430\u043C\u0438 '{0}' \u0438 '{1}'.",
|
|
13062
13065
|
[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}.",
|
|
13063
13066
|
[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.",
|
|
13064
13067
|
[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.",
|
|
@@ -18917,7 +18920,7 @@ var DisplayServiceA = class extends BaseDisplayService {
|
|
|
18917
18920
|
const asyncKeyword = func.isAsync() ? `${this.displayKeyword(44 /* Async */)} ` : "";
|
|
18918
18921
|
const keyword = this.displayKeyword(16 /* Function */);
|
|
18919
18922
|
const operatorKind = func.getOperatorKind();
|
|
18920
|
-
const name = operatorKind === void 0 ? this.common.displayEntityName(func.getEntity()) : this.displayOperatorKind(operatorKind)
|
|
18923
|
+
const name = operatorKind === void 0 ? this.common.displayEntityName(func.getEntity()) : `'${this.displayOperatorKind(operatorKind)}'`;
|
|
18921
18924
|
const typeParameters = func.getTypeParameterValues().map((t) => this.displayTypeParameterValue(t));
|
|
18922
18925
|
const typeParametersStart = typeParameters.length > 0 ? "<" : "";
|
|
18923
18926
|
const typeParametersEnd = typeParameters.length > 0 ? ">" : "";
|
|
@@ -21500,8 +21503,9 @@ var EntityLocalizationContext = class {
|
|
|
21500
21503
|
const localizedDestructor = this.getLocalizedDestructorEntity(containingEntity);
|
|
21501
21504
|
return localizedDestructor.getParameters().find((p) => p.getOriginalEntity() === entity) ?? entity;
|
|
21502
21505
|
}
|
|
21503
|
-
case
|
|
21506
|
+
case 13 /* TextTranslation */: {
|
|
21504
21507
|
return entity;
|
|
21508
|
+
}
|
|
21505
21509
|
default:
|
|
21506
21510
|
Debug.never(containingEntity);
|
|
21507
21511
|
}
|
|
@@ -50889,7 +50893,7 @@ var FunctionBlockLiteralEntity = class {
|
|
|
50889
50893
|
return targetType?.getParameters().map((p) => new IntrinsicParameterEntity(
|
|
50890
50894
|
p.getEntity().getName(),
|
|
50891
50895
|
p.getType(),
|
|
50892
|
-
this
|
|
50896
|
+
this,
|
|
50893
50897
|
p.isOptional(),
|
|
50894
50898
|
p.isVariadic(),
|
|
50895
50899
|
p.isObjectParameter(),
|
|
@@ -54128,7 +54132,7 @@ var TranslationTextTemplateParameterEntity = class {
|
|
|
54128
54132
|
this.name = analyzer.createNameFromIdentifier(node.name);
|
|
54129
54133
|
}
|
|
54130
54134
|
getContainingEntity() {
|
|
54131
|
-
return
|
|
54135
|
+
return this.analyzer.entity.ofTextTranslationDeclaration(this.node.parent.parent.parent);
|
|
54132
54136
|
}
|
|
54133
54137
|
getName() {
|
|
54134
54138
|
return this.name;
|
|
@@ -58510,10 +58514,7 @@ var SourceFileAnalyzer = class {
|
|
|
58510
58514
|
break;
|
|
58511
58515
|
}
|
|
58512
58516
|
case 61 /* BinaryExpression */: {
|
|
58513
|
-
|
|
58514
|
-
if (classificationResult.kind === "user-definable") {
|
|
58515
|
-
this.analyzer.resolveBinaryExpressionUserDefinableOperator(node, classificationResult.operatorKind);
|
|
58516
|
-
}
|
|
58517
|
+
this.checkBinaryExpression(node);
|
|
58517
58518
|
break;
|
|
58518
58519
|
}
|
|
58519
58520
|
case 90 /* AssignmentStatement */: {
|
|
@@ -58763,6 +58764,34 @@ var SourceFileAnalyzer = class {
|
|
|
58763
58764
|
}
|
|
58764
58765
|
return void 0;
|
|
58765
58766
|
}
|
|
58767
|
+
checkBinaryExpression(node) {
|
|
58768
|
+
const classificationResult = this.analyzer.classifyBinaryExpressionOperator(node.operator);
|
|
58769
|
+
switch (classificationResult.kind) {
|
|
58770
|
+
case "user-definable":
|
|
58771
|
+
this.analyzer.resolveBinaryExpressionUserDefinableOperator(node, classificationResult.operatorKind);
|
|
58772
|
+
break;
|
|
58773
|
+
case "equals":
|
|
58774
|
+
case "not-equals": {
|
|
58775
|
+
const leftType = this.analyzer.type.ofExpression(node.left);
|
|
58776
|
+
const rightType = this.analyzer.type.ofExpression(node.right);
|
|
58777
|
+
if (!this.analyzer.typeUtils.areTypesComparable(leftType, rightType)) {
|
|
58778
|
+
this.createAndAddDiagnostic(
|
|
58779
|
+
2231 /* ExpressionsWithTypes0And1CannotBeCompared */,
|
|
58780
|
+
node.operator,
|
|
58781
|
+
[
|
|
58782
|
+
this.diagnosticArgumentFactory.createDisplayableType(leftType),
|
|
58783
|
+
this.diagnosticArgumentFactory.createDisplayableType(rightType)
|
|
58784
|
+
]
|
|
58785
|
+
);
|
|
58786
|
+
}
|
|
58787
|
+
break;
|
|
58788
|
+
}
|
|
58789
|
+
case "question-question":
|
|
58790
|
+
break;
|
|
58791
|
+
default:
|
|
58792
|
+
Debug.never(classificationResult);
|
|
58793
|
+
}
|
|
58794
|
+
}
|
|
58766
58795
|
checkPackageVariantDeclaration(node) {
|
|
58767
58796
|
if (node.typeParameterClause !== void 0) {
|
|
58768
58797
|
this.analyzer.semanticContext.ofTypeDeclarationTypeParameters(node, node.typeParameterClause).validateNameConflicts(this.diagnosticAcceptor);
|
|
@@ -61754,6 +61783,9 @@ var Analyzer = class {
|
|
|
61754
61783
|
get typeAssignabilityCheck() {
|
|
61755
61784
|
return this.state.typeAssignabilityCheck;
|
|
61756
61785
|
}
|
|
61786
|
+
get typeComparabilityCheck() {
|
|
61787
|
+
return this.state.typeComparabilityCheck;
|
|
61788
|
+
}
|
|
61757
61789
|
get overriddenMember() {
|
|
61758
61790
|
return this.state.overriddenMember;
|
|
61759
61791
|
}
|
|
@@ -61855,6 +61887,9 @@ var Analyzer = class {
|
|
|
61855
61887
|
getTypeAssignabilityFlags(source, target) {
|
|
61856
61888
|
return this.typeAssignabilityCheck.getAssignabilityFlags(source, target);
|
|
61857
61889
|
}
|
|
61890
|
+
isTypeComparableTo(source, target) {
|
|
61891
|
+
return this.typeComparabilityCheck.isTypeComparableTo(source, target);
|
|
61892
|
+
}
|
|
61858
61893
|
getUnambiguousTargetFunctionType(targetType) {
|
|
61859
61894
|
if (targetType !== void 0) {
|
|
61860
61895
|
const unaliasedType = targetType.unalias();
|
|
@@ -62915,6 +62950,7 @@ var CommonAnalyzerState = class {
|
|
|
62915
62950
|
initialize(analyzer) {
|
|
62916
62951
|
this.typeFactory = new TypeFactory(analyzer);
|
|
62917
62952
|
this.typeAssignabilityCheck = new TypeAssignabilityCheck(analyzer);
|
|
62953
|
+
this.typeComparabilityCheck = new TypeComparabilityCheck(analyzer);
|
|
62918
62954
|
this.implementation = new ImplementationEntity(analyzer);
|
|
62919
62955
|
this.typeUtils = new TypeUtils2(analyzer);
|
|
62920
62956
|
this.signatureComparer = new SignatureComparer(analyzer);
|
|
@@ -63996,6 +64032,98 @@ var TypeAssignabilityCheck = class {
|
|
|
63996
64032
|
return result;
|
|
63997
64033
|
}
|
|
63998
64034
|
};
|
|
64035
|
+
var TypeComparabilityCheck = class {
|
|
64036
|
+
constructor(analyzer) {
|
|
64037
|
+
this.analyzer = analyzer;
|
|
64038
|
+
}
|
|
64039
|
+
isTypeComparableTo(source, target) {
|
|
64040
|
+
source = source.unaliasAndGetReductionSource();
|
|
64041
|
+
target = target.unaliasAndGetReductionSource();
|
|
64042
|
+
if (source.kind === "unresolved" || target.kind === "unresolved") {
|
|
64043
|
+
return true;
|
|
64044
|
+
}
|
|
64045
|
+
if (source.isNullType) {
|
|
64046
|
+
return this.analyzer.canTypeBeNull(target);
|
|
64047
|
+
} else if (target.isNullType) {
|
|
64048
|
+
return this.analyzer.canTypeBeNull(source);
|
|
64049
|
+
}
|
|
64050
|
+
source = this.analyzer.excludeNullFromType(source).unaliasAndGetReductionSource();
|
|
64051
|
+
target = this.analyzer.excludeNullFromType(target).unaliasAndGetReductionSource();
|
|
64052
|
+
const objectType = this.analyzer.originalStandardTypes.object;
|
|
64053
|
+
if (source.equals(objectType) || target.equals(objectType)) {
|
|
64054
|
+
return true;
|
|
64055
|
+
}
|
|
64056
|
+
if (source.equals(target)) {
|
|
64057
|
+
return true;
|
|
64058
|
+
}
|
|
64059
|
+
if (source.kind === "parameter" && target.kind === "parameter") {
|
|
64060
|
+
const sourceConstraint = source.constraint;
|
|
64061
|
+
const targetConstraint = target.constraint;
|
|
64062
|
+
if (sourceConstraint !== void 0 && targetConstraint !== void 0) {
|
|
64063
|
+
const result = this.isTypeComparableTo(sourceConstraint, targetConstraint);
|
|
64064
|
+
if (result) {
|
|
64065
|
+
return true;
|
|
64066
|
+
}
|
|
64067
|
+
}
|
|
64068
|
+
return source.getEntity().getOriginalEntity() === target.getEntity().getOriginalEntity();
|
|
64069
|
+
} else if (source.kind === "parameter") {
|
|
64070
|
+
const sourceConstraint = source.constraint;
|
|
64071
|
+
if (sourceConstraint !== void 0) {
|
|
64072
|
+
const result = this.isTypeComparableTo(sourceConstraint, target);
|
|
64073
|
+
if (result) {
|
|
64074
|
+
return true;
|
|
64075
|
+
}
|
|
64076
|
+
}
|
|
64077
|
+
} else if (target.kind === "parameter") {
|
|
64078
|
+
const targetConstraint = target.constraint;
|
|
64079
|
+
if (targetConstraint !== void 0) {
|
|
64080
|
+
const result = this.isTypeComparableTo(source, targetConstraint);
|
|
64081
|
+
if (result) {
|
|
64082
|
+
return true;
|
|
64083
|
+
}
|
|
64084
|
+
}
|
|
64085
|
+
}
|
|
64086
|
+
if (source.kind === "union") {
|
|
64087
|
+
const sourceConstituentTypes = source.unaliasedFlattenedTypes;
|
|
64088
|
+
return sourceConstituentTypes.some((s) => this.isTypeComparableTo(s, target));
|
|
64089
|
+
}
|
|
64090
|
+
if (target.kind === "union") {
|
|
64091
|
+
const targetConstituentTypes = target.unaliasedFlattenedTypes;
|
|
64092
|
+
return targetConstituentTypes.some((t) => this.isTypeComparableTo(source, t));
|
|
64093
|
+
}
|
|
64094
|
+
if (source.kind === "intersection") {
|
|
64095
|
+
const sourceConstituentTypes = source.unaliasedFlattenedTypes;
|
|
64096
|
+
return sourceConstituentTypes.some((s) => this.isTypeComparableTo(s, target));
|
|
64097
|
+
}
|
|
64098
|
+
if (target.kind === "intersection") {
|
|
64099
|
+
const targetConstituentTypes = target.unaliasedFlattenedTypes;
|
|
64100
|
+
return targetConstituentTypes.some((t) => this.isTypeComparableTo(source, t));
|
|
64101
|
+
}
|
|
64102
|
+
if (source.kind === "variant") {
|
|
64103
|
+
const result = this.isTypeComparableTo(source.getUnderlyingType(), target);
|
|
64104
|
+
if (result) {
|
|
64105
|
+
return true;
|
|
64106
|
+
}
|
|
64107
|
+
} else if (target.kind === "variant") {
|
|
64108
|
+
const result = this.isTypeComparableTo(source, target.getUnderlyingType());
|
|
64109
|
+
if (result) {
|
|
64110
|
+
return true;
|
|
64111
|
+
}
|
|
64112
|
+
}
|
|
64113
|
+
const integerType = this.analyzer.originalStandardTypes.integer;
|
|
64114
|
+
const numberType = this.analyzer.originalStandardTypes.number;
|
|
64115
|
+
if (source.equals(integerType) && target.equals(numberType) || source.equals(numberType) && target.equals(integerType)) {
|
|
64116
|
+
return true;
|
|
64117
|
+
}
|
|
64118
|
+
if (source.kind === "function" && target.kind === "function") {
|
|
64119
|
+
return source.equals(target);
|
|
64120
|
+
}
|
|
64121
|
+
if (source.kind === "structured" && target.kind === "structured") {
|
|
64122
|
+
return this.analyzer.typeUtils.isTypeDerivedFromOrEqualsTo(source, target) || this.analyzer.typeUtils.isTypeDerivedFromOrEqualsTo(target, source);
|
|
64123
|
+
}
|
|
64124
|
+
return false;
|
|
64125
|
+
}
|
|
64126
|
+
};
|
|
63999
64127
|
var TypeUtils2 = class {
|
|
64000
64128
|
constructor(analyzer) {
|
|
64001
64129
|
this.analyzer = analyzer;
|
|
@@ -64285,6 +64413,9 @@ var TypeUtils2 = class {
|
|
|
64285
64413
|
}
|
|
64286
64414
|
return Query.any(this.allAspectsOfType(type), (a) => a.getEntity().getOriginalEntity() === aspectEntity.getOriginalEntity());
|
|
64287
64415
|
}
|
|
64416
|
+
areTypesComparable(type1, type2) {
|
|
64417
|
+
return type1.isNullType || type2.isNullType || this.analyzer.isTypeComparableTo(type1, type2);
|
|
64418
|
+
}
|
|
64288
64419
|
collectBaseAndAliasedTypesRecursively(type, result) {
|
|
64289
64420
|
switch (type.kind) {
|
|
64290
64421
|
case "function": {
|
|
@@ -71716,6 +71847,12 @@ var UserDefinableBinaryOperatorResolver = class {
|
|
|
71716
71847
|
const semanticContext = this.analyzer.semanticContext.containing(this.left);
|
|
71717
71848
|
const typeMemberLookupContext = semanticContext.getTypeMemberLookupContext();
|
|
71718
71849
|
const nonNullableLeftType = this.analyzer.excludeNullFromType(leftType);
|
|
71850
|
+
if (!nonNullableLeftType.equals(leftType)) {
|
|
71851
|
+
this.diagnostics?.addDiagnostic(this.analyzer.createDiagnostic(
|
|
71852
|
+
2105 /* ExpressionCanBeNull */,
|
|
71853
|
+
this.left
|
|
71854
|
+
));
|
|
71855
|
+
}
|
|
71719
71856
|
const leftTypeMemberLookup = TypeMemberLookup.ofType(this.analyzer, nonNullableLeftType);
|
|
71720
71857
|
const operators = leftTypeMemberLookup.getNamedMembersByName(name, typeMemberLookupContext, 1 /* OnlyInstanceMembers */).filter((o) => o.kind === "method" && o.getParameters().length === 1);
|
|
71721
71858
|
if (operators.length > 0) {
|
|
@@ -71851,6 +71988,12 @@ var UserDefinableUnaryOperatorResolver = class {
|
|
|
71851
71988
|
const semanticContext = this.analyzer.semanticContext.containing(this.node.operand);
|
|
71852
71989
|
const typeMemberLookupContext = semanticContext.getTypeMemberLookupContext();
|
|
71853
71990
|
const nonNullableOperandType = this.analyzer.excludeNullFromType(operandType);
|
|
71991
|
+
if (!nonNullableOperandType.equals(operandType)) {
|
|
71992
|
+
this.diagnostics?.addDiagnostic(this.analyzer.createDiagnostic(
|
|
71993
|
+
2105 /* ExpressionCanBeNull */,
|
|
71994
|
+
this.node.operand
|
|
71995
|
+
));
|
|
71996
|
+
}
|
|
71854
71997
|
const typeMemberLookup = TypeMemberLookup.ofType(this.analyzer, nonNullableOperandType);
|
|
71855
71998
|
const operators = typeMemberLookup.getNamedMembersByName(name, typeMemberLookupContext, 1 /* OnlyInstanceMembers */).filter((o) => o.kind === "method" && o.getParameters().length === 0);
|
|
71856
71999
|
if (operators.length === 1) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Compiler
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-PCY52KYM.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-
|
|
18
|
+
} from "./chunk-KCEJTV3Q.js";
|
|
19
19
|
|
|
20
20
|
// source/executor/FileSystemUri.ts
|
|
21
21
|
import { platform } from "os";
|
|
@@ -56,6 +56,7 @@ export declare abstract class Analyzer {
|
|
|
56
56
|
get signatureComparer(): SignatureComparer;
|
|
57
57
|
get conflictsCheck(): ConflictsCheck;
|
|
58
58
|
get typeAssignabilityCheck(): TypeAssignabilityCheck;
|
|
59
|
+
get typeComparabilityCheck(): TypeComparabilityCheck;
|
|
59
60
|
get overriddenMember(): OverriddenMember;
|
|
60
61
|
get tsInterop(): TsInteropContext;
|
|
61
62
|
constructor(state: CommonAnalyzerState);
|
|
@@ -69,6 +70,7 @@ export declare abstract class Analyzer {
|
|
|
69
70
|
ifTypeReferenceThenReferencedType(type: types.Type): types.Type | undefined;
|
|
70
71
|
isTypeAssignableTo(source: types.Type, target: types.Type): boolean;
|
|
71
72
|
getTypeAssignabilityFlags(source: types.Type, target: types.Type): TypeAssignabilityFlags;
|
|
73
|
+
isTypeComparableTo(source: types.Type, target: types.Type): boolean;
|
|
72
74
|
getUnambiguousTargetFunctionType(targetType: types.Type | undefined): types.FunctionType | undefined;
|
|
73
75
|
getUnambiguousTargetArrayType(targetType: types.Type | undefined): types.Type | undefined;
|
|
74
76
|
getUnambiguousTargetReferenceType(targetType: types.Type | undefined): types.Type | undefined;
|
|
@@ -179,6 +181,7 @@ export declare class CommonAnalyzerState {
|
|
|
179
181
|
signatureComparer: SignatureComparer;
|
|
180
182
|
conflictsCheck: ConflictsCheck;
|
|
181
183
|
typeAssignabilityCheck: TypeAssignabilityCheck;
|
|
184
|
+
typeComparabilityCheck: TypeComparabilityCheck;
|
|
182
185
|
overriddenMember: OverriddenMember;
|
|
183
186
|
readonly tsInteropInputs: TsInteropInputs;
|
|
184
187
|
readonly tsInterop: Cached<TsInteropContext>;
|
|
@@ -286,6 +289,11 @@ declare class TypeAssignabilityCheck {
|
|
|
286
289
|
private areNewFlagsBetter;
|
|
287
290
|
private getFlagCount;
|
|
288
291
|
}
|
|
292
|
+
declare class TypeComparabilityCheck {
|
|
293
|
+
private readonly analyzer;
|
|
294
|
+
constructor(analyzer: Analyzer);
|
|
295
|
+
isTypeComparableTo(source: types.Type, target: types.Type): boolean;
|
|
296
|
+
}
|
|
289
297
|
declare class TypeUtils {
|
|
290
298
|
private readonly analyzer;
|
|
291
299
|
constructor(analyzer: Analyzer);
|
|
@@ -302,6 +310,7 @@ declare class TypeUtils {
|
|
|
302
310
|
compareSubstitutionsWithSimpleTypeComparer(substitutions1: types.Substitutions, substitutions2: types.Substitutions, comparer: SimpleTypeComparer): boolean;
|
|
303
311
|
allAspectsOfType(type: types.Type): Iterable<types.StructuredType>;
|
|
304
312
|
checkTypeIsBasedOnAspect(type: types.Type, aspectEntity: e.StructuredTypeEntity): boolean;
|
|
313
|
+
areTypesComparable(type1: types.Type, type2: types.Type): boolean;
|
|
305
314
|
private collectBaseAndAliasedTypesRecursively;
|
|
306
315
|
private getBaseTypesForCommonTypesSearch;
|
|
307
316
|
private addTypeAndCollectAllBaseTypes;
|
|
@@ -20,6 +20,7 @@ export declare class SourceFileAnalyzer {
|
|
|
20
20
|
constructor(analyzer: Analyzer, sourceFile: project.SourceFileA);
|
|
21
21
|
analyze(taskController: TaskController): Promise<Diagnostic[]>;
|
|
22
22
|
private analyzeNode;
|
|
23
|
+
private checkBinaryExpression;
|
|
23
24
|
private checkPackageVariantDeclaration;
|
|
24
25
|
private checkTypeMemberDeclarationBlock;
|
|
25
26
|
private checkAssumptionExpression;
|
|
@@ -267,6 +267,7 @@ export declare enum DiagnosticCode {
|
|
|
267
267
|
OperatorCannotBeAsync = 2228,
|
|
268
268
|
OperatorCannotContainTypeParameterDeclarations = 2229,
|
|
269
269
|
TypeNameExpectedAtLastQualifier = 2230,
|
|
270
|
+
ExpressionsWithTypes0And1CannotBeCompared = 2231,
|
|
270
271
|
CannotFindTsLibDirectoryBaseSearchPaths0 = 3000,
|
|
271
272
|
SourceFile0IsNotPartOfThePackageAndWontBeLoaded = 3001,
|
|
272
273
|
ProgramWithoutMainPackageCannotBeCompiled = 3002,
|
|
@@ -50,7 +50,7 @@ export type AccessorEntity = GetterEntity | SetterEntity;
|
|
|
50
50
|
export declare function isAccessorEntity(entity: Entity): entity is AccessorEntity;
|
|
51
51
|
export type EntityWithTypeParameters = EntityContainingTypeParameter;
|
|
52
52
|
export declare function isEntityWithTypeParameters(entity: Entity): entity is EntityWithTypeParameters;
|
|
53
|
-
export type EntityWithParameters =
|
|
53
|
+
export type EntityWithParameters = EntityContainingParameter;
|
|
54
54
|
export declare function isEntityWithParameters(entity: Entity): entity is EntityWithParameters;
|
|
55
55
|
export type NamedFunctionEntity = PackageFunctionEntity | MethodEntity | NestedFunctionEntity;
|
|
56
56
|
export declare function isNamedFunctionEntity(entity: Entity): entity is NamedFunctionEntity;
|
|
@@ -2,7 +2,7 @@ import { Name } from '../../common/index.js';
|
|
|
2
2
|
import * as treeA from '../../tree/a/index.js';
|
|
3
3
|
import * as types from '../../types/index.js';
|
|
4
4
|
import { IEntity } from '../IEntity.js';
|
|
5
|
-
import { AnonymousFunctionEntity, ConstructorEntity, DefinitionKind, DestructorEntity, EntityHidingLevel, EntityKind, FunctionEntity, FunctionTypeEntity, GetterEntity, IndexerEntity,
|
|
5
|
+
import { AnonymousFunctionEntity, ConstructorEntity, DefinitionKind, DestructorEntity, EntityHidingLevel, EntityKind, FunctionEntity, FunctionTypeEntity, GetterEntity, IndexerEntity, PreservedReducedTypeEntityMemberInfo, SetterEntity, TextTranslationEntity, TypeWithMembersOrExtensionEntity } from '../index.js';
|
|
6
6
|
export type VariableEntity = PackageVariableEntity | FieldEntity | ParameterEntity | LocalVariableEntity;
|
|
7
7
|
interface IVariableEntity extends IEntity {
|
|
8
8
|
readonly kind: EntityKind.Variable;
|
|
@@ -50,7 +50,7 @@ export declare enum LocalVariableKind {
|
|
|
50
50
|
Enumeration = 1,
|
|
51
51
|
Error = 2
|
|
52
52
|
}
|
|
53
|
-
export type EntityContainingParameter = FunctionEntity | IndexerEntity | ConstructorEntity | DestructorEntity | FunctionTypeEntity |
|
|
53
|
+
export type EntityContainingParameter = FunctionEntity | IndexerEntity | ConstructorEntity | DestructorEntity | FunctionTypeEntity | TextTranslationEntity;
|
|
54
54
|
export type VariableEntityDefinition = {
|
|
55
55
|
kind: DefinitionKind.Source;
|
|
56
56
|
value: SourceVariableEntityDefinition;
|