dart-sdk/tests/web
Nate Biggs 9eba05482b [dart2js] Fix list tracing treating first/last setters as type preserving.
I suspect that when the list of type preserving selectors was created the first/last setters either didn't exist or were just overlooked. Any dynamic List could have its inferred type changed by these operations.

Due to Dart2js's type representation this bug affects more than just dynamic lists. We track some simple values as part of the type system. So an operation that modifies a value can technically modify the type, as Dart2js represents it, even if the "real" type is preserved.

In the added test we would represent the list literal's type as "List(length: 2, elementType: Bool(true))". Notice the type states the elementType is specifically true, not just bool. Thus the first/last operations are modifying that type. But since we aren't registering this type change, SSA optimizes away the call/index and inlines the element itself.

Interestingly, this primarily manifested for bools due to a check in SSA:
https://github.com/dart-lang/sdk/blob/main/pkg/compiler/lib/src/ssa/optimize.dart#L475

In that code we are inlining constant-like expressions for the arguments of static invocations (such as the argument to a Expect.isTrue call). However, a few lines earlier you will see we only inline bool constants:
https://github.com/dart-lang/sdk/blob/main/pkg/compiler/lib/src/ssa/optimize.dart#L467

So when the list element type is anything other than a bool, this inlining does not trigger thus avoiding the bug.

