Commit graph

351 commits

Author SHA1 Message Date
Alexander Markov c798bd8e53 [vm/nnbd] Fix element type nullability check in _GrowableList.length=
When growing an array, we're checking if element type is nullable.
The problem is that 'null is! T' is true for legacy types T
(other than top types and Null), so it throws for List<int*>.

In order to be able to grow arrays with all element types which can
hold null (including legacy element types) this test is changed to

      null as T;

which throws type error if T cannot hold null.

Change-Id: Icf0a397109945b049b4aaead4c7eab11d903c45b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134790
Reviewed-by: Liam Appelbe <liama@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-02-07 17:32:24 +00:00
Jonas Termansen 02ced42875 [nnbd] Fix remaining NNBD errors in dart:_http and dart:io.
HeaderValue parameters must have non-null values per the specification.

Bug: https://github.com/dart-lang/sdk/issues/40040
Change-Id: I39f8c894015197c014057888026e4ad474aa5dc8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134722
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Jonas Termansen <sortie@google.com>
2020-02-07 14:31:09 +00:00
Jonas Termansen 514a8d4c84 [nnbd] Fix SecureServerSocket not allowing null SecurityContext.
Bug: https://github.com/dart-lang/sdk/issues/40040
Change-Id: I030f3f6740fd0ffefaa20fac1be69fb74c5cbff5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134293
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Jonas Termansen <sortie@google.com>
2020-02-07 13:36:03 +00:00
Jonas Termansen 7704b83091 [nnbd] Fix Process.stderr providing stdout instead in NNBD dart:io.
Bug: https://github.com/dart-lang/sdk/issues/40040
Change-Id: Ia318180de1b1614502671c6bf4051d79ae7808f3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134327
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Jonas Termansen <sortie@google.com>
2020-02-07 13:33:19 +00:00
Srujan Gaddam dae60008ab DOM script changes to handle nnbd
-Adds field for type nullability for IDL operations
-Adds field for conversions to reflect input and output type nullability
--based on implementation
-Corrects generic object types to include nullability
-Changes 'any' types to dynamics
-Adds nullability to types in various operations
-Converts finals and non-initialized non-nullable fields to getters and
setters
--TODO: convert these to native instead of JS inline
-Modifies nullability for annotations and removes annotations from
setters

Change-Id: Iab19830fd1d7f37b170a4da8672f922c3f9b0863
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132967
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-02-07 01:05:14 +00:00
Ben Konyi e9e555f4e3 [ VM / Service ] Fix service/developer_server_control_test which was broken after vmservice NNBD migration
Change-Id: Ibbf295b25fbad6cbd9bd0db98ecd6c3ac3eb2eeb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134791
Reviewed-by: Siva Annamalai <asiva@google.com>
2020-02-07 00:45:09 +00:00
Ben Konyi d47391ec41 [ VM / Service ] Fix multiple errors in VM service introduced during NNBD migration
Change-Id: I63ceb4ed94650011d1e0d38ee6f7d2a8e6185c7a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134805
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-02-07 00:11:39 +00:00
asiva f29d9f4fb1 [VM/Libraries] Use the NNBD libraries when building the NNBD sdk.
Change-Id: I06507799f678eeb204fdc8719ef6d97b177cbfd2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134112
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-02-07 00:00:07 +00:00
Srujan Gaddam 3776313e65 Change dart:html templates to generate null-safe code
Introduces NULLASSERT token and NNBD condition to allow code to
conditionally compile with NNBD.

Change-Id: Ib71e439f32c793e69b66c328cd7c9900358d886e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134045
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-02-06 23:18:24 +00:00
Robert Nystrom 688801cb27 Migrate language_2/assert to NNBD.
Change-Id: I4daa09afa52f76076374591b3e3f3420a46b169b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134240
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
2020-02-06 22:47:25 +00:00
Ryan Macnak a85f6ec3a1 Fix VM service message routing and asset loading.
Change-Id: I8c36663fd2324e731283ea65dd8a0d3b5e13d55e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134760
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-02-06 22:28:04 +00:00
Ben Konyi 49850e6919 [ VM / Service ] Fixed mismatching type in migrated NNBD service code
Change-Id: If2bd92c48893adf46a7fe08e725d908f50317e2d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134782
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2020-02-06 21:06:11 +00:00
Joshua Litt 9781d3dc9f Fix minor bug with NNBD and Math.exp
This cl simply adds a missing nullcheck to Math.exp

