[stubtest] Check runtime availability of private types not marked `@type_check_only` (#19574)
Currently, stubtest ignores symbols that are 1) private and 2) not
present at runtime. Private names are often used for stub-only
constructs (which we don't want stubtest to complain about), but they
can also denote actual private runtime types. Without other context,
it's often ambiguous which category a private names falls into. For
class definitions, we can make the intent explicit by decorating the
class with `@type_check_only`. Typeshed already does this for the most
part, but there's still quite a few cases of stub-only private types
that aren't marked `@type_check_only` (especially in older stubs).
Going forward, I think it could a good idea to make stubtest start
checking for `@type_check_only` on private types that are not available
at runtime.
A few special cases are needed to avoid false positives on types that
cannot be marked with `@type_check_only`, namely:
* NewType declarations
* TypedDicts with fields that are not valid identifiers (and therefore
need to use the functional syntax)
~This PR creates quite a few new errors on typeshed (\~100 in stdlib,
\~300 in third-party stubs), which we'll probably want to sift through
before merging this.~ As of this writing, all typeshed hits have been
fixed.