This changeset lets DidYouMean::Correctable to use #detailed_message,
which is Ruby 3.2's more dedicated way to show additional error
information like did_you_mean and error_highlight.
There are some problems with the approach of overriding #message.
One is that the approach breaks a test that checks a return value
of #message. I actually faced this kind of issues in real-world
applications when I was implementing error_highlight with the same
approach as did_you_mean.
See https://github.com/minitest/minitest/pull/880 for example.
I believe #detailed_message will solve the issue.
I want did_you_mean and error_highlight to use the new API instead of
clobbering #message method.
See https://bugs.ruby-lang.org/issues/18564 for detail.
This changeset lets DidYouMean::Correctable to use #detailed_message, which is Ruby 3.2's more dedicated way to show additional error information like did_you_mean and error_highlight.
There are some problems with the approach of overriding #message. One is that the approach breaks a test that checks a return value of #message. I actually faced this kind of issues in real-world applications when I was implementing error_highlight with the same approach as did_you_mean. See https://github.com/minitest/minitest/pull/880 for example.
For this reason, error_highlight enhances only NameError. The support of other error types such as TypeError and ArgumentError is currently disabled because it breaks more tests: https://github.com/ruby/error_highlight/blob/f88b6fab2ff34559a0f08d019d574dbb52426a20/lib/error_highlight/core_ext.rb#L49-L52
I believe #detailed_message will solve the issue. I want did_you_mean and error_highlight to use the new API instead of clobbering #message method. See https://bugs.ruby-lang.org/issues/18564 for detail.