Commit Graph

983 Commits

Author SHA1 Message Date
Nicholas Shahan a9f3c66bd8 Revert "[ddc] Verify null safety modes of modules agree"
This reverts commit fda897a423.

Reason for revert: Breaks all the flutter web tests here:
https://ci.chromium.org/ui/p/dart/builders/ci.sandbox/flutter-engine-linux-web_tests/1089/overview

This indicates we still have a misconfiguration in flutter web dev 
builds where artifacts with different null safety modes are being 
mixed.

Original change's description:
> [ddc] Verify null safety modes of modules agree
>
> Checks that the null safety mode of every module loaded matches the mode
> of the SDK.
>
> Change-Id: I50543d10fbea22a61bd7f12d51d6e9c8f8286890
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173120
> Commit-Queue: Nicholas Shahan <nshahan@google.com>
> Reviewed-by: Mark Zhou <markzipan@google.com>

TBR=sigmund@google.com,nshahan@google.com,markzipan@google.com

Change-Id: I0d09efde53f268b353cb842286b11bb3f375e754
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173440
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2020-11-21 17:42:25 +00:00
Nicholas Shahan fda897a423 [ddc] Verify null safety modes of modules agree
Checks that the null safety mode of every module loaded matches the mode
of the SDK.

Change-Id: I50543d10fbea22a61bd7f12d51d6e9c8f8286890
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173120
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
2020-11-21 00:51:14 +00:00
Anna Gringauze c6c4661567 Enable fixed expression compilation tests, add more loop tests.
Tests are no longer failing since
https://github.com/dart-lang/sdk/issues/44235 is now fixed.

Change-Id: I2654233e4c62426e363eab518fdb5b041bc22724
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173160
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Anna Gringauze <annagrin@google.com>
2020-11-20 21:47:23 +00:00
Anna Gringauze 57cbfa73ed Add tests for expression compilation with sound null safety
Change-Id: I895b769ce203c2aed0cfcce9f1fca70f42dbb97c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172689
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Anna Gringauze <annagrin@google.com>
2020-11-19 01:24:41 +00:00
Johnni Winther 887ab360e5 Revert "[kernel] Ensure that visitors don't implicitly returns null"
This reverts commit 4a3f121341.

The changes broke flutter/engine

TEST=It's a revert!

Change-Id: I1e65e6cfab03795a21a64a96fe3ed72e6ba8ecd9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172760
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2020-11-18 14:51:30 +00:00
Johnni Winther 4a3f121341 [kernel] Ensure that visitors don't implicitly returns null
This is in preparation to migrate package:kernel to null safety.
For the visitor interfaces to support non-nullable return types, the
implementations must avoid using `null` as return value in its base case.

TEST=Refactoring

Change-Id: I9f9b318982148d844be9826a5f8c88374a9fc402
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172180
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2020-11-18 11:54:30 +00:00
Anna Gringauze 9c54996510 Fix issues in expression evaluation in google3
- Define private symbols load without reloading the module
  and knowing module format
- Remove libraryName->moduleName map from ExpressionCompiler's
  compileExpressionToJs API as a result of above
- Make ddc tolerate null locations on kernel loaded from dill
  during assert insertions for nullability
- Disable asserts in expression compilation worker
  due to ddc reading source for assert statement compilation
- Remove unused test configuration for expression compiler worker
- Add and update expression compiler tests

Part of: https://github.com/dart-lang/webdev/issues/1174

Change-Id: Idf8f508308915a5487fa0e9810b5674140393fed
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170028
Commit-Queue: Anna Gringauze <annagrin@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2020-11-14 01:34:16 +00:00
Dmitry Stefantsov d54e2bb568 [cfe,ddc,dart2js,vm] Add NullType
This CL is the sum of the following 5 CLs:
* https://dart-review.googlesource.com/c/sdk/+/170342/
* https://dart-review.googlesource.com/c/sdk/+/170344/
* https://dart-review.googlesource.com/c/sdk/+/170345/
* https://dart-review.googlesource.com/c/sdk/+/170346/
* https://dart-review.googlesource.com/c/sdk/+/170347/

The reason for landing the 5 CLs as one CL is to prevent potential
troubles with bisecting over the branch because the change is fully
functional only with all 5 CLs.

