When decoding types, indicate to the def-id conversion function what kind of
def-id we have, so that the inliner can distinguish between external and
internal def-ids.  Also add some comments explaining the distinction!

Fixes #4516.

r=graydon
Propagate expected types through block expressions.

r=graydon
Correct tests

rs=breakage