Commit Graph

2611 Commits

Author SHA1 Message Date
Nicholas Shahan ee54a343ba [ddc] Fix type parameters in tear offs
Add missing nullability on type parameters in function types of
tear offs.

Change-Id: If56ab42db57d14d0939a03518d5b944548e4065d
Fixes: https://github.com/dart-lang/sdk/issues/42246
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150680
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2020-06-10 23:49:43 +00:00
Harry Terkelsen 54fe29e965 support @JS annotation from SDK
Attempt at fixing https://github.com/dart-lang/sdk/issues/39740 to allow the flutter web engine to use @JS
interop to avoid the overhead of the SDK available js interop.

Bug: 39740
Change-Id: I7ba9c8981e639cd267bee3086ba900b89bfc0d6f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150501
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Harry Terkelsen <het@google.com>
2020-06-09 17:10:15 +00:00
Nicholas Shahan 092789f1ac [ddc] Fix legacy type in covariance bounds check
There should be no way this could cause an unexpected failure
or break soundness but there is no reason to be marking the type
parameter as a legacy type in the check.

Change-Id: Ib4cf22cacd78d6cb9b55dd6ed594c75aa81ceead
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149887
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2020-06-04 21:18:39 +00:00
Nicholas Shahan 2ed302bfbb [ddc] Update ddb script to use SDK js from gen dir
When running ddb with `--debug` pull the SDK .dill and .js files from
ReleaseX64/gen/utils/dartdevc and require.js from third_party/require.

Change-Id: Ibcfd5e1d32c39cca3583cfef14fe8393e0846d69
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149886
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2020-06-04 21:10:39 +00:00
Johnni Winther a936f3019e [cfe] Embed and use allowed experiments in CFE
This CL embeds the sdk_nnbd/lib/_internal/allowed_experiments.json
into the CFE and uses this to allow experiments enabled on a
per library basis. The file is embedded through generated code to
avoid reliance on access to the file itself.

A presubmit check is also added to ensure that the json file and
the generated code are in sync.

This work is in preparation for https://github.com/dart-lang/sdk/issues/41538


Change-Id: Ic03c0fc69684d124c685f2fe6e80423a7e751530
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149064
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2020-05-30 09:47:02 +00:00
Nicholas Shahan 72e559929f [ddc] Add --sound-null-safety flag and pass to CFE
https://dart-review.googlesource.com/c/sdk/+/149080 is required to
get errors if you try use weak .dill files when passing the
--sound-null-safety flag.

Added a new build target to copy the sound SDK outline .dill to
dart-sdk/lib/_internal. This is only part of dartdevc_test right
now. We will decide in the future if we are going to include this
in the released SDK or if we will have the build systems create
them as needed. For now in testing scenarios it appears to be part
of the SDK.

Change-Id: I3b31a894841f59b437658104e7ee9443ee67db93
Fixes: https://github.com/dart-lang/sdk/issues/41694
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146962
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-05-29 01:16:18 +00:00
Nicholas Shahan d76b5318b4 [ddc] Make amd modules a named function
Apply the same naming used in the ddc module format to amd modules.

Change-Id: Ib766c20cb35c3c6e11a345e45cba5c49f3a34b3b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148941
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Anna Gringauze <annagrin@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2020-05-27 20:44:07 +00:00
Ben Konyi c4b7097e97 [ VM ] Migrate VM tests to support null safety and return errors from Dart_GetType and Dart_NewListOf when --null-safety is enabled
These methods return legacy types, which aren't valid with null safety
enabled.

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

Change-Id: I1181f0f3b9a8df156dea4dc4c82fef8afdf97ab9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148685
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-05-26 22:40:52 +00:00
Jens Johansen 4dcf24ac7f [CFE] Use BlockExpression for encoding cascades
Change-Id: I9c56cbed9880716af804c80c6ca34578ae6765a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148528
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigurd Meldgaard <sigurdm@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-05-26 09:07:25 +00:00
Konstantin Shcheglov 2231b8c580 Use AllowedExperiments in analyzer.
Bug: https://github.com/dart-lang/sdk/issues/41741
Change-Id: Iba0face7198f4ecc17c86d2fcb0630912db7ba60
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148648
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-05-20 20:42:31 +00:00
Anna Gringauze 0218c66698 Emit types during incremental expression compilation
During expression compilation, if the compiled expression is using
a type that was not used in the current function, the incremental
compiler and DDC produce code that refers to undefined types.
To fix that, discharge types created during expression compilation
and add their definitions at the beginning of the generated
function.

Added tests to validate the behavior.

Fixes: https://github.com/dart-lang/sdk/issues/41443
Change-Id: If3fdce85a50ab2590d107f3b9e8c19b4768fd482
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148468
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Anna Gringauze <annagrin@google.com>
2020-05-20 18:51:20 +00:00
Nicholas Shahan ab0d67d8db [ddc] Add flag to suppress null safety warnings
Default setting will hide the warnings.

Allow infra to decide if warnings in the browser console will be
shown for null safety errors in weak mode.

Always show warnings when running with weak null safety with our
ddb script and the SDK test_runner.

Change-Id: I7c800b087069390ff374cbc4111334c2df947d86
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148238
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2020-05-18 21:41:06 +00:00
Johnni Winther c10b41a4e2 [kernel] Add DartType.toTypeText and Constant.toConstantText
These are used to provide a testable textual representation
of types and constants that do not rely upon Node.toString.

Change-Id: Iff77ebb44e8299b262f4f263666b2e1d4dd5794b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147909
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2020-05-18 11:48:20 +00:00
Jens Johansen 7929b4223e [CFE] Fix memory leak via WidgetCreatorTracker
Change-Id: Iebb961955bcd6cf2513cdec6036dfbd126e45231
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148240
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-05-15 14:09:02 +00:00
Dmitry Stefantsov e53e5f2475 [cfe] Separate nullability and declared nullability
For some types it makes sense to distinguish between nullability as a
property of including null and the declared nullability, such as for
type-parameter types and FutureOr types.  This CL introduces the
separation between the two concepts.  The plan is to use that when
implementing FutureOrType.

Bug: https://github.com/dart-lang/sdk/issues/40123
Change-Id: I90b45bea768e89c213d021d360a481d38377c682
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147903
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2020-05-15 07:38:05 +00:00
Nicholas Shahan a83cbcc94c [ddc] Cleanup "ReleaseX64NNBD" from ddb script
That platform out directory isn't use now that we have unforked.

Change-Id: I8baba2ab25ae4f0d38b2b58ab06d52b90288d280
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148009
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
2020-05-13 22:57:33 +00:00
Nicholas Shahan 40c1f17434 [ddc] Fix null check in equality operator
Move null check up so it can return before performing the cast in the
case of a covariant parameter.

Change-Id: I727822751e6613fac635fa49b254b9406eb93e1c
Fixes: https://github.com/dart-lang/sdk/issues/41866
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147812
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-05-13 21:13:27 +00:00
Nicholas Shahan f916fa6b4e [ddc] Output a metadata file for debugger
Currently hidden behind a flag marked experimental. We need to
define a clear API or process to introduce breaking changes before
we start landing dependencies in packages outside the SDK.

Change-Id: I27ed48c78fc3bad46be92c21c35ae91f4c036784
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144243
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Gary Roumanis <grouma@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2020-05-12 19:36:21 +00:00
asiva 03ce33f80c [BUILD] - Initial CL to unfork the NNBD Dart SDK
- Flips the flag from --nnbd to --no-nnbd so that by default it builds
  the NNBD version
- using the --no-nnbd flag results in the SDK being built in a
  directory which has the 'Legacy' suffix added to it
  (e.g: out/DebugX64Legacy)
- the '--enable-experiment=non-nullable' flag still needs to be passed
  in during execution so that CFE runs in that mode. This is different
  from the 'null_safety' flag

Change-Id: I729630a7bd36ea7ae38134f9285b44e93c283c68
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138902
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2020-05-07 21:12:47 +00:00
Leaf Petersen 3437336ed0 Make dynamic catch clauses explicit.
Make the NNBD sdk libraries compatible with the change making the
default type of the error variable in a catch clause Object.

