Commit graph

99461 commits

Author SHA1 Message Date
Jens Johansen
f3740c96e8 [package:testing] Reset the isolates errors fatal option
This code

```
import 'dart:isolate';

Future<void> main([List<String> arguments = const []]) async {
  await something();
  print("After the call!");
  if (1+1==2) throw "This will be swallowed";
  print("This will never be printed.");
}

Future<void> something() async {
  Isolate.current.setErrorsFatal(false);
}
```

prints

```
$ out/ReleaseX64/dart pkg/front_end/test/fasta/hmm.dart
After the call!
$ echo $?
0
```

I.e. it dies silently, swallowing the throw and has a 0 exit code.

Using package:testing (and having it run at least one thing), it
previously did this so that if anything crashed, say, in user code
after the run (or maybe even some places inside package:testing?) it
would just swallow the error and leave a 0 exit code.
This CL sets the errors fatal thing to true (which must be the default)
causing the normal behaviour of it not swallowing any throws.

Change-Id: I9850bbf504e172cc4077e5e17265833ef58dfe90
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350321
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2024-02-05 14:38:05 +00:00
Moritz
502e8e0960 Prepare package:meta for publish
Change-Id: I28615dd6eae807bd585218e343b11d490058c89b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350241
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Moritz Sümmermann <mosum@google.com>
2024-02-05 14:05:29 +00:00
Sergey G. Grekhov
4cc0743f3f [co19] Roll co19 to d1ce99fc64d3766ec7dd82362cf80192262822ec
2024-02-02 sgrekhov22@gmail.com Fix dart-lang/co19#2517. Fix wrong test, add experimental flags (dart-lang/co19#2518)
2024-02-02 sgrekhov22@gmail.com Fix dart-lang/co19#2490. Update incompatible with await tests according to the changed rule (dart-lang/co19#2516)
2024-02-01 sgrekhov22@gmail.com dart-lang/co19#2420. Add more exhaustiveness tests (dart-lang/co19#2513)
2024-01-31 sgrekhov22@gmail.com dart-lang/co19#2446. Add additional test for cast pattern (dart-lang/co19#2514)
2024-01-30 sgrekhov22@gmail.com dart-lang/co19#1399. Add more tests for records (dart-lang/co19#2511)
2024-01-30 sgrekhov22@gmail.com dart-lang/co19#2485. Update map and list constant literals tests. Add parenthesized for records (dart-lang/co19#2512)
2024-01-29 sgrekhov22@gmail.com Fixes dart-lang/co19#2490. Add more await tests for extension types (dart-lang/co19#2500)
2024-01-29 sgrekhov22@gmail.com dart-lang/co19#2119. Fix typo in Subtyping tests description (dart-lang/co19#2510)
2024-01-29 sgrekhov22@gmail.com Fixes dart-lang/co19#2505. Add more tests for `call` member (dart-lang/co19#2506)
2024-01-29 sgrekhov22@gmail.com dart-lang/co19#2420. Add cast-pattern tests for extension types (dart-lang/co19#2458)

Change-Id: I631705a013f9a77910ae0f0be5a9fea01e7c719f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350240
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: William Hesse <whesse@google.com>
2024-02-05 12:56:59 +00:00
Chloe Stefantsova
5c3b873027 [cfe] Merge TypeConstraintGatherer and TypeSchemaConstraintGatherer
This is a follow up to
https://dart-review.googlesource.com/c/sdk/+/349881

Now that there's only one implementation of TypeConstraintGatherer, it
can be merged with the abstract class.

Change-Id: Iaf50548da2841c7dfb51126de9f746fac1a8ad0d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350242
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2024-02-05 11:11:56 +00:00
Jens Johansen
b7eb3f3c92 [CFE] Introduce forEachMember on kernel Library and class; change verifier slightly
verify_with_lazy_loading: instructions:u: -0.1311% +/- 0.0001% (-1182610.00 +/- 971.82)
verify_without_lazy_loading: instructions:u: -0.1267% +/- 0.0002% (-1124839.67 +/- 1776.77)

