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

MethodError: no method matching String(::Expr) #266

Open
letalvoj opened this issue Aug 27, 2021 · 10 comments
Open

MethodError: no method matching String(::Expr) #266

letalvoj opened this issue Aug 27, 2021 · 10 comments

Comments

@letalvoj
Copy link

letalvoj commented Aug 27, 2021

Julia 1.5.4, SnoopCompile 2.7.1

data = SnoopCompile.read("7464124.snoop")
pc = SnoopCompile.parcel(reverse!(data[2]))

yields

ERROR: LoadError: MethodError: no method matching String(::Expr)
Closest candidates are:
  String(::String) at boot.jl:337
  String(::Array{UInt8,1}) at strings/string.jl:39
  String(::Base.CodeUnits{UInt8,String}) at strings/string.jl:77
  ...
Stacktrace:
 [1] parse_call(::String; subst::Array{Pair{String,String},1}, exclusions::Array{String,1}) at /Users/vojtech.letal/.julia/packages/SnoopCompile/Y17OY/src/parcel_snoopc.jl:89
 [2] format_userimg(::Array{String,1}; subst::Array{Pair{String,String},1}, exclusions::Array{String,1}) at /Users/vojtech.letal/.julia/packages/SnoopCompile/Y17OY/src/parcel_snoopc.jl:184
 [3] format_userimg(::Array{String,1}) at /Users/vojtech.letal/.julia/packages/SnoopCompile/Y17OY/src/parcel_snoopc.jl:182

it's this line

name = String(name)::String

Seems like there is a test covering that very method. If I manage to fix that issue I will submit a pr

success, line, modsym = SnoopCompile.parse_call("Tuple{typeof(ColorTypes.to_top), Type{C}} where C<:(ColorTypes.Colorant{T, N} where N where T)")

@letalvoj
Copy link
Author

Ok. These should be all Symbol according to the test suite. I have no idea why I get Expr there.
The snooped compilation is pretty large and it uses macros, Flux, HTTP, ... 🤷

@letalvoj
Copy link
Author

A workaround which might just produce incorrect results yet it works for what I needed it to was to replace

name = String(name)::String

with

name = string(name)::String

@timholy
Copy link
Owner

timholy commented Aug 30, 2021

I'd be fine with a PR that does that, especially if it came with a test! I don't know how to trigger this, but if you do...

@letalvoj
Copy link
Author

Yeah, it's most likely wrong for the ::Expr type ... If I fix it such that it makes sense I'll send a PR for sure 👍

@pkofod
Copy link

pkofod commented Nov 2, 2021

Yeah, I'm hitting this as well when benchmarking code. I can share a private reproducer if you want @timholy

@timholy
Copy link
Owner

timholy commented Nov 2, 2021

Yeah, I'd take a reproducer!

@pkofod
Copy link

pkofod commented Nov 2, 2021

It's not minimal, but I'll e-mail it.

@letalvoj
Copy link
Author

@pkofod did you manage to find out the root cause?

@PharmCat
Copy link

Hello! Is any thoughts how to fix it locally?

@timholy
Copy link
Owner

timholy commented Jan 10, 2023

Recommended practice these days is to use SnoopPrecompile. I'd recommend switching.

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

No branches or pull requests

4 participants