-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Closed
Labels
regressionRegression in behavior compared to a previous versionRegression in behavior compared to a previous version
Milestone
Description
Hi,
(I'm opening this as a separate issue for easy tracking and to make sure people see this.)
I just noticed that the type inference related changes newly introduced in #42046 breaks my existing code. A minimal example:
map(1:4) do i
a = (x=i, y=(i==1 ? 1 : "a"))
b = 3
(a, b)
end
throws the following error
ERROR: LoadError: TypeError: in typeassert, expected AbstractVector{<:Tuple{NamedTuple{(:x, :y), _A} where _A<:Tuple{Int64, Union{Int64, String}}, Int64}}, got a value of type Vector{Tuple{NamedTuple{(:x, :y)}, Int64}}
Stacktrace:
[1] _collect(c::UnitRange{Int64}, itr::Base.Generator{UnitRange{Int64}, Main.SEDL.var"#636#637"}, #unused#::Base.EltypeUnknown, isz::Base.HasShape{1})
@ Base ./array.jl:754
[2] collect_similar(cont::UnitRange{Int64}, itr::Base.Generator{UnitRange{Int64}, Main.SEDL.var"#636#637"})
@ Base ./array.jl:653
[3] map(f::Function, A::UnitRange{Int64})
@ Base ./abstractarray.jl:2849
[4] top-level scope
@ ~/.julia/dev/SEDL/scripts/hovercraft_example.jl:63
I just upgraded to 1.7.0-rc3 from rc1 this morning and immediately ran into this. Looks like the computed type annotation is more precise but is not compatible with the actual returned collection type.
Metadata
Metadata
Assignees
Labels
regressionRegression in behavior compared to a previous versionRegression in behavior compared to a previous version