Closes #40122.

TEST=Verified by changes in .expect files in pkg/vm/.
Bug: https://github.com/dart-lang/sdk/issues/40122
Change-Id: Ib8197802fdc69694387ae47ac990c58b3aaab7a5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170689
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-11-06 12:43:52 +00:00
Anna Gringauze 42dc617ee8 Emit constants during expression compilation to js
Closes: https://github.com/dart-lang/sdk/issues/43963
Change-Id: Ic8af046b2cf1506984b84ea66b2676b3cc0f1771
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169580
Commit-Queue: Anna Gringauze <annagrin@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2020-11-02 20:03:14 +00:00
Nicholas Shahan 2615e865e2 [ddc] Opt code in expression compiler test
Avoids breaks that appear when enabling the `nnbd` experiment
by default as seen in:
https://dart-review.googlesource.com/c/sdk/+/166790

Change-Id: I052853c42b772af9180d109f231215c00a5a8202
Fixes: https://github.com/dart-lang/sdk/issues/43843
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168742
Reviewed-by: Anna Gringauze <annagrin@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2020-10-23 17:49:22 +00:00
Johnni Winther b42f954364 [cfe] Use experiment release version when non-nullable is enabled explicitly
Even when non-nullable is enabled by default, enabling the experiment
explicitly should result in the experiment release version (and not
the experiment enabled version) to be used for opting in.

For this change, the semantics of parseExperimentalFlags was change
to _not_ normalize the flags to a full mapping including default values.
For this reason all uses of such maps are renamed to
'explicitExperimentalFlags'.

Closes #43879

Change-Id: I0d0262e68ec1403549abcfd305ae3a4404fe93e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168654
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-10-22 06:17:39 +00:00
Nicholas Shahan f990e70930 [ddc] Opt code in nullable inference test
Avoids breaks that appear when enabling the `nnbd` experiment
by default as seen in:
https://dart-review.googlesource.com/c/sdk/+/166790

Change-Id: Idaf69b40c27336c8601cb143741f79604d2647e7
Fixes: https://github.com/dart-lang/sdk/issues/43843
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168583
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2020-10-20 21:38:51 +00:00
Anna Gringauze f04bc85e4f Refined scope calculation in expression compiler
- make sure nested blocks scopes are visited
- make sure variable definitions do not leak beyond block scopes
- properly collect scopes for loops, if statements, constructors
- add calculation of fileEndOffsets for blocks
- save block file offsets to dill
  - update binary format version
  - change kernel readers and writers to read and write block offsets
  - change vm readers to read and block offsets for new version
- add missing fileOffsets and fileEndOffsets on functions for
  late fields
- add missing fileOffsets and fileEndOffsets on functions for
  extensions
- add errors on failures to find scope
- find libraries for private fields correctly
- add more expression compilation tests
- add test to verify fileOffsets and fileEndOffsets are set for
  SDK summary (will add full dill tests later)

Closes: https://github.com/dart-lang/sdk/issues/40278
Related: https://github.com/dart-lang/sdk/issues/34942

Change-Id: I5bc1bb645543045b689d8d61069ee77dc4ee9025
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167541
Commit-Queue: Anna Gringauze <annagrin@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-10-20 01:44:52 +00:00
Nicholas Shahan f3962367a5 [ddc] Add language version to test files
Avoids breaks that appear when enabling the `nnbd` experiment
by default as seen in:
https://dart-review.googlesource.com/c/sdk/+/166790

Some of these synthetic files are created as packages but the
expression compiler wasn't designed to handle that information.
In the future we should support language versioning better in the
expression compiler or setup similar tests for opted in code since
in reality the language versioning might be handled by the dev
build system.

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

Change-Id: Icfac40d1c9b47e75fb92d7672700e066ac372267
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168441
Reviewed-by: Anna Gringauze <annagrin@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2020-10-20 00:48:08 +00:00
Anna Gringauze a8c727a61a Use types of parameters for expression compilation
- use parameter types passed to IncrementalCompiler.compileExpression
  for compilation of the synthetic function containing the expression
- updated expression compiler tests

Note: some expressions that previously compiled wouldn't now
Example:

** package:test/library.dart **

class TestLibraryClass {
  final int field;
  final int _field;
  TestLibraryClass(this.field, this._field);
}

** main.dart **

import 'package:test/library.dart';

void main() {
  var instance = TestLibraryClass(1, 2);
  print('$instance'); // Breakpoint here
}

Expression:

`instance._field`

Previously, the incremental compiler would compile the expression
to kernel due to the type of instance being Dynamic. That compilation
result made it impossible for dartdevc to generate correct code due
 to missing type information.

Now, the compilation will fail with "Getter isn't defined"
error. To properly evaluate private fields now, we would need
the CFE to support a special mode for expression compilation
where private fields from other libraries are allowed.

Closes: https://github.com/dart-lang/sdk/issues/43469
Change-Id: Id8015c5e334115a82049fb2d1725db54dd3ea3dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166925
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Anna Gringauze <annagrin@google.com>
2020-10-13 01:44:02 +00:00
Leaf Petersen e85bf740ef Opt pkg/dev_compiler out of null safety.
Change-Id: I62207a436605480b6981b8b00bf7b88d8589db0f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166980
Commit-Queue: Leaf Petersen <leafp@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2020-10-12 23:25:42 +00:00
Anna Gringauze 1c8020cfc7 Emit module and add logging with timer to expression compilation
- Emit module before expression compilation to JavaScript so the
  ProgramCompiler has all types available.

- Add logging with ticker to expression compilation in expression
  compilation worker in DDC and in frontend server.

- Remove excessively verbose logging

Related:
https://github.com/dart-lang/webdev/issues/1006
https://github.com/dart-lang/webdev/issues/1106
Change-Id: Ia3a985f2d12d27f0bcc2c5d3923db137070e9cdd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162624
Commit-Queue: Anna Gringauze <annagrin@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2020-09-22 02:17:12 +00:00
Anna Gringauze 0567798ea5 fix expression_compiler_worker_test failure on windows
Closes: https://github.com/dart-lang/sdk/issues/43324
Change-Id: I73c861e8b665d023ac5c820fc88eb75d62edb179
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162106
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Anna Gringauze <annagrin@google.com>
2020-09-09 16:22:29 +00:00
Anna Gringauze 34052bf2bb Add expression evaluation to ddc for google3
- Move expression evaluation to ddc in preparation for google3
- Added server to ddc to handle update and compileExpression requests
- Added tests
- Added 'experimental-output-compiled-kernel' option to ddc to generate
  full kernel files only for compiled libraries, and store with
  '.full.dill' extension
- Added AssetFileSystem to communicate to the asset server in the
  debugger
- Made expression_compiler_worker work with full kernel files,
  so removed invalidation of current file to improve performance
- Made expression_compiler_worker reuse already loaded imports
  to avoid reading them from source in the incremental compiler
- Updated tests to work with DDC (for simulating webdev)
- Disabled tests that work with bazel kernel worker for now
  as it does not generate full dill files yet
- Addressed code review comments from the prototype version:
  https://dart-review.googlesource.com/c/sdk/+/157005

Details:

Currently, in flutter tools, expression evaluation is supported via
expression compilation, which is done by the incremental compiler in
the frontend server. The same incremental compiler is used for initial
application compilation, incremental code compilation for hot reload,
and any number of expression compilation requests.

In google3, the apps are typically too large to be compiled as a whole
in memory by the frontend server. Build in google3 is currently done by
blaze, as a distributed build using a task dependency graph. Build tasks
output kernel outline files as an interface between components produced
by individual tasks.

We are proposing an implementation of the expression compilation in
google3 that is taking advantage of full kernel files produced by the
build (supporting build changes to follow). This change introduces a
small server based on dev_compiler, which can handle following requests:

- update: load full kernel for given modules (done on app start)
- compileExpression: compile expression in a given library and module
  (done when paused on a breakpoint)

Expression compilation uses previously loaded kernel files for the
application component and its dependencies to compile an expression.


Change-Id: Icf73868069faf3a2eb6d43ba78e459f8457e9e35
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160944
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Gary Roumanis <grouma@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Anna Gringauze <annagrin@google.com>
2020-09-03 03:05:13 +00:00
Nicholas Shahan 7478143e5f [ddc] Inline the sound null safety flag
Now that the sound null safety mode is a compile time flag
instead of a runtime flag there is no need to set the value in
the bootstrapping code before running main(). The sound and weak
versions of the sdk now have it already set.

