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

ERROR: MethodError: Cannot convert an object of type Type{Nothing} to an object of type Union #175

Closed
yakir12 opened this issue May 27, 2020 · 2 comments · Fixed by #176
Closed

Comments

@yakir12
Copy link

yakir12 commented May 27, 2020

Got this error when trying to

julia> t = Template(; interactive = true)
Template keywords to customize:
[press: d=done, a=all, n=none]
   [X] user
   [X] authors
   [X] dir
   [X] host
 > [X] julia
   [X] plugins
Enter value for 'user' (String, default="yakir12"): 
Enter value for 'authors' (Vector{String}, comma-delimited, default="yakir12 <[email protected]> and contributors"): 
Enter value for 'dir' (String, default="~/.julia/dev"): ~/DackeLab                                           
Select Git repository hosting service:
 > github.com
   gitlab.com
   bitbucket.org
   Other
Select minimum Julia version:
   1.0
   1.1
   1.2
   1.3
 > 1.4
   Other
Select plugins:
[press: d=done, a=all, n=none]
   [X] CompatHelper
   [X] ProjectFile
   [X] SrcDir
   [X] Git
   [X] License
   [X] Readme
   [X] Tests
   [X] TagBot
 > [X] AppVeyor
   [ ] CirrusCI
   [ ] Citation
   [X] Codecov
   [ ] Coveralls
   [ ] Develop
   [X] Documenter
   [ ] DroneCI
   [ ] GitHubActions
   [ ] GitLabCI
   [X] TravisCI
CompatHelper keywords to customize:
[press: d=done, a=all, n=none]
 > [ ] cron
   [ ] destination
   [ ] file
ProjectFile keywords to customize:
[press: d=done, a=all, n=none]
 > [ ] version
   [ ] None
SrcDir keywords to customize:
[press: d=done, a=all, n=none]
 > [ ] destination
   [ ] file
Git keywords to customize:
[press: d=done, a=all, n=none]
   [ ] email
   [ ] gpgsign
 > [ ] ignore
   [ ] manifest
   [ ] name
   [X] ssh
Enter value for 'ssh' (Bool, default=false): true
License keywords to customize:
[press: d=done, a=all, n=none]
 > [ ] destination
   [ ] name
   [ ] path
Readme keywords to customize:
[press: d=done, a=all, n=none]
 > [ ] destination
   [ ] file
   [ ] inline_badges
Tests keywords to customize:
[press: d=done, a=all, n=none]
 > [ ] file
   [ ] project
TagBot keywords to customize:
[press: d=done, a=all, n=none]
 > [ ] branches
   [ ] changelog
   [ ] changelog_ignore
   [ ] cron
   [ ] destination
   [ ] dispatch
   [ ] dispatch_delay
   [ ] file
   [ ] gpg
   [ ] gpg_password
   [ ] registry
   [ ] ssh
   [ ] ssh_password
   [ ] token
AppVeyor keywords to customize:
[press: d=done, a=all, n=none]
 > [ ] coverage
   [ ] extra_versions
   [ ] file
   [ ] x86
ERROR: MethodError: Cannot `convert` an object of type Type{Nothing} to an object of type Union
Closest candidates are:
  convert(::Type{T}, ::T) where T at essentials.jl:171
Stacktrace:
 [1] convert(::Type{Pair{Symbol,Union}}, ::Pair{Symbol,DataType}) at ./pair.jl:71
 [2] push!(::Array{Pair{Symbol,Union},1}, ::Pair{Symbol,DataType}) at ./array.jl:913
 [3] interactive(::Type{T} where T) at /home/yakir/.julia/packages/PkgTemplates/ZV8PR/src/interactive.jl:27
 [4] iterate at ./generator.jl:47 [inlined]
 [5] collect_to!(::Array{PkgTemplates.Plugin,1}, ::Base.Generator{Array{Any,1},typeof(PkgTemplates.interactive)}, ::Int64, ::Int64) at ./array.jl:711
 [6] collect_to!(::Array{CompatHelper,1}, ::Base.Generator{Array{Any,1},typeof(PkgTemplates.interactive)}, ::Int64, ::Int64) at ./array.jl:719
 [7] collect_to_with_first!(::Array{CompatHelper,1}, ::CompatHelper, ::Base.Generator{Array{Any,1},typeof(PkgTemplates.interactive)}, ::Int64) at ./array.jl:689
 [8] _collect(::Array{Any,1}, ::Base.Generator{Array{Any,1},typeof(PkgTemplates.interactive)}, ::Base.EltypeUnknown, ::Base.HasShape{1}) at ./array.jl:683
 [9] collect_similar(::Array{Any,1}, ::Base.Generator{Array{Any,1},typeof(PkgTemplates.interactive)}) at ./array.jl:607
 [10] map(::Function, ::Array{Any,1}) at ./abstractarray.jl:2072
 [11] prompt(::Type{Template}, ::Type{T} where T, ::Val{:plugins}) at /home/yakir/.julia/packages/PkgTemplates/ZV8PR/src/template.jl:248
 [12] prompt(::Type{T} where T, ::Type, ::Symbol) at /home/yakir/.julia/packages/PkgTemplates/ZV8PR/src/interactive.jl:118
 [13] (::PkgTemplates.var"#27#28")(::Symbol) at /home/yakir/.julia/packages/PkgTemplates/ZV8PR/src/template.jl:195
 [14] foreach at ./abstractarray.jl:1919 [inlined]
 [15] interactive(::Type{Template}; kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /home/yakir/.julia/packages/PkgTemplates/ZV8PR/src/template.jl:194
 [16] interactive(::Type{Template}) at /home/yakir/.julia/packages/PkgTemplates/ZV8PR/src/template.jl:178
 [17] Template(::Val{true}; kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /home/yakir/.julia/packages/PkgTemplates/ZV8PR/src/template.jl:76
 [18] Template(::Val{true}) at /home/yakir/.julia/packages/PkgTemplates/ZV8PR/src/template.jl:76
 [19] Template(; interactive::Bool, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /home/yakir/.julia/packages/PkgTemplates/ZV8PR/src/template.jl:75
 [20] top-level scope at REPL[3]:1

I'm on PkgTemplates v0.7.0 and

julia> versioninfo()
Julia Version 1.4.2
Commit 44fa15b150 (2020-05-23 18:35 UTC)
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: AMD Ryzen Threadripper 2950X 16-Core Processor
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-8.0.1 (ORCJIT, znver1)
Environment:
  JULIA_NUM_THREADS = 16
@yakir12
Copy link
Author

yakir12 commented May 27, 2020

I'll just add that avoiding the interactive option, and generating an identical template works:

t = Template(dir = "/home/yakir/DackeLab/", plugins = [CompatHelper(), ProjectFile(), SrcDir(), Git(), License(), Readme(), Tests(), TagBot(), AppVeyor(), Codecov(), Documenter(), TravisCI()])

@christopher-dG
Copy link
Member

Thanks for the report! I have seen a similar error, but thought I had fixed it...

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