Change-Id: Ic0419980b067fdb1702c0ac9ca2cbc73b27d41b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146521
Auto-Submit: Leaf Petersen <leafp@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2020-05-06 15:48:34 +00:00
Johnni Winther a2015351c8 [dart2js,ddc] Ensure valid d8 breakpoints in testing
D8 breakpoints used in sourcemap testing should only be set for
test files and not, accidentally, in sdk source files. This
was hit in a dart2js step debugging test where, after unforking,
the line number in the test file accidentally matched those of
print.dart from the sdk.

Change-Id: I6a9c6f5bfd28b8821e9cee9b10cc6c67e4fc689b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146781
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-05-06 14:36:32 +00:00
Nicholas Shahan 525e02fa5e [ddc] Use Null Safety flag in typeAcceptsNull
- Expose the internal runtime flag for the Null Safety mode.
- Add a guard to protect against accidental configurations
  that set the mode multiple times.

Change-Id: I8d16a3c7bd8590ea6f2fee9b6f8c09009898a64b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144991
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2020-04-28 21:56:48 +00:00
Siva Annamalai 726d3c7725 Revert "[BUILD] - Initial CL to unfork the NNBD Dart SDK"
This reverts commit cab69e7706.

Reason for revert: It was a temporary submit

Original change's description:
> [BUILD] - Initial CL to unfork the NNBD Dart SDK
> NOTE: This is a trial submit and will be reverted immediately.
> 
> - Flips the flag from --nnbd to --no-nnbd so that by default it builds
>   the NNBD version
> - using the --no-nnbd flag results in the SDK being built in a
>   directory which has the 'Legacy' suffix added to it
>   (e.g: out/DebugX64Legacy)
> - the '--enable-experiment=non-nullable' flag still needs to be passed
>   in during execution so that CFE runs in that mode. This is different
>   from the 'null_safety' flag
> 
> Change-Id: I7d25d9710818af5919c0bb83abe51153172f5886
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144880
> Reviewed-by: Siva Annamalai <asiva@google.com>

TBR=asiva@google.com

Change-Id: Ib0f99fc1a42c9c7a8b21f8542f4a35dba9105d5c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144900
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2020-04-27 05:00:10 +00:00
asiva cab69e7706 [BUILD] - Initial CL to unfork the NNBD Dart SDK
NOTE: This is a trial submit and will be reverted immediately.

- Flips the flag from --nnbd to --no-nnbd so that by default it builds
  the NNBD version
- using the --no-nnbd flag results in the SDK being built in a
  directory which has the 'Legacy' suffix added to it
  (e.g: out/DebugX64Legacy)
- the '--enable-experiment=non-nullable' flag still needs to be passed
  in during execution so that CFE runs in that mode. This is different
  from the 'null_safety' flag

Change-Id: I7d25d9710818af5919c0bb83abe51153172f5886
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144880
Reviewed-by: Siva Annamalai <asiva@google.com>
2020-04-27 04:59:26 +00:00
Johnni Winther 6c21ed6314 [cfe] Support class hierarchy changes in ChangedStructureNotifier
Closes #40707

Change-Id: I0a9e0b11d0f597dfed7182dd869382057d04e5dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144821
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-04-26 19:51:29 +00:00
Nicholas Shahan 23cbe39355 [ddc] Remove error handler from number parse helpers
This copies the logic from dart2js and brings the two patches closer
together. There is no need to pass the error handler to the helper
function shared between `parse()` and `tryParse()`.

Update JS foreign function types in parseDouble to match the NNBD
version.

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

Change-Id: I85d39f8ba6bd76459cf6263099983b8b96d3a669
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144304
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2020-04-22 16:07:29 +00:00
Siva Annamalai 63a92a3b00 Revert "This is a trial submit of the unfork CL, it will be reverted immediately."
This reverts commit 393468dc89.

Reason for revert: This was a trial submit and so reverting it.

Original change's description:
> This is a trial submit of the unfork CL, it will be reverted immediately.
> This commit is being done so we can roll it into Flutter and run some device lab testing to see the effect this CL will have on Flutter.
> 
> [BUILD] - Initial CL to unfork the NNBD Dart SDK
> 
> - Flips the flag from --nnbd to --no-nnbd so that by default it builds
>   the NNBD version
> - using the --no-nnbd flag results in the SDK being built in a
>   directory which has the 'Legacy' suffix added to it
>   (e.g: out/DebugX64Legacy)
> - the '--enable-experiment=non-nullable' flag still needs to be passed
>   in during execution so that CFE runs in that mode. This is different
>   from the 'null_safety' flag
> 
> Change-Id: I83c813aee2a5b61ad876d8a7b0988705bb24c839
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144082
> Reviewed-by: Siva Annamalai <asiva@google.com>

TBR=asiva@google.com,liama@google.com

Change-Id: I7b50fae71764eceb17893338d1981e40ea2de520
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144083
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2020-04-20 03:50:49 +00:00
asiva 393468dc89 This is a trial submit of the unfork CL, it will be reverted immediately.
This commit is being done so we can roll it into Flutter and run some device lab testing to see the effect this CL will have on Flutter.

[BUILD] - Initial CL to unfork the NNBD Dart SDK

- Flips the flag from --nnbd to --no-nnbd so that by default it builds
  the NNBD version
- using the --no-nnbd flag results in the SDK being built in a
  directory which has the 'Legacy' suffix added to it
  (e.g: out/DebugX64Legacy)
- the '--enable-experiment=non-nullable' flag still needs to be passed
  in during execution so that CFE runs in that mode. This is different
  from the 'null_safety' flag

Change-Id: I83c813aee2a5b61ad876d8a7b0988705bb24c839
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144082
Reviewed-by: Siva Annamalai <asiva@google.com>
2020-04-20 03:46:06 +00:00
Konstantin Shcheglov cf70a46f8e Change the default type of the exception to 'Object' instead of 'dynamic'.
Bug: https://github.com/dart-lang/sdk/issues/41521
Change-Id: I4410bb5b968899b6368eed304e1dfb84f4451554
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143980
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-04-18 01:33:17 +00:00
Nicholas Shahan 9ae942b083 [ddc] Use dynamic as default for top type bounds
For the cases of implicit bounds like `<T>` the default value
should be `dynamic` when instantiating and no type parameter is
provided. This change fixes this cases.

For explicit bounds like `<T extends Object?>` or
`<T extends Object*>` the default values should be `Object?` or
`Object*`. This change breaks these cases by defaulting to
`dynamic`.

Filed: https://github.com/dart-lang/sdk/issues/41539

I believe this is the correct trade off right now because the
implicit bounds like `<T>` are more likely to appear compared to
`<T extends Object?>` or `<T extends Object*>`.

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

Change-Id: I53a22cf9de2d200f628f3ac0f6b0a6b1ab9ba3fb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143442
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2020-04-17 17:51:58 +00:00
Stephen Adams 74e28e7703 Avoid 'late' for timer
Change-Id: I7cf9ef01437cc30a41bd8d0d73e6c10c07296bc4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143441
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-04-15 06:32:19 +00:00
Nicholas Shahan 1ce773c67f [ddc] Hoist all legacy and nullable types
As a possible performance improvement types are hoisted to top
level variables where they can be used from anywhere in
the program.

Change-Id: I93cee0b6e582e9218dae5b15b2b8816e7c64153b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142905
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
2020-04-10 17:50:45 +00:00
Nicholas Shahan 8a6d0b57ea [ddc] Unfork DDC dart:_runtime library
Treats the SDK and all application code as a legacy library when
running without enabling the null safety experiment.

