feat: switch method signatures to parenthesized parameter notation and update error messages
The method signature format has been changed from space-counted arity (e.g., "== ") to explicit parenthesized parameter lists (e.g., "==(_)"). This required updating the MAX_METHOD_SIGNATURE calculation to account for parentheses and parameter separators, replacing the old copyName helper with a new Signature struct and SignatureType enum, and rewriting the methodNotFound error message to display the full signature string instead of reconstructing arity from trailing spaces. All core method registrations in wren_core.c, wren_io.c, and corresponding test expectations have been updated to use the new signature format.
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' with 0 arguments.
|
||||
IO.print(fiber.error) // expect: String does not implement method 'unknown' with 0 arguments.
|
||||
IO.print(fiber.try) // expect: String does not implement 'unknown'.
|
||||
IO.print(fiber.error) // expect: String does not implement 'unknown'.
|
||||
|
||||
+1
-1
@@ -6,5 +6,5 @@ var fiber = new Fiber {
|
||||
|
||||
IO.print(fiber.try)
|
||||
// expect: before
|
||||
// expect: Bool does not implement method 'unknownMethod' with 0 arguments.
|
||||
// expect: Bool does not implement 'unknownMethod'.
|
||||
IO.print("after try") // expect: after try
|
||||
|
||||
@@ -4,4 +4,4 @@ class Foo {
|
||||
|
||||
class Bar is Foo {}
|
||||
|
||||
Bar.methodOnFoo // expect runtime error: Bar metaclass does not implement method 'methodOnFoo' with 0 arguments.
|
||||
Bar.methodOnFoo // expect runtime error: Bar metaclass does not implement 'methodOnFoo'.
|
||||
|
||||
@@ -1 +1 @@
|
||||
[1, 2, 3].all("string") // expect runtime error: String does not implement method 'call' with 1 argument.
|
||||
[1, 2, 3].all("string") // expect runtime error: String does not implement 'call(_)'.
|
||||
@@ -1,3 +1,3 @@
|
||||
class Foo {}
|
||||
|
||||
(new Foo).someUnknownMethod // expect runtime error: Foo does not implement method 'someUnknownMethod' with 0 arguments.
|
||||
(new Foo).someUnknownMethod // expect runtime error: Foo does not implement 'someUnknownMethod'.
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
class Foo {}
|
||||
|
||||
(new Foo).someUnknownMethod(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) // expect runtime error: Foo does not implement method 'someUnknownMethod' with 11 arguments.
|
||||
(new Foo).someUnknownMethod(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) // expect runtime error: Foo does not implement 'someUnknownMethod(_,_,_,_,_,_,_,_,_,_,_)'.
|
||||
@@ -1,3 +1,3 @@
|
||||
class Foo {}
|
||||
|
||||
(new Foo).someUnknownMethod(1, 2) // expect runtime error: Foo does not implement method 'someUnknownMethod' with 2 arguments.
|
||||
(new Foo).someUnknownMethod(1, 2) // expect runtime error: Foo does not implement 'someUnknownMethod(_,_)'.
|
||||
@@ -1,3 +1,3 @@
|
||||
class Foo {}
|
||||
|
||||
(new Foo).someUnknownMethod(1) // expect runtime error: Foo does not implement method 'someUnknownMethod' with 1 argument.
|
||||
(new Foo).someUnknownMethod(1) // expect runtime error: Foo does not implement 'someUnknownMethod(_)'.
|
||||
@@ -1,3 +1,3 @@
|
||||
class Foo {}
|
||||
|
||||
Foo.bar // expect runtime error: Foo metaclass does not implement method 'bar' with 0 arguments.
|
||||
Foo.bar // expect runtime error: Foo metaclass does not implement 'bar'.
|
||||
@@ -1,7 +1,7 @@
|
||||
class Base {}
|
||||
|
||||
class Derived is Base {
|
||||
foo { super.doesNotExist } // expect runtime error: Base does not implement method 'doesNotExist' with 0 arguments.
|
||||
foo { super.doesNotExist(1) } // expect runtime error: Base does not implement 'doesNotExist(_)'.
|
||||
}
|
||||
|
||||
(new Derived).foo
|
||||
|
||||
Reference in New Issue
Block a user