Change-Id: Idef856c7f6ad99c12deaa07ab95598e77a51f57e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349863
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2024-02-05 10:36:59 +00:00
Liam Appelbe
dff831dbfc [ffi] Fix callback subtyping test
Previously we were reusing the ensureNativeTypeToDartType function to
check that Dart function passed as a callback matches the native type.
This works if the types exactly match, but the subtyping test is
backwards, so it doesn't allow certain cases that should be allowed. The
main case is that when the native function type returns void, the Dart
function should be allowed to return anything.

So I added ensureDartTypeToNativeType, which reverses the subtype test.

As well as making the return types more permissive, this has also
changed what parameters are allowed to be passed to callbacks. For
example, in tests/ffi/vmspecific_static_checks_typeddata_test.dart:80,
passing a Handle to a function expecting an Int8List used to work, but
is now a compile error. I think this change is an improvement, because
previously it would have been possible to pass any type of object to
that callback. So this change turns some potential runtime type errors
into compile errors. But technically I think this is a breaking change.

Fixes: https://github.com/dart-lang/sdk/issues/53659
Bug: https://github.com/dart-lang/sdk/issues/53659
Change-Id: I6846a59fc309ec897cba8f985d7dd0a63b912b42
TEST=tests/ffi/function_callbacks_subtype_test.dart and others
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346440
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-02-05 03:19:01 +00:00
Konstantin Shcheglov
6f83936c23 Legacy. Remove 'isNonNullableByDefault' from TypeSystemImpl.
Change-Id: I0e72247a1168a83456288ba69bd17aa2de2a1d30
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350022
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-02-03 02:37:29 +00:00
Konstantin Shcheglov
f724cf6472 Extension type. Tests for references to extension type and its method.
Change-Id: Ibcf1a6408ea2e5dfa3d29aabfc8d09631a85bdea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350005
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-02-03 01:31:51 +00:00
Konstantin Shcheglov
46b306491c Macro. Test for searching references inside macro-generated code.
Change-Id: I5629c328c1a9a29e4e825d3953771fd91e25d868
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350060
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-02-03 01:30:54 +00:00
Konstantin Shcheglov
11ac65bc2a Macro. Tests for reporting diagnostics on named/positional formal parameter of FunctionTypeAnnotation.
Change-Id: I3dc680a4c8a651465e7ec577ac770e7602d2842c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350004
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-02-03 01:23:39 +00:00
Konstantin Shcheglov
473ba0254c Legacy. Use non-nullable TypeProvider, don't create legacy TypeProvider/TypeSystem.
Change-Id: I01ec3849ed0ad1f2a777cd14a51720b88c489a37
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350003
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-02-03 01:22:50 +00:00
Mayank Patke
aec3ec0244 Revert "[dart2js] Replace phi with controlling condition"
This reverts commit 75b1973041.

Reason for revert: Breaks g3 tests

Original change's description:
> [dart2js] Replace phi with controlling condition
>
> Rewrite `phi(true, false)` to the controlling condition.
>
> This patchset comparison shows the general effect: https://dart-review.googlesource.com/c/sdk/+/340065/2..3/pkg/compiler/test/codegen/data/phi_to_condition_test.dart
>
> This change is a partial remedy for http://dartbug.com/54115
>
> Issue: #54115
> Change-Id: Ibcc5d17f6c4c8ad9600840ec106f84edcd008e4a
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/340065
> Reviewed-by: Nate Biggs <natebiggs@google.com>
> Commit-Queue: Stephen Adams <sra@google.com>