- Copy all changes from the SDK fork and applies them to the existing
  SDK (except the null safety syntax used in the library itself.
- Start emitting legacy types.
- Add a work around to avoid ever creating legacy or nullable versions
  of types in the dart:_runtime library or in JS contexts. This should
  be safely removed once the SDK is opted in to null safety.

Fixes: #40266

Change-Id: I6a029b676c3e35980a6bab876a348c35590df92d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142904
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-04-10 17:50:45 +00:00
Sam Rawlins 2c420267b7 analyzer: Do not allow errors to be ignored inline. Fixes #27218
Change-Id: If37dabba3ec18a9f79f44c4ea38d6920a4013019
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140142
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2020-04-10 17:16:24 +00:00
Konstantin Shcheglov 450ae848f6 Applying a mixin replaces corresponding names in the interface.
Change-Id: I5e2ada71af50aa580f5d236773ccb122fca5591c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143060
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-04-10 15:57:44 +00:00
Nicholas Shahan aa47d74666 [ddc] Run modular test suite in weak mode
Preparation to unfork the SDK.

- Added the test suite to run in weak mode. Need to assess how we
  want to migrate these tests in the future.
- Updated one test to be legacy/nnbd agnostic.
- Update step names from DDK to DDC.

Change-Id: I0d2f1218c9acad82ab70dd525b0a0ad3cdc2ca92

Issue: https://github.com/dart-lang/sdk/issues/40266
Change-Id: If92e7778984de6a5a049faaf421a069c6f492b36
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142557
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-04-08 18:25:14 +00:00
Nicholas Shahan 8064c1c342 [ddc] Add typeRep<T>() to inline an unwrapped type directly
Also add `legacyTypeRep<T>()` that is similar but performs
a shallow conversion to a legacy type.

Using this in compiler/dartdevc_native/ tests gives a better usability
instead of constantly wrapping and unwrapping types. It allows us to
avoid stripping off the legacy from a type when calling `wrapType()`.

Issue: https://github.com/dart-lang/sdk/issues/40266
Change-Id: I07225f18c253222b31203b0b110233a3e018a7d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142547
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-04-08 00:03:38 +00:00
Jacob MacDonald 4eebe712f5 add --dartdevc-module-format argument to frontend_server
This allows us to start experimenting with the legacy module format in flutter web/internal.

This also updates the DDC module name parsing to throw an ArgumentError on invalid formats, and exposes the parsing method.

Change-Id: I4ce85ecd4078a9827aba046e34425a4f1d1e9abd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142263
Commit-Queue: Jake Macdonald <jakemac@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2020-04-03 16:10:46 +00:00
Nate Bosch 86b178070c Remove a stale TODO comment
The comment references a feature we don't plan to add because dartdevc
is not planned as a production compiler. The linked SDK issue is
unrelated.

Change-Id: I67d5946b7afe562e12fcdb2b45599afb648499b7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141205
Commit-Queue: Nate Bosch <nbosch@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Auto-Submit: Nate Bosch <nbosch@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2020-03-27 01:24:42 +00:00
Nicholas Shahan 289c4d5990 [ddc] Add nullable and legacy markers to JS names
This is only changing the names that appear in the JS source and
should not change the runtime semantics. Prepends "_N_" and "_L_"
to nullable and legacy type names.

Function types get their markers prepended to the word "To". For
example a type `int Function(String)` in a legacy library would
have a name in JS like "_L_String_L_To_L_int".

Change-Id: I26416e2c7396806f0ff9b3d36cd915f49d48d1cf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140366
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-03-25 00:11:21 +00:00
Stephen Adams 099e287f1c Avoid set:length in JSArray.+
Change-Id: Id68c02d050da0e3e6f209979a8a81102f1731a3e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140720
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2020-03-24 23:38:27 +00:00
Johnni Winther 62f84880ef [cfe] Report error on missing return from non-nullable function
Closes #40520
Closes #40948
Closes #40425

Change-Id: I0aa3cfa51b410c90dd0bea963846eeb6b2e73efb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140540
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-03-24 08:21:36 +00:00
Vijay Menon d29e79a595 [dartdevc] record metrics
This reverts commit 056bd5e72f.

Change-Id: I12479342060b276c54a981ce17d96c179c0e4554
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140620
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Vijay Menon <vsm@google.com>
2020-03-23 15:38:37 +00:00
David Morgan 056bd5e72f Reland "Revert "[dartdevc] record metrics""
This reverts commit a0e4f0575a.

Reason for revert: Issues with hot restart in google3, see b/152181536.

Original change's description:
> Revert "Revert "[dartdevc] record metrics""
> 
> Reland with fixes for internal build (patch set 2+)
> 
> Change-Id: I5b130d020c9437a2c52dd074ad007e1fef7a8fa5
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139241
> Commit-Queue: Vijay Menon <vsm@google.com>
> Reviewed-by: Sigmund Cherem <sigmund@google.com>
> Reviewed-by: Gary Roumanis <grouma@google.com>

TBR=vsm@google.com,sigmund@google.com,grouma@google.com

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

Change-Id: I012e1adaa405e85fd1a3d7d280b889b7df44e5b3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140580
Reviewed-by: David Morgan <davidmorgan@google.com>
Commit-Queue: David Morgan <davidmorgan@google.com>
2020-03-23 12:16:13 +00:00
Jens Johansen feefcf0c94 [kernel/CFE] Simplified toString on (ast) nodes
This is a bare-bones implementation (and test) for having an explicit
toString on all `Node`s.
This can then be extended as-needed to better suit our debugging
purposes. It's not allowed to leak, though.

Change-Id: I8d3f5a9cd13b292ed7a6bf33762e507286f3fa7d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139805
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-03-23 10:25:23 +00:00
Jonas Termansen 0296286c03 [nnbd] Fix remaining analyzer issues in dart:io and dart:_http.
Change-Id: I419b54962fde1a6bd4efd9ea58d81cf29a8bd45a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140103
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Jonas Termansen <sortie@google.com>
2020-03-20 17:11:49 +00:00
Vijay Menon a0e4f0575a Revert "Revert "[dartdevc] record metrics""
Reland with fixes for internal build (patch set 2+)

Change-Id: I5b130d020c9437a2c52dd074ad007e1fef7a8fa5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139241
Commit-Queue: Vijay Menon <vsm@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Gary Roumanis <grouma@google.com>
2020-03-19 13:09:59 +00:00
Nicholas Shahan a5704eaca3 [dartdevc] Throw TypeError instead of CastError
Remove all `_check()` calls as they are now identical to `as()`.

Fixes: #41008
Change-Id: I4e4dd1ff50840d3d1cbf0aae9b8cef0621016079
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139490
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2020-03-18 18:39:26 +00:00
Jonas Termansen 96cf889e6b [dart:io] Fix HeaderValue parsing, toString(), and support null values.
This is a breaking change. https://github.com/dart-lang/sdk/issues/40709

This change makes the HeaderValue parsing more strict in two invalid
edge cases, supports parameters with null values as a feature, and fixes
toString() so it always produces tokens or quoted-strings valid per RFC
7230 3.2.6.

The empty parameter value without double quotes (which is not allowed by
the standards) is now parsed as the empty string rather than null. E.g.
HeaderValue.parse("v;a=").parameters now gives {"a": ""} rather than
{"a": null}.

Invalid inputs with unbalanced double quotes are now rejected. E.g.
HeaderValue.parse('v;a="b').parameters will now throw a HttpException
instead of giving {"a": "b"}.

The HeaderValue.toString() method now supports parameters with null
values by omitting the value. E.g.:

  HeaderValue("v", {"a": null, "b": "c"}).toString()

now gives

  v; a; b=c

This behavior can be used to implement some features in the Accept and
Sec-WebSocket-Extensions headers.

Likewise the empty value and values using characters outside of RFC 7230
3.2.6 tokens are now correctly implemented by double quoting such values
with escape sequences. E.g.:

  HeaderValue("v",
      {"a": "A", "b": "(B)", "c": "", "d": "ø", "e": "\\\""}).toString()

now gives

   v;a=A;b="(B)";c="";d="ø";e="\\\""

The NNBD migration required making subtle changes to some dart:io
semantics in order to provide a better API. This change backports one of
these semantic changes to the unmigrated SDK so any issues can be
discovered now instead of blocking the future SDK unfork.

Change-Id: Iafc790e03b6290232cac71fe14f995ce0f0b036b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136620
Commit-Queue: Jonas Termansen <sortie@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2020-03-18 11:36:36 +00:00
Nicholas Shahan edb2c51dc4 [dartdevc] Cleanup old DDC test suite descriptors
Change-Id: Ic4f295f67bfdad9ac28b0513769e62fd93ca85c8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139720
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2020-03-16 21:55:01 +00:00