Commit graph

82344 commits

Author SHA1 Message Date
Brian Wilkerson ff34b81174 Support overlapping deletions in quick fixes
I believe that the tests cover the added behavior (and some existing
behavior), but they aren't complete. I'll add more tests over time, but
for now the test coverage is strictly better than it used to be.

Change-Id: I8dd228cb2b3c477c28e6d20c6da4a549a30d1afb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217280
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-10-19 18:36:23 +00:00
Paul Berry e5e8f84927 Rework how final and late are represented in flow analysis tests.
The fields `isFinal` and `isLate` are moved to the `Var` class.  This
should allow greater flexibility when experimenting with possible
changes in promotion behavior for final and late variables.

Bug: https://github.com/dart-lang/language/issues/1721
Change-Id: I3a328566b4a55244ca76c41da6e362066118d283
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217261
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-10-19 18:18:52 +00:00
Konstantin Shcheglov 95dc8bd415 Patch dart:ui/src/ui references.
Bug: https://buganizer.corp.google.com/issues/203423390
Change-Id: Ibbe2a304b9bbc3dddff684ca8ba1cc41b28507e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217281
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-10-19 18:05:55 +00:00
Ryan Macnak 1ef7e6a974 [vm, compiler] Use comparisons with the correct width for SpeculativeShiftUint32OpInstr.
Fixes failure to detect negative Smis with compressed pointers.

TEST=left_shift_bit_and_op_test on AppJIT
Change-Id: I2ca98f1af16eb62a309ddd8d6fe6d4a0e98e49c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217152
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-10-19 18:00:32 +00:00
pq 15d00a8586 bulk fix accounting for hints with correction producers
Sample run:

```
hints w/ correction producers:

HintCode.CAN_BE_NULL_AFTER_NULL_AWARE bulk fixable: false
HintCode.DEAD_CODE bulk fixable: false
HintCode.DEAD_CODE_CATCH_FOLLOWING_CATCH bulk fixable: false
HintCode.DEAD_CODE_ON_CATCH_SUBTYPE bulk fixable: false
HintCode.DIVISION_OPTIMIZATION bulk fixable: false
HintCode.DUPLICATE_HIDDEN_NAME bulk fixable: false
HintCode.DUPLICATE_IMPORT bulk fixable: false
  => override explanation missing for: RemoveUnusedImport
HintCode.DUPLICATE_SHOWN_NAME bulk fixable: false
HintCode.INVALID_FACTORY_ANNOTATION bulk fixable: false
HintCode.INVALID_IMMUTABLE_ANNOTATION bulk fixable: false
HintCode.INVALID_LITERAL_ANNOTATION bulk fixable: false
HintCode.INVALID_REQUIRED_NAMED_PARAM bulk fixable: false
HintCode.INVALID_REQUIRED_OPTIONAL_POSITIONAL_PARAM bulk fixable: false
HintCode.INVALID_REQUIRED_POSITIONAL_PARAM bulk fixable: false
HintCode.INVALID_SEALED_ANNOTATION bulk fixable: false
HintCode.MISSING_REQUIRED_PARAM bulk fixable: false
HintCode.MISSING_REQUIRED_PARAM_WITH_DETAILS bulk fixable: false
HintCode.MISSING_RETURN bulk fixable: false
HintCode.NULLABLE_TYPE_IN_CATCH_CLAUSE bulk fixable: true
HintCode.OVERRIDE_ON_NON_OVERRIDING_FIELD bulk fixable: false
HintCode.OVERRIDE_ON_NON_OVERRIDING_GETTER bulk fixable: false
HintCode.OVERRIDE_ON_NON_OVERRIDING_METHOD bulk fixable: false
HintCode.OVERRIDE_ON_NON_OVERRIDING_SETTER bulk fixable: false
HintCode.SDK_VERSION_AS_EXPRESSION_IN_CONST_CONTEXT bulk fixable: false
HintCode.SDK_VERSION_ASYNC_EXPORTED_FROM_CORE bulk fixable: false
HintCode.SDK_VERSION_BOOL_OPERATOR_IN_CONST_CONTEXT bulk fixable: false
HintCode.SDK_VERSION_EQ_EQ_OPERATOR_IN_CONST_CONTEXT bulk fixable: false
HintCode.SDK_VERSION_EXTENSION_METHODS bulk fixable: false
HintCode.SDK_VERSION_GT_GT_GT_OPERATOR bulk fixable: false
HintCode.SDK_VERSION_IS_EXPRESSION_IN_CONST_CONTEXT bulk fixable: false
HintCode.SDK_VERSION_SET_LITERAL bulk fixable: false
HintCode.SDK_VERSION_UI_AS_CODE bulk fixable: false
HintCode.TYPE_CHECK_IS_NOT_NULL bulk fixable: false
  => override explanation missing for: UseNotEqNull
HintCode.TYPE_CHECK_IS_NULL bulk fixable: false
  => override explanation missing for: UseEqEqNull
HintCode.UNDEFINED_HIDDEN_NAME bulk fixable: false
HintCode.UNDEFINED_SHOWN_NAME bulk fixable: false
HintCode.UNNECESSARY_CAST bulk fixable: true
HintCode.UNNECESSARY_IMPORT bulk fixable: false
  => override explanation missing for: RemoveUnusedImport
HintCode.UNNECESSARY_NULL_COMPARISON_FALSE bulk fixable: false
HintCode.UNNECESSARY_NULL_COMPARISON_TRUE bulk fixable: false
HintCode.UNUSED_CATCH_CLAUSE bulk fixable: false
HintCode.UNUSED_CATCH_STACK bulk fixable: false
HintCode.UNUSED_ELEMENT bulk fixable: false
HintCode.UNUSED_FIELD bulk fixable: false
HintCode.UNUSED_IMPORT bulk fixable: false
  => override explanation missing for: RemoveUnusedImport
HintCode.UNUSED_LABEL bulk fixable: false
HintCode.UNUSED_LOCAL_VARIABLE bulk fixable: false
HintCode.UNUSED_SHOWN_NAME bulk fixable: false
```



