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

Non-inferrability in broadcasting #546

Closed
timholy opened this issue Nov 18, 2018 · 1 comment
Closed

Non-inferrability in broadcasting #546

timholy opened this issue Nov 18, 2018 · 1 comment

Comments

@timholy
Copy link
Member

timholy commented Nov 18, 2018

Noticed in JuliaMath/Interpolations.jl#269:

using StaticArrays, Test
h = SMatrix{1,1}([1.0])
steps = SVector(1.0)
testinf(h, steps) = h ./ (steps .* steps')

julia> testinf(h, steps)
1×1 SArray{Tuple{1,1},Float64,2,1}:
 1.0

julia> @inferred testinf(h, steps)
ERROR: return type SArray{Tuple{1,1},Float64,2,1} does not match inferred return type Any
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] top-level scope at none:0
@timholy
Copy link
Member Author

timholy commented Nov 18, 2018

Reduced to:

julia> a = axes(v)
(SOneTo(2),)

julia> b = axes(v')
(Base.OneTo(1), SOneTo(2))

julia> @inferred Broadcast.broadcast_shape(a, b)
ERROR: return type Tuple{SOneTo{2},SOneTo{2}} does not match inferred return type Tuple{Union{SOneTo{2}, OneTo{Int64}},SOneTo{2}}
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] top-level scope at none:0

Fix coming.

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

No branches or pull requests

1 participant