Coder Social home page Coder Social logo

Comments (4)

davidanthoff avatar davidanthoff commented on July 23, 2024

convert(Any, NA) throws a method ambiguity error without it...

from datavalues.jl.

JeffBezanson avatar JeffBezanson commented on July 23, 2024

Works for me on master. What's the full error output you get?

from datavalues.jl.

davidanthoff avatar davidanthoff commented on July 23, 2024
julia> convert(Any, NA)
ERROR: MethodError: convert(::Type{Any}, ::DataValue{Union{}}) is ambiguous. Candidates:
  convert(::Type{Union{Missing, T}}, ::DataValue{Union{}}) where T in DataValues at C:\Users\david\.julia\dev\DataValues\src\scalar\core.jl:38
  convert(::Type{Any}, x) in Base at essentials.jl:153
Possible fix, define
  convert(::Type{Any}, ::DataValue{Union{}})
Stacktrace:
 [1] top-level scope at none:0

from datavalues.jl.

pfitzseb avatar pfitzseb commented on July 23, 2024

This also causes issues when trying to put a DataValue{Any} into Any-typed containers, e.g.

julia> dv = DataValue{Any}("asd")
DataValue{Any}("asd")

julia> c = Channel(0)
Channel{Any}(sz_max:0,sz_curr:0)

julia> put!(c, dv)
ERROR: MethodError: convert(::Type{Any}, ::DataValue{Any}) is ambiguous. Candidates:
  convert(::Type{Any}, x) in Base at essentials.jl:170
  convert(::Type{Union{Missing, T}}, value::DataValue{T}) where T in DataValues at /home/pfitzseb/.julia/packages/DataValues/N7oeL/src/scalar/core.jl:40
  convert(::Type{T}, x::T) where T>:Union{Missing, Nothing} in Base at missing.jl:68
To resolve the ambiguity, try making one of the methods more specific, or adding a new method more specific than any of the existing applicable methods.
Stacktrace:
 [1] put!(::Channel{Any}, ::DataValue{Any}) at ./channels.jl:311
 [2] top-level scope at REPL[5]:1

on 1.5 or

julia> dv = DataValue{Any}("asd")
Error showing value of type DataValue{Any}:
ERROR: MethodError: convert(::Type{Any}, ::DataValue{Any}) is ambiguous. Candidates:
  convert(::Type{Any}, x) in Base at essentials.jl:204
  convert(::Type{T}, x::T) where T>:Union{Missing, Nothing} in Base at missing.jl:68
  convert(::Type{T}, x::T) where T>:Nothing in Base at some.jl:35
  convert(::Type{T}, x) where T>:Union{Missing, Nothing} in Base at missing.jl:70
  convert(::Type{T}, x) where T>:Nothing in Base at some.jl:36
  convert(::Type{Union{Missing, T}}, value::DataValue{T}) where T in DataValues at /home/pfitzseb/.julia/packages/DataValues/N7oeL/src/scalar/core.jl:40
To resolve the ambiguity, try making one of the methods more specific, or adding a new method more specific than any of the existing applicable methods.
Stacktrace:
  [1] Base.RefValue{Any}(x::DataValue{Any})
    @ Base ./refvalue.jl:8
  [2] Ref{Any}(x::DataValue{Any})
    @ Base ./refpointer.jl:136
  [3] display(d::REPL.REPLDisplay, mime::MIME{Symbol("text/plain")}, x::Any)
    @ REPL ~/Documents/Git/julia/usr/share/julia/stdlib/v1.7/REPL/src/REPL.jl:212
  [4] display(d::REPL.REPLDisplay, x::Any)
    @ REPL ~/Documents/Git/julia/usr/share/julia/stdlib/v1.7/REPL/src/REPL.jl:225

on master.

That first error is also the cause of julia-vscode/julia-vscode#1940.

from datavalues.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.