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 01658b13c2 - Show all commits

View File

@ -129,9 +129,12 @@ describe('A custom instance', () => {
assert.strictEqual(
inst.typeMerge(3, inst.complex(4.5,2.1)),
'Merge to Complex')
// The following is the current behavior, since both `3+0i` and `3n + 0ni`
// are Complex, but it is unfortunate and hopefully it will be fixed
// with templates:
// The following is the current behavior, since 3 converts to 3+0i
// and 3n converts to 3n+0ni, both of which are technically Complex.
// This will remain the case even with templated Complex, because
// both Complex<bigint> and Complex<NumInt> will refine Complex (for the
// sake of catching new specializations). Not sure whether that will be
// OK or a problem that will have to be dealt with.
assert.strictEqual(inst.typeMerge(3, 3n), 'Merge to Complex')
})
})