Commit graph

8 commits

Author SHA1 Message Date
Nicholas Shahan bef857b6cb Fix dart:collection analysis errors in NNBD fork
Change-Id: Id4a5e5b100ca1c429070263555ab730622644d19
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127161
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2019-12-05 18:20:09 +00:00
Mark Zhou a4bac1fb10 [dartdevc] Migrating dart:_js_helper and dart:_interceptors to NNBD.
Subsumes the reland of https://dart-review.googlesource.com/c/sdk/+/125994

Change-Id: Ie12c8d473303d0ce7379828caf7523b26733ab75
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126610
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2019-12-04 18:23:29 +00:00
Robert Nystrom b8cd8eee5d Migrate dart:internal to NNBD.
Also caught a couple of mistakes I made in dart:collection which got
picked up by this because some classes in here use classes from there.

Change-Id: I799db57baf4ea97e8ad4700008918acf03956aff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123600
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2019-11-05 19:21:23 +00:00
Robert Nystrom 34e8595362 Migrate the forked version of dart:collection to NNBD... mostly.
I ended up using nullable types and "!" (or "as E" because "!" has a
bug right now) in most cases to fix the nullability errors. There is
probably a more elegant refactoring one could do around things like the
sentinel nodes, but this preserves the existing behavior, doesn't break
any APIs and is minimally invasive.

It's not perfect, but it's progress and we can land and iterate on it.

Other changes:

- Filled in dynamic for raw types. No particular reason, but it seemed
  clearer to me, and I noticed in places where I was getting errors
  about implicit casts from dynamic.

- Added some "dynamic" type annotations on lambdas. I was surprised
  those are needed since I expected inference to fill in the type, but
  if I don't annotate, I get "Missing parameter type for '_'."

- Made optional parameters nullable. When the parameter was a function
  type, I also switched to the new function type syntax since using "?"
  on the old C-style syntax looks pretty strange to me.

- Fixed many many implicit downcast errors. In some cases, no cast was
  needed and I could loosen the target type to get rid of the cast. In
  other cases, I added an explicit cast.

- Got rid of "new" in doc comments.

There are still a few errors. They are either:

- Invalid override errors from stuff in dart:core. I think these will
  go away once core is migrated too.

- Errors caused by #38813.

- An error that I think it caused by #38900.

Observations:

- I found a few cases where implicit downcasts were happening
  unintentionally. They didn't fail but there was no need to use the
  tighter type there.

- It was annoying to work around List<E>(size) being prohibited on a
  nullable type, but not particularly painful. This library is probably
  the most affected by that restriction and it wasn't that bad.

- Having both explicit downcasts *and* type annotated local variables
  is really silly. It's a good thing most users use "var" and "final".

- Analyzer error messages were almost always precise, clear, and well
  located. The one exception is that the invalid override errors are
  really strange looking and don't tell you why the types don't match.

- Migrating code you're completely unfamiliar with is a little
  uncomfortable, but still surprisingly doable. You can almost always
  fix an error with some local change and little global context.

- I only used "late" once. That's probably mostly a consequence of me
  not knowing the code well and trying to make minimal changes.

Change-Id: Ifaedd0d4203945fd0b5ce20145c6e10b8ac1d646
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121920
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2019-10-23 20:53:55 +00:00
Sam Rawlins 04702d827b Fix Queue.from doc comment
Fixes #37943

Change-Id: I6812ba3c3ccc8e679b9bcbb2d6ad5e4d14035cd3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122482
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2019-10-23 10:03:55 +00:00
Sam Rawlins fd0617bd98 Improve listToString and setToString documentation. Fixes #26529
Bug: https://github.com/dart-lang/sdk/issues/26529
Change-Id: I4e2994dd39c676c2136c82d3e5dd9f45a8b154ce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/82784
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2019-10-18 18:15:52 +00:00
Lasse R.H. Nielsen e88057fe04 Add non-NNBD language version marker on all sdk_nnbd files.
Change-Id: I2ab3d4b1efe0f3c79f4b770e79476153380220f2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118040
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2019-09-19 19:44:37 +00:00
Paul Berry 004d49bd6b Make a fork of sdk/lib for use by NNBD.
Change-Id: I7f5892d66f9e7bd08ca064fb2df329794a56faf5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116527
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-09-10 19:20:12 +00:00