We would expect failing as checks to throw in all modes (unless --omit-as-casts is provided). However, the new test program fails in production mode. This is because we are not registering the type usage of the function's type parameter. This leads us to drop the as check completely later on. We should be doing subtype checks with nullability if we want to consider an as test omitted. Golem patch results: https://golem.corp.goog/Comparison?repository=dart#targetA%3Ddart2js%3BmachineTypeA%3Dlinux-x64%3BrevisionA%3D107840%3BpatchA%3Dnatebiggs--dart2js--Fix-as-check-type-registration.-7%3BtargetB%3Ddart2js%3BmachineTypeB%3Dlinux-x64%3BrevisionB%3D107839%3BpatchB%3DNone Fixed: https://github.com/dart-lang/sdk/issues/54419 Change-Id: If93f78a939a690f05f5398c1a5ca971df1fc9243 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/343821 Reviewed-by: Mayank Patke <fishythefish@google.com> Reviewed-by: Stephen Adams <sra@google.com> Commit-Queue: Nate Biggs <natebiggs@google.com>