Change-Id: I5a5a145b1c60e31d956891c530cba2bb9a718b4a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134761
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2020-02-06 20:41:07 +00:00
asiva 83fdfde140 [VM/libraries] - Fix signature of waitFor.
This should fix issue 40472.

Bug: 40472
Change-Id: I5cfa7cf25778b6a5430168707dd9370b202d3e6d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134565
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2020-02-05 22:48:50 +00:00
Sigmund Cherem 40a03f472a [dart2js] Make dart:_native_type_data null safe.
This mostly copies the changes from DDC to the dart2js implementation.

Change-Id: Ib56b607a6cea3df0e319e32cd4afa6b5b55b03d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134463
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2020-02-05 19:34:59 +00:00
Sigmund Cherem eb54b5bb9b Formatting changes to dart:_native_type_data to make dart2js and ddc more similar.
Mostly changes to the comment syntax, removing optional `new`, and using the
same kind of quotes on strings.

Change-Id: Ia6d7f38523312f67cfa30cd30cef994759d40ef1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134480
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2020-02-05 19:34:59 +00:00
Sigmund Cherem 20745941ad [ddc,dart2js] make dart:typed_data the same in dart2js and ddc and opt-in to null safety.
Change-Id: If325a2ea11afef1d784fd01830999d5a4c9d4daf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134049
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
2020-02-05 19:29:10 +00:00
Ben Konyi 763bcae067 Reland "[ VM / Service ] Added getClientName, setClientName and requireResumeApproval RPCs"
This reverts commit 37f4a44a27.

Reason for revert: Relanding after infra issues cleared

Original change's description:
> Revert "[ VM / Service ] Added `getClientName`, `setClientName` and `requireResumeApproval` RPCs"
> 
> This reverts commit 48808f7dce.
> 
> Reason for revert: Unable to approve failures.
> 
> Original change's description:
> > [ VM / Service ] Added `getClientName`, `setClientName` and `requireResumeApproval` RPCs
> > 
> > Add support for naming VM service clients which allows for resume
> > permissions to be set for all clients of the same name. If a client
> > name requires resume approval, an isolate won't be resumed until all
> > clients which require resume approval have called the `resume` RPC.
> > 
> > Resume approvals can be set for the following pause events:
> > - PauseOnStart
> > - PausePostRequest (issued after `reloadSources(pause: true)`)
> > - PauseOnExit
> > 
> > Change-Id: I7dde3d8aaeccfcf47fa84f1f92159846f1560e16
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133621
> > Commit-Queue: Ben Konyi <bkonyi@google.com>
> > Reviewed-by: Siva Annamalai <asiva@google.com>
> > Reviewed-by: Gary Roumanis <grouma@google.com>
> 
> TBR=jacobr@google.com,bkonyi@google.com,rmacnak@google.com,asiva@google.com,grouma@google.com
> 
> Change-Id: I8e60416ad8cbec9ad93f4e34e9bf9af5a516c6dc
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134465
> Reviewed-by: Ben Konyi <bkonyi@google.com>
> Commit-Queue: Ben Konyi <bkonyi@google.com>

TBR=jacobr@google.com,bkonyi@google.com,rmacnak@google.com,asiva@google.com,grouma@google.com

Change-Id: Ibd9d831774e5c4dd500da026f41b173589a9aefd
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134415
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-02-05 18:14:39 +00:00
Jake Macdonald 12b5e23084 Revert "[dart:io] Backport semantic changes from the dart:io NNBD migration."
This reverts commit 4cd6243d77.

Reason for revert: Breaks anything using the bazel_worker package (which is used for modular compilation with build_runner).  https://travis-ci.org/dart-lang/build/jobs/645748778

