Fix an embarrassing bug in [TypeChecker].

The expected type was lost when going through a local type definition. This
fixes the bug found in [adoptslib].