# Can't find overloaded parse() method

**URL:** <https://discourse.julialang.org/t/cant-find-overloaded-parse-method/16697>\
**Category:** General Usage\
**Tags:** question, package\
**Created:** [October 23, 2018, 4:40pm UTC](https://discourse.julialang.org/t/cant-find-overloaded-parse-method/16697 "2018-10-23T16:40:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kilgoretrout](https://avatars.discourse-cdn.com/v4/letter/k/dc4da7/32.png) [@kilgoretrout](https://discourse.julialang.org/u/kilgoretrout)\
**Post date:** [October 23, 2018, 4:40pm UTC](https://discourse.julialang.org/t/cant-find-overloaded-parse-method/16697/1 "2018-10-23T16:40:14Z")

</div>

I’m trying to use a package `AutoEnvs` which uses the [AutomotiveDrivingModels](https://github.com/sisl/AutomotiveDrivingModels.jl) 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](https://stackoverflow.com/questions/42947095/no-method-matching-in-subtraction) but it didn’t help.

This is all to try and install [ngsim\_env](https://github.com/sisl/ngsim_env). Note, [the installation instructions](https://github.com/sisl/ngsim_env/blob/master/docs/install_env_gail_full.md) 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!

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [October 23, 2018, 4:44pm UTC](https://discourse.julialang.org/t/cant-find-overloaded-parse-method/16697/2 "2018-10-23T16:44:36Z")

</div>

> [@kilgoretrout](#):
>
> could this be the problem if the overloaded `parse()` is expecting `String` ?

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

---

<div class="post-metadata">

**Author:** ![kilgoretrout](https://avatars.discourse-cdn.com/v4/letter/k/dc4da7/32.png) [@kilgoretrout](https://discourse.julialang.org/u/kilgoretrout)\
**Post date:** [October 23, 2018, 5:27pm UTC](https://discourse.julialang.org/t/cant-find-overloaded-parse-method/16697/3 "2018-10-23T17:27:05Z")

</div>

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