Change-Id: I9d6e86854d7f1de43ac8154631610869bf56c2c8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217149
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2021-10-19 17:57:52 +00:00
pq 4d35418b6f fix unused_result false positive
Fixes: https://github.com/dart-lang/sdk/issues/47473

Change-Id: Idc8a7c029dd3f081cda5c0d3d2ca4929156fcc98
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217161
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-10-19 17:09:02 +00:00
Konstantin Shcheglov de16d277d7 Fix MockSdk to be more backward compatible.
Bug: https://buganizer.corp.google.com/issues/203503644
Change-Id: I7dffc8b80597cd21cc41261678e74ba90a4e7e8a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217260
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-10-19 16:23:42 +00:00
Lasse R.H. Nielsen 2c36db9b0a Deprecate IntegerDivisionByZeroException.
Deprecates the class and makes it implement `Error` (more specifically
`UnsupportedError`).
Code throwing `IntegerDivisionByZeroException` should be migrated to
throwing `unsupportedError` directly, code catching the exception class
should start catching `UnsupportedError` immediately (or reconsider why
they are catching at all).

Integer division by zero also covers other ways that a double division
can give a non-number result (any infinity or NaN result of the division prior to calling `truncate()` on the result, will cause `~/` to throw).

Fixes #46776

Bug: https://github.com/dart-lang/sdk/issues/46776
Change-Id: Idf2657153dd16542e72c6ba921f587dd9fc9032a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208643
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2021-10-19 16:07:52 +00:00
Alexander Thomas 056afdac39 [testing] Merge dart2js-batch into the global batch option
* Remove all uses of `--dart2js-batch`.
* Enable batch mode for dart2js by default.
* Rename `--noBatch` to `--no-batch`.
* Make `--no-batch` affect dart2js configurations.

Change-Id: I33bdb5cfe8a82ccfc6ce9e43843f1b7a34ff1fbf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217006
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2021-10-19 13:49:02 +00:00
Clement Skau 0cd81027f4 Set correct fileUri on FfiNative fields.
`currentLibrary.fileUri` points to the library file (e.g. ui.dart)
and not the class-containing `part` file (e.g. compositing.dart).
This causes `fileOffset` out-of-bounds and `location` to fail.

Failing stack trace:
Unhandled exception: Crash when compiling null, at character offset null:
RangeError (offset): Invalid value: Not in inclusive range 0..1257: 1543
#0      RangeError.checkValueInInterval (dart:core/errors.dart:282:7)
#1      Source.getLocation (package:kernel/ast.dart:13919:16)
#2      Component.getLocation (package:kernel/ast.dart:13692:31)
#3      _getLocationInComponent (package:kernel/ast.dart:14212:22)
#4      Field._getLocationInEnclosingFile (package:kernel/ast.dart:2363:12)
#5      TreeNode._getLocationInEnclosingFile (package:kernel/ast.dart:206:20)
#6      TreeNode.location (package:kernel/ast.dart:202:12)
#7      _FfiUseSiteTransformer._ensureNativeTypeToDartType (package:vm/transformations/ffi_use_sites.dart:744:35)
[...]

TEST=Existing.
Change-Id: I17b3ab23abcb04aca046509e7cdbb177ed156e54
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217186
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2021-10-19 13:09:46 +00:00
Jonas Finnemann Jensen 51573a9c92 Bump pub to 400f21e9883ce6555b66d3ef82f0b732ba9b9fc8
Changes:
```
> git log --format="%C(auto) %h %s" 35681b0..400f21e
 https://dart.googlesource.com/pub.git/+/400f21e9 migrate pub client (except tests) to null-safety (#3178)
 https://dart.googlesource.com/pub.git/+/909852fc Remove unused `pub run --dart-dev` (#3177)

```

Diff: https://dart.googlesource.com/pub.git/+/35681b0126a1fb48bf2062dd09f74296715402c2~..400f21e9883ce6555b66d3ef82f0b732ba9b9fc8/
Change-Id: If428fda768156f8923be3d739e80b9ac9a37eb87
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217188
Auto-Submit: Jonas Jensen <jonasfj@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2021-10-19 12:40:17 +00:00
Johnni Winther 0cbaee4c30 [cfe] Pass reference for lowered static late fields
Fixes fuzz test of static_field_lowering/opt_in

Change-Id: Ia0199e0cf3471a9b100e5f442ccfaad2930d94bd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217187
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-10-19 12:32:57 +00:00
Johnni Winther c206ec38ce [cfe] Pass ReferenceFromIndex to value class transformation
This fixes fuzz testing for value_class/empty,
value_class/explicit_mixin, and value_class/value_mixin_error

Change-Id: Ia098b3ed5b8a028f1a28c5579fe5df11e5a92ff0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217185
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-10-19 10:02:38 +00:00
Chloe Stefantsova 82dc2cf255 [analyzer] Disable check for argument order if experiment is enabled
Part of https://github.com/dart-lang/sdk/issues/47451.

Change-Id: I6e13e8642c287c2386f7a323ccd5e41d83c5b358
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217012
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Chloe Stefantsova <dmitryas@google.com>
2021-10-19 09:24:27 +00:00
Johnni Winther 565d0977d1 [cfe] Handle Procedure.signatureType in transformers
Change-Id: I2e32883c2e2cebaa48335d1aa3a1d1834d3a8106
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217182
Reviewed-by: Chloe Stefantsova <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-10-19 09:24:07 +00:00
Kevin Moore 38f764f4b8 vm math patch: use a singleton for Random.secure
Seems to be zero upside to creating a new instance every time

Change-Id: I8cf372f654225ee5f599fd0c36019607c1186fc9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217143
Auto-Submit: Kevin Moore <kevmoo@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2021-10-19 09:09:00 +00:00
Johnni Winther a5de2458f6 [cfe] Use correct Name for lookup of private forwarding constructors
Fixes fuzz testing of general/issue46581 and general/issue46581/main

Change-Id: Idb03be55756dec0a861006484a457a6911fc9adf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217017
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-10-19 08:40:08 +00:00
Daco Harkes 0cd586486b [cfe/ffi] Move FFI transforms into folder
Having the transforms in a dedicated folder enables us to add more files
without cluttering the transformations folder itself.

TEST=This only moves files. Bots test whether imports are correct.

Change-Id: Icf1d64b5ec09a7d19915b1cb72464fa67b6cfe15
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217180
Reviewed-by: Clement Skau <cskau@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-10-19 07:25:09 +00:00
Daco Harkes 1868b119e7 [vm/ffi] Cleanup outdated documentation
This file as not been updated in a long time, and we're not using it
as the ground truth for CFE/analyzer checks.

TEST=This is deleting a markdown file.

Change-Id: I4872223a889407800c2f0d6a6092f7db4200967c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217018
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-10-19 05:50:58 +00:00
Sam Rawlins 37b3ed798f Fix references to StaticWarningCodes which are now CompileTimeErrorCodes
Change-Id: I89390b6f89de4301460e092b8828d720ac9c3224
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217155
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-10-19 04:54:50 +00:00
Sigmund Cherem 38b5a841de [dart-web] Remove dart:web_sql library.
The WebSQL standard was abandoned more than 10 years ago and is not
supported by many browsers.

The `dart:web_sql` library was marked as deprecated in Dart 2.14. This
CL makes the library inaccesible, removes support for `dart:web_sql` imports,
and removes the `Window.openDatabase` API. The old code for `dart:web_sql` is
still generated by the html generators. Removing that will be handled by a
separate change.

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

Change-Id: I892107396b3b227b4f33344377585aa5e5328288
Bug: https://github.com/dart-lang/sdk/issues/46316
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/216080
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2021-10-19 01:00:08 +00:00
Konstantin Shcheglov 5fff311900 Add createMockSdk(), a replacement for MockSdk.
This makes MockSdk a factory for FolderBasedDartSdk.
In a next CL I will deprecate MockSdk, and update SDK clients.

Change-Id: I1a24c70d2e9b902150f80ccaaa8a84d5e385058f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217150
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-10-18 21:37:54 +00:00
Brian Quinlan b89382ad4e Use full path for link to gethostname
Add some documentation for

Change-Id: Iea03e02afac304f4d6a17103b2e99d123bdc9d48
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217141
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2021-10-18 20:36:14 +00:00
Paul Berry 04c8ef2bf1 Reduce the use of <unnamed> in analyzer error messages.
Two error messages are affected:

1. When the user tries to access a static member of an extension
through an instance of a class that mentions the extension's "on"
type, and that extension is unnamed, we now report
INSTANCE_ACCESS_TO_STATIC_MEMBER_OF_UNNAMED_EXTENSION instead of
INSTANCE_ACCESS_TO_STATIC_MEMBER.  The new error message is the same
as the old one (and uses the same sharedName), but it omits the
correction message suggesting to the user that they try accessing the
static method directly via the extension name, since this advice
doesn't apply.

2. When we report AMBIGUOUS_EXTENSION_MEMBER_ACCESS, if one of the
ambiguous members comes from an unnamed extension, we now report the
unnamed extension as "unnamed extension on '$type'" rather than
referring it to as an extension named `<unnamed>`.

Change-Id: I3ca3a1ccc9399b26b083040de20db8e4f691be32
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217102
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-10-18 19:27:18 +00:00
Riley Porter d17fd4b14f Reland "Re-land "Add a generic return type for js_util functions""
This reverts commit b70a134933.

Reason for revert: google3 linter bugs disabled with a comment and Flutter PR with new js_util landed with ignore comments. Should be safe to reland.

Original change's description:
> Revert "Re-land "Add a generic return type for js_util functions""
>
> This reverts commit 66cbeb6718.
>
> Reason for revert: Causes dart analyzer and dart linter to find
> issues within google3 and flutter, causing breakages and blocking
> the roll.
>
> Original change's description:
> > Re-land "Add a generic return type for js_util functions"
> >
> > This relands commit 46486cf260.
> >
> > The differences from the original commit:
> >   - jsify is no longer being made generic
> >   - Updated the CHANGELOG
> >
> > Change-Id: Ibc3402833cce2babbec9a57ad73963d7b9442ed8
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/216920
> > Commit-Queue: Riley Porter <rileyporter@google.com>
> > Reviewed-by: Sigmund Cherem <sigmund@google.com>
>
> TBR=sigmund@google.com,srujzs@google.com,rileyporter@google.com
>
> Change-Id: Ic2ff63bc9658ccafcab3db75bdd06814d2f17b76
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/216963
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Commit-Queue: Siva Annamalai <asiva@google.com>

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: Ia8c753b568b0aca10e7784126048bddd9e1ab976
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217148
Reviewed-by: Riley Porter <rileyporter@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Riley Porter <rileyporter@google.com>
2021-10-18 18:41:53 +00:00
Ryan Macnak 60d2df4a42 [vm, gc] Consider external memory when deciding whether an idle scavenge is worthwhile.
Otherwise a heap can accumulate just under 128MB (4 * max new-space capacity) worth of new-space external data without triggering a GC.

TEST=--verbose-gc
Change-Id: Ifaa5e4ea9277f1f4a09b722897b508a192c3297f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215142
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-10-18 18:32:43 +00:00
Paul Berry 267323de7d Remove unnecessary declaration names from error codes.
The errors HintCode.INVALID_VISIBLE_FOR_OVERRIDING_ANNOTATION and
CompileTimeErrorCode.EXTENSION_CONFLICTING_STATIC_AND_INSTANCE didn't
really need to name the enclosing declaration, since the user can
easily find the enclosing declaration from the location of the error
message.  Without this change, there are some situations where an
error message would awkwardly refer to an unnamed extension as having
the name `<unnamed>`.

Change-Id: I4ddec389f18e78167464b1b5c35556e92dd1c15f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/216860
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-10-18 18:26:04 +00:00
Konstantin Shcheglov b5022a7693 Remove unused 'nullSafePackages' and 'sdkVersion' from MockSdk.
Change-Id: I281ae17a94181d2a5d769e030faf4b5f4d667792
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217145
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-10-18 18:01:43 +00:00
Konstantin Shcheglov c50982e0b7 Deprecate InterfaceType.getSmartLeastUpperBound()
Change-Id: Ia626e41015bffcbc49b48d4065b5a2420e60487a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217142
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-10-18 17:38:30 +00:00
Konstantin Shcheglov 413a08ef7c Suggest constructors when ConstructorReference and matching context type.
Change-Id: I4506365286b327687563d3c7c7fede077256697c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217062
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-10-18 17:34:39 +00:00
Konstantin Shcheglov 2626eb025e Stop using 'nullSafePackages' and 'sdkVersion' for MockSdk.
There is a released version with Null Safety, and so we don't need
to allow-list packages, and test with pre-release versions.

