Commit graph

91 commits

Author SHA1 Message Date
Alexander Markov 24b8399086 [tests] Avoid small --optimization-counter-threshold in tests
Small --optimization-counter-threshold makes tests very slow,
especially on architectures where kernel service runs from
kernel and not from app-jit snapshot.

TEST=change in tests, *-ia32 bots
Fixes https://github.com/dart-lang/sdk/issues/48627

Change-Id: I63e7e201ef9a0e4f645016c39a5be1819b61822d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/263421
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2022-10-10 21:04:18 +00:00
Daco Harkes 1f1f7dbe08 [test] Skip FFI native in invocation_fuzz_test
TEST=tests/lib/mirrors/invocation_fuzz_test.dart

Closes: https://github.com/dart-lang/sdk/issues/48672

Change-Id: Ib9d189a78c6bfe63378be04cfdcb80761fe0b52f
Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-nnbd-linux-release-simarm-try,vm-kernel-nnbd-linux-release-simarm64-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-nnbd-linux-debug-simarm_x64-try,vm-kernel-precomp-nnbd-linux-release-simarm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239021
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2022-03-28 10:00:32 +00:00
Nate Bosch 33e174084a Replace Uri.scheme == with Uri.isScheme
Use `hasScheme` in place of comparing against the empty string, and
`isScheme` to compare against all other schemes.

TEST=No behavior changes.

Change-Id: Ifc9fd13c6cf37933ebd4a754c4b500dedbcb291b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231185
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
2022-02-08 21:38:57 +00:00
Alexander Aprelev 56403a0d35 [vm/sendandexit] Introduce Isolate.exit([port, message]).
This exits current isolate immediately. If [port] is provided, then [message] is verified and sent out as isolate exits.

TEST=ci
Fixes https://github.com/dart-lang/sdk/issues/47164

Change-Id: I513f4d7ceb5d74820f4aee60f5799b7b5193f2e4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214312
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2021-09-30 20:20:24 +00:00
Paul Berry f5a3bce734 Fix scope resolution of metadata on type parameters
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>
2021-08-17 15:17:02 +00:00
Alexander Markov cfb057ddca Reland "[vm] Hide internal implementation List types and expose them as List"
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>
2021-08-16 22:52:21 +00:00
Lasse R.H. Nielsen 83376bf1ee Add Object.hash and Object.hashAll static helper methods.
Fixes #11617.

Bug: http://dartbug.com/11617
Change-Id: Id06fb5b3914bee24713427edbd3b9b7e86f86449
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/73360
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2021-06-25 11:40:35 +00:00
Regis Crelier 1f55b7ca10 Reland "[VM/runtime] Refactor the representation of type parameters in the VM."
This is a reland of 8a21ab195a

Original change's description:
> [VM/runtime] Refactor the representation of type parameters in the VM.
>
> This introduces a new VM internal class 'TypeParameters' representing the declaration of a list of type parameters, either in a class or function.
> The reference to (or use of) a type parameter is still represented by the existing 'TypeParameter' class.
>
> Fixes https://github.com/dart-lang/sdk/issues/43901
> Fixes https://github.com/dart-lang/sdk/issues/45763
>
> TEST=existing ones and a regression test
>
> Change-Id: I1fde808bf753cc1cb829f2c4383c1836651cee80
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189942
> Commit-Queue: Régis Crelier <regis@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>

This fixes https://github.com/dart-lang/sdk/issues/45911

TEST=existing ones and a regression test

Change-Id: I709d38b1df3d73fe3c9796d5aca3cbbdcf77fd38
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/198380
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2021-05-05 23:43:14 +00:00
Michal Terepeta c6bffaf19e Revert "[VM/runtime] Refactor the representation of type parameters in the VM."
This reverts commit 8a21ab195a.

Reason for revert: Test failure: http://b/187227619

Original change's description:
> [VM/runtime] Refactor the representation of type parameters in the VM.
>
> This introduces a new VM internal class 'TypeParameters' representing the declaration of a list of type parameters, either in a class or function.
> The reference to (or use of) a type parameter is still represented by the existing 'TypeParameter' class.
>
> Fixes https://github.com/dart-lang/sdk/issues/43901
> Fixes https://github.com/dart-lang/sdk/issues/45763
>
> TEST=existing ones and a regression test
>
> Change-Id: I1fde808bf753cc1cb829f2c4383c1836651cee80
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189942
> Commit-Queue: Régis Crelier <regis@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>

TBR=rmacnak@google.com,alexmarkov@google.com,regis@google.com,sstrickl@google.com

Change-Id: If12caa1a84cb6d1c1b8225589f3c994d25abb120
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/198282
Reviewed-by: Michal Terepeta <michalt@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Michal Terepeta <michalt@google.com>
2021-05-05 10:03:57 +00:00
Regis Crelier 8a21ab195a [VM/runtime] Refactor the representation of type parameters in the VM.
This introduces a new VM internal class 'TypeParameters' representing the declaration of a list of type parameters, either in a class or function.
The reference to (or use of) a type parameter is still represented by the existing 'TypeParameter' class.

Fixes https://github.com/dart-lang/sdk/issues/43901
Fixes https://github.com/dart-lang/sdk/issues/45763

TEST=existing ones and a regression test

Change-Id: I1fde808bf753cc1cb829f2c4383c1836651cee80
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189942
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2021-05-04 15:47:01 +00:00
Leaf Petersen b101a7d002 Add language versions to _2 test libraries
Change-Id: Ib33169c3e0ffc870915c189404074a1dea472546
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196548
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Leaf Petersen <leafp@google.com>
2021-04-26 17:58:57 +00:00
Regis Crelier b3bca1821c [VM/runtime] Decouple representation of function signatures from Function objects.
This fixes issue https://github.com/dart-lang/sdk/issues/43088

This CL improves on https://dart-review.googlesource.com/c/sdk/+/166920 by keeping the names of type parameters.

See go/dart-vm-signatures for motivation for this change.

TEST=existing suites

Change-Id: Ia82f1d322f72d07b2fb253cf914f9b868025c71e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176981
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2021-01-07 23:45:37 +00:00
Alexander Markov 89ee3c8e2a [test] Fix lib/mirrors/library_uri_io_test to pass when running not from source
This test was assuming that Platform.script would be equal to library
URI, but this is not the case when running from a dill file or a
snapshot.

Change-Id: I0ff2249b5b5301d6463ceca48097df7cb64e78b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167501
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-10-14 00:54:17 +00:00
Brian Wilkerson 41a884315f Clean up uses of @virtual in tests
The annotation has no semantics related to these tests, and the tests
will be cleaner without the extra code.

Change-Id: I0f31a30af624d2af707eae3003acb09a742bef3f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152612
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-06-26 20:33:55 +00:00
Michael Thomsen 8d65076f18 Change terms to be more divisive
Based on guidance in https://developers.google.com/style/

Related to https://github.com/dart-lang/sdk/issues/42247

Change-Id: Ia4edb2cb0540781f1119c369406a7b65553e26f6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150632
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Michael Thomsen <mit@google.com>
2020-06-10 17:14:37 +00:00
Ryan Macnak e7c6a72760 [test] Update use of Null as a bottom type to Never.
Change-Id: Ied7176bf9bd1dafeb2b6e7e764361d2e1b1f460e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141363
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-03-27 19:49:22 +00:00
Ryan Macnak 8ed772d37f Reland "[vm] Fix some further mirror breaks with frontend NNBD checks enabled."
Without loadLibrary()! changes.

Change-Id: I78806547ac62fa806e99eb2d5e3f2041f20ce942
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139404
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-03-13 17:11:52 +00:00
Ryan Macnak 42e6cf4967 Revert "[vm] Fix some further mirror breaks with frontend NNBD checks enabled."
This reverts commit daf91f56b9.

Reason for revert: Analyzer and CFE disagree

Original change's description:
> [vm] Fix some further mirror breaks with frontend NNBD checks enabled.
> 
> Change-Id: I3c52dac2244c1f7eae59d85bc637cce2cbb3faa9
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139302
> Reviewed-by: Régis Crelier <regis@google.com>
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

TBR=rmacnak@google.com,asiva@google.com,regis@google.com

Change-Id: I2f13dac7f2d7441f8db61543261ca28f500b8adc
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139319
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-03-12 22:41:41 +00:00
Ryan Macnak daf91f56b9 [vm] Fix some further mirror breaks with frontend NNBD checks enabled.
Change-Id: I3c52dac2244c1f7eae59d85bc637cce2cbb3faa9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139302
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-03-12 20:58:56 +00:00
Nate Bosch 9d76737487 Remove support for --emit-metadata in DDC
This flag is unused and the behavior it enables was only useful along with
`dart:mirrors`.

- Remove the flag and the field on the options object.
- Prune code branches that are no longer reachable.
- Remove or inline some functions that became either empty or trivially small.
- Remove the manual check for a `dart:mirrors` import since this is handled by
  the CFE now.
- Remove references to the flag in tests.
- Remove test files which only existed to enable the flag for other tests.

Change-Id: I21bf594271fb4eeb5b73fcbf07da736e9e8d1f33
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138018
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
Auto-Submit: Nate Bosch <nbosch@google.com>
2020-03-05 23:26:13 +00:00
Robert Nystrom 0d34bf5571 Remove another one of the unittest-like libraries.
This one was literally only used for a single test. :-/

Change-Id: I316e17ecaf9a839b3c6f27ec86971a67ab52bbfb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135782
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2020-02-13 23:36:13 +00:00
Ryan Macnak 0fde59b21d [vm] Further mirrors and test fixes.
Bug: https://github.com/dart-lang/sdk/issues/40497
Change-Id: Ieed8a51600f92fa4dc9137bf1f4ed58bb4cfa598
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134900
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-02-10 20:58:05 +00:00
Ryan Macnak 439cabaec0 [test] Changes to mirrors tests to make them more Dart 3 compatible.
These changes are not sufficient by themselves, but the subset that can still run in Dart 2.

Bug: https://github.com/dart-lang/sdk/issues/40045
Change-Id: Ie8f61fc9ee94b85329a701f97b5d3f91dbc1f889
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132422
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2020-01-22 01:30:05 +00:00
Ryan Macnak 7295841073 [test] Remove dart2js tests of MirrorsUsed. Remove MirrorsUsed annotations for all tests.
Remove tests using both dart:mirrors and dart:html.

Bug: https://github.com/dart-lang/sdk/issues/40045
Change-Id: Ib0fcaab497fee6c18460199ae2db18451408b015
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132740
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-01-22 00:06:24 +00:00
asiva a551c507bd [VM] Implement name demangling of extension methods.
Change-Id: Id64ae1aa0de89260b6bf2d6f40260a0dc9ef5c16
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121000
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2019-10-14 20:40:09 +00:00
asiva b12bed36a8 [VM] Implement isExtensionMember in MethodMirror and VariableMirror
Added ability to recognize a MethodMirror to be a mirror of an extension member
Added ability to recognize a VariableMirror to be a mirror of a static
extension field.

Change-Id: I56715a491bba0d8cafb2796ebb755bd339e147c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120760
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2019-10-09 00:27:30 +00:00
Ryan Macnak 39ff937afa [vm] Rename _LocalXMirror to _XMirror.
Remote mirrors ended up being implemented as the service protocol instead of a Dart API.

Change-Id: I03b6c92d6acdde28e7b55044d98e075f5a1fe57e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109321
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-09-18 20:28:25 +00:00
Alexander Markov 2e34231c8e [vm] Do not mirror default values of parameters of abstract methods
In bytecode mode default values are part of the method body, which is
omitted for abstract methods.

In anticipation for this future change, default values of parameters of
abstract methods are no longer available through dart:mirrors.

Please also see https://github.com/dart-lang/sdk/issues/38464

Change-Id: I47742b588690ea96cb3ca636ff86e4e042bfe5a2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117299
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-09-18 20:12:50 +00:00
Alexander Markov 1017a562d7 [vm/bytecode] Fix crash while querying parameter descriptors for static implicit closure
Fixes https://github.com/dart-lang/sdk/issues/38035

Change-Id: Ib060a0b43ff0ca85d984642e9faca8fd966a1e62
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114634
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-08-28 02:26:33 +00:00
Ryan Macnak d08c203e30 Add various missing argument checks to dart:io natives.
Avoid reflective access to mirrors creating invalid reflectees.

Change type checks in embedding API functions to return UnhandledExceptionErrors instead of APIErrors so they are catchable by Dart.

Fixes invocation_fuzz_test.

Bug: https://github.com/dart-lang/sdk/issues/15274
Bug: https://github.com/dart-lang/sdk/issues/23869
Bug: https://github.com/dart-lang/sdk/issues/37680
Change-Id: Ife3e3cb894c59620b0318e4e08947a3d1d45bab9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110620
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-08-01 23:32:40 +00:00
Ryan Macnak 938d3be958 Revert "Add various missing argument checks to dart:io natives."
This reverts commit ba72890aa7.

Reason for revert: Crash in bytecode modes

Original change's description:
> Add various missing argument checks to dart:io natives.
> 
> Change type checks in embedding API functions to return UnhandledExceptionErrors instead of APIErrors so they are catchable by Dart.
> 
> Fixes invocation_fuzz_test.
> 
> Bug: https://github.com/dart-lang/sdk/issues/15274
> Bug: https://github.com/dart-lang/sdk/issues/23869
> Change-Id: Ia6103e7ffceda897e475c1a3ba534c2f4b910475
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110020
> Commit-Queue: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Siva Annamalai <asiva@google.com>

TBR=sortie@google.com,rmacnak@google.com,asiva@google.com

Change-Id: Ib52ec03caf4b177cd91bb1d366df51588bf23177
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/15274, https://github.com/dart-lang/sdk/issues/23869
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110580
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-07-25 19:18:23 +00:00
Ryan Macnak ba72890aa7 Add various missing argument checks to dart:io natives.
Change type checks in embedding API functions to return UnhandledExceptionErrors instead of APIErrors so they are catchable by Dart.

Fixes invocation_fuzz_test.

Bug: https://github.com/dart-lang/sdk/issues/15274
Bug: https://github.com/dart-lang/sdk/issues/23869
Change-Id: Ia6103e7ffceda897e475c1a3ba534c2f4b910475
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110020
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-07-25 16:40:04 +00:00
Ryan Macnak 9fe8865f4a [vm, bytecode] Implement ParameterMirror and enable mirror tests.
In particular, mirrors_reader_test no longer crashes.

Change-Id: I602e7d85755dafd943fe84d20831f0f35484b387
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108968
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-07-25 00:04:02 +00:00
Sigmund Cherem fb29d0e96d Move async_minitest to package:async_helper.
This allows to break a circular dependency between package:expect and

package:async_helper, which will simplify the support for modular tests using
package:modular_test.
Change-Id: Ie48723d3f35d51a8fbe622e0158450e8104fe3f5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102140
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-05-10 19:43:58 +00:00
Liam Appelbe 223eaa6fbb Report noSuchMethod forwarders as synthetic in the mirror api
Fixes http://dartbug.com/34982

Bug: http://dartbug.com/34982
Change-Id: I0302586c5f0e58dd66e238bd32088ebe1c150c0e
Reviewed-on: https://dart-review.googlesource.com/c/93124
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2019-02-14 18:42:19 +00:00
Ben Konyi fbe3b1ebc0 Reland "[ VM / Mirrors ] Added type checking to enforce strong mode semantics when using dart:mirrors"
Was reverted to temporarily fix issue #35009 for 2.1.

This reverts commit 65ffd0f7190f04dd0a8f94b7941e1ab706b0b084.

Change-Id: I71fe094b24f882cd942634557c9c43af06058842
Reviewed-on: https://dart-review.googlesource.com/c/83226
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-11-06 23:59:29 +00:00
Ben Konyi 9c95624a63 Temporary revert to fix issue #35009 for 2.1. package:rpc relies on mirrors behaviour that is not valid for Dart 2, so these type checks cause the package to crash.
Revert "[ VM / Mirrors ] Added type checking to enforce strong mode semantics when using dart:mirrors"

This reverts commit 9f00eec55b.

Change-Id: I82ce07d388ba9402f20caf700815b39c9bc418f6
Reviewed-on: https://dart-review.googlesource.com/c/83225
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2018-11-06 23:59:11 +00:00
Ben Konyi 9f00eec55b [ VM / Mirrors ] Added type checking to enforce strong mode semantics when using dart:mirrors
Fixes issue #32232

Change-Id: Id6c9ea8e72bb66c77a2817f20c33bb405cb4c310
Reviewed-on: https://dart-review.googlesource.com/c/79081
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Auto-Submit: Ben Konyi <bkonyi@google.com>
2018-10-13 16:27:40 +00:00
Daniel Hillerström de984e58cb Type checking for redirecting factories.
Implements static semantics for redirecting factories (c.f. §10.6.2 of
the specification). This CL does not include inference of actual type
arguments on redirectees, that is it does not handle the case where
type arguments have been omitted on the redirectee as in this
following example program:

  class A<T> {
    factory A() = B;
  }
  class B<T> implements A<T> {
    B();
  }

Closes https://github.com/dart-lang/sdk/issues/32988.

Also resolves the second part of
https://github.com/dart-lang/sdk/issues/30579.

Can possibly also close https://github.com/dart-lang/sdk/issues/11578.

Change-Id: I5f1fb60510ba6cdc917321239819c1f817b5b85d
Reviewed-on: https://dart-review.googlesource.com/74580
Commit-Queue: Daniel Hillerström <hillerstrom@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2018-09-19 06:20:20 +00:00
Aske Simon Christensen f8a96b88e9 It is an error if a final field is not initialized.
Bug: https://github.com/dart-lang/sdk/issues/33022

This commit adds an error when a final field is not initialized at all
(and there is at least one generative constructor). A later commit
will add an error for the case where a field is initialized by some,
but not all, generative constructors.

A number of classes in the Dart2js and DDC support libraries use
uninitialized final fields to indicate getters in the corresponding
native classes. This commit adds a temporary whitelist for the
affected files, which can be removed when the fields have been
replaced by external getters.

This is tracked by https://github.com/dart-lang/sdk/issues/33762

Change-Id: I6b5cee230c7cd5554da2b61da7ebddb6b0b9396e
Reviewed-on: https://dart-review.googlesource.com/63781
Reviewed-by: Daniel Hillerström <hillerstrom@google.com>
2018-08-17 12:37:52 +00:00
Lasse R.H. Nielsen b1eeacc30a Remove usage of unittest package from a number of tests.
Add simplified unittest replacement to package:expect.
(It is used in multi-tests, so it needs to be in an accessible place without using ".." in its path).

Change-Id: I60aa212ed67ffbdda17ca18fce1cdff16237f4fe
Reviewed-on: https://dart-review.googlesource.com/65700
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Jenny Messerly <jmesserly@google.com>
2018-07-20 13:26:38 +00:00
asiva c6f55f7478 [VM] Use the incremental compiler to compile sources only when the observatory
server is started.

When the incremental compiler is used it accumulates state that
increases the footprint of the process. This state is needed only
when the 'reload' or 'expression evaluation' functionality is used
in the debugger.

Currently in the VM we do not have a good way of detecting when the
debugger will be used as the vm service observatory functionality
can be turned on dynamically after the program has started.

This CL turns on the incremental compiler only when command line options
are used to start the observatory server. We could run into issues with
'expression evaluation' when the observatory is started dynamically after
the program is loaded.

Change-Id: I18c17698622071bca428018f7fdac1a84b0f195e
Reviewed-on: https://dart-review.googlesource.com/64667
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2018-07-13 23:28:51 +00:00
Alexander Markov f885a0c8f3 [vm/kernel] Fix crash when reading symbol literal from Dart annotation
Fixes https://github.com/dart-lang/sdk/issues/33513

Change-Id: I1595409dd3faa363922d595c1c33e6acce92af74
Reviewed-on: https://dart-review.googlesource.com/61800
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-06-22 00:22:13 +00:00
Alexander Aprelev f2883d1b4f Fix test error message expectation on Windows.
This fixes buildbot failure:
```
Running "vm" command: set DART_CONFIGURATION=ReleaseX64 & pkg\vm\tool\dart2.bat --sync-async --ignore-unrecognized-flags --packages=C:\b\s\w\ir\.packages C:\b\s\w\ir\out\ReleaseX64\generated_tests\lib_2\mirrors\initializing_formals_test_none.dart
FAILED: dartk-vm release_x64 lib_2/mirrors/dynamic_load_test
Expected: Pass
Actual: RuntimeError
--- Command "vm" (took 03.000953s):
set DART_CONFIGURATION=ReleaseX64 & pkg\vm\tool\dart2.bat --sync-async --ignore-unrecognized-flags --packages=C:\b\s\w\ir\.packages C:\b\s\w\ir\tests\lib_2\mirrors\dynamic_load_test.dart
exit code:
255
stdout:
IsolateMirror on 'dynamic_load_test.dart:main()'
LibraryMirror on 'dynamic_load_success'
InstanceMirror on 1
InstanceMirror on 2
LibraryMirror on 'dynamic_load_success'
InstanceMirror on 3
InstanceMirror on 4
tests/lib_2/mirrors/DOES_NOT_EXIST: Error: The system cannot find the file specified.
stderr:
Unhandled exception:
Expect.isTrue(false) fails.
#0      Expect._fail (package:expect/expect.dart:605:5)
#1      Expect.isTrue (package:expect/expect.dart:133:5)
#2      main (file:///C:/b/s/w/ir/tests/lib_2/mirrors/dynamic_load_test.dart:45:10)
<asynchronous suspension>
#3      _startIsolate.<anonymous closure> (dart:isolate/runtime/libisolate_patch.dart:279:19)
#4      _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:165:12)
--- Re-run this test:
python tools/test.py -m release -c dartk --strong --output-directory C:\b\s\w\iodxgot1 lib_2/mirrors/dynamic_load_test
Done dartk-vm release_x64 lib_2/mirrors/dynamic_load_test: fail
```

Change-Id: Ib042899894ab903bc6c21fc3600a5b5b83916f4d
Reviewed-on: https://dart-review.googlesource.com/58521
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2018-06-05 17:33:29 +00:00
Alexander Markov 6b71414296 [Test status] Update status of several triaged lib_2/mirrors tests
Change-Id: Ie90688ea7a9fd95a939c87b4c619213b74c904c1
Reviewed-on: https://dart-review.googlesource.com/58422
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-06-05 16:24:09 +00:00
Alexander Markov 5bfe8d454e [vm/kernel] Set active class when evaluating Dart annotations, take 2
In 4fb0c60938
active class was set in StreamingDartTypeTranslator, but it turns out
this is not enough. This CL sets active class in StreamingFlowGraphBuilder;
all dependent helper objects should pick it automatically.

Fixes https://github.com/dart-lang/sdk/issues/33259

Change-Id: If16afff35de32cbdba23f6260dac0e0fd7e9786a
Reviewed-on: https://dart-review.googlesource.com/57524
Reviewed-by: Samir Jindel <sjindel@google.com>
2018-06-04 19:05:33 +00:00
Ryan Macnak c30af41b96 Reapply "[mirrors] Add IsolateMirror.loadUri."
- Forward only kImportTag requests to DFE. This restores the current handling of a kScriptTag request when loading the kernel isolate in the simulators.
 - Mark dynamic_load_test as failing in the reload stress tests (reload fails to preserve library identity).

Change-Id: Ibe6f0a3505b99736a38d566abf3b2151505d7a7e
Reviewed-on: https://dart-review.googlesource.com/56706
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-05-29 22:01:01 +00:00
Ryan Macnak de545b4079 Revert "[mirrors] Add IsolateMirror.loadUri."
This reverts commit ad4cfa0260.

Reason for revert: Assertion failures on DBC

Original change's description:
> [mirrors] Add IsolateMirror.loadUri.
> 
> This allows a programmer to dynamically load code into an isolate. The closest existing API is Isolate.spawnUri, but communication with the dynamically loaded code in that case is limited to asynchronous message passing of JSON-like objects.
> 
> Change-Id: Icb23e9dacfb0035622c119f11d4e0f892ba2ccd1
> Reviewed-on: https://dart-review.googlesource.com/45363
> Reviewed-by: Zach Anderson <zra@google.com>

TBR=rmacnak@google.com,zra@google.com,asiva@google.com,kmillikin@google.com

Change-Id: I80669188b9f40b3b527e8e268ade0d0d514a8753
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/56640
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-05-24 20:03:40 +00:00
Ryan Macnak ad4cfa0260 [mirrors] Add IsolateMirror.loadUri.
This allows a programmer to dynamically load code into an isolate. The closest existing API is Isolate.spawnUri, but communication with the dynamically loaded code in that case is limited to asynchronous message passing of JSON-like objects.

Change-Id: Icb23e9dacfb0035622c119f11d4e0f892ba2ccd1
Reviewed-on: https://dart-review.googlesource.com/45363
Reviewed-by: Zach Anderson <zra@google.com>
2018-05-24 17:07:15 +00:00
Alexander Markov 4fb0c60938 [vm/kernel] Set active class when evaluating Dart annotations
Without active class, kernel reader is not able to finalize types
and fails to parse type literals.

Fixes https://github.com/dart-lang/sdk/issues/33173

Change-Id: Iefe7f33a371f3d4f892f21f8ea0060d70887186c
Reviewed-on: https://dart-review.googlesource.com/56242
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-05-23 16:17:55 +00:00