Adds tests to check that various members are correctly mocked,
inheritance on both the Dart and @staticInterop side work as
expected with respect to mocking, and pkg:mockito can be used
with the new mocking functionality.
Change-Id: I7346339f15c14e934b045d75260c1e4540f89d0c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257161
Reviewed-by: Riley Porter <rileyporter@google.com>
Bug: https://github.com/dart-lang/sdk/issues/49351
After static checks have passed, adds functionality for a JS
object literal to mock a @staticInterop class using a Dart
implementation. Fields, getters, setters, and methods' names are
added to the object literal, and their values are closures which
call the Dart mock's members.
Change-Id: Ie2ef27179eb79039d3aa28737b246c5091f4beb6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257160
Reviewed-by: Riley Porter <rileyporter@google.com>
Adds tests for the following cases:
- Type arguments to createStaticInteropMock
- Missing members in implementing class
- Members that need to be implemented through inheritance
- Members that implement through inheritance and mixins
- Implemented members are correct subtypes
- Static checker checks for potential extension conflicts
Change-Id: I866ba47189d8f397fe6a934af1c5ecb0b231aa68
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256422
Reviewed-by: Riley Porter <rileyporter@google.com>
Bug: https://github.com/dart-lang/sdk/issues/49351
Adds checks for the following cases:
- Type arguments to createStaticInteropMock are correct
- No missing members in implementing class
- Inherited and non-overridden @staticInterop members are implemented
- Dart class can implement through inheritance and mixins
- Implemented members are correct subtypes of @staticInterop members
- Potential extension member conflicts that are attempted to be
resolved through subtyping rules
Change-Id: Iacbe5846040ba7fab41459aa19be77351cf1efca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255761
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Riley Porter <rileyporter@google.com>
Change-Id: I5b2de0bda736abf89ba3f5f3a8300af9fbf68a6a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259510
Auto-Submit: Devon Carew <devoncarew@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
This change adds minimal support for RecordType, RecordLiteral,
RecordIndexGet, RecordNameGet and RecordConstant kernel nodes to TFA.
TFA is *not* yet extended with the ability to infer record types.
TEST=language/records/simple
Issue: https://github.com/dart-lang/sdk/issues/49719
Change-Id: I7c5eb860c6a5cb263e4d1bb55ad230e5c51f47c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259520
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
This change provides baseline implementation of type checks involving
record instances and record types via runtime calls.
TEST=language/records/simple/type_checks_test
Issue: https://github.com/dart-lang/sdk/issues/49719
Change-Id: I2402f3db0a6dadbab477b073ed2b8861d5a172e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259460
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
I believe that this accounts for all of the changes to the proposal
that impact the AST structure. Let me know if you see something I
missed, though I'm sure we'll find any problems when we implement the
parser support.
If this looks good, then I plan to follow up with changes to the
constructors for `IfElement` and `IfStatement` and remove the
AstFactory methods.
Change-Id: I56937b3715d91b16a8f3a5cf45272278532b0bff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259201
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
In certain cases, VM can omit field setters for static fields as an
optimization. This change makes sure that setters are not omitted
if static field needs a null assertion.
TEST=language/nnbd/null_assertions/parameter_checks_fields_and_setters_test
(Borrowed from https://dart-review.googlesource.com/c/sdk/+/258220.)
Fixes https://github.com/dart-lang/sdk/issues/49940
Change-Id: I370bff7ad2d9dddb38c6c1b481684fdda09636ac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258940
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Experiment with tool that finds duplicate code.
This still leaves a lot to be desired, but has already found something,
e.g. https://dart-review.googlesource.com/c/sdk/+/257400
It will probably need some iterations before running it on more than
one file would make sense.
Change-Id: I687e63e0a9003a8350df6682db279050d407605a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257401
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Will be used during call hierarchy analysis in combination with explicit call graph construction.
Currently typemasks do not support the `difference` operation and so we cannot fully narrow the type cones based on the call hierarchy. An implementation is included here of the applies-to set with subtraction of overrides.
Change-Id: I3f6c113787a4d26e9751added482791365c12832
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259560
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
This is the latest version, which we can now update to after switching
the JS interop imports/exports in dart2wasm to use `externref`.
Change-Id: I102ca6e4b6d777cf490ee28cc36b46536ceff7dd
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258542
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
There's one only one path for creating a _FileResourceInfo which comes from RandomAccessFile. Type the `file` field to avoid a dynamic call to `.path`.
Change-Id: Ia1041d5b221d0496af3dd177562263b31cdf4157
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259106
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Both the production and try builders for the macOS SDK have been
migrated to the new recipe that doesn't use the test matrix.
Bug: b/236109661
Change-Id: I4f578a162c866da6673b228023adb5966f1ca505
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259423
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Jonas Termansen <sortie@google.com>
Changes to experimental inferrer include:
- Subtyping the experimental results classes so that they can be passed around in place of the base results classes.
- Leave out 'abstract_value_domain.dart' and 'abstract_value_strategy.dart'. All references to these in the experimental inferrer refer to the version in the base inferrer. These AbstractValue* types leak out of the inferrer and require more significant changes to duplicate. If necessary we can revisit these down the road.
Change-Id: I91ff44336c0471cb64ad4e0d36d727a38caea2fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259261
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
Make the following changes, based on
8a9b9a8a74:
- Replace `ConstOrLiteralPattern` nomenclature with `ConstantPattern`
(the spec no longer speaks of "literal patterns").
- It is an error if a guard's type is not assignable to `bool`.
- Variable patterns can now be `final`.
- We now have a separate error condition to cover the case where a
variable, list, map, record, or extractor pattern appears in an
irrefutable context and the matched type is not assignable to the
required type of the pattern. (Previously such patterns were simply
called "refutable", leading to a less clear error).
Additionally, we now consistenly use the term "guard" to refer to the
expression after a `when`, consistent with the spec text.
There are a few new TODOs, which I plan to address in follow-up CLs.
Change-Id: Ia0abab9492583f2aa8b59a9b381b90ba11b3e0fc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259246
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This function is used internally to abstract over null safety modes.
Since dart2wasm is always fully null safe, the function is trivial.
Change-Id: I8d636d4ce146a2a848dde736d8563dcb0028f92a
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258928
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
There's no LICENSE file that mentions the Go authors in this repository, but since this code is covered by the CLA we can just move the name to the AUTHORS file and rely on the existing statement that references the Dart LICENSE file.
Change-Id: I3e8e04ef39e7ed6de0134cc33bf8a22e3d33389b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250792
Commit-Queue: Michael Thomsen <mit@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
Avoid removing dynamic invocations in sanitizing code as we don't know what type the element and its attributes may be.
Change-Id: I057d908027befe7fd284bf4ec6c68bd1d0e977f4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259108
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Change-Id: Ifb1bf92c9017a43c626104d115276cc49d883e13
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259241
Commit-Queue: Kevin Moore <kevmoo@google.com>
Auto-Submit: Devon Carew <devoncarew@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
This requires some tweaks to to/from JSON code, and some handling for Maps that previously could be serialised directly but now may contain `Uri`s in keys and need to be converted to strings explicitly (since Uri has no toJson method).
Change-Id: I61358d8198ac1da322fae98d6c40747ad08754b7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258927
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>