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

TODO: v2 API: Support converting types in setters #21

Open
ghost opened this issue Jun 4, 2020 · 0 comments
Open

TODO: v2 API: Support converting types in setters #21

ghost opened this issue Jun 4, 2020 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@ghost
Copy link

ghost commented Jun 4, 2020

In old salsa this was supported, but in the new v2 API it's not:

julia> rt = Runtime()
Salsa.Runtime(Salsa.DefaultStorage(0, ...))

julia> @declare_input x(rt)::Int
(x, set_x!, delete_x!)

julia> set_x!(rt, 2.0)
ERROR: MethodError: no method matching set_x!(::Salsa._TopLevelRuntime{Salsa.EmptyContext,Salsa._DefaultSalsaStorage.DefaultStorage}, ::Float64)
Closest candidates are:
  set_x!(::Any, ::Int64) at /Users/nathandaly/.julia/dev/Salsa/src/Salsa.jl:773
Stacktrace:
 [1] top-level scope at REPL[34]:1

julia> @declare_input a(rt)::Vector{Int}
(a, set_a!, delete_a!)

julia> set_a!(rt, [])
ERROR: MethodError: no method matching set_a!(::Salsa._TopLevelRuntime{Salsa.EmptyContext,Salsa._DefaultSalsaStorage.DefaultStorage}, ::Array{Any,1})
Closest candidates are:
  set_a!(::Any, ::Array{Int64,1}) at /Users/nathandaly/.julia/dev/Salsa/src/Salsa.jl:773
Stacktrace:
 [1] top-level scope at REPL[41]:1

julia>

This should be very simple; I think we just need to call convert(T, v) in the generated setters. :)

@ghost ghost added enhancement New feature or request good first issue Good for newcomers labels Jun 4, 2020
@NHDaly NHDaly assigned NHDaly and unassigned NHDaly Dec 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant