julia
4ec13f5e - Make callable-related MethodError messages more descriptive (#57815)

Commit
314 days ago
Make callable-related MethodError messages more descriptive (#57815) Addresses https://github.com/JuliaLang/julia/issues/57807 to some extent, although the error message may be improved further. On nightly, ```julia julia> stack(1:3, 1:3) ERROR: MethodError: objects of type UnitRange{Int64} are not callable Use square brackets [] for indexing an Array. The object of type `UnitRange{Int64}` exists, but no method is defined for this combination of argument types when trying to treat it as a callable object. ``` The second sentence seems unrelated to the first, and the source of the error remains unclear from the message. This PR makes the message more verbose, and provides pointers. ```julia julia> stack(1:3, 200) ERROR: MethodError: objects of type UnitRange{Int64} are not callable. In case you did not try calling it explicitly, check if a UnitRange{Int64} has been passed as an argument to a method that expects a callable instead. In case you're trying to index into the array, use square brackets [] instead of parentheses (). The object of type `UnitRange{Int64}` exists, but no method is defined for this combination of argument types when trying to treat it as a callable object. ```
Author
Parents
Loading