Some fixes to diagnostics and lints

I’m not so sure about the way I’ve handled #17567, but at least the error message is an improvement over what it was before (albeit still not quite as good as it was before DST).