Issue: #54115
Change-Id: Id717ef469b09a5b07e43b3ffafc54bc6b409f0df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350006
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2024-02-03 00:56:15 +00:00
Konstantin Shcheglov
24162bd03f Use UnitAnalysis in LibraryAnalyzer instead of separate maps.
Change-Id: I18927c0ef14eae06aba14b1e3605d38683492f64
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350001
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-02-02 22:13:39 +00:00
Konstantin Shcheglov
4b4834256a Legacy. Deprecated LibraryElement.toLegacyTypeIfOptOut(), removed form TypeSystemImpl.
Change-Id: I556af588d8721e1f720fc86477f9b6c97cf90644
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350000
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-02-02 21:10:30 +00:00
Konstantin Shcheglov
26e1f2f392 Macro. Tests for reporting diagnostics on named/positional fields of record types.
Change-Id: I3564195d923aea54f9891d44af6e56108160e3bb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350020
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-02-02 21:05:59 +00:00
Chingjun Lau
0024349fb3 Avoid unnecessary calls to isExternalPackageLibrary and resolveUrisToPackageLibPaths.
Only try to resolve the uri when `debugExternalPackageLibraries` is
false, which is when it is actually needed.

Change-Id: I5aade6214657eccbdb5e294a8bfb5e2968aa6b3d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349631
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Helin Shiah <helinx@google.com>
Auto-Submit: Chingjun Lau <chingjun@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2024-02-02 20:40:59 +00:00
Konstantin Shcheglov
ef43762a14 Legacy. Remove tests for language versions 2.9
Change-Id: I55227f3573d8a2ac3d03de93aeca493fdd3c9596
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349981
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-02-02 19:56:19 +00:00
Konstantin Shcheglov
6c73a8e0f7 Macro. Support for reporting a diagnostic on a declaration in user code.
Change-Id: I8eb0e738d368e30320f443b2e7a6420d0d356b67
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349980
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-02-02 19:40:20 +00:00
Martin Kustermann
0bc92a4333 [dart2wasm] Remove usage of type category table
The type category table is a O(number-of-classes) sized byte array that
maps from class-id to either a type category (function, record, ...) or
a masqueraded class-id.

* for flute this table takes up around 1 KB.
* this prevents from making concrete class-ids come before all abstract
  class ids

After recent changes the core RTT implementation no longer involves
masqueraded types (i.e. `<obj> is/as <type>` and `<type> <: <type>`
queries don't trigger masquerading functionality)

This CL removes the type category table, the special casing in the
class-id assignment and the compiler support for building the table.

Instead we move the logic to pure dart code, which can use normal `is`
checks to perform its function.

We add one optimization: The compiler will provide the class-id from
which one only non-masqueraded classes come. This makes the masquerading
function have a fast path.

* We use `Wasm{TypedData,String}Base` marker interfaces i
 `dart:_internal` to check for wasm-backed implementations
* We use `-Ddart.wasm.js_compatibility` to provide JSCM mode

We add a test that actually exercises the 2 modes.

Change-Id: I051c35b17878950402a1336df871a686b649f732
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349641
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2024-02-02 19:01:49 +00:00
Parker Lougheed
5b980d6995 [analyzer] Update diagnostic messages to use markdown codeblocks
To prepare for the site dropping prettify.

Change-Id: I90367bd67ae0216572aa9defe6aa180a34942e35
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349761
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-02-02 18:42:28 +00:00
Volodymyr Buberenko
6d3f389e59 Improve sort_pub_dependencies.dart messages
Closes https://github.com/dart-lang/sdk/pull/54812

GitOrigin-RevId: c80e6b2ae2c14ce0d510b26809041aaf3be936e6
Change-Id: I1f6ce709702a5f9b9ee63dd9730bfd8b7f8f7a6e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349920
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-02-02 18:27:50 +00:00
Konstantin Shcheglov
f3486f7e3e Legacy. Remove tests for language versions 2.6, 2.7, 2.8
Change-Id: I5dadd2c9a6720125f3bf0cdeaeaa2d8bda411534
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349922
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-02-02 18:22:49 +00:00
Daco Harkes
28c7f5bd1e [vm/ffi] Refactor dart:ffi generator
Refactor to avoid conflicts later with concurrent work on:
- https://github.com/dart-lang/sdk/issues/45508
- https://github.com/dart-lang/sdk/issues/44589

Change-Id: I7b7ea2e4ec29115da42b0c196a2952c3cd5d3fa6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349901
Commit-Queue: Martin Kustermann <kustermann@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2024-02-02 18:11:00 +00:00
Konstantin Shcheglov
f95441f707 ErrorReporter. Remove empty 'arguments' arguments.
Change-Id: I70251ec7872162f148dc6a4b5feae99faa175890
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349632
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-02-02 16:55:00 +00:00
Jake Macdonald
ec20773558 [macros] output better error messages for unrecognized types in the JSON macro language test
Change-Id: Ib672dcdcff11f376014a58a9b9f7630de8d2539a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349601
Commit-Queue: Morgan :) <davidmorgan@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Morgan :) <davidmorgan@google.com>
2024-02-02 15:53:18 +00:00
Johnni Winther
ec6e1065f2 [vm] Remove 'dart:_macros' from extraRequiredLibrariesPlatform
Intended change accidentally left out of
https://dart-review.googlesource.com/c/sdk/+/348680

