@shapeshift-labs/frontier-lang-compiler 0.2.137 → 0.2.138

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.
@@ -38,7 +38,7 @@ function semanticEditFallbackResult(input, topLevelResult) {
38
38
  },
39
39
  summary: {
40
40
  ...resultBase.summary,
41
- changedExistingDeclarations: topLevelResult.summary?.changedExistingDeclarations ?? resultBase.summary?.changedExistingDeclarations ?? 0,
41
+ changedExistingDeclarations: semanticFallbackChangedExistingDeclarations(topLevelResult, resultBase, stagedFallback),
42
42
  conflicts: 0,
43
43
  gatesPassed: gates.filter((gate) => gate.status === 'passed').length,
44
44
  semanticEditOperations: artifacts.script.summary.operations,
@@ -62,7 +62,28 @@ function semanticEditFallbackResult(input, topLevelResult) {
62
62
 
63
63
  function shouldTrySemanticEditFallback(result) {
64
64
  const conflicts = result.conflicts ?? [];
65
- return conflicts.length > 0 && conflicts.every((conflict) => conflict.code === JsTsSafeMergeConflictCodes.changedExistingDeclaration);
65
+ return conflicts.length > 0 && conflicts.every((conflict) => semanticFallbackConflictCodes.has(conflict.code));
66
+ }
67
+
68
+ const semanticFallbackConflictCodes = new Set([
69
+ JsTsSafeMergeConflictCodes.changedExistingDeclaration,
70
+ JsTsSafeMergeConflictCodes.typeAliasConflict
71
+ ]);
72
+
73
+ function semanticFallbackConflictCode(result) {
74
+ return result.conflicts?.find((conflict) => semanticFallbackConflictCodes.has(conflict.code))?.code
75
+ ?? JsTsSafeMergeConflictCodes.changedExistingDeclaration;
76
+ }
77
+
78
+ function semanticFallbackChangedExistingDeclarations(topLevelResult, resultBase, stagedFallback) {
79
+ const conflictCount = (topLevelResult.conflicts ?? [])
80
+ .filter((conflict) => semanticFallbackConflictCodes.has(conflict.code)).length;
81
+ return Math.max(
82
+ topLevelResult.summary?.changedExistingDeclarations ?? 0,
83
+ resultBase?.summary?.changedExistingDeclarations ?? 0,
84
+ stagedFallback?.neutralization?.summary?.workerChangedExistingDeclarations ?? 0,
85
+ conflictCount
86
+ );
66
87
  }
67
88
 
68
89
  function createSemanticEditFallbackArtifacts(input, topLevelResult, stagedFallback) {
@@ -240,7 +261,7 @@ function semanticEditFallbackBlockedResult(input, topLevelResult, artifacts) {
240
261
  : topLevelResult.admission?.reasonCodes ?? [];
241
262
  const gates = semanticEditGates(artifacts);
242
263
  const conflict = {
243
- code: JsTsSafeMergeConflictCodes.changedExistingDeclaration,
264
+ code: semanticFallbackConflictCode(topLevelResult),
244
265
  gateId: 'semantic-edit-replay',
245
266
  message: 'JS/TS semantic edit fallback did not verify a clean replay.',
246
267
  side: 'worker',
@@ -262,6 +283,7 @@ function semanticEditFallbackBlockedResult(input, topLevelResult, artifacts) {
262
283
  },
263
284
  summary: {
264
285
  ...topLevelResult.summary,
286
+ changedExistingDeclarations: semanticFallbackChangedExistingDeclarations(topLevelResult, topLevelResult),
265
287
  conflicts: 1,
266
288
  gatesPassed: gates.filter((gate) => gate.status === 'passed').length,
267
289
  semanticEditOperations: artifacts.summary.operations,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shapeshift-labs/frontier-lang-compiler",
3
- "version": "0.2.137",
3
+ "version": "0.2.138",
4
4
  "description": "Compiler facade for Frontier Lang source documents and language projection adapters.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",