fix: prevent obsolete typed-functions from hanging around
In other words, if name a depends on b and b is invalidated (because of added implementations), then a must be invalidated as well. Also adds a specific test (custom/piecemeal) that tests this.
This commit is contained in:
parent
66cbccfbbe
commit
4999cad775
3 changed files with 35 additions and 2 deletions
|
@ -1,4 +1,8 @@
|
|||
import './Complex.mjs'
|
||||
import {numComplex} from './Complex.mjs'
|
||||
export const negate = {
|
||||
Complex: [['self'], ref => z => ({re: ref.self(z.re), im: ref.self(z.im)})]
|
||||
/* need a "base case" to avoid infinite self-reference */
|
||||
Complex: [['self'], ref => z => {
|
||||
if (numComplex(z)) return {re: -z.re, im: -z.im}
|
||||
return {re: ref.self(z.re), im: ref.self(z.im)}
|
||||
}]
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue