I don’t think free variables can be determined from block arguments. Seems like it falls back to using the generic argument T from the parent type, which is obviously not intended in this case. This looks like a bug.
The code should probably result in a compile error that T can’t be resolved, like with this code:
def foo(&block : T -> _) forall T # undefined constant T
p T
end
foo{|x| x}
The exact error message could certainly be improved and tailored to this specific case, but I think that’s the direction.