Add compileTimeFlag() method that will inline the constant value
directly into the generated output.

Change-Id: I5b9243c47cffc421067ac820ef49342b9d0efff9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154100
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2020-07-13 22:45:19 +00:00
Jacob MacDonald d9d4e5ccb3 copy package config changes to the modular_suite_nnbd.dart
Change-Id: Ib2c645c0d94adb60693be85b266d23b811982e70
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153364
Auto-Submit: Jake Macdonald <jakemac@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-07-06 20:53:11 +00:00
Jacob MacDonald f42889fbb8 create package_config.json files in ddc modular test suite
Copies the same changes as were added for dart2js here https://dart-review.googlesource.com/c/sdk/+/152361/9/pkg/compiler/tool/modular_test_suite.dart

Change-Id: I785b275c62c3d3afb9f37c0b0c8c4e4369b4ccf3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153362
Auto-Submit: Jake Macdonald <jakemac@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-07-06 19:33:11 +00:00
Anna Gringauze c909e16ee2 Added module information to metadata and use by frontend_sever
- created class representing module metadata, added metadata to JsCode
  class
- added module information to metadata, such as module name, load
  function name
- added import and file uris for libraries
- added experimental-emit-debug-metadata flag to frontend_server
- added frontend server tests to check for saved metadata

Related: https://github.com/dart-lang/sdk/issues/41852
Closes: https://github.com/dart-lang/sdk/issues/40774
Change-Id: Iecbbf1e4eea1919e01f002f45363d30707cb1590
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150181
Commit-Queue: Anna Gringauze <annagrin@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Gary Roumanis <grouma@google.com>
2020-06-20 00:40:35 +00:00
Leaf Petersen d44457f79d [Core Libraries] Eliminate the fork in the core libraries.
Move the nnbd core libraries from sdk_nnbd to sdk, and updates
references in build files and elsewhere accordingly.

Change-Id: I09760fe1e006657aacdfe80f3b22fdf6f7e30a9f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151121
Commit-Queue: Leaf Petersen <leafp@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2020-06-16 23:37:36 +00:00
Johnni Winther 7fce125300 [cfe,kernel] Add AstPrinter
This CL adds a Node.toText method together with an AstPrinter. These
facility and better toString implementation on AST nodes while allowing
for toString independent printing of AST to use in testing. This also
add support for an integrated toString of custom/internal nodes.

Some work is still needed in bringing the toString implementation on
all nodes to the old quality, and not all internal nodes have
customized textual representations yet. This work is left for future
CLs.

Change-Id: Ib0bf8a0bc02f489dfacdc8aa5f96da9c52f26058
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150923
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2020-06-16 17:15:10 +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
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
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
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
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
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
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
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
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
Jens Johansen 81d4ac07d4 [CFE] Use package config v2
Change-Id: I32da9e8b2c1040db1521af4345f8e952c22bd30d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130864
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-02-12 10:07:25 +00:00
Nicholas Shahan 3ca719b44c [dartdevc] Enforce omit_local_variable_types lint
Change-Id: I50d9c073ec337d5f05203b30abf289877fdeb08f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134082
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2020-02-03 23:41:17 +00:00
Nicholas Shahan 2d5265f59d [dartdevc] Apply always_declare_return_types lint and cleanup violations
In most cases I provided the type that appeared in the return
statements. For a few test files I explicitly typed the return types as
dynamic because it caused diffs in the expected break point locations
when adding more explicit types and it wasn't totally clear what the
new locations should be.

Change-Id: Ifdd80edcccc5fc4a2083ecdbb0e5fbf1c4453e01
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133339
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2020-01-29 07:17:22 +00:00
Nate Bosch 2d82fb42ce Enforce and fix lint prefer_single_quotes
Change-Id: I7e7b18d90ae8518c700607ec383c73a0eda5a299
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130726
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Auto-Submit: Nate Bosch <nbosch@google.com>
2020-01-08 22:07:21 +00:00
Nate Bosch 4be46419fa Add types to uninitialized variables in DDC
Enable and fix lint prefer_typing_uninitialied_variables