Change-Id: Ia0f574155df32f326c2e3ff56f1564cbb103e8cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217060
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-10-18 17:10:29 +00:00
Konstantin Shcheglov 60535b95de Issue 47073. Inherit covariant-by-declaration from any candidate.
Bug: https://github.com/dart-lang/sdk/issues/47073
Change-Id: I1ae779d50f1e4ee63f005098f9a22615c744480a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217081
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-10-18 16:45:59 +00:00
Konstantin Shcheglov f904b30c8d Tweaks for LinkedElementFactory.
Change-Id: I5011c2182d870eb35460df227e08b1493434fb8b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217140
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-10-18 16:39:38 +00:00
Devon Carew 840a8aada4 [core libs] add the ability to have sample assumptions when validating the api docs
Change-Id: Ic2d0af4dd033b09fb5b0fcf4f57a48da367b6f1d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/216681
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
2021-10-18 16:11:48 +00:00
Erik Ernst ace8c34996 Adjust language{,_2}/regress/regress31596_covariant_declaration_test
These tests are updated to match the behavior which was specified in
dart-lang/language#1833. The change is valid for both language_2 and
language because it isn't tied to a language version. This should not
break any existing code because it only changes programs with
compile-time errors into programs with no errors.

(If we agree on this change then I'll approve the failures.)

Change-Id: I49f41fd1b1575c237c9c619c912de3e8de53356f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217016
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2021-10-18 15:58:09 +00:00
Konstantin Shcheglov 098d517e9f Store 'request' and 'builder' as fields in DartCompletionContributor.
Change-Id: I86d5a19cd264f2287a86c7e0278077affc365925
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217101
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-10-18 15:52:49 +00:00
David Benjamin 3d73ae1c22 Replace old M_ASN1_* macros with their functions
M_ASN1_* is an old quirk from a very very old OpenSSL. They're just
wrappers over identically-named functions at this point.

Bug: none
TEST=ci
Change-Id: I1a204d6c1cca62861d7f11bf3c7adfa24bd47e59
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217040
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
Auto-Submit: David Benjamin <davidben@google.com>
2021-10-18 14:48:39 +00:00
Daco Harkes 757c2b82ce [vm/ffi] Add Bool
This CL adds the `Bool` `NativeType` with support for loading/storing
from `Pointer<Bool>`, `Array<Bool>`, and `Struct` and `Union` fields,
and support for passing booleans through FFI calls and callbacks.

The assumption is that `bool` is always treated as `uint8_t` in the
native ABIs. Including: (1) whether there can be garbage in the upper
bytes in CPU registers, (2) stack alignment, and (3) alignment in
compounds.

The conversion from `bool` to `uint8_t` is implemented as follows:
- bool to int: `value ? 1 : 0`
- int to bool: `value != 0`
The conversion is implemented in Dart in patch files for memory loads
and stores (pointer, array, and struct fields) and kernel_to_il for
FFI call and callback arguments and return value.

TEST=runtime/vm/compiler/ffi/native_type_vm_test.cc
TEST=tests/ffi/bool_test.dart
TEST=tests/ffi/function_callbacks_structs_by_value_generated_test.dart
TEST=tests/ffi/function_structs_by_value_generated_test.dart

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

Change-Id: I75d100340ba41771abfb41c598ca92066a89370b
Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-debug-x64-try,vm-ffi-android-debug-arm-try,vm-kernel-mac-debug-x64-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-linux-debug-ia32-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-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-ffi-android-debug-arm64c-try,vm-kernel-mac-release-arm64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-precomp-android-release-arm64c-try,vm-kernel-precomp-android-release-arm_x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/216900
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
2021-10-18 10:44:11 +00:00
Paul Berry 72cfca37aa Change WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR to use .new consistently.
This changes the behavior of the
CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR error
so that instead of referring to unnamed constructors with a clumsy
trailing `.` (e.g. `The constructor 'Foo.'`), it refers to them in the
same way the user's code refers to them (so, e.g. if the user's code
refers to the constructor using the name "new", the error message does
too).

Change-Id: Ib29b64ce0122d8928b3a59f5e0125561da8f73d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/216840
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-10-18 10:01:38 +00:00
Daco Harkes 8986a2bcd9 [analyzer/ffi] Non const type argument error on receiver
Bug: https://github.com/dart-lang/sdk/issues/36780

