Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make type error detection less specific #527

Closed
eernstg opened this issue Feb 10, 2020 · 3 comments
Closed

Make type error detection less specific #527

eernstg opened this issue Feb 10, 2020 · 3 comments
Assignees

Comments

@eernstg
Copy link
Member

eernstg commented Feb 10, 2020

The treatment of type errors in Dart is about to change slightly. Currently there is a distinction between TypeError and CastError, but in the future we plan to stop making this distinction. Cf. dart-lang/language#787.

In order to avoid having failures due to overly specific expectations about the error thrown in various tests, we should adjust the checkTypeError in https://github.com/dart-lang/co19/blob/45dcc9d4a34f008af14f8b881ac2b85f084d46f0/Utils/dynamic_check.dart to be

checkTypeError(f()) {
  Expect.throws(f, (e) => e is TypeError || e is CastError,
      'Type error should be thrown');
}

and use this in order to verify that a type error occurs, rather than checking specifically for a TypeError or a CastError.

@sgrekhov sgrekhov self-assigned this Feb 11, 2020
@eernstg
Copy link
Member Author

eernstg commented Feb 11, 2020

I can see that checkTypeError is now applying the less specific check. But how about all the usages?

sdk/tests/co19/src((def1183ba...))$ dgrep '\bTypeError\b' | wc -l
6743
sdk/tests/co19/src((def1183ba...))$ dgrep '\bCastError\b' | wc -l
36

@sgrekhov sgrekhov reopened this Feb 12, 2020
@sgrekhov
Copy link
Contributor

@eernstg thank you for pointing. Fixed

@eernstg
Copy link
Member Author

eernstg commented Feb 12, 2020

@sgrekhov, thank you for fixing a lot of code in a few hours! ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants