See
src/test/run-pass/closure-expected-type
.