The following behaviour surprised me: I would like to plot with data with units (Using Unitful), but it seems return type declarations causes something to break.
Silly example:
using Unitful, UnitfulRecipes, Plots
function calctempv(v)::Vector{Unitful.Temperature}
[u"270.0K" + p*u"1K/bar" for p in v]
end
pressures = collect(u"1.0bar":u"1bar":u"30bar")
plot(pressures, calctempv(pressures))
error message: DimensionError: Inf and 271.0 K are not dimensionally compatible.
julia> typeof(calctempv(pressures))
Vector{Union{Quantity{T, 𝚯, U}, Level{L, S, Quantity{T, 𝚯, U}} where {L, S}} where {T, U}} (alias for Array{Union{Quantity{T, 𝚯, U}, Level{L, S, Quantity{T, 𝚯, U}} where {L, S}} where {T, U}, 1})
If I remove Vector{Unitful.Temperature}, everything works.