Original change's description:
> [dart:io] Backport semantic changes from the dart:io NNBD migration.
> 
> The NNBD migration required making subtle changes to some dart:io
> semantics in order to provide a better API. This change backports these
> semantic changes to the unmigrated SDK so any issues can be discovered
> now instead of blocking the future SDK unfork.
> 
> The Process class will now throw a StateError if the process is detached
> upon accessing the stdin, stdout, stderr, and exitCode getters.
> 
> The Socket class will now throw a SocketException if the socket has been
> destroyed or upgraded to a secure socket upon setting or getting socket
> options.
> 
> Change-Id: I956fd07e713e51ebd479ebbfe4790d8d2fdf0744
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133989
> Commit-Queue: Jonas Termansen <sortie@google.com>
> Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>

TBR=sortie@google.com,lrn@google.com

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

Change-Id: I744662fcd14ca232bf44a584bb6f3974d48da69a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134361
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
Commit-Queue: Jonas Termansen <sortie@google.com>
2020-02-05 10:03:47 +00:00
Ben Konyi 37f4a44a27 Revert "[ VM / Service ] Added getClientName, setClientName and requireResumeApproval RPCs"
This reverts commit 48808f7dce.

Reason for revert: Unable to approve failures.

Original change's description:
> [ VM / Service ] Added `getClientName`, `setClientName` and `requireResumeApproval` RPCs
> 
> Add support for naming VM service clients which allows for resume
> permissions to be set for all clients of the same name. If a client
> name requires resume approval, an isolate won't be resumed until all
> clients which require resume approval have called the `resume` RPC.
> 
> Resume approvals can be set for the following pause events:
> - PauseOnStart
> - PausePostRequest (issued after `reloadSources(pause: true)`)
> - PauseOnExit
> 
> Change-Id: I7dde3d8aaeccfcf47fa84f1f92159846f1560e16
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133621
> Commit-Queue: Ben Konyi <bkonyi@google.com>
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Reviewed-by: Gary Roumanis <grouma@google.com>

TBR=jacobr@google.com,bkonyi@google.com,rmacnak@google.com,asiva@google.com,grouma@google.com

Change-Id: I8e60416ad8cbec9ad93f4e34e9bf9af5a516c6dc
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134465
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-02-05 01:13:17 +00:00
Mayank Patke 450924a8cd [dart2js] Remove typedefs from backend.
Change-Id: Ia170535b5d35d97003cff93acbf33cb3fe75725f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134206
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2020-02-05 01:09:47 +00:00
Ben Konyi 48808f7dce [ VM / Service ] Added getClientName, setClientName and requireResumeApproval RPCs
Add support for naming VM service clients which allows for resume
permissions to be set for all clients of the same name. If a client
name requires resume approval, an isolate won't be resumed until all
clients which require resume approval have called the `resume` RPC.

Resume approvals can be set for the following pause events:
- PauseOnStart
- PausePostRequest (issued after `reloadSources(pause: true)`)
- PauseOnExit

