Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix type comparison printing in MethodErrors from convert. #49645

Merged
merged 1 commit into from
May 5, 2023

Conversation

fredrikekre
Copy link
Member

This patch removes the erroneous {} for types without parameters when printing MethodErrors from convert. Fixes e.g. the following (note Float64{}):

julia> struct A{B, C} end

julia> convert(A{Float64,1}, A{Float64,2}())
ERROR: MethodError: Cannot `convert` an object of type
  A{Float64{},2} to an object of type
  A{Float64{},1}

@fredrikekre fredrikekre added bugfix This change fixes an existing bug error messages Better, more actionable error messages labels May 5, 2023
@KristofferC KristofferC added the merge me PR is reviewed. Merge when all tests are passing label May 5, 2023
This patch removes the erroneous `{}` for types without parameters when
printing `MethodError`s from convert. Fixes e.g. the following (note
`Float64{}`):

```julia
julia> struct A{B, C} end

julia> convert(A{Float64,1}, A{Float64,2}())
ERROR: MethodError: Cannot `convert` an object of type
  A{Float64{},2} to an object of type
  A{Float64{},1}
```
@timholy
Copy link
Sponsor Member

timholy commented May 5, 2023

Amazing I've never noticed this before. Thanks!

@fredrikekre fredrikekre merged commit 6bcdd00 into master May 5, 2023
@fredrikekre fredrikekre deleted the fe/convertmethoderror branch May 5, 2023 16:22
@DilumAluthge DilumAluthge removed the merge me PR is reviewed. Merge when all tests are passing label May 5, 2023
@vtjnash
Copy link
Sponsor Member

vtjnash commented May 5, 2023

Fixes #36644

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix This change fixes an existing bug error messages Better, more actionable error messages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants