JunoLab / Juno.jl

MIT License
144 stars 23 forks source link

[BUG] Juno Formatting with SimpleTraits #529

Closed theogf closed 4 years ago

theogf commented 4 years ago

Please search existing issues to avoid duplicates.

Details

Steps to reproduce

  1. Use SimpleTraits.jl and create a @traitfn function foo(bar::T) where {T; IsTrait{T}} end The Juno automatic formatting (Ctrl+J, Ctrl+F) give the error "no method matching rem_where(::Nothing)"
pfitzseb commented 4 years ago

Works fine for me. What version of JuliaFormatter.jl do you have installed (you can check with pkg> st -m JuliaFormatter)?

Edit: Oh, actually, it doesn't error but still messes up: @traitfn function foo(bar::T) where {T; IsTrait{T}} end -> @traitfn function foo(bar::T) where {TIsTrait{T}} end

theogf commented 4 years ago

JuliaFormatter is at version 0.3.8

pfitzseb commented 4 years ago

Are you sure it's that line that causes the error (you can check by only selecting that before formatting)?

theogf commented 4 years ago

Here is what it gives when I select a line with @traitfn :

Parsing error for input:
@traitfn function predict_ar(m::TGP, p::Int = 3, n::Int = 1; y_past = get_y(m)) where {T,TGP<:AbstractGP{T};IsMultiOutput{TGP}}
error(::String) at error.jl:33
#format_text#86(::Int64, ::Int64, ::Bool, ::Bool, ::Bool, ::Bool, ::JuliaFormatter.DefaultStyle, ::typeof(JuliaFormatter.format_text), ::String) at JuliaFormatter.jl:291
(::JuliaFormatter.var"#kw##format_text")(::NamedTuple{(:indent, :margin, :always_for_in, :whitespace_typedefs, :whitespace_ops_in_indices, :remove_extra_newlines),Tuple{Int64,Int64,Bool,Bool,Bool,Bool}}, ::typeof(JuliaFormatter.format_text), ::String) at none:0
(::Atom.var"#308#309")(::Dict{String,Any}) at formatter.jl:14
handlemsg(::Dict{String,Any}, ::Dict{String,Any}) at comm.jl:168
(::Atom.var"#19#21"{Array{Any,1}})() at task.jl:333
theogf commented 4 years ago

The rem_where issue was when I was selecting the whole function

pfitzseb commented 4 years ago

Ah ok, I can repro with that function. Wanna open an issue about this at the JuliaFormatter repo?

theogf commented 4 years ago

Sure! Probably it's the combination of comas and semicolumn...

aviatesk commented 4 years ago

closed since the upstream issue has been solved.