Commit graph

65098 commits

Author SHA1 Message Date
Johnni Winther
05b5883813 [cfe] Add documentation to some Generator implementations
Change-Id: I0a57b08da639557376b1b6f666d2d8aa6344f59c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109711
Reviewed-by: Dan Rubel <danrubel@google.com>
2019-07-23 08:02:18 +00:00
Felicitas Hetzelt
c9c0f56f48 [dart/vm] Add 'small string' parameter specifier
Rationale: Forces the fuzzer to generate a string literal
as the parameter of selected string functions (i.e. padLeft/Right)
in order to avoid recursion of the form x = "".padLeft/Right(x).

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

Change-Id: Icd9f5da07ccdd44e81c88a450c3d2cdd7c8e8f95
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109893
Commit-Queue: Felicitas Hetzelt <felih@google.com>
Reviewed-by: Aart Bik <ajcbik@google.com>
2019-07-23 00:19:48 +00:00
Konstantin Shcheglov
eebbed2d7a Make PropertyDescription constructor parameters named.
Also move next property id to PropertyDescription.

R=brianwilkerson@google.com

Change-Id: I96773a1c3e5c46c3111102aab03f8fff92fcd9a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109896
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-07-23 00:05:58 +00:00
Mayank Patke
68ba8f9198 [WATCHLISTS] Don't CC dart2js on tests/compiler/dartdevc_native.
Change-Id: Ibd4c56df154a718717605b322e06d9545d57df01
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109982
Auto-Submit: Mayank Patke <fishythefish@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2019-07-22 23:52:18 +00:00
Stephen Adams
9197c1b021 [dart2js] new-rti: fix TypeEval GVN
Type expression GVN needs to structural equality on TypeRecipe and
TypeEnvironmentStructure.

Change-Id: Iaa4985ec99fff6db29e8bfd63fd0dbacdc10dde6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109942
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2019-07-22 23:32:00 +00:00
Ryan Macnak
60a952e261 [vm] Avoid superlinear time canonicalizing deep constants.
Bug: https://github.com/dart-lang/sdk/issues/37523
Change-Id: Ia3c2514891e2e3f07d1b3266b019b142413918d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109318
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-07-22 22:20:33 +00:00
Alexander Markov
730d2c6c6c [vm/bytecode] Fix removal of empty scopes in local variable info
Even if a scope doesn't have variables, it may define a context
level different from enclosing scope. As debugger needs to know
context level at any point, bytecode generator should not elide
such scopes.

Change-Id: I2f97deae55285b758f91aee852338432dcddf373
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109898
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-07-22 21:54:49 +00:00
Alexander Markov
d3a09dda15 [vm/bytecode] Recognize list factories and set result type for static calls
Sudoku +15.62%

Issue: https://github.com/dart-lang/sdk/issues/36429
Change-Id: I58cde03ffc9788b2eebe889fcc1a98a82698c39a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109887
Reviewed-by: Aart Bik <ajcbik@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-07-22 21:50:34 +00:00
Brian Wilkerson
0864980e8c Resolve the call method when used with an extension override
Change-Id: I2bf310abb3b8c3f4fc5eb9179bd60df4539d241f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109888
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-07-22 21:18:30 +00:00
Brian Wilkerson
17e15ee9a4 Add outline support for extensions
Change-Id: I1b7145e899614b3d73d3fc2bfbe3dd7f773d38d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109880
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-07-22 21:12:40 +00:00
Stephen Adams
41263a4c1a [dart2js] Fix for 37502: double ~/ x returns int
http://dartbug.com/37502 shows the type-propagation results of ~/ is double instead of int.

Bug: 37502
Change-Id: Iec7b8a876a20784c7d2858305eaa67e9d02a63dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109889
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2019-07-22 20:54:10 +00:00
Alexander Markov
211190e7ec [vm/bytecode] Reuse ConstantEvaluator instance in bytecode generator
By reusing ConstantEvaluator instance among members we avoid
recalculating values of constant static fields.