TEST=existing

Change-Id: Id96d2acda95a5b010c7ff53e03e07dde81a254d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349880
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2024-02-02 14:19:38 +00:00
Chloe Stefantsova
d337c62c00 [cfe] Allow null representation types in .call tear-offs
Closes https://github.com/dart-lang/sdk/issues/54768

Change-Id: I4624bdc7e02b79c174fa661f4bda7eb633673dea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349502
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2024-02-02 13:32:22 +00:00
Chloe Stefantsova
a5bbbe814f [cfe] Implement the update of "incompatible with await"
This CL implements the udpate to the notion of a type being
"incompatible with await" as found here:
https://github.com/dart-lang/language/pull/3598

Change-Id: I7792564c1854468709d0da3238c02e912df52369
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349882
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2024-02-02 13:29:27 +00:00
Chloe Stefantsova
b6d69bd296 [cfe] Remove TypeBuilderConstraintGatherer
The removed class is not used since
https://dart-review.googlesource.com/c/sdk/+/343920

Change-Id: If8e7daf1493feeee2638874b164157aa697c2243
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349881
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2024-02-02 12:09:30 +00:00
Martin Kustermann
32c22da2b6 [dart2wasm] Record type related cleanups
* avoid allocating _RecordType objects for `<obj> is/as <record-type>`
  => Introduce `Record._checkRecordType()`
  => Use `Record._recordRuntimeType` (which is now not masquerading) for
  other purposes (e.g. verification)

* avoid using masqueraded types for `<obj> is/as <record-type>`
  => Introduce `Record._masqueradedRecordRuntimeType`

Although we introduce 2 extra methods on `Record` that are overriden,
it's O(record-shapes-in-program) and therefore not a big overhead.

=> This will enforce the invariant that the actual type check
   implementation (i.e. for `<obj> is/as <type>` or
   for `<type> <: <type>`) *never* calls back into
   masquerading functionality

=> This in return means we can make the masquerading functionality
   using `<obj> is <type>` checks.

Change-Id: I3e3a0411022042a8e735aaeed396cc8f90d8c9c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349800
Reviewed-by: Slava Egorov <vegorov@google.com>
2024-02-02 11:52:23 +00:00
Martin Kustermann
105825dfc4 [vm] Fix memory leak of [AppSnapshot] object
This leak start to happen after [0] landed.

[0] https://dart-review.googlesource.com/c/sdk/+/346060

TEST=Fixes vm/dart/isolates/regress_54528_test in ASAN mode

Change-Id: I0f24c4d997abcb0b0b6d396a505a5498bb633650
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349862
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2024-02-02 10:45:27 +00:00
Johnni Winther
fe52b9bfe5 [macros] Add dart:_macros
This adds the dart:_macros library to the SDK and adds support for accessing dart:_macros from package:macros. The library is not used yet.

