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

add <: to add-dots #35085

Merged
merged 15 commits into from
May 6, 2020
2 changes: 2 additions & 0 deletions base/broadcast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1173,6 +1173,8 @@ function __dot__(x::Expr)
elseif (x.head === :(=) || x.head === :function || x.head === :macro) &&
Meta.isexpr(x.args[1], :call) # function or macro definition
Expr(x.head, x.args[1], dotargs[2])
elseif x.head === :(<:)
Expr(:(.<:), dotargs...)
stevengj marked this conversation as resolved.
Show resolved Hide resolved
else
if x.head === :&& || x.head === :||
error("""
Expand Down
3 changes: 3 additions & 0 deletions test/broadcast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -857,3 +857,6 @@ end

# 28680
@test 1 .+ 1 .+ (1, 2) == (3, 4)

ret = @macroexpand @.([Int, Number] <: Real)
@test ret == :($(Expr(:.<:, :([Int, Number]), :Real)))
2 changes: 2 additions & 0 deletions test/parse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -315,3 +315,5 @@ end
@test Meta.parse("±x") == Expr(:call, :±, :x)
@test Meta.parse("∓x") == Expr(:call, :∓, :x)
end

@test [Int, Float64, String, Bool] .<: Union{Int, String} == Bool[1, 0, 1, 0]