Change-Id: I5c13489a353bf101cd4a01d5993e44842042c2d6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109892
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-07-22 20:43:30 +00:00
Aart Bik
c2af59f1ea [dart/fuzzer] Add flag to control FP operations
Rationale:
Floating-point operations have some potential for
false divergences (mostly when going through libc
methods that are compiled differently between 32-
and 64-bit. To avoid these, a --no-fp flag has
been added to dartfuzz.dart which can be used
to dartfuzz_test.dart to avoid floating-point
operations when comparing 32-/64-bit execution
modes.

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

Change-Id: Ie3c28f2a6e2d257b8e9adbba79d088b3879264ac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109891
Reviewed-by: Felicitas Hetzelt <felih@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
2019-07-22 20:42:30 +00:00
Paul Berry
ee5a90cb1b Flow analysis: test that all variables are registered with add().
This uncovered two more instances where we weren't properly
registering variables:
- Local function parameters
- Variables introduced by "catch" syntax.
- Variables introduced by "for (...; ...; ...)" syntax.

Change-Id: Id5e8aa1b598962cca1bb19df6d4ede99a672f108
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109885
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-07-22 20:27:08 +00:00
Ryan Macnak
477a3c4748 Revert "[ VM / Service ] Pulled in vm_service_drivers from its own repo."
This reverts commit dbeceb1d06.

Reason for revert: Exposes private VM service methods

Original change's description:
> [ VM / Service ] Pulled in vm_service_drivers from its own repo.
> 
> - Updated various paths to point to the sdk repo instead of the
>   vm_service_drivers repo.
> - Updated generate.dart to use the service.md from the SDK, not a copy.
> - Removed hidden files that are no longer needed.
> 
> Change-Id: I11b1f2e32d55f1fdaaa6eb9ce34fc318716c36f9
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109120
> Reviewed-by: Devon Carew <devoncarew@google.com>
> Commit-Queue: Ben Konyi <bkonyi@google.com>

TBR=devoncarew@google.com,bkonyi@google.com,rmacnak@google.com,asiva@google.com

Change-Id: I44af2074ba13dec41ffac3c25330e4603c50b06a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109895
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-07-22 20:26:22 +00:00
Paul Berry
722b505316 NNBD migration: Fix an implicit downcast error.
Change-Id: I2762d60dc739adc046d7c438ae8eadae550bfa97
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109941
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-07-22 20:25:59 +00:00
Dan Rubel
d7cb52b863 capture more info to debug 37528
This updates the exception message to capture more information
about where the exception is occurring. Hopefully that information
can be used to fix https://github.com/dart-lang/sdk/issues/37528

Change-Id: Iaf10395091f8bd8b540dddc59001f23b6dc6a073
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109920
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-07-22 20:18:17 +00:00
Dan Rubel
d6c85f4e92 rename dartfix "exclude" option to "excludeFix"
This renames the "exclude" option to make it more clear exactly
what is being excluded, similar to the earlier change renaming
"include" to "fix".

Change-Id: I07d164d480c8e389e5c7353db81e7633f0efd3d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109921
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-07-22 20:17:57 +00:00
Konstantin Shcheglov
1e04ff86b0 Mutate Aling(...) and Padding(...) into Container().
R=brianwilkerson@google.com

Change-Id: I5d15b93f3262cafe6915c5681c4baede87e7699a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109940
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-07-22 20:09:47 +00:00
Ben Konyi
dbeceb1d06 [ VM / Service ] Pulled in vm_service_drivers from its own repo.
- Updated various paths to point to the sdk repo instead of the
  vm_service_drivers repo.
- Updated generate.dart to use the service.md from the SDK, not a copy.
- Removed hidden files that are no longer needed.

Change-Id: I11b1f2e32d55f1fdaaa6eb9ce34fc318716c36f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109120
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2019-07-22 20:06:29 +00:00
Mayank Patke
76f82bd0ec [dart2js] Split up runtime_types.
This is a first pass at breaking up runtime_types.dart.
runtime_types_resolution.dart contains the former parts of runtime_types
that runtime_types_new depends on (namely, RuntimeTypesNeed and
RuntimeTypesSubstitutions), as well as their transitive dependencies.
This leaves just the code responsible for encoding the old type
representation in runtime_types, mirroring what we have in
runtime_types_new. As a result, both runtime_types and runtime_types_new
have runtime_types_resolution as a common dependency, but
runtime_types_resolution does not depend on a particular encoding.

However, runtime_types_resolution is still over 2.5 KLOC and still
depends on the old TypeCheck representation.

Change-Id: I22d932d2695cb573c2a3b4dafe5132d4e424fa77
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109557
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-07-22 20:00:47 +00:00
Kevin Moore
0352fb2cb7 Fix package dependencies in analyzer_cli, dartfix, nnbd_migration
Change-Id: Ib7f3b3f12d95b59b81164321e7d2176179adc957
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109890
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-07-22 19:55:43 +00:00
Felicitas Hetzelt
3999369c5f [dart/vm] Display test return code on divergence
Rationale:
A divergence can be caused by differences in test
output, timeout or crash. This patch displays the
return code of the test program, so that the latter
two cases can be distinguished.
Change-Id: Id5520a2da41aad191c0878148acfff2c98c110aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109682
Reviewed-by: Aart Bik <ajcbik@google.com>
Commit-Queue: Felicitas Hetzelt <felih@google.com>
2019-07-22 18:18:38 +00:00
Konstantin Shcheglov
d16ad91719 Update DATA_VERSION after summary2 changes to support extensions.
R=brianwilkerson@google.com, paulberry@google.com

Change-Id: I834c400308e9479aacc483fb2e129db180402937
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109886
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-07-22 18:04:28 +00:00
Paul Berry
da58647161 Flow analysis: register loop variables with add().
Change-Id: I321e3ec9b6413028b78bfa36c3022ef70447f745
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109762
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-07-22 17:23:28 +00:00
Konstantin Shcheglov
1390201177 Support for 'padding' property, and EdgeInsets type.
R=brianwilkerson@google.com

Change-Id: I536ee3952d6e280a56b048773a3a5696bc508b07
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109761
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-07-22 17:15:28 +00:00
Devon Carew
91eb2f5fd0 [analyzer] rename the dartfix --include <fix> option to dartfix --fix <fix>
Change-Id: Ibd5d8c45912a292e1a787e88ddb06e730ebda0a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109548
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2019-07-22 16:35:18 +00:00
Zichang Guo
53bda39466 Create stream timeout timer before ondata() opeartions
Originally, Timer for timeout is created after controller.add() where onCancel has been triggered. Timeout events will always be called.

Bug: https://github.com/dart-lang/sdk/issues/37565
Change-Id: I1504694cb746b6653d858effd7c5b33b07de6057
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109725
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Zichang Guo <zichangguo@google.com>
2019-07-22 16:23:58 +00:00
Devon Carew
65d544edea [analyzer] update the analysis server's diagnostic page
Change-Id: I22d58002a3753c7f3e5d5a218ca76a4de7560fce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109884
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2019-07-22 16:11:18 +00:00
Johnni Winther
cddd21dde1 [cfe] Merge ExpressionGenerator into Generator
+ Make more internal properties private
+ Add documentation on more properties/methods

Change-Id: I40779c83fcb7f888e485ccbc7b1fad312199806c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109710
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-07-22 16:00:28 +00:00
Johnni Winther
b52328e528 [cfe] Remove unneeded indirect generator construction through Forest
Change-Id: Ic535bfe84395608c9b0764edf8646fd2606429b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109708
Reviewed-by: Dan Rubel <danrubel@google.com>
2019-07-22 16:00:28 +00:00
Johnni Winther
2a199f3993 [cfe] Merge KernelExpressionGenerator with ExpressionGenerator
We no longer need the distinction between *Generator and Kernel*Generator
so the Kernel*Generator classes are now merge into the *Generator classes.

Change-Id: I9f9650fc4ab88a0952b8d2bd346e1d416d68eac6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109707
Reviewed-by: Dan Rubel <danrubel@google.com>
2019-07-22 16:00:28 +00:00
Johnni Winther
948b60f8dc [cfe] Add test for extension member parameters
Change-Id: I6ceb66bbef561b0c86e6f529e9d90a35dd82f628
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109705
Reviewed-by: Dan Rubel <danrubel@google.com>
2019-07-22 16:00:28 +00:00
Johnni Winther
11755e537c [cfe] Add tests for extension members
+ Avoid creating default constructors.

Change-Id: Ie0ed967d9be4cf31a2eb6991767887de1f88149a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109702
Reviewed-by: Dan Rubel <danrubel@google.com>
2019-07-22 16:00:28 +00:00
Johnni Winther
610183d5f9 [cfe] Rename operator[] to getLocalMember on Library/ClassBuilder
Change-Id: I8d03cf939e15de53b3768ee946815cf31e3a1124
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109700
Reviewed-by: Dan Rubel <danrubel@google.com>
2019-07-22 16:00:28 +00:00
Johnni Winther
b3b6533c3d [cfe] Create ClassBuilder for extension declarations
Change-Id: Ic372b89588ed9ec3afc43f7db7e3d38a81846ad5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109264
Reviewed-by: Dan Rubel <danrubel@google.com>
2019-07-22 16:00:28 +00:00
Johnni Winther
7075ae7026 [cfe+dart2js] Move features to CFE
To share support for annotated tests based on Features.

Change-Id: Ic319442e2e016bf4d1584825ea019d13a74acedb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109560
Reviewed-by: Stephen Adams <sra@google.com>
2019-07-22 16:00:28 +00:00
Paul Berry
b912aebf5c Flow analysis: change tryPromoteToNonNull to promoteToNonNull.
The flow analysis engine is now responsible for figuring out whether a
promotion actually occurred; this is less error prone.

Change-Id: Idce8af01fae982a9cc240ec4675812f8d7fd68a0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109883
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-07-22 15:58:48 +00:00
Paul Berry
7adca0ec5f Flow analysis: Remove "emptySet" argument from markNonNullable
Change-Id: Ia2fd7878badedba95ffee5f7a6948402376a2300
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109882
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-07-22 15:36:48 +00:00
Paul Berry
7719298616 Flow analysis: fix incorrectly written unit test.
Change-Id: Iba5fcbb6ecd6f707ef2b20b0ec653fda7c577924
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109881
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-07-22 15:36:48 +00:00
Brian Wilkerson
073d521131 Update DartType.displayName to display nullability when appropriate
Change-Id: I36dbda77e4a363a2265e4b94a87fbe6d842a5348
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109800
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-07-22 12:40:27 +00:00
Brian Wilkerson
fe1da36f12 Change the wording of unused-element
I think this makes the message better, but it also means that the message
can be internationalized.

Change-Id: I0697fc05b79e33d5af2424609b30c2832b1a210b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109860
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-07-22 12:40:07 +00:00
Paul Berry
977a78b7a0 Flow analysis: expose State and unit test. Also fix restrict method.
Change-Id: Id96a3266aea6ab8dd97e72bbf72a55b4156ebc0b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109841
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-07-21 21:22:45 +00:00
Konstantin Shcheglov
90f03db962 Support for extensions in summary2.
I ignored unnamed extensions for now, so correspondings tests crash.

R=brianwilkerson@google.com

Change-Id: I3e56d1ccaf0c5839b426ea179ed6100dbb15c143
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109727
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-07-21 21:14:15 +00:00
Paul Berry
f23418d9b7 Flow analysis: Refactor some common unit testing code
Change-Id: I227bc09ed8e0c2161b5de9a06e70089b5f623b65
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109840
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-07-21 20:33:55 +00:00
Paul Berry
c8587ce199 Flow analysis: don't use == to compare types.
Includes an integration test illustrating where this would have caused
incorrect behavior (due to the fact that the analyzer's `DartType.==`
doesn't yet distinguish nullabilities - see #37587), as well as unit
tests that will ensure we don't regress even after #37587 is fixed.

Change-Id: Ief92cf5a052bc2b96e4e74f69f2268b0565d920f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109820
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-07-21 20:33:55 +00:00
Paul Berry
7b6c667863 Flow analysis: rework tracking of nullability.
We now track nullability via type promotion, e.g. by promoting from
`int?` to `int` to represent a non-nullable value.

I've added a few more unit tests of flow analysis that were helpful
while preparing this CL.  I plan to add more tests in follow-up CLs.

A few behaviors are lost by this change:

- We no longer track whether a variable's value is exactly null
  (previously the tests annotated such variables as "nullable", which
  was a bit misleading).  I'm not sure whether we really want this
  feature or not; I've filed
  https://github.com/dart-lang/language/issues/461 for discussion.

- Assignment of a non-null value to a nullable-typed variable no
  longer promotes it to non-nullable.  I think we want to get this
  behavior back, but we'll need to add a little bit more machinery to
  get it back (we need to allow assignments in general to promote.
  I'll address in follow-up CLs.  See
  https://github.com/dart-lang/language/issues/440 for discussion.

- A promotion to non-nullable that happens during a "try" block is
  lost if there is a "finally" block.  I think we want to get this
  behavior back, but we'll need to add a little bit more machinery to
  do so, to allow promotions in general to be preserved by
  try/finally.  I'll address in follow-up CLs.

Change-Id: Ibc45d70043725697fbee063a8dcefb1179506e9b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109780
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-07-21 04:09:14 +00:00
Paul Berry
c2e78e83c6 Flow analysis: fix and unit test joinPromoted.
I will add further unit tests of flow analysis in follow-up CLs.

Note that flow_analysis_unit_test.dart does not make use of the
test_reflective_loader package because the intent is to move these
tests into the front end, and front end tests are written using
vanilla package:test conventions.

Change-Id: I10ba27212a1986f0c1fd960d33105f281712b506
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109760
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-07-21 03:24:34 +00:00
Paul Berry
7976bea0df Add ? suffixes to flow analysis tests.
The new flow analysis will only function for libraries that are opted
into NNBD, therefore if we want to test that a variable is properly
promoted from a nullable type to a non-nullable one, we need its
declared type to be explicitly marked as nullable.

Change-Id: Ia649167f8069c37b3907ba63cabf4f50224dbade
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109745
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-07-20 05:01:43 +00:00
Paul Berry
507f404361 Flow analysis: always supply a type parameter for FunctionBodyAccess.
This reduces the risk of mistakes and avoids downcasts.

Change-Id: I98f021e0dd6754ee499a08aabe4fee00d17501ac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109744
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-07-20 05:01:43 +00:00