Skip to content

Conversation

@jishnub
Copy link
Member

@jishnub jishnub commented Oct 13, 2020

Looks like this was missed out in #126 . This improves the error message (it's still a MethodError).

before:

julia> similar(Matrix{Float64}, (:, :))
ERROR: MethodError: no method matching Array{Float64,2}(::UndefInitializer, ::Tuple{Colon,Colon})

after:

julia> similar(Matrix{Float64}, (:, :))
ERROR: MethodError: no method matching similar(::Type{Array{Float64,2}}, ::Tuple{Colon,Colon})

@codecov
Copy link

codecov bot commented Oct 13, 2020

Codecov Report

Merging #165 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #165   +/-   ##
=======================================
  Coverage   99.21%   99.21%           
=======================================
  Files           4        4           
  Lines         256      256           
=======================================
  Hits          254      254           
  Misses          2        2           
Impacted Files Coverage Δ
src/OffsetArrays.jl 99.43% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c841a99...2b4c73d. Read the comment docs.

Copy link
Member

@johnnychen94 johnnychen94 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks nice. Perhaps you might also want to test the error message content, since this is what this PR does. For me it doesn't matter much as long as it errors...

@jishnub
Copy link
Member Author

jishnub commented Oct 13, 2020

Ideally yes, but that might be going too far, don't want tests to break if Base changes the error message. This is type-piracy anyway

@jishnub
Copy link
Member Author

jishnub commented Oct 13, 2020

There appears to be a way to test this by checking the function field of the raised MethodError and making sure that it's similar, but I wonder if it might be too internal? That's exactly what this PR does

@johnnychen94
Copy link
Member

johnnychen94 commented Oct 13, 2020

Probably just redirect the error io: https://github.com/JuliaGraphics/ColorTypes.jl/blob/bd31741d162361ebd44ed05ae532266998d9ce9f/test/error_hints.jl#L1-L15

(Your new avatar looks nice!)

@jishnub jishnub merged commit 4aba375 into JuliaArrays:master Oct 19, 2020
@jishnub jishnub deleted the similarcolon branch October 19, 2020 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants