* This message should only be reported by the parser; the
error raised in the analyzer was strictly duplicate.
* This message theoretically used to mention "async*" or
"sync*" depending on the modifier that the function in
question listed. However, listing one modifier or the
other is a red herring, and may confuse the user; any
function declared with one or the other is a "generator",
and the error applies equally to a "generator" using one
or the other modifier.
Bug: https://github.com/dart-lang/sdk/issues/43665
Change-Id: I6ef1f5c055473170e7563222f6f0a6c56a4ad5f5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210801
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
The 'File' object created in the async file open method is leaked
if the operation is not completed when the isolate shuts down
with an unhandled exception.
This change adds a finalizable state for the 'File' object so that
the message deletion that happens when ports are closed could run
the callback to clean up the 'File' object.
TEST=new tests added
Change-Id: I4a3cb28370d27306c795c1914aeb5c18a1d85e2b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210761
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
On one hand this is less precise, OTOH this tells which feature and
the language version it requires.
Change-Id: I1d24a2d7cf2c7b7ca305d5bfc9f094fce0734bc4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210644
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Previously, when encountering identifiers in metadata on a class's
type parameter, the analyzer would resolve them using the type
parameter scope, but then fall back on using implicit `this`. The CFE
would resolve them using the class body scope. In both cases, the end
result was that the annotation could refer to static class members.
This change brings the behavior of both the analyzer and the CFE in
line with the spec, by preventing the use of implicit `this` in these
annotations, and resolving them in the type parameter scope.
This is not expected to break any code in practice, because
annotations on type parameters are rare, as are annotations referring
to static class members, and the overlap between these two should be
negligibly small.
Fixes https://github.com/dart-lang/language/issues/1790.
Bug: https://github.com/dart-lang/language/issues/1790
Change-Id: Ibe5a421e04a53d29074a8b1509e1390658ed72e5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210040
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
This is a reland of 824bec596f
Original change's description:
> [vm] Hide internal implementation List types and expose them as List
>
> When taking a type of an instance with x.runtimeType we can map
> internal classes _List, _ImmutableList and _GrowableList to a
> user-visible List class. This is similar to what we do for
> implementation classes of int, String and Type.
> After that, result of x.runtimeType for built-in lists would be
> compatible with List<T> type literals.
>
> Also, both intrinsic and native implementations of _haveSameRuntimeType
> are updated to agree with new semantic of runtimeType.
>
> TEST=co19/LanguageFeatures/Constructor-tear-offs/type_literal_A01_t01
> TEST=runtime/tests/vm/dart/have_same_runtime_type_test
>
> Fixes https://github.com/dart-lang/sdk/issues/46893
> Issue https://github.com/dart-lang/sdk/issues/46231
>
> Change-Id: Ie24a9f527f66a06118427b7a09e49c03dff93d8e
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210066
> Commit-Queue: Alexander Markov <alexmarkov@google.com>
> Reviewed-by: Tess Strickland <sstrickl@google.com>
TEST=co19/LanguageFeatures/Constructor-tear-offs/type_literal_A01_t01
TEST=runtime/tests/vm/dart/have_same_runtime_type_test
TEST=lib/mirrors/regress_b196606044_test
Fixes https://github.com/dart-lang/sdk/issues/46893
Issue https://github.com/dart-lang/sdk/issues/46231
Change-Id: I79b587540338808bd73a6554f00a5eed042f4c26
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210201
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
[co19_2] LibTests/typed_data tests skipped for dart2js
Change-Id: I2e8a93f7991b36367b84678bbfebda36babaf96f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209915
Reviewed-by: Erik Ernst <eernst@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Add missing checks for FFI types disallowed in isolate messages.
Align error messages with the other serializer and test expectations.
TEST=ci
Change-Id: I3813dd8f26e5122524bdf41f9ce6e0785fdd260b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209840
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
language/covariant/type_parameter_test.dart performed a tearoff which
should incur a run-time error (because the dynamic type of the
tearoff is not a subtype of the static type, so it would be a
soundness violation to pass that value on to the next step of
evaluation).
Change-Id: Ia4ec813606e711cab0bdcc68d24bbac3c9a2d8c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209910
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
This CL changes the test
language/generic_methods/explicit_instantiated_tearoff_test.dart
such that it no longer expects a generic instantiation of a local
function tearoff to be notEqual to another function object which is
the same local function, same enclosing invocation, same type
arguments.
The rationale is that we should not preclude an optimization whereby
these function objects are canonicalized (at run time, or if they
can be lifted to the top level even possibly at compile time).
Change-Id: I5845a19ce9ccf931c4d3abe4ab619f3ed2a2fbc4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209860
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
This should handle all cases of constructor reference w/ explicit type
args; there aren't too many cases:
* named and unnamed constructors
* referencing class and referencing type alias
* prefixed class names and not-prefixed
* null-aware access (weird)
* bound on type parameter of class, and on type parameter of alias
error cases:
* cascade
* wrong number of type arguments
Bug: https://github.com/dart-lang/sdk/issues/46020
Change-Id: If257eb561a9ad854709b6e9a7d81faa9d084d6ee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209622
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
The instantiation at runtime implies non-constant type expressions
but canonicalization is unspecified so backends should be allowed
to optimize by canonicalizing types.
Change-Id: I2f1cab6ac68a1ce156b15af0b99e02d03b7b3dca
Issue: https://github.com/dart-lang/sdk/issues/46837
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209663
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
The transitive copy algorithm was missing support for [WeakProperty]s,
thereby ensuring that we only copy the values if the keys are reachable.
Furthermore we might need to re-hash [Expando]s - since the copied
objects start with no identity hash codes.
The CL also makes us avoid calling to Dart for each [Expando]
separately and instead use a list - just as we do in the re-hashing of
maps/sets.
We also move the C++ code to invoke rehashing logic into
DartLibraryCalls::*.
Issue https://github.com/dart-lang/sdk/issues/36097
TEST=vm/dart{,_2}/isolates/fast_object_copy{,2}_test
Change-Id: I836745feef8a6d7573faa94e29a19c1eca0c39f2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209106
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Previously the synthetic field that holds the FfiNative
function pointer was injected into the current library.
This change makes sure we instead add the field to the
relevant parent - Class or Library.
TEST=Added regression test for name collision.
Bug: https://github.com/dart-lang/sdk/issues/43889
Change-Id: Ifbf2d70de00e4748c179fe7d626c495675c2b338
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208502
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
We might get different flags on lhs and rhs of a subtype check as
lhs might come from a tear-off which has generic-covariant-impl type
parameters and rhs is a standalone function type.
TEST=language/regress/regress46816_test
Fixes https://github.com/dart-lang/sdk/issues/46816
Change-Id: Ic0f1b4a9fdf0f4c9ae65c8c372d12c1e51ad8050
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209265
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
This CL restores the equality related tests in
tests/language/closure/identity_equality_tearoff_test.dart that we had
in https://dart-review.googlesource.com/c/sdk/+/202243, but removed
in order to finalize language team discussions about equality of
function objects, based on language issue #1712.
Note that these additional test cases do not include any cases involving
tearoffs of extension methods, they will be dealt with separately.
Change-Id: I84daaf91229bd0d0f4c64446bb71cb87f32eedfc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/205081
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Said test expects a raw type literal (e.g., `Direct`) to evaluate to an
instantiation where the type argument is `Object?` (`Direct<Object?>`),
but the type argument is actually chosen by instantiation to bound,
so the resulting type argument is `dynamic` (`Direct<dynamic>`). This
CL adjusts the test to expect `dynamic`.
Bug: https://github.com/dart-lang/sdk/issues/46811
Change-Id: I06af0bf87ccb5e980e88416085921948dd5234d1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209081
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
These annotations have all been replaced with @pragma('dart2js:xxx')
versions:
@ForceInline, @NoInline, @NoThrows, @NoSideEffects, @AssumeDynamic.
Change-Id: Ia4730670c6864ccbe0fa4120108c3c16ab887c23
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208863
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
Replace bogus body created for redirecting factories with a
normal body which calls target factory or constructor and
forwards all arguments. Such a body can be used by back-ends
if they choose to treat redirecting factories as ordinary
factories.
TEST=ci
Fixes https://github.com/dart-lang/sdk/issues/41915
Issue https://github.com/dart-lang/sdk/issues/46231
Change-Id: I62c83bcc9005995e85de049d3d929ca86a75297f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208681
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
The test aliased_constructor_tear_off_test.dart expected torn off
constructors to be unequal even in cases where the same constructor
is torn off and instantiated with the same type argument (albeit a
non-constant type). That equality _should_ hold, and this PR makes
the change needed to give the test that expectation.
The test tear_off_test.dart was adjusted similarly.
Change-Id: I79c8dbd312a393b4f509aa28fc46c06ffc77da5d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208658
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
Extension method closurizations are specified to be unequal unless they
are identical (because the extension itself may have different type
arguments, so it's not enough that it is "the same method").
This CL changes the test
language/generic_methods/explicit_instantiated_tearoff_test.dart
such that its expectations match that property.
Change-Id: Ife31646623099ad5d1b970d0097d37d6b00c5814
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208645
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Removes the lazy loading of the underlying type in LazyJSTypes.
As such, this removes the need to keep AnonymousJSType and
LazyJSType separate, and is therefore refactored to
PackageJSType. Similarly, subtyping is fixed such that
PackageJSTypes are all subtypes of each other.
Change-Id: If489defdbeb5cb932db802a7d146ad2fc393b12c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207982
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reports an error if there are external members in an extension,
where the extension on type is not a JS interop class. A follow
up change will allow extensions with external members on some
Native classes, like dart:html classes.
Change-Id: I01c645aa46e46071aae5f380c5e36329f61d3e18
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207722
Commit-Queue: Riley Porter <rileyporter@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Change-Id: Ie81359c91e39834799cfd8cba0026fe2d0f3b345
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207130
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
We were lacking tests for doing a `null` lookup in const maps and sets.
Also, we were lacking tests for having type literals with user-defined
classes in const maps and sets.
Bug: https://github.com/dart-lang/sdk/issues/45908
Change-Id: I1665420ddcc71df7b47a87ee9e16d7ebbe9e13f5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208080
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Previously, prologue builder omitted loading of delayed type arguments
from closure object in case of inling. This would effectively switch
from using delayed type arguments of an instantiated generic closure to
type arguments passed on the stack (null/all-dynamic if none), which is
not correct.
The fix is to load delayed type arguments from closure object even
in case of inlining.
TEST=tests/language/regress/regress46550_test.dart
Fixes https://github.com/dart-lang/sdk/issues/46550
Change-Id: Ibe50b0bc2ebda1d3638c4940fe9a26cd5ba7ce32
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207704
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
This makes it a compile-time error to add @FfiNative annotation
to any non-static function, such as an instance method.
TEST=tests/ffi/ffi_native_test.dart,pkg/analyzer/test/src/diagnostics/ffi_native_test.dart
Bug: https://github.com/dart-lang/sdk/issues/43889
Change-Id: Ib9ec61345bb47e735ed635c5ceea15ab643f65a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207306
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
Two different const functions should not be identical.
Change-Id: I3974574c8d0cb34b9cf886532c41e1a77ae632a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/206422
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
This will allow running the same test concurrently in multiple isolates
without causing name collisions.
It also aligns the NNBD and non-NNBD test.
TEST=Making test more robust. Fixes one issue in iso-stress builder.
Change-Id: Ic0c15a0f47de8e255d2bdfb96547d44d016b2a72
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207125
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>