JuliaLang/julia

"@inferred requires a call expression" for do notation

Open

#59,114 opened on Jul 28, 2025

View on GitHub
 (8 comments) (0 reactions) (0 assignees)Julia (5,773 forks)batch import
good first issue

Repository metrics

Stars
 (48,709 stars)
PR merge metrics
 (Avg merge 20d 6h) (157 merged PRs in 30d)

Description

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

Contributor guide