KittyCAD / modeling-app

The KittyCAD modeling app.
https://kittycad.io/modeling-app/download
MIT License
368 stars 30 forks source link

[CRYPTIC]: function with no defined return results in error at callsite, not function definition #3224

Closed paultag closed 2 months ago

paultag commented 2 months ago

Paste minimal KCL source that produces a cryptic error

fn test = (origin) => {
  origin
}

test([0, 0])

Expected Behavior

The error in this case (no defined return) ought to be placed on the function declaration, not at the callsite(s)

Additional Context

No response

jessfraz commented 2 months ago

thats right here for anyone who gets to it before me: https://github.com/KittyCAD/modeling-app/blob/b32f5c1d4e7040fbe8dd4be2441fd539931a5be4/src/wasm-lib/kcl/src/ast/types.rs#L1499