Change-Id: Ibb739b21ac8654feef01ecc2aa1c646882b0b749
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130140
Commit-Queue: Nate Bosch <nbosch@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2020-01-06 23:45:51 +00:00
Johnni Winther 818ec6db92 [cfe] Implement nnbd-top-merge
+ and use nnbd-top-merge and legacy erasure in hierarchy computation

Change-Id: I4bf06ce8d3c68a9926865ebf84b24b4029828d73
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128065
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2019-12-13 17:19:59 +00:00
Nicholas Shahan c561a9eacc [dartdevc] Delete the legacy version of DDC
Change-Id: I2dc3999b0b7e93252402422d662fb5da4dcca3f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127840
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
2019-12-12 21:53:08 +00:00
Nicholas Shahan 2015c55277 [dartdevc] Remove ability to run analyzer based DDC
This is the first step in deleting legacy DDC!
* Default all invocations of DDC to run the kernel version.
* Disable all tests that run analyzer DDC.
* Detect the most likely case when invoked with an analyzer
  summary and print instruction to update build_web_compilers
  dependency.

I will follow up with deletions, and a rename of the test configurations/
builders to reclaim the names (ddc vs ddk, dartdevc vs dartdevk).

Issue #38777

Change-Id: I1477f0274b6b7f345a5e19d2b3f93797c454a09e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127067
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-12-09 22:11:22 +00:00
William Hesse 304eb2cb7b [test] Remove extra / in dartdevc nndb test suite runner.
Change-Id: I0f04cb2414b726005a60b4a2263be1bacd5ddb1f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127643
Reviewed-by: Alexander Thomas <athom@google.com>
2019-12-09 17:20:26 +00:00
Nicholas Shahan 88e26cd5d9 [dartdevc] Fix DDK sourcemap tests to use the right version of the SDK
Change-Id: I1fbed66efd51f02f0faa3b489013a398f8edcd1f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127260
Auto-Submit: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2019-12-05 15:43:29 +00:00
Sigmund Cherem 42ec44a6a4 Reland "Revamp patch_sdk.dart mainly to use libraries.json."
This is a reland of 3c9e924073

Original change's description:
> Revamp patch_sdk.dart mainly to use libraries.json.
> 
> This will make it possible to use the script to create a patched sdk
> for dart2js and the vm (some followup needed), which will be useful
> to migrate their libraries to nnbd.
> 
> In the future, we should be able to leverage this new logic to
> write tests that ensure our sdk is warning-free (there are > 80 real
> warnings today even on the non-nnbd sdk)
> 
> In detail, this CL includes:
> 
> * loading the libraries data from libraries.json, this removes the need for a
>    hand-crafted libraries.dart that replicates the data in libraries.json.
> 
> * auto-generates a libraries.dart in the patched sdk that can be used to run
>  dartanalyzer or to compile an sdk with dartdevc-legacy.
> 
> * script simplifications in patch_sdk.dart
>     * removed tracking of modification stamps. This didn't appeared to be
>       used by the ninja rules. I believe it was used to reduce local
>       iteration cycles when we were first developing the sdk itself.
> 
>     * use Uri directly instead of package:path - this simplifies things,
>       especially since the libraries_specification is Uri-based as well.
> 
>     * switch to use package:args for parsing options
> 
>  * added an option to merge part files in a single file. I've noticed that the
>  analyzer provides some false positive errors in part files, but once merged
>  they are no longer shown. In particular, we are clearly hitting limitations of
>  dartanalyzer on the patched sdk. At this time the old patch-script generated
>  an sdk with 1500 warnings, this new script reduces it to 500 (not sure why),
>  with merging of part files it goes down to 80.
> 
> 
> Change-Id: I6bbaf92ef4554f00c8bf6b38d19bf79d44fb3e94
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125780
> Reviewed-by: Nicholas Shahan <nshahan@google.com>
> Commit-Queue: Sigmund Cherem <sigmund@google.com>

Change-Id: Ifcb9dbef36452e41e8e96e086761d76b5a3d988e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125998
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Auto-Submit: Sigmund Cherem <sigmund@google.com>
2019-11-26 01:40:53 +00:00