This is the "next step" mentioned in
https://dart-review.googlesource.com/c/sdk/+/141240.
`List<UnresolvedType> typeArguments` were dropped (and null was passed)
in several cases in `handleSend`, but they are needed in
BodyBuilder.buildConstructorInvocation in the case where the receiver
of the constructor invocation is a type alias.
This CL ensures that the `typeArguments` are passed when needed, and a
named parameter `isTypeArgumentsInForest` is passed in order to preserve
the information about whether or not they have been to the `forest`.
The CL also adjusts tests '{generic_,}usage_type_variable_*' to fit the
decision made in language issue 848 that a type alias cannot be used
for constructor invocations when it (directly or indirectly) denotes
a type variable.
Change-Id: I8d831457e35a7455f8fcfe461a10872c61555748
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141543
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
This handles (un)assigned state in try-statement that do not
complete normally. In this case we could create a variable model
for an unreachable state that would be both assigned and unassigned
leading to an assertion failure.
Closes#41284
Change-Id: Id4c7689bc7c614338af3542eb342c964696fca1e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141981
Auto-Submit: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
When compiling a big internal app with the NNBD SDK there's a big time
regression. This is a first "poor-mans fix" that "fixes" it via caching
which probably is not the best solution, but does the trick.
Without change
==============
Without NNBD platform:
$ out/ReleaseX64/dart pkg/front_end/tool/_fasta/compile.dart --target=dart2js --platform=out/ReleaseX64/dart2js_platform.dill -v bigapp.dart
[...]
0:00:14.238352: Built class hierarchy in 1663ms.
[...]
0:00:55.871356: Wrote component to bigapp.dart.dill in 5690ms.
With NNBD platform:
$ out/ReleaseX64/dart pkg/front_end/tool/_fasta/compile.dart --target=dart2js --platform=out/ReleaseX64NNBD/dart2js_platform.dill -v bigapp.dart
[...]
0:04:41.842548: Built class hierarchy in 268716ms.
[...]
0:05:22.120455: Wrote component to bigapp.dart.dill in 5407ms.
So: Big regression; it takes almost 4.5 minutes to built the class
hierarchy and almost as long extra to compile as a whole.
With change
===========
Without NNBD platform:
$ out/ReleaseX64/dart pkg/front_end/tool/_fasta/compile.dart --target=dart2js --platform=out/ReleaseX64/dart2js_platform.dill -v bigapp.dart
[...]
0:00:15.255893: Built class hierarchy in 2175ms.
[...]
0:00:55.203753: Wrote component to bigapp.dart.dill in 5306ms.
So: Without the NNBD platform there's basically no change.
With NNBD platform:
$ out/ReleaseX64/dart pkg/front_end/tool/_fasta/compile.dart --target=dart2js --platform=out/ReleaseX64NNBD/dart2js_platform.dill -v bigapp.dart
[...]
0:00:15.864901: Built class hierarchy in 2574ms.
[...]
0:00:55.640201: Wrote component to bigapp.dart.dill in 5363ms.
So: With the NNBD platform, the speedup is significant and there's basically no
change between using the NNBD platform or not.
Change-Id: I74993710a34f08f69421b03f2682ff8418af7599
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141982
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Including the library name/uri in types and member names makes these
unreadable in most cases. This changes that default toStringInternal
to omit the library name/uri but supports a verbose mode that includes
the library name/uri for debugging the rare occasions where they matter.
Change-Id: I783e8bd0ac5d2f19c3051e8e7f226b240c8d1bc8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141546
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Generalize `TypeAliasBuilder.unaliasDeclaration` such that it takes
an argument `typeArguments` and uses that to handle the case where
a type alias application ultimately expands to a type variable (e.g.,
with `typedef F<X> = X`, `F<int>` expands to `int`), and also to
emit a compile-time error in the case where such a type alias is
used to invoke a constructor or invoke/tear-off a static member.
Next step: Pass `List<UnresolvedType> typeArguments` from `handleSend`
to `finishSend` etc. to `BodyBuilder.buildConstructorInvocation`,
which seems to be a somewhat larger refactoring; needed in order to
make `generic_usage_class_test` pass. Some other fix is needed in
order to make `generic_usage_type_variable_test` pass.
Change-Id: Icd3593f03c6348c50b1ec3d7c9676f1bd7c56daf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141240
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
If calling an opt-in method from opt-out we would use the opt-in
parameter types as type context for the arguments leading to
opt-in inference in opt-out libraries. With this change the
callee type is legacy erased before inference when the invocation
is in an opt-out library.
Closes#41180
Change-Id: I55a0a4f055f500652c154c020a175fe12892abb9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140861
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
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>
This doesn't reduce the technical debt of having the whitelist in the
first place, but it correctly treats those tests as being opted out.
This doesn't address "compiler/dartdevc_native". That one's a little
harder because it contains a mixture of NNBD and legacy libraries. We
might want to put "@dart=2.7" tags in there for the legacy ones. I'll
look into that in a separate CL.
But this should at least get the CFE handling some more of the tests
correctly.
Change-Id: I4db0d671ac097eba27bfbeedb296a8526043622a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139868
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>