Johnni Winther
72eb475f6c
[cfe] Refactor for-in loops to handle flow analysis
...
Change-Id: Iddbf84e9d878fc828280c76cdaa22f3082b6b842
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128067
Commit-Queue: Johnni Winther <johnniwinther@google.com >
Reviewed-by: Jens Johansen <jensj@google.com >
2019-12-12 13:53:59 +00:00
Dmitry Stefantsov
4df5b5458a
[cfe] Implement NNBD-aware lower / upper bound algorithms
...
Change-Id: I1def2843f41938e8aee39d12fc4e2807b0c5a1b3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126725
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com >
Reviewed-by: Johnni Winther <johnniwinther@google.com >
2019-12-12 11:00:21 +00:00
Johnni Winther
d9fa37e85d
[kernel] Use Never as static type for throw/rethrow
...
Change-Id: Iba61a834827747e656a6dc14d73ee152f66864cd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127882
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com >
Commit-Queue: Johnni Winther <johnniwinther@google.com >
2019-12-11 08:37:59 +00:00
Johnni Winther
de11b7b373
[cfe] Implement legacy erasure
...
Change-Id: I4f152264469e7cb6d23c7502e277004cd35e8527
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127463
Commit-Queue: Johnni Winther <johnniwinther@google.com >
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com >
2019-12-09 13:07:07 +00:00
Sam Rawlins
a455e099bb
Ignore _printEvent as an unused element
...
This is required for #37116
Change-Id: Ia061a423b2455f4e64d5a90f35cc5d7461fa57d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127343
Reviewed-by: Johnni Winther <johnniwinther@google.com >
Commit-Queue: Samuel Rawlins <srawlins@google.com >
2019-12-06 16:02:15 +00:00
Erik Ernst
80a400297a
[cfe] Add initial version of support for nonfunction-type-aliases
...
Change-Id: I9ff3f0c18a31bd1e0d16ba8b6ccd0cc261250c11
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127005
Commit-Queue: Erik Ernst <eernst@google.com >
Reviewed-by: Johnni Winther <johnniwinther@google.com >
2019-12-06 13:35:30 +00:00
Johnni Winther
97c2ca5ff1
[cfe] Use valid static types and file offsets in collections transformation
...
Closes #39566
Change-Id: I589d0dd568b3ea939bb1238b1c61fca6867e737e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127320
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com >
Commit-Queue: Johnni Winther <johnniwinther@google.com >
2019-12-06 10:58:20 +00:00
Jens Johansen
0dc6d59d52
[CFE] Fix crash caused by name clash of loadLibrary tearoff method
...
Fixes #39682
Change-Id: I0e326df9390e05ede939f0019e94f8abe1fb7983
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127460
Reviewed-by: Johnni Winther <johnniwinther@google.com >
Commit-Queue: Jens Johansen <jensj@google.com >
2019-12-06 09:29:19 +00:00
Dmitry Stefantsov
47a9ebea76
[cfe] Make API of as-instance-of and legacy LUB/GLB library-specific
...
Change-Id: I1991c66e654ef537243d9f25f17070acbfa13af9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126380
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com >
Reviewed-by: Johnni Winther <johnniwinther@google.com >
2019-12-05 13:32:28 +00:00
Johnni Winther
42a4442521
[cfe] Handle promotion of Null to Never
...
Change-Id: If784cc315e0ea179e98df45a06d4a99179e4c197
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127140
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com >
Commit-Queue: Johnni Winther <johnniwinther@google.com >
2019-12-04 12:41:38 +00:00
Johnni Winther
2ea8ff5ae7
[cfe] Don't continue shorting in explicit extension null aware access
...
Change-Id: Icd4ca31d4ca3c1601f190c3661cfd61b3f96db3d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126735
Reviewed-by: Jens Johansen <jensj@google.com >
Commit-Queue: Johnni Winther <johnniwinther@google.com >
2019-12-04 09:24:49 +00:00
Johnni Winther
441a17d1f9
[cfe] Fix flow analysis for type parameter promotion, initializers, switch continue and for loops
...
Change-Id: Ia0bbbeb7f968961846a30a31471399bef9065842
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127003
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com >
Commit-Queue: Johnni Winther <johnniwinther@google.com >
2019-12-03 14:28:48 +00:00
Johnni Winther
f7941eb850
[cfe] Handle break/continue in flow analysis
...
Change-Id: Ic02e60237b8eda3c98c0715e3fcc668d21e1bf62
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126728
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com >
Commit-Queue: Johnni Winther <johnniwinther@google.com >
2019-12-03 11:25:51 +00:00
Johnni Winther
5013ce6e5d
[cfe] Use correct types and errors in late lowering
...
Change-Id: I6e7dcbd96e151a69fc67a6cd5e5af1620760b02a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126647
Commit-Queue: Johnni Winther <johnniwinther@google.com >
Reviewed-by: Jens Johansen <jensj@google.com >
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com >
2019-12-02 15:00:18 +00:00
Johnni Winther
1454a67e09
[cfe] Don't use multiple null-aware guards in opt-out
...
Change-Id: I15bd991577ffcc309569ee4a5512dfb29c7874ee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126732
Reviewed-by: Jens Johansen <jensj@google.com >
Commit-Queue: Johnni Winther <johnniwinther@google.com >
2019-12-02 12:19:27 +00:00
Jens Johansen
88630cc235
Move real resolveConstructors from ClassBuilderImpl to SourceClassBuilder
...
Change-Id: I9855130de2e9947d1cc574512f75cee82fc24e3e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125969
Commit-Queue: Jens Johansen <jensj@google.com >
Reviewed-by: Johnni Winther <johnniwinther@google.com >
2019-12-02 10:19:37 +00:00
Jens Johansen
c1d21c368a
Move a few methods from ClassBuilderImpl to SourceClassBuilder
...
Change-Id: I85553b68f497f58d32721a93a718a069c8d783e4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125968
Commit-Queue: Jens Johansen <jensj@google.com >
Reviewed-by: Johnni Winther <johnniwinther@google.com >
2019-12-02 09:34:32 +00:00
Jens Johansen
1c3468a646
[kernel] Remove Library.isExternal
...
Change-Id: I6638b915c1189838e7081069a0075e4ecd9ee9d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125600
Commit-Queue: Jens Johansen <jensj@google.com >
Reviewed-by: Johnni Winther <johnniwinther@google.com >
2019-12-02 09:24:42 +00:00
Johnni Winther
659b32ffc8
[cfe] Handle chained null shorting and null aware if-null set
...
Change-Id: I39d2448a957ca7f4f3d1f027e543f773b300ce9b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126645
Commit-Queue: Johnni Winther <johnniwinther@google.com >
Reviewed-by: Jens Johansen <jensj@google.com >
2019-11-28 12:44:55 +00:00
Johnni Winther
8d874a5bd8
[cfe] Avoid cascading errors from part versioning mismatch
...
Change-Id: I8a233ff6c3b727176b812db203dac87f022f8a84
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126643
Reviewed-by: Jens Johansen <jensj@google.com >
Commit-Queue: Johnni Winther <johnniwinther@google.com >
2019-11-28 10:48:34 +00:00
Johnni Winther
a17809ad18
[kernel] Add TypeEnvironment.forInElementType
...
Adds convenience method for computing the element type of a for-in
iterable.
Change-Id: Idd1bf0a9b80523c49130b2d7f17590dcf86d3e40
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126581
Reviewed-by: Samir Jindel <sjindel@google.com >
Commit-Queue: Johnni Winther <johnniwinther@google.com >
2019-11-27 19:18:21 +00:00
Aske Simon Christensen
18f23124ad
[cfe] Print nullability on types in messages for opt-in libraries.
...
This CL changes the message template generator to add an extra
'isNonNullableByDefault' parameter to 'withArguments' for all
messages that include types, thus forcing the reporter to specify
whether the library that the message belongs to is opted in to NNBD.
When the message is formatted, a '?' is added to all nullable types
if the message is reported for an opt-in library.
Change-Id: I4e1861eba48043c570afad3f40bc3dccfd2e5668
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124984
Commit-Queue: Aske Simon Christensen <askesc@google.com >
Reviewed-by: Johnni Winther <johnniwinther@google.com >
2019-11-25 14:58:45 +00:00
Aske Simon Christensen
e84af9b761
[cfe] Disallow annotations on type parameters of function types
...
Also, do not copy annotations on type parameters of functions into
their inferred types.
See https://github.com/dart-lang/language/issues/656
Change-Id: I1460007645a32ac56a505b23ab3ee8a457c3f994
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123732
Commit-Queue: Aske Simon Christensen <askesc@google.com >
Reviewed-by: Erik Ernst <eernst@google.com >
2019-11-25 14:55:55 +00:00
Johnni Winther
cb6ab6eaa2
[cfe] Handle untyped initializing formals for late fields
...
Change-Id: I7cd0612ea7690d1679fbd7269f628ec5bc65dd05
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126040
Reviewed-by: Jens Johansen <jensj@google.com >
2019-11-25 13:59:25 +00:00
Johnni Winther
ecaa3e643a
[cfe] Move inference visitor to its own library and rename kernel_shadow_ast to internal_ast
...
Change-Id: I2a30efc08568380017230dd2af16329488687e9a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126041
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com >
Commit-Queue: Johnni Winther <johnniwinther@google.com >
2019-11-22 16:08:44 +00:00
Aske Simon Christensen
e78a2fd0df
[cfe] Remove optional parameter to toString
...
Violates usual toString interface for no good reason.
Change-Id: I8f92f1c91c40bcab192e0862b920a4dabf259d57
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125262
Reviewed-by: Johnni Winther <johnniwinther@google.com >
Commit-Queue: Aske Simon Christensen <askesc@google.com >
2019-11-22 14:37:54 +00:00
Dmitry Stefantsov
1f382890a7
[cfe] Make inference NNBD-aware
...
Change-Id: I7a793c87b00c97a7d4b05ba94116215d8f6d2a89
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125970
Reviewed-by: Johnni Winther <johnniwinther@google.com >
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com >
2019-11-22 12:09:14 +00:00
Johnni Winther
970c164826
[cfe] Use correct types in transformations and start verifying getStaticType
...
With this fix Expression.getStaticType no longer throws on any known cases.
Users of getStaticType can therefore avoid enclosing static type computation
in try-catch.
Closes #38597
Change-Id: I52eaacd30256333d7c368e5d14f4e4956bafc96f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121988
Commit-Queue: Johnni Winther <johnniwinther@google.com >
Reviewed-by: Alexander Markov <alexmarkov@google.com >
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com >
2019-11-21 22:15:58 +00:00
Dmitry Stefantsov
0b9665fc8b
[cfe] Use library's non-nullable modifier when creating new types
...
It's a part of internal cleanup of pkg/kernel and pkg/front_end. The
library's status is queried when the new types are created for it in
order to determine the value of the nullability modifier of the type.
Change-Id: Id653c511d17b3811a26b1751876a6e5036cdbed9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125261
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com >
Reviewed-by: Johnni Winther <johnniwinther@google.com >
2019-11-21 16:00:25 +00:00
Dmitry Stefantsov
3ed0ce2419
[cfe] Reuse nullability modifier when creating a copy of a type
...
It's a part of internal cleanup of pkg/kernel and pkg/front_end. The
nullability modifier is reused whenever a type object is created as a
(potentially modified) copy of another type object.
Change-Id: I9d09a744281e33814289a4f4dd65c764a7905eff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125260
Reviewed-by: Johnni Winther <johnniwinther@google.com >
2019-11-21 16:00:25 +00:00
Erik Ernst
6808c563aa
Adjusted front end to allow non-function type aliases
...
This change does not enable much (because the backends do not support
non-function type aliases), but this change makes it possible to work
on this feature in dart2js code, without making the changes to the
front end and the changes to dart2js part of the same cl.
Change-Id: I0d8a27a0e87cf6908f914b2c10d97ef3d02ebec5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125961
Commit-Queue: Erik Ernst <eernst@google.com >
Reviewed-by: Johnni Winther <johnniwinther@google.com >
2019-11-21 15:40:45 +00:00
Johnni Winther
acff31ed26
[cfe] Support null-aware index access
...
Change-Id: I54b58624722845e4b008b90e675516ec274bc2da
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125960
Reviewed-by: Jens Johansen <jensj@google.com >
Commit-Queue: Johnni Winther <johnniwinther@google.com >
2019-11-21 14:36:30 +00:00
Johnni Winther
4c8c44ec78
[cfe] Implement lowering for constructor initialization of late fields
...
Change-Id: Ia6187c3eac630a2bd4351868aadfaa8771648830
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125821
Commit-Queue: Johnni Winther <johnniwinther@google.com >
Reviewed-by: Jens Johansen <jensj@google.com >
2019-11-21 09:36:35 +00:00
Dmitry Stefantsov
f692a2fbb8
[cfe] Eliminate Nullability.legacy in transformers
...
Nullability.legacy is replaced with an appropriate invocation of a
method on Library to retrieve the appropriate nullability. Only
transformers in pkg/kernel and pkg/front_end are affected. The
inference transformers are excluded from the scope of this CL.
Change-Id: I691c4343def913388a1277227b760fd7e1aa194c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125666
Reviewed-by: Johnni Winther <johnniwinther@google.com >
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com >
2019-11-21 09:12:05 +00:00
Jens Johansen
2e32972929
[pkg/vm] Remove usage of Library.isExternal
...
Change-Id: I014184e2324ab0379653cb8c23cb7eed52677aeb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124985
Commit-Queue: Jens Johansen <jensj@google.com >
Reviewed-by: Alexander Markov <alexmarkov@google.com >
Reviewed-by: Johnni Winther <johnniwinther@google.com >
2019-11-21 08:36:54 +00:00
Kallen Tu
aa2b3a5eaa
[cfe] Inference constraint solving takes contravariance into account.
...
Implements https://github.com/dart-lang/language/issues/658 .
Change-Id: I28857c40bbc5db76f7312ed540052fed40dac4b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125552
Commit-Queue: Kallen Tu <kallentu@google.com >
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com >
Reviewed-by: Leaf Petersen <leafp@google.com >
2019-11-21 00:05:18 +00:00
Johnni Winther
246b23e5be
[cfe] Implement late lowering for local variables.
...
Change-Id: I18f848561f7eca61f662f8083f7ca1451a8a0b3d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125605
Commit-Queue: Johnni Winther <johnniwinther@google.com >
Reviewed-by: Jens Johansen <jensj@google.com >
2019-11-20 08:30:18 +00:00
Johnni Winther
195dd200ab
[cfe] Support statement replacement in inference_visitor
...
Change-Id: Ib4cfbab9478eda43ad9f6271511120c782349440
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125603
Reviewed-by: Jens Johansen <jensj@google.com >
2019-11-20 08:30:18 +00:00
Jens Johansen
fae6affeea
[CFE] Incremental compiler has experimental invalidation strategy (first checkpoint)
...
This CL adds an option to the incremental compiler that enables an experiment
invalidation strategy that only rebuilds bodies for changed libraries (if possible).
As far as we know, for valid applications this should work fine, although,
applications with errors in them (or where the changed libraries have errors in them)
might not issue those errors correctly.
Known caveats:
- Doesn't work on dill library builders (aka if you load from dill we
still have to invalidate transitively).
- Only body-in-brace-changes --- cannot add new private members for
instance, nor changed fields.
- It doesn't track which bodies has changed so there's room for
improvement in regards to for instance mixin stuff where we bail
if a class from an invalidated file is used as a mixin.
- Offsets for methods, for instance, isn't updated
- Any errors issued at the outline stage won't be issued.
Change-Id: I6edf073ec47ea31429479ffe67e2e8b6d2cb80dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124980
Commit-Queue: Jens Johansen <jensj@google.com >
Reviewed-by: Johnni Winther <johnniwinther@google.com >
2019-11-19 13:27:14 +00:00
Dmitry Stefantsov
d9d5fbc109
[cfe] Create TypeParameterTypes with default nullabilities
...
Change-Id: I85be937240ba5cc39840e78f374902c1e36521a0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124327
Reviewed-by: Johnni Winther <johnniwinther@google.com >
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com >
2019-11-19 11:22:43 +00:00
Dmitry Stefantsov
1b295ef956
[cfe] Make nullability parameter of SubtypeTester.futureType required
...
Change-Id: I6be7cda9b976e83e2453dfc1c851efa75eb4fb40
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124326
Reviewed-by: Johnni Winther <johnniwinther@google.com >
2019-11-19 11:22:43 +00:00
Dmitry Stefantsov
203583b41b
[cfe] Account for invalid type being part of a type in subtype check
...
Bug: http://dartbug.com/39421
Change-Id: I9d70f6722134ece7f567d0aab9b6a0d661ea650e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125268
Reviewed-by: Johnni Winther <johnniwinther@google.com >
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com >
2019-11-19 09:42:03 +00:00
Johnni Winther
7c1f58f9fe
[cfe] Demote inferred type variables when used as type arguments
...
Closes #39346
Change-Id: I997347d04e7a3c3cb9786f31cd6c24513307de92
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125502
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com >
Commit-Queue: Johnni Winther <johnniwinther@google.com >
2019-11-18 14:57:43 +00:00
Jens Johansen
043885676c
[CFE] Mark initializer as inferred and don't redo work
...
No reason to do the same work twice.
Change-Id: I8cea469f91dc7087b31bb80352723f0158dcaa6a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125402
Commit-Queue: Jens Johansen <jensj@google.com >
Reviewed-by: Johnni Winther <johnniwinther@google.com >
2019-11-18 13:50:43 +00:00
Jens Johansen
06e6554d2e
[CFE] getFormal via Identifier (name and offset) and not just String (name)
...
Change-Id: I78059e627edaf8876eee74f878b36cfce990b78f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125265
Commit-Queue: Jens Johansen <jensj@google.com >
Reviewed-by: Johnni Winther <johnniwinther@google.com >
2019-11-18 13:48:53 +00:00
Johnni Winther
9e03a639ea
[cfe] Split inferMethodInvocation into invocation variants
...
Change-Id: I4ca0cb419652b4d822d8eb945a77b7243012ed1e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125411
Commit-Queue: Johnni Winther <johnniwinther@google.com >
Reviewed-by: Jens Johansen <jensj@google.com >
2019-11-18 10:03:33 +00:00
Johnni Winther
764926f37d
[cfe] Use BinaryExpression in compounds
...
Change-Id: I82c420bbc2e6d85eef0d602c3993487b78e91f19
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125409
Reviewed-by: Jens Johansen <jensj@google.com >
2019-11-18 10:03:33 +00:00
Jens Johansen
29f127d055
[CFE] Clear initializers unconditionally in prepareInitializers
...
There doesn't appear to be any reason to guard the clearing,
and in a future CL it makes sense for it to always be cleared.
Change-Id: Id75a0ceb51dff474f20ac5aa5a05e56e49c00698
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125401
Reviewed-by: Johnni Winther <johnniwinther@google.com >
Commit-Queue: Jens Johansen <jensj@google.com >
2019-11-18 08:46:13 +00:00
Johnni Winther
4b5589e0cb
Reland "[cfe] Use StaticTypeContext for getStaticType" and more"
...
This relands commits
"[cfe] Use StaticTypeContext for getStaticType"
45033c6ad9
"[cfe] Move caching of thisType to CoreTypes"
fab25cbe0c
"[vm/bytecode] Notify static type context when entering/leaving library"
c9f88ae253
Change-Id: I407d6b0e3b3df503cedc9fcb2c834d835cf083f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125343
Reviewed-by: Sigmund Cherem <sigmund@google.com >
Commit-Queue: Johnni Winther <johnniwinther@google.com >
2019-11-16 05:50:58 +00:00
Erik Ernst
d290f1cec2
Add nonfunction-type-aliases experimental flag
...
Change-Id: I203af5227ecfee8c9e6b0f4985f68e38a18553c0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125203
Commit-Queue: Erik Ernst <eernst@google.com >
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com >
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
2019-11-15 17:04:15 +00:00