Skip to content

Commit

Permalink
* changed the error message when trying to call a non-function
Browse files Browse the repository at this point in the history
  • Loading branch information
christianschmitz committed Nov 23, 2023
1 parent 780721c commit d1fef55
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion helios.js
Original file line number Diff line number Diff line change
Expand Up @@ -33380,7 +33380,7 @@ export class CallExpr extends Expr {
} else if (fnVal.asFunc) {
return fnVal.asFunc.call(this.site, posArgVals, namedArgVals);
} else {
this.#fnExpr.typeError(`expected function, got ${fnVal.toString()}`);
this.#fnExpr.typeError(`unable to call ${fnVal.toString()} (returned by ${this.#fnExpr.toString()})`);
return null;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/helios-ast-expressions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2848,7 +2848,7 @@ export class CallExpr extends Expr {
} else if (fnVal.asFunc) {
return fnVal.asFunc.call(this.site, posArgVals, namedArgVals);
} else {
this.#fnExpr.typeError(`expected function, got ${fnVal.toString()}`);
this.#fnExpr.typeError(`unable to call ${fnVal.toString()} (returned by ${this.#fnExpr.toString()})`);
return null;
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/example-scripts.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export default async function main() {
func main() -> Bool {
x: ByteArray = #32423acd232;
(fibonacci(1) == 1) && x.length() == 12
}`, "expected function, got Int", []);
}`, "unable to call Int", []);

// 7. mutual recursion
// * mutual recursive struct statements in wrong order
Expand Down

0 comments on commit d1fef55

Please sign in to comment.