Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix synthesised label generation #2

Merged
merged 1 commit into from
Feb 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix synthesised label generation
  • Loading branch information
sgwilym committed Feb 2, 2023
commit 6bce1a5860deb0e3d0e272bb51f5a503eed76dca
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