Commit graph

87517 commits

Author SHA1 Message Date
Kallen Tu
646886c968 Type Socket in _HttpConnection to avoid dynamic invocations.
Change-Id: I55b4312dcf6f2af79f183f21b8d2722f62f0aece
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258515
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2022-09-30 19:29:56 +00:00
Konstantin Shcheglov
c73228abaf Report an error when a variable pattern binds in one branch of logical-or, but not in another.
Only check for if-case is implements for now.

Change-Id: I57d1b8b33fbe2bf7adc848b5d607ff99b878b479
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262101
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2022-09-30 18:53:26 +00:00
Brian Wilkerson
74a5cf758f Enhance create-local-variable to work with records
Change-Id: Iedbcdebe79b3c4ef2ce1205fb7605c1106ac852d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262262
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-09-30 18:24:16 +00:00
Joshua Litt
c6b141e9e5 [dart2wasm] Fix bug in dartify.
Change-Id: Ia922d3ac6e3849db13877259c65c7d8d884c5828
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262100
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2022-09-30 18:14:07 +00:00
Brian Wilkerson
53447c990f Enhance add-type-annotation to handle record types
Change-Id: I684820c9368f282039a93f34571afb014fb476a1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262260
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-09-30 17:04:46 +00:00
Brian Wilkerson
06c5592b9c Enhance change-type-annotation to support record types
Change-Id: Ib5bbdec16c88858cda4f1739ad92a4c68e598a6d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262261
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-09-30 17:04:16 +00:00
Sigmund Cherem
dad1db4e20 [dart2js] remove unused helpers
These helper methods were used by generated code long ago, before
Dart 2 I believe.  There appears to be no uses of these methods in
our code generation today (last use in the compiler was removed in https://dart-review.googlesource.com/c/sdk/+/75300/2/pkg/compiler/lib/src/common_elements.dart 4 years ago), so I believe we can remove them.

Change-Id: I09647000e4b2643a54246cb77a6d0d06b78abeb3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260961
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2022-09-30 16:21:46 +00:00
Ahmed Ashour
9b4cda1bfd [analysis_server] DataDriven: allow replacedBy from a package to another one
Bug: #48204
Change-Id: Id13f038e39e9e150e1d6b21bcdde25bb815b15a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241004
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-09-30 15:30:57 +00:00
Johnni Winther
599836a2c5 [cfe,vm] Make patch parts into actual parts
This changes the VM patch files to use parts explicitly, making
handling of patch libraries similar to regular libraries.

Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try

Change-Id: I6280d62edba3d12a1f77ae6a7f64e1e9b5d18227
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/224949
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-09-30 15:25:11 +00:00
Konstantin Shcheglov
4b134e4b14 Simplify TypeMemberContributor.
There is no need to put data into local variables, and invoke
something for the InterfaceType. We can call it directly at the end
of each branch.

Change-Id: Iee0d2304fb45b526604f2c6bd6a81363820d5909
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262103
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-09-30 14:32:41 +00:00
Brian Wilkerson
a30a4dc860 Update make_variable_nullable fix to work with records
Change-Id: I77d6db6f79d2bc83e16b406c9b2804cbe2164974
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262021
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-09-30 14:19:51 +00:00
Martin Kustermann
ed5ad5c087 Add CLI tool for analyzing Dart VM heapsnapshots
This CL adds an interactive command line tool to analyze
heapsnapshots generated by the Dart VM.

The tool works by operating on sets of objects. It supports operations
like users, transitive closure, union, ...

An example usage that loads snapshot, finds all live objects, finds
the empty lists in them and prints retainers of the empty lists:

    ```
    % dart bin/explore.dart

    (hsa) load foo.heapsnapshot

    (hsa) all = closure roots
    (hsa) stat all
          size       count     class
      --------   --------  --------
       43861 kb    8371    _Uint8List dart:typed_data
         ...
      --------   --------  --------
      108904 kb  400745

    (hsa) empty-lists = dfilter (filter all _List) ==0
    (hsa) empty-growable-lists = filter (users empty-lists) _GrowableList

    (hsa) retain empty-growable-lists
    There are 5632 retaining paths of
    _GrowableList (dart:core)
    ⮑ ・UnlinkedLibraryImportDirective.configurations (package:analyzer/src/dart/analysis/unlinked_data.dart)
        ⮑ ﹢_List (dart:core)
            ⮑ ・...
    ```

For now the tool lives only in dart-lang/sdk.

TEST=pkg/heapsnapshot/test/*_test.dart

Change-Id: I671c2e3ca770e1a5aa3e590e850a5694070b4c3a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261100
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2022-09-30 14:15:01 +00:00
Ahmed Ashour
8eb8e61e1e [analysis_server] DataDrive replacedByto handle removed constructors
Fixes #50011

Change-Id: I30670f88562216ffe057b0e4de7e93d50a414fe0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260761
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-09-30 13:58:08 +00:00
Daco Harkes
d9c442bce8 [vm/ffi] Throw on returning Error in Handle
Makes `Dart_Handle` FFI returns behave as the following snippet:

```
Dart_Handle ExampleSnippet() {
  Dart_Handle result;
  if (Dart_IsError(result)) {
    Dart_PropagateError(result);
  }
  return result;
}
```

Also makes FFI consistent with Dart_NativeFunctions, which will
automatically throw upon return if Dart_SetReturnValue set the result
to an error.

`UnhandledExceptions` cannot flow out into Dart generated code. So,
the implementation needs to be in `FfiCallInstr::EmitNativeCode`.

Using `Dart_IsError` is slow compared to a machine code class id
check. So, we should do the handle unwrapping and class id check in
machine code.

Unwrapping Handles in machine code is only safe when the GC is
guaranteed to not run: Either (1) in `kThreadInGenerated`, or (2) in
`kThreadInNative`, but only when transitioned into safepoint. So, the
handle cannot be unwrapped immediately after the FFI call in machine code. We first need to transition back to generated.

This means we need to transition again to native to do the actual
`Dart_PropagateError` call. We can do so without the stub in JIT
because we never return with normal control flow.

Performance impact of this change is within benchmark noise in both
JIT and AOT.
Size impact is 42 bytes on x64, which is 10% in AOT and 12% in JIT.

For more numbers see: go/dart-ffi-handle-error

TEST=runtime/bin/ffi_test/ffi_test_functions_vmspecific.cc
TEST=tests/ffi/vmspecific_handle_test.dart

Closes: https://github.com/dart-lang/sdk/issues/49936
Change-Id: Ie8fabeb6d53bc80689541bc4470cb37ee2200581
Cq-Include-Trybots: luci.dart.try:vm-canary-linux-debug-try,vm-ffi-android-debug-arm64c-try,vm-ffi-android-debug-arm-try,vm-kernel-gcc-linux-try,vm-kernel-linux-debug-x64-try,vm-kernel-linux-debug-x64c-try,vm-kernel-msvc-windows-try,vm-kernel-optcounter-threshold-linux-release-x64-try,vm-kernel-precomp-asan-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-tsan-linux-release-x64-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-precomp-ffi-qemu-linux-release-riscv64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-mac-release-arm64-try,vm-kernel-precomp-win-debug-x64c-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261603
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2022-09-30 13:29:51 +00:00
Paul Berry
175385825a Migration: clean up handling of type substitutions.
Previously, when the migration tool needed to change one type variable
to another during a substitution, it created a DecortedType to
represent the substitution using
`DecoratedType._forTypeParameterSubstitution`.  This was problematic
because the resulting DecoratedType had a null nullability `node`.
This in turn forced nearly every reference to `DecoratedType.node` to
be followed by a `!` operator.

With this change, we now have a new base class, `SubstitutedType`,
which can either be a `DecoratedType` (representing a fully general
substitution) or a `_TypeVariableReplacement` (representing a simple
change from one type variable to another).  This paves the way for a
follow-up CL that will make `DecoratedType.node` non-nullable.

Change-Id: I7fdaef57994c7678ecd517ab4fe84d00f0d81424
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261941
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-09-30 13:14:31 +00:00
Tess Strickland
fef905cbe2 [build] Remove linker flags to create empty section in AOT runtime.
These linker flags are causing issues with the Dart->Flutter roll,
and so I'm removing them for now until we can figure out how to
reintroduce them later.

To avoid overwriting section contents, even at a much reduced
amount, I also reland the clang DEPS revert in CL 256208.

TEST=pkg/dartdev/test/commands/compile_test

Bug: https://github.com/flutter/flutter/issues/112687
Change-Id: I35d3ff6a2a0a46e2f589469fb47bca5f9ca6df1d
Cq-Include-Trybots: luci.dart.try:analyzer-mac-release-try,dart-sdk-mac-arm64-try,dart-sdk-mac-try,pkg-mac-release-arm64-try,pkg-mac-release-try,vm-kernel-precomp-mac-product-x64-try,vm-kernel-precomp-nnbd-mac-release-arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262161
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2022-09-30 12:48:59 +00:00
Sergey G. Grekhov
21d2935dad [co19] Roll co19 to 7f9c5d2552ae31efc6f8105b7202496755e9661f
2022-09-29 sgrekhov22@gmail.com dart-lang/co19#195. Description some of RawDatagramSocket tests improved (dart-lang/co19#1473)
2022-09-28 49699333+dependabot[bot]@users.noreply.github.com Bump actions/setup-java from 3.5.0 to 3.5.1 (dart-lang/co19#1470)
2022-09-23 sgrekhov22@gmail.com Fixes dart-lang/co19#1468. [Records]. Numerous typos fixed (dart-lang/co19#1469)
2022-09-23 sgrekhov22@gmail.com dart-lang/co19#1399. [Records] Primitive equality tests added (dart-lang/co19#1466)

Change-Id: Ib538f7946b4cc1d98971e20adb9ebdc5d4243bf3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262140
Reviewed-by: Alexander Thomas <athom@google.com>
2022-09-30 07:18:22 +00:00
Stephen Adams
f7809873f4 [dart2js] Add RecordType
Add RecordType to the dart2js DartType hierarchy.
The RecordShape is made explicit so that processing the record type usually means processing the list of field types.
This pattern of shape + combined-fields will be used elsewhere, e.g. constants.

Filled out some uses of ir.RecordType until it gets converted to a dart2js DartType.


Change-Id: I6aa4d4a920cbb0e4f37e7079bc4d9d10e366a849
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261581
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
2022-09-30 04:59:49 +00:00
Brian Wilkerson
4b4f58b674 Suggest members from Object when completing a record property access
Looks like we might need a feature to cause record fields to be suggested
before Object members. Hard to say though without tests. Anyway, that's
a task for another CL.

Change-Id: I123d6953b1ed10ac926885ce2b1a4d5926a908ce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262024
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-09-30 00:04:58 +00:00
Nicholas Shahan
457d9fe537 [web] Remove implicit casts from dynamic in DDC
DDC:
Adding return types avoids casts on the returned values and
using JS foreign functions avoids the cast when setting the
value during truncation as well as avoiding the extra
method dispatch for setting and getting elements.

Dart2js:
Updated the return types for consistency but the dynamic
return type was already being inferred to avoid casts.

Change-Id: Ic9abaffd8dee3d12793d5083c78d35a9ada47527
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261787
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2022-09-29 23:22:29 +00:00
Ahmed Ashour
ae435d7cfc [analysis_server] associate UNDEFINED_IDENTIFIER with ImportLibrary.forExtensionMember
Fixes #50042

Change-Id: Id714445c50bbe1df1db873179772b42b08b72560
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260706
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-09-29 21:50:48 +00:00
Devon Carew
9db5174b64 [deps] rev dartdoc, html, intl, mime, and usage
dartdoc (62bc150..866338f):
  866338f1  2022-09-29  Sam Rawlins  Bump to 6.1.2 (#3198)

html (8243e96..faafebf):
  faafebf  2022-09-29  Devon Carew  Merge pull request #188 from dart-lang/update_readme
  d27b898  2022-09-29  Devon Carew  Merge pull request #189 from dart-lang/update_ci
  5a0be75  2022-09-29  Devon Carew  update to our current CI best practices
  4185afd  2022-09-29  Devon Carew  add markdown badges to the readme

intl (5464b3b..7639a15):
  7639a15  2022-09-27  Nate Bosch  Simplify the IntlStream class (#494)
  a4b44a9  2022-09-27  Lasse R.H. Nielsen  Cleanup of `var this.`, dynamic parameters, and more (#497)

mime (0a75a41..bf041aa):
  bf041aa  2022-09-26  Devon Carew  update action versions; add dependabot config (#69)

usage (e287a72..9a98c89):
  9a98c89  2022-09-29  Devon Carew  whitespace change to the LICENSE file (#182)
  cf284c7  2022-09-29  Kevin Moore  analysis options and lint cleanup (#183)

Change-Id: I0a6bd0de7bc75cd84b20e1de6f0463544ac68a70
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262020
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
Auto-Submit: Devon Carew <devoncarew@google.com>
2022-09-29 21:25:38 +00:00
Konstantin Shcheglov
42c58c100a Add missed 'typeArguments' to FunctionExpressionInvocation.childEntities
Change-Id: I2cc5873a35ef4a7b8f36560c80c9dff7fc3820be
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261942
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-09-29 20:47:41 +00:00
Konstantin Shcheglov
d8f928331a Don't import class Record from dart:core into a library where the 'records' feature is not enabled.
...while it is still an experiment.

Change-Id: Ib606a3c099b45343686b8e921c0aa1c24dec59da
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261920
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-09-29 20:47:38 +00:00
Sam Rawlins
eb9554d70e Evaluate more fixes
I also noted how many ParserErrorCodes are 'needsEvaluation'

Change-Id: I487976c918038903ef49a87a3cb97d1af2327398
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261880
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2022-09-29 20:37:59 +00:00
Devon Carew
ad34feec87 [dart create] suggest using the pubspec repository field
Change-Id: I51e83853d947bc545aced1ae2ae3d048dd7c6b01
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261940
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2022-09-29 19:13:27 +00:00
Stephen Adams
a8ab1853a9 [dart2js] Avoid eager initialization with a large set
Change-Id: Ic4027cfe09294836cc182969a7cb92be01d3c7a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261781
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2022-09-29 19:08:27 +00:00
DEPS Autoroller
af850a8165 Roll Dart Documentation Generator from 691fa9640aae to 62bc1503b285 (3 revisions)
https://dart.googlesource.com/dartdoc/+log/691fa9640aae..62bc1503b285

2022-09-28 srawlins@google.com Fix styles in inline search results (#3197)
2022-09-28 srawlins@google.com Simplify some code in dartdoc_options.dart (#3156)
2022-09-28 srawlins@google.com Prevent default when hitting enter (#3195)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/dart-doc-dart-sdk
Please CC dart-ecosystem-gardener@grotations.appspotmail.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Dart Documentation Generator: https://github.com/dart-lang/dartdoc/issues
To file a bug in Dart SDK: https://github.com/dart-lang/sdk/issues

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md

Tbr: dart-ecosystem-gardener@grotations.appspotmail.com
Change-Id: I51527ab30a73a73de95f53715e83488562a54c71
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261445
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2022-09-29 18:58:38 +00:00
Aske Simon Christensen
0ef1afa10f [dart2wasm] Remove obsolete patch annotation declaration
Required to match https://dart-review.googlesource.com/c/sdk/+/224946

Change-Id: I271fca2b408583ad0a645b6bcbea3f3ac129e015
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261901
Auto-Submit: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2022-09-29 17:57:47 +00:00
Konstantin Shcheglov
afc8abb2e6 Replace two more assertX with textual dumps.
Change-Id: I89332f27bfdb19cbb0e64b37e5b77403ea89872e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261785
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2022-09-29 17:54:38 +00:00
Brian Wilkerson
53e3d2b5bc Fix one failure on the windows bot
Change-Id: I885b5cff40d60631602912a7b5751b4abd728cab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261446
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-09-29 17:33:27 +00:00
Greg Spencer
73bb76184f Fix Windows tests, return absolute paths from example navigation
Fixes failing post-submit Windows tests,
and causes the examples/api IDE navigation results to return absolute paths.

Change-Id: If6d1ca9848644b78ff6f8e9549b84df7139b7ffc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261801
Auto-Submit: Greg Spencer <gspencer@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-09-29 16:58:51 +00:00
Konstantin Shcheglov
4693daea8a Resolve BinaryPattern.
Change-Id: Ia37f1d0fe9d5a5368c1035732ff6a217ff4e24bd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261784
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-09-29 16:56:03 +00:00
Konstantin Shcheglov
1ed03b3707 Replace assertFunctionExpressionInvocation() with textual dumps.
Change-Id: I4f9d4da934a128c6413880a4bd5a8e3adf3678f7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261783
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2022-09-29 16:48:22 +00:00
Alexander Markov
2ab5130eb5 [vm] Relax assertion for empty record type
TEST=co19/LanguageFeatures/Records/upper_and_lower_bounds_A04_t01
(Tested manualy by applying 4b6a8f35b9 and running
"tools/test.py -n dartk-strong-linux-debug-x64 co19/LanguageFeatures/Records/upper_and_lower_bounds_A04_t01").

Issue: https://github.com/dart-lang/sdk/issues/49719
Change-Id: Ib5658ac776a75913e617095f8861baba25f13de3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261800
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
2022-09-29 16:48:00 +00:00
Danny Tuppeny
604bf2fe3b [analysis_server] Don't overlap folding regions when lineFoldingOnly
+ convert LSP folding tests to use TestCode parser.

A change in VS Code means two folding regions are no longer allowed to end/start on the same line (the second range is silently dropped). This truncates folding regions if they end on the same line that another starts to end on the line before (but only if a client only supports line-folding mode).

Fixes https://github.com/Dart-Code/Dart-Code/issues/4121.

Change-Id: Ic26f58f84c44a01ae5157c336ed0f207d1c0eeb8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261900
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-09-29 16:34:07 +00:00
Daco Harkes
f70ca8ee11 [vm] Make RangeCheck reusable
Moves `RangeCheck` from the intrinsifier to the assembler.

Also, unifies the signature and semantics and adds documentation.

TEST=refactor

Change-Id: I274e5e46fde6a6e8baf30d8b732932f4f46d5855
Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-debug-simriscv64-try,vm-kernel-precomp-linux-debug-simriscv64-try,vm-kernel-linux-release-simarm64-try,vm-kernel-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-linux-release-simarm-try,vm-precomp-ffi-qemu-linux-release-riscv64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-linux-debug-ia32-try,vm-kernel-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261681
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2022-09-29 15:07:27 +00:00
Johnni Winther
90dd21e5d0 [cfe] Use distinct import uri on patch libraries
This CL changes the import uri of a patch library builder to be its
file uri. This makes patch libraries more like regular libraries,
preparing for full support for patch parts.

Change-Id: I1fa4c10998f17945d6607e1307337b5f66992c3a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/224947
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2022-09-29 14:28:57 +00:00
Alexander Markov
824028f96f [vm] Move _Record class to record_patch.dart
TEST=ci

Issue: https://github.com/dart-lang/sdk/issues/49719
Change-Id: Ibf818df1f57afa93051123d0c9493913e7f9ab76
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260641
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-09-29 14:12:57 +00:00
Ömer Sinan Ağacan
c427299b1c [kernel] Add an example and a note in kernel BreakStatement docs
Change-Id: Ic0153a084950d2eea53e9fd8a0ee0332de5e2ae3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261841
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2022-09-29 12:29:47 +00:00
Paul Berry
cba19c0de0 Remove bogus comment from parseLiteralSetOrMapSuffix
This comment was relevant in a previous revision of the patterns
parsing logic and I neglected to revert it.

Bug: https://github.com/dart-lang/sdk/issues/50035
Change-Id: Ia4034d66c3cc354e2ea6f2e1485380bccf7333dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261700
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-09-29 12:24:47 +00:00
Johnni Winther
3cfca8e38c Make internal/patch.part a part of dart:_internal
`internal/patch.dart` is changed to be an actual part of
`dart:_internal` and backends are changed to all use the `patch`
constant from `dart:_internal` in `@patch` annotations.

This is done in preparation for changing the import uri of a
patch library builder to be its file uri, with which the
`internal/patch.dart` part can no longer declare itself as
`part of 'dart:_internal';` through a patch library.

Change-Id: I884e939d4a56782e64fb527cdf900769c2b2fcfd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/224946
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-09-29 11:52:37 +00:00
Tess Strickland
ef53c1929d [vm/test] Fix assumption about dynamic symbol table.
The original code assumed that only the initial symbol in the
dynamic symbol table had an empty name, and so any symbol with an
empty name was checked as if it was the initial symbol.

However, it turns out that in at least one case on our testing
infrastructure, the assembler generates a dynamic symbol with an
empty name.

Thus, we change the test to check the initial symbol separately
from the rest of the symbols in the symbol table.

TEST=vm/dart{,_2}/use_add_readonly_data_symbols_flag

Bug: https://github.com/dart-lang/sdk/issues/50071
Change-Id: Ie5d443ee2a45f8fb3400955d8bdfb3e726ab028a
Fixed: 50071
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-nnbd-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261820
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2022-09-29 09:36:37 +00:00
Johnni Winther
dc7df3218e [cfe] Add parser tests for patterns
These tests are copied from
pkg/analyzer/test/generated/patterns_parser_test.dart

Change-Id: Ib5fd7ca8c22dd24bf5334ac87140d961bc80838a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261660
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2022-09-29 09:08:57 +00:00
Chloe Stefantsova
f1927345a6 [cfe] Pass offset as constructor parameter in new internal ast nodes
Change-Id: Ie69f6a7fc11225e7010d91a146ca20160986e050
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261081
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2022-09-29 08:51:27 +00:00
Tess Strickland
b0c4ddf919 [pkg/dart2native] Avoid overwriting section contents in MachO files.
To create a Dart standalone executable on MacOS, we modify the
dartaotruntime executable to add the snapshot contents, and the
VM looks into the executable on disk to find the snapshot to load.

Previously, we did this by adding a new 64-bit segment load command
with a single section, where the section's file offset and size
describes the inserted snapshot. This meant the Mach-O header size increased by 152 bytes.

Originally, this wasn't an issue as there was plenty of padding, but
later clang updates removed most of this padding, and so writing the
new header actually overwrote the initial contents of the first section
in the file, which happens to be the __text section. In addition, since
the first section's offset was now declared to be within the header,
utilities that strictly validated the Mach-O format, like codesign,
would report errors.

This CL changes it so that we actually reserve space in the
dartaotruntime header using the -add_empty_section flag to the linker.
In addition, we change from using a segment load command to using a
(40 byte) note load command. This is because a segment load command
specifies that the contents should be loaded in memory, but we don't
use that loaded version. Instead, the VM reloads it from the executable
on disk so it can appropriately mmap the different parts of the
snapshot. A note section instead just declares a section of the
executable as arbitrary data that the owner can read from the file
and use as desired, which is semantically closer to our current usage.

This CL also adds a test to pkg/dartdev/test/commands/compile_test to
ensure that corrupting a random part of the snapshot in the executable
causes signature verification to fail.

This CL also reverts CL 256208, thus relanding the clang changes
starting from June that originally raised awareness of the issue by
greatly reduced the amount of padding after the load commands.

TEST=pkg/dartdev/test/commands/compile_test

Bug: https://github.com/dart-lang/sdk/issues/49783
Change-Id: Iee554d87b0eabaecd7a534ca4e4facfefbce6385
Cq-Include-Trybots: luci.dart.try:analyzer-mac-release-try,dart-sdk-mac-arm64-try,dart-sdk-mac-try,pkg-mac-release-arm64-try,pkg-mac-release-try,vm-kernel-precomp-mac-product-x64-try,vm-kernel-precomp-nnbd-mac-release-arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260108
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2022-09-29 08:32:47 +00:00
Jens Johansen
a2466e26c5 [parser] Parse nested generics with records
Fixes https://github.com/dart-lang/sdk/issues/50005
Fixes https://github.com/dart-lang/sdk/issues/50057

Change-Id: I6c84f20093b27c4d2f51e7058295257b5d82288e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261642
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2022-09-29 07:28:47 +00:00
Jens Johansen
f9e508a0cc [parser] Parse typedef with record return type
Fixes https://github.com/dart-lang/sdk/issues/49994

Change-Id: I5212b780bdd4e28c7c3afcabc72c9e65f7caecfc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261604
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2022-09-29 06:28:36 +00:00
Sigmund Cherem
efb509c114 [dart2js] stop using the deprecated NoSuchMethod consturctor
This change is a small incremental step, but should allow us to delete
the public NoSuchMethod constructor in dart:core. The change simply creates
a private constructor in the dart2js patch file and uses that instead.

https://github.com/dart-lang/sdk/issues/49529

Change-Id: I51cb2ec3b7f169a6cb831e753a3e5e9bf0752dbd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260940
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2022-09-29 01:58:56 +00:00
Konstantin Shcheglov
e1b5cbd266 Resolve VariablePattern.
Change-Id: Ibfd32610e86aa3396495b3ba7210612a17756fc4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261782
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-09-28 22:09:07 +00:00