feat: validate argument type in Fn.new and add runtime error test
Add type checking to the `fn_new` native function to ensure the argument passed to `Fn.new` is either a function or closure. Previously, passing an invalid type like an integer would silently succeed. Now it returns a clear runtime error message: "Argument must be a function." Also remove two stale TODO comments about newline handling in the compiler that were no longer relevant to current parsing logic.
This commit is contained in:
@@ -0,0 +1 @@
|
||||
new Fn(3) // expect runtime error: Argument must be a function.
|
||||
Reference in New Issue
Block a user