This change is needed as a prestep to adding the package:macros and using it in the CFE and analyzer, and needs to be rolled in as the checked in sdk before package:macros can be supported.

TEST=ci

Change-Id: Ife3ffd48527e3a196048d2ddf7387b8b7818f3a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/348680
Reviewed-by: Jake Macdonald <jakemac@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2024-02-02 07:47:59 +00:00
Parker Lougheed
1327a9a71e [analyzer] Expand NULLABLE_TYPE_IN_IMPLEMENTS_CLAUSE for extension types
This is already functional, but I noticed the message needed to be updated. I also added tests for the case, mostly corresponding to the existing ones for classes.

Change-Id: I3529691f640bfbde3d8018b002b9ddf65c4ac4e0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349762
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-02-02 06:55:10 +00:00
Konstantin Shcheglov
2a88162b84 ErrorReporter. Use atNode() instead of reportErrorForNode().
Change-Id: I118fb7623d3effc3bf4bebdeb586196659e8da88
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349630
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-02-02 01:56:59 +00:00
Konstantin Shcheglov
3c78ff1f33 ErrorReporter. Fix merge deprecation.
Change-Id: If490af30b443396b7c01d1ab759a1afbc708ea8a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349713
Auto-Submit: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-02-02 00:19:48 +00:00
Konstantin Shcheglov
14a9782895 Legacy. Remove 2.5 language tests, two error codes.
Change-Id: If29c291d17fbbd74141c08afe55d0c174b303f0a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349627
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-02-01 23:02:38 +00:00
Konstantin Shcheglov
79cd9a6655 ErrorReporter. Add atToken(), atOffset(), atNode(); use atToken()
We discussed this some time ago, and I found another place where
I would like to report at a `SyntacticEntity`. So, if I'm going to
add something, I can just as well make `ErrorReporter` better.

Change-Id: I46d99e8959c7a5fd700cc2cba775114bfefec04d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349709
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-02-01 22:32:27 +00:00
Danny Tuppeny
c3d80286fe [analysis_server] Add a supportsUris client capability for legacy server to switch into URI mode
This adds support for the legacy server to switch to URIs using a client capability. In this mode, all "FilePaths" will be URI strings over the protocol (in both directions).

It also allows the server to send LSP notifications (wrapped inside an "lsp.notification" notification, matching how requests/responses work). Notifications are automatically enabled if the client uses any LSP methods or sends the new "supportsUris" capability.

Change-Id: I5d2b76e396862129c61de70d57397603c958a02d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349120
Reviewed-by: Jaime Wren <jwren@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-02-01 22:19:00 +00:00
Konstantin Shcheglov
33fc944a80 Macro. Use either AstNode or Token for type location.
Change-Id: Idced9134ae82bc315101635a1b29f7aef044246a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349707
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-02-01 21:45:00 +00:00
Parker Lougheed
df7c3197af [docs/api] Minor adjustments and fixes to api.dart.dev homepage
- Since "Futures", "Streams", and "Zones" are plural and not in code syntax, can make them lowercase to be consistent with the `dart:core` entry in the same list.
- Use the full "platform interopability" term when introducing the libraries, as it might be a newer term for readers.
- Replaces "interoping" term as after searching it seems not common and easily mistaken.
- Fixes spelling of "function"

Change-Id: Ia887b427789a50d70cb47228c677fe2fd03499e2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349421
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
Reviewed-by: Marya Belanger <mbelanger@google.com>
2024-02-01 21:41:38 +00:00
pq
bb9ce9cd2a ensure a defined options file overrides discovered ones
(Note an additional pre-existing test in `context_locatator_test:test_locateRoots_nested_options_overriddenOptions`.)

Fixes https://github.com/dart-lang/sdk/issues/54791

Change-Id: Ie67e9d840bec1caaa3548a8803f3a9b452807249
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349625
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-02-01 21:28:40 +00:00
Kallen Tu
1aa0575ef1 [analyzer] Add doc imports to UnlinkedLibraryDirective and report errors.
This CL adds doc import information to UnlinkedLibraryDirective and reports any static errors such as `URI_DOES_NOT_EXIST` from the doc imports.

The doc imports should be treated similarly to actual imports so it uses a lot of the same logic.

Based largely on Sam's WIP work in this CL:
https://dart-review.googlesource.com/c/sdk/+/344340

Bug: https://github.com/dart-lang/sdk/issues/50702
Change-Id: Ic001fd6d4077eea04905288be0424e7b11b2b56c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345361
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2024-02-01 20:04:59 +00:00
Konstantin Shcheglov
423e769053 Macro. Support for more kinds of TypeAnnotation(s) as diagnostics target.
Change-Id: I67ce3ca386175c0055ceecfdfbd7dcc52c031f4a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349781
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-02-01 19:59:29 +00:00
Alexander Aprelev
baf1e6e904 [gardening] Mark non_utf8_output_test accordingly in status file.
Change-Id: Id497a20951db32130f27ab48b508649ca7d13067
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349780
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2024-02-01 19:44:50 +00:00
Danny Tuppeny
581686b8fb [analysis_server] Consolidate some more writePackageConfig() methods
+ tidy up some redundant package versions that are inherited from the ConfigurationFiles mixin.

Change-Id: I93329cbf65af3a68ed27284903e7becac01cf5ea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349380
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-02-01 19:11:27 +00:00
Danny Tuppeny
19677cb591 [analysis_server] Remove "previewSurveys" flag
Dart-Code has defaulted this flag to true for a while now and this flag was intended to be temporary to allow for our own testing.

Change-Id: Iad679303480151627fa2dead26b4a3a9f625c773
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349742
Reviewed-by: Jaime Wren <jwren@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Elias Yishak <eliasyishak@google.com>
2024-02-01 19:10:12 +00:00
Konstantin Shcheglov
8947b7ffc5 Remove TestAnalysisContext.typeSystemLegacy
Change-Id: I1568c8ec0c36ad9ff23bb517f775fa6f9734aee0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349703
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-02-01 18:40:21 +00:00
Danny Tuppeny
d6211dc141 [analyzer] Increase package:path constraint to 1.9.0
1.9.0 contains a fix for parsing file:// URIs with encoded colons that we can get from VS Code and is the version analyzer_plugin now requires.

Change-Id: I193ce4660116b2847a280516ba33f076f75494aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349741
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-02-01 18:36:41 +00:00
Daco Harkes
c0c7c1ef49 [vm/ffi] Update inner pointer accesses in IL
FFI loads and stores via structs can have a TypedData as receiver,
so this CL updates those loads to `kMayBeInnerPointer`.

This CL adds an IL test to verify that for `Pointer` loads the untagged
value is treated correctly as `kCannotBeInnerPointer`.
(And adds some prefer-inline pragmas to make some common operations
be inlined to avoid allocating `Pointer` objects.)

This CL updates the load in the FFI closures to use a load-field.
This can also potentially enable not allocating a pointer object when
this closure is inlined.

TEST=tests/ffi/unwrap_typeddata_generated_test.dart
TEST=tests/ffi