Change-Id: I2dd98d58f0045d25afcfb92a43f858e5f2bcc1fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217009
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-10-18 07:46:19 +00:00
Kevin Moore cc40080d96 dart2js_info: enable and fix lints, validate analysis on CI
Also updated dependencies and dropped publish information

Change-Id: Ie5d8ca907599c5e504c747d97413d32ef9e329e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217061
Auto-Submit: Kevin Moore <kevmoo@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
2021-10-17 06:25:00 +00:00
Paul Berry 189aeead47 Fix reporting of INSTANCE_ACCESS_TO_STATIC_MEMBER from within an extension.
Previously, if a piece of code inside an extension tried erroneously
to refer to a static class member using instance access, the error
CompileTimeError.UNQUALIFIED_ACCESS_TO_STATIC_MEMBER_OF_EXTENDED_TYPE
would be reported.  This change corrects the error to
CompileTimeError.INSTANCE_ACCESS_TO_STATIC_MEMBER.

In addition, the responsibility to report the error
CompileTimeError.INSTANCE_ACCESS_TO_STATIC_MEMBER is shifted fully to
the resolver (previously, it was split between the resolver and the
error verifier).

Change-Id: Idcd1a3b8a1e226fed692900838c3d2d3c0585d4f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217020
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-10-17 06:22:30 +00:00
Konstantin Shcheglov 0a8091f908 Change ConstructorElement.displayString to 'Class' or 'Class.constructor'
Change-Id: I0918cd9f97d2ec3af008f5369cbd048fc5137dc8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/216922
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2021-10-16 22:28:40 +00:00
Paul Berry 79fd228bbb Improve test output when error messages don't match.
We now print any non-null values of `ExpectedError.message`,
`ExpectedError.messageContains`, and
`ExpectedError.correctionContains`.  This should make it easier to
understand what has gone wrong when there's a mismatch due to an
incorrect message or correction string.

Change-Id: I50359008ad15b894b1a5c5512ff6847d07193408
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/216820
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-10-16 12:55:58 +00:00
Ryan Macnak 0e8d33825b [vm] Change Version::String() to not invoke malloc.
This may run during a segfault signal handler, and malloc is not signal safe.

TEST=tsan
Bug: https://github.com/dart-lang/sdk/issues/47472
Change-Id: I29702010384dc95396313791dddb3887ff6ca097
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217063
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-10-15 23:22:10 +00:00
Mayank Patke 70479beea5 [dart2js] Rename platform files.
This avoids terms like "NNBD" and "strong" in favor of sound/unsound
null safety.

Change-Id: I1c99bea7155f80bc6acf62f46c6f266a29ebf1a2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213406
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2021-10-15 21:40:08 +00:00
Brian Quinlan 81ddb51b84 Add some documentation for localHostname
Change-Id: Ib56a233731450ff1085bf66fe672a94cf865bd69
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217026
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2021-10-15 21:29:58 +00:00
Ryan Macnak f2174d4eb8 [vm, compiler] Fix BoxInt32Instr to not create denormalized Mints on arm64 with compressed pointers.
Removes the assumption that the incoming int32 is sign-extended.

TEST=ffi/function_test
Change-Id: I347dccec47b4784be40c834de62ccea157d9042d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/216960
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-10-15 19:54:30 +00:00
Konstantin Shcheglov 7c17777ecc Rewrite 'C<args>.<synthetic>' into ConstructorReference.
It will make things more consistent, and helpful for completion.

Change-Id: Id21b7544862af25c5feb13c7c8864bdbf5d88227
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217027
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-10-15 19:48:50 +00:00
Konstantin Shcheglov 71da05e920 When const evaluating ConditionalExpression, if the condition is unknown, checks both then/else for errors.
Bug: https://github.com/flutter/flutter/issues/91906
Change-Id: I29057d9b5704fe9850a6ba2ed1416472c7e1abc6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217025
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-10-15 19:32:30 +00:00