feat: Template types #45

Merged
glen merged 10 commits from template_types into main 2022-08-05 12:48:57 +00:00
Showing only changes of commit 21ce098f98 - Show all commits

View File

@ -136,5 +136,10 @@ describe('A custom instance', () => {
// sake of catching new specializations). Not sure whether that will be // sake of catching new specializations). Not sure whether that will be
// OK or a problem that will have to be dealt with. // OK or a problem that will have to be dealt with.
assert.strictEqual(inst.typeMerge(3, 3n), 'Merge to Complex') assert.strictEqual(inst.typeMerge(3, 3n), 'Merge to Complex')
// But types that truly cannot be merged should throw a TypeError
// Should add a variation of this with a more usual type once there is
// one not interconvertible with others...
inst.install(genericSubtract)
assert.throws(() => inst.typeMerge(3, undefined), TypeError)
}) })
}) })