mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 01:30:32 +00:00
cfb057ddca
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>
24 lines
751 B
Dart
24 lines
751 B
Dart
// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
// Regression test for b/196606044.
|
|
//
|
|
// Verifies that instance.type.instanceMembers contains 'isNotEmpty'
|
|
// member for a List literal.
|
|
|
|
import 'package:expect/expect.dart';
|
|
import 'dart:mirrors';
|
|
|
|
dynamic object = <int>[1, 2, 3];
|
|
String name = 'isNotEmpty';
|
|
|
|
main() {
|
|
var instance = reflect(object);
|
|
var member = instance.type.instanceMembers[new Symbol(name)];
|
|
Expect.isNotNull(member);
|
|
var invocation = instance.getField(member!.simpleName);
|
|
Expect.isNotNull(invocation);
|
|
Expect.equals(true, invocation.reflectee);
|
|
}
|