Commit graph

14 commits

Author SHA1 Message Date
Sigmund Cherem 050afd650f [expect] introduce Expect.throwsWhen and Expect.throwsTypeErrorWhen
Today, most tests that touch on a behavior variation end up
skipping expectations or the entirety of a test for some
testing configurations.  Moving forward, we'd like skip less
and try to account for the behavior variations if that's
reasonable.

This CL shows an approach to improve our test coverage for
behavior variations. We introduce two new methods to
[Expect] that allow us to conditionally check that a
function throws, depending on variation predicates.

The CL changes expectations for errors that don't occur
when dart2js omits parameter type checks or implicit
downcasts.

Note: originally I had the intention to introduce a name
parameter to `Expect.throws` and `Expect.throwsTypeError` to
avoid introducing a new API. However, because these APIs are
used for testing core language features, such as function
parameters themselves, we decided to keep the use of
features in these APIs as simple as it can be.

CoreLibraryReviewExempt: no public library semantic change - only improving test coverage under variations
Change-Id: I531657622655778491eaca8b37ba69ffaab559fc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/351340
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2024-02-14 20:12:05 +00:00
Sigmund Cherem ff4c387079 [tests] update tests to use variations
This updates tests to start using `checkedParamters` and
`checkedImplicitDowncasts` instead of `dart2jsProductionMode`

CoreLibraryReviewExempt: no semantic changes - only updates to use new pkg/expect variations properties
Change-Id: Ie717b4fd44590ff1f977142cf5802c4aace34dea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346910
Reviewed-by: Mayank Patke <fishythefish@google.com>
2024-02-08 17:00:59 +00:00
Stephen Adams 5a2ef55808 [web-fixit] Don't test covariance checks in production mode
Exit early for dart2jsProductionMode.
Remove multitest markers.

Change-Id: I9ccf1b3495823b8de3965f1c0b177ce4643c84f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/338587
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Kallen Tu <kallentu@google.com>
2023-11-29 21:19:49 +00:00
Paul Berry 1e0e12052c Add language test to reproduce #53089.
Change-Id: Ia77a7336a9f5abd73a7575d7833ce0e3ee3453a8
Bug: https://github.com/dart-lang/sdk/issues/53089
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/317441
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2023-08-02 12:02:38 +00:00
Jake Macdonald 2cec283bd0 update covariant setter test to test mixin class behavior also
Change-Id: I8f87f5d2d7745719462e0782176b04a595cdd5f6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289521
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-03-17 17:38:49 +00:00
Jake Macdonald 3b06df241f Clean up a number of 2.19 opt outs in language tests.
This is less than half of them, will send some other chunks later.

Bug:51557
Change-Id: I4e80812a689fde99e23c34b6405aaf57cd431ce8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289261
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
2023-03-17 16:17:50 +00:00
Robert Nystrom 7ca5ad46ce Set tests that have mixin errors as 2.19.
Mark tests that contain errors about using a class as a mixin to use
language version 2.19 where that's not an error.

This may not fix all of the tests because it's the language version of
the library where the class is declared that matters, not where the
class is used as a mixin. But most tests have all of their declarations
in the same library, so this should fix most.

Change-Id: I910439ebd2f10f731418dc588b7e4619a0841c16
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285923
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
2023-03-01 15:03:39 +00:00
Erik Ernst 87ccae9e3f Add tests about covariant parameters and inherited methods
Change-Id: Ibf2e4256605c1c479c6b244c44c1c424b0a2e6ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208504
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2021-09-01 23:47:47 +00:00
Erik Ernst cc84bb3e28 Adjust type_parameter_test to expect caller-side check on tearoff
language/covariant/type_parameter_test.dart performed a tearoff which
should incur a run-time error (because the dynamic type of the
tearoff is not a subtype of the static type, so it would be a
soundness violation to pass that value on to the next step of
evaluation).

Change-Id: Ia4ec813606e711cab0bdcc68d24bbac3c9a2d8c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209910
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2021-08-11 16:37:51 +00:00
Konstantin Shcheglov 8de8a1c226 Move codes from StaticTypeWarningCode into CompileTimeErrorCode.
They are all errors now.

Change-Id: If48d38e38e845fd5b5a950dd5514bf1cbbce03d8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155880
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-07-27 16:44:15 +00:00
Mayank Patke 6c593ac117 [dart2js] Visit type parameter bounds in the scope visitor.
Change-Id: Ief8cc2a88ef0833a10969237fa02cfdec869116d
Bug: https://github.com/dart-lang/sdk/issues/42344
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151460
Reviewed-by: Stephen Adams <sra@google.com>
2020-06-19 23:17:47 +00:00
Johnni Winther 28606d040b [cfe] Recompute type parameter type nullability after substitution
Closes #41697

Change-Id: Ib4977aa3f8d97defa7884036a0f561d6ecb4c3ee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149587
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2020-06-15 13:24:26 +00:00
Konstantin Shcheglov 21f42b4305 Fix covariant/return_type_test
Change-Id: Ie71d0579ed52af187dacc8f642425866da6a2d2f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143246
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-04-13 18:18:22 +00:00
Robert Nystrom 5f655a8c27 Migrate language_2/covariant to NNBD.
Change-Id: Icb4eae77fab5257ea00ff948d3f775725398e6ab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142067
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2020-04-07 01:05:28 +00:00