Skip to content

Commit

Permalink
Fix synthesised label generation
Browse files Browse the repository at this point in the history
  • Loading branch information
sgwilym committed Feb 2, 2023
1 parent 23cdee7 commit 6bce1a5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 1.0.1

- Fixes a bug which caused value types to be used as fingerprints when
calculating fingerprints for certain kinds of ranges.

# 1.0.0

- Added `getType` to `RangeMessengerConfig.decode`
Expand Down
7 changes: 5 additions & 2 deletions src/fingerprint_tree/fingerprint_tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,9 @@ export class FingerprintTree<ValueType, LiftedType>
y,
);

const synthesisedLabel = [maxValue as unknown as LiftedType, [1, [
const maxLifted = this.monoid.lift(maxValue);

const synthesisedLabel = [maxLifted[0], [1, [
[maxValue],
maxValue,
]]] as [
Expand Down Expand Up @@ -504,7 +506,8 @@ export class FingerprintTree<ValueType, LiftedType>
maxValue,
);

const synthesisedLabel = [maxValue as unknown as LiftedType, [1, [
const maxLifted = this.monoid.lift(maxValue);
const synthesisedLabel = [maxLifted[0], [1, [
[maxValue],
maxValue,
]]] as [
Expand Down
5 changes: 4 additions & 1 deletion src/range_messenger/range_messenger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,11 @@ export class RangeMessenger<EncodedMessageType, ValueType, LiftedType> {
return ({ "type": "terminal" });
}
}
} catch {
} catch (err) {
// argh
console.group("range-reconcile: Could not decode message");
console.warn(message);
console.warn(err);
}

return null as never;
Expand Down

0 comments on commit 6bce1a5

Please sign in to comment.