It seems buggy as well:
*julia> **@Base.Test.inferred ucfirst("foobar")*
*"Foobar"*
*julia> **@Base.Test.inferred ucfirst(utf32("foobar"))*
*ERROR: return type ASCIIString does not match inferred return type
Union{ASCIIString,UTF32String,UTF8String}*
* in error at ./error.jl:21*
If the inferred return type is a union, shouldn't it return the value if it
matches any member of the Union?
Scott
On Monday, August 31, 2015 at 11:18:01 AM UTC-4, Isaiah wrote:
>
> `@inferred` returns the result of invoking the given call, or raises an
> error if the inferred and actual return types don't match.
>
> (see also the definition of `return_types`, here:
>
>
> https://github.com/JuliaLang/julia/blob/16916766680107576e16b512968eee42c8c6740a/base/reflection.jl#L272-L285
> )
>
> On Mon, Aug 31, 2015 at 10:54 AM, Tomas Lycken <[email protected]
> <javascript:>> wrote:
>
>> In some of the test code in Interpolations.jl, I’ve stumbled over the
>> macro Base.Test.@inferred. I took a look at the source code
>> <https://github.com/JuliaLang/julia/blob/e22233ece2516fee7212538a618a3c72a6f84d0f/base/test.jl#L161-L172>
>>
>> but didn’t get much wiser. Also, there’s no documentation in the doc
>> system, so ?@inferred in the REPL doesn’t give anything at all.
>>
>> What does @inferred do? What does it return?
>>
>> // T
>>
>>
>
>