Bug: https://github.com/dart-lang/sdk/issues/53944
Change-Id: I4e893903f335fc99b13cf526736c27bb066a4bad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/334420
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2023-11-08 03:50:21 +00:00
..
deferred Spelling tests web 2023-01-05 01:26:52 +00:00
internal [tests, dart2js] Fix test using minified type names 2023-10-27 01:36:28 +00:00
native [tests] Cleanup .__proto__ use in native tests 2023-10-11 20:37:57 +00:00
regress [dart2js] Fix list tracing treating first/last setters as type preserving. 2023-11-08 03:50:21 +00:00
supermixin [flip-modifiers]: opt out failing ddc tests from class modifiers 2023-03-02 20:27:25 +00:00
wasm [dart2wasm] Use only JS strings in JSCM 2023-10-31 12:58:26 +00:00
assert_with_message_test.dart
assertions_disabled_test.dart [test_runner] Unify name for passing DDC options 2023-02-14 20:13:57 +00:00
assertions_enabled_test.dart [dart2js] Automatically set dart.web.assertions_enabled=true. 2023-02-14 01:35:05 +00:00
async_helper.dart
async_stacktrace_test.dart
await_non_future_test.dart Reland "[dart2js] Add runtime type check for await." 2023-08-09 23:17:18 +00:00
big_allocation_expression_test.dart
block_expression_on_field_test.dart
bound_closure_interceptor_methods_test.dart Remove superfluous words. 2023-01-30 15:58:38 +00:00
bounded_type_literal_test.dart [tests, dart2js] Fix test using minified type names 2023-10-27 01:36:28 +00:00
bounds_check1a_test.dart
bounds_check1b_test.dart
bounds_check2a_test.dart
bounds_check2b_test.dart
bounds_check3a_test.dart
bounds_check3b_test.dart
bounds_check3c_test.dart
bounds_check4a_test.dart
bounds_check4b_test.dart
bounds_check_test.dart
break_test.dart
call_is_function_test.dart
call_signature_test.dart
call_uninlined_test.dart
cfe_instance_constant_test.dart
checked_setter_test.dart
class_hierarchy_extends_clause_test.dart
closure2_test.dart
closure3_test.dart Remove uses of : as default value separator in some tests/ directories. 2022-09-07 14:49:17 +00:00
closure4_test.dart
closure5_test.dart Remove uses of : as default value separator in some tests/ directories. 2022-09-07 14:49:17 +00:00
closure6_test.dart Remove uses of : as default value separator in some tests/ directories. 2022-09-07 14:49:17 +00:00
closure7_test.dart Remove uses of : as default value separator in some tests/ directories. 2022-09-07 14:49:17 +00:00
closure_capture2_test.dart
closure_capture3_test.dart
closure_capture4_test.dart
closure_capture5_test.dart
closure_capture6_test.dart
closure_capture7_test.dart
closure_capture_test.dart
closure_signature_unneeded_test.dart
closure_test.dart
code_motion_exception_test.dart [js_runtime] NullError always reports as a failed null check 2023-09-01 00:05:09 +00:00
compile_time_constant4_test.dart
compound_operator_index_test.dart
conditional_rewrite_test.dart
conditional_send_test.dart
conditional_test.dart
conflict_index_test.dart
consistent_add_error_test.dart
consistent_codeUnitAt_error_test.dart
consistent_index_error_array_test.dart
consistent_index_error_string_test.dart
consistent_index_error_typed_list_test.dart
consistent_null_add_error_test.dart
consistent_subtract_error_test.dart
consistent_type_error_test.dart
constant_fold_number_dart2_j_s_test.dart
constant_folding2_test.dart
constant_folding_test.dart
constant_javascript_semantics2_test.dart
constant_javascript_semantics3_test.dart
constant_javascript_semantics_test5.dart Remove uses of : as default value separator in some tests/ directories. 2022-09-07 14:49:17 +00:00
constant_truncate_test.dart
crash_library_metadata.dart
data_uri_test.dart
deferred_fail_and_retry_lib.dart
deferred_fail_and_retry_test.dart [dart2js] Fix failing web/deferred_fail_and_retry_test on d8 platform. 2023-06-27 18:25:30 +00:00
deferred_function_types1_test.dart [web] fix improperly migrated tests. 2023-10-25 15:37:50 +00:00
deferred_function_types2_test.dart [web] fix improperly migrated tests. 2023-10-25 15:37:50 +00:00
deferred_function_types3_test.dart [web] fix improperly migrated tests. 2023-10-25 15:37:50 +00:00
deferred_function_types4_test.dart [web] fix improperly migrated tests. 2023-10-25 15:37:50 +00:00
deferred_function_types5_test.dart [web] fix improperly migrated tests. 2023-10-25 15:37:50 +00:00
deferred_function_types6_test.dart [web] fix improperly migrated tests. 2023-10-25 15:37:50 +00:00
deferred_function_types7_test.dart [web] fix improperly migrated tests. 2023-10-25 15:37:50 +00:00
deferred_function_types8_test.dart [web] fix improperly migrated tests. 2023-10-25 15:37:50 +00:00
deferred_function_types_lib1.dart [web] fix improperly migrated tests. 2023-10-25 15:37:50 +00:00
deferred_function_types_lib2.dart [web] fix improperly migrated tests. 2023-10-25 15:37:50 +00:00
deferred_inheritance_lib1.dart
deferred_inheritance_lib2.dart
deferred_inheritance_test.dart Remove obsolete internal dart2js annotations 2021-08-04 23:27:18 +00:00
deferred_split_lib1.dart
deferred_split_lib2.dart
deferred_split_test.dart
deferred_tearoff_load_library_lib.dart
deferred_tearoff_load_library_test.dart
deferred_with_cross_origin_lib.dart
deferred_with_cross_origin_test.dart
deferred_with_csp_nonce2_test.dart
deferred_with_csp_nonce_lib.dart
deferred_with_csp_nonce_test.dart
do_test.dart
dynamic_bounds_check_test.dart
dynamic_generic_method_resolution_test.dart [ddc] Attaching default type arg member signatures to JS native types. 2023-06-07 17:57:26 +00:00
dynamic_invocation_test.dart
dynamic_type_literal_test.dart
effectively_constant_fields_test.dart
effectively_constant_instance_field_test.dart
empty_method_test.dart
eof_line_ending_test.dart
equals_test.dart
expose_this1_test.dart
expose_this2_test.dart
field_access_test.dart
field_in_constructor_test.dart
field_initializer_test.dart
fields_test.dart
first_class_types_hashcode_test.dart
fixed_type_argument_implements_test.dart
fixed_type_argument_test.dart
foo7_test.dart
for_in_test.dart
for_test.dart
function_parameters_test.dart
function_typed_arguments_test.dart
generator_elided_parameter_test.dart Remove uses of : as default value separator in some tests/ directories. 2022-09-07 14:49:17 +00:00
generic_bounds_test.dart
generic_class_is_test.dart
generic_in_mixin_field_test.dart [flip-modifiers]: prep dart2js language tests for class modifiers flag flip 2023-03-02 19:09:45 +00:00
generic_in_redirect_test.dart
generic_in_super_test.dart
generic_instantiation1_test.dart
generic_instantiation2_test.dart
generic_instantiation3_test.dart
generic_instantiation4_test.dart
generic_method_dynamic_is_test.dart
generic_method_dynamic_type_test.dart
generic_method_static_is_test.dart
generic_type_error_message_test.dart
generics_factories_test.dart
generics_is_check1_test.dart
getter_element_test.dart
getters_setters_test.dart
hash_code_test.dart
identical_trace_test.dart
if_in_loop_test.dart
if_method_call_test.dart [dart2js] Rename issue-specific tests. 2022-03-09 22:18:27 +00:00
if_null2_test.dart
if_null3_test.dart
if_null_test.dart
if_test.dart
index_test.dart
indirect_type_literal_test.dart
inference_super_set_call_test.dart
inferrer_is_int_test.dart [test] Replace non-implemented @DontInline() annotations 2021-07-26 13:22:31 +00:00
injected_cast_test.dart
inline_generic_test.dart
inline_position_crash_source.dart
inline_position_crash_test.dart
instantiation_stub_2_test.dart
instantiation_stub_test.dart
int_index_test.dart
interceptor_named_arguments_test.dart
interface_type_optimization_test.dart
invalid_annotation_test.dart
invoke_dynamic_test.dart
is_check_instanceof_test.dart
is_operator_test.dart
js_array_index_error_test.dart Spelling tests web 2023-01-05 01:26:52 +00:00
js_array_removeLast_error_test.dart
js_array_sort_default_test.dart
js_interop_cast_test.dart
js_interop_implements_test.dart
js_interop_no_elide_optional_arg_test.dart
js_interop_optional_arg_test.dart
js_interop_test.dart
js_trust_types_disallowed_test.dart [package:js] Add @trustTypes annotation. 2022-04-20 15:24:18 +00:00
jsinterop_test.dart [dart2js] Add phase 1 kernel transformer to simplify const conditionals. 2023-02-07 20:07:57 +00:00
label_test.dart
late_field_checks_common.dart [dart2js] late annotations with context 2022-07-20 06:04:34 +00:00
late_field_checks_lib_check.dart [dart2js] late annotations with context 2022-07-20 06:04:34 +00:00
late_field_checks_lib_none.dart [dart2js] late annotations with context 2022-07-20 06:04:34 +00:00
late_field_checks_lib_trust.dart [dart2js] late annotations with context 2022-07-20 06:04:34 +00:00
late_field_checks_test.dart [dart2js] late annotations with context 2022-07-20 06:04:34 +00:00
late_initializers_1_test.dart
late_initializers_2_test.dart
late_narrowing_test.dart [dart2js] Improve type inference for createSentinel. 2021-09-13 21:59:20 +00:00
late_no_inlining_test.dart [dart2js] Add regression test for https://dart-review.googlesource.com/c/sdk/+/225320 2022-05-10 22:56:23 +00:00
lax_runtime_type_closure_equals1_test.dart
lax_runtime_type_closure_equals2_test.dart
lax_runtime_type_closure_equals3_test.dart
lax_runtime_type_closure_equals4_test.dart
lax_runtime_type_closure_equals5_test.dart
lax_runtime_type_closure_equals6_test.dart
lax_runtime_type_closure_equals7_test.dart
lax_runtime_type_closure_equals8_test.dart
lax_runtime_type_closure_to_string3_test.dart
lax_runtime_type_closure_to_string4_test.dart
lax_runtime_type_closure_to_string5_test.dart
lax_runtime_type_closure_to_string6_test.dart
lax_runtime_type_equals1_test.dart
lax_runtime_type_equals2_test.dart
lax_runtime_type_equals3_test.dart
lax_runtime_type_equals4_test.dart
lax_runtime_type_instantiate_to_string_test.dart [tests, dart2js] Fix test using minified type names 2023-10-27 01:36:28 +00:00
LayoutTests_fast_mediastream_getusermedia_t01_test.dart
list_factory_test.dart
list_generate_1_test.dart
list_generate_2_test.dart
literal_string_juxtaposition_test.dart
literals_test.dart
local_function_call2_test.dart
local_function_call_test.dart
local_function_generic_strong_test.dart
local_function_signatures_strong_test.dart
local_function_signatures_test.dart
local_signature_test.dart
locals_test.dart
logical_and_test.dart
logical_or_test.dart
loop_if_phi_test.dart
many_constants_test.dart Remove uses of : as default value separator in some tests/ directories. 2022-09-07 14:49:17 +00:00
many_fields_test.dart [flip-modifiers]: prep dart2js language tests for class modifiers flag flip 2023-03-02 19:09:45 +00:00
many_instantiations_test.dart
map_to_set_test.dart
math_lib_prefix_test.dart
math_lib_test.dart
member_namespace_test.dart
method_signatures_strong_test.dart
method_signatures_test.dart
minus_zero2_test.dart
minus_zero_test.dart
mixin_subtype_test.dart [flip-modifiers]: prep dart2js language tests for class modifiers flag flip 2023-03-02 19:09:45 +00:00
mixin_type_variable_test.dart [flip-modifiers]: prep dart2js language tests for class modifiers flag flip 2023-03-02 19:09:45 +00:00
multi_global_def_single_instantiation_test.dart
named_mixin_runtime_type_test.dart [flip-modifiers]: prep dart2js language tests for class modifiers flag flip 2023-03-02 19:09:45 +00:00
named_parameter_for_static_test.dart
named_parameter_test.dart
nan_index_test.dart [dart2js, js_runtime, js_dev_runtime] NaN-safe range checks. 2021-08-27 00:37:56 +00:00
nan_negate_test.dart
new_from_env_test.dart
no_such_method_strong1_test.dart
no_such_method_strong2_test.dart
no_such_method_strong3_test.dart
no_such_method_strong4_test.dart
no_such_method_strong5_test.dart
no_such_method_strong6_test.dart
no_such_method_strong7_test.dart
no_such_method_strong8_test.dart
no_such_method_strong9_test.dart
no_such_method_strong10_test.dart
no_such_method_strong11_lib.dart
no_such_method_strong11_test.dart
no_such_method_strong12_test.dart Remove uses of : as default value separator in some tests/ directories. 2022-09-07 14:49:17 +00:00
no_such_method_test.dart
non_jsinterop_test.dart [dart2js] Add phase 1 kernel transformer to simplify const conditionals. 2023-02-07 20:07:57 +00:00
non_trivial_substitution_test.dart
not_equals_test.dart
not_test.dart
null_stacktrace_test.dart
null_test.dart
operator2_test.dart
operator3_test.dart
operator_equals_test.dart
operator_test.dart
optional_parameter_test.dart
panda_lib.dart
panda_test.dart
phi_elimination_test.dart
phi_gvn_test.dart
phi_test.dart
record_numbers_test.dart [test] Adding tests for records with web semantics for numerics. 2023-05-25 23:45:25 +00:00
recursive_metadata_test.dart
replaced_type_variable_test.dart
return_setter_test.dart
round_constant_folding_test.dart
rti_need_for_closure_signature_test.dart
rti_need_for_runtime_type_test.dart
runtime_type_closure_equals1_test.dart
runtime_type_closure_equals2_test.dart
runtime_type_closure_equals3_test.dart
runtime_type_closure_equals4_test.dart
runtime_type_closure_equals5_test.dart
runtime_type_closure_equals6_test.dart
runtime_type_closure_equals7_test.dart
runtime_type_closure_equals8_test.dart
runtime_type_equals1_test.dart
runtime_type_equals2_test.dart
runtime_type_equals3_test.dart
runtime_type_equals4_test.dart
runtime_type_equals5_test.dart
runtime_type_equals6_test.dart
runtime_type_equals7_test.dart
runtime_type_equals8_test.dart
runtime_type_int_test.dart
runtime_type_test.dart
runtime_type_to_string1_test.dart
scope_info_field_loop_test.dart [dart2js] Rename issue-specific tests. 2022-03-09 22:18:27 +00:00
send_test.dart
simple_string_constant_test.dart
source_mapping_crash_source.dart
source_mapping_crash_test.dart
static_field2_test.dart
static_field_test.dart
static_method2_test.dart
static_method_test.dart
static_var_no_initializer_test.dart
static_var_test.dart
string_escape_test.dart
string_interpolation_dynamic_test.dart
string_interpolation_opt1_test.dart
string_interpolation_test.dart
super_call_test.dart
super_constructor1_test.dart
super_constructor2_test.dart
switch_equals_test.dart [flip-patterns] Enable "records" and "patterns" experiment flags. 2023-03-10 20:02:23 +00:00
switch_test.dart [flip-patterns] Fix web switch tests. 2023-03-09 01:13:09 +00:00
sync_star_element_rti_need_test.dart
tear_off_types_test.dart
this_phi_elimination_test.dart
this_redirecting_constructor_test.dart
this_test.dart
throw1_test.dart
throw2_test.dart
timer_test.dart
to_string_test.dart
truncation_errors_test.dart
type_argument_factory_crash_test.dart
type_argument_factory_nocrash_test.dart
type_argument_optimization_test.dart
type_error_message_test.dart
type_literal2_test.dart
type_literal_test.dart
typevariable_factory_test.dart
typevariable_substitution_test.dart
typevariable_typedef_test.dart
unconditional_dartio_import_test.dart
unused_generator_type_parameter_test.dart [dart2js] Rename issue-specific tests. 2022-03-09 22:18:27 +00:00
unused_local_const_test.dart
useful_error_message_1_test.dart
weak_reference_polyfill_test.dart [js_runtime] Polyfill WeakReference and Finalizer for ancient browsers 2023-11-03 22:15:38 +00:00
weak_reference_test.dart Spelling pkg dev compiler 2023-01-26 09:12:41 +00:00
web.status [js_runtime] Polyfill WeakReference and Finalizer for ancient browsers 2023-11-03 22:15:38 +00:00
while_test.dart