Change-Id: I7dde3d8aaeccfcf47fa84f1f92159846f1560e16
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133621
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Gary Roumanis <grouma@google.com>
2020-02-05 00:02:17 +00:00
Vijay Menon ce21fd034e [dartdevc,nnbd] fix type errors in dart:_interceptors
Change-Id: If842fbab8bc043c9331529d1280c57faa7ce6769
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134407
Auto-Submit: Vijay Menon <vsm@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Vijay Menon <vsm@google.com>
2020-02-04 23:46:37 +00:00
asiva 1f32305392 [VM/libraries] - Fix issues in ported patch files that cause dart2js to fail (https://github.com/dart-lang/sdk/issues/40463)
- List<String> should be List<Object?> because entries in the stack can be either Map or Strings
- _divRem has some cached values which are marked late but are used
before they are initialized resulting in exceptions, these four cached
values are now made nullable.

Bug: 40463
Change-Id: I469692e95bf6ef74665d14209dd3e2cd556c1f06
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134408
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-02-04 23:43:27 +00:00
Sigmund Cherem d798004ba3 [ddc,dart2js] remove web patches for dart:cli
Since dart:cli is not in the libraries.yaml/json for ddc and dart2js, imports to
it are not allowed on web code. The patch files were not needed and can be
removed.

Change-Id: I46acf8a540f4b2d0a2aa7dcc50b572adab564b68
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134048
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2020-02-04 23:32:47 +00:00
asiva 0e5a7275d0 [VM/library] Fix signature of waitFor to account for potential null return value.
This should fix the breakage in the NNBD on test standalone/io/issue_32052_test

Change-Id: I58192dffa9a9d7f5c492dd58e7f570fabcb69b86
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134243
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2020-02-04 16:55:08 +00:00
Srujan Gaddam 851912cc1d Change nnbd_src files to be null-safe
Translates the forked nnbd_src files to address analyzer issues.

Change-Id: Ida21988bff63a6c5a037b548d0c8b11208317b3e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130131
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-02-04 01:57:39 +00:00
Jonas Termansen 4cd6243d77 [dart:io] Backport semantic changes from the dart:io NNBD migration.
The NNBD migration required making subtle changes to some dart:io
semantics in order to provide a better API. This change backports these
semantic changes to the unmigrated SDK so any issues can be discovered
now instead of blocking the future SDK unfork.

The Process class will now throw a StateError if the process is detached
upon accessing the stdin, stdout, stderr, and exitCode getters.

The Socket class will now throw a SocketException if the socket has been
destroyed or upgraded to a secure socket upon setting or getting socket
options.

Change-Id: I956fd07e713e51ebd479ebbfe4790d8d2fdf0744
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133989
Commit-Queue: Jonas Termansen <sortie@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2020-02-03 15:10:45 +00:00
Sigmund Cherem 07675de0c0 Fix type error within _EventStream.onData
The constructor was wrapping the onData handler to hide the type-mismatch. This
copies the same logic to the onData handler.

In non-nnbd code this code was not exercised. The migration of dart:async
made this code reachable on our tests. That's because Stream.first used to
do:

  var subscription;
  this.listen(() => ... cancel subscription here, ...)

it now avoids making subscription nullable by registering the onData handler
later:

  var subscrition = stream.listen(null, ...);
  subscription.onData(() => ... cancel subscription here);

This change fixes the following 6 html tests under nnbd:
html/history_test/history/history
html/transferables_test
html/transition_event_test
html/websocket_test
html/worker_test/functional/functional
html/xhr_test


Change-Id: I095ea8d545e65b047504af0367586884bba84d72
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134120
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2020-02-02 05:58:24 +00:00
Zichang Guo 91a3ea89c8 Revert "[dart:io] Stop forcing lower case on HttpHeaders"
This reverts commit b2b7337ad4.

Reason for revert: flutter build broke!!

Original change's description:
> [dart:io] Stop forcing lower case on HttpHeaders
> 
> This is a breaking change. Request: https://github.com/dart-lang/sdk/issues/33501
> 
> HttpHeaders use lowercase by default for all headers, since it is supposed to be case insensitive. Some servers incorrectly treat case as significant, however, and expect headers with capitalization or in uppercase. The current implementation forces headers to be lower cases when adding values. Users cannot even manually modify the headers.
> 
> This change removes this restriction here so that users can modify the headers to whatever form they want. The new behavior is backwards compatible except if class was implemented. All headers inside http.dart are written as lower cases, adding values to HttpHeaders is still receiving lower cases input.
> 
> The other cl (https://dart-review.googlesource.com/c/http_multi_server/+/121411) migrates multi_headers.dart to be compatible with this change.
> 
> Bug: https://github.com/dart-lang/sdk/issues/33501
> Change-Id: I6f7f2ef907b229773c283140c07f2de4cd500981
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119100
> Commit-Queue: Zichang Guo <zichangguo@google.com>
> Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>

TBR=whesse@google.com,sortie@google.com,lrn@google.com,zichangguo@google.com

Change-Id: I4d4299393ad6549b250053df8823e726855e2baf
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/33501
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134102
Reviewed-by: Zichang Guo <zichangguo@google.com>
Commit-Queue: Zichang Guo <zichangguo@google.com>
2020-01-31 22:32:22 +00:00
Mayank Patke a5cfdf6586 [dart2js] Use flags to choose between legacy/NNBD in RTI.
Change-Id: I42705320aabcdfecc12098f40ca16a2c623a1033
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134091
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2020-01-31 20:04:52 +00:00
Sigmund Cherem f07c805656 Fix based64 decoder.
The non-nnbd code doesn't have this extra `if`. It appears
that this conditional was added during the migration but
it is accidentally hiding the update to the _state.

This change restores the algorithm to how it was before
the migration and fixes lib_2/convert/base64_test/none

Change-Id: I72dd2e870056bb55158bbd053d8a3c8825a1d144
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134090
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2020-01-31 19:00:32 +00:00
Mayank Patke 023f286772 [dart2js] Update generic function subtyping.
We now test bounds for mutual subtyping rather than structural equality
up to renaming of bound type variables and equating all top types.

Change-Id: I7dd23a3211a1631e463ea90c3173f3deae46ca23
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134042
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-01-31 18:33:02 +00:00
Zichang Guo b2b7337ad4 [dart:io] Stop forcing lower case on HttpHeaders
This is a breaking change. Request: https://github.com/dart-lang/sdk/issues/33501

HttpHeaders use lowercase by default for all headers, since it is supposed to be case insensitive. Some servers incorrectly treat case as significant, however, and expect headers with capitalization or in uppercase. The current implementation forces headers to be lower cases when adding values. Users cannot even manually modify the headers.

This change removes this restriction here so that users can modify the headers to whatever form they want. The new behavior is backwards compatible except if class was implemented. All headers inside http.dart are written as lower cases, adding values to HttpHeaders is still receiving lower cases input.

The other cl (https://dart-review.googlesource.com/c/http_multi_server/+/121411) migrates multi_headers.dart to be compatible with this change.

Bug: https://github.com/dart-lang/sdk/issues/33501
Change-Id: I6f7f2ef907b229773c283140c07f2de4cd500981
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119100
Commit-Queue: Zichang Guo <zichangguo@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2020-01-31 17:08:52 +00:00
Zichang Guo 0ed9f7179d [vm] seperate error and unknown types for getStdioHandletype
Infer other types as kPipe which is sync with Win platform.

Bug: https://github.com/dart-lang/sdk/issues/40354
Change-Id: I8bf40a143573685833a689ff2c724a421b308234
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133623
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Zichang Guo <zichangguo@google.com>
2020-01-31 17:07:22 +00:00
Johnni Winther 906c6ea21c Avoid implicit downcast in nnbd sdk
The least upper bound of _SyncBroadcastStreamController and
_SyncStreamController is StreamController (according to the CFE) leading
to an implicit downcast from StreamController to _StreamControllerBase.

The analyzer and CFE sometimes disagree on the hierarchy depth
computation (see https://github.com/dart-lang/sdk/issues/38377)
which is probably the root cause of this.

Change-Id: I276bdc894d3926eae603b023b29462571c620c52
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133980
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2020-01-31 11:58:31 +00:00
Nicholas Shahan eafa17ccfb [dartdevc] Update subtype check to allow mutual subtypes in bounds
Generic functions with bounds on the type parameters should be allowed
to differ in that legacy type bound should be considered equivalent to
a nullable or non-nullable version of the same type bound.

Fixes test failures:
lib_2/async/async_await_zones_test
lib_2/async/stream_listen_zone_test
lib_2/async/zone_bind_callback_test
lib_2/async/zone_bind_callback_unary_test
lib_2/async/zone_debug_test
lib_2/async/zone_fork_test
lib_2/async/zone_register_callback_test
lib_2/async/zone_register_callback_unary_test
lib_2/async/zone_run_guarded_test
lib_2/async/zone_run_test
lib_2/async/zone_run_unary_test


Change-Id: I8bbb2ebae20f4e67bdaf8f321609b3307d92c6d4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133245
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-01-31 06:37:02 +00:00
Jonas Termansen f6e0200523 [nnbd] Migrate dart:io to NNBD.
The Process class will now throw a StateError if the process is detached
upon accessing the stdin, stdout, stderr, and exitCode getters.

The Socket class will now throw a SocketException if the socket has been
destroyed or upgraded to a secure socket upon setting or getting socket
options.

Bug: https://github.com/dart-lang/sdk/issues/40040
Change-Id: I68e22873932c68a3fac549c0f742dd49d0a60dfb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133060
Commit-Queue: Jonas Termansen <sortie@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2020-01-30 15:46:08 +00:00
asiva f24c0f0837 [VM/tests] Second step of porting dart:cli tests for NNBD
Turn on the dart:cli tests in the nnbd bot.

Change-Id: I2c521b217300839deb7ad47a820768172b8f0e26
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133866
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-01-30 02:42:11 +00:00
Srujan Gaddam 28917d8b1d Handle invalid overrides in template and src dart files
Several functions did not override their parents' function signatures
correctly for nnbd.

Change-Id: Ibd935ffa39b3175db65bb43d15396134700d2f78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129143
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-01-29 22:22:50 +00:00
Srujan Gaddam 151dc015c0 Add $#NAME syntax to emitter to allow subtemplates
NNBD will require explicit casts in various locations in the dart:html
libraries. To avoid taking on this overhead in the pre-nnbd dart:html
library, syntax is introduced in the emitter to allow tokens with
arguments.

Test: emitter_test.py

Change-Id: Ie6de714f491e0cda654f33ee389a91b765cacc9b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133333
Reviewed-by: Stephen Adams <sra@google.com>
2020-01-29 22:22:50 +00:00
Martin Kustermann 37d562d2a4 [vm/async] Ensure --lazy-async-stacks also works inside custom zones with error handlers
Issue https://github.com/dart-lang/sdk/issues/37668

Change-Id: Ib7fb8299fbc8b7f73e154414f37451a488297a67
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133583
Auto-Submit: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
2020-01-29 11:17:50 +00:00
Srujan Gaddam 7db61c6b01 Changing the dart:html generator scripts to generate null-safe/nnbd code
Change-Id: I4a8b097b126864366076b1e73cf3e0296600380e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128376
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2020-01-29 00:20:42 +00:00
Zichang Guo 06fa701c95 [http] fix hanging when parser failed to parser body of response/request
* Some cleanups on http parser.
* When parsing body of the http response/request, errors should not go to _controller, where it is paused. This leads to hanging.
* Fix another bug: (byte < 0x30 && 0x39 < byte)

Bug: https://github.com/dart-lang/sdk/issues/40132

Change-Id: Iaf3fb6a409c92889f50b86220a2c6c2318012c47
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132964
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Zichang Guo <zichangguo@google.com>
2020-01-28 23:43:42 +00:00
jonahwilliams 96ff3276f4 [vmservice] allow fallback on port bind failure
Work towards https://github.com/flutter/flutter/issues/46724

Background:

on the latest versions of iOS today, we have to use mdns to discover the observatory port and authentication code. For a variety of reasons this can fail, leaving us with no way to connect.

An alternative approach is to specify the observatory port and disable the authentication code. If binding to this port fails, however, we would still like to attempt connecting with mdns.

Overview:

This adds a new flag to the dart SDK, --enable-service-port-fallback. This amends the behavior of the vmservice with a specified port. After failing to bind 3 times to a non-zero port, update the port selection to 0.

Results:

Tested locally two dart VMs with the same specified port:

```
jonahwilliams@jonahwilliams0:~/Documents/engine/src/out/host_debug_unopt$ ./dart --enable-service-port-fallback --observe=8080 example.dart
Observatory server failed to start after 1 tries
Falling back to automatic port selection

vm-service: isolate(2785434094928835)  'main' has no debugger attached and is paused at exit.  Connect to Observatory to debug.
Observatory listening on http://127.0.0.1:45663/62A5IHjmv9E=/
```
Change-Id: I582ab402a457330928e5b490f9718fcd52b56720
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133434
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Jonah Williams <jonahwilliams@google.com>
2020-01-28 23:36:14 +00:00
asiva c2fb631d99 [VM/libraries] Fix final set of warnings in dart:core and dart:typed_data
Change-Id: If05b13eba924fbeaad2a82598a5255f12ba6b1b0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133323
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-01-27 19:51:14 +00:00
Arun 3efd623849 Fixes failure of x86_64 builds for android
This fixes #39838

Closes https://github.com/dart-lang/sdk/pull/40328
https://github.com/dart-lang/sdk/pull/40328

GitOrigin-RevId: 3794c3875cc2c2a5ab6360ed3a86eb2ada3114e1
Change-Id: Iebc8927b9d758c3d1ec36f038819276abb0091c8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133401
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2020-01-27 14:21:26 +00:00
asiva 5d0c08b5de [VM/libraries] Port some of the changes made in the sdk version of typed_data_patch.dart over to the sdk_nnbd version too.
Change-Id: I30a60395a7d828a5f44afa2fadbef152af832753
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133362
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2020-01-25 01:54:14 +00:00
Jonah Williams cdeb9a7a8c Revert "[vmservice] allow fallback on port bind failure"
This reverts commit 6ff7e9ebad.

Reason for revert: <INSERT REASONING HERE>

Original change's description:
> [vmservice] allow fallback on port bind failure
> 
> Work towards https://github.com/flutter/flutter/issues/46724
> 
> Background:
> 
> on the latest versions of iOS today, we have to use mdns to discover the observatory port and authentication code. For a variety of reasons this can fail, leaving us with no way to connect.
> 
> An alternative approach is to specify the observatory port and disable the authentication code. If binding to this port fails, however, we would still like to attempt connecting with mdns.
> 
> Overview:
> 
> This adds a new flag to the dart SDK, --enable-service-port-fallback. This amends the behavior of the vmservice with a specified port. After failing to bind once to a non-zero port, update the port selection to 0.
> 
> Results:
> 
> Tested locally two dart VMs with the same specified port:
> 
> ```
> jonahwilliams@jonahwilliams0:~/Documents/engine/src/out/host_debug_unopt$ ./dart --enable-service-port-fallback --observe=8080 example.dart
> Observatory server failed to start after 1 tries
> Falling back to automatic port selection
> vm-service: isolate(2785434094928835)  'main' has no debugger attached and is paused at exit.  Connect to Observatory to debug.
> Observatory listening on http://127.0.0.1:45663/62A5IHjmv9E=/
> ```
> 
> Change-Id: I371583edcb603325428f1cb760992e39b9f3b6dc
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130441
> Commit-Queue: Jonah Williams <jonahwilliams@google.com>
> Reviewed-by: Ben Konyi <bkonyi@google.com>

TBR=bkonyi@google.com,jonahwilliams@google.com

Change-Id: I337b2d549e33ef9c616c276a48ce894a14b1c317
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133327
Reviewed-by: Jonah Williams <jonahwilliams@google.com>
Commit-Queue: Jonah Williams <jonahwilliams@google.com>
2020-01-24 21:47:34 +00:00
jonahwilliams 6ff7e9ebad [vmservice] allow fallback on port bind failure
Work towards https://github.com/flutter/flutter/issues/46724

Background:

on the latest versions of iOS today, we have to use mdns to discover the observatory port and authentication code. For a variety of reasons this can fail, leaving us with no way to connect.

An alternative approach is to specify the observatory port and disable the authentication code. If binding to this port fails, however, we would still like to attempt connecting with mdns.

Overview:

This adds a new flag to the dart SDK, --enable-service-port-fallback. This amends the behavior of the vmservice with a specified port. After failing to bind once to a non-zero port, update the port selection to 0.

Results:

Tested locally two dart VMs with the same specified port:

```
jonahwilliams@jonahwilliams0:~/Documents/engine/src/out/host_debug_unopt$ ./dart --enable-service-port-fallback --observe=8080 example.dart
Observatory server failed to start after 1 tries
Falling back to automatic port selection
vm-service: isolate(2785434094928835)  'main' has no debugger attached and is paused at exit.  Connect to Observatory to debug.
Observatory listening on http://127.0.0.1:45663/62A5IHjmv9E=/
```

Change-Id: I371583edcb603325428f1cb760992e39b9f3b6dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130441
Commit-Queue: Jonah Williams <jonahwilliams@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2020-01-24 20:28:15 +00:00