dart-sdk/pkg/test_runner
Paul Berry 5662ce3813 Add test runner support for context messages without location information.
The CFE implementation of "why not promoted" functionality for
non-promotion of `this` doesn't associate the context message with any
location information, because there is no relevant location to cite.
For example, the output can look like this:

    tests/language/why_not_promoted/this_error_test.dart:16:10: Error: Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
    Try accessing using ?. instead.
        this.isEven;
             ^^^^^^
    Context: 'this' can't be promoted.
    See http://dart.dev/go/non-promo-this

The test runner assumes that all messages have a location, so it
wasn't picking up on this context message at all.  This CL avoids the
problem by having the test runner associate any location-less context
message with the error above it.

(Note that the analyzer doesn't have this problem; all of its context
messages have locations).

Change-Id: Ied52daa8b0090f28617e7d3784233aa44dcc897a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195301
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-04-20 18:46:38 +00:00
..
bin Remove unnecessary imports from analyzer_plugin, analysis_server, analyzer_cli, test_runner 2021-04-08 19:02:31 +00:00
lib Add test runner support for context messages without location information. 2021-04-20 18:46:38 +00:00
test Add support for context messages to static error tests. 2021-03-30 18:41:21 +00:00
tool Modify test runner to use the new dartanalyzer --format=json feature. 2021-04-05 14:12:56 +00:00
.gitignore
analysis_options.yaml Turn on the "isEmpty" and "isNotEmpty" lints and fix violations. 2020-08-31 18:33:48 +00:00
pubspec.yaml Reland "Reland "update Glob in the sdk, also adds package:file to the sdk"" 2020-11-30 21:58:44 +00:00