feat: include method arity in missing method runtime error messages
Add helper functions `canonicalSymbol` and `methodArgumentsString` to extract and format the argument count from symbol names. Update the runtime error message in `runInterpreter` to append the arity (e.g., "with 0 arguments", "with 2 arguments", "with 1 argument") when a class does not implement a method. Add new test cases for missing methods with one, two, and eleven arguments, and update all existing test expectations to include the arity suffix.
This commit is contained in:
@@ -3,5 +3,5 @@ var fiber = new Fiber {
|
||||
}
|
||||
|
||||
IO.print(fiber.error) // expect: null
|
||||
IO.print(fiber.try) // expect: String does not implement method 'unknown'.
|
||||
IO.print(fiber.error) // expect: String does not implement method 'unknown'.
|
||||
IO.print(fiber.try) // expect: String does not implement method 'unknown' with 0 arguments.
|
||||
IO.print(fiber.error) // expect: String does not implement method 'unknown' with 0 arguments.
|
||||
|
||||
+1
-1
@@ -6,5 +6,5 @@ var fiber = new Fiber {
|
||||
|
||||
IO.print(fiber.try)
|
||||
// expect: before
|
||||
// expect: Bool does not implement method 'unknownMethod'.
|
||||
// expect: Bool does not implement method 'unknownMethod' with 0 arguments.
|
||||
IO.print("after try") // expect: after try
|
||||
|
||||
Reference in New Issue
Block a user