JuliaLang/julia

"@inferred requires a call expression" for do notation

Open

#59,114 创建于 2025年7月28日

在 GitHub 查看
 (8 评论) (0 反应) (0 负责人)Julia (48,709 star) (5,773 fork)batch import
good first issue

描述

Lambda functions work fine, while the same do-block throws an error:

julia> using Test

julia> @inferred map(x->x, [1,2])
2-element Vector{Int64}:
 1
 2

julia> @inferred map([1,2]) do x
       x
       end
ERROR: LoadError: @inferred requires a call expression

贡献者指南