-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Consider this example:
import { Real, Vec, fn, vec } from "rose";
const foo = fn([Real, Real], Real, (x, y) => {
const z = f(x, y);
const w = g(x, z);
const u = h(z);
const v = α(w, u);
return v;
});
const bar = fn(
[Vec(n, { x: Real, y: Real })],
Vec(n, Real),
(vals) => vec(n, Real, (i) => {
const { x, y } = vals[i];
return f(x, y);
})
);The x and y variables inside the body of the vec both get typed as symbol, when they should be typed as Real, causing this error in the call to f:
Argument of type 'symbol' is not assignable to parameter of type 'Real'.
If you add an as const after the { x: Real, y: Real } type, the correct behavior occurs, but this is ugly. There should be a way to handle these sorts of types without the user having to write as const.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels