dart-sdk/tests/language
Paul Berry 0d636e5543 Ensure that partial inference results aren't refined by later partial inference stages.
As part of the implementation of
https://github.com/dart-lang/language/issues/731 (improved inference
for fold etc.), I expanded the front end's type inference logic so
that instead of just having a downward phase and an upward phase, it
could have 3 or more phases.  The function that previously did
downward inference became repurposed to do "partial inference" (which
could either be the first, downward stage, or a later, horizontal
stage).  However, I failed to generalize the logic that prevents types
assigned by one inference stage from being refined by later
stages--previously this logic was only needed for upward inference,
but now it's needed for horizontal inference stages as well.  (This
logic is needed because of Dart's "runtime checked covariance"
behavior--it means that we want to stick with the type from downward
inference, even if a later horizontal inference stage is able to find
a more precise type, because that more precise type may lead to
runtime failures).

As part of this change I've re-architected the inference methods so
that they are responsible for creating and returning the list of
inferred types.  This makes the inference logic more similar between
the front end and analyzer, and is easier to read IMHO.  The total
number of list allocations is the same as before.

Change-Id: I19bfcede9c2968e50f110b571164549f16495217
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243707
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-05-10 15:10:44 +00:00
..
abstract [test] Replace non-implemented @DontInline() annotations 2021-07-26 13:22:31 +00:00
accessor_conflict Migrate language_2/accessor_conflict to NNBD. 2020-02-04 09:52:03 +00:00
argument Make update_static_error_tests work on Windows (again) 2020-09-10 06:21:13 +00:00
assert [dart2js] Support AssertInitializer in dart2js 2021-03-05 09:14:37 +00:00
assign Remove 'checked mode' from checked_mode_compile_time_errors 2020-07-31 19:20:58 +00:00
async [vm] New async/await implementation in the VM, part 2 - vm 2022-04-29 01:03:50 +00:00
async_nested Migrate language_2/async_nested to NNBD. 2020-02-12 20:46:37 +00:00
async_star Reland "[vm] Fix some async* semantics issues: Only run generator if there's active subscription (not paused/cancelled)" 2022-04-26 12:01:34 +00:00
await [vm] New async/await implementation in the VM, part 2 - vm 2022-04-29 01:03:50 +00:00
bool Fix context type for conditionals of conditional expressions. 2022-01-24 01:25:38 +00:00
call Add test about evaluation order 2022-04-08 17:44:18 +00:00
canonicalize Migrate language_2/canonicalize to NNBD. 2020-03-31 00:42:49 +00:00
cascade Analyzer: do not report an undefined getter with an empty name 2020-12-05 14:39:03 +00:00
class [cfe] Add UnresolvedKind for fine grained unresolved reporting 2021-08-25 09:51:54 +00:00
closure Restore function object equality related tests 2021-08-06 15:31:19 +00:00
compile_time_constant Enable by default the experiment flags for the 2.17 language features 2022-03-04 01:08:01 +00:00
const Enable by default the experiment flags for the 2.17 language features 2022-03-04 01:08:01 +00:00
const_functions [cfe] Report all compile-time errors found during constant evaluation 2021-08-24 11:42:53 +00:00
constants_2018 Adjust test to allow type variable as expression 2021-09-28 10:24:05 +00:00
constructor [cfe] Handle tear-offs of patched constructors 2022-04-25 15:50:47 +00:00
control_flow_collections Simplify asyncExpectThrows and enhance Expect.throws. 2022-01-06 17:06:47 +00:00
covariant Add tests about covariant parameters and inherited methods 2021-09-01 23:47:47 +00:00
covariant_override Migrate language_2/covariant_override to NNBD. 2020-04-02 19:04:39 +00:00
deferred [vm] Remove support for non-bare AOT snapshots 2021-11-24 13:03:52 +00:00
double Move errors from StaticWarningCode to CompileTimeErrorCode. 2020-07-26 04:19:25 +00:00
double_literals Migrate language_2/double_literals to NNBD. 2020-04-04 00:20:37 +00:00
dynamic [cfe] Refactor TypeBuilders 2022-03-28 18:22:50 +00:00
enum Roll dart_style 2.2.2 into the repo. 2022-03-04 13:06:42 +00:00
exception Make tests not assume catch(e) gives e type dynamic. 2020-05-05 09:57:23 +00:00
export [test] Fix bug in export/duplicate_import_libd 2021-06-30 07:44:52 +00:00
extension_methods [cfe] Add UnresolvedKind for fine grained unresolved reporting 2021-08-25 09:51:54 +00:00
external_abstract_fields [cfe] Implemenet abstract fields errors 2020-07-20 12:05:54 +00:00
factory [cfe] Add UnresolvedKind for fine grained unresolved reporting 2021-08-25 09:51:54 +00:00
field [dart2wasm] Initialize the function class early. 2022-03-18 17:44:57 +00:00
final Flow analysis: ensure that not-yet-declared variables aren't marked as captured. 2022-01-11 15:42:04 +00:00
function Issue 46062. Report TYPE_ALIAS_CANNOT_REFERENCE_ITSELF on the name of the alias. 2021-05-19 15:45:21 +00:00
function_subtype [tests] Add nested function subtype test 2021-09-21 19:16:37 +00:00
function_type Migrate language_2/function_type to NNBD. 2020-05-05 01:38:43 +00:00
generic Adjust typedef_test, cf. SDK issue #47561 2021-11-04 09:13:03 +00:00
generic_methods Remove references to constructor-tearoff experiment. 2021-11-11 14:04:43 +00:00
getter Fix reporting of INSTANCE_ACCESS_TO_STATIC_MEMBER from within an extension. 2021-10-17 06:22:30 +00:00
identifier [cfe] Refactor TypeBuilders 2022-03-28 18:22:50 +00:00
identity Migrate language_2/identity to NNBD. 2020-05-15 18:05:02 +00:00
if Migrate language_2/if to NNBD. 2020-05-15 16:00:12 +00:00
if_null [cfe] Add UnresolvedKind for fine grained unresolved reporting 2021-08-25 09:51:54 +00:00
implicit_creation Fix typos 2022-04-28 12:53:43 +00:00
implicit_downcast_during Reland "Flow analysis: promote to non-nullable on initialization" 2020-10-07 13:14:55 +00:00
import [cfe] Add UnresolvedKind for fine grained unresolved reporting 2021-08-25 09:51:54 +00:00
inference [cfe] Use combined member signature in override inference in legacy code 2020-12-09 17:33:20 +00:00
inference_update_1 Ensure that partial inference results aren't refined by later partial inference stages. 2022-05-10 15:10:44 +00:00
initializing_formal Move codes from StaticTypeWarningCode into CompileTimeErrorCode. 2020-07-27 16:44:15 +00:00
instance [cfe] Add UnresolvedKind for fine grained unresolved reporting 2021-08-25 09:51:54 +00:00
instantiate_to_bound master branch to main 2021-09-15 06:22:23 +00:00
interceptor Migrate language_2/interceptor to NNBD. 2020-05-26 16:04:15 +00:00
interface [cfe] Add UnresolvedKind for fine grained unresolved reporting 2021-08-25 09:51:54 +00:00
invalid_returns Move codes from StaticTypeWarningCode into CompileTimeErrorCode. 2020-07-27 16:44:15 +00:00
is Rename is{Strong,Weak}Mode to has{Sound,Unsound}NullSafety 2020-11-05 14:26:53 +00:00
label [parser] Add beforeSynthetic to SyntheticStringToken 2021-08-30 11:56:30 +00:00
lazy [tests/nnbd] Fix tests/language/lazy/static8_test 2020-07-17 20:27:07 +00:00
least_upper_bound Add test for upper bound with greatest closure 2021-01-21 08:51:53 +00:00
library [gardening] Fix env_test/has_mirror_support. 2022-01-14 23:33:11 +00:00
list [parser] More specific error messages when recovering new/const/Map/Set/List with said literals 2021-03-25 13:27:03 +00:00
loop Migrate language_2/loop to NNBD. 2020-05-29 23:48:57 +00:00
main [cfe] Report errors in invalid main declarations 2020-10-05 14:37:33 +00:00
malbounded Migrate language_2/malbounded to NNBD. 2020-06-03 01:17:26 +00:00
malformed [cfe] Refactor TypeBuilders 2022-03-28 18:22:50 +00:00
map [js_runtime] Use custom hashCode for GeneralConstantMap 2021-07-16 22:58:02 +00:00
metadata [cfe] Refactor detection of instance type variable access in static context 2021-10-05 11:58:04 +00:00
method [cfe] Add UnresolvedKind for fine grained unresolved reporting 2021-08-25 09:51:54 +00:00
mixin [ddc] Ensure mixin class is emitted before use 2021-11-12 19:21:52 +00:00
mixin_constructor_forwarding Add test for mixin application constructor forwarding of default values. 2020-06-12 16:36:40 +00:00
mixin_declaration Migrate language_2/mixin_declaration to NNBD. 2020-06-10 01:09:45 +00:00
named_arguments_anywhere Roll dart_style 2.2.2 into the repo. 2022-03-04 13:06:42 +00:00
new [cfe] Add UnresolvedKind for fine grained unresolved reporting 2021-08-25 09:51:54 +00:00
nnbd Remove references to constructor-tearoff experiment. 2021-11-11 14:04:43 +00:00
no_such_method Migrate language_2/no_such_method to NNBD. 2020-06-03 17:15:10 +00:00
nonfunction_type_aliases Expire experiments released in earlier stable versions. 2021-11-11 08:28:31 +00:00
nosuchmethod_forwarding Rename some more incorrectly named tests. 2021-06-03 00:49:54 +00:00
null Rename is{Strong,Weak}Mode to has{Sound,Unsound}NullSafety 2020-11-05 14:26:53 +00:00
null_aware add test that repros issue #47338 2021-09-30 18:14:44 +00:00
number [cfe] Add UnresolvedKind for fine grained unresolved reporting 2021-08-25 09:51:54 +00:00
operator Deprecate IntegerDivisionByZeroException. 2021-10-19 16:07:52 +00:00
optimize [test] Replace non-implemented @DontInline() annotations 2021-07-26 13:22:31 +00:00
override Move codes from StaticTypeWarningCode into CompileTimeErrorCode. 2020-07-27 16:44:15 +00:00
parameter [Analyzer] Report EXTRA_POSITIONAL_ARGUMENTS and EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED against first unmatched argument 2021-01-11 18:46:26 +00:00
part Migrate language_2/part to NNBD. 2020-06-08 23:16:55 +00:00
prefix [cfe] Add UnresolvedKind for fine grained unresolved reporting 2021-08-25 09:51:54 +00:00
private [cfe] Add UnresolvedKind for fine grained unresolved reporting 2021-08-25 09:51:54 +00:00
propagate Migrate language_2/propagate to NNBD. 2020-06-08 23:36:46 +00:00
redirecting [cfe] Use effective target in redirecting factory tear off lowering 2022-03-08 13:11:53 +00:00
reg_exp Migrate language_2/reg_exp to NNBD. 2020-06-09 18:45:33 +00:00
regress [dart2js] Compute the correct selector for InstanceGetterInvocation 2022-03-01 08:55:17 +00:00
resolution Migrate language_2/resolution to NNBD. 2020-06-09 00:44:05 +00:00
return Migrate language_2/return to NNBD. 2020-06-09 16:31:44 +00:00
rewrite Move codes from StaticTypeWarningCode into CompileTimeErrorCode. 2020-07-27 16:44:15 +00:00
script Delete unused files in test folders. 2021-05-19 08:05:05 +00:00
set_literals [tests] Add const-big-set-literal test 2020-10-20 11:07:23 +00:00
setter Do not report BODY_MIGHT_COMPLETE_NORMALLY for setters 2021-09-08 16:07:13 +00:00
spread_collections Front end: Fix follow-on error arising from ill-typed spread element. 2021-03-04 15:52:57 +00:00
stack_trace Reland "[vm/compiler] Move AssertAssignables out of closure bodies." 2020-11-18 22:42:31 +00:00
static [ddc] Adding support for static setters of const fields 2022-04-01 23:51:15 +00:00
string [parser-ish] Better errors on invalid unicode escapes 2022-03-17 13:57:45 +00:00
subtyping_static Migrate language_2/subtyping_static to NNBD. 2020-06-15 20:53:55 +00:00
super Enable by default the experiment flags for the 2.17 language features 2022-03-04 01:08:01 +00:00
superinterface_variance Migrate language_2/superinterface_variance to NNBD. 2020-06-25 20:21:42 +00:00
switch Move errors from StaticWarningCode to CompileTimeErrorCode. 2020-07-26 04:19:25 +00:00
symbol Move codes from StaticTypeWarningCode into CompileTimeErrorCode. 2020-07-27 16:44:15 +00:00
sync_star [VM] Fixes yield* exception handling in sync*. 2020-10-27 06:46:27 +00:00
syntax Migrate language_2/syntax to NNBD. 2020-06-18 22:54:13 +00:00
this Analyzer: do not report an undefined getter with an empty name 2020-12-05 14:39:03 +00:00
top_level Delete unused files in test folders. 2021-05-19 08:05:05 +00:00
type [cfe] Check primitive equals in legacy libraries 2022-02-10 22:13:14 +00:00
type_object Remove references to constructor-tearoff experiment. 2021-11-11 14:04:43 +00:00
type_promotion Move codes from StaticTypeWarningCode into CompileTimeErrorCode. 2020-07-27 16:44:15 +00:00
type_variable [cfe] Refactor detection of instance type variable access in static context 2021-10-05 11:58:04 +00:00
typedef Remove references to constructor-tearoff experiment. 2021-11-11 14:04:43 +00:00
unsorted [test] Replace non-implemented @DontInline() annotations 2021-07-26 13:22:31 +00:00
value_class [cfe] Add Jenkins SMI hashcode combiner 2020-09-07 12:36:13 +00:00
variable Report fewer duplicate errors for invalid superinitializers 2021-11-08 18:53:42 +00:00
variance Fix analyzer implementation of the "variance" feature. 2022-03-10 15:56:35 +00:00
vm [vm/field_guards] Ensure that field guard updates are done with stopped mutators. 2022-03-10 17:16:05 +00:00
void master branch to main 2021-09-15 06:22:23 +00:00
why_not_promoted Rename some more incorrectly named tests. 2021-06-03 00:49:54 +00:00
analysis_options.yaml [tests] Add analysis options file to migrated test directories 2020-03-16 20:51:26 +00:00
await_type_error_test.dart Analyzer: Don't do recursive flattening of FutureOr in await. 2020-01-28 11:16:07 +00:00
await_type_test.dart Analyzer: Don't do recursive flattening of FutureOr in await. 2020-01-28 11:16:07 +00:00
dynamic_type_helper.dart Migrate language_2/function to NNBD. 2020-04-25 01:53:20 +00:00
explicit_type_instantiation_parsing_test.dart Remove references to constructor-tearoff experiment. 2021-11-11 14:04:43 +00:00
language.status [VM/tests] issue/45618 - Avoid large outputs from tests 2021-05-26 06:04:01 +00:00
language_analyzer.status Update all Slow tests to be Slow, Pass. 2020-02-01 00:17:42 +00:00
language_dart2js.status Add a language test to check situations where implicit call tearoff does not occur. 2022-02-15 16:37:50 +00:00
language_dart2wasm.status [dart2wasm] Initial commit for the Dart-to-WasmGC compiler. 2022-02-16 11:11:14 +00:00
language_dartdevc.status [tests] Remove triple shift test skips from status files 2021-03-19 02:32:34 +00:00
language_kernel.status Reland "[vm] Remove --causal-async-stacks flag" 2021-07-02 14:26:46 +00:00
language_precompiled.status [SDK] Removes non-exiting tests from .status 2021-02-04 06:46:13 +00:00
language_spec_parser.status [SDK] Removes non-exiting tests from .status 2021-02-04 06:46:13 +00:00
language_vm.status Move files under language_2 into subdirectories. 2019-12-11 19:18:00 +00:00
library1.dart Migrate language_2/function to NNBD. 2020-04-25 01:53:20 +00:00
library2.dart Migrate language_2/function to NNBD. 2020-04-25 01:53:20 +00:00
library10.dart Migrate language_2/function to NNBD. 2020-04-25 01:53:20 +00:00
library11.dart Migrate language_2/function to NNBD. 2020-04-25 01:53:20 +00:00
library12.dart Migrate language_2/function to NNBD. 2020-04-25 01:53:20 +00:00
static_type_helper.dart [test] Fix constructor tear off tests in language 2021-07-23 08:41:09 +00:00
syntax_helper.dart Additional language tests for parsing behaviors around type arguments. 2021-05-18 14:06:13 +00:00