Can't find overloaded parse() method

I’m trying to use a package AutoEnvs which uses the AutomotiveDrivingModels package but when I run using AutoEnvs I get this error

MethodError: no method matching parse(::Type{AutomotiveDrivingModels.LaneConnection}, ::SubString{String})

But in the same file where this call to parse() is made it defines the overloaded parse() with precisely these parameters. In the problem code in AutomotiveDrivingModels/src/2d/roadway/roadways.jl they do all of the following:

  1. Define struct LaneConnection
  2. Define function Base.parse(::Type{LaneConnection}, line::String)
  3. Define function advance!()
  4. In a loop set conn = parse(LaneConnection, advance!()) - this throws the error

I tried using ::Type{AutomotiveDrivingModels.LaneConnection} in the definition of Base.parse and also adding the package name in the call to parse but it didn’t help.

Based on the error it looks like advance!() is returning a SubString - could this be the problem if the overloaded parse() is expecting String ?

I also tried adding import Base: parse as recommended here but it didn’t help.

This is all to try and install ngsim_env. Note, the installation instructions require an older version of AutomotiveDrivingModels at a specific commit.

I am on Mac OS Mojave 10.14 and also using Julia v0.7.0 because of a restriction in ngsim_env.

Thank you for any help!

Definitely. They should probably accept an AbstractString. You can call String on your SubString to convert it in the meantime.

1 Like

Yeah, this happened because I am forced to use an older version of AutomotiveDrivingModels. Changing the function signature to line::AbstractString seemed to work.