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

Method definition convert_input overwritten #382

Open
nsajko opened this issue Jan 25, 2023 · 1 comment
Open

Method definition convert_input overwritten #382

nsajko opened this issue Jan 25, 2023 · 1 comment
Labels
good-first-issue A good issue for newcomers to the repo

Comments

@nsajko
Copy link

nsajko commented Jan 25, 2023

┌ PkgTemplates [14b8a8f1-9102-5b29-a752-f990bacb7fe1]
│  WARNING: Method definition convert_input(Type, Type{Union{Nothing, Symbol, T}}, AbstractString) where {T} in module PkgTemplates at /home/nsajko/.julia/packages/PkgTemplates/N9g79/src/interactive.jl:90 overwritten at /home/nsajko/.julia/packages/PkgTemplates/N9g79/src/interactive.jl:98.
│    ** incremental compilation may be fatally broken for this module **
@nsajko nsajko changed the title Method definition convert_input overwritten, Method definition convert_input overwritten Jan 25, 2023
@timholy
Copy link
Member

timholy commented Mar 8, 2023

The issue is that these implementations:

function convert_input(P::Type, ::Type{Union{T, Nothing}}, s::AbstractString) where T
# This is kind of sketchy because technically, there might be some other input
# whose value we want to instantiate with the string "nothing",
# but I think that would be a pretty rare occurrence.
# If that really happens, they can just override this method.
return s == "nothing" ? nothing : convert_input(P, T, s)
end
function convert_input(P::Type, ::Type{Union{T, Symbol, Nothing}}, s::AbstractString) where T
# Assume inputs starting with ':' char are intended as Symbols, if a plugin accept symbols.
# i.e. assume the set of valid Symbols the plugin expects can be spelt starting with ':'.
return if startswith(s, ":")
Symbol(chop(s, head=1, tail=0)) # remove ':'
else
convert_input(P, Union{T,Nothing}, s)
end
end

overlap each other. (Consider the case where T = Symbol.) Can they be merged?

@oxinabox oxinabox added the good-first-issue A good issue for newcomers to the repo label Mar 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good-first-issue A good issue for newcomers to the repo
Projects
None yet
Development

No branches or pull requests

3 participants