docs/sigs.md in rbs-1.1.1 vs docs/sigs.md in rbs-1.2.0
- old
+ new
@@ -24,11 +24,11 @@
The test installs instrumentations to spy the method calls and check if arguments/return values are correct with respect to the type of the method in signature.
If errors are reported by the test, you will fix the signature.
You will be sure that you ship a correct signature finally.
-The instrumentations are implemneted using `Module#prepend`.
+The instrumentations are implemented using `Module#prepend`.
It defines a module with same name of methods, which asserts the type of arguments/return values and calls `super`.
## Type errors
If the test detects type errors, it will print error messages.
@@ -67,9 +67,26 @@
### UnresolvedOverloadingError
The error means there is a type error on overloaded methods.
The `rbs` test framework tries to the best error message for overloaded methods too, but it reports the `UnresolvedOverloadingError` when it fails.
+
+### DuplicatedMethodDefinitionError
+
+The error is reported when a method is defined multiple times, as RBS does not allow duplicate method definitions. When you need to overload a method, use the `...` syntax:
+
+```ruby
+# First definition
+class C
+ def foo: () -> untyped
+end
+
+# Second definition, use `...` syntax to tell RBS that we're overloading the method
+class C
+ def foo: () -> untyped
+ | ...
+end
+```
## Setting up the test
The design of the signature testing aims to be non-intrusive. The setup is done in two steps: