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

getindex(::LaTeXStrings.LaTeXString, ::AbstractVector{Bool}) is ambiguous (in Julia v1.7) #61

Closed
ranocha opened this issue Jun 16, 2022 · 3 comments · Fixed by #62
Closed

Comments

@ranocha
Copy link
Contributor

ranocha commented Jun 16, 2022

I found this while running tests with Aqua.jl for one of my packages.

julia> using Pkg; Pkg.activate(temp=true); Pkg.add("LaTeXStrings")
  Activating new project at `/tmp/jl_PC9tEj`
    Updating registry at `~/.julia/registries/General.toml`
   Resolving package versions...
    Updating `/tmp/jl_PC9tEj/Project.toml`
  [b964fa9f] + LaTeXStrings v1.3.0
    Updating `/tmp/jl_PC9tEj/Manifest.toml`
  [b964fa9f] + LaTeXStrings v1.3.0

julia> using LaTeXStrings

julia> getindex(L"\alpha \beta \gamma", [true])
ERROR: MethodError: getindex(::LaTeXString, ::Vector{Bool}) is ambiguous. Candidates:
  getindex(s::AbstractString, v::AbstractVector{Bool}) in Base at strings/basic.jl:194
  getindex(s::LaTeXString, i::AbstractVector{<:Integer}) in LaTeXStrings at ~/.julia/packages/LaTeXStrings/pJ7vn/src/LaTeXStrings.jl:120
Possible fix, define
  getindex(::LaTeXString, ::AbstractVector{Bool})
Stacktrace:
 [1] top-level scope
   @ REPL[8]:1
@stevengj
Copy link
Member

Note that this method just throws an error for strings anyway … what are you trying to accomplish here?

@ranocha
Copy link
Contributor Author

ranocha commented Jun 19, 2022

I ran the Auqa.test_all tests from Aqua.jl for one of my packages. It reported this as ambiguous method. Thus, I needed to exclude getindex explicitly from the method ambiguity tests which is a bit annoying since it excludes checks of the same function for my own types, too. Thus, it may be nice to resolve this method ambiguity to allow downstream packages to run all ambiguity tests with Aqua.jl.
If this would be okay for you, I can make a PR. Otherwise, feel free to close this issue.

@stevengj
Copy link
Member

A PR would be fine.

ranocha added a commit to ranocha/LaTeXStrings.jl that referenced this issue Jun 20, 2022
stevengj pushed a commit that referenced this issue Jun 22, 2022
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 a pull request may close this issue.

2 participants