@artel/artc 0.6.25208 → 0.6.25209

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.
@@ -169,10 +169,12 @@ var Query = class _Query {
169
169
  toArray() {
170
170
  return Array.from(this);
171
171
  }
172
- count() {
172
+ count(fn) {
173
173
  let result = 0;
174
- for (const _ of this) {
175
- result++;
174
+ for (const e of this) {
175
+ if (fn === void 0 || fn(e)) {
176
+ result++;
177
+ }
176
178
  }
177
179
  return result;
178
180
  }
@@ -307,6 +309,25 @@ var Query = class _Query {
307
309
  }
308
310
  return maxElement;
309
311
  }
312
+ minByValue(valueSelector) {
313
+ const iterator = this[Symbol.iterator]();
314
+ const first = iterator.next();
315
+ if (first.done === true) {
316
+ return void 0;
317
+ }
318
+ let minValue = valueSelector(first.value);
319
+ let minElement = first.value;
320
+ let current = iterator.next();
321
+ while (current.done !== true) {
322
+ const currentValue = valueSelector(current.value);
323
+ if (currentValue < minValue) {
324
+ minValue = currentValue;
325
+ minElement = current.value;
326
+ }
327
+ current = iterator.next();
328
+ }
329
+ return minElement;
330
+ }
310
331
  single(fn) {
311
332
  let result;
312
333
  let hasValue = false;
@@ -556,7 +577,7 @@ var UniqueWithComparatorQuery = class extends Query {
556
577
  };
557
578
 
558
579
  // source/common/Constants.ts
559
- var ArtelVersion = true ? "0.6.25208" : "";
580
+ var ArtelVersion = true ? "0.6.25209" : "";
560
581
  var ArtelSourceFileExtensions = [".\u0430\u0440\u0442", ".\u0430\u0440\u0442\u0435\u043B\u044C", ".art", ".artel"];
561
582
  var ArtelSourceFileExtensionSet = new Set(ArtelSourceFileExtensions);
562
583
  var ArtelSourceAndConfigurationFileExtensionSet = new Set(ArtelSourceFileExtensionSet).add(".json");
@@ -14568,7 +14589,7 @@ var AnalyzedTranslationPackage = class {
14568
14589
  if (translation.kind === 135 /* MethodTypeTranslation */) {
14569
14590
  const getTargetResult = this.getMethodTypeTranslationTarget(translation);
14570
14591
  if (getTargetResult.validTarget === entity) {
14571
- result = this.createTranslatedSubprogramSignatureFromMethodTypeAlias(translation, entity);
14592
+ result = this.createTranslatedSubprogramSignatureFromMethodTypeTranslation(translation, entity);
14572
14593
  break;
14573
14594
  }
14574
14595
  }
@@ -14588,16 +14609,24 @@ var AnalyzedTranslationPackage = class {
14588
14609
  if (resultOpt === void 0) {
14589
14610
  let result;
14590
14611
  const typeTranslation = this.findTypeTranslation(container.typeEntity);
14591
- if (typeTranslation?.memberList !== void 0) {
14592
- for (const memberTranslation of typeTranslation.memberList.elements) {
14593
- if (memberTranslation.kind === 128 /* ConstructorTranslation */) {
14594
- const getTargetsResult = this.getConstructorTranslationTargets(memberTranslation);
14595
- if (getTargetsResult.validUnambiguousTargets.includes(entity)) {
14596
- result = this.createTranslatedSubprogramSignatureFromConstructorAlias(memberTranslation, entity);
14597
- break;
14612
+ if (typeTranslation !== void 0) {
14613
+ if (typeTranslation.memberList !== void 0) {
14614
+ for (const memberTranslation of typeTranslation.memberList.elements) {
14615
+ if (memberTranslation.kind === 128 /* ConstructorTranslation */) {
14616
+ const getTargetsResult = this.getConstructorTranslationTargets(memberTranslation);
14617
+ if (getTargetsResult.validUnambiguousTargets.includes(entity)) {
14618
+ result = this.createTranslatedSubprogramSignatureFromConstructorTranslation(memberTranslation, entity);
14619
+ break;
14620
+ }
14598
14621
  }
14599
14622
  }
14600
14623
  }
14624
+ if (result === void 0) {
14625
+ const defaultConstructorInfo = entity.isDefault();
14626
+ if (defaultConstructorInfo !== void 0) {
14627
+ result = this.createTranslatedSubprogramSignatureForDefaultConstructor(entity, defaultConstructorInfo);
14628
+ }
14629
+ }
14601
14630
  }
14602
14631
  resultOpt = Option.fromNullable(result);
14603
14632
  this._constructorSignatureTranslations.set(entity, resultOpt);
@@ -14621,7 +14650,7 @@ var AnalyzedTranslationPackage = class {
14621
14650
  if (memberTranslation.kind === 130 /* IndexerTranslation */) {
14622
14651
  const getTargetsResult = this.getIndexerTranslationTargets(memberTranslation);
14623
14652
  if (getTargetsResult.validUnambiguousTargets.includes(entity)) {
14624
- result = this.createTranslatedSubprogramSignatureFromIndexerAlias(memberTranslation, entity);
14653
+ result = this.createTranslatedSubprogramSignatureFromIndexerTranslation(memberTranslation, entity);
14625
14654
  break;
14626
14655
  }
14627
14656
  }
@@ -14964,7 +14993,7 @@ var AnalyzedTranslationPackage = class {
14964
14993
  ).toArray();
14965
14994
  return new LocalizedSubprogramSignature.Translated(typeParameters, valueParameters);
14966
14995
  }
14967
- createTranslatedSubprogramSignatureFromMethodTypeAlias(node, entity) {
14996
+ createTranslatedSubprogramSignatureFromMethodTypeTranslation(node, entity) {
14968
14997
  const typeParameters = node.translatedTypeParameterClause?.parameterList.parameters.zip(entity.getTypeParameters(), (n, p) => new TranslatedTypeParameter(
14969
14998
  p,
14970
14999
  new LocalizedName.Translated(
@@ -14984,7 +15013,7 @@ var AnalyzedTranslationPackage = class {
14984
15013
  ).toArray();
14985
15014
  return new LocalizedSubprogramSignature.Translated(typeParameters, valueParameters);
14986
15015
  }
14987
- createTranslatedSubprogramSignatureFromConstructorAlias(node, entity) {
15016
+ createTranslatedSubprogramSignatureFromConstructorTranslation(node, entity) {
14988
15017
  const valueParameters = node.translatedParameterClause.parameterList.parameters.zip(
14989
15018
  entity.getValueParameters(),
14990
15019
  (n, p) => new TranslatedValueParameter(
@@ -14997,7 +15026,7 @@ var AnalyzedTranslationPackage = class {
14997
15026
  ).toArray();
14998
15027
  return new LocalizedSubprogramSignature.Translated([], valueParameters);
14999
15028
  }
15000
- createTranslatedSubprogramSignatureFromIndexerAlias(node, entity) {
15029
+ createTranslatedSubprogramSignatureFromIndexerTranslation(node, entity) {
15001
15030
  const valueParameters = node.translatedParameterClause.parameterList.parameters.zip(
15002
15031
  entity.getValueParameters(),
15003
15032
  (n, p) => new TranslatedValueParameter(
@@ -15010,6 +15039,58 @@ var AnalyzedTranslationPackage = class {
15010
15039
  ).toArray();
15011
15040
  return new LocalizedSubprogramSignature.Translated([], valueParameters);
15012
15041
  }
15042
+ createTranslatedSubprogramSignatureForDefaultConstructor(entity, info) {
15043
+ let translatedNameByParameter;
15044
+ if (info.parametersForOwnFieldsInitialization !== void 0) {
15045
+ const container = entity.getContainer();
15046
+ if (container.kind === "type" && isPackageTypeEntity(container.typeEntity)) {
15047
+ const members = this.getTypeEntityMembers(container.typeEntity);
15048
+ if (members !== void 0) {
15049
+ for (const parameterInfo of info.parametersForOwnFieldsInitialization) {
15050
+ const name = members.getMemberName(parameterInfo.field);
15051
+ if (name !== void 0) {
15052
+ const localizedName = new LocalizedName.Translated(
15053
+ name,
15054
+ new Localization.Translated(new Translation(this))
15055
+ );
15056
+ translatedNameByParameter ??= /* @__PURE__ */ new Map();
15057
+ translatedNameByParameter.set(parameterInfo.parameter, localizedName);
15058
+ }
15059
+ }
15060
+ }
15061
+ }
15062
+ }
15063
+ if (info.orderedParametersForBaseConstructor.length > 0) {
15064
+ const baseConstructorEntity = info.baseConstructor?.getEntity();
15065
+ if (baseConstructorEntity !== void 0 && getPackageContainingEntity(baseConstructorEntity) === this._translatedPackage) {
15066
+ const baseConstructorSignature = this.getConstructorSignature(baseConstructorEntity);
15067
+ if (baseConstructorSignature !== void 0) {
15068
+ for (const parameterInfo of info.orderedParametersForBaseConstructor) {
15069
+ const name = baseConstructorSignature.getValueParameterName(parameterInfo.baseConstructorParameter);
15070
+ if (name !== void 0) {
15071
+ const localizedName = new LocalizedName.Translated(
15072
+ name,
15073
+ new Localization.Translated(new Translation(this))
15074
+ );
15075
+ translatedNameByParameter ??= /* @__PURE__ */ new Map();
15076
+ translatedNameByParameter.set(parameterInfo.parameter, localizedName);
15077
+ }
15078
+ }
15079
+ }
15080
+ }
15081
+ }
15082
+ const valueParameters = entity.getValueParameters().map((p) => {
15083
+ let localizedName = translatedNameByParameter?.get(p);
15084
+ if (localizedName === void 0) {
15085
+ localizedName = new LocalizedName.Translated(
15086
+ p.getName(),
15087
+ new Localization.Translated(new Translation(this))
15088
+ );
15089
+ }
15090
+ return new TranslatedValueParameter(p, localizedName);
15091
+ });
15092
+ return new LocalizedSubprogramSignature.Translated([], valueParameters);
15093
+ }
15013
15094
  createTranslatedTypeSignature(node, typeParameterEntities) {
15014
15095
  const typeParameters = node.translatedTypeParameterClause?.parameterList.parameters.zip(typeParameterEntities, (n, p) => new TranslatedTypeParameter(
15015
15096
  p,
@@ -17507,12 +17588,11 @@ var PackageAliasTypeDeclarationEntity = class {
17507
17588
  const backingVariables = this._analyzer.createBackingTypeVariables(declared.variables, this);
17508
17589
  namedMembers.push(...backingVariables);
17509
17590
  }
17510
- const defaultConstructors = this._analyzer.defaultConstructors.createAliasTypeDefaultConstructors(this, declared.constructors.length > 0);
17511
17591
  const unaryOperators = declared.unaryOperators.concat(this._analyzer.builtInOperators.getUnaryOperators(this));
17512
17592
  const binaryOperators = declared.binaryOperators.concat(this._analyzer.builtInOperators.getBinaryOperators(this));
17513
17593
  result = new OriginalTypeEntityMembers(
17514
17594
  namedMembers,
17515
- declared.constructors.concat(defaultConstructors),
17595
+ declared.constructors,
17516
17596
  declared.destructors,
17517
17597
  declared.indexers,
17518
17598
  declared.dereferenceOperators,
@@ -17520,8 +17600,7 @@ var PackageAliasTypeDeclarationEntity = class {
17520
17600
  binaryOperators
17521
17601
  );
17522
17602
  } else {
17523
- const defaultConstructors = this._analyzer.defaultConstructors.createAliasTypeDefaultConstructors(this, false);
17524
- result = new OriginalTypeEntityMembers([], defaultConstructors, [], [], [], [], []);
17603
+ result = new OriginalTypeEntityMembers([], [], [], [], [], [], []);
17525
17604
  }
17526
17605
  return result;
17527
17606
  });
@@ -17595,6 +17674,9 @@ var IntrinsicBinaryOperatorEntity = class {
17595
17674
  isHidden() {
17596
17675
  return void 0;
17597
17676
  }
17677
+ getTags() {
17678
+ return [];
17679
+ }
17598
17680
  };
17599
17681
  IntrinsicBinaryOperatorEntity = __decorateClass([
17600
17682
  entityToStringDecorator
@@ -24688,9 +24770,44 @@ var ConstructorLookup = class {
24688
24770
  return this.getConstructorsOfTypeWithOwnMembers(type.getEntity(), type, hidingMatcher, typeExtensionsLookup);
24689
24771
  }
24690
24772
  getConstructorsOfAliasType(type, hidingMatcher, typeExtensionsLookup) {
24691
- return this.getConstructorsOfTypeWithOwnMembers(type.getEntity(), type, hidingMatcher, typeExtensionsLookup);
24773
+ let result = this.getOwnConstructors(type.getEntity(), type, hidingMatcher);
24774
+ if (typeExtensionsLookup !== void 0) {
24775
+ const extensionConstructors = this.getExtensionConstructors(
24776
+ type.getEntity(),
24777
+ type,
24778
+ hidingMatcher,
24779
+ typeExtensionsLookup
24780
+ );
24781
+ result = this.mergeConstructors(result, extensionConstructors);
24782
+ }
24783
+ let aliasedType = type.getAliasedType();
24784
+ while (aliasedType.kind === "alias") {
24785
+ const constructors2 = this.getOwnConstructors(aliasedType.getEntity(), aliasedType, hidingMatcher);
24786
+ result = this.mergeConstructors(result, constructors2);
24787
+ if (typeExtensionsLookup !== void 0) {
24788
+ const extensionConstructors = this.getExtensionConstructors(
24789
+ aliasedType.getEntity(),
24790
+ aliasedType,
24791
+ hidingMatcher,
24792
+ typeExtensionsLookup
24793
+ );
24794
+ result = this.mergeConstructors(result, extensionConstructors);
24795
+ }
24796
+ aliasedType = aliasedType.getAliasedType();
24797
+ }
24798
+ const constructors = this.getConstructors(aliasedType, hidingMatcher, typeExtensionsLookup);
24799
+ result = this.mergeConstructors(result, constructors);
24800
+ return result;
24692
24801
  }
24693
24802
  getConstructorsOfTypeWithOwnMembers(typeEntity, type, hidingMatcher, typeExtensionsLookup) {
24803
+ let result = this.getOwnConstructors(typeEntity, type, hidingMatcher);
24804
+ if (typeExtensionsLookup !== void 0) {
24805
+ const extensionConstructors = this.getExtensionConstructors(typeEntity, type, hidingMatcher, typeExtensionsLookup);
24806
+ result = this.mergeConstructors(result, extensionConstructors);
24807
+ }
24808
+ return result;
24809
+ }
24810
+ getOwnConstructors(typeEntity, type, hidingMatcher) {
24694
24811
  const translatedMembers = this._localizationContext?.getTranslatedTypeEntityMembers(typeEntity);
24695
24812
  const originalLocale = getPackageContainingEntity(typeEntity).getLocale();
24696
24813
  let result = Query.from(typeEntity.getMembers().getConstructors()).map((c) => {
@@ -24708,26 +24825,23 @@ var ConstructorLookup = class {
24708
24825
  return hiding === void 0 || hidingMatcher.matches(hiding);
24709
24826
  });
24710
24827
  }
24711
- let extensionConstructors;
24712
- if (typeExtensionsLookup !== void 0) {
24713
- extensionConstructors = Query.from(typeExtensionsLookup.getTypeExtensionsByType(typeEntity)).flatMap((e) => {
24714
- const originalLocale2 = getPackageContainingEntity(e).getLocale();
24715
- return e.getMembers().getConstructors().map(
24716
- (c) => FoundAnonymousDeclaration.original(
24717
- new Constructor(c, type.getSubstitutions(), type),
24718
- originalLocale2
24719
- )
24720
- );
24828
+ return result;
24829
+ }
24830
+ getExtensionConstructors(typeEntity, type, hidingMatcher, typeExtensionsLookup) {
24831
+ let result = Query.from(typeExtensionsLookup.getTypeExtensionsByType(typeEntity)).flatMap((e) => {
24832
+ const originalLocale = getPackageContainingEntity(e).getLocale();
24833
+ return e.getMembers().getConstructors().map(
24834
+ (c) => FoundAnonymousDeclaration.original(
24835
+ new Constructor(c, type.getSubstitutions(), type),
24836
+ originalLocale
24837
+ )
24838
+ );
24839
+ });
24840
+ if (hidingMatcher !== void 0) {
24841
+ result = result.filter((m) => {
24842
+ const hiding = m.value.isHidden();
24843
+ return hiding === void 0 || hidingMatcher.matches(hiding);
24721
24844
  });
24722
- if (hidingMatcher !== void 0) {
24723
- extensionConstructors = extensionConstructors.filter((m) => {
24724
- const hiding = m.value.isHidden();
24725
- return hiding === void 0 || hidingMatcher.matches(hiding);
24726
- });
24727
- }
24728
- result = this.mergeConstructors(result, extensionConstructors);
24729
- } else {
24730
- extensionConstructors = Query.empty();
24731
24845
  }
24732
24846
  return result;
24733
24847
  }
@@ -29529,6 +29643,14 @@ var OverloadResolver = class {
29529
29643
  if (matchingSignatures.length === 0) {
29530
29644
  return void 0;
29531
29645
  }
29646
+ const signatureWithLeastParameterCount = Query.from(matchingSignatures).minByValue((s) => s.value.getParameters().length);
29647
+ if (signatureWithLeastParameterCount !== void 0) {
29648
+ const parameterCount = signatureWithLeastParameterCount.value.getParameters().length;
29649
+ const isSingle = Query.from(matchingSignatures).count((s) => s.value.getParameters().length === parameterCount) === 1;
29650
+ if (isSingle) {
29651
+ return signatureWithLeastParameterCount;
29652
+ }
29653
+ }
29532
29654
  let bestSignature = matchingSignatures[0];
29533
29655
  for (let i = 1; i < matchingSignatures.length && bestSignature !== void 0; i++) {
29534
29656
  const currentSignature = matchingSignatures[i];
@@ -29742,18 +29864,19 @@ var Resolver2 = class {
29742
29864
  )]);
29743
29865
  }
29744
29866
  if (constructors.length === 1) {
29745
- return new Meaning_constructorCall(constructors, constructors);
29867
+ return new Meaning_constructorCall(targetType, constructors, constructors);
29746
29868
  }
29747
29869
  if (constructors.length > 1) {
29748
29870
  const candidates = Query.from(constructors).map((c) => new FoundTypeMemberCandidate(c));
29749
29871
  const result = Query.from(this._analyzer.resolveConstructorOverload(candidates, this._node.callArgumentList.callArguments)).map((c) => c.value).toArray();
29750
- return new Meaning_constructorCall(constructors, result);
29872
+ return new Meaning_constructorCall(targetType, constructors, result);
29751
29873
  }
29752
29874
  Debug.unreachable();
29753
29875
  }
29754
29876
  };
29755
29877
  var Meaning_constructorCall = class {
29756
- constructor(candidates, suitableConstructors) {
29878
+ constructor(type, candidates, suitableConstructors) {
29879
+ this.type = type;
29757
29880
  this.candidates = candidates;
29758
29881
  this.suitableConstructors = suitableConstructors;
29759
29882
  this.kind = "constructor-call";
@@ -30024,11 +30147,11 @@ var Resolver3 = class {
30024
30147
  );
30025
30148
  }
30026
30149
  if (constructors.length === 1) {
30027
- return new Meaning_baseConstructorAccess(constructors, constructors);
30150
+ return new Meaning_baseConstructorAccess(baseType, constructors, constructors);
30028
30151
  }
30029
30152
  const candidates = Query.from(constructors).map((c) => new FoundTypeMemberCandidate(c));
30030
30153
  const result = Query.from(this._analyzer.resolveConstructorOverload(candidates, parent.callArgumentList.callArguments)).map((c) => c.value).toArray();
30031
- return new Meaning_baseConstructorAccess(constructors, result);
30154
+ return new Meaning_baseConstructorAccess(baseType, constructors, result);
30032
30155
  }
30033
30156
  resolveBaseMethodAccess(containingDeclaration) {
30034
30157
  const overriddenMethod = this._analyzer.overriddenMember.getOverriddenMethod(this._analyzer.entity.ofTypeMethodDeclaration(containingDeclaration));
@@ -30093,7 +30216,8 @@ var Meaning_baseObjectAccess = class {
30093
30216
  }
30094
30217
  };
30095
30218
  var Meaning_baseConstructorAccess = class {
30096
- constructor(candidates, suitableConstructors) {
30219
+ constructor(type, candidates, suitableConstructors) {
30220
+ this.type = type;
30097
30221
  this.candidates = candidates;
30098
30222
  this.suitableConstructors = suitableConstructors;
30099
30223
  this.kind = "base-constructor-access";
@@ -30488,7 +30612,7 @@ var Resolver4 = class {
30488
30612
  if (this.callee.kind === 88 /* ObjectExpression */) {
30489
30613
  const meaning = this._analyzer.getObjectExpressionMeaning(this.callee);
30490
30614
  if (meaning.kind === "own-constructor-access") {
30491
- return new Meaning_constructorCall2(meaning.candidates, meaning.suitableConstructors);
30615
+ return new Meaning_constructorCall2(meaning.type, meaning.candidates, meaning.suitableConstructors);
30492
30616
  }
30493
30617
  }
30494
30618
  }
@@ -30496,7 +30620,7 @@ var Resolver4 = class {
30496
30620
  if (this.callee.kind === 89 /* BaseExpression */) {
30497
30621
  const meaning = this._analyzer.getBaseExpressionMeaning(this.callee);
30498
30622
  if (meaning.kind === "base-constructor-access") {
30499
- return new Meaning_constructorCall2(meaning.candidates, meaning.suitableConstructors);
30623
+ return new Meaning_constructorCall2(meaning.type, meaning.candidates, meaning.suitableConstructors);
30500
30624
  }
30501
30625
  }
30502
30626
  }
@@ -30540,12 +30664,12 @@ var Resolver4 = class {
30540
30664
  )]);
30541
30665
  }
30542
30666
  if (constructors.length === 1) {
30543
- return new Meaning_constructorCall2(constructors, constructors);
30667
+ return new Meaning_constructorCall2(type, constructors, constructors);
30544
30668
  }
30545
30669
  if (constructors.length > 1) {
30546
30670
  const candidates = Query.from(constructors).map((c) => new FoundTypeMemberCandidate(c));
30547
30671
  const result = Query.from(this._analyzer.resolveConstructorOverload(candidates, this._node.callArgumentList.callArguments)).map((c) => c.value).toArray();
30548
- return new Meaning_constructorCall2(constructors, result);
30672
+ return new Meaning_constructorCall2(type, constructors, result);
30549
30673
  }
30550
30674
  Debug.unreachable();
30551
30675
  }
@@ -30570,7 +30694,8 @@ var Meaning_objectMethodCall = class {
30570
30694
  }
30571
30695
  };
30572
30696
  var Meaning_constructorCall2 = class {
30573
- constructor(candidates, suitableConstructors) {
30697
+ constructor(type, candidates, suitableConstructors) {
30698
+ this.type = type;
30574
30699
  this.candidates = candidates;
30575
30700
  this.suitableConstructors = suitableConstructors;
30576
30701
  this.kind = "constructor-call";
@@ -31907,11 +32032,11 @@ var Resolver8 = class {
31907
32032
  ));
31908
32033
  }
31909
32034
  if (constructors.length === 1) {
31910
- return new Meaning_ownConstructorAccess(constructors, constructors);
32035
+ return new Meaning_ownConstructorAccess(type, constructors, constructors);
31911
32036
  }
31912
32037
  const candidates = Query.from(constructors).map((c) => new FoundTypeMemberCandidate(c));
31913
32038
  const result = Query.from(this._analyzer.resolveConstructorOverload(candidates, parent.callArgumentList.callArguments)).map((c) => c.value).toArray();
31914
- return new Meaning_ownConstructorAccess(constructors, result);
32039
+ return new Meaning_ownConstructorAccess(type, constructors, result);
31915
32040
  }
31916
32041
  resolveContextAccess() {
31917
32042
  const semanticContext = this._analyzer.semanticContext.containing(this._node);
@@ -31949,7 +32074,8 @@ var Resolver8 = class {
31949
32074
  }
31950
32075
  };
31951
32076
  var Meaning_ownConstructorAccess = class {
31952
- constructor(candidates, suitableConstructors) {
32077
+ constructor(type, candidates, suitableConstructors) {
32078
+ this.type = type;
31953
32079
  this.candidates = candidates;
31954
32080
  this.suitableConstructors = suitableConstructors;
31955
32081
  this.kind = "own-constructor-access";
@@ -36737,6 +36863,7 @@ var WellKnownDeclarationsLoader = class {
36737
36863
  declarations.typeVariableProxy = this.findPackageStructuredType(systemPackage, new Name("\u041F\u043E\u0441\u0440\u0435\u0434\u043D\u0438\u043A\u041F\u0435\u0440\u0435\u043C\u0435\u043D\u043D\u043E\u0439\u041E\u0431\u044A\u0435\u043A\u0442\u0430"), 2);
36738
36864
  declarations.parameterArray = this.findPackageAliasType(interopPackage, new Name("\u041C\u0430\u0441\u0441\u0438\u0432\u041F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u043E\u0432"), 1);
36739
36865
  declarations.defaultImport = this.findPackageStructuredType(interopPackage, new Name("\u0418\u043C\u043F\u043E\u0440\u0442\u041F\u043E\u0423\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E"), 0);
36866
+ declarations.builtIntoPlatform = this.findPackageStructuredType(interopPackage, new Name("\u0412\u0441\u0442\u0440\u043E\u0435\u043D\u043E\u0412\u041F\u043B\u0430\u0442\u0444\u043E\u0440\u043C\u0443"), 0);
36740
36867
  declarations.realName = this.findPackageStructuredType(interopPackage, new Name("\u041D\u0430\u0441\u0442\u043E\u044F\u0449\u0435\u0435\u0418\u043C\u044F"), 0);
36741
36868
  return declarations;
36742
36869
  }
@@ -37024,7 +37151,7 @@ var Type4 = class {
37024
37151
  case "object-method-call":
37025
37152
  return this._analyzer.makeNoneAssignableToTypeIfExpressionOptionalChaining(meaning.type.getReturnType(), node);
37026
37153
  case "constructor-call":
37027
- return meaning.suitableConstructors[0]?.value.getInstanceType() ?? this._analyzer.standardTypes.unresolved;
37154
+ return meaning.type;
37028
37155
  case "unresolved":
37029
37156
  return this._analyzer.standardTypes.unresolved;
37030
37157
  }
@@ -37033,7 +37160,7 @@ var Type4 = class {
37033
37160
  const meaning = this._analyzer.getAutotypeCallExpressionMeaning(node, targetTypeHint);
37034
37161
  switch (meaning.kind) {
37035
37162
  case "constructor-call":
37036
- return meaning.suitableConstructors[0]?.value.getInstanceType() ?? this._analyzer.standardTypes.unresolved;
37163
+ return meaning.type;
37037
37164
  case "unresolved":
37038
37165
  return this._analyzer.standardTypes.unresolved;
37039
37166
  default:
@@ -39352,16 +39479,6 @@ var DefaultConstructors = class {
39352
39479
  }
39353
39480
  return result;
39354
39481
  }
39355
- createAliasTypeDefaultConstructors(aliasTypeEntity, hasDeclaredConstructors) {
39356
- let result;
39357
- if (!hasDeclaredConstructors) {
39358
- const lookup = new TypeMemberLookup(this._analyzer, aliasTypeEntity.getAliasedType().cycleFree, void 0);
39359
- result = lookup.getConstructors().map((c) => new SynthesizedAliasTypeConstructor(this._analyzer, c.value, aliasTypeEntity)).toArray();
39360
- } else {
39361
- result = [];
39362
- }
39363
- return result;
39364
- }
39365
39482
  createDefaultConstructors(node) {
39366
39483
  let result;
39367
39484
  const hasDeclaredConstructor = Query.from(flattenTypeMemberDeclarationList(node.body.memberBlock.memberList)).any((m) => m.kind === 45 /* TypeConstructorDeclaration */);
@@ -40850,6 +40967,14 @@ var DiagnosticCollector = class _DiagnosticCollector {
40850
40967
  this.checkTypeIndexedSetterDeclaration(node);
40851
40968
  break;
40852
40969
  }
40970
+ case 50 /* TypeDereferencedVariableGetterDeclaration */: {
40971
+ this.checkTypeDereferencedVariableGetterDeclaration(node);
40972
+ break;
40973
+ }
40974
+ case 51 /* TypeDereferencedVariableSetterDeclaration */: {
40975
+ this.checkTypeDereferencedVariableSetterDeclaration(node);
40976
+ break;
40977
+ }
40853
40978
  case 57 /* NestedMethodDeclaration */: {
40854
40979
  this.checkNestedMethodDeclaration(node);
40855
40980
  break;
@@ -41245,6 +41370,30 @@ var DiagnosticCollector = class _DiagnosticCollector {
41245
41370
  this.checkTypeMemberBodyPresence(node, node.body, node.parameterClause);
41246
41371
  }
41247
41372
  }
41373
+ checkTypeDereferencedVariableGetterDeclaration(node) {
41374
+ if (this.isInterfacePackageFile) {
41375
+ if (node.body !== void 0) {
41376
+ this.addDiagnostic(this._analyzer.createNodeDiagnostic(
41377
+ 105 /* InterfacePackageMustNotContainImplementation */,
41378
+ node.caretToken
41379
+ ));
41380
+ }
41381
+ } else {
41382
+ this.checkTypeMemberBodyPresence(node, node.body, node.caretToken);
41383
+ }
41384
+ }
41385
+ checkTypeDereferencedVariableSetterDeclaration(node) {
41386
+ if (this.isInterfacePackageFile) {
41387
+ if (node.body !== void 0) {
41388
+ this.addDiagnostic(this._analyzer.createNodeDiagnostic(
41389
+ 105 /* InterfacePackageMustNotContainImplementation */,
41390
+ node.caretToken
41391
+ ));
41392
+ }
41393
+ } else {
41394
+ this.checkTypeMemberBodyPresence(node, node.body, node.caretToken);
41395
+ }
41396
+ }
41248
41397
  checkNestedMethodDeclaration(node) {
41249
41398
  const entity = this._analyzer.entity.ofNestedMethodDeclaration(node);
41250
41399
  if (node.body !== void 0) {
@@ -41318,7 +41467,16 @@ var DiagnosticCollector = class _DiagnosticCollector {
41318
41467
  if (!bodyCanBeMissing) {
41319
41468
  bodyCanBeMissing = this.isAspectTypeMemberDeclaration(typeMemberWithBody) && findModifier(typeMemberWithBody, 38 /* Redefinable */) === void 0;
41320
41469
  if (!bodyCanBeMissing) {
41321
- this.addDiagnostic(this._analyzer.createNodeDiagnostic(109 /* BodyIsMissing */, nodeForDiagnostics));
41470
+ const entity = this.tryGetTypeMemberDeclarationEntity(typeMemberWithBody);
41471
+ if (entity !== void 0) {
41472
+ bodyCanBeMissing = findTag(
41473
+ this._analyzer.wellKnownDeclarations.builtIntoPlatform,
41474
+ entity.getTags()
41475
+ ) !== void 0;
41476
+ }
41477
+ if (!bodyCanBeMissing) {
41478
+ this.addDiagnostic(this._analyzer.createNodeDiagnostic(109 /* BodyIsMissing */, nodeForDiagnostics));
41479
+ }
41322
41480
  }
41323
41481
  }
41324
41482
  } else {
@@ -41330,6 +41488,36 @@ var DiagnosticCollector = class _DiagnosticCollector {
41330
41488
  }
41331
41489
  }
41332
41490
  }
41491
+ tryGetTypeMemberDeclarationEntity(node) {
41492
+ switch (node.kind) {
41493
+ case 44 /* TypeMemberGroupDeclaration */:
41494
+ return void 0;
41495
+ case 45 /* TypeConstructorDeclaration */:
41496
+ return this._analyzer.entity.ofTypeConstructorDeclaration(node);
41497
+ case 46 /* TypeDestructorDeclaration */:
41498
+ return this._analyzer.entity.ofTypeDestructorDeclaration(node);
41499
+ case 47 /* TypeIndexedGetterDeclaration */:
41500
+ return this._analyzer.entity.ofTypeIndexedGetterDeclaration(node);
41501
+ case 48 /* TypeIndexedSetterDeclaration */:
41502
+ return this._analyzer.entity.ofTypeIndexedSetterDeclaration(node);
41503
+ case 50 /* TypeDereferencedVariableGetterDeclaration */:
41504
+ return this._analyzer.entity.ofTypeDereferencedVariableGetterDeclaration(node);
41505
+ case 51 /* TypeDereferencedVariableSetterDeclaration */:
41506
+ return this._analyzer.entity.ofTypeDereferencedVariableSetterDeclaration(node);
41507
+ case 52 /* TypeMethodDeclaration */:
41508
+ return this._analyzer.entity.ofTypeMethodDeclaration(node);
41509
+ case 53 /* TypeVariableDeclaration */:
41510
+ return this._analyzer.entity.ofTypeVariableDeclaration(node);
41511
+ case 54 /* TypeVariableGetterDeclaration */:
41512
+ return this._analyzer.entity.ofTypeVariableGetterDeclaration(node);
41513
+ case 55 /* TypeVariableSetterDeclaration */:
41514
+ return this._analyzer.entity.ofTypeVariableSetterDeclaration(node);
41515
+ case 56 /* InvalidTypeMemberDeclaration */:
41516
+ return void 0;
41517
+ case 144 /* VariantDeclaration */:
41518
+ return this._analyzer.entity.ofVariantDeclaration(node);
41519
+ }
41520
+ }
41333
41521
  isAspectTypeMemberDeclaration(node) {
41334
41522
  const containingDeclaration = TreeQuery.fromTypeMemberDeclaration(node).container().getNode();
41335
41523
  return containingDeclaration.kind === 33 /* PackageStructuredTypeDeclaration */ && containingDeclaration.body.structuredTypeKindKeyword.keywordKind === 3 /* Aspect */ || containingDeclaration.kind === 18 /* AnonymousStructuredTypeDeclaration */ && containingDeclaration.body.structuredTypeKindKeyword.keywordKind === 3 /* Aspect */;
@@ -42035,11 +42223,24 @@ var WellKnownDeclarations = class {
42035
42223
  };
42036
42224
 
42037
42225
  // source/entities/ConstructorEntity.ts
42038
- var DefaultConstructorEntityInfo2 = class {
42039
- constructor(baseConstructor, orderedParametersForBaseConstructor, hasParametersForFieldInitialization) {
42226
+ var DefaultConstructorEntityInfo3 = class {
42227
+ constructor(baseConstructor, orderedParametersForBaseConstructor, hasParametersForFieldInitialization, parametersForOwnFieldsInitialization) {
42040
42228
  this.baseConstructor = baseConstructor;
42041
42229
  this.orderedParametersForBaseConstructor = orderedParametersForBaseConstructor;
42042
42230
  this.hasParametersForFieldInitialization = hasParametersForFieldInitialization;
42231
+ this.parametersForOwnFieldsInitialization = parametersForOwnFieldsInitialization;
42232
+ }
42233
+ };
42234
+ var DefaultConstructorParameterForBaseConstructorInfo = class {
42235
+ constructor(parameter, baseConstructorParameter) {
42236
+ this.parameter = parameter;
42237
+ this.baseConstructorParameter = baseConstructorParameter;
42238
+ }
42239
+ };
42240
+ var ConstructorParameterInitializingFieldInfo = class {
42241
+ constructor(parameter, field) {
42242
+ this.parameter = parameter;
42243
+ this.field = field;
42043
42244
  }
42044
42245
  };
42045
42246
  var TypeConstructorDeclarationEntity = class {
@@ -42117,26 +42318,10 @@ var DefaultConstructorEntity = class {
42117
42318
  this._variablesToInitialize = _variablesToInitialize;
42118
42319
  this._baseConstructor = _baseConstructor;
42119
42320
  this.kind = 9 /* Constructor */;
42120
- this._valueParameters = new Cached();
42121
- this._orderedParametersForBaseConstructor = new Cached();
42321
+ this._parametersInfo = new Cached();
42122
42322
  }
42123
42323
  getValueParameters() {
42124
- return this._valueParameters.getOrInsertWith(() => {
42125
- const orderedParametersForBaseConstructor = this.getOrderedParametersForBaseConstructor();
42126
- const parametersForOwnVariables = Query.from(this._variablesToInitialize).map((v) => {
42127
- const isOptionalParameter = v.hasInitializer || this._analyzer.isNoneAssignableToType(v.entity.getType());
42128
- return new IntrinsicParameterVariableEntity(
42129
- v.entity.getName(),
42130
- v.entity.getType(),
42131
- new ParameterVariableEntityContainer.Entity(this),
42132
- isOptionalParameter,
42133
- false,
42134
- void 0
42135
- );
42136
- }).toArray();
42137
- const orderedParameters = Query.from(parametersForOwnVariables.filter((p) => !p.isOptional())).chain(orderedParametersForBaseConstructor.filter((p) => !p.isOptional())).chain(parametersForOwnVariables.filter((p) => p.isOptional())).chain(orderedParametersForBaseConstructor.filter((p) => p.isOptional())).toArray();
42138
- return orderedParameters;
42139
- });
42324
+ return this.getParametersInfo().values;
42140
42325
  }
42141
42326
  getDefinition() {
42142
42327
  return { kind: 1 /* Intrinsic */ };
@@ -42145,11 +42330,13 @@ var DefaultConstructorEntity = class {
42145
42330
  return new TypeMemberEntityContainer2.Type(this._containingType);
42146
42331
  }
42147
42332
  isDefault() {
42333
+ const parametersInfo = this.getParametersInfo();
42148
42334
  const hasParametersForFieldInitialization = this._variablesToInitialize.length > 0 || this._baseConstructor?.value.getEntity().isDefault()?.hasParametersForFieldInitialization === true;
42149
- return new DefaultConstructorEntityInfo2(
42335
+ return new DefaultConstructorEntityInfo3(
42150
42336
  this._baseConstructor?.value,
42151
- this.getOrderedParametersForBaseConstructor(),
42152
- hasParametersForFieldInitialization
42337
+ parametersInfo.orderedParametersForBaseConstructor,
42338
+ hasParametersForFieldInitialization,
42339
+ parametersInfo.parametersForOwnFieldsInitialization
42153
42340
  );
42154
42341
  }
42155
42342
  isHidden() {
@@ -42161,25 +42348,53 @@ var DefaultConstructorEntity = class {
42161
42348
  getTags() {
42162
42349
  return [];
42163
42350
  }
42164
- getOrderedParametersForBaseConstructor() {
42165
- return this._orderedParametersForBaseConstructor.getOrInsertWith(() => {
42166
- if (this._baseConstructor !== void 0) {
42167
- const localizedSignature = EntityLocalizationHelper.getLocalizedConstructorSignature(
42168
- this._baseConstructor.value.getEntity(),
42169
- this._baseConstructor.localization
42351
+ getParametersInfo() {
42352
+ return this._parametersInfo.getOrInsertWith(() => {
42353
+ const orderedParametersForBaseConstructor = this.createOrderedParametersForBaseConstructor();
42354
+ const parametersForOwnFieldsInitialization = this._variablesToInitialize.length > 0 ? [] : void 0;
42355
+ const parametersForOwnVariables = this._variablesToInitialize.map((v) => {
42356
+ const isOptionalParameter = v.hasInitializer || this._analyzer.isNoneAssignableToType(v.entity.getType());
42357
+ const parameter = new IntrinsicParameterVariableEntity(
42358
+ v.entity.getName(),
42359
+ v.entity.getType(),
42360
+ new ParameterVariableEntityContainer.Entity(this),
42361
+ isOptionalParameter,
42362
+ false,
42363
+ void 0
42170
42364
  );
42171
- return Query.from(this._baseConstructor.value.getValueParameters()).zip(localizedSignature.getValueParameterNames(), (p, n) => new IntrinsicParameterVariableEntity(
42365
+ parametersForOwnFieldsInitialization?.push(new ConstructorParameterInitializingFieldInfo(parameter, v.entity));
42366
+ return parameter;
42367
+ });
42368
+ const orderedParameters = Query.from(parametersForOwnVariables.filter((p) => !p.isOptional())).chain(orderedParametersForBaseConstructor.map((i) => i.parameter).filter((p) => !p.isOptional())).chain(parametersForOwnVariables.filter((p) => p.isOptional())).chain(orderedParametersForBaseConstructor.map((i) => i.parameter).filter((p) => p.isOptional())).toArray();
42369
+ return new DefaultConstructorParametersInfo(
42370
+ orderedParameters,
42371
+ orderedParametersForBaseConstructor,
42372
+ parametersForOwnFieldsInitialization
42373
+ );
42374
+ });
42375
+ }
42376
+ createOrderedParametersForBaseConstructor() {
42377
+ let result;
42378
+ if (this._baseConstructor !== void 0) {
42379
+ const localizedSignature = EntityLocalizationHelper.getLocalizedConstructorSignature(
42380
+ this._baseConstructor.value.getEntity(),
42381
+ this._baseConstructor.localization
42382
+ );
42383
+ result = Query.from(this._baseConstructor.value.getValueParameters()).zip(localizedSignature.getValueParameterNames(), (p, n) => {
42384
+ const parameter = new IntrinsicParameterVariableEntity(
42172
42385
  n.value,
42173
42386
  p.getType(),
42174
42387
  new ParameterVariableEntityContainer.Entity(this),
42175
42388
  p.isOptional(),
42176
42389
  p.isVariadic(),
42177
42390
  void 0
42178
- )).toArray();
42179
- } else {
42180
- return [];
42181
- }
42182
- });
42391
+ );
42392
+ return new DefaultConstructorParameterForBaseConstructorInfo(parameter, p.getEntity());
42393
+ }).toArray();
42394
+ } else {
42395
+ result = [];
42396
+ }
42397
+ return result;
42183
42398
  }
42184
42399
  };
42185
42400
  DefaultConstructorEntity = __decorateClass([
@@ -42191,47 +42406,13 @@ var VariableToInitialize = class {
42191
42406
  this.hasInitializer = hasInitializer;
42192
42407
  }
42193
42408
  };
42194
- var SynthesizedAliasTypeConstructor = class {
42195
- constructor(_analyzer, _originalConstructor, _aliasTypeEntity) {
42196
- this._analyzer = _analyzer;
42197
- this._originalConstructor = _originalConstructor;
42198
- this._aliasTypeEntity = _aliasTypeEntity;
42199
- this.kind = 9 /* Constructor */;
42200
- this._valueParameters = new Cached();
42201
- }
42202
- getValueParameters() {
42203
- return this._valueParameters.getOrInsertWith(() => this._originalConstructor.getValueParameters().map((p) => new IntrinsicParameterVariableEntity(
42204
- p.getName(),
42205
- p.getType(),
42206
- new ParameterVariableEntityContainer.Entity(this),
42207
- p.isOptional(),
42208
- p.isVariadic(),
42209
- p.getEntity().isSpecial()
42210
- )));
42211
- }
42212
- getDefinition() {
42213
- return { kind: 1 /* Intrinsic */ };
42214
- }
42215
- getContainer() {
42216
- return new TypeMemberEntityContainer2.Type(this._aliasTypeEntity);
42217
- }
42218
- isDefault() {
42219
- const hasParametersForFieldInitialization = this._originalConstructor.getEntity().isDefault()?.hasParametersForFieldInitialization === true;
42220
- return new DefaultConstructorEntityInfo2(this._originalConstructor, [], hasParametersForFieldInitialization);
42221
- }
42222
- isHidden() {
42223
- return this._originalConstructor.getEntity().isHidden();
42224
- }
42225
- isAbstract() {
42226
- return this._originalConstructor.getEntity().isAbstract();
42227
- }
42228
- getTags() {
42229
- return this._originalConstructor.getEntity().getTags();
42409
+ var DefaultConstructorParametersInfo = class {
42410
+ constructor(values, orderedParametersForBaseConstructor, parametersForOwnFieldsInitialization) {
42411
+ this.values = values;
42412
+ this.orderedParametersForBaseConstructor = orderedParametersForBaseConstructor;
42413
+ this.parametersForOwnFieldsInitialization = parametersForOwnFieldsInitialization;
42230
42414
  }
42231
42415
  };
42232
- SynthesizedAliasTypeConstructor = __decorateClass([
42233
- entityToStringDecorator
42234
- ], SynthesizedAliasTypeConstructor);
42235
42416
 
42236
42417
  // source/entities/DestructorEntity.ts
42237
42418
  var TypeDestructorDeclarationEntity = class {
@@ -44538,6 +44719,9 @@ var IntrinsicUnaryOperatorEntity = class {
44538
44719
  isHidden() {
44539
44720
  return void 0;
44540
44721
  }
44722
+ getTags() {
44723
+ return [];
44724
+ }
44541
44725
  };
44542
44726
  IntrinsicUnaryOperatorEntity = __decorateClass([
44543
44727
  entityToStringDecorator
@@ -44880,6 +45064,8 @@ function isEntityWithTags(entity) {
44880
45064
  case 11 /* MethodType */:
44881
45065
  case 12 /* StructuredType */:
44882
45066
  case 14 /* AliasType */:
45067
+ case 3 /* Getter */:
45068
+ case 4 /* Setter */:
44883
45069
  return true;
44884
45070
  default:
44885
45071
  Debug.typeIsAssignableTo();
@@ -48445,7 +48631,7 @@ var IrBuilder = class {
48445
48631
  });
48446
48632
  const statements = [];
48447
48633
  if (info.baseConstructor !== void 0) {
48448
- const callArguments = new OrderedCallArguments(info.orderedParametersForBaseConstructor.map((v) => VariableAccessExpression.get(this._entityMap.getVariableEntity(v))), false);
48634
+ const callArguments = new OrderedCallArguments(info.orderedParametersForBaseConstructor.map((v) => VariableAccessExpression.get(this._entityMap.getVariableEntity(v.parameter))), false);
48449
48635
  const baseConstructorEntity = info.baseConstructor.getEntity();
48450
48636
  const container = baseConstructorEntity.getContainer();
48451
48637
  if (container.kind === "type") {
@@ -48458,19 +48644,16 @@ var IrBuilder = class {
48458
48644
  statements.unshift(new ExpressionStatement3(baseConstructorCall, void 0));
48459
48645
  }
48460
48646
  }
48461
- const parametersForBaseConstructor = new Set(info.orderedParametersForBaseConstructor);
48462
- const typeMemberLookup = TypeMemberLookup.ofTypeEntity(this._analyzer, typeEntity, void 0);
48463
- for (const parameter of entity.getValueParameters()) {
48464
- if (!parametersForBaseConstructor.has(parameter)) {
48465
- const parameterName = parameter.getName();
48466
- const variable = typeMemberLookup.getNamedMembersByName(new SearchName(parameterName, true)).mapAndFilter((m) => m.value.kind === "variable" ? m.value : void 0).first();
48467
- if (variable !== void 0) {
48468
- const memberEntity = variable.getEntity();
48469
- const receiver = this.createExplicitReceiver(memberEntity);
48647
+ if (info.parametersForOwnFieldsInitialization !== void 0) {
48648
+ const fieldToInitializeByOwnParameter = Query.from(info.parametersForOwnFieldsInitialization).toMap((i) => i.parameter, (i) => i.field);
48649
+ for (const parameter of entity.getValueParameters()) {
48650
+ const field = fieldToInitializeByOwnParameter.get(parameter);
48651
+ if (field !== void 0) {
48652
+ const receiver = this.createExplicitReceiver(field);
48470
48653
  const memberAccess = TypeVariableAccessExpression.set(
48471
48654
  receiver,
48472
48655
  false,
48473
- AccessedVariable.fromEntity(this._entityMap.getVariableEntity(memberEntity))
48656
+ AccessedVariable.fromEntity(this._entityMap.getVariableEntity(field))
48474
48657
  );
48475
48658
  const parameterAccess = VariableAccessExpression.get(
48476
48659
  this._entityMap.getVariableEntity(parameter)
@@ -56355,12 +56538,13 @@ export {
56355
56538
  PackageAliasTypeDeclarationEntity,
56356
56539
  BinaryOperatorKind2 as BinaryOperatorKind,
56357
56540
  IntrinsicBinaryOperatorEntity,
56358
- DefaultConstructorEntityInfo2 as DefaultConstructorEntityInfo,
56541
+ DefaultConstructorEntityInfo3 as DefaultConstructorEntityInfo,
56542
+ DefaultConstructorParameterForBaseConstructorInfo,
56543
+ ConstructorParameterInitializingFieldInfo,
56359
56544
  TypeConstructorDeclarationEntity,
56360
56545
  IntrinsicConstructorEntity,
56361
56546
  DefaultConstructorEntity,
56362
56547
  VariableToInitialize,
56363
- SynthesizedAliasTypeConstructor,
56364
56548
  TypeDestructorDeclarationEntity,
56365
56549
  EntityHidingLevel_type,
56366
56550
  EntityHidingLevel_typeFamily,