Bug in 0.7 or not?

I have a piece of code which is fine in 0.6.4 and gives a syntax error on 0.7.beta2:

ERROR: LoadError: syntax: extra token "T" after end of expression

here is an MWE:

struct bar{T<:Integer}
      d::Vector{T}
end
import Base.^
^(n::Integer, a::bar{T})where T=if n>length(a.d) T(n) else a.d[n] end

Apparently you need a space between ) and where, here is another MWE:

julia> foo(::T)where T = 1
ERROR: syntax: extra token "T" after end of expression

definitely looks like bug to me. Edit: This example does not work on 0.6 either though.

1 Like