CoreLibraryReviewExempt: Only adding some pragmas.
Change-Id: If687e54c676f275cc849b3fed526a13766ab331a
Cq-Include-Trybots: luci.dart.try:vm-aot-android-release-arm64c-try,vm-aot-android-release-arm_x64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-debug-x64c-try,vm-aot-mac-release-arm64-try,vm-aot-mac-release-x64-try,vm-aot-obfuscate-linux-release-x64-try,vm-aot-optimization-level-linux-release-x64-try,vm-aot-win-debug-arm64-try,vm-aot-win-debug-x64-try,vm-appjit-linux-debug-x64-try,vm-asan-linux-release-x64-try,vm-checked-mac-release-arm64-try,vm-eager-optimization-linux-release-ia32-try,vm-eager-optimization-linux-release-x64-try,vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64c-try,vm-ffi-qemu-linux-release-arm-try,vm-ffi-qemu-linux-release-riscv64-try,vm-fuchsia-release-x64-try,vm-kernel-linux-debug-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-linux-debug-ia32-try,vm-linux-debug-x64-try,vm-linux-debug-x64c-try,vm-mac-debug-arm64-try,vm-mac-debug-x64-try,vm-msan-linux-release-x64-try,vm-reload-linux-debug-x64-try,vm-reload-rollback-linux-debug-x64-try,vm-ubsan-linux-release-x64-try,vm-win-debug-arm64-try,vm-win-debug-x64-try,vm-win-release-ia32-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349241
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2024-02-01 18:28:53 +00:00
Daco Harkes
bf683bacbb Reland "[vm/ffi] Introduce Struct.create and Union.create"
Analyzer fix https://github.com/dart-lang/sdk/issues/54754 has
landed. A new version of package:analyzer and package:dartdoc have
been released. `pub global activate dartdoc` should now work.

Patchset 1 is identical to the original CL.
The only difference is an extra test testing with negative offsets.

=== Original CL description ===

Structs and unions can now be created from an existing typed data
with the new `create` methods.

The typed data argument to these `create` methods is optional. If
the typed data argument is omitted, a new typed data of the right
size will be allocated.

Compound field reads and writes are unchecked. (These are
TypedDataBase loads and stores, rather than TypedData loads and stores.
And Pointers have no byte length.) Therefore the `create` method taking
existing TypedData objects check whether the length in bytes it at
least the size of the compound.

TEST=pkg/analyzer/test/src/diagnostics/creation_of_struct_or_union_test.dart
TEST=pkg/vm/testcases/transformations/ffi/struct_typed_data.dart
TEST=tests/ffi/structs_typed_data_test.dart
TEST=tests/ffi/vmspecific_static_checks_test.dart

Closes: https://github.com/dart-lang/sdk/issues/45697
Closes: https://github.com/dart-lang/sdk/issues/53418

Change-Id: Id7f30bcd4a6ae55a8298b39c9eadf4e80bc699a9
CoreLibraryReviewExempt: FFI is a VM and WASM only feature.
Cq-Include-Trybots: luci.dart.try:vm-aot-android-release-arm64c-try,vm-aot-android-release-arm_x64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-debug-x64c-try,vm-aot-mac-release-arm64-try,vm-aot-mac-release-x64-try,vm-aot-obfuscate-linux-release-x64-try,vm-aot-optimization-level-linux-release-x64-try,vm-aot-win-debug-arm64-try,vm-aot-win-release-x64-try,vm-appjit-linux-debug-x64-try,vm-asan-linux-release-x64-try,vm-checked-mac-release-arm64-try,vm-eager-optimization-linux-release-ia32-try,vm-eager-optimization-linux-release-x64-try,vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64c-try,vm-ffi-qemu-linux-release-arm-try,vm-ffi-qemu-linux-release-riscv64-try,vm-fuchsia-release-x64-try,vm-kernel-linux-debug-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-linux-debug-ia32-try,vm-linux-debug-x64-try,vm-linux-debug-x64c-try,vm-mac-debug-arm64-try,vm-mac-debug-x64-try,vm-msan-linux-release-x64-try,vm-reload-linux-debug-x64-try,vm-reload-rollback-linux-debug-x64-try,vm-ubsan-linux-release-x64-try,vm-win-debug-arm64-try,vm-win-debug-x64-try,vm-win-release-ia32-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349260
Reviewed-by: Martin Kustermann <kustermann@google.com>
2024-02-01 18:28:03 +00:00