Version 2.0.0-dev.38.0
Merge commit '5c90b1fd98e767702357faa561193777527bd9c6' into dev
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2369ad0..fa39c4f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,5 @@
+## 2.0.0-dev.38.0
+
## 2.0.0-dev.37.0
### Tool Changes
diff --git a/docs/language/informal/dynamic-members.md b/docs/language/informal/dynamic-members.md
new file mode 100644
index 0000000..e60c925
--- /dev/null
+++ b/docs/language/informal/dynamic-members.md
@@ -0,0 +1,202 @@
+# Typing of members of dynamic
+
+Author: eernst@.
+
+Version: 0.1 (2018-03-13)
+
+Status: Under discussion.
+
+**This document** is a Dart 2 feature specification of the static typing
+of instance members of a receiver whose static type is `dynamic`.
+
+This document uses discussions in
+[this github issue](https://github.com/dart-lang/sdk/issues/32414)
+as a starting point.
+
+
+## Motivation
+
+For Dart programs using a statically typed style, it is often helpful to
+use the most precise static type for an expression which is still sound.
+In contrast, if such an expression gets type `dynamic` it often causes
+subsequent type computations such as inference to make less useful
+decisions, or it may mask errors which are likely or guaranteed to occur at
+run time. Here is an example:
+
+```dart
+class A {
+ String toString([bool b = true]) =>
+ b ? 'This is an A!' : 'Whatever';
+}
+
+foo(List<String> xs) {
+ for (String s in xs) print(s);
+}
+
+main() {
+ dynamic d = new A();
+ var xs = [d.toString()];
+ foo(xs);
+}
+```
+
+In this example, the actual type argument passed to the list literal
+`[d.toString()]` by inference depends on the static type of the expression
+`d.toString()`. If that expression is given the type `dynamic` (as it would
+be in Dart 1) then the resulting list will be a `List<dynamic>`, and hence
+the invocation of `foo` would fail because it requires an argument of type
+`List<String>`.
+
+In general, a receiver with static type `dynamic` is assumed to have all
+members, i.e., we can make the attempt to invoke a getter, setter, method,
+or operator with any name, and we can pass any list of actual arguments and
+possibly some type arguments, and that will not cause any compile-time
+errors. Various checks may be performed at run time when such an invocation
+takes place, and that is the whole point: Usage of expressions of type
+`dynamic` allows developers to skip the static checks and instead have
+dynamic checks.
+
+However, every object in a Dart program execution has a type which is a
+subtype of `Object`. Hence, for each member declared by `Object`, it will
+either inherit an implementation declared by `Object`, or it will have some
+implementation specified as an override for the declaration in
+`Object`. Given that overriding declarations must satisfy certain
+constraints, we do know something about the properties of a member declared
+in `Object`. This allows static analysis to give static types to some
+expressions which are more precise than `dynamic`, even for a member access
+where the receiver has type `dynamic`, and that is the topic of this
+document.
+
+We will obey the general principle that an instance method invocation
+(including getters, setters, and operators) which would be compiled without
+errors under some typing of the receiver must also be without compile-time
+errors when the receiver has type `dynamic`. It should be noted that there
+is no requirement that the typing relies only on declarations which are in
+scope at the point where the invocation occurs, it must instead be possible
+to _declare_ such a class that the invocation can be statically typed. The
+point in obeying this principle is that dynamic invocation should be
+capable of performing _every_ invocation which is possible using types.
+
+For instance, `d.toString(42)` cannot have a compile-time error when `d`
+has static type `dynamic`, because we could have the following declaration,
+and `d` could have had type `D`:
+
+```dart
+class D {
+ noSuchMethod(Object o) => o;
+ Null toString([int i]) => null;
+}
+```
+
+Similarly, `d.noSuchMethod('Oh!')` would not be a compile-time error,
+because a contravariant type annotation on the parameter as shown above
+would allow actual arguments of other types than `Invocation`.
+
+On the other hand, it is safe to assign the static type `String` to
+`d.toString()`, because that invocation will definitely invoke the
+implementation of `toString` in `Object` or an override thereof, and that
+override must have a return type which is `String` or a subtype (for
+`String` that can only be `Null`, but in general it can be any subtype).
+
+It may look like a highly marginal corner of the language to give special
+treatment to the few methods declared in `Object`, but it does matter in
+practice that a number of invocations of `toString` are given the type
+`String`. Other members like `hashCode` get the same treatment in order to
+have a certain amount of consistency.
+
+Moreover, we have considered generalizing the notion of "the type dynamic"
+such that it becomes "the type dynamic based on `T`" for any given type
+`T`, using some syntax, e.g., `dynamic(T)`. The idea would be that
+statically known methods invoked on a receiver of type `dynamic(T)` would
+receive static checking, but invocations of other methods get dynamic
+checking. With that, the treatment specified in this document (which was
+originally motivated by the typing of `toString`) will suddenly apply to
+any member declared by `T`, where `T` can be any type (that is, any
+declarable member). It is then important to have a systematic approach and
+a simple conceptual "story" about how it works, and why it works like
+that. This document should be a usable starting point for such an approach
+and story.
+
+
+## Static Analysis
+
+In this section, `Object` denotes the built-in class `Object`, and
+`dynamic` denotes the built-in type `dynamic`.
+
+Let `e` be an expression of the form `d.g` where the static type of `d` is
+`dynamic` and `g` is a getter declared in `Object`; if the return type of
+`Object.g` is `T` then the static type of `e` is `T`.
+
+*For instance, `d.hashCode` has type `int` and `d.runtimeType` has type
+`Type`.*
+
+Let `e` be an expression of the form `d.m` where the static type of `d` is
+`dynamic` and `m` is a method declared in `Object` whose method signature
+has type `F` (*which is a function type*). The static type of `e` is then
+`F`.
+
+*For instance, `d.toString` has type `String Function()`.*
+
+Let `e` be an expression of the form `d.m(arguments)` where the static type
+of `d` is `dynamic`, `arguments` is an actual argument list, and `m` is a
+method declared in `Object` whose method signature has type `F`. If the
+number of positional actual arguments in `arguments` is less than the
+number of required positional arguments of `F` or greater than the number
+of positional arguments in `F`, or if `arguments` includes any named
+arguments with a name that is not declared in `F`, the type of `e` is
+`dynamic`. Otherwise, the type of `e` is the return type in `F`.
+
+*So `d.toString(bazzle: 42)` has type `dynamic` whereas `d.toString()` has
+type `String`. Note that invocations which "do not fit" the statically
+known declaration are not errors, they just get return type `dynamic`.*
+
+Let `e` be an expression of the form `d.m<typeArguments>(arguments)` where
+the static type of `d` is `dynamic`, `typeArguments` is a list of actual
+type arguments, `arguments` is an actual argument list, and `m` is a
+method declared in `Object` whose method signature has type `F`. The
+static type of `e` is then `dynamic`.
+
+*We do not need to address the case `d.m(arguments)` where `m` is a getter
+declared in `Object` whose return type is a function type or a supertype
+thereof, because no such getters exist, but such a case would be covered in
+a generalization to support `dynamic(T)` for all `T`. Similarly, such a
+generalization would need to handle the case where the method is generic
+and no type arguments are passed, and the case where the method is
+generic and a wrong number of type arguments is passed, etc. Such a
+generalization is expected to be possible without invalidating the rules
+given in this document.*
+
+For an instance method invocation `e` (including invocations of getters,
+setters, and operators) where the receiver has static type `dynamic` and
+`e` does not match any of the above cases, the static type of `e` is
+`dynamic`.
+
+*Note that it is not possible for an instance method invocation with a
+receiver of type `dynamic` to be a compile-time error (except, of course,
+that some expressions like `x[1, 2]` are syntax errors even though they
+could also be considered "invocations", and except that subexpressions are
+checked separately, and any given actual argument could be a compile-time
+error). In general, any argument list shape could be handled via
+`noSuchMethod`, and an argument of any type could be accepted because any
+formal parameter in an overriding declaration could have its type
+annotation contravariantly changed to `Object`. So it is a natural
+consequence of the principle mentioned in 'Motivation' that a `dynamic`
+receiver admits all instance method invocations.*
+
+
+## Dynamic Semantics
+
+This feature has no implications for the dynamic semantics, beyond the ones
+which are derived directly from the static typing.
+
+*For instance, a list literal may have a run-time type which is determined
+via inference by the static type of its elements, as in the example in the
+'Motivation' section, or the actual type argument may be influenced by the
+typing context, which may again depend on the rules specified in this
+document.*
+
+
+## Revisions
+
+- 0.1 (2018-03-13) Initial version, based on discussions in
+[this github issue](https://github.com/dart-lang/sdk/issues/32414).
diff --git a/docs/language/informal/generalized-void.md b/docs/language/informal/generalized-void.md
index 6b5718a..9c06e31 100644
--- a/docs/language/informal/generalized-void.md
+++ b/docs/language/informal/generalized-void.md
@@ -2,17 +2,15 @@
**Author**: eernst@
+**Version**: 0.9 (2018-02-22)
+
**Status**: Under implementation.
-**This document** is an informal specification of the generalized support
-in Dart 1.x for the type `void`. Dart 2 will have a very similar kind of
-generalized support for `void`, without the function type subtype exception
-that this feature includes for backward compatibility in Dart 1.x. This
-document specifies the feature for Dart 1.x and indicates how Dart 2
-differs at relevant points.
+**This document** is a feature specification of the generalized support
+in Dart 2 for the type `void`.
-**The feature** described here, *generalized void*, allows for using the
-type `void` as a type annotation and as a type argument.
+**The feature** described here, *generalized void*, allows for using
+`void` as a type annotation and as a type argument.
The **motivation** for allowing the extended usage is that it helps
developers state the intent that a particular **value should be
@@ -30,34 +28,34 @@
like `Future<T>` and `Stream<T>`, and it uses `T` as a parameter type of a
callback in the method `then`.
-Note that using the value of an expression of type `void` is not
+Note that using the value of an expression of type void is not
technically dangerous, doing so does not violate any constraints at the
-level of the language semantics. By using the type `void`, developers
+level of the language semantics. By using the type void, developers
indicate that the value of the corresponding expression evaluation is
meaningless. Hence, there is **no requirement** for the generalized void
mechanism to be strict and **sound**. However, it is the intention that the
mechanism should be sufficiently sound to make the mechanism helpful and
non-frustrating in practice.
-No constraints are imposed on which values may be given type `void`, so in
+No constraints are imposed on which values may be given type void, so in
that sense `void` can be considered to be just another name for the type
`Object`, flagged as useless. Note that this is an approximate rule in
Dart 1.x, it fails to hold for function types; it does hold in Dart 2.
The mechanisms helping developers to avoid using the value of an expression
-of type `void` are divided into **two phases**. This document specifies the
+of type void are divided into **two phases**. This document specifies the
first phase.
The **first phase** uses restrictions which are based on syntactic criteria
in order to ensure that direct usage of the value of an expression of type
-`void` is a static warning (in Dart 2: an error). A few exceptions are
+void is a compile-time error. A few exceptions are
allowed, e.g., type casts, such that developers can explicitly make the
choice to use such a value. The general rule is that for every expression
-of type `void`, its value must be ignored.
+of type void, its value must be ignored.
The **second phase** will deal with casts and preservation of
voidness. Some casts will cause derived expressions to switch from having
-type `void` to having some other type, and hence those casts introduce the
+type void to having some other type, and hence those casts introduce the
possibility that "a void value" will get passed and used. Here is an
example:
@@ -88,7 +86,7 @@
type ::= // ENTIRE RULE MODIFIED
typeNotVoid | 'void'
redirectingFactoryConstructorSignature ::=
- 'const'? 'factory' identifier ('.' identifier)?
+ 'const'? 'factory' identifier ('.' identifier)?
formalParameterList `=' typeNotVoid ('.' identifier)?
superclass ::=
'extends' typeNotVoid
@@ -211,7 +209,7 @@
are erased to regular function types during compilation. Hence there is no
need to specify the the typing relations for generic function types. In
Dart 2, the subtype relationship for generic function types follows from
-the rule that `void` is treated as `Object`.*
+the rule that the type void is treated as `Object`.*
Consider a function type _T_ where the return type is the type void. In
Dart 1.x, the dynamic more-specific-than relation, `<<`, and the dynamic
@@ -236,78 +234,108 @@
Dart 2) then this assignment would be permitted (but we would then use
voidness preservation to detect and avoid this situation at compile time).*
-*The semantics of checked mode checks involving types where the type void
+*The semantics of dynamic checks involving types where the type void
occurs is determined by the semantics of subtype tests, so we do not
specify that separately.*
-An instantiation of a generic class `G` is malbounded if it contains `void`
-as an actual type argument for a formal type parameter, unless that type
-parameter does not have a bound, or it has a bound which is the built-in
-class `Object`, or `dynamic`.
+It is a compile-time error to use `void` as the bound of a type variable.
+
+An instantiation of a generic class `G` is malbounded if it contains the
+type void as an actual type argument for a formal type parameter, unless
+that type parameter does not have a bound, or it has a bound which is the
+built-in class `Object`, or `dynamic`.
*The treatment of malbounded types follows the current specification.*
+
## Static Analysis
-For the static analysis, the more-specific-than relation, `<<`, and the
-subtype relation, `<:`, are determined by the same rules as described above
-for the dynamic semantics, for both Dart 1.x and Dart 2.
+For the static analysis, the subtype relation, `<:`, is determined by the
+same rules as described above for the dynamic semantics.
-*That is, the type void is considered to be equivalent to the built-in
-class `Object` in Dart 1.x, except when used as a return type, in which
-case it is effectively considered to be a proper supertype of `Object`. In
-Dart 2 subtyping, the type void is consistently considered to be equivalent
-to the built-in class `Object`. As mentioned, this document does not
-specify voidness preservation; however, when voidness preservation checks
-are added we get an effect in Dart 2 which is similar to the special
-treatment of void as a return type in Dart 1.x: The function type downcast
-which will be rejected in Dart 1.x (at run time, with a static warning at
-compile time) will become a voidness preservation violation, i.e., a
-compile-time error.*
+*That is, the type void, for the purposes of subtyping, is considered to be
+equivalent to the built-in class `Object`. As mentioned, this document does
+not specify voidness preservation. However, when voidness preservation
+checks are added we will get (among other things) an effect which is
+similar to the special treatment of void as a return type which was used in
+Dart 1.x: In Dart 1.x, an implicit downcast from `void Function()` to
+`Object Function()` will fail at run time, but with voidness preservation
+it will be a compile-time error.*
-It is a static warning for an expression to have type void (in Dart 2: a
-compile-time error), except for the following situations:
+It is a compile-time error to evaluate an expression of type void, except
+for the following situations:
-* In an expressionStatement `e;`, e may have type void.
+* In an expressionStatement `e;`, `e` may have type void.
* In the initialization and increment expressions of a for-loop,
`for (e1; e2; e3) {..}`, `e1` and `e3` may have type void.
-* In a typeCast `e as T`, `e` may have type void.
+* In a type cast `e as T`, `e` may have type void.
* In a parenthesized expression `(e)`, `e` may have type void.
+* In a conditional expression `e ? e1 : e2`, `e1` and `e2` may have the
+ type void; the static type of the conditional expression is then the
+ type void. (*This is true even if one of the branches has a different
+ type.*)
+* If _N1_ and _N2_ are non-terminals in the Dart grammar, and there is a
+ derivation of the form _N1 --> N2_, and _N2_ can have type void, then
+ _N1_ can also have type void for such a derivation. *In this derivation
+ no additional tokens are included, it is only the non-terminal which
+ changes.*
* In a return statement `return e;`, when the return type of the innermost
enclosing function is the type void, `e` may have type void.
+* An initializing expression for a variable of type void may have the type
+ void.
+* An actual parameter expression corresponding to a formal parameter whose
+ statically known type annotation is the type void may have the type void.
+* In an expression of the form `e1 = e2` where `e1` is an
+ assignableExpression denoting a variable or parameter of type void, `e2` may
+ have the type void.
+* Assume that `e` is an expression ending in a `cascadeSection` of the
+ form `'..' S s = e1` where `S` is of the form `(cascadeSelector
+ argumentPart*) (assignableSelector argumentPart*)*` and `e1` is an
+ `expressionWithoutCascade`. If `s` is an `assignableSelector` of the
+ form `'.' identifier` or `'?.' identifier` where the static type of the
+ `identifier` is the type void, `e1` may have type void; otherwise, if
+ `s` is an `assignableSelector` of the form `'[' e0 ']'` where the
+ static type of the first formal parameter in the statically known
+ declaration of operator `[]=` is the type void, `e0` may have type
+ void; also, if the static type of the second formal parameter is the
+ type void, `e1` may have type void.
-*Note that the parenthesized expression itself has type void, so it is
-again subject to the same constraints. Also note that we may not allow
-return statements returning an expression of type void in Dart 2, but
-it is allowed here for backward compatibility.*
+*The rule about non-terminals is needed in order to allow, say, `void x = b
+? (y) : e2;` where `y` has type void: `y` is an identifier which is derived
+from primary, which is derived from postfixExpression, from
+unaryExpression, from multiplicativeExpression, etc. Only if we allow such
+a (trivial) multiplicativeExpression can we allow the corresponding
+(trivial) unaryExpression, etc., all the way down to identifier, and all
+the way up to expression, which is needed for the initialization of `x`.*
-*The value yielded by an expression of type void must be discarded (and
-hence ignored), except when explicitly subjected to a type cast. This
+*The general rule is that the value yielded by an expression of type void
+must be discarded (and hence ignored), except when explicitly subjected to
+a type cast, or when returned or assigned to a target of type void. This
"makes it hard to use a meaningless value", but leaves a small escape hatch
open for the cases where the developer knows that the typing misrepresents
the actual situation.*
-It is a static warning (in Dart 2: a compile-time error) if a return
-statement `return e;` occurs such that the innermost enclosing function
-has return type `void` and the static type of `e` is not the type void.
+It is a compile-time error if a return statement `return e;` occurs such
+that the innermost enclosing function has return type `void` and the static
+type of `e` is not the type void.
-It is a static warning (in Dart 2: a compile-time error) if a function
-marked `async*`, or `sync*` has return type `void`.
+It is a compile-time error if a function marked `async*`, or `sync*` has
+return type `void`.
*Note that it is allowed for an `async` function to have return type
`void`. This serves to indicate that said function performs a
"fire-and-forget" operation, that is, it is not even useful for the caller
to synchronize with the completion of that task.*
-It is a static warning (Dart 2: a compile-time error) for a for-in
-statement to have an iterator expression of type `T` such that
-`Iterator<void>` is the most specific instantiation of `Iterator` that is a
-superinterface of `T`, unless the iteration variable has type void.
+It is a compile-time error for a for-in statement to have an iterator
+expression of type `T` such that `Iterator<void>` is the most specific
+instantiation of `Iterator` that is a superinterface of `T`, unless the
+iteration variable has type void.
-It is a static warning (Dart 2: a compile-time error) for an asynchronous
-for-in statement to have a stream expression of type `T` such that
-`Stream<void>` is the most specific instantiation of `Stream` that is a
-superinterface of `T`, unless the iteration variable has type void.
+It is a compile-time error for an asynchronous for-in statement to have a
+stream expression of type `T` such that `Stream<void>` is the most specific
+instantiation of `Stream` that is a superinterface of `T`, unless the
+iteration variable has type void.
*Hence, `for (Object x in <void>[]) {}` and
`await for (int x in new Stream<void>.empty()) {}` are errors, whereas
@@ -320,13 +348,16 @@
void. In this case, the bound is considered to be the built-in class
`Object`.
-In Dart 2, it is a compile-time error when a method declaration _D2_ with
-return type void overrides a method declaration _D1_ whose return type is
-not void.
+It is a compile-time error when a method declaration _D2_ with return type
+void overrides a method declaration _D1_ whose return type is not void.
-*This rule is a special case of voidness preservation, which is needed in
-order to maintain the discipline which arises naturally from the function
-type subtype rules in Dart 1.x concerning void as a return type.*
+*This rule is a special case of voidness preservation, which maintains the
+discipline which arises naturally from the function type subtype rules in
+Dart 1.x concerning void as a return type. It also matches the conceptual
+interpretation that a value of type void can be anything, but it should be
+discarded: This ensures that a subtype can be used where the supertype is
+expected (also known as Liskov substitutability), because it is always
+considered safe to ignore the value of an expression evaluation.*
## Discussion
@@ -356,6 +387,12 @@
## Updates
+* February 22nd 2018, v0.9: Added several new contexts where an
+ expression with static type void may be evaluated, such that pure data
+ transfers to a target of type void are allowed. For instance, a void
+ expression may be passed as an actual argument to a parameter of type
+ void.
+
* August 22nd 2017: Reworded specification of reified types to deal with
only such values which may be obtained at run time (previously mentioned
some entities which may not exist). Added one override rule.
diff --git a/pkg/analyzer/lib/src/dart/analysis/frontend_resolution.dart b/pkg/analyzer/lib/src/dart/analysis/frontend_resolution.dart
index 88bdde6..9340caf 100644
--- a/pkg/analyzer/lib/src/dart/analysis/frontend_resolution.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/frontend_resolution.dart
@@ -114,16 +114,16 @@
/// Each value is the compilation result of the key library.
final Map<Uri, LibraryCompilationResult> _results = {};
- /// The [Program] with currently valid libraries. When a file is invalidated,
- /// we remove the file, its library, and everything affected from [_program].
- Program _program = new Program();
+ /// The [Component] with currently valid libraries. When a file is invalidated,
+ /// we remove the file, its library, and everything affected from [_component].
+ Component _component = new Component();
/// Each key is the file system URI of a library.
/// Each value is the libraries that directly depend on the key library.
final Map<Uri, Set<Uri>> _directLibraryDependencies = {};
/// Each key is the file system URI of a library.
- /// Each value is the [Library] that is still in the [_program].
+ /// Each value is the [Library] that is still in the [_component].
final Map<Uri, Library> _uriToLibrary = {};
/// Each key is the file system URI of a part.
@@ -227,9 +227,9 @@
var dillTarget =
new DillTarget(_options.ticker, uriTranslator, _options.target);
- // Append all libraries what we still have in the current program.
+ // Append all libraries what we still have in the current component.
await _logger.runAsync('Load dill libraries', () async {
- dillTarget.loader.appendLibraries(_program);
+ dillTarget.loader.appendLibraries(_component);
await dillTarget.buildOutlines();
});
@@ -238,23 +238,23 @@
uriTranslator, new AnalyzerMetadataCollector());
kernelTarget.read(uri);
- // Compile the entry point into the new program.
- _program = await _logger.runAsync('Compile', () async {
- await kernelTarget.buildOutlines(nameRoot: _program.root);
- return await kernelTarget.buildProgram() ?? _program;
+ // Compile the entry point into the new component.
+ _component = await _logger.runAsync('Compile', () async {
+ await kernelTarget.buildOutlines(nameRoot: _component.root);
+ return await kernelTarget.buildComponent() ?? _component;
});
// TODO(scheglov) Only for new libraries?
- _program.computeCanonicalNames();
+ _component.computeCanonicalNames();
_logger.run('Compute dependencies', _computeDependencies);
// TODO(scheglov) Can we keep the same instance?
var types = new TypeEnvironment(
- new CoreTypes(_program), new ClassHierarchy(_program));
+ new CoreTypes(_component), new ClassHierarchy(_component));
// Add results for new libraries.
- for (var library in _program.libraries) {
+ for (var library in _component.libraries) {
if (!_results.containsKey(library.importUri)) {
Map<Uri, List<CollectedResolution>> libraryResolutions =
kernelTarget.resolutions[library.fileUri];
@@ -276,7 +276,7 @@
}
var libraryResult = new LibraryCompilationResult(
- _program, types, library.importUri, library, files);
+ _component, types, library.importUri, library, files);
_results[library.importUri] = libraryResult;
}
}
@@ -299,9 +299,9 @@
if (library == null) return;
// Invalidate the library.
- _program.libraries.remove(library);
- _program.root.removeChild('${library.importUri}');
- _program.uriToSource.remove(libraryUri);
+ _component.libraries.remove(library);
+ _component.root.removeChild('${library.importUri}');
+ _component.uriToSource.remove(libraryUri);
_results.remove(library.importUri);
// Recursively invalidate dependencies.
@@ -314,7 +314,7 @@
invalidateLibrary(libraryUri);
}
- /// Recompute [_directLibraryDependencies] for the current [_program].
+ /// Recompute [_directLibraryDependencies] for the current [_component].
void _computeDependencies() {
_directLibraryDependencies.clear();
_uriToLibrary.clear();
@@ -341,8 +341,8 @@
}
}
- // Record dependencies for every library in the program.
- _program.libraries.forEach(processLibrary);
+ // Record dependencies for every library in the component.
+ _component.libraries.forEach(processLibrary);
}
Future<T> _runWithFrontEndContext<T>(String msg, Future<T> f()) async {
@@ -355,13 +355,13 @@
/// The compilation result for a single library.
class LibraryCompilationResult {
- /// The full current [Program]. It has all libraries that are required by
+ /// The full current [Component]. It has all libraries that are required by
/// this library, but might also have other libraries, that are not required.
///
/// The object is mutable, and is changed when files are invalidated.
- final Program program;
+ final Component component;
- /// The [TypeEnvironment] for the [program].
+ /// The [TypeEnvironment] for the [component].
final TypeEnvironment types;
/// The absolute URI of the library.
@@ -374,7 +374,7 @@
final Map<Uri, FileCompilationResult> files;
LibraryCompilationResult(
- this.program, this.types, this.uri, this.kernel, this.files);
+ this.component, this.types, this.uri, this.kernel, this.files);
}
/// The [DietListener] that record resolution information.
diff --git a/pkg/analyzer/lib/src/dart/analysis/kernel_context.dart b/pkg/analyzer/lib/src/dart/analysis/kernel_context.dart
index e0323b2..0ce8c48 100644
--- a/pkg/analyzer/lib/src/dart/analysis/kernel_context.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/kernel_context.dart
@@ -88,7 +88,7 @@
// This is probably OK, because we consume them lazily.
var libraryMap = <String, kernel.Library>{};
var libraryExistMap = <String, bool>{};
- for (var library in compilationResult.program.libraries) {
+ for (var library in compilationResult.component.libraries) {
String uriStr = library.importUri.toString();
libraryMap[uriStr] = library;
FileState file = fsState.getFileForUri(library.importUri);
diff --git a/pkg/analyzer/lib/src/dart/analysis/kernel_metadata.dart b/pkg/analyzer/lib/src/dart/analysis/kernel_metadata.dart
index 9ec5360..f96c5c6 100644
--- a/pkg/analyzer/lib/src/dart/analysis/kernel_metadata.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/kernel_metadata.dart
@@ -21,7 +21,7 @@
/// Return the [AnalyzerMetadata] for the [node], or `null` absent.
static AnalyzerMetadata forNode(kernel.TreeNode node) {
var repository =
- node.enclosingProgram.metadata[AnalyzerMetadataRepository.TAG];
+ node.enclosingComponent.metadata[AnalyzerMetadataRepository.TAG];
if (repository != null) {
return repository.mapping[node];
}
diff --git a/pkg/analyzer/lib/src/fasta/ast_builder.dart b/pkg/analyzer/lib/src/fasta/ast_builder.dart
index 5823b35..083a05f 100644
--- a/pkg/analyzer/lib/src/fasta/ast_builder.dart
+++ b/pkg/analyzer/lib/src/fasta/ast_builder.dart
@@ -45,7 +45,8 @@
messageMissingAssignableSelector,
messageNativeClauseShouldBeAnnotation,
messageStaticConstructor,
- templateDuplicateLabelInSwitchStatement;
+ templateDuplicateLabelInSwitchStatement,
+ templateExpectedType;
import 'package:front_end/src/fasta/kernel/kernel_builder.dart'
show Builder, KernelLibraryBuilder, Scope;
import 'package:front_end/src/fasta/quote.dart';
@@ -897,6 +898,17 @@
debugEvent("AsOperator");
TypeAnnotation type = pop();
+ if (type is TypeName) {
+ Identifier name = type.name;
+ if (name is SimpleIdentifier) {
+ if (name.name == 'void') {
+ Token token = name.beginToken;
+ // TODO(danrubel): This needs to be reported during fasta resolution.
+ handleRecoverableError(
+ templateExpectedType.withArguments(token), token, token);
+ }
+ }
+ }
Expression expression = pop();
push(ast.asExpression(expression, asOperator, type));
}
@@ -929,6 +941,17 @@
debugEvent("IsOperator");
TypeAnnotation type = pop();
+ if (type is TypeName) {
+ Identifier name = type.name;
+ if (name is SimpleIdentifier) {
+ if (name.name == 'void') {
+ Token token = name.beginToken;
+ // TODO(danrubel): This needs to be reported during fasta resolution.
+ handleRecoverableError(
+ templateExpectedType.withArguments(token), token, token);
+ }
+ }
+ }
Expression expression = pop();
push(ast.isExpression(expression, isOperator, not, type));
}
diff --git a/pkg/analyzer/lib/src/kernel/loader.dart b/pkg/analyzer/lib/src/kernel/loader.dart
index 24808f0..73dd076 100644
--- a/pkg/analyzer/lib/src/kernel/loader.dart
+++ b/pkg/analyzer/lib/src/kernel/loader.dart
@@ -90,7 +90,7 @@
}
class DartLoader implements ReferenceLevelLoader {
- final ast.Program program;
+ final ast.Component component;
final ApplicationRoot applicationRoot;
final Bimap<ClassElement, ast.Class> _classes =
new Bimap<ClassElement, ast.Class>();
@@ -119,7 +119,7 @@
bool get strongMode => context.analysisOptions.strongMode;
- DartLoader(this.program, DartOptions options, Packages packages,
+ DartLoader(this.component, DartOptions options, Packages packages,
{DartSdk dartSdk,
AnalysisContext context,
this.ignoreRedirectingFactories: true})
@@ -145,7 +145,7 @@
..isExternal = true
..name = getLibraryName(element)
..fileUri = element.source.uri;
- program.libraries.add(library..parent = program);
+ component.libraries.add(library..parent = component);
_libraries[element] = library;
}
return library;
@@ -732,7 +732,7 @@
}
}
- void loadSdkInterface(ast.Program program, Target target) {
+ void loadSdkInterface(ast.Component component, Target target) {
var requiredSdkMembers = target.requiredSdkClasses;
for (var libraryUri in requiredSdkMembers.keys) {
var source = context.sourceFactory.forUri2(Uri.parse(libraryUri));
@@ -764,8 +764,8 @@
}
}
}
- for (int i = 0; i < program.libraries.length; ++i) {
- var library = program.libraries[i];
+ for (int i = 0; i < component.libraries.length; ++i) {
+ var library = component.libraries[i];
if (compileSdk || library.importUri.scheme != 'dart') {
ensureLibraryIsLoaded(library);
}
@@ -777,7 +777,7 @@
/// This operation may be expensive and should only be used for diagnostics.
List<String> getLoadedFileNames() {
var list = <String>[];
- for (var library in program.libraries) {
+ for (var library in component.libraries) {
LibraryElement element = context.computeLibraryElement(context
.sourceFactory
.forUri2(applicationRoot.absoluteUri(library.importUri)));
@@ -829,14 +829,14 @@
new ast.Name('main'),
ast.ProcedureKind.Method,
new ast.FunctionNode(new ast.ExpressionStatement(new ast.Throw(
- new ast.StringLiteral('Program has no main method')))),
+ new ast.StringLiteral('Component has no main method')))),
isStatic: true)
..fileUri = library.fileUri;
library.addMember(main);
return main;
}
- void loadProgram(Uri mainLibrary, {Target target, bool compileSdk}) {
+ void loadComponent(Uri mainLibrary, {Target target, bool compileSdk}) {
ast.Library library = getLibraryReferenceFromUri(mainLibrary);
ensureLibraryIsLoaded(library);
var mainMethod = _getMainMethod(mainLibrary);
@@ -844,7 +844,7 @@
if (mainMethod == null) {
mainMethod = _makeMissingMainMethod(library);
}
- program.mainMethod = mainMethod;
+ component.mainMethod = mainMethod;
for (LibraryElement libraryElement in libraryElements) {
for (CompilationUnitElement compilationUnitElement
in libraryElement.units) {
@@ -858,7 +858,7 @@
// The source's contents could not be accessed.
sourceCode = const <int>[];
}
- program.uriToSource[source.uri] =
+ component.uriToSource[source.uri] =
new ast.Source(lineInfo.lineStarts, sourceCode);
}
}
@@ -896,7 +896,7 @@
String lastPackagePath;
bool lastStrongMode;
- Future<DartLoader> getLoader(ast.Program program, DartOptions options,
+ Future<DartLoader> getLoader(ast.Component component, DartOptions options,
{String packageDiscoveryPath}) async {
if (dartSdk == null ||
lastSdk != options.sdk ||
@@ -912,7 +912,7 @@
packages = await createPackages(options.packagePath,
discoveryPath: packageDiscoveryPath);
}
- return new DartLoader(program, options, packages, dartSdk: dartSdk);
+ return new DartLoader(component, options, packages, dartSdk: dartSdk);
}
}
diff --git a/pkg/analyzer/test/generated/parser_fasta_test.dart b/pkg/analyzer/test/generated/parser_fasta_test.dart
index 5d3baf4..b3465ea 100644
--- a/pkg/analyzer/test/generated/parser_fasta_test.dart
+++ b/pkg/analyzer/test/generated/parser_fasta_test.dart
@@ -191,31 +191,6 @@
@override
@failingTest
- void test_expectedTypeName_as_void() {
- // TODO(brianwilkerson) Does not recover.
- // Expected: true
- // Actual: <false>
- //
- // package:test expect
- // test/generated/parser_fasta_test.dart 2974:5 ParserProxy._run
- // test/generated/parser_fasta_test.dart 2661:34 FastaParserTestCase._runParser
- super.test_expectedTypeName_as_void();
- }
-
- @override
- @failingTest
- void test_expectedTypeName_is_void() {
- // TODO(brianwilkerson) Does not recover.
- // Expected: true
- // Actual: <false>
- //
- // package:test expect
- // test/generated/parser_fasta_test.dart 2999:5 ParserProxy._run
- super.test_expectedTypeName_is_void();
- }
-
- @override
- @failingTest
void test_getterInFunction_block_noReturnType() {
// TODO(brianwilkerson) Does not recover.
// type 'ExpressionStatementImpl' is not a subtype of type 'FunctionDeclarationStatement' of 'statement' where
diff --git a/pkg/analyzer/test/generated/parser_test.dart b/pkg/analyzer/test/generated/parser_test.dart
index dfab7a0..353465d 100644
--- a/pkg/analyzer/test/generated/parser_test.dart
+++ b/pkg/analyzer/test/generated/parser_test.dart
@@ -3219,7 +3219,7 @@
void test_expectedTypeName_is_void() {
parseExpression("x is void)",
expectedEndOffset: 9,
- errors: [expectedError(ParserErrorCode.EXPECTED_TYPE_NAME, 4, 4)]);
+ errors: [expectedError(ParserErrorCode.EXPECTED_TYPE_NAME, 5, 4)]);
}
void test_exportAsType() {
@@ -3795,6 +3795,52 @@
]);
}
+ void test_initializedVariableInForEach_var() {
+ Statement statement = parseStatement('for (var a = 0 in foo) {}');
+ expectNotNullIfNoErrors(statement);
+ listener.assertErrors([
+ expectedError(ParserErrorCode.INITIALIZED_VARIABLE_IN_FOR_EACH, 11, 1)
+ ]);
+ }
+
+ void test_initializedVariableInForEach_annotation() {
+ Statement statement = parseStatement('for (@Foo var a = 0 in foo) {}');
+ expectNotNullIfNoErrors(statement);
+ listener.assertErrors([
+ expectedError(ParserErrorCode.INITIALIZED_VARIABLE_IN_FOR_EACH, 16, 1)
+ ]);
+ }
+
+ void test_initializedVariableInForEach_localFunction() {
+ Statement statement = parseStatement('for (f()) {}');
+ expectNotNullIfNoErrors(statement);
+ listener.assertErrors(usingFastaParser
+ ? [
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 8, 1),
+ expectedError(ParserErrorCode.MISSING_IDENTIFIER, 8, 1),
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 8, 1)
+ ]
+ : [
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 7, 1),
+ expectedError(ParserErrorCode.MISSING_IDENTIFIER, 8, 1),
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 8, 1)
+ ]);
+ }
+
+ void test_initializedVariableInForEach_localFunction2() {
+ Statement statement = parseStatement('for (T f()) {}');
+ expectNotNullIfNoErrors(statement);
+ listener.assertErrors(usingFastaParser
+ ? [
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 7, 1),
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 10, 1)
+ ]
+ : [
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 5, 1),
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 9, 1)
+ ]);
+ }
+
void test_invalidAwaitInFor() {
Statement statement = parseStatement('await for (; ;) {}');
expectNotNullIfNoErrors(statement);
diff --git a/pkg/analyzer/test/src/summary/resynthesize_kernel_test.dart b/pkg/analyzer/test/src/summary/resynthesize_kernel_test.dart
index 952d08c..fcc0791 100644
--- a/pkg/analyzer/test/src/summary/resynthesize_kernel_test.dart
+++ b/pkg/analyzer/test/src/summary/resynthesize_kernel_test.dart
@@ -401,7 +401,7 @@
// Remember Kernel libraries produced by the compiler.
var libraryMap = <String, kernel.Library>{};
var libraryExistMap = <String, bool>{};
- for (var library in libraryResult.program.libraries) {
+ for (var library in libraryResult.component.libraries) {
String uriStr = library.importUri.toString();
libraryMap[uriStr] = library;
FileState file = fsState.getFileForUri(library.importUri);
diff --git a/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart b/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart
index ab0a2ae..326e6a0 100644
--- a/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart
+++ b/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart
@@ -323,7 +323,7 @@
}
/**
- * A node representing a resolved element of the program. The kind of
+ * A node representing a resolved element of the component. The kind of
* elements that need an [ElementTypeInformation] are:
*
* - Functions (including getters and setters)
diff --git a/pkg/compiler/lib/src/io/kernel_source_information.dart b/pkg/compiler/lib/src/io/kernel_source_information.dart
index 93d324e..586b0f7 100644
--- a/pkg/compiler/lib/src/io/kernel_source_information.dart
+++ b/pkg/compiler/lib/src/io/kernel_source_information.dart
@@ -90,7 +90,7 @@
ir.Location location;
if (offset != null) {
location = node.location;
- location = node.enclosingProgram.getLocation(location.file, offset);
+ location = node.enclosingComponent.getLocation(location.file, offset);
} else {
while (node != null && node.fileOffset == ir.TreeNode.noOffset) {
node = node.parent;
diff --git a/pkg/compiler/lib/src/kernel/dart2js_target.dart b/pkg/compiler/lib/src/kernel/dart2js_target.dart
index db3de60..ba98796 100644
--- a/pkg/compiler/lib/src/kernel/dart2js_target.dart
+++ b/pkg/compiler/lib/src/kernel/dart2js_target.dart
@@ -69,7 +69,7 @@
{void logger(String msg)}) {}
@override
- void performGlobalTransformations(CoreTypes coreTypes, Program program,
+ void performGlobalTransformations(CoreTypes coreTypes, Component component,
{void logger(String msg)}) {}
@override
diff --git a/pkg/compiler/lib/src/kernel/element_map.dart b/pkg/compiler/lib/src/kernel/element_map.dart
index bfb8531..cc058e6 100644
--- a/pkg/compiler/lib/src/kernel/element_map.dart
+++ b/pkg/compiler/lib/src/kernel/element_map.dart
@@ -126,11 +126,11 @@
abstract class KernelToElementMapForImpact extends KernelToElementMap {
NativeBasicData get nativeBasicData;
- /// Adds libraries in [program] to the set of libraries.
+ /// Adds libraries in [component] to the set of libraries.
///
- /// The main method of the first program is used as the main method for the
+ /// The main method of the first component is used as the main method for the
/// compilation.
- void addProgram(ir.Program program);
+ void addProgram(ir.Component component);
/// Returns the [ConstructorEntity] corresponding to a super initializer in
/// [constructor].
diff --git a/pkg/compiler/lib/src/kernel/element_map_impl.dart b/pkg/compiler/lib/src/kernel/element_map_impl.dart
index 53b132c..ccec600 100644
--- a/pkg/compiler/lib/src/kernel/element_map_impl.dart
+++ b/pkg/compiler/lib/src/kernel/element_map_impl.dart
@@ -1216,12 +1216,12 @@
@override
NativeBasicData get nativeBasicData => _frontendStrategy.nativeBasicData;
- /// Adds libraries in [program] to the set of libraries.
+ /// Adds libraries in [component] to the set of libraries.
///
- /// The main method of the first program is used as the main method for the
+ /// The main method of the first component is used as the main method for the
/// compilation.
- void addProgram(ir.Program program) {
- _env.addProgram(program);
+ void addProgram(ir.Component component) {
+ _env.addProgram(component);
}
@override
diff --git a/pkg/compiler/lib/src/kernel/env.dart b/pkg/compiler/lib/src/kernel/env.dart
index 782c999..0870b99 100644
--- a/pkg/compiler/lib/src/kernel/env.dart
+++ b/pkg/compiler/lib/src/kernel/env.dart
@@ -23,25 +23,25 @@
import 'element_map_mixins.dart';
import 'kelements.dart' show KImport;
-/// Environment for fast lookup of program libraries.
+/// Environment for fast lookup of component libraries.
class ProgramEnv {
- final Set<ir.Program> _programs = new Set<ir.Program>();
+ final Set<ir.Component> _programs = new Set<ir.Component>();
Map<Uri, LibraryEnv> _libraryMap;
/// TODO(johnniwinther): Handle arbitrary load order if needed.
ir.Member get mainMethod => _programs.first?.mainMethod;
- void addProgram(ir.Program program) {
- if (_programs.add(program)) {
+ void addProgram(ir.Component component) {
+ if (_programs.add(component)) {
if (_libraryMap != null) {
- _addLibraries(program);
+ _addLibraries(component);
}
}
}
- void _addLibraries(ir.Program program) {
- for (ir.Library library in program.libraries) {
+ void _addLibraries(ir.Component component) {
+ for (ir.Library library in component.libraries) {
_libraryMap[library.importUri] = new LibraryEnv(library);
}
}
@@ -49,8 +49,8 @@
void _ensureLibraryMap() {
if (_libraryMap == null) {
_libraryMap = <Uri, LibraryEnv>{};
- for (ir.Program program in _programs) {
- _addLibraries(program);
+ for (ir.Component component in _programs) {
+ _addLibraries(component);
}
}
}
diff --git a/pkg/compiler/lib/src/library_loader.dart b/pkg/compiler/lib/src/library_loader.dart
index a2d7c31..ace0223 100644
--- a/pkg/compiler/lib/src/library_loader.dart
+++ b/pkg/compiler/lib/src/library_loader.dart
@@ -815,8 +815,7 @@
}
}
-/// A loader that builds a kernel IR representation of the program (or set of
-/// libraries).
+/// A loader that builds a kernel IR representation of the component.
///
/// It supports loading both .dart source files or pre-compiled .dill files.
/// When given .dart source files, it invokes the shared frontend
@@ -832,7 +831,7 @@
final api.CompilerInput compilerInput;
/// Holds the mapping of Kernel IR to KElements that is constructed as a
- /// result of loading a program.
+ /// result of loading a component.
final KernelToElementMapForImpactImpl _elementMap;
final bool verbose;
@@ -847,7 +846,7 @@
: _allLoadedLibraries = new List<LibraryEntity>(),
super(measurer);
- /// Loads an entire Kernel [Program] from a file on disk (note, not just a
+ /// Loads an entire Kernel [Component] from a file on disk (note, not just a
/// library, so this name is actually a bit of a misnomer).
// TODO(efortuna): Rename this once the Element library loader class goes
// away.
@@ -855,12 +854,12 @@
{bool skipFileWithPartOfTag: false}) {
return measure(() async {
var isDill = resolvedUri.path.endsWith('.dill');
- ir.Program program;
+ ir.Component component;
if (isDill) {
api.Input input = await compilerInput.readFromUri(resolvedUri,
inputKind: api.InputKind.binary);
- program = new ir.Program();
- new BinaryBuilder(input.data).readProgram(program);
+ component = new ir.Component();
+ new BinaryBuilder(input.data).readComponent(component);
} else {
bool strongMode = _elementMap.options.strongMode;
String platform = strongMode
@@ -871,28 +870,28 @@
new Dart2jsTarget(new TargetFlags(strongMode: strongMode)),
platformBinaries.resolve(platform),
_packageConfig);
- program = await fe.compile(
+ component = await fe.compile(
initializedCompilerState,
verbose,
new CompilerFileSystem(compilerInput),
(e) => reportFrontEndMessage(reporter, e),
resolvedUri);
}
- if (program == null) return null;
- return createLoadedLibraries(program);
+ if (component == null) return null;
+ return createLoadedLibraries(component);
});
}
// Only visible for unit testing.
- LoadedLibraries createLoadedLibraries(ir.Program program) {
- _elementMap.addProgram(program);
+ LoadedLibraries createLoadedLibraries(ir.Component component) {
+ _elementMap.addProgram(component);
LibraryEntity rootLibrary = null;
- Iterable<ir.Library> libraries = program.libraries;
- if (program.mainMethod != null) {
- var root = program.mainMethod.enclosingLibrary;
+ Iterable<ir.Library> libraries = component.libraries;
+ if (component.mainMethod != null) {
+ var root = component.mainMethod.enclosingLibrary;
rootLibrary = _elementMap.lookupLibrary(root.importUri);
- // Filter unreachable libraries: [Program] was built by linking in the
+ // Filter unreachable libraries: [Component] was built by linking in the
// entire SDK libraries, not all of them are used. We include anything
// that is reachable from `main`. Note that all internal libraries that
// the compiler relies on are reachable from `dart:core`.
@@ -907,7 +906,7 @@
search(root);
// Libraries dependencies do not show implicit imports to `dart:core`.
- var dartCore = program.libraries.firstWhere((lib) {
+ var dartCore = component.libraries.firstWhere((lib) {
return lib.importUri.scheme == 'dart' && lib.importUri.path == 'core';
});
search(dartCore);
diff --git a/pkg/compiler/tool/generate_kernel.dart b/pkg/compiler/tool/generate_kernel.dart
index 9887aaa..a649997 100644
--- a/pkg/compiler/tool/generate_kernel.dart
+++ b/pkg/compiler/tool/generate_kernel.dart
@@ -40,8 +40,8 @@
}
Uri entry = Uri.base.resolve(nativeToUriPath(flags.rest.first));
- var program = await kernelForProgram(entry, options);
- await writeProgramToBinary(program, flags['out']);
+ var component = await kernelForProgram(entry, options);
+ await writeComponentToBinary(component, flags['out']);
}
ArgParser _argParser = new ArgParser()
diff --git a/pkg/dev_compiler/lib/src/kernel/command.dart b/pkg/dev_compiler/lib/src/kernel/command.dart
index f3f1108..810aa8e 100644
--- a/pkg/dev_compiler/lib/src/kernel/command.dart
+++ b/pkg/dev_compiler/lib/src/kernel/command.dart
@@ -197,12 +197,12 @@
if (!file.parent.existsSync()) file.parent.createSync(recursive: true);
// Useful for debugging:
- writeProgramToText(result.program, path: output + '.txt');
+ writeComponentToText(result.component, path: output + '.txt');
// TODO(jmesserly): Save .dill file so other modules can link in this one.
- //await writeProgramToBinary(program, output);
+ //await writeComponentToBinary(component, output);
var jsModule = compileToJSModule(
- result.program, result.inputSummaries, summaryUris, declaredVariables);
+ result.component, result.inputSummaries, summaryUris, declaredVariables);
var jsCode = jsProgramToCode(jsModule, moduleFormat,
buildSourceMap: argResults['source-map'] as bool,
jsUrl: path.toUri(output).toString(),
@@ -219,7 +219,7 @@
return new CompilerResult(compilerState, true);
}
-JS.Program compileToJSModule(Program p, List<Program> summaries,
+JS.Program compileToJSModule(Component p, List<Component> summaries,
List<Uri> summaryUris, Map<String, String> declaredVariables) {
var compiler = new ProgramCompiler(p, declaredVariables: declaredVariables);
return compiler.emitProgram(p, summaries, summaryUris);
diff --git a/pkg/dev_compiler/lib/src/kernel/compiler.dart b/pkg/dev_compiler/lib/src/kernel/compiler.dart
index 9e7b386..d3f8a9f 100644
--- a/pkg/dev_compiler/lib/src/kernel/compiler.dart
+++ b/pkg/dev_compiler/lib/src/kernel/compiler.dart
@@ -44,10 +44,10 @@
/// Maps a library URI import, that is not in [_libraries], to the
/// corresponding Kernel summary module we imported it with.
- final _importToSummary = new Map<Library, Program>.identity();
+ final _importToSummary = new Map<Library, Component>.identity();
/// Maps a summary to the file URI we used to load it from disk.
- final _summaryToUri = new Map<Program, Uri>.identity();
+ final _summaryToUri = new Map<Component, Uri>.identity();
/// Imported libraries, and the temporaries used to refer to them.
final _imports = new Map<Library, JS.TemporaryId>();
@@ -92,7 +92,7 @@
/// The current source file URI for emitting in the source map.
Uri _currentUri;
- Program _program;
+ Component _component;
Library _currentLibrary;
@@ -200,13 +200,13 @@
final NullableInference _nullableInference;
- factory ProgramCompiler(Program program,
+ factory ProgramCompiler(Component component,
{bool emitMetadata: true,
bool replCompile: false,
Map<String, String> declaredVariables: const {}}) {
- var nativeTypes = new NativeTypeSet(program);
+ var nativeTypes = new NativeTypeSet(component);
var types = new TypeSchemaEnvironment(
- nativeTypes.coreTypes, new ClassHierarchy(program), true);
+ nativeTypes.coreTypes, new ClassHierarchy(component), true);
return new ProgramCompiler._(
nativeTypes, new JSTypeRep(types, nativeTypes.sdk),
emitMetadata: emitMetadata,
@@ -246,11 +246,11 @@
ClassHierarchy get hierarchy => types.hierarchy;
JS.Program emitProgram(
- Program p, List<Program> summaries, List<Uri> summaryUris) {
+ Component p, List<Component> summaries, List<Uri> summaryUris) {
if (_moduleItems.isNotEmpty) {
throw new StateError('Can only call emitModule once.');
}
- _program = p;
+ _component = p;
for (var i = 0; i < summaries.length; i++) {
var summary = summaries[i];
@@ -3185,7 +3185,7 @@
if (offset == -1) return null;
var fileUri = _currentUri;
if (fileUri == null) return null;
- var loc = _program.getLocation(fileUri, offset);
+ var loc = _component.getLocation(fileUri, offset);
if (loc == null) return null;
return new SourceLocation(offset,
sourceUrl: fileUri, line: loc.line - 1, column: loc.column - 1);
@@ -3227,6 +3227,13 @@
visitEmptyStatement(EmptyStatement node) => new JS.EmptyStatement();
@override
+ visitAssertBlock(AssertBlock node) {
+ // AssertBlocks are introduced by the VM-specific async elimination
+ // transformation. We do not expect them to arise here.
+ throw new UnsupportedError('compilation of an assert block');
+ }
+
+ @override
visitAssertStatement(AssertStatement node) {
// TODO(jmesserly): only emit in checked mode.
var condition = node.condition;
diff --git a/pkg/dev_compiler/lib/src/kernel/native_types.dart b/pkg/dev_compiler/lib/src/kernel/native_types.dart
index deaff11..e862eb9 100644
--- a/pkg/dev_compiler/lib/src/kernel/native_types.dart
+++ b/pkg/dev_compiler/lib/src/kernel/native_types.dart
@@ -36,9 +36,9 @@
final _nativeTypes = new HashSet<Class>.identity();
final _pendingLibraries = new HashSet<Library>.identity();
- NativeTypeSet(Program program)
- : sdk = new LibraryIndex.coreLibraries(program),
- coreTypes = new CoreTypes(program) {
+ NativeTypeSet(Component component)
+ : sdk = new LibraryIndex.coreLibraries(component),
+ coreTypes = new CoreTypes(component) {
// First, core types:
// TODO(vsm): If we're analyzing against the main SDK, those
// types are not explicitly annotated.
diff --git a/pkg/dev_compiler/lib/src/kernel/target.dart b/pkg/dev_compiler/lib/src/kernel/target.dart
index cb4f95b..1e1277a 100644
--- a/pkg/dev_compiler/lib/src/kernel/target.dart
+++ b/pkg/dev_compiler/lib/src/kernel/target.dart
@@ -63,7 +63,7 @@
{void logger(String msg)}) {}
@override
- void performGlobalTransformations(CoreTypes coreTypes, Program program,
+ void performGlobalTransformations(CoreTypes coreTypes, Component component,
{void logger(String msg)}) {}
@override
diff --git a/pkg/dev_compiler/test/nullable_inference_test.dart b/pkg/dev_compiler/test/nullable_inference_test.dart
index 3d9348e..742508b 100644
--- a/pkg/dev_compiler/test/nullable_inference_test.dart
+++ b/pkg/dev_compiler/test/nullable_inference_test.dart
@@ -465,9 +465,9 @@
/// to be produced in the set of expressions that cannot be null by DDC's null
/// inference.
Future expectNotNull(String code, String expectedNotNull) async {
- var program = await kernelCompile(code);
+ var component = await kernelCompile(code);
var collector = new NotNullCollector();
- program.accept(collector);
+ component.accept(collector);
var actualNotNull =
collector.notNullExpressions.map((e) => e.toString()).join(', ');
expect(actualNotNull, equals(expectedNotNull));
@@ -485,7 +485,7 @@
int _functionNesting = 0;
@override
- visitProgram(Program node) {
+ visitComponent(Component node) {
inference ??= new NullableInference(new JSTypeRep(
new TypeSchemaEnvironment(
new CoreTypes(node), new ClassHierarchy(node), true),
@@ -495,7 +495,7 @@
inference.allowNotNullDeclarations = useAnnotations;
inference.allowPackageMetaAnnotations = useAnnotations;
}
- super.visitProgram(node);
+ super.visitComponent(node);
}
@override
@@ -542,7 +542,7 @@
fe.InitializedCompilerState _compilerState;
final _fileSystem = new MemoryFileSystem(new Uri.file('/memory/'));
-Future<Program> kernelCompile(String code) async {
+Future<Component> kernelCompile(String code) async {
var succeeded = true;
void errorHandler(fe.CompilationMessage error) {
if (error.severity == fe.Severity.error) {
@@ -577,5 +577,5 @@
fe.DdcResult result =
await fe.compile(_compilerState, [mainUri], errorHandler);
expect(succeeded, true);
- return result.program;
+ return result.component;
}
diff --git a/pkg/dev_compiler/tool/kernel_sdk.dart b/pkg/dev_compiler/tool/kernel_sdk.dart
index b94a9bb..4e8a20b 100755
--- a/pkg/dev_compiler/tool/kernel_sdk.dart
+++ b/pkg/dev_compiler/tool/kernel_sdk.dart
@@ -39,13 +39,13 @@
..target = target;
var inputs = target.extraRequiredLibraries.map(Uri.parse).toList();
- var program = await kernelForBuildUnit(inputs, options);
+ var component = await kernelForComponent(inputs, options);
var outputDir = path.dirname(outputPath);
await new Directory(outputDir).create(recursive: true);
- await writeProgramToBinary(program, outputPath);
+ await writeComponentToBinary(component, outputPath);
- var jsModule = compileToJSModule(program, [], [], {});
+ var jsModule = compileToJSModule(component, [], [], {});
var moduleFormats = {
'amd': ModuleFormat.amd,
'common': ModuleFormat.common,
diff --git a/pkg/dev_compiler/web/index.html b/pkg/dev_compiler/web/index.html
index 1ef26e1..891bd19 100644
--- a/pkg/dev_compiler/web/index.html
+++ b/pkg/dev_compiler/web/index.html
@@ -1,12 +1,10 @@
<!DOCTYPE html>
-
<html>
<head>
<meta charset="utf-8">
- <title>Dart Browser</title>
+ <title>Dart Dev Compiler Console</title>
</head>
<body>
- <script type="application/dart" src="main.dart"></script>
- <script src="packages/browser/dart.js"></script>
+ <script defer src="main.dart.js"></script>
</body>
</html>
diff --git a/pkg/front_end/lib/src/api_prototype/compiler_options.dart b/pkg/front_end/lib/src/api_prototype/compiler_options.dart
index ccfe2ea..4710a15 100644
--- a/pkg/front_end/lib/src/api_prototype/compiler_options.dart
+++ b/pkg/front_end/lib/src/api_prototype/compiler_options.dart
@@ -83,7 +83,7 @@
/// of [inputSummaries] or [sdkSummary].
List<Uri> inputSummaries = [];
- /// URIs of other kernel programs to link.
+ /// URIs of other kernel components to link.
///
/// Commonly used to link the code for the SDK libraries that was compiled
/// separately. For example, dart2js needs to link the SDK so it can
@@ -91,8 +91,8 @@
/// always embeds the SDK internally and doesn't need it as part of the
/// program.
///
- /// The programs provided here should be closed and acyclic: any libraries
- /// that they reference should be defined in a program in [linkedDependencies]
+ /// The components provided here should be closed and acyclic: any libraries
+ /// that they reference should be defined in a component in [linkedDependencies]
/// or any of the [inputSummaries] or [sdkSummary].
List<Uri> linkedDependencies = [];
@@ -125,7 +125,7 @@
/// Whether to generate code for the SDK.
///
- /// By default the front end resolves programs using a prebuilt SDK summary.
+ /// By default the front end resolves components using a prebuilt SDK summary.
/// When this option is `true`, [sdkSummary] must be null.
bool compileSdk = false;
@@ -134,7 +134,7 @@
///
/// This option has different defaults depending on the API.
///
- /// For modular APIs like `kernelForBuildUnit` and `summaryFor` the default
+ /// For modular APIs like `kernelForComponent` and `summaryFor` the default
/// behavior is `false`. These APIs want to ensure that builds are hermetic,
/// where all files that will be compiled are listed explicitly and all other
/// dependencies are covered by summary files.
@@ -169,7 +169,7 @@
/// * the set of libraries are part of a platform's SDK (e.g. dart:html for
/// dart2js, dart:ui for flutter).
///
- /// * what kernel transformations should be applied to the program
+ /// * what kernel transformations should be applied to the component
/// (async/await, mixin inlining, etc).
///
/// * how to deal with non-standard features like `native` extensions.
@@ -185,14 +185,14 @@
// verbose data (Issue #30056)
bool verbose = false;
- /// Whether to run extra verification steps to validate that compiled programs
+ /// Whether to run extra verification steps to validate that compiled components
/// are well formed.
///
/// Errors are reported via the [onError] callback.
// TODO(sigmund): ensure we don't print errors to stdout (Issue #30056)
bool verify = false;
- /// Whether to dump generated programs in a text format (also mainly for
+ /// Whether to dump generated components in a text format (also mainly for
/// debugging).
///
/// Dumped data is printed in stdout.
@@ -202,9 +202,9 @@
/// warning, etc.) is encountered during compilation.
bool setExitCodeOnProblem = false;
- /// Whether to embed the input sources in generated kernel programs.
+ /// Whether to embed the input sources in generated kernel components.
///
- /// The kernel `Program` API includes a `uriToSource` map field that is used
+ /// The kernel `Component` API includes a `uriToSource` map field that is used
/// to embed the entire contents of the source files. This part of the kernel
/// API is in flux and it is not necessary for some tools. Today it is used
/// for translating error locations and stack traces in the VM.
diff --git a/pkg/front_end/lib/src/api_prototype/incremental_kernel_generator.dart b/pkg/front_end/lib/src/api_prototype/incremental_kernel_generator.dart
index aac0185..460e203 100644
--- a/pkg/front_end/lib/src/api_prototype/incremental_kernel_generator.dart
+++ b/pkg/front_end/lib/src/api_prototype/incremental_kernel_generator.dart
@@ -4,7 +4,7 @@
import 'dart:async' show Future;
-import 'package:kernel/kernel.dart' show Program;
+import 'package:kernel/kernel.dart' show Component;
import '../base/processed_options.dart' show ProcessedOptions;
@@ -22,9 +22,8 @@
bootstrapDill);
}
- /// Returns a component (nee program) whose libraries are the recompiled
- /// libraries.
- Future<Program> computeDelta({Uri entryPoint});
+ /// Returns a component whose libraries are the recompiled libraries.
+ Future<Component> computeDelta({Uri entryPoint});
/// Remove the file associated with the given file [uri] from the set of
/// valid files. This guarantees that those files will be re-read on the
diff --git a/pkg/front_end/lib/src/api_prototype/kernel_generator.dart b/pkg/front_end/lib/src/api_prototype/kernel_generator.dart
index ddf30e1..94a6d0f 100644
--- a/pkg/front_end/lib/src/api_prototype/kernel_generator.dart
+++ b/pkg/front_end/lib/src/api_prototype/kernel_generator.dart
@@ -7,7 +7,7 @@
import 'dart:async' show Future;
-import 'package:kernel/kernel.dart' show Program;
+import 'package:kernel/kernel.dart' show Component;
import '../base/processed_options.dart' show ProcessedOptions;
@@ -25,13 +25,13 @@
/// Generates a kernel representation of the program whose main library is in
/// the given [source].
///
-/// Intended for whole program (non-modular) compilation.
+/// Intended for whole-program (non-modular) compilation.
///
/// Given the Uri of a file containing a program's `main` method, this function
/// follows `import`, `export`, and `part` declarations to discover the whole
/// program, and converts the result to Dart Kernel format.
///
-/// If `compileSdk` in [options] is true, the generated program will include
+/// If `compileSdk` in [options] is true, the generated component will include
/// code for the SDK.
///
/// If summaries are provided in [options], the compiler will use them instead
@@ -42,19 +42,19 @@
/// The input [source] is expected to be a script with a main method, otherwise
/// an error is reported.
// TODO(sigmund): rename to kernelForScript?
-Future<Program> kernelForProgram(Uri source, CompilerOptions options) async {
+Future<Component> kernelForProgram(Uri source, CompilerOptions options) async {
var pOptions = new ProcessedOptions(options, false, [source]);
return await CompilerContext.runWithOptions(pOptions, (context) async {
- var program = (await generateKernelInternal())?.program;
- if (program == null) return null;
+ var component = (await generateKernelInternal())?.component;
+ if (component == null) return null;
- if (program.mainMethod == null) {
+ if (component.mainMethod == null) {
context.options.report(
messageMissingMain.withLocation(source, -1, noLength),
Severity.error);
return null;
}
- return program;
+ return component;
});
}
@@ -84,11 +84,11 @@
/// are also listed in the build unit sources, otherwise an error results. (It
/// is not permitted to refer to a part file declared in another build unit).
///
-/// The return value is a [Program] object with no main method set. The
-/// [Program] includes external libraries for those libraries loaded through
+/// The return value is a [Component] object with no main method set. The
+/// [Component] includes external libraries for those libraries loaded through
/// summaries.
-Future<Program> kernelForBuildUnit(
+Future<Component> kernelForComponent(
List<Uri> sources, CompilerOptions options) async {
return (await generateKernel(new ProcessedOptions(options, true, sources)))
- ?.program;
+ ?.component;
}
diff --git a/pkg/front_end/lib/src/api_prototype/summary_generator.dart b/pkg/front_end/lib/src/api_prototype/summary_generator.dart
index 8bd633a..4a2974c 100644
--- a/pkg/front_end/lib/src/api_prototype/summary_generator.dart
+++ b/pkg/front_end/lib/src/api_prototype/summary_generator.dart
@@ -43,6 +43,6 @@
Future<List<int>> summaryFor(List<Uri> sources, CompilerOptions options,
{bool truncate: false}) async {
return (await generateKernel(new ProcessedOptions(options, true, sources),
- buildSummary: true, buildProgram: false, truncateSummary: truncate))
+ buildSummary: true, buildComponent: false, truncateSummary: truncate))
?.summary;
}
diff --git a/pkg/front_end/lib/src/api_unstable/dart2js.dart b/pkg/front_end/lib/src/api_unstable/dart2js.dart
index bad1ff9..c8151c0 100644
--- a/pkg/front_end/lib/src/api_unstable/dart2js.dart
+++ b/pkg/front_end/lib/src/api_unstable/dart2js.dart
@@ -4,7 +4,7 @@
import 'dart:async' show Future;
-import 'package:kernel/kernel.dart' show Program;
+import 'package:kernel/kernel.dart' show Component;
import 'package:kernel/target/targets.dart' show Target;
@@ -46,7 +46,7 @@
return new InitializedCompilerState(options, processedOpts);
}
-Future<Program> compile(InitializedCompilerState state, bool verbose,
+Future<Component> compile(InitializedCompilerState state, bool verbose,
FileSystem fileSystem, ErrorHandler onError, Uri input) async {
CompilerOptions options = state.options;
options
@@ -62,9 +62,9 @@
var compilerResult = await CompilerContext.runWithOptions(processedOpts,
(CompilerContext context) async {
var compilerResult = await generateKernelInternal();
- Program program = compilerResult?.program;
- if (program == null) return null;
- if (program.mainMethod == null) {
+ Component component = compilerResult?.component;
+ if (component == null) return null;
+ if (component.mainMethod == null) {
context.options.report(
messageMissingMain.withLocation(input, -1, noLength), Severity.error);
return null;
@@ -72,5 +72,5 @@
return compilerResult;
});
- return compilerResult?.program;
+ return compilerResult?.component;
}
diff --git a/pkg/front_end/lib/src/api_unstable/ddc.dart b/pkg/front_end/lib/src/api_unstable/ddc.dart
index 5e0cf2c..0b9545f 100644
--- a/pkg/front_end/lib/src/api_unstable/ddc.dart
+++ b/pkg/front_end/lib/src/api_unstable/ddc.dart
@@ -8,7 +8,7 @@
import 'package:front_end/src/api_prototype/standard_file_system.dart';
import 'package:front_end/src/base/processed_options.dart';
import 'package:front_end/src/kernel_generator_impl.dart';
-import 'package:kernel/kernel.dart' show Program;
+import 'package:kernel/kernel.dart' show Component;
import 'package:kernel/target/targets.dart' show Target;
import '../api_prototype/compiler_options.dart';
@@ -19,10 +19,10 @@
export '../api_prototype/compilation_message.dart';
class DdcResult {
- final Program program;
- final List<Program> inputSummaries;
+ final Component component;
+ final List<Component> inputSummaries;
- DdcResult(this.program, this.inputSummaries);
+ DdcResult(this.component, this.inputSummaries);
}
Future<InitializedCompilerState> initializeCompiler(
@@ -85,10 +85,10 @@
var compilerResult = await generateKernel(processedOpts);
- var program = compilerResult?.program;
- if (program == null) return null;
+ var component = compilerResult?.component;
+ if (component == null) return null;
// This should be cached.
var summaries = await processedOpts.loadInputSummaries(null);
- return new DdcResult(program, summaries);
+ return new DdcResult(component, summaries);
}
diff --git a/pkg/front_end/lib/src/api_unstable/summary_worker.dart b/pkg/front_end/lib/src/api_unstable/summary_worker.dart
index d5c8b18..2144265 100644
--- a/pkg/front_end/lib/src/api_unstable/summary_worker.dart
+++ b/pkg/front_end/lib/src/api_unstable/summary_worker.dart
@@ -56,6 +56,6 @@
processedOpts.inputs.addAll(inputs);
var result = await generateKernel(processedOpts,
- buildSummary: true, buildProgram: false, truncateSummary: true);
+ buildSummary: true, buildComponent: false, truncateSummary: true);
return result?.summary;
}
diff --git a/pkg/front_end/lib/src/base/processed_options.dart b/pkg/front_end/lib/src/base/processed_options.dart
index 3dc85f7..cbe7ebc 100644
--- a/pkg/front_end/lib/src/base/processed_options.dart
+++ b/pkg/front_end/lib/src/base/processed_options.dart
@@ -6,7 +6,7 @@
import 'package:kernel/binary/ast_from_binary.dart' show BinaryBuilder;
-import 'package:kernel/kernel.dart' show CanonicalName, Location, Program;
+import 'package:kernel/kernel.dart' show CanonicalName, Component, Location;
import 'package:kernel/target/targets.dart' show Target, TargetFlags;
@@ -98,23 +98,23 @@
/// The SDK summary, or `null` if it has not been read yet.
///
- /// A summary, also referred to as "outline" internally, is a [Program] where
+ /// A summary, also referred to as "outline" internally, is a [Component] where
/// all method bodies are left out. In essence, it contains just API
/// signatures and constants. When strong-mode is enabled, the summary already
/// includes inferred types.
- Program _sdkSummaryProgram;
+ Component _sdkSummaryProgram;
/// The summary for each uri in `options.inputSummaries`.
///
- /// A summary, also referred to as "outline" internally, is a [Program] where
+ /// A summary, also referred to as "outline" internally, is a [Component] where
/// all method bodies are left out. In essence, it contains just API
/// signatures and constants. When strong-mode is enabled, the summary already
/// includes inferred types.
- List<Program> _inputSummariesPrograms;
+ List<Component> _inputSummariesPrograms;
/// Other programs that are meant to be linked and compiled with the input
/// sources.
- List<Program> _linkedDependencies;
+ List<Component> _linkedDependencies;
/// The location of the SDK, or `null` if the location hasn't been determined
/// yet.
@@ -306,18 +306,18 @@
Target get target => _target ??=
_raw.target ?? new VmTarget(new TargetFlags(strongMode: strongMode));
- /// Get an outline program that summarizes the SDK, if any.
+ /// Get an outline component that summarizes the SDK, if any.
// TODO(sigmund): move, this doesn't feel like an "option".
- Future<Program> loadSdkSummary(CanonicalName nameRoot) async {
+ Future<Component> loadSdkSummary(CanonicalName nameRoot) async {
if (_sdkSummaryProgram == null) {
if (sdkSummary == null) return null;
var bytes = await loadSdkSummaryBytes();
- _sdkSummaryProgram = loadProgram(bytes, nameRoot);
+ _sdkSummaryProgram = loadComponent(bytes, nameRoot);
}
return _sdkSummaryProgram;
}
- void set sdkSummaryComponent(Program platform) {
+ void set sdkSummaryComponent(Component platform) {
if (_sdkSummaryProgram != null) {
throw new StateError("sdkSummary already loaded.");
}
@@ -327,42 +327,42 @@
/// Get the summary programs for each of the underlying `inputSummaries`
/// provided via [CompilerOptions].
// TODO(sigmund): move, this doesn't feel like an "option".
- Future<List<Program>> loadInputSummaries(CanonicalName nameRoot) async {
+ Future<List<Component>> loadInputSummaries(CanonicalName nameRoot) async {
if (_inputSummariesPrograms == null) {
var uris = _raw.inputSummaries;
- if (uris == null || uris.isEmpty) return const <Program>[];
+ if (uris == null || uris.isEmpty) return const <Component>[];
// TODO(sigmund): throttle # of concurrent opreations.
var allBytes = await Future
.wait(uris.map((uri) => fileSystem.entityForUri(uri).readAsBytes()));
_inputSummariesPrograms =
- allBytes.map((bytes) => loadProgram(bytes, nameRoot)).toList();
+ allBytes.map((bytes) => loadComponent(bytes, nameRoot)).toList();
}
return _inputSummariesPrograms;
}
/// Load each of the [CompilerOptions.linkedDependencies] programs.
// TODO(sigmund): move, this doesn't feel like an "option".
- Future<List<Program>> loadLinkDependencies(CanonicalName nameRoot) async {
+ Future<List<Component>> loadLinkDependencies(CanonicalName nameRoot) async {
if (_linkedDependencies == null) {
var uris = _raw.linkedDependencies;
- if (uris == null || uris.isEmpty) return const <Program>[];
+ if (uris == null || uris.isEmpty) return const <Component>[];
// TODO(sigmund): throttle # of concurrent opreations.
var allBytes = await Future
.wait(uris.map((uri) => fileSystem.entityForUri(uri).readAsBytes()));
_linkedDependencies =
- allBytes.map((bytes) => loadProgram(bytes, nameRoot)).toList();
+ allBytes.map((bytes) => loadComponent(bytes, nameRoot)).toList();
}
return _linkedDependencies;
}
/// Helper to load a .dill file from [uri] using the existing [nameRoot].
- Program loadProgram(List<int> bytes, CanonicalName nameRoot) {
- Program program = new Program(nameRoot: nameRoot);
+ Component loadComponent(List<int> bytes, CanonicalName nameRoot) {
+ Component component = new Component(nameRoot: nameRoot);
// TODO(ahe): Pass file name to BinaryBuilder.
// TODO(ahe): Control lazy loading via an option.
new BinaryBuilder(bytes, filename: null, disableLazyReading: false)
- .readProgram(program);
- return program;
+ .readComponent(component);
+ return component;
}
/// Get the [UriTranslator] which resolves "package:" and "dart:" URIs.
diff --git a/pkg/front_end/lib/src/external_state_snapshot.dart b/pkg/front_end/lib/src/external_state_snapshot.dart
index cdb31e9..0484dc0 100644
--- a/pkg/front_end/lib/src/external_state_snapshot.dart
+++ b/pkg/front_end/lib/src/external_state_snapshot.dart
@@ -4,15 +4,15 @@
// TODO(ahe): Remove this file.
-import 'package:kernel/kernel.dart' show Library, Program;
+import 'package:kernel/kernel.dart' show Library, Component;
/// Helper class to work around modifications in [kernel_generator_impl.dart].
class ExternalStateSnapshot {
final List<ExternalState> snapshots;
- ExternalStateSnapshot(Program program)
+ ExternalStateSnapshot(Component component)
: snapshots = new List<ExternalState>.from(
- program.libraries.map((l) => new ExternalState(l, l.isExternal)));
+ component.libraries.map((l) => new ExternalState(l, l.isExternal)));
void restore() {
for (ExternalState state in snapshots) {
diff --git a/pkg/front_end/lib/src/fasta/dill/dill_loader.dart b/pkg/front_end/lib/src/fasta/dill/dill_loader.dart
index 713a5e6..2be3fcf 100644
--- a/pkg/front_end/lib/src/fasta/dill/dill_loader.dart
+++ b/pkg/front_end/lib/src/fasta/dill/dill_loader.dart
@@ -6,7 +6,7 @@
import 'dart:async' show Future;
-import 'package:kernel/ast.dart' show Library, Program, Source;
+import 'package:kernel/ast.dart' show Library, Component, Source;
import '../fasta_codes.dart'
show SummaryTemplate, Template, templateDillOutlineSummary;
@@ -33,12 +33,12 @@
Template<SummaryTemplate> get outlineSummaryTemplate =>
templateDillOutlineSummary;
- /// Append compiled libraries from the given [program]. If the [filter] is
+ /// Append compiled libraries from the given [component]. If the [filter] is
/// provided, append only libraries whose [Uri] is accepted by the [filter].
- List<DillLibraryBuilder> appendLibraries(Program program,
+ List<DillLibraryBuilder> appendLibraries(Component component,
{bool filter(Uri uri), int byteCount: 0}) {
var builders = <DillLibraryBuilder>[];
- for (Library library in program.libraries) {
+ for (Library library in component.libraries) {
if (filter == null || filter(library.importUri)) {
libraries.add(library);
DillLibraryBuilder builder = read(library.importUri, -1);
@@ -46,7 +46,7 @@
builders.add(builder);
}
}
- uriToSource.addAll(program.uriToSource);
+ uriToSource.addAll(component.uriToSource);
this.byteCount += byteCount;
return builders;
}
diff --git a/pkg/front_end/lib/src/fasta/dill/dill_target.dart b/pkg/front_end/lib/src/fasta/dill/dill_target.dart
index 7da0d21..405f1f8 100644
--- a/pkg/front_end/lib/src/fasta/dill/dill_target.dart
+++ b/pkg/front_end/lib/src/fasta/dill/dill_target.dart
@@ -43,8 +43,8 @@
}
@override
- Future<Null> buildProgram() {
- return new Future<Null>.sync(() => unsupported("buildProgram", -1, null));
+ Future<Null> buildComponent() {
+ return new Future<Null>.sync(() => unsupported("buildComponent", -1, null));
}
@override
diff --git a/pkg/front_end/lib/src/fasta/get_dependencies.dart b/pkg/front_end/lib/src/fasta/get_dependencies.dart
index b9d7999..14165b7 100644
--- a/pkg/front_end/lib/src/fasta/get_dependencies.dart
+++ b/pkg/front_end/lib/src/fasta/get_dependencies.dart
@@ -6,7 +6,7 @@
import 'dart:async' show Future;
-import 'package:kernel/kernel.dart' show loadProgramFromBytes;
+import 'package:kernel/kernel.dart' show loadComponentFromBytes;
import 'package:kernel/target/targets.dart' show Target;
@@ -47,7 +47,7 @@
new DillTarget(c.options.ticker, uriTranslator, c.options.target);
if (platform != null) {
var bytes = await fileSystem.entityForUri(platform).readAsBytes();
- var platformProgram = loadProgramFromBytes(bytes);
+ var platformProgram = loadComponentFromBytes(bytes);
dillTarget.loader.appendLibraries(platformProgram);
}
KernelTarget kernelTarget = new KernelTarget(
diff --git a/pkg/front_end/lib/src/fasta/incremental_compiler.dart b/pkg/front_end/lib/src/fasta/incremental_compiler.dart
index c530048..eba0a79 100644
--- a/pkg/front_end/lib/src/fasta/incremental_compiler.dart
+++ b/pkg/front_end/lib/src/fasta/incremental_compiler.dart
@@ -8,7 +8,7 @@
import 'package:kernel/binary/ast_from_binary.dart' show BinaryBuilder;
-import 'package:kernel/kernel.dart' show Library, Procedure, Program, Source;
+import 'package:kernel/kernel.dart' show Library, Procedure, Component, Source;
import '../api_prototype/incremental_kernel_generator.dart'
show IncrementalKernelGenerator;
@@ -52,10 +52,10 @@
: ticker = context.options.ticker;
@override
- Future<Program> computeDelta({Uri entryPoint}) async {
+ Future<Component> computeDelta({Uri entryPoint}) async {
ticker.reset();
entryPoint ??= context.options.inputs.single;
- return context.runInContext<Future<Program>>((CompilerContext c) async {
+ return context.runInContext<Future<Component>>((CompilerContext c) async {
IncrementalCompilerData data = new IncrementalCompilerData();
if (dillLoadedData == null) {
UriTranslator uriTranslator = await c.options.getUriTranslator();
@@ -67,7 +67,7 @@
try {
bytesLength += await initializeFromDill(summaryBytes, c, data);
} catch (e) {
- // We might have loaded x out of y libraries into the program.
+ // We might have loaded x out of y libraries into the component.
// To avoid any unforeseen problems start over.
bytesLength = prepareSummary(summaryBytes, uriTranslator, c, data);
}
@@ -131,10 +131,10 @@
await userCode.buildOutlines();
- // This is not the full program. It is the program including all
+ // This is not the full program. It is the component including all
// libraries loaded from .dill files.
- Program programWithDill =
- await userCode.buildProgram(verify: c.options.verify);
+ Component programWithDill =
+ await userCode.buildComponent(verify: c.options.verify);
List<Library> libraries =
new List<Library>.from(userCode.loader.libraries);
@@ -158,11 +158,12 @@
});
}
- // This is the incremental program.
+ // This component represents the parts of the program that were
+ // recompiled.
Procedure mainMethod = programWithDill == null
? data.userLoadedUriMain
: programWithDill.mainMethod;
- return new Program(libraries: libraries, uriToSource: data.uriToSource)
+ return new Component(libraries: libraries, uriToSource: data.uriToSource)
..mainMethod = mainMethod;
});
}
@@ -174,9 +175,9 @@
if (summaryBytes != null) {
ticker.logMs("Read ${c.options.sdkSummary}");
- data.program = new Program();
+ data.component = new Component();
new BinaryBuilder(summaryBytes, disableLazyReading: false)
- .readProgram(data.program);
+ .readComponent(data.component);
ticker.logMs("Deserialized ${c.options.sdkSummary}");
bytesLength += summaryBytes.length;
}
@@ -194,32 +195,32 @@
List<int> initializationBytes = await entity.readAsBytes();
if (initializationBytes != null) {
Set<Uri> prevLibraryUris = new Set<Uri>.from(
- data.program.libraries.map((Library lib) => lib.importUri));
+ data.component.libraries.map((Library lib) => lib.importUri));
ticker.logMs("Read $initializeFromDillUri");
// We're going to output all we read here so lazy loading it
// doesn't make sense.
new BinaryBuilder(initializationBytes, disableLazyReading: true)
- .readProgram(data.program);
+ .readComponent(data.component);
initializedFromDill = true;
bytesLength += initializationBytes.length;
- for (Library lib in data.program.libraries) {
+ for (Library lib in data.component.libraries) {
if (prevLibraryUris.contains(lib.importUri)) continue;
data.importUriToOrder[lib.importUri] = data.importUriToOrder.length;
}
- data.userLoadedUriMain = data.program.mainMethod;
+ data.userLoadedUriMain = data.component.mainMethod;
data.includeUserLoadedLibraries = true;
- data.uriToSource.addAll(data.program.uriToSource);
+ data.uriToSource.addAll(data.component.uriToSource);
}
}
return bytesLength;
}
void appendLibraries(IncrementalCompilerData data, int bytesLength) {
- if (data.program != null) {
+ if (data.component != null) {
dillLoadedData.loader
- .appendLibraries(data.program, byteCount: bytesLength);
+ .appendLibraries(data.component, byteCount: bytesLength);
}
ticker.logMs("Appended libraries");
}
@@ -327,7 +328,7 @@
Map<Uri, Source> uriToSource;
Map<Uri, int> importUriToOrder;
Procedure userLoadedUriMain;
- Program program;
+ Component component;
IncrementalCompilerData() {
reset();
@@ -338,6 +339,6 @@
uriToSource = <Uri, Source>{};
importUriToOrder = <Uri, int>{};
userLoadedUriMain = null;
- program = null;
+ component = null;
}
}
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_outline_shaker.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_outline_shaker.dart
index 979fc5f..687e5ff 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_outline_shaker.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_outline_shaker.dart
@@ -17,11 +17,11 @@
/// the included libraries. Only outlines are serialized, even for included
/// libraries, all function bodies are ignored.
void serializeTrimmedOutline(
- Sink<List<int>> sink, Program program, bool isIncluded(Uri uri)) {
+ Sink<List<int>> sink, Component component, bool isIncluded(Uri uri)) {
var data = new _RetainedDataBuilder();
- data._markRequired(program);
+ data._markRequired(component);
- for (var library in program.libraries) {
+ for (var library in component.libraries) {
if (!isIncluded(library.importUri)) continue;
data.markAdditionalExports(library);
for (var clazz in library.classes) {
@@ -42,35 +42,36 @@
}
}
- new _TrimmedBinaryPrinter(sink, isIncluded, data).writeProgramFile(program);
+ new _TrimmedBinaryPrinter(sink, isIncluded, data)
+ .writeComponentFile(component);
}
-/// Removes unnecessary libraries, classes, and members from [program].
+/// Removes unnecessary libraries, classes, and members from [component].
///
/// This applies a simple "tree-shaking" technique: the full body of libraries
/// whose URI match [isIncluded] is preserved, and so is the outline of the
/// members and classes which are transitively visible from the
/// included libraries.
///
-/// The intent is that the resulting program has the entire code that is meant
+/// The intent is that the resulting component has the entire code that is meant
/// to be included and the minimum required to prevent dangling references and
/// allow modular program transformations.
///
-/// Note that the resulting program may include libraries not in [isIncluded],
+/// Note that the resulting component may include libraries not in [isIncluded],
/// but those will be marked as external. There should be no method bodies for
/// any members of those libraries.
-void trimProgram(Program program, bool isIncluded(Uri uri)) {
+void trimProgram(Component component, bool isIncluded(Uri uri)) {
var data = new _RetainedDataBuilder();
- data._markRequired(program);
+ data._markRequired(component);
- data.markMember(program.mainMethod);
- for (var library in program.libraries) {
+ data.markMember(component.mainMethod);
+ for (var library in component.libraries) {
if (isIncluded(library.importUri)) {
library.accept(data);
}
}
- new _KernelOutlineShaker(isIncluded, data).transform(program);
+ new _KernelOutlineShaker(isIncluded, data).transform(component);
}
/// Transformer that trims everything in the excluded libraries that is not
@@ -109,9 +110,9 @@
@override
TreeNode defaultTreeNode(TreeNode node) => node;
- void transform(Program program) {
+ void transform(Component component) {
var toRemove = new Set<Library>();
- for (var library in program.libraries) {
+ for (var library in component.libraries) {
if (!isIncluded(library.importUri)) {
if (!data.isLibraryUsed(library)) {
toRemove.add(library);
@@ -121,7 +122,7 @@
}
}
}
- program.libraries.removeWhere(toRemove.contains);
+ component.libraries.removeWhere(toRemove.contains);
}
@override
@@ -530,8 +531,8 @@
/// transformers.
// TODO(sigmund): consider being more fine-grained and only marking what is
// seen and used.
- void _markRequired(Program program) {
- var coreTypes = new CoreTypes(program);
+ void _markRequired(Component component) {
+ var coreTypes = new CoreTypes(component);
coreTypes.objectClass.members.forEach(markMember);
// These are assumed to be available by fasta:
@@ -660,8 +661,8 @@
}
@override
- void writeLibraries(Program program) {
- for (var library in program.libraries) {
+ void writeLibraries(Component component) {
+ for (var library in component.libraries) {
if (isIncluded(library.importUri) || data.isLibraryUsed(library)) {
librariesToWrite.add(library);
}
@@ -697,8 +698,8 @@
}
@override
- void writeProgramIndex(Program program, List<Library> libraries) {
- super.writeProgramIndex(program, librariesToWrite);
+ void writeComponentIndex(Component component, List<Library> libraries) {
+ super.writeComponentIndex(component, librariesToWrite);
}
@override
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
index 388fd98..9550057 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
@@ -30,7 +30,7 @@
NullLiteral,
Procedure,
ProcedureKind,
- Program,
+ Component,
Source,
Statement,
StringLiteral,
@@ -92,7 +92,7 @@
import 'metadata_collector.dart' show MetadataCollector;
-import 'verifier.dart' show verifyProgram;
+import 'verifier.dart' show verifyComponent;
class KernelTarget extends TargetImplementation {
/// The [FileSystem] which should be used to access files.
@@ -111,7 +111,7 @@
SourceLoader<Library> loader;
- Program program;
+ Component component;
final List<LocatedMessage> errors = <LocatedMessage>[];
@@ -220,17 +220,17 @@
builder.mixedInType = null;
}
- void handleInputError(deprecated_InputError error, {bool isFullProgram}) {
+ void handleInputError(deprecated_InputError error, {bool isFullComponent}) {
if (error != null) {
LocatedMessage message = deprecated_InputError.toMessage(error);
context.report(message, Severity.error);
errors.add(message);
}
- program = erroneousProgram(isFullProgram);
+ component = erroneousComponent(isFullComponent);
}
@override
- Future<Program> buildOutlines({CanonicalName nameRoot}) async {
+ Future<Component> buildOutlines({CanonicalName nameRoot}) async {
if (loader.first == null) return null;
try {
loader.createTypeInferenceEngine();
@@ -248,14 +248,14 @@
List<SourceClassBuilder> myClasses = collectMyClasses();
loader.checkSemantics(myClasses);
loader.finishTypeVariables(objectClassBuilder);
- loader.buildProgram();
+ loader.buildComponent();
installDefaultSupertypes();
installDefaultConstructors(myClasses);
loader.resolveConstructors();
- program =
+ component =
link(new List<Library>.from(loader.libraries), nameRoot: nameRoot);
if (metadataCollector != null) {
- program.addMetadataRepository(metadataCollector.repository);
+ component.addMetadataRepository(metadataCollector.repository);
}
computeCoreTypes();
loader.computeHierarchy();
@@ -266,30 +266,30 @@
loader.checkOverrides(myClasses);
} on deprecated_InputError catch (e) {
ticker.logMs("Got deprecated_InputError");
- handleInputError(e, isFullProgram: false);
+ handleInputError(e, isFullComponent: false);
} catch (e, s) {
return reportCrash(e, s, loader?.currentUriForCrashReporting);
}
- return program;
+ return component;
}
- /// Build the kernel representation of the program loaded by this target. The
- /// program will contain full bodies for the code loaded from sources, and
+ /// Build the kernel representation of the component loaded by this target. The
+ /// component will contain full bodies for the code loaded from sources, and
/// only references to the code loaded by the [DillTarget], which may or may
/// not include method bodies (depending on what was loaded into that target,
- /// an outline or a full kernel program).
+ /// an outline or a full kernel component).
///
- /// If [verify], run the default kernel verification on the resulting program.
+ /// If [verify], run the default kernel verification on the resulting component.
@override
- Future<Program> buildProgram({bool verify: false}) async {
+ Future<Component> buildComponent({bool verify: false}) async {
if (loader.first == null) return null;
if (errors.isNotEmpty) {
- handleInputError(null, isFullProgram: true);
- return program;
+ handleInputError(null, isFullComponent: true);
+ return component;
}
try {
- ticker.logMs("Building program");
+ ticker.logMs("Building component");
await loader.buildBodies();
loader.finishDeferredLoadTearoffs();
List<SourceClassBuilder> myClasses = collectMyClasses();
@@ -300,16 +300,16 @@
if (verify) this.verify();
if (errors.isNotEmpty) {
- handleInputError(null, isFullProgram: true);
+ handleInputError(null, isFullComponent: true);
}
handleRecoverableErrors(loader.unhandledErrors);
} on deprecated_InputError catch (e) {
ticker.logMs("Got deprecated_InputError");
- handleInputError(e, isFullProgram: true);
+ handleInputError(e, isFullComponent: true);
} catch (e, s) {
return reportCrash(e, s, loader?.currentUriForCrashReporting);
}
- return program;
+ return component;
}
/// Adds a synthetic field named `#errors` to the main library that contains
@@ -317,13 +317,13 @@
///
/// If [recoverableErrors] is empty, this method does nothing.
///
- /// If there's no main library, this method uses [erroneousProgram] to
- /// replace [program].
+ /// If there's no main library, this method uses [erroneousComponent] to
+ /// replace [component].
void handleRecoverableErrors(List<LocatedMessage> recoverableErrors) {
if (recoverableErrors.isEmpty) return;
KernelLibraryBuilder mainLibrary = loader.first;
if (mainLibrary == null) {
- program = erroneousProgram(true);
+ component = erroneousComponent(true);
return;
}
List<Expression> expressions = <Expression>[];
@@ -337,13 +337,13 @@
isStatic: true));
}
- Program erroneousProgram(bool isFullProgram) {
+ Component erroneousComponent(bool isFullComponent) {
Uri uri = loader.first?.uri ?? Uri.parse("error:error");
Uri fileUri = loader.first?.fileUri ?? uri;
KernelLibraryBuilder library =
new KernelLibraryBuilder(uri, fileUri, loader, null);
loader.first = library;
- if (isFullProgram) {
+ if (isFullComponent) {
// If this is an outline, we shouldn't add an executable main
// method. Similarly considerations apply to separate compilation. It
// could also make sense to add a way to mark .dill files as having
@@ -360,9 +360,9 @@
return link(<Library>[library.library]);
}
- /// Creates a program by combining [libraries] with the libraries of
- /// `dillTarget.loader.program`.
- Program link(List<Library> libraries, {CanonicalName nameRoot}) {
+ /// Creates a component by combining [libraries] with the libraries of
+ /// `dillTarget.loader.component`.
+ Component link(List<Library> libraries, {CanonicalName nameRoot}) {
libraries.addAll(dillTarget.loader.libraries);
Map<Uri, Source> uriToSource = new Map<Uri, Source>();
@@ -374,22 +374,22 @@
this.uriToSource.forEach(copySource);
dillTarget.loader.uriToSource.forEach(copySource);
- Program program = new Program(
+ Component component = new Component(
nameRoot: nameRoot, libraries: libraries, uriToSource: uriToSource);
if (loader.first != null) {
// TODO(sigmund): do only for full program
Builder builder = loader.first.exportScope.lookup("main", -1, null);
if (builder is KernelProcedureBuilder) {
- program.mainMethod = builder.procedure;
+ component.mainMethod = builder.procedure;
} else if (builder is DillMemberBuilder) {
if (builder.member is Procedure) {
- program.mainMethod = builder.member;
+ component.mainMethod = builder.member;
}
}
}
- ticker.logMs("Linked program");
- return program;
+ ticker.logMs("Linked component");
+ return component;
}
void installDefaultSupertypes() {
@@ -575,7 +575,7 @@
libraries.add(library.target);
}
}
- Program plaformLibraries = new Program();
+ Component plaformLibraries = new Component();
// Add libraries directly to prevent that their parents are changed.
plaformLibraries.libraries.addAll(libraries);
loader.computeCoreTypes(plaformLibraries);
@@ -711,8 +711,8 @@
}
void verify() {
- errors.addAll(verifyProgram(program));
- ticker.logMs("Verified program");
+ errors.addAll(verifyComponent(component));
+ ticker.logMs("Verified component");
}
/// Return `true` if the given [library] was built by this [KernelTarget]
diff --git a/pkg/front_end/lib/src/fasta/kernel/metadata_collector.dart b/pkg/front_end/lib/src/fasta/kernel/metadata_collector.dart
index 944540a..2b73d92 100644
--- a/pkg/front_end/lib/src/fasta/kernel/metadata_collector.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/metadata_collector.dart
@@ -7,7 +7,7 @@
/// The collector to add target specific metadata to.
abstract class MetadataCollector {
/// Metadata is remembered in this repository, so that when it is added
- /// to a program, metadata is serialized with the program.
+ /// to a component, metadata is serialized with the component.
MetadataRepository get repository;
void setConstructorNameOffset(Member node, Object name);
diff --git a/pkg/front_end/lib/src/fasta/kernel/utils.dart b/pkg/front_end/lib/src/fasta/kernel/utils.dart
index 4a9bd7f0..8bcda60 100644
--- a/pkg/front_end/lib/src/fasta/kernel/utils.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/utils.dart
@@ -6,7 +6,7 @@
import 'dart:io' show BytesBuilder, File, IOSink;
-import 'package:kernel/ast.dart' show Library, Program;
+import 'package:kernel/ast.dart' show Library, Component;
import 'package:kernel/binary/ast_to_binary.dart' show BinaryPrinter;
@@ -15,13 +15,14 @@
import 'package:kernel/text/ast_to_text.dart' show Printer;
-/// Print the given [program]. Do nothing if it is `null`. If the
+/// Print the given [component]. Do nothing if it is `null`. If the
/// [libraryFilter] is provided, then only libraries that satisfy it are
/// printed.
-void printProgramText(Program program, {bool libraryFilter(Library library)}) {
- if (program == null) return;
+void printComponentText(Component component,
+ {bool libraryFilter(Library library)}) {
+ if (component == null) return;
StringBuffer sb = new StringBuffer();
- for (Library library in program.libraries) {
+ for (Library library in component.libraries) {
if (libraryFilter != null && !libraryFilter(library)) continue;
Printer printer = new Printer(sb);
printer.writeLibraryFile(library);
@@ -29,8 +30,8 @@
print(sb);
}
-/// Write [program] to file only including libraries that match [filter].
-Future<Null> writeProgramToFile(Program program, Uri uri,
+/// Write [component] to file only including libraries that match [filter].
+Future<Null> writeComponentToFile(Component component, Uri uri,
{bool filter(Library library)}) async {
File output = new File.fromUri(uri);
IOSink sink = output.openWrite();
@@ -38,22 +39,22 @@
BinaryPrinter printer = filter == null
? new BinaryPrinter(sink)
: new LimitedBinaryPrinter(sink, filter ?? (_) => true, false);
- printer.writeProgramFile(program);
- program.unbindCanonicalNames();
+ printer.writeComponentFile(component);
+ component.unbindCanonicalNames();
} finally {
await sink.close();
}
}
-/// Serialize the libraries in [program] that match [filter].
-List<int> serializeProgram(Program program,
+/// Serialize the libraries in [component] that match [filter].
+List<int> serializeComponent(Component component,
{bool filter(Library library), bool excludeUriToSource: false}) {
ByteSink byteSink = new ByteSink();
BinaryPrinter printer = filter == null && !excludeUriToSource
? new BinaryPrinter(byteSink)
: new LimitedBinaryPrinter(
byteSink, filter ?? (_) => true, excludeUriToSource);
- printer.writeProgramFile(program);
+ printer.writeComponentFile(component);
return byteSink.builder.takeBytes();
}
diff --git a/pkg/front_end/lib/src/fasta/kernel/verifier.dart b/pkg/front_end/lib/src/fasta/kernel/verifier.dart
index 6cfa12c..86aaafd 100644
--- a/pkg/front_end/lib/src/fasta/kernel/verifier.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/verifier.dart
@@ -14,7 +14,7 @@
Library,
Member,
Procedure,
- Program,
+ Component,
StaticInvocation,
SuperMethodInvocation,
SuperPropertyGet,
@@ -37,9 +37,11 @@
import 'redirecting_factory_body.dart'
show RedirectingFactoryBody, getRedirectingFactoryBody;
-List<LocatedMessage> verifyProgram(Program program, {bool isOutline: false}) {
- FastaVerifyingVisitor verifier = new FastaVerifyingVisitor(isOutline);
- program.accept(verifier);
+List<LocatedMessage> verifyComponent(Component component,
+ {bool isOutline: false, bool skipPlatform: false}) {
+ FastaVerifyingVisitor verifier =
+ new FastaVerifyingVisitor(isOutline, skipPlatform);
+ component.accept(verifier);
return verifier.errors;
}
@@ -48,8 +50,9 @@
final List<LocatedMessage> errors = <LocatedMessage>[];
Uri fileUri;
+ final bool skipPlatform;
- FastaVerifyingVisitor(bool isOutline) {
+ FastaVerifyingVisitor(bool isOutline, this.skipPlatform) {
this.isOutline = isOutline;
}
@@ -129,6 +132,10 @@
@override
visitLibrary(Library node) {
+ // Issue(http://dartbug.com/32530)
+ if (skipPlatform && node.importUri.scheme == 'dart') {
+ return;
+ }
fileUri = checkLocation(node, node.name, node.fileUri);
super.visitLibrary(node);
}
diff --git a/pkg/front_end/lib/src/fasta/messages.dart b/pkg/front_end/lib/src/fasta/messages.dart
index 9c654de..397ce96 100644
--- a/pkg/front_end/lib/src/fasta/messages.dart
+++ b/pkg/front_end/lib/src/fasta/messages.dart
@@ -4,7 +4,7 @@
library fasta.messages;
-import 'package:kernel/ast.dart' show Library, Location, Program, TreeNode;
+import 'package:kernel/ast.dart' show Library, Location, Component, TreeNode;
import 'compiler_context.dart' show CompilerContext;
@@ -28,18 +28,18 @@
}
Location getLocationFromNode(TreeNode node) {
- if (node.enclosingProgram == null) {
+ if (node.enclosingComponent == null) {
TreeNode parent = node;
while (parent != null && parent is! Library) {
parent = parent.parent;
}
if (parent is Library) {
- Program program =
- new Program(uriToSource: CompilerContext.current.uriToSource);
- program.libraries.add(parent);
- parent.parent = program;
+ Component component =
+ new Component(uriToSource: CompilerContext.current.uriToSource);
+ component.libraries.add(parent);
+ parent.parent = component;
Location result = node.location;
- program.libraries.clear();
+ component.libraries.clear();
parent.parent = null;
return result;
} else {
diff --git a/pkg/front_end/lib/src/fasta/parser/parser.dart b/pkg/front_end/lib/src/fasta/parser/parser.dart
index 466f059..5203691 100644
--- a/pkg/front_end/lib/src/fasta/parser/parser.dart
+++ b/pkg/front_end/lib/src/fasta/parser/parser.dart
@@ -93,7 +93,13 @@
import 'type_continuation.dart'
show TypeContinuation, typeContinuationFromFormalParameterKind;
-import 'type_info.dart' show isGeneralizedFunctionType, isValidTypeReference;
+import 'type_info.dart'
+ show
+ TypeInfo,
+ computeType,
+ isGeneralizedFunctionType,
+ isValidTypeReference,
+ noTypeInfo;
import 'util.dart' show closeBraceTokenFor, optional;
@@ -5508,13 +5514,92 @@
return token;
}
- Token parseVariablesDeclaration(Token token) {
- token = parseMetadataStar(token);
- return parseVariablesDeclarationMaybeSemicolon(token, true);
+ /// Parse the metadata, modifiers, and type of a local declaration and return
+ /// the last token consumed. If a local variable declaration or local
+ /// function declaration is not found, then return the starting token.
+ Token parseLocalDeclarationStartOpt(final Token start) {
+ Token token = start;
+ Token next = token.next;
+ if (optional('@', next)) {
+ token = parseMetadataStar(token);
+ next = token.next;
+ }
+
+ TypeContinuation typeContinuation;
+ Token varFinalOrConst;
+ if (isModifier(next)) {
+ if (optional('var', next)) {
+ typeContinuation = TypeContinuation.OptionalAfterVar;
+ varFinalOrConst = token = token.next;
+ next = token.next;
+ } else if (optional('final', next) || optional('const', next)) {
+ typeContinuation = TypeContinuation.Optional;
+ varFinalOrConst = token = token.next;
+ next = token.next;
+ }
+
+ if (isModifier(next)) {
+ // Recovery
+ ModifierRecoveryContext2 modifierContext =
+ new ModifierRecoveryContext2(this);
+ token = modifierContext.parseVariableDeclarationModifiers(
+ token, typeContinuation,
+ varFinalOrConst: varFinalOrConst);
+ next = token.next;
+
+ varFinalOrConst = modifierContext.varFinalOrConst;
+ typeContinuation = modifierContext.typeContinuation;
+ modifierContext = null;
+ }
+ }
+
+ Token beforeType = token;
+ TypeInfo typeInfo = computeType(beforeType, false);
+ token = typeInfo.skipType(beforeType);
+ next = token.next;
+
+ if (next.isIdentifier) {
+ if (optional('<', next.next) || optional('(', next.next)) {
+ // Found an expression or local function declaration.
+ // TODO(danrubel): Process local function declarations.
+ return start;
+ }
+ }
+
+ if (token == start) {
+ // If no annotation, modifier, or type, and this is not a local function
+ // then return without consuming any tokens because this is not
+ // a local declaration.
+ return start;
+ }
+
+ if (!optional('@', start.next)) {
+ listener.beginMetadataStar(start.next);
+ listener.endMetadataStar(0);
+ }
+ token = typeInfo.parseType(beforeType, this);
+ next = token.next;
+
+ // If there is not an identifier, then allow ensureIdentifier to report an
+ // error and don't report errors here.
+ if (next.isIdentifier) {
+ if (varFinalOrConst == null) {
+ if (typeInfo == noTypeInfo) {
+ reportRecoverableError(next, fasta.messageMissingConstFinalVarOrType);
+ }
+ } else if (optional('var', varFinalOrConst)) {
+ if (typeInfo != noTypeInfo) {
+ reportRecoverableError(varFinalOrConst, fasta.messageTypeAfterVar);
+ }
+ }
+ }
+
+ listener.beginVariablesDeclaration(next, varFinalOrConst);
+ return token;
}
- Token parseVariablesDeclarationMaybeSemicolon(
- Token token, bool endWithSemicolon) {
+ Token parseVariablesDeclaration(Token token) {
+ token = parseMetadataStar(token);
Token next = token.next;
TypeContinuation typeContinuation;
@@ -5544,16 +5629,30 @@
}
}
- token = parseType(token, typeContinuation ?? TypeContinuation.Required,
- null, MemberKind.Local);
- return parseVariablesDeclarationMaybeSemicolonRest(
- token, varFinalOrConst, endWithSemicolon);
+ TypeInfo typeInfo = computeType(token, false);
+ if (varFinalOrConst == null) {
+ if (typeInfo == noTypeInfo) {
+ // If there is no modifer, no type, and no identifier
+ // then let parseVariablesDeclarationMaybeSemicolonRest
+ // report a missing identifier rather than reporting two errors.
+ if (token.next.isIdentifier) {
+ reportRecoverableError(
+ token.next, fasta.messageMissingConstFinalVarOrType);
+ }
+ }
+ } else if (optional('var', varFinalOrConst)) {
+ if (typeInfo != noTypeInfo) {
+ reportRecoverableError(token.next, fasta.messageTypeAfterVar);
+ }
+ }
+ token = typeInfo.parseType(token, this);
+
+ listener.beginVariablesDeclaration(token.next, varFinalOrConst);
+ return parseVariablesDeclarationRest(token, true);
}
- Token parseVariablesDeclarationMaybeSemicolonRest(
- Token token, Token varFinalOrConst, bool endWithSemicolon) {
+ Token parseVariablesDeclarationRest(Token token, bool endWithSemicolon) {
int count = 1;
- listener.beginVariablesDeclaration(token.next, varFinalOrConst);
token = parseOptionallyInitializedIdentifier(token);
while (optional(',', token.next)) {
token = parseOptionallyInitializedIdentifier(token.next);
@@ -5646,57 +5745,47 @@
}
token = leftParenthesis;
- Token beforeIdentifier;
- final String stringValue = token.next.stringValue;
- if (identical(stringValue, ';')) {
+ token = parseLocalDeclarationStartOpt(token);
+ Token beforeIdentifier = token;
+ if (token != leftParenthesis) {
+ token = parseVariablesDeclarationRest(token, false);
+ } else if (optional(';', token.next)) {
listener.handleNoExpression(token.next);
} else {
- if (identical('@', stringValue) ||
- identical('var', stringValue) ||
- identical('final', stringValue) ||
- identical('const', stringValue)) {
- token = parseMetadataStar(token);
- beforeIdentifier = skipTypeReferenceOpt(token, false);
- // TODO(ahe, danrubel): Generate type events and call
- // parseVariablesDeclarationNoSemicolonRest instead.
- token = parseVariablesDeclarationMaybeSemicolon(token, false);
- } else {
- beforeIdentifier = skipTypeReferenceOpt(token, false);
- if (token == beforeIdentifier) {
- // No type found, just parse expression
- token = parseExpression(token);
- } else {
- // TODO(ahe, danrubel): Generate type events and call
- // parseVariablesDeclarationNoSemicolonRest instead.
- token = parseMetadataStar(token);
- token = parseVariablesDeclarationMaybeSemicolon(token, false);
- }
- }
+ token = parseExpression(token);
}
Token next = token.next;
- if (optional('in', next)) {
- if (awaitToken != null && !inAsync) {
- reportRecoverableError(next, fasta.messageAwaitForNotAsync);
+ if (!optional('in', next)) {
+ if (optional(':', next)) {
+ reportRecoverableError(next, fasta.messageColonInPlaceOfIn);
+ // Fall through to process `for ( ... in ... )`
+ } else {
+ // Process `for ( ... ; ... ; ... )`
+ if (awaitToken != null) {
+ reportRecoverableError(awaitToken, fasta.messageInvalidAwaitFor);
+ }
+ return parseForRest(token, forKeyword, leftParenthesis);
}
- if (beforeIdentifier != null &&
- optional('=', beforeIdentifier.next.next)) {
- reportRecoverableError(beforeIdentifier.next.next,
- fasta.messageInitializedVariableInForEach);
- }
- return parseForInRest(awaitToken, forKeyword, leftParenthesis, token);
- } else if (optional(':', next)) {
- reportRecoverableError(next, fasta.messageColonInPlaceOfIn);
- if (awaitToken != null && !inAsync) {
- reportRecoverableError(next, fasta.messageAwaitForNotAsync);
- }
- return parseForInRest(awaitToken, forKeyword, leftParenthesis, token);
- } else {
- if (awaitToken != null) {
- reportRecoverableError(awaitToken, fasta.messageInvalidAwaitFor);
- }
- return parseForRest(forKeyword, leftParenthesis, token);
}
+
+ // Process `for ( ... in ... )`
+ Token identifier = beforeIdentifier.next;
+ if (!identifier.isIdentifier) {
+ reportRecoverableErrorWithToken(
+ identifier, fasta.templateExpectedIdentifier);
+ } else if (identifier != token) {
+ if (optional('=', identifier.next)) {
+ reportRecoverableError(
+ identifier.next, fasta.messageInitializedVariableInForEach);
+ } else {
+ reportRecoverableErrorWithToken(
+ identifier.next, fasta.templateUnexpectedToken);
+ }
+ } else if (awaitToken != null && !inAsync) {
+ reportRecoverableError(next, fasta.messageAwaitForNotAsync);
+ }
+ return parseForInRest(token, awaitToken, forKeyword, leftParenthesis);
}
/// This method parses the portion of the forLoopParts that starts with the
@@ -5709,8 +5798,7 @@
/// identifier 'in' expression
/// ;
/// ```
- Token parseForRest(Token forToken, Token leftParenthesis, Token token) {
- // TODO(brianwilkerson): Consider moving `token` to be the first parameter.
+ Token parseForRest(Token token, Token forToken, Token leftParenthesis) {
Token leftSeparator = ensureSemicolon(token);
if (optional(';', leftSeparator.next)) {
token = parseEmptyStatement(leftSeparator);
@@ -5730,7 +5818,10 @@
break;
}
}
- expect(')', token);
+ if (token != leftParenthesis.endGroup) {
+ reportRecoverableErrorWithToken(token, fasta.templateUnexpectedToken);
+ token = leftParenthesis.endGroup;
+ }
listener.beginForStatementBody(token.next);
LoopState savedLoopState = loopState;
loopState = LoopState.InsideLoop;
@@ -5754,8 +5845,7 @@
/// ;
/// ```
Token parseForInRest(
- Token awaitToken, Token forKeyword, Token leftParenthesis, Token token) {
- // TODO(brianwilkerson): Consider moving `token` to be the first parameter.
+ Token token, Token awaitToken, Token forKeyword, Token leftParenthesis) {
Token inKeyword = token.next;
assert(optional('in', inKeyword) || optional(':', inKeyword));
listener.beginForInExpression(inKeyword.next);
diff --git a/pkg/front_end/lib/src/fasta/parser/type_info.dart b/pkg/front_end/lib/src/fasta/parser/type_info.dart
index 8a012ce..d282fcb 100644
--- a/pkg/front_end/lib/src/fasta/parser/type_info.dart
+++ b/pkg/front_end/lib/src/fasta/parser/type_info.dart
@@ -35,12 +35,13 @@
abstract class TypeInfo {
/// Call this function when it's known that the token after [token] is a type.
/// This function will call the appropriate event methods on the [Parser]'s
- /// listener to handle the type.
+ /// listener to handle the type. This may modify the token stream
+ /// when parsing `>>` in valid code or during recovery.
Token parseType(Token token, Parser parser);
/// Call this function with the [token] before the type to obtain
/// the last token in the type. If there is no type, then this method
- /// will return [token].
+ /// will return [token]. This does not modify the token stream.
Token skipType(Token token);
}
@@ -85,7 +86,7 @@
}
/// Called by the parser to obtain information about a possible type reference
-/// that follows [token].
+/// that follows [token]. This does not modify the token stream.
TypeInfo computeType(final Token token, bool required) {
Token next = token.next;
if (!isValidTypeReference(next)) {
@@ -238,9 +239,17 @@
listener.endFunctionType(functionToken, token.next);
}
- assert(
- identical(token, end) || (optional('>', token) && optional('>>', end)));
- return token;
+ // There are two situations in which the [token] != [end]:
+ // Valid code: identifier `<` identifier `<` identifier `>>`
+ // where `>>` is replaced by two tokens.
+ // Invalid code: identifier `<` identifier identifier `>`
+ // where a synthetic `>` is inserted between the identifiers.
+ assert(identical(token, end) || optional('>', token));
+
+ // During recovery, [token] may be a synthetic that was inserted in the
+ // middle of the type reference. In this situation, return [end] so that it
+ // matches [skipType], and so that the next token to be parsed is correct.
+ return token.isSynthetic ? end : token;
}
@override
diff --git a/pkg/front_end/lib/src/fasta/source/source_loader.dart b/pkg/front_end/lib/src/fasta/source/source_loader.dart
index fb478c7..83396f3 100644
--- a/pkg/front_end/lib/src/fasta/source/source_loader.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_loader.dart
@@ -15,7 +15,7 @@
Expression,
Library,
LibraryDependency,
- Program,
+ Component,
Supertype;
import 'package:kernel/class_hierarchy.dart' show ClassHierarchy;
@@ -544,7 +544,7 @@
ticker.logMs("Checked restricted supertypes");
}
- void buildProgram() {
+ void buildComponent() {
builders.forEach((Uri uri, LibraryBuilder library) {
if (library.loader == this) {
SourceLibraryBuilder sourceLibrary = library;
@@ -554,10 +554,10 @@
}
}
});
- ticker.logMs("Built program");
+ ticker.logMs("Built component");
}
- Program computeFullProgram() {
+ Component computeFullProgram() {
Set<Library> libraries = new Set<Library>();
List<Library> workList = <Library>[];
builders.forEach((Uri uri, LibraryBuilder library) {
@@ -575,7 +575,7 @@
}
}
}
- return new Program()..libraries.addAll(libraries);
+ return new Component()..libraries.addAll(libraries);
}
void computeHierarchy() {
@@ -614,8 +614,8 @@
void ignoreAmbiguousSupertypes(Class cls, Supertype a, Supertype b) {}
- void computeCoreTypes(Program program) {
- coreTypes = new CoreTypes(program);
+ void computeCoreTypes(Component component) {
+ coreTypes = new CoreTypes(component);
ticker.logMs("Computed core types");
}
diff --git a/pkg/front_end/lib/src/fasta/target.dart b/pkg/front_end/lib/src/fasta/target.dart
index c49da71..30b3754 100644
--- a/pkg/front_end/lib/src/fasta/target.dart
+++ b/pkg/front_end/lib/src/fasta/target.dart
@@ -12,7 +12,7 @@
/// A compilation target.
///
/// A target reads source files with [read], builds outlines when
-/// [buildOutlines] is called and builds the full program when [buildProgram]
+/// [buildOutlines] is called and builds the full component when [buildComponent]
/// is called.
abstract class Target {
final Ticker ticker;
@@ -23,8 +23,8 @@
void read(Uri uri);
/// Build and return outlines for all libraries.
- Future<Program> buildOutlines();
+ Future<Component> buildOutlines();
- /// Build and return the full program for all libraries.
- Future<Program> buildProgram();
+ /// Build and return the full component for all libraries.
+ Future<Component> buildComponent();
}
diff --git a/pkg/front_end/lib/src/fasta/testing/kernel_chain.dart b/pkg/front_end/lib/src/fasta/testing/kernel_chain.dart
index 47a7d33..49b1793 100644
--- a/pkg/front_end/lib/src/fasta/testing/kernel_chain.dart
+++ b/pkg/front_end/lib/src/fasta/testing/kernel_chain.dart
@@ -13,7 +13,7 @@
import 'dart:typed_data' show Uint8List;
-import 'package:kernel/ast.dart' show Library, Program;
+import 'package:kernel/ast.dart' show Library, Component;
import 'package:kernel/binary/ast_to_binary.dart' show BinaryPrinter;
@@ -21,7 +21,7 @@
import 'package:kernel/error_formatter.dart' show ErrorFormatter;
-import 'package:kernel/kernel.dart' show loadProgramFromBinary;
+import 'package:kernel/kernel.dart' show loadComponentFromBinary;
import 'package:kernel/naive_type_checker.dart' show StrongModeTypeChecker;
@@ -42,16 +42,16 @@
import '../compiler_context.dart';
-import '../kernel/verifier.dart' show verifyProgram;
+import '../kernel/verifier.dart' show verifyComponent;
-class Print extends Step<Program, Program, ChainContext> {
+class Print extends Step<Component, Component, ChainContext> {
const Print();
String get name => "print";
- Future<Result<Program>> run(Program program, _) async {
+ Future<Result<Component>> run(Component component, _) async {
StringBuffer sb = new StringBuffer();
- for (Library library in program.libraries) {
+ for (Library library in component.libraries) {
Printer printer = new Printer(sb);
if (library.importUri.scheme != "dart" &&
library.importUri.scheme != "package") {
@@ -59,53 +59,59 @@
}
}
print("$sb");
- return pass(program);
+ return pass(component);
}
}
-class Verify extends Step<Program, Program, ChainContext> {
+class Verify extends Step<Component, Component, ChainContext> {
final bool fullCompile;
const Verify(this.fullCompile);
String get name => "verify";
- Future<Result<Program>> run(Program program, ChainContext context) async {
+ Future<Result<Component>> run(
+ Component component, ChainContext context) async {
var options = new ProcessedOptions(new CompilerOptions());
return await CompilerContext.runWithOptions(options, (_) async {
- var errors = verifyProgram(program, isOutline: !fullCompile);
+ var errors = verifyComponent(component,
+ isOutline: !fullCompile, skipPlatform: true);
if (errors.isEmpty) {
- return pass(program);
+ return pass(component);
} else {
- return new Result<Program>(
+ return new Result<Component>(
null, context.expectationSet["VerificationError"], errors, null);
}
});
}
}
-class TypeCheck extends Step<Program, Program, ChainContext> {
+class TypeCheck extends Step<Component, Component, ChainContext> {
const TypeCheck();
String get name => "typeCheck";
- Future<Result<Program>> run(Program program, ChainContext context) async {
+ Future<Result<Component>> run(
+ Component component, ChainContext context) async {
var errorFormatter = new ErrorFormatter();
var checker =
- new StrongModeTypeChecker(errorFormatter, program, ignoreSdk: true);
- checker.checkProgram(program);
+ new StrongModeTypeChecker(errorFormatter, component, ignoreSdk: true);
+ checker.checkComponent(component);
if (errorFormatter.numberOfFailures == 0) {
- return pass(program);
+ return pass(component);
} else {
errorFormatter.failures.forEach(print);
print('------- Found ${errorFormatter.numberOfFailures} errors -------');
- return new Result<Program>(null, context.expectationSet["TypeCheckError"],
- '${errorFormatter.numberOfFailures} type errors', null);
+ return new Result<Component>(
+ null,
+ context.expectationSet["TypeCheckError"],
+ '${errorFormatter.numberOfFailures} type errors',
+ null);
}
}
}
-class MatchExpectation extends Step<Program, Program, ChainContext> {
+class MatchExpectation extends Step<Component, Component, ChainContext> {
final String suffix;
// TODO(ahe): This is true by default which doesn't match well with the class
@@ -116,8 +122,8 @@
String get name => "match expectations";
- Future<Result<Program>> run(Program program, _) async {
- Library library = program.libraries
+ Future<Result<Component>> run(Component component, _) async {
+ Library library = component.libraries
.firstWhere((Library library) => library.importUri.scheme != "dart");
Uri uri = library.importUri;
Uri base = uri.resolve(".");
@@ -134,37 +140,37 @@
return fail(null, "$uri doesn't match ${expectedFile.uri}\n$diff");
}
} else {
- return pass(program);
+ return pass(component);
}
}
if (updateExpectations) {
await openWrite(expectedFile.uri, (IOSink sink) {
sink.writeln(actual.trim());
});
- return pass(program);
+ return pass(component);
} else {
- return fail(program, """
+ return fail(component, """
Please create file ${expectedFile.path} with this content:
$actual""");
}
}
}
-class WriteDill extends Step<Program, Uri, ChainContext> {
+class WriteDill extends Step<Component, Uri, ChainContext> {
const WriteDill();
String get name => "write .dill";
- Future<Result<Uri>> run(Program program, _) async {
+ Future<Result<Uri>> run(Component component, _) async {
Directory tmp = await Directory.systemTemp.createTemp();
Uri uri = tmp.uri.resolve("generated.dill");
File generated = new File.fromUri(uri);
IOSink sink = generated.openWrite();
try {
try {
- new BinaryPrinter(sink).writeProgramFile(program);
+ new BinaryPrinter(sink).writeComponentFile(component);
} finally {
- program.unbindCanonicalNames();
+ component.unbindCanonicalNames();
}
} catch (e, s) {
return fail(uri, e, s);
@@ -183,7 +189,7 @@
Future<Result<Uri>> run(Uri uri, _) async {
try {
- loadProgramFromBinary(uri.toFilePath());
+ loadComponentFromBinary(uri.toFilePath());
} catch (e, s) {
return fail(uri, e, s);
}
@@ -191,34 +197,34 @@
}
}
-class Copy extends Step<Program, Program, ChainContext> {
+class Copy extends Step<Component, Component, ChainContext> {
const Copy();
- String get name => "copy program";
+ String get name => "copy component";
- Future<Result<Program>> run(Program program, _) async {
+ Future<Result<Component>> run(Component component, _) async {
BytesCollector sink = new BytesCollector();
- new BinaryPrinter(sink).writeProgramFile(program);
- program.unbindCanonicalNames();
+ new BinaryPrinter(sink).writeComponentFile(component);
+ component.unbindCanonicalNames();
Uint8List bytes = sink.collect();
- new BinaryBuilder(bytes).readProgram(program);
- return pass(program);
+ new BinaryBuilder(bytes).readComponent(component);
+ return pass(component);
}
}
/// A `package:testing` step that runs the `package:front_end` compiler to
-/// generate a kernel program for an individual file.
+/// generate a kernel component for an individual file.
///
/// Most options are hard-coded, but if necessary they could be moved to the
/// [CompileContext] object in the future.
-class Compile extends Step<TestDescription, Program, CompileContext> {
+class Compile extends Step<TestDescription, Component, CompileContext> {
const Compile();
String get name => "fasta compilation";
- Future<Result<Program>> run(
+ Future<Result<Component>> run(
TestDescription description, CompileContext context) async {
- Result<Program> result;
+ Result<Component> result;
reportError(CompilationMessage error) {
result ??= fail(null, error.message);
}
@@ -240,7 +246,7 @@
computePlatformBinariesLocation().resolve("vm_platform.dill"),
];
}
- Program p = await kernelForProgram(description.uri, options);
+ Component p = await kernelForProgram(description.uri, options);
return result ??= pass(p);
}
}
diff --git a/pkg/front_end/lib/src/fasta/type_inference/type_inference_engine.dart b/pkg/front_end/lib/src/fasta/type_inference/type_inference_engine.dart
index 0f78fba..87723e6 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/type_inference_engine.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/type_inference_engine.dart
@@ -229,7 +229,7 @@
/// corresponding fields.
void finishTopLevelInitializingFormals();
- /// Gets ready to do top level type inference for the program having the given
+ /// Gets ready to do top level type inference for the component having the given
/// [hierarchy], using the given [coreTypes].
void prepareTopLevel(CoreTypes coreTypes, ClassHierarchy hierarchy);
diff --git a/pkg/front_end/lib/src/fasta/type_inference/type_promotion.dart b/pkg/front_end/lib/src/fasta/type_inference/type_promotion.dart
index d40ee3d..fa4b1ea 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/type_promotion.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/type_promotion.dart
@@ -16,7 +16,7 @@
/// methods maintain a linked list of [TypePromotionFact] objects tracking what
/// is known about the state of each variable at the current point in the code,
/// as well as a linked list of [TypePromotionScope] objects tracking the
-/// program's nesting structure. Whenever a variable is read, the current
+/// component's nesting structure. Whenever a variable is read, the current
/// [TypePromotionFact] and [TypePromotionScope] are recorded for later use.
///
/// During type inference, the [TypeInferrer] calls back into this class to ask
@@ -473,7 +473,7 @@
}
/// A single fact which is known to the type promotion engine about the state of
-/// a variable (or about the flow control of the program).
+/// a variable (or about the flow control of the component).
///
/// The type argument V represents is the class which represents local variable
/// declarations.
@@ -481,14 +481,14 @@
/// Facts are linked together into linked lists via the [previous] pointer into
/// a data structure called a "fact chain" (or sometimes a "fact state"), which
/// represents all facts that are known to hold at a certain point in the
-/// program.
+/// component.
///
-/// The fact is said to "apply" to a given point in the execution of the program
+/// The fact is said to "apply" to a given point in the execution of the component
/// if the fact is part of the current fact state at the point the parser
-/// reaches that point in the program.
+/// reaches that point in the component.
///
/// Note: just because a fact "applies" to a given point in the execution of the
-/// program doesn't mean a type will be promoted--it simply means that the fact
+/// component doesn't mean a type will be promoted--it simply means that the fact
/// was deduced at a previous point in the straight line execution of the code.
/// It's possible that the fact will be overshadowed by a later fact, or its
/// effect will be cancelled by a later assignment. The final detemination of
diff --git a/pkg/front_end/lib/src/incremental/kernel_driver.dart b/pkg/front_end/lib/src/incremental/kernel_driver.dart
index 3bbb34f..9038870 100644
--- a/pkg/front_end/lib/src/incremental/kernel_driver.dart
+++ b/pkg/front_end/lib/src/incremental/kernel_driver.dart
@@ -64,7 +64,7 @@
/// Options used by the kernel compiler.
final ProcessedOptions _options;
- /// The optional SDK outline as a serialized program.
+ /// The optional SDK outline as a serialized component.
/// If provided, the driver will not attempt to read SDK files.
final List<int> _sdkOutlineBytes;
@@ -93,7 +93,7 @@
/// The optional SDK outline loaded from [_sdkOutlineBytes].
/// Might be `null` if the bytes are not provided, or if not loaded yet.
- Program _sdkOutline;
+ Component _sdkOutline;
/// The salt to mix into all hashes used as keys for serialized data.
List<int> _salt;
@@ -368,9 +368,9 @@
CanonicalName nameRoot, List<LibraryCycleResult> results) {
var coreLibraries =
results.first.libraryResults.map((l) => l.library).toList();
- var program = new Program(nameRoot: nameRoot, libraries: coreLibraries);
+ var component = new Component(nameRoot: nameRoot, libraries: coreLibraries);
return new TypeEnvironment(
- new CoreTypes(program), new ClassHierarchy(program));
+ new CoreTypes(component), new ClassHierarchy(component));
}
/// Ensure that [dillTarget] includes the [cycle] libraries. It already
@@ -405,9 +405,9 @@
}
}
- Future<Null> appendNewDillLibraries(Program program) async {
+ Future<Null> appendNewDillLibraries(Component component) async {
dillTarget.loader
- .appendLibraries(program, filter: libraryUris.contains);
+ .appendLibraries(component, filter: libraryUris.contains);
await dillTarget.buildOutlines();
}
@@ -417,15 +417,15 @@
List<int> bytes = _byteStore.get(kernelKey);
if (bytes != null) {
return _logger.runAsync('Read serialized libraries', () async {
- var program = new Program(nameRoot: nameRoot);
- _readProgram(program, bytes);
- await appendNewDillLibraries(program);
+ var component = new Component(nameRoot: nameRoot);
+ _readProgram(component, bytes);
+ await appendNewDillLibraries(component);
return new LibraryCycleResult(
cycle,
signature,
- program.uriToSource,
- program.libraries
+ component.uriToSource,
+ component.libraries
// TODO report errors here
.map((l) => new LibraryResult(l, []))
.toList());
@@ -441,19 +441,19 @@
kernelTarget.read(library.uri);
}
- // Compile the cycle libraries into a new full program.
- Program program = await _logger
+ // Compile the cycle libraries into a new full component.
+ Component component = await _logger
.runAsync('Compile ${cycle.libraries.length} libraries', () async {
await kernelTarget.buildOutlines(nameRoot: nameRoot);
- return await kernelTarget.buildProgram();
+ return await kernelTarget.buildComponent();
});
_testView.compiledCycles.add(cycle);
// Add newly compiled libraries into DILL.
- await appendNewDillLibraries(program);
+ await appendNewDillLibraries(component);
- List<Library> kernelLibraries = program.libraries
+ List<Library> kernelLibraries = component.libraries
.where((library) => libraryUris.contains(library.importUri))
.toList();
@@ -469,23 +469,23 @@
// Remove source for libraries outside of the cycle.
{
var urisToRemoveSources = <Uri>[];
- for (var uri in program.uriToSource.keys) {
+ for (var uri in component.uriToSource.keys) {
if (!cycleFileUris.contains(uri)) {
urisToRemoveSources.add(uri);
}
}
- urisToRemoveSources.forEach(program.uriToSource.remove);
+ urisToRemoveSources.forEach(component.uriToSource.remove);
}
_logger.run('Serialize ${kernelLibraries.length} libraries', () {
List<int> bytes =
- serializeProgram(program, filter: kernelLibraries.contains);
+ serializeComponent(component, filter: kernelLibraries.contains);
_byteStore.put(kernelKey, bytes);
_logger.writeln('Stored ${bytes.length} bytes.');
});
return new LibraryCycleResult(
- cycle, signature, program.uriToSource, kernelLibrariesResults);
+ cycle, signature, component.uriToSource, kernelLibrariesResults);
});
}
@@ -544,7 +544,7 @@
Future<Null> _loadSdkOutline() async {
if (_sdkOutlineBytes != null && _sdkOutline == null) {
await _logger.runAsync('Load SDK outline from bytes', () async {
- _sdkOutline = loadProgramFromBytes(_sdkOutlineBytes);
+ _sdkOutline = loadComponentFromBytes(_sdkOutlineBytes);
// Configure the file system state to skip the outline libraries.
for (var outlineLibrary in _sdkOutline.libraries) {
_fsState.skipSdkLibraries.add(outlineLibrary.importUri);
@@ -553,17 +553,17 @@
}
}
- /// Read libraries from the given [bytes] into the [program], using the
- /// configured metadata factory. The [program] must be ready to read these
- /// libraries, i.e. either the [bytes] represent a full program with all
- /// dependencies, or the [program] already has all required dependencies.
- void _readProgram(Program program, List<int> bytes) {
+ /// Read libraries from the given [bytes] into the [component], using the
+ /// configured metadata factory. The [component] must be ready to read these
+ /// libraries, i.e. either the [bytes] represent a full component with all
+ /// dependencies, or the [component] already has all required dependencies.
+ void _readProgram(Component component, List<int> bytes) {
if (_metadataFactory != null) {
var repository = _metadataFactory.newRepositoryForReading();
- program.addMetadataRepository(repository);
- new BinaryBuilderWithMetadata(bytes).readSingleFileProgram(program);
+ component.addMetadataRepository(repository);
+ new BinaryBuilderWithMetadata(bytes).readSingleFileComponent(component);
} else {
- new BinaryBuilder(bytes).readProgram(program);
+ new BinaryBuilder(bytes).readComponent(component);
}
}
@@ -662,7 +662,7 @@
MetadataCollector newCollector();
/// Return a new [MetadataRepository] instance to read metadata while
- /// reading a [Program] for a library cycle.
+ /// reading a [Component] for a library cycle.
MetadataRepository newRepositoryForReading();
}
diff --git a/pkg/front_end/lib/src/kernel_generator_impl.dart b/pkg/front_end/lib/src/kernel_generator_impl.dart
index a41e93a..4761b9a 100644
--- a/pkg/front_end/lib/src/kernel_generator_impl.dart
+++ b/pkg/front_end/lib/src/kernel_generator_impl.dart
@@ -8,7 +8,7 @@
import 'dart:async' show Future;
import 'dart:async';
-import 'package:kernel/kernel.dart' show Program, CanonicalName;
+import 'package:kernel/kernel.dart' show Component, CanonicalName;
import 'base/processed_options.dart';
import 'fasta/severity.dart' show Severity;
@@ -25,19 +25,19 @@
/// `package:front_end/src/api_prototype/summary_generator.dart` APIs.
Future<CompilerResult> generateKernel(ProcessedOptions options,
{bool buildSummary: false,
- bool buildProgram: true,
+ bool buildComponent: true,
bool truncateSummary: false}) async {
return await CompilerContext.runWithOptions(options, (_) async {
return await generateKernelInternal(
buildSummary: buildSummary,
- buildProgram: buildProgram,
+ buildComponent: buildComponent,
truncateSummary: truncateSummary);
});
}
Future<CompilerResult> generateKernelInternal(
{bool buildSummary: false,
- bool buildProgram: true,
+ bool buildComponent: true,
bool truncateSummary: false}) async {
var options = CompilerContext.current.options;
var fs = options.fileSystem;
@@ -50,8 +50,8 @@
var dillTarget =
new DillTarget(options.ticker, uriTranslator, options.target);
- Set<Uri> externalLibs(Program program) {
- return program.libraries
+ Set<Uri> externalLibs(Component component) {
+ return component.libraries
.where((lib) => lib.isExternal)
.map((lib) => lib.importUri)
.toSet();
@@ -82,7 +82,7 @@
lib.isExternal = true;
});
- // Linked dependencies are meant to be part of the program so they are not
+ // Linked dependencies are meant to be part of the component so they are not
// marked external.
for (var dependency in await options.loadLinkDependencies(nameRoot)) {
var excluded = externalLibs(dependency);
@@ -94,54 +94,55 @@
var kernelTarget = new KernelTarget(fs, false, dillTarget, uriTranslator);
options.inputs.forEach(kernelTarget.read);
- Program summaryProgram =
+ Component summaryProgram =
await kernelTarget.buildOutlines(nameRoot: nameRoot);
List<int> summary = null;
if (buildSummary) {
if (options.verify) {
- for (var error in verifyProgram(summaryProgram)) {
+ for (var error in verifyComponent(summaryProgram)) {
options.report(error, Severity.error);
}
}
if (options.debugDump) {
- printProgramText(summaryProgram,
+ printComponentText(summaryProgram,
libraryFilter: kernelTarget.isSourceLibrary);
}
- // Copy the program to exclude the uriToSource map from the summary.
+ // Copy the component to exclude the uriToSource map from the summary.
//
// Note: we don't pass the library argument to the constructor to
// preserve the the libraries parent pointer (it should continue to point
- // to the program within KernelTarget).
- var trimmedSummaryProgram = new Program(nameRoot: summaryProgram.root)
+ // to the component within KernelTarget).
+ var trimmedSummaryProgram = new Component(nameRoot: summaryProgram.root)
..libraries.addAll(truncateSummary
? kernelTarget.loader.libraries
: summaryProgram.libraries);
trimmedSummaryProgram.metadata.addAll(summaryProgram.metadata);
// As documented, we only run outline transformations when we are building
- // summaries without building a full program (at this time, that's
+ // summaries without building a full component (at this time, that's
// the only need we have for these transformations).
- if (!buildProgram) {
+ if (!buildComponent) {
options.target.performOutlineTransformations(trimmedSummaryProgram);
options.ticker.logMs("Transformed outline");
}
- summary = serializeProgram(trimmedSummaryProgram);
+ summary = serializeComponent(trimmedSummaryProgram);
options.ticker.logMs("Generated outline");
}
- Program program;
- if (buildProgram && kernelTarget.errors.isEmpty) {
- program = await kernelTarget.buildProgram(verify: options.verify);
+ Component component;
+ if (buildComponent && kernelTarget.errors.isEmpty) {
+ component = await kernelTarget.buildComponent(verify: options.verify);
if (options.debugDump) {
- printProgramText(program, libraryFilter: kernelTarget.isSourceLibrary);
+ printComponentText(component,
+ libraryFilter: kernelTarget.isSourceLibrary);
}
- options.ticker.logMs("Generated program");
+ options.ticker.logMs("Generated component");
}
return new CompilerResult(
summary: summary,
- program: program,
+ component: component,
deps: kernelTarget.loader.getDependencies());
} on deprecated_InputError catch (e) {
options.report(
@@ -157,8 +158,8 @@
/// The generated summary bytes, if it was requested.
final List<int> summary;
- /// The generated program, if it was requested.
- final Program program;
+ /// The generated component, if it was requested.
+ final Component component;
/// Dependencies traversed by the compiler. Used only for generating
/// dependency .GN files in the dart-sdk build system.
@@ -166,5 +167,5 @@
/// using the compiler itself.
final List<Uri> deps;
- CompilerResult({this.summary, this.program, this.deps});
+ CompilerResult({this.summary, this.component, this.deps});
}
diff --git a/pkg/front_end/lib/src/testing/compiler_common.dart b/pkg/front_end/lib/src/testing/compiler_common.dart
index 8e6a904..0193e73 100644
--- a/pkg/front_end/lib/src/testing/compiler_common.dart
+++ b/pkg/front_end/lib/src/testing/compiler_common.dart
@@ -7,10 +7,10 @@
import 'dart:async' show Future;
-import 'package:kernel/ast.dart' show Library, Program;
+import 'package:kernel/ast.dart' show Library, Component;
import '../api_prototype/front_end.dart'
- show CompilerOptions, kernelForBuildUnit, kernelForProgram, summaryFor;
+ show CompilerOptions, kernelForComponent, kernelForProgram, summaryFor;
import '../api_prototype/memory_file_system.dart' show MemoryFileSystem;
@@ -26,7 +26,7 @@
/// compiles the entry whose name is [fileName].
///
/// Wraps [kernelForProgram] with some default testing options (see [setup]).
-Future<Program> compileScript(dynamic scriptOrSources,
+Future<Component> compileScript(dynamic scriptOrSources,
{fileName: 'main.dart',
List<String> inputSummaries: const [],
List<String> linkedDependencies: const [],
@@ -44,17 +44,17 @@
return await kernelForProgram(toTestUri(fileName), options);
}
-/// Generate a program for a modular complation unit.
+/// Generate a component for a modular complation unit.
///
-/// Wraps [kernelForBuildUnit] with some default testing options (see [setup]).
-Future<Program> compileUnit(List<String> inputs, Map<String, dynamic> sources,
+/// Wraps [kernelForComponent] with some default testing options (see [setup]).
+Future<Component> compileUnit(List<String> inputs, Map<String, dynamic> sources,
{List<String> inputSummaries: const [],
List<String> linkedDependencies: const [],
CompilerOptions options}) async {
options ??= new CompilerOptions();
await setup(options, sources,
inputSummaries: inputSummaries, linkedDependencies: linkedDependencies);
- return await kernelForBuildUnit(inputs.map(toTestUri).toList(), options);
+ return await kernelForComponent(inputs.map(toTestUri).toList(), options);
}
/// Generate a summary for a modular complation unit.
@@ -136,8 +136,8 @@
bool isDartCoreLibrary(Library lib) => isDartCore(lib.importUri);
bool isDartCore(Uri uri) => uri.scheme == 'dart' && uri.path == 'core';
-/// Find a library in [program] whose Uri ends with the given [suffix]
-Library findLibrary(Program program, String suffix) {
- return program.libraries
+/// Find a library in [component] whose Uri ends with the given [suffix]
+Library findLibrary(Component component, String suffix) {
+ return component.libraries
.firstWhere((lib) => lib.importUri.path.endsWith(suffix));
}
diff --git a/pkg/front_end/test/fasta/ambiguous_export_test.dart b/pkg/front_end/test/fasta/ambiguous_export_test.dart
index 0189766..8123c39 100644
--- a/pkg/front_end/test/fasta/ambiguous_export_test.dart
+++ b/pkg/front_end/test/fasta/ambiguous_export_test.dart
@@ -17,7 +17,7 @@
import 'package:front_end/src/fasta/dill/dill_target.dart' show DillTarget;
import 'package:kernel/ast.dart'
- show Field, Library, Name, Program, StringLiteral;
+ show Field, Library, Name, Component, StringLiteral;
main() async {
await asyncTest(() async {
@@ -25,11 +25,11 @@
Field field = new Field(new Name("_exports#", library),
initializer: new StringLiteral('{"main":"Problem with main"}'));
library.addMember(field);
- Program program = new Program(libraries: <Library>[library]);
+ Component component = new Component(libraries: <Library>[library]);
await CompilerContext.runWithDefaultOptions((CompilerContext c) async {
DillTarget target =
new DillTarget(c.options.ticker, null, c.options.target);
- target.loader.appendLibraries(program);
+ target.loader.appendLibraries(component);
DillLibraryBuilder builder = target.loader.read(library.importUri, -1);
await target.loader.buildOutline(builder);
builder.finalizeExports();
diff --git a/pkg/front_end/test/fasta/assert_locations_test.dart b/pkg/front_end/test/fasta/assert_locations_test.dart
index b8bcf7e..a2e7355 100644
--- a/pkg/front_end/test/fasta/assert_locations_test.dart
+++ b/pkg/front_end/test/fasta/assert_locations_test.dart
@@ -9,7 +9,7 @@
import 'package:expect/expect.dart' show Expect;
import 'package:kernel/ast.dart'
- show Program, RecursiveVisitor, Procedure, AssertStatement;
+ show Component, RecursiveVisitor, Procedure, AssertStatement;
import "package:front_end/src/api_prototype/compiler_options.dart"
show CompilerOptions;
@@ -142,7 +142,7 @@
Expect.fail("Unexpected error: $formatted");
}
..strongMode = true;
- Program p = await compileScript(test.source,
+ Component p = await compileScript(test.source,
options: options, fileName: 'synthetic-test.dart');
Expect.isNotNull(p);
VerifyingVisitor visitor = new VerifyingVisitor(test);
diff --git a/pkg/front_end/test/fasta/bootstrap_test.dart b/pkg/front_end/test/fasta/bootstrap_test.dart
index 524ec46..77e7cab 100644
--- a/pkg/front_end/test/fasta/bootstrap_test.dart
+++ b/pkg/front_end/test/fasta/bootstrap_test.dart
@@ -12,9 +12,9 @@
import 'package:kernel/binary/ast_from_binary.dart' show BinaryBuilder;
-import 'package:kernel/ast.dart' show Program;
+import 'package:kernel/ast.dart' show Component;
-import 'package:kernel/text/ast_to_text.dart' show programToString;
+import 'package:kernel/text/ast_to_text.dart' show componentToString;
Future main() async {
asyncStart();
@@ -31,8 +31,8 @@
await compare(compiledOnceOutput, compiledTwiceOutput);
await runCompiler(compiledTwiceOutput, outline, outlineOutput);
try {
- // Test that compare actually works by comparing the compile program to
- // the outline program (which are different, but similar).
+ // Test that compare actually works by comparing the compiled component
+ // to the outline component (which are different, but similar).
await compare(compiledOnceOutput, outlineOutput, silent: true);
throw "Expected an error.";
} on ComparisonFailed {
@@ -78,13 +78,13 @@
if (!silent) {
print("$a is different from $b");
}
- Program programA = new Program();
- Program programB = new Program();
- new BinaryBuilder(bytesA, filename: a.toFilePath()).readProgram(programA);
- new BinaryBuilder(bytesB, filename: b.toFilePath()).readProgram(programB);
+ Component programA = new Component();
+ Component programB = new Component();
+ new BinaryBuilder(bytesA, filename: a.toFilePath()).readComponent(programA);
+ new BinaryBuilder(bytesB, filename: b.toFilePath()).readComponent(programB);
RegExp splitLines = new RegExp('^', multiLine: true);
- List<String> linesA = programToString(programA).split(splitLines);
- List<String> linesB = programToString(programB).split(splitLines);
+ List<String> linesA = componentToString(programA).split(splitLines);
+ List<String> linesB = componentToString(programB).split(splitLines);
for (int i = 0; i < linesA.length && i < linesB.length; i++) {
String lineA = linesA[i].trimRight();
String lineB = linesB[i].trimRight();
diff --git a/pkg/front_end/test/fasta/incremental_hello_test.dart b/pkg/front_end/test/fasta/incremental_hello_test.dart
index 1b13610..7976f2d 100644
--- a/pkg/front_end/test/fasta/incremental_hello_test.dart
+++ b/pkg/front_end/test/fasta/incremental_hello_test.dart
@@ -8,7 +8,7 @@
import 'package:expect/expect.dart' show Expect;
-import 'package:kernel/ast.dart' show Program;
+import 'package:kernel/ast.dart' show Component;
import "package:front_end/src/api_prototype/compiler_options.dart"
show CompilerOptions;
@@ -55,28 +55,28 @@
IncrementalCompiler compiler =
new IncrementalCompiler(new CompilerContext(options));
- Program program = await compiler.computeDelta();
+ Component component = await compiler.computeDelta();
if (sdkFromSource) {
- // Expect that the new program contains at least the following libraries:
+ // Expect that the new component contains at least the following libraries:
// dart:core, dart:async, and hello.dart.
Expect.isTrue(
- program.libraries.length > 2, "${program.libraries.length} <= 2");
+ component.libraries.length > 2, "${component.libraries.length} <= 2");
} else {
- // Expect that the new program contains exactly hello.dart.
+ // Expect that the new component contains exactly hello.dart.
Expect.isTrue(
- program.libraries.length == 1, "${program.libraries.length} != 1");
+ component.libraries.length == 1, "${component.libraries.length} != 1");
}
compiler.invalidate(helloDart);
- program = await compiler.computeDelta(entryPoint: helloDart);
- // Expect that the new program contains exactly hello.dart
+ component = await compiler.computeDelta(entryPoint: helloDart);
+ // Expect that the new component contains exactly hello.dart
Expect.isTrue(
- program.libraries.length == 1, "${program.libraries.length} != 1");
+ component.libraries.length == 1, "${component.libraries.length} != 1");
- program = await compiler.computeDelta(entryPoint: helloDart);
- Expect.isTrue(program.libraries.isEmpty);
+ component = await compiler.computeDelta(entryPoint: helloDart);
+ Expect.isTrue(component.libraries.isEmpty);
}
void main() {
diff --git a/pkg/front_end/test/fasta/incremental_test.dart b/pkg/front_end/test/fasta/incremental_test.dart
index d89f3a32..3d2fb2a 100644
--- a/pkg/front_end/test/fasta/incremental_test.dart
+++ b/pkg/front_end/test/fasta/incremental_test.dart
@@ -10,7 +10,7 @@
import "dart:io" show File;
-import "package:kernel/ast.dart" show Program;
+import "package:kernel/ast.dart" show Component;
import "package:testing/testing.dart"
show Chain, ChainContext, Result, Step, TestDescription, runMe;
@@ -146,7 +146,7 @@
return edits == 0 ? fail(test, "No sources found") : pass(test);
}
var compiler = context.compiler;
- Program program = await compiler.computeDelta(entryPoint: entryPoint);
+ Component component = await compiler.computeDelta(entryPoint: entryPoint);
List<CompilationMessage> errors = context.takeErrors();
if (test.expectations[edits].hasCompileTimeError) {
if (errors.isEmpty) {
@@ -155,7 +155,7 @@
} else if (errors.isNotEmpty) {
return fail(
test, "Unexpected compile-time errors:\n ${errors.join('\n ')}");
- } else if (program.libraries.length < 1) {
+ } else if (component.libraries.length < 1) {
return fail(test, "The compiler detected no changes");
}
}
diff --git a/pkg/front_end/test/fasta/parser/type_info_test.dart b/pkg/front_end/test/fasta/parser/type_info_test.dart
index 4efa647..9486a3f 100644
--- a/pkg/front_end/test/fasta/parser/type_info_test.dart
+++ b/pkg/front_end/test/fasta/parser/type_info_test.dart
@@ -331,6 +331,22 @@
// TOOD(danrubel): dynamic, do, other keywords, malformed, recovery
// <T>
+ expectComplexInfo('G<int double> g',
+ required: true,
+ tokenAfter: 'g',
+ expectedCalls: [
+ 'handleIdentifier G typeReference',
+ 'beginTypeArguments <',
+ 'handleIdentifier int typeReference',
+ 'handleNoTypeArguments double',
+ 'handleType int double',
+ 'endTypeArguments 1 < >',
+ 'handleType G double',
+ ],
+ expectedErrors: [
+ error(codeExpectedToken, 6, 6)
+ ]);
+
expectInfo(noTypeInfo, 'C<>', required: false);
expectComplexInfo('C<>', required: true, expectedCalls: [
'handleIdentifier C typeReference',
@@ -340,6 +356,8 @@
'handleType > >',
'endTypeArguments 1 < >',
'handleType C ',
+ ], expectedErrors: [
+ error(codeExpectedType, 2, 1)
]);
expectComplexInfo('C<> f', required: true, tokenAfter: 'f', expectedCalls: [
'handleIdentifier C typeReference',
@@ -349,6 +367,8 @@
'handleType > >',
'endTypeArguments 1 < >',
'handleType C f',
+ ], expectedErrors: [
+ error(codeExpectedType, 2, 1)
]);
// Statements that should not have a type
@@ -528,27 +548,42 @@
}
void expectInfo(expectedInfo, String source,
- {bool required, String expectedAfter, List<String> expectedCalls}) {
+ {bool required,
+ String expectedAfter,
+ List<String> expectedCalls,
+ List<ExpectedError> expectedErrors}) {
Token start = scan(source);
if (required == null) {
- compute(expectedInfo, source, start, true, expectedAfter, expectedCalls);
- compute(expectedInfo, source, start, false, expectedAfter, expectedCalls);
+ compute(expectedInfo, source, start, true, expectedAfter, expectedCalls,
+ expectedErrors);
+ compute(expectedInfo, source, start, false, expectedAfter, expectedCalls,
+ expectedErrors);
} else {
- compute(
- expectedInfo, source, start, required, expectedAfter, expectedCalls);
+ compute(expectedInfo, source, start, required, expectedAfter, expectedCalls,
+ expectedErrors);
}
}
void expectComplexInfo(String source,
- {bool required, String tokenAfter, List<String> expectedCalls}) {
+ {bool required,
+ String tokenAfter,
+ List<String> expectedCalls,
+ List<ExpectedError> expectedErrors}) {
expectInfo(const isInstanceOf<ComplexTypeInfo>(), source,
required: required,
expectedAfter: tokenAfter,
- expectedCalls: expectedCalls);
+ expectedCalls: expectedCalls,
+ expectedErrors: expectedErrors);
}
-void compute(expectedInfo, String source, Token start, bool required,
- String expectedAfter, List<String> expectedCalls) {
+void compute(
+ expectedInfo,
+ String source,
+ Token start,
+ bool required,
+ String expectedAfter,
+ List<String> expectedCalls,
+ List<ExpectedError> expectedErrors) {
TypeInfo typeInfo = computeType(start, required);
expect(typeInfo, expectedInfo, reason: source);
if (typeInfo is ComplexTypeInfo) {
@@ -568,6 +603,9 @@
expect(listener.calls, expectedCalls, reason: source);
}
+ expect(listener.errors, expectedErrors, reason: source);
+ } else {
+ assert(expectedErrors == null);
}
}
@@ -590,6 +628,7 @@
class TypeInfoListener implements Listener {
List<String> calls = <String>[];
+ List<ExpectedError> errors;
@override
void beginFormalParameter(Token token, MemberKind kind) {
@@ -702,7 +741,9 @@
@override
void handleRecoverableError(
Message message, Token startToken, Token endToken) {
- // ignored
+ errors ??= <ExpectedError>[];
+ int offset = startToken.charOffset;
+ errors.add(error(message.code, offset, endToken.charEnd - offset));
}
@override
@@ -724,3 +765,24 @@
throw '${invocation.memberName} should not be called.';
}
}
+
+ExpectedError error(Code code, int start, int length) =>
+ new ExpectedError(code, start, length);
+
+class ExpectedError {
+ final Code code;
+ final int start;
+ final int length;
+
+ ExpectedError(this.code, this.start, this.length);
+
+ @override
+ bool operator ==(other) =>
+ other is ExpectedError &&
+ code == other.code &&
+ start == other.start &&
+ length == other.length;
+
+ @override
+ String toString() => 'error(${code.name}, $start, $length)';
+}
diff --git a/pkg/front_end/test/fasta/shaker_test.dart b/pkg/front_end/test/fasta/shaker_test.dart
index 757e778..d86e4d9 100644
--- a/pkg/front_end/test/fasta/shaker_test.dart
+++ b/pkg/front_end/test/fasta/shaker_test.dart
@@ -30,13 +30,13 @@
import 'package:front_end/src/fasta/kernel/kernel_outline_shaker.dart';
import 'package:front_end/src/fasta/kernel/kernel_target.dart'
show KernelTarget;
-import 'package:front_end/src/fasta/kernel/verifier.dart' show verifyProgram;
+import 'package:front_end/src/fasta/kernel/verifier.dart' show verifyComponent;
import 'package:front_end/src/fasta/testing/kernel_chain.dart'
show BytesCollector, runDiff;
import 'package:front_end/src/fasta/util/relativize.dart' show relativizeUri;
-import 'package:kernel/ast.dart' show Program;
+import 'package:kernel/ast.dart' show Component;
import 'package:kernel/binary/ast_from_binary.dart';
-import 'package:kernel/kernel.dart' show loadProgramFromBytes;
+import 'package:kernel/kernel.dart' show loadComponentFromBytes;
import 'package:kernel/target/targets.dart' show TargetFlags;
import 'package:kernel/target/vm.dart' show VmTarget;
import 'package:kernel/text/ast_to_text.dart';
@@ -70,11 +70,11 @@
new CheckOutline(updateExpectations: updateExpectations),
];
- Program loadPlatformOutline() {
+ Component loadPlatformOutline() {
// Note: we rebuild the platform outline on every test because the
- // tree-shaker mutates the in-memory representation of the program without
+ // tree-shaker mutates the in-memory representation of the component without
// cloning it.
- return loadProgramFromBytes(outlineBytes);
+ return loadComponentFromBytes(outlineBytes);
}
static create(Map<String, String> environment) async {
@@ -134,23 +134,23 @@
var showCoreLibraries = contents.contains("@@SHOW_CORE_LIBRARIES@@");
await sourceTarget.buildOutlines();
- var program = await sourceTarget.buildProgram();
+ var component = await sourceTarget.buildComponent();
bool isIncluded(Uri uri) => uri == inputUri;
- Program outline;
+ Component outline;
{
var bytesCollector = new BytesCollector();
- serializeTrimmedOutline(bytesCollector, program, isIncluded);
+ serializeTrimmedOutline(bytesCollector, component, isIncluded);
var bytes = bytesCollector.collect();
- outline = new Program();
- new BinaryBuilder(bytes).readProgram(outline);
+ outline = new Component();
+ new BinaryBuilder(bytes).readComponent(outline);
}
- trimProgram(program, isIncluded);
+ trimProgram(component, isIncluded);
return pass(new _IntermediateData(
- inputUri, program, outline, showCoreLibraries));
+ inputUri, component, outline, showCoreLibraries));
} on deprecated_InputError catch (e, s) {
return fail(null, e.error, s);
}
@@ -163,11 +163,11 @@
/// The input URI provided to the test.
final Uri uri;
- /// Program built by [BuildProgram].
- final Program program;
+ /// Component built by [BuildProgram].
+ final Component component;
- /// Shaken outline of [program].
- final Program outline;
+ /// Shaken outline of [component].
+ final Component outline;
/// Whether the output should include tree-shaking information about the core
/// libraries. This is specified in a comment on individual test files where
@@ -175,7 +175,7 @@
final bool showCoreLibraries;
_IntermediateData(
- this.uri, this.program, this.outline, this.showCoreLibraries);
+ this.uri, this.component, this.outline, this.showCoreLibraries);
}
/// A step that runs the tree-shaker and checks against an expectation file for
@@ -191,9 +191,9 @@
_IntermediateData data, ChainContext context) async {
String actualResult;
var entryUri = data.uri;
- var program = data.program;
+ var component = data.component;
- var errors = verifyProgram(program, isOutline: false);
+ var errors = verifyComponent(component, isOutline: false);
if (!errors.isEmpty) {
return new Result<_IntermediateData>(
data, context.expectationSet["VerificationError"], errors, null);
@@ -207,7 +207,7 @@
To update this file, either copy the output from a failing test or run
pkg/front_end/tool/fasta testing shaker -DupdateExpectations=true''');
- for (var library in program.libraries) {
+ for (var library in component.libraries) {
var importUri = library.importUri;
if (importUri == entryUri) continue;
if (importUri.isScheme('dart') && !data.showCoreLibraries) continue;
@@ -272,7 +272,7 @@
var entryUri = data.uri;
var outline = data.outline;
- var errors = verifyProgram(outline, isOutline: true);
+ var errors = verifyComponent(outline, isOutline: true);
if (!errors.isEmpty) {
return new Result<String>(
null, context.expectationSet["VerificationError"], errors, null);
diff --git a/pkg/front_end/test/fasta/testing/suite.dart b/pkg/front_end/test/fasta/testing/suite.dart
index d40576b..3337a9e 100644
--- a/pkg/front_end/test/fasta/testing/suite.dart
+++ b/pkg/front_end/test/fasta/testing/suite.dart
@@ -21,7 +21,7 @@
import 'package:front_end/src/fasta/uri_translator_impl.dart';
-import 'package:kernel/ast.dart' show Library, Program;
+import 'package:kernel/ast.dart' show Library, Component;
import 'package:testing/testing.dart'
show
@@ -60,7 +60,7 @@
import 'package:front_end/src/fasta/dill/dill_target.dart' show DillTarget;
-import 'package:kernel/kernel.dart' show loadProgramFromBytes;
+import 'package:kernel/kernel.dart' show loadComponentFromBytes;
import 'package:kernel/target/targets.dart' show TargetFlags;
@@ -108,11 +108,11 @@
final Uri vm;
final bool strongMode;
final bool onlyCrashes;
- final Map<Program, KernelTarget> programToTarget = <Program, KernelTarget>{};
+ final Map<Component, KernelTarget> programToTarget =
+ <Component, KernelTarget>{};
final Uri platformBinaries;
Uri platformUri;
- Uri outlineUri;
- Program outline;
+ Component platform;
final ExpectationSet expectationSet =
new ExpectationSet.fromJsonList(JSON.decode(EXPECTATIONS));
@@ -150,6 +150,13 @@
}
if (fullCompile && !skipVm) {
steps.add(const Transform());
+ if (!ignoreExpectations) {
+ steps.add(new MatchExpectation(
+ fullCompile
+ ? ".${generateExpectationName(strongMode)}.transformed.expect"
+ : ".outline.transformed.expect",
+ updateExpectations: updateExpectations));
+ }
steps.add(const WriteDill());
steps.add(const Run());
}
@@ -158,19 +165,18 @@
Future ensurePlatformUris() async {
if (platformUri == null) {
- platformUri = platformBinaries.resolve("vm_platform.dill");
- outlineUri = platformBinaries
- .resolve(strongMode ? "vm_outline_strong.dill" : "vm_outline.dill");
+ platformUri = platformBinaries
+ .resolve(strongMode ? "vm_platform_strong.dill" : "vm_platform.dill");
}
}
- Future<Program> loadPlatformOutline() async {
- if (outline == null) {
+ Future<Component> loadPlatform() async {
+ if (platform == null) {
await ensurePlatformUris();
- outline =
- loadProgramFromBytes(new File.fromUri(outlineUri).readAsBytesSync());
+ platform = loadComponentFromBytes(
+ new File.fromUri(platformUri).readAsBytesSync());
}
- return outline;
+ return platform;
}
@override
@@ -256,7 +262,7 @@
}
}
-class Outline extends Step<TestDescription, Program, FastaContext> {
+class Outline extends Step<TestDescription, Component, FastaContext> {
final bool fullCompile;
final AstKind astKind;
@@ -274,18 +280,18 @@
bool get isCompiler => fullCompile;
- Future<Result<Program>> run(
+ Future<Result<Component>> run(
TestDescription description, FastaContext context) async {
var options = new ProcessedOptions(new CompilerOptions());
return await CompilerContext.runWithOptions(options, (_) async {
// Disable colors to ensure that expectation files are the same across
// platforms and independent of stdin/stderr.
CompilerContext.current.disableColors();
- Program platformOutline = await context.loadPlatformOutline();
+ Component platform = await context.loadPlatform();
Ticker ticker = new Ticker();
DillTarget dillTarget = new DillTarget(ticker, context.uriTranslator,
new TestVmTarget(new TargetFlags(strongMode: strongMode)));
- dillTarget.loader.appendLibraries(platformOutline);
+ dillTarget.loader.appendLibraries(platform);
// We create a new URI translator to avoid reading platform libraries from
// file system.
UriTranslatorImpl uriTranslator = new UriTranslatorImpl(
@@ -296,7 +302,7 @@
: new KernelTarget(
StandardFileSystem.instance, false, dillTarget, uriTranslator);
- Program p;
+ Component p;
try {
sourceTarget.read(description.uri);
await dillTarget.buildOutlines();
@@ -308,7 +314,7 @@
}
p = await sourceTarget.buildOutlines();
if (fullCompile) {
- p = await sourceTarget.buildProgram();
+ p = await sourceTarget.buildComponent();
instrumentation?.finish();
if (instrumentation != null && instrumentation.hasProblems) {
if (updateComments) {
@@ -328,14 +334,15 @@
}
}
-class Transform extends Step<Program, Program, FastaContext> {
+class Transform extends Step<Component, Component, FastaContext> {
const Transform();
- String get name => "transform program";
+ String get name => "transform component";
- Future<Result<Program>> run(Program program, FastaContext context) async {
- KernelTarget sourceTarget = context.programToTarget[program];
- context.programToTarget.remove(program);
+ Future<Result<Component>> run(
+ Component component, FastaContext context) async {
+ KernelTarget sourceTarget = context.programToTarget[component];
+ context.programToTarget.remove(component);
TestVmTarget backendTarget = sourceTarget.backendTarget;
backendTarget.enabled = true;
try {
@@ -345,7 +352,7 @@
} finally {
backendTarget.enabled = false;
}
- return pass(program);
+ return pass(component);
}
}
@@ -366,10 +373,10 @@
}
}
- void performGlobalTransformations(CoreTypes coreTypes, Program program,
+ void performGlobalTransformations(CoreTypes coreTypes, Component component,
{void logger(String msg)}) {
if (enabled) {
- super.performGlobalTransformations(coreTypes, program, logger: logger);
+ super.performGlobalTransformations(coreTypes, component, logger: logger);
}
}
}
diff --git a/pkg/front_end/test/fasta/type_inference/interface_resolver_test.dart b/pkg/front_end/test/fasta/type_inference/interface_resolver_test.dart
index 269c4c6..7aca4b1 100644
--- a/pkg/front_end/test/fasta/type_inference/interface_resolver_test.dart
+++ b/pkg/front_end/test/fasta/type_inference/interface_resolver_test.dart
@@ -8,7 +8,7 @@
import 'package:kernel/ast.dart';
import 'package:kernel/class_hierarchy.dart';
import 'package:kernel/core_types.dart';
-import 'package:kernel/testing/mock_sdk_program.dart';
+import 'package:kernel/testing/mock_sdk_component.dart';
import 'package:kernel/type_algebra.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -23,7 +23,7 @@
class InterfaceResolverTest {
final Library testLib;
- final Program program;
+ final Component component;
final CoreTypes coreTypes;
@@ -35,14 +35,14 @@
InterfaceResolverTest()
: this._(new Library(Uri.parse('org-dartlang:///test.dart'), name: 'lib'),
- createMockSdkProgram());
+ createMockSdkComponent());
- InterfaceResolverTest._(this.testLib, Program program)
- : program = program..libraries.add(testLib..parent = program),
- coreTypes = new CoreTypes(program);
+ InterfaceResolverTest._(this.testLib, Component component)
+ : component = component..libraries.add(testLib..parent = component),
+ coreTypes = new CoreTypes(component);
ClassHierarchy get classHierarchy {
- return cachedClassHierarchy ??= new ClassHierarchy(program);
+ return cachedClassHierarchy ??= new ClassHierarchy(component);
}
TypeSchemaEnvironment get typeEnvironment {
@@ -84,7 +84,7 @@
expect(interfaceMember, same(member));
}
- check(new ClassHierarchy(program));
+ check(new ClassHierarchy(component));
}
Procedure getCandidate(Class class_, bool setter) {
diff --git a/pkg/front_end/test/fasta/type_inference/type_constraint_gatherer_test.dart b/pkg/front_end/test/fasta/type_inference/type_constraint_gatherer_test.dart
index d51d345..dddce21 100644
--- a/pkg/front_end/test/fasta/type_inference/type_constraint_gatherer_test.dart
+++ b/pkg/front_end/test/fasta/type_inference/type_constraint_gatherer_test.dart
@@ -8,7 +8,7 @@
import 'package:kernel/ast.dart';
import 'package:kernel/core_types.dart';
import 'package:kernel/class_hierarchy.dart';
-import 'package:kernel/testing/mock_sdk_program.dart';
+import 'package:kernel/testing/mock_sdk_component.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -29,7 +29,7 @@
final testLib =
new Library(Uri.parse('org-dartlang:///test.dart'), name: 'lib');
- Program program;
+ Component component;
CoreTypes coreTypes;
@@ -42,9 +42,9 @@
Class classQ;
TypeConstraintGathererTest() {
- program = createMockSdkProgram();
- program.libraries.add(testLib..parent = program);
- coreTypes = new CoreTypes(program);
+ component = createMockSdkComponent();
+ component.libraries.add(testLib..parent = component);
+ coreTypes = new CoreTypes(component);
T1 = new TypeParameterType(new TypeParameter('T1', objectType));
T2 = new TypeParameterType(new TypeParameter('T2', objectType));
classP = _addClass(_class('P'));
@@ -209,8 +209,8 @@
void _checkConstraints(
DartType a, DartType b, List<String> expectedConstraints) {
- var typeSchemaEnvironment =
- new TypeSchemaEnvironment(coreTypes, new ClassHierarchy(program), true);
+ var typeSchemaEnvironment = new TypeSchemaEnvironment(
+ coreTypes, new ClassHierarchy(component), true);
var typeConstraintGatherer = new TypeConstraintGatherer(
typeSchemaEnvironment, [T1.parameter, T2.parameter]);
var constraints = typeConstraintGatherer.trySubtypeMatch(a, b)
diff --git a/pkg/front_end/test/fasta/type_inference/type_schema_environment_test.dart b/pkg/front_end/test/fasta/type_inference/type_schema_environment_test.dart
index a8335b2..4621b9a 100644
--- a/pkg/front_end/test/fasta/type_inference/type_schema_environment_test.dart
+++ b/pkg/front_end/test/fasta/type_inference/type_schema_environment_test.dart
@@ -7,7 +7,7 @@
import 'package:kernel/ast.dart';
import 'package:kernel/core_types.dart';
import 'package:kernel/class_hierarchy.dart';
-import 'package:kernel/testing/mock_sdk_program.dart';
+import 'package:kernel/testing/mock_sdk_component.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -29,14 +29,14 @@
final testLib = new Library(Uri.parse('org-dartlang:///test.dart'));
- Program program;
+ Component component;
CoreTypes coreTypes;
TypeSchemaEnvironmentTest() {
- program = createMockSdkProgram();
- program.libraries.add(testLib..parent = program);
- coreTypes = new CoreTypes(program);
+ component = createMockSdkComponent();
+ component.libraries.add(testLib..parent = component);
+ coreTypes = new CoreTypes(component);
}
InterfaceType get doubleType => coreTypes.doubleClass.rawType;
@@ -714,7 +714,7 @@
TypeSchemaEnvironment _makeEnv() {
return new TypeSchemaEnvironment(
- coreTypes, new ClassHierarchy(program), true);
+ coreTypes, new ClassHierarchy(component), true);
}
DartType _map(DartType key, DartType value) =>
diff --git a/pkg/front_end/test/incremental_load_from_dill_test.dart b/pkg/front_end/test/incremental_load_from_dill_test.dart
index 686cda7..13ab958 100644
--- a/pkg/front_end/test/incremental_load_from_dill_test.dart
+++ b/pkg/front_end/test/incremental_load_from_dill_test.dart
@@ -15,11 +15,11 @@
import 'package:front_end/src/fasta/incremental_compiler.dart'
show IncrementalCompiler;
import 'package:front_end/src/fasta/kernel/utils.dart'
- show writeProgramToFile, serializeProgram;
+ show writeComponentToFile, serializeComponent;
import "package:front_end/src/api_prototype/memory_file_system.dart"
show MemoryFileSystem;
import 'package:kernel/kernel.dart'
- show Class, EmptyStatement, Library, Procedure, Program;
+ show Class, EmptyStatement, Library, Procedure, Component;
import 'package:front_end/src/fasta/fasta_codes.dart' show LocatedMessage;
@@ -366,16 +366,16 @@
IncrementalCompiler compiler =
new IncrementalKernelGenerator(options, main);
Stopwatch stopwatch = new Stopwatch()..start();
- var program = await compiler.computeDelta();
- throwOnEmptyMixinBodies(program);
+ var component = await compiler.computeDelta();
+ throwOnEmptyMixinBodies(component);
print("Normal compile took ${stopwatch.elapsedMilliseconds} ms");
- libCount2 = serializeProgram(program);
- if (program.libraries.length != 2) {
- throw "Expected 2 libraries, got ${program.libraries.length}";
+ libCount2 = serializeComponent(component);
+ if (component.libraries.length != 2) {
+ throw "Expected 2 libraries, got ${component.libraries.length}";
}
- if (program.libraries[0].fileUri != main) {
+ if (component.libraries[0].fileUri != main) {
throw "Expected the first library to have uri $main but was "
- "${program.libraries[0].fileUri}";
+ "${component.libraries[0].fileUri}";
}
}
@@ -399,11 +399,11 @@
compiler.invalidate(main);
compiler.invalidate(b);
Stopwatch stopwatch = new Stopwatch()..start();
- var program = await compiler.computeDelta();
- throwOnEmptyMixinBodies(program);
+ var component = await compiler.computeDelta();
+ throwOnEmptyMixinBodies(component);
print("Bootstrapped compile took ${stopwatch.elapsedMilliseconds} ms");
- if (program.libraries.length != 1) {
- throw "Expected 1 library, got ${program.libraries.length}";
+ if (component.libraries.length != 1) {
+ throw "Expected 1 library, got ${component.libraries.length}";
}
}
}
@@ -434,22 +434,22 @@
{CompilerOptions options}) async {
options ??= getOptions(false);
IncrementalCompiler compiler = new IncrementalKernelGenerator(options, input);
- var program = await compiler.computeDelta();
- throwOnEmptyMixinBodies(program);
- await writeProgramToFile(program, output);
+ var component = await compiler.computeDelta();
+ throwOnEmptyMixinBodies(component);
+ await writeComponentToFile(component, output);
return compiler.initializedFromDill;
}
-void throwOnEmptyMixinBodies(Program program) {
- int empty = countEmptyMixinBodies(program);
+void throwOnEmptyMixinBodies(Component component) {
+ int empty = countEmptyMixinBodies(component);
if (empty != 0) {
throw "Expected 0 empty bodies in mixins, but found $empty";
}
}
-int countEmptyMixinBodies(Program program) {
+int countEmptyMixinBodies(Component component) {
int empty = 0;
- for (Library lib in program.libraries) {
+ for (Library lib in component.libraries) {
for (Class c in lib.classes) {
if (c.isSyntheticMixinImplementation) {
// Assume mixin
@@ -476,7 +476,7 @@
var bootstrappedProgram = await compiler.computeDelta();
throwOnEmptyMixinBodies(bootstrappedProgram);
bool result = compiler.initializedFromDill;
- await writeProgramToFile(bootstrappedProgram, output);
+ await writeComponentToFile(bootstrappedProgram, output);
for (Uri invalidateUri in invalidateUris) {
compiler.invalidate(invalidateUri);
}
diff --git a/pkg/front_end/test/kernel_generator_test.dart b/pkg/front_end/test/kernel_generator_test.dart
index f84b832..6a2c923 100644
--- a/pkg/front_end/test/kernel_generator_test.dart
+++ b/pkg/front_end/test/kernel_generator_test.dart
@@ -3,7 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
import 'package:kernel/ast.dart'
- show EmptyStatement, Program, ReturnStatement, StaticInvocation;
+ show EmptyStatement, Component, ReturnStatement, StaticInvocation;
import 'package:test/test.dart'
show
@@ -28,7 +28,7 @@
import 'package:front_end/src/fasta/fasta_codes.dart' show messageMissingMain;
-import 'package:front_end/src/fasta/kernel/utils.dart' show serializeProgram;
+import 'package:front_end/src/fasta/kernel/utils.dart' show serializeComponent;
import 'package:front_end/src/testing/compiler_common.dart'
show
@@ -48,9 +48,9 @@
..compileSdk = true // To prevent FE from loading an sdk-summary.
..onError = (e) => errors.add(e);
- var program =
+ var component =
await compileScript('main() => print("hi");', options: options);
- expect(program, isNull);
+ expect(component, isNull);
expect(errors, isNotEmpty);
});
@@ -61,22 +61,22 @@
Uri.parse('org-dartlang-test:///not_existing_summary_file')
..onError = (e) => errors.add(e);
- var program =
+ var component =
await compileScript('main() => print("hi");', options: options);
- expect(program, isNull);
+ expect(component, isNull);
expect(errors, isNotEmpty);
});
- test('by default program is compiled using the full platform file',
+ test('by default component is compiled using the full platform file',
() async {
var options = new CompilerOptions()
// Note: we define [librariesSpecificationUri] with a specification that
// contains broken URIs to ensure we do not attempt to lookup for
// sources of the sdk directly.
..librariesSpecificationUri = invalidCoreLibsSpecUri;
- var program =
+ var component =
await compileScript('main() => print("hi");', options: options);
- var core = program.libraries.firstWhere(isDartCoreLibrary);
+ var core = component.libraries.firstWhere(isDartCoreLibrary);
var printMember = core.members.firstWhere((m) => m.name.name == 'print');
// Note: summaries created by the SDK today contain empty statements as
@@ -107,29 +107,29 @@
expect(exceptionThrown, isTrue);
}, skip: true /* Issue 30194 */);
- test('generated program contains source-info', () async {
- var program = await compileScript('a() => print("hi"); main() {}',
+ test('generated component contains source-info', () async {
+ var component = await compileScript('a() => print("hi"); main() {}',
fileName: 'a.dart');
// Kernel always store an empty '' key in the map, so there is always at
// least one. Having more means that source-info is added.
- expect(program.uriToSource.keys.length, greaterThan(1));
+ expect(component.uriToSource.keys.length, greaterThan(1));
expect(
- program.uriToSource[Uri.parse('org-dartlang-test:///a/b/c/a.dart')],
+ component.uriToSource[Uri.parse('org-dartlang-test:///a/b/c/a.dart')],
isNotNull);
});
test('code from summary dependencies are marked external', () async {
- var program = await compileScript('a() => print("hi"); main() {}',
+ var component = await compileScript('a() => print("hi"); main() {}',
fileName: 'a.dart');
- for (var lib in program.libraries) {
+ for (var lib in component.libraries) {
if (lib.importUri.scheme == 'dart') {
expect(lib.isExternal, isTrue);
}
}
// Pretend that the compiled code is a summary
- var bytes = serializeProgram(program);
- program = await compileScript(
+ var bytes = serializeComponent(component);
+ component = await compileScript(
{
'b.dart': 'import "a.dart" as m; b() => m.a(); main() {}',
'summary.dill': bytes
@@ -137,22 +137,22 @@
fileName: 'b.dart',
inputSummaries: ['summary.dill']);
- var aLib = program.libraries
+ var aLib = component.libraries
.firstWhere((lib) => lib.importUri.path == '/a/b/c/a.dart');
expect(aLib.isExternal, isTrue);
});
test('code from linked dependencies are not marked external', () async {
- var program = await compileScript('a() => print("hi"); main() {}',
+ var component = await compileScript('a() => print("hi"); main() {}',
fileName: 'a.dart');
- for (var lib in program.libraries) {
+ for (var lib in component.libraries) {
if (lib.importUri.scheme == 'dart') {
expect(lib.isExternal, isTrue);
}
}
- var bytes = serializeProgram(program);
- program = await compileScript(
+ var bytes = serializeComponent(component);
+ component = await compileScript(
{
'b.dart': 'import "a.dart" as m; b() => m.a(); main() {}',
'link.dill': bytes
@@ -160,7 +160,7 @@
fileName: 'b.dart',
linkedDependencies: ['link.dill']);
- var aLib = program.libraries
+ var aLib = component.libraries
.firstWhere((lib) => lib.importUri.path == '/a/b/c/a.dart');
expect(aLib.isExternal, isFalse);
});
@@ -168,7 +168,7 @@
// TODO(sigmund): add tests discovering libraries.json
});
- group('kernelForBuildUnit', () {
+ group('kernelForComponent', () {
test('compiler does not require a main method', () async {
var errors = [];
var options = new CompilerOptions()..onError = (e) => errors.add(e);
@@ -216,17 +216,17 @@
var unitA = await compileUnit(['a.dart'], sources);
// Pretend that the compiled code is a summary
- sources['a.dill'] = serializeProgram(unitA);
+ sources['a.dill'] = serializeComponent(unitA);
var unitBC = await compileUnit(['b.dart', 'c.dart'], sources,
inputSummaries: ['a.dill']);
// Pretend that the compiled code is a summary
- sources['bc.dill'] = serializeProgram(unitBC);
+ sources['bc.dill'] = serializeComponent(unitBC);
- void checkDCallsC(Program program) {
- var dLib = findLibrary(program, 'd.dart');
- var cLib = findLibrary(program, 'c.dart');
+ void checkDCallsC(Component component) {
+ var dLib = findLibrary(component, 'd.dart');
+ var cLib = findLibrary(component, 'c.dart');
var dMethod = dLib.procedures.first;
var dBody = dMethod.function.body;
var dCall = (dBody as ReturnStatement).expression;
diff --git a/pkg/front_end/test/src/base/processed_options_test.dart b/pkg/front_end/test/src/base/processed_options_test.dart
index 359acab..2ce4498 100644
--- a/pkg/front_end/test/src/base/processed_options_test.dart
+++ b/pkg/front_end/test/src/base/processed_options_test.dart
@@ -12,7 +12,7 @@
import 'package:front_end/src/fasta/fasta_codes.dart';
import 'package:kernel/binary/ast_to_binary.dart' show BinaryPrinter;
import 'package:kernel/kernel.dart'
- show CanonicalName, Library, Program, loadProgramFromBytes;
+ show CanonicalName, Library, Component, loadComponentFromBytes;
import 'package:package_config/packages.dart' show Packages;
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -30,9 +30,9 @@
MemoryFileSystem fileSystem =
new MemoryFileSystem(Uri.parse('org-dartlang-test:///'));
- Program _mockOutline;
+ Component _mockOutline;
- Program get mockSummary => _mockOutline ??= new Program(
+ Component get mockSummary => _mockOutline ??= new Component(
libraries: [new Library(Uri.parse('org-dartlang-test:///a/b.dart'))]);
test_compileSdk_false() {
@@ -80,7 +80,7 @@
var bytes = await processed.loadSdkSummaryBytes();
expect(bytes, isNotEmpty);
- var sdkSummary = loadProgramFromBytes(bytes);
+ var sdkSummary = loadComponentFromBytes(bytes);
expect(sdkSummary.libraries.single.importUri,
mockSummary.libraries.single.importUri);
}
@@ -95,7 +95,7 @@
void writeMockSummaryTo(Uri uri) {
var sink = new BytesSink();
- new BinaryPrinter(sink).writeProgramFile(mockSummary);
+ new BinaryPrinter(sink).writeComponentFile(mockSummary);
fileSystem.entityForUri(uri).writeAsBytesSync(sink.builder.takeBytes());
}
diff --git a/pkg/front_end/test/src/incremental/hot_reload_e2e_test.dart b/pkg/front_end/test/src/incremental/hot_reload_e2e_test.dart
index 23e91a3..56728d6 100644
--- a/pkg/front_end/test/src/incremental/hot_reload_e2e_test.dart
+++ b/pkg/front_end/test/src/incremental/hot_reload_e2e_test.dart
@@ -17,7 +17,7 @@
import 'package:expect/expect.dart' show Expect;
-import 'package:kernel/ast.dart' show Program;
+import 'package:kernel/ast.dart' show Component;
import 'package:kernel/binary/limited_ast_to_binary.dart'
show LimitedBinaryPrinter;
@@ -308,21 +308,21 @@
compiler.invalidate(Uri.parse("org-dartlang-test:///a.dart"));
compiler.invalidate(Uri.parse("org-dartlang-test:///b.dart"));
compiler.invalidate(Uri.parse("org-dartlang-test:///c.dart"));
- var program = await compiler.computeDelta();
- if (program != null && !program.libraries.isEmpty) {
- await writeProgram(program, outputUri);
+ var component = await compiler.computeDelta();
+ if (component != null && !component.libraries.isEmpty) {
+ await writeProgram(component, outputUri);
return true;
}
return false;
}
-Future<Null> writeProgram(Program program, Uri outputUri) async {
+Future<Null> writeProgram(Component component, Uri outputUri) async {
var sink = new File.fromUri(outputUri).openWrite();
// TODO(sigmund): the incremental generator should always filter these
// libraries instead.
new LimitedBinaryPrinter(
sink, (library) => library.importUri.scheme != 'dart', false)
- .writeProgramFile(program);
+ .writeComponentFile(component);
await sink.close();
}
diff --git a/pkg/front_end/test/src/incremental/kernel_driver_test.dart b/pkg/front_end/test/src/incremental/kernel_driver_test.dart
index 28554bd..febded4 100644
--- a/pkg/front_end/test/src/incremental/kernel_driver_test.dart
+++ b/pkg/front_end/test/src/incremental/kernel_driver_test.dart
@@ -567,9 +567,9 @@
'dart.async::Future<dart.core::String>');
// We should be able to serialize the libraries without SDK.
- var program =
- new Program(nameRoot: kernelResult.nameRoot, libraries: allLibraries);
- serializeProgram(program,
+ var component = new Component(
+ nameRoot: kernelResult.nameRoot, libraries: allLibraries);
+ serializeComponent(component,
filter: (library) => !library.importUri.isScheme('dart'));
}
@@ -710,43 +710,43 @@
KernelSequenceResult result = await driver.getKernelSequence(bUri);
- Program program = new Program(
+ Component component = new Component(
nameRoot: result.nameRoot, libraries: _allLibraries(result));
String initialKernelText;
List<int> bytes;
{
- Library initialLibrary = _getLibraryFromProgram(program, bUri);
+ Library initialLibrary = _getLibraryFromProgram(component, bUri);
initialKernelText = _getLibraryText(initialLibrary);
- bytes = serializeProgram(program,
+ bytes = serializeComponent(component,
filter: (library) => library.importUri == bUri);
- // Remove b.dart from the program.
- // So, the program is now ready for re-adding the library.
- program.mainMethod = null;
- program.libraries.remove(initialLibrary);
- program.root.removeChild(initialLibrary.importUri.toString());
+ // Remove b.dart from the component.
+ // So, the component is now ready for re-adding the library.
+ component.mainMethod = null;
+ component.libraries.remove(initialLibrary);
+ component.root.removeChild(initialLibrary.importUri.toString());
}
// Load b.dart from bytes using the initial name root, so that
// serialized canonical names can be linked to corresponding nodes.
Library loadedLibrary;
{
- var programForLoading = new Program(nameRoot: program.root);
+ var programForLoading = new Component(nameRoot: component.root);
var reader = new BinaryBuilder(bytes);
- reader.readProgram(programForLoading);
+ reader.readComponent(programForLoading);
loadedLibrary = _getLibraryFromProgram(programForLoading, bUri);
}
- // Add the library into the program.
- program.libraries.add(loadedLibrary);
- loadedLibrary.parent = program;
- program.mainMethod = loadedLibrary.procedures
+ // Add the library into the component.
+ component.libraries.add(loadedLibrary);
+ loadedLibrary.parent = component;
+ component.mainMethod = loadedLibrary.procedures
.firstWhere((procedure) => procedure.name.name == 'main');
expect(_getLibraryText(loadedLibrary), initialKernelText);
- verifyProgram(program);
+ verifyComponent(component);
}
test_updatePackageSourceUsingFileUri() async {
@@ -1023,8 +1023,8 @@
fail('No library found with URI "$uri"');
}
- Library _getLibraryFromProgram(Program program, Uri uri) {
- for (var library in program.libraries) {
+ Library _getLibraryFromProgram(Component component, Uri uri) {
+ for (var library in component.libraries) {
if (library.importUri == uri) return library;
}
fail('No library found with URI "$uri"');
diff --git a/pkg/front_end/test/summary_generator_test.dart b/pkg/front_end/test/summary_generator_test.dart
index 36306a2..05d582c 100644
--- a/pkg/front_end/test/summary_generator_test.dart
+++ b/pkg/front_end/test/summary_generator_test.dart
@@ -12,17 +12,17 @@
main() {
test('summary has no source-info by default', () async {
var summary = await summarize(['a.dart'], allSources);
- var program = loadProgramFromBytes(summary);
+ var component = loadComponentFromBytes(summary);
// Note: the kernel representation always has an empty '' key in the map,
// but otherwise no other data is included here.
- expect(program.uriToSource.keys.single, Uri.parse(""));
+ expect(component.uriToSource.keys.single, Uri.parse(""));
});
test('summary includes declarations, but no method bodies', () async {
var summary = await summarize(['a.dart'], allSources);
- var program = loadProgramFromBytes(summary);
- var aLib = findLibrary(program, 'a.dart');
+ var component = loadComponentFromBytes(summary);
+ var aLib = findLibrary(component, 'a.dart');
expect(aLib.importUri.path, '/a/b/c/a.dart');
var classA = aLib.classes.first;
expect(classA.name, 'A');
@@ -33,8 +33,8 @@
test('summarized libraries are not marked external', () async {
var summary = await summarize(['a.dart'], allSources);
- var program = loadProgramFromBytes(summary);
- var aLib = findLibrary(program, 'a.dart');
+ var component = loadComponentFromBytes(summary);
+ var aLib = findLibrary(component, 'a.dart');
expect(aLib.importUri.path, '/a/b/c/a.dart');
expect(aLib.isExternal, isFalse);
});
@@ -42,8 +42,8 @@
test('sdk dependencies are marked external', () async {
// Note: by default this test is loading the SDK from summaries.
var summary = await summarize(['a.dart'], allSources);
- var program = loadProgramFromBytes(summary);
- var coreLib = findLibrary(program, 'core');
+ var component = loadComponentFromBytes(summary);
+ var coreLib = findLibrary(component, 'core');
expect(coreLib.isExternal, isTrue);
});
@@ -54,9 +54,9 @@
var summaryB =
await summarize(['b.dart'], sourcesWithA, inputSummaries: ['a.dill']);
- var program = loadProgramFromBytes(summaryB);
- var aLib = findLibrary(program, 'a.dart');
- var bLib = findLibrary(program, 'b.dart');
+ var component = loadComponentFromBytes(summaryB);
+ var aLib = findLibrary(component, 'a.dart');
+ var bLib = findLibrary(component, 'b.dart');
expect(aLib.isExternal, isTrue);
expect(bLib.isExternal, isFalse);
});
@@ -103,17 +103,19 @@
test('dependencies not included in truncated summaries', () async {
// Note: by default this test is loading the SDK from summaries.
var summaryA = await summarize(['a.dart'], allSources, truncate: true);
- var program = loadProgramFromBytes(summaryA);
- expect(program.libraries.length, 1);
- expect(program.libraries.single.importUri.path.endsWith('a.dart'), isTrue);
+ var component = loadComponentFromBytes(summaryA);
+ expect(component.libraries.length, 1);
+ expect(
+ component.libraries.single.importUri.path.endsWith('a.dart'), isTrue);
var sourcesWithA = new Map.from(allSources);
sourcesWithA['a.dill'] = summaryA;
var summaryB = await summarize(['b.dart'], sourcesWithA,
inputSummaries: ['a.dill'], truncate: true);
- program = loadProgramFromBytes(summaryB);
- expect(program.libraries.length, 1);
- expect(program.libraries.single.importUri.path.endsWith('b.dart'), isTrue);
+ component = loadComponentFromBytes(summaryB);
+ expect(component.libraries.length, 1);
+ expect(
+ component.libraries.single.importUri.path.endsWith('b.dart'), isTrue);
});
test('summarization by default is hermetic', () async {
@@ -143,11 +145,11 @@
/// Helper function to check that some expectations from the summary of D.
checkDSummary(List<int> summary) {
- var program = loadProgramFromBytes(summary);
- var aLib = findLibrary(program, 'a.dart');
- var bLib = findLibrary(program, 'b.dart');
- var cLib = findLibrary(program, 'c.dart');
- var dLib = findLibrary(program, 'd.dart');
+ var component = loadComponentFromBytes(summary);
+ var aLib = findLibrary(component, 'a.dart');
+ var bLib = findLibrary(component, 'b.dart');
+ var cLib = findLibrary(component, 'c.dart');
+ var dLib = findLibrary(component, 'd.dart');
// All libraries but `d.dart` are marked external.
expect(aLib.isExternal, isTrue);
diff --git a/pkg/front_end/testcases/accessors.dart.direct.transformed.expect b/pkg/front_end/testcases/accessors.dart.direct.transformed.expect
new file mode 100644
index 0000000..342baaf
--- /dev/null
+++ b/pkg/front_end/testcases/accessors.dart.direct.transformed.expect
@@ -0,0 +1,51 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class C extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ set onlySetter(dynamic value) → void {
+ core::print("C.onlySetter called with ${value}.");
+ }
+ method testC() → dynamic {
+ try {
+ core::print(this.onlySetter);
+ throw "No error thrown";
+ }
+ on core::NoSuchMethodError catch(final core::NoSuchMethodError e) {
+ core::print("Expected error: ${e}");
+ }
+ this.{self::C::onlySetter} = "hest";
+ }
+ method testD() → dynamic {
+ core::print(this.onlySetter);
+ this.{self::C::onlySetter} = "hest";
+ }
+}
+class D extends self::C {
+ synthetic constructor •() → void
+ : super self::C::•()
+ ;
+ get onlySetter() → core::String
+ return "D.onlySetter called.";
+ set onlySetter(dynamic value) → void {
+ core::print("D.onlySetter called with ${value}.");
+ }
+}
+static set onlySetter(dynamic value) → void {
+ core::print("onlySetter called with ${value}.");
+}
+static method main() → dynamic {
+ try {
+ core::print(throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#onlySetter, 33, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))));
+ throw "No error thrown";
+ }
+ on core::NoSuchMethodError catch(final core::NoSuchMethodError e) {
+ core::print("Expected error: ${e}");
+ }
+ self::onlySetter = "fisk";
+ new self::C::•().testC();
+ new self::D::•().testD();
+}
diff --git a/pkg/front_end/testcases/ambiguous_exports.dart.direct.transformed.expect b/pkg/front_end/testcases/ambiguous_exports.dart.direct.transformed.expect
new file mode 100644
index 0000000..b45d2fc
--- /dev/null
+++ b/pkg/front_end/testcases/ambiguous_exports.dart.direct.transformed.expect
@@ -0,0 +1,4 @@
+library;
+import self as self;
+
+static const field dynamic _exports# = "{\"main\":\"'main' is exported from both 'pkg/front_end/testcases/hello.dart' and 'pkg/front_end/testcases/map.dart'.\"}" /* from null */;
diff --git a/pkg/front_end/testcases/ambiguous_exports.dart.strong.transformed.expect b/pkg/front_end/testcases/ambiguous_exports.dart.strong.transformed.expect
new file mode 100644
index 0000000..b45d2fc
--- /dev/null
+++ b/pkg/front_end/testcases/ambiguous_exports.dart.strong.transformed.expect
@@ -0,0 +1,4 @@
+library;
+import self as self;
+
+static const field dynamic _exports# = "{\"main\":\"'main' is exported from both 'pkg/front_end/testcases/hello.dart' and 'pkg/front_end/testcases/map.dart'.\"}" /* from null */;
diff --git a/pkg/front_end/testcases/annotation_eof.dart.direct.transformed.expect b/pkg/front_end/testcases/annotation_eof.dart.direct.transformed.expect
new file mode 100644
index 0000000..62142d7
--- /dev/null
+++ b/pkg/front_end/testcases/annotation_eof.dart.direct.transformed.expect
@@ -0,0 +1,8 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/annotation_eof.dart:10:1: Error: Expected a declaration, but got ''."]/* from null */;
+static method main() → dynamic {
+ core::print("There is a dangling annotation at the end of this file");
+}
diff --git a/pkg/front_end/testcases/annotation_eof.dart.strong.transformed.expect b/pkg/front_end/testcases/annotation_eof.dart.strong.transformed.expect
new file mode 100644
index 0000000..62142d7
--- /dev/null
+++ b/pkg/front_end/testcases/annotation_eof.dart.strong.transformed.expect
@@ -0,0 +1,8 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/annotation_eof.dart:10:1: Error: Expected a declaration, but got ''."]/* from null */;
+static method main() → dynamic {
+ core::print("There is a dangling annotation at the end of this file");
+}
diff --git a/pkg/front_end/testcases/annotation_top.dart.direct.transformed.expect b/pkg/front_end/testcases/annotation_top.dart.direct.transformed.expect
new file mode 100644
index 0000000..69d3ebe
--- /dev/null
+++ b/pkg/front_end/testcases/annotation_top.dart.direct.transformed.expect
@@ -0,0 +1,34 @@
+@test::a
+@test::A::•(1)
+library test;
+import self as self;
+import "dart:core" as core;
+
+@self::a
+@self::A::•(2)
+typedef F1 = () → void;
+@self::a
+@self::A::•(3)
+typedef F2 = () → void;
+class A extends core::Object {
+ const constructor •(core::int value) → void
+ : super core::Object::•()
+ ;
+}
+@self::a
+@self::A::•(2)
+class C extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static const field core::Object a = const core::Object::•();
+@self::a
+@self::A::•(3)
+static field core::int f1;
+@self::a
+@self::A::•(3)
+static field core::int f2;
+@self::a
+@self::A::•(4)
+static method main() → void {}
diff --git a/pkg/front_end/testcases/annotation_top.dart.strong.transformed.expect b/pkg/front_end/testcases/annotation_top.dart.strong.transformed.expect
new file mode 100644
index 0000000..69d3ebe
--- /dev/null
+++ b/pkg/front_end/testcases/annotation_top.dart.strong.transformed.expect
@@ -0,0 +1,34 @@
+@test::a
+@test::A::•(1)
+library test;
+import self as self;
+import "dart:core" as core;
+
+@self::a
+@self::A::•(2)
+typedef F1 = () → void;
+@self::a
+@self::A::•(3)
+typedef F2 = () → void;
+class A extends core::Object {
+ const constructor •(core::int value) → void
+ : super core::Object::•()
+ ;
+}
+@self::a
+@self::A::•(2)
+class C extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static const field core::Object a = const core::Object::•();
+@self::a
+@self::A::•(3)
+static field core::int f1;
+@self::a
+@self::A::•(3)
+static field core::int f2;
+@self::a
+@self::A::•(4)
+static method main() → void {}
diff --git a/pkg/front_end/testcases/argument.dart.direct.transformed.expect b/pkg/front_end/testcases/argument.dart.direct.transformed.expect
new file mode 100644
index 0000000..3eb116b
--- /dev/null
+++ b/pkg/front_end/testcases/argument.dart.direct.transformed.expect
@@ -0,0 +1,37 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+abstract class Base extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class Foo extends self::Base {
+ synthetic constructor •() → void
+ : super self::Base::•()
+ ;
+}
+class Bar extends self::Base {
+ synthetic constructor •() → void
+ : super self::Base::•()
+ ;
+}
+class Baz extends self::Base {
+ synthetic constructor •() → void
+ : super self::Base::•()
+ ;
+}
+static method foo(dynamic x) → void {}
+static method bar(dynamic x) → void {}
+static method foo_escaped(dynamic x) → void {}
+static method bar_escaped(dynamic x) → void {}
+static method escape(dynamic fn) → void {
+ fn.call(new self::Baz::•());
+}
+static method main() → dynamic {
+ self::foo(new self::Foo::•());
+ self::bar(new self::Bar::•());
+ self::escape(self::foo_escaped);
+ self::escape(self::bar_escaped);
+}
diff --git a/pkg/front_end/testcases/argument.dart.strong.transformed.expect b/pkg/front_end/testcases/argument.dart.strong.transformed.expect
new file mode 100644
index 0000000..3eb116b
--- /dev/null
+++ b/pkg/front_end/testcases/argument.dart.strong.transformed.expect
@@ -0,0 +1,37 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+abstract class Base extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class Foo extends self::Base {
+ synthetic constructor •() → void
+ : super self::Base::•()
+ ;
+}
+class Bar extends self::Base {
+ synthetic constructor •() → void
+ : super self::Base::•()
+ ;
+}
+class Baz extends self::Base {
+ synthetic constructor •() → void
+ : super self::Base::•()
+ ;
+}
+static method foo(dynamic x) → void {}
+static method bar(dynamic x) → void {}
+static method foo_escaped(dynamic x) → void {}
+static method bar_escaped(dynamic x) → void {}
+static method escape(dynamic fn) → void {
+ fn.call(new self::Baz::•());
+}
+static method main() → dynamic {
+ self::foo(new self::Foo::•());
+ self::bar(new self::Bar::•());
+ self::escape(self::foo_escaped);
+ self::escape(self::bar_escaped);
+}
diff --git a/pkg/front_end/testcases/argument_mismatch.dart.direct.transformed.expect b/pkg/front_end/testcases/argument_mismatch.dart.direct.transformed.expect
new file mode 100644
index 0000000..5d084af
--- /dev/null
+++ b/pkg/front_end/testcases/argument_mismatch.dart.direct.transformed.expect
@@ -0,0 +1,9 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+static method foo() → dynamic {}
+static method test() → dynamic {
+ throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#foo, 32, const <core::Type>[], <dynamic>[null].toList(growable: false), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{})));
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/arithmetic.dart.direct.transformed.expect b/pkg/front_end/testcases/arithmetic.dart.direct.transformed.expect
new file mode 100644
index 0000000..7c867f3
--- /dev/null
+++ b/pkg/front_end/testcases/arithmetic.dart.direct.transformed.expect
@@ -0,0 +1,18 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+static method foo(core::int x, core::int y) → core::int {
+ dynamic z = x.+(y);
+ return z.<<(4);
+}
+static method loop(core::List<dynamic> xs) → void {
+ core::int _ = xs.length;
+ for (core::int i = 0; i.<(xs.length); i = i.+(1)) {
+ }
+}
+static method main() → dynamic {
+ self::foo(4, 5);
+ self::foo(6, 7);
+ self::loop(<dynamic>["dfg"]);
+}
diff --git a/pkg/front_end/testcases/arithmetic.dart.strong.transformed.expect b/pkg/front_end/testcases/arithmetic.dart.strong.transformed.expect
new file mode 100644
index 0000000..0eac1ce
--- /dev/null
+++ b/pkg/front_end/testcases/arithmetic.dart.strong.transformed.expect
@@ -0,0 +1,18 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+static method foo(core::int x, core::int y) → core::int {
+ core::int z = x.{core::num::+}(y);
+ return z.{core::int::<<}(4);
+}
+static method loop(core::List<dynamic> xs) → void {
+ core::int _ = xs.{core::List::length};
+ for (core::int i = 0; i.{core::num::<}(xs.{core::List::length}); i = i.{core::num::+}(1)) {
+ }
+}
+static method main() → dynamic {
+ self::foo(4, 5);
+ self::foo(6, 7);
+ self::loop(<dynamic>["dfg"]);
+}
diff --git a/pkg/front_end/testcases/arrow_function.dart.direct.transformed.expect b/pkg/front_end/testcases/arrow_function.dart.direct.transformed.expect
new file mode 100644
index 0000000..ec2e898
--- /dev/null
+++ b/pkg/front_end/testcases/arrow_function.dart.direct.transformed.expect
@@ -0,0 +1,6 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+static method main<T extends core::Object>() → dynamic
+ return () → dynamic => self::main::T;
diff --git a/pkg/front_end/testcases/arrow_function.dart.strong.transformed.expect b/pkg/front_end/testcases/arrow_function.dart.strong.transformed.expect
new file mode 100644
index 0000000..4cea2f2
--- /dev/null
+++ b/pkg/front_end/testcases/arrow_function.dart.strong.transformed.expect
@@ -0,0 +1,6 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+static method main<T extends core::Object>() → dynamic
+ return () → core::Type => self::main::T;
diff --git a/pkg/front_end/testcases/async_function.dart.direct.transformed.expect b/pkg/front_end/testcases/async_function.dart.direct.transformed.expect
new file mode 100644
index 0000000..6d5759c
--- /dev/null
+++ b/pkg/front_end/testcases/async_function.dart.direct.transformed.expect
@@ -0,0 +1,199 @@
+library;
+import self as self;
+import "dart:async" as asy;
+import "dart:core" as core;
+
+static field core::List<core::String> stringList = <dynamic>["bar"];
+static method asyncString() → asy::Future<core::String> /* originally async */ {
+ final asy::Completer<core::String> :completer = asy::Completer::sync<core::String>();
+ asy::FutureOr<core::String> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L1:
+ {
+ :return_value = "foo";
+ break #L1;
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+}
+static method asyncString2() → asy::Future<core::String> /* originally async */ {
+ final asy::Completer<core::String> :completer = asy::Completer::sync<core::String>();
+ asy::FutureOr<core::String> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L2:
+ {
+ :return_value = self::asyncString();
+ break #L2;
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+}
+static method syncStarString() → core::Iterable<core::String> /* originally sync* */ {
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ function :sync_op(core::_SyncIterator<core::String> :iterator) → core::bool yielding {
+ {
+ {
+ :iterator.{core::_SyncIterator::_current} = "foo";
+ [yield] true;
+ }
+ {
+ :iterator.{core::_SyncIterator::_yieldEachIterable} = self::syncStarString2();
+ [yield] true;
+ }
+ {
+ :iterator.{core::_SyncIterator::_yieldEachIterable} = self::stringList;
+ [yield] true;
+ }
+ }
+ return false;
+ }
+ return new core::_SyncIterable::•<core::String>(:sync_op);
+}
+static method syncStarString2() → core::Iterable<core::String> /* originally sync* */ {
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ function :sync_op(core::_SyncIterator<core::String> :iterator) → core::bool yielding {
+ {
+ {
+ :iterator.{core::_SyncIterator::_current} = "foo";
+ [yield] true;
+ }
+ }
+ return false;
+ }
+ return new core::_SyncIterable::•<core::String>(:sync_op);
+}
+static method asyncStarString() → asy::Stream<core::String> /* originally async* */ {
+ asy::_AsyncStarStreamController<core::String> :controller;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ dynamic :saved_try_context_var0;
+ dynamic :saved_try_context_var1;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try
+ try {
+ #L3:
+ {
+ if(:controller.{asy::_AsyncStarStreamController::add}("foo"))
+ return null;
+ else
+ [yield] null;
+ if(:controller.{asy::_AsyncStarStreamController::addStream}(self::asyncStarString2()))
+ return null;
+ else
+ [yield] null;
+ [yield] let dynamic #t1 = asy::_awaitHelper(self::asyncString(), :async_op_then, :async_op_error, :async_op) in null;
+ if(:controller.{asy::_AsyncStarStreamController::add}(:result))
+ return null;
+ else
+ [yield] null;
+ }
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :controller.{asy::_AsyncStarStreamController::addError}(:exception, :stack_trace);
+ }
+ finally {
+ :controller.{asy::_AsyncStarStreamController::close}();
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ :controller = new asy::_AsyncStarStreamController::•<core::String>(:async_op);
+ return :controller.{asy::_AsyncStarStreamController::stream};
+}
+static method asyncStarString2() → asy::Stream<core::String> /* originally async* */ {
+ asy::_AsyncStarStreamController<core::String> :controller;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ dynamic :saved_try_context_var0;
+ dynamic :saved_try_context_var1;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try
+ try {
+ #L4:
+ {
+ if(:controller.{asy::_AsyncStarStreamController::add}("bar"))
+ return null;
+ else
+ [yield] null;
+ }
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :controller.{asy::_AsyncStarStreamController::addError}(:exception, :stack_trace);
+ }
+ finally {
+ :controller.{asy::_AsyncStarStreamController::close}();
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ :controller = new asy::_AsyncStarStreamController::•<core::String>(:async_op);
+ return :controller.{asy::_AsyncStarStreamController::stream};
+}
+static method main() → dynamic /* originally async */ {
+ final asy::Completer<dynamic> :completer = asy::Completer::sync<dynamic>();
+ asy::FutureOr<dynamic> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ dynamic :saved_try_context_var0;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L5:
+ {
+ [yield] let dynamic #t2 = asy::_awaitHelper(self::asyncString(), :async_op_then, :async_op_error, :async_op) in null;
+ core::String str = :result;
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+}
diff --git a/pkg/front_end/testcases/await.dart.direct.transformed.expect b/pkg/front_end/testcases/await.dart.direct.transformed.expect
new file mode 100644
index 0000000..7a12084
--- /dev/null
+++ b/pkg/front_end/testcases/await.dart.direct.transformed.expect
@@ -0,0 +1,33 @@
+library;
+import self as self;
+import "dart:async" as asy;
+import "dart:core" as core;
+
+static method main() → dynamic /* originally async */ {
+ final asy::Completer<dynamic> :completer = asy::Completer::sync<dynamic>();
+ asy::FutureOr<dynamic> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ dynamic :saved_try_context_var0;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L1:
+ {
+ [yield] let dynamic #t1 = asy::_awaitHelper("Hello, World!", :async_op_then, :async_op_error, :async_op) in null;
+ core::print(:result);
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+}
diff --git a/pkg/front_end/testcases/bad_setter_abstract.dart.direct.transformed.expect b/pkg/front_end/testcases/bad_setter_abstract.dart.direct.transformed.expect
new file mode 100644
index 0000000..fb62763
--- /dev/null
+++ b/pkg/front_end/testcases/bad_setter_abstract.dart.direct.transformed.expect
@@ -0,0 +1,101 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ set a(dynamic #synthetic) → dynamic
+ let dynamic _ = null in invalid-expression "pkg/front_end/testcases/bad_setter_abstract.dart:10:8: Error: A setter should have exactly one formal parameter.
+ set a();
+ ^";
+ set d(dynamic #synthetic) → dynamic
+ let dynamic _ = null in invalid-expression "pkg/front_end/testcases/bad_setter_abstract.dart:11:8: Error: A setter should have exactly one formal parameter.
+ set d(x, y);
+ ^";
+}
+abstract class B extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ set a(dynamic #synthetic) → dynamic
+ let dynamic _ = null in invalid-expression "pkg/front_end/testcases/bad_setter_abstract.dart:15:8: Error: A setter should have exactly one formal parameter.
+ set a();
+ ^";
+ set d(dynamic #synthetic) → dynamic
+ let dynamic _ = null in invalid-expression "pkg/front_end/testcases/bad_setter_abstract.dart:16:8: Error: A setter should have exactly one formal parameter.
+ set d(x, y);
+ ^";
+}
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/bad_setter_abstract.dart:5:8: Error: Expected a function body or '=>'.
+Try adding {}.
+set b();
+ ^", "pkg/front_end/testcases/bad_setter_abstract.dart:7:12: Error: Expected a function body or '=>'.
+Try adding {}.
+set c(x, y);
+ ^"]/* from null */;
+static set b(dynamic #synthetic) → dynamic
+ let dynamic _ = null in invalid-expression "pkg/front_end/testcases/bad_setter_abstract.dart:5:6: Error: A setter should have exactly one formal parameter.
+set b();
+ ^";
+static set c(dynamic #synthetic) → dynamic
+ let dynamic _ = null in invalid-expression "pkg/front_end/testcases/bad_setter_abstract.dart:7:6: Error: A setter should have exactly one formal parameter.
+set c(x, y);
+ ^";
+static method main() → dynamic {
+ core::bool threw;
+ try {
+ threw = true;
+ new self::A::•().a = null;
+ threw = false;
+ }
+ on dynamic catch(final dynamic e) {
+ }
+ if(!threw) {
+ throw "Expected an error above.";
+ }
+ try {
+ threw = true;
+ new self::A::•().d = null;
+ threw = false;
+ }
+ on dynamic catch(final dynamic e) {
+ }
+ if(!threw) {
+ throw "Expected an error above.";
+ }
+ try {
+ threw = true;
+ self::b = null;
+ threw = false;
+ }
+ on dynamic catch(final dynamic e) {
+ }
+ if(!threw) {
+ throw "Expected an error above.";
+ }
+ if(!threw) {
+ throw "Expected an error above.";
+ }
+ try {
+ threw = true;
+ self::c = null;
+ threw = false;
+ }
+ on dynamic catch(final dynamic e) {
+ }
+ if(!threw) {
+ throw "Expected an error above.";
+ }
+ try {
+ threw = true;
+ throw new core::AbstractClassInstantiationError::•("B");
+ threw = false;
+ }
+ on core::AbstractClassInstantiationError catch(final core::AbstractClassInstantiationError _) {
+ }
+ if(!threw) {
+ throw "Expected an error above.";
+ }
+}
diff --git a/pkg/front_end/testcases/bad_setter_abstract.dart.strong.transformed.expect b/pkg/front_end/testcases/bad_setter_abstract.dart.strong.transformed.expect
new file mode 100644
index 0000000..6acf36b
--- /dev/null
+++ b/pkg/front_end/testcases/bad_setter_abstract.dart.strong.transformed.expect
@@ -0,0 +1,103 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ set a(dynamic #synthetic) → void
+ let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/bad_setter_abstract.dart:10:8: Error: A setter should have exactly one formal parameter.
+ set a();
+ ^";
+ set d(dynamic #synthetic) → void
+ let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/bad_setter_abstract.dart:11:8: Error: A setter should have exactly one formal parameter.
+ set d(x, y);
+ ^";
+}
+abstract class B extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ set a(dynamic #synthetic) → void
+ let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/bad_setter_abstract.dart:15:8: Error: A setter should have exactly one formal parameter.
+ set a();
+ ^";
+ set d(dynamic #synthetic) → void
+ let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/bad_setter_abstract.dart:16:8: Error: A setter should have exactly one formal parameter.
+ set d(x, y);
+ ^";
+}
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/bad_setter_abstract.dart:5:8: Error: Expected a function body or '=>'.
+Try adding {}.
+set b();
+ ^", "pkg/front_end/testcases/bad_setter_abstract.dart:7:12: Error: Expected a function body or '=>'.
+Try adding {}.
+set c(x, y);
+ ^", "pkg/front_end/testcases/bad_setter_abstract.dart:66:9: Error: The class 'B' is abstract and can't be instantiated.
+ new B();
+ ^"]/* from null */;
+static set b(dynamic #synthetic) → void
+ let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/bad_setter_abstract.dart:5:6: Error: A setter should have exactly one formal parameter.
+set b();
+ ^";
+static set c(dynamic #synthetic) → void
+ let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/bad_setter_abstract.dart:7:6: Error: A setter should have exactly one formal parameter.
+set c(x, y);
+ ^";
+static method main() → dynamic {
+ core::bool threw;
+ try {
+ threw = true;
+ new self::A::•().{self::A::a} = null;
+ threw = false;
+ }
+ on dynamic catch(final dynamic e) {
+ }
+ if(!threw) {
+ throw "Expected an error above.";
+ }
+ try {
+ threw = true;
+ new self::A::•().{self::A::d} = null;
+ threw = false;
+ }
+ on dynamic catch(final dynamic e) {
+ }
+ if(!threw) {
+ throw "Expected an error above.";
+ }
+ try {
+ threw = true;
+ self::b = null;
+ threw = false;
+ }
+ on dynamic catch(final dynamic e) {
+ }
+ if(!threw) {
+ throw "Expected an error above.";
+ }
+ if(!threw) {
+ throw "Expected an error above.";
+ }
+ try {
+ threw = true;
+ self::c = null;
+ threw = false;
+ }
+ on dynamic catch(final dynamic e) {
+ }
+ if(!threw) {
+ throw "Expected an error above.";
+ }
+ try {
+ threw = true;
+ throw new core::AbstractClassInstantiationError::•("B");
+ threw = false;
+ }
+ on core::AbstractClassInstantiationError catch(final core::AbstractClassInstantiationError _) {
+ }
+ if(!threw) {
+ throw "Expected an error above.";
+ }
+}
diff --git a/pkg/front_end/testcases/bad_store.dart.direct.transformed.expect b/pkg/front_end/testcases/bad_store.dart.direct.transformed.expect
new file mode 100644
index 0000000..2acd12e
--- /dev/null
+++ b/pkg/front_end/testcases/bad_store.dart.direct.transformed.expect
@@ -0,0 +1,24 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class Foo extends core::Object {
+ field dynamic field = null;
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static method identity(dynamic x) → dynamic
+ return x;
+static method use(dynamic x) → void {}
+static method main(core::List<core::String> args) → dynamic {
+ dynamic foo = self::identity(new self::Foo::•());
+ if(args.length.>(1)) {
+ foo.field = "string";
+ dynamic first = foo.field;
+ self::use(first);
+ foo.noField = "string";
+ dynamic second = foo.noField;
+ self::use(second);
+ }
+}
diff --git a/pkg/front_end/testcases/bad_store.dart.strong.transformed.expect b/pkg/front_end/testcases/bad_store.dart.strong.transformed.expect
new file mode 100644
index 0000000..9d63dac
--- /dev/null
+++ b/pkg/front_end/testcases/bad_store.dart.strong.transformed.expect
@@ -0,0 +1,24 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class Foo extends core::Object {
+ field dynamic field = null;
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static method identity(dynamic x) → dynamic
+ return x;
+static method use(dynamic x) → void {}
+static method main(core::List<core::String> args) → dynamic {
+ dynamic foo = self::identity(new self::Foo::•());
+ if(args.{core::List::length}.{core::num::>}(1)) {
+ foo.field = "string";
+ dynamic first = foo.field;
+ self::use(first);
+ foo.noField = "string";
+ dynamic second = foo.noField;
+ self::use(second);
+ }
+}
diff --git a/pkg/front_end/testcases/bug21938.dart.direct.transformed.expect b/pkg/front_end/testcases/bug21938.dart.direct.transformed.expect
new file mode 100644
index 0000000..a399b1b
--- /dev/null
+++ b/pkg/front_end/testcases/bug21938.dart.direct.transformed.expect
@@ -0,0 +1,15 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+static method test() → dynamic {
+ core::Object x;
+ core::Function f;
+ x.call();
+ x.call(3);
+ f.call(5, 2);
+ x.call();
+ f.call;
+ f.call(5, 2);
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/bug30695.dart.direct.transformed.expect b/pkg/front_end/testcases/bug30695.dart.direct.transformed.expect
new file mode 100644
index 0000000..b07b4f4
--- /dev/null
+++ b/pkg/front_end/testcases/bug30695.dart.direct.transformed.expect
@@ -0,0 +1,18 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A extends core::Object {
+ field dynamic foo = 42;
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class B extends self::A {
+ synthetic constructor •() → void
+ : super self::A::•()
+ ;
+ method foo() → dynamic
+ return 42;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/bug31124.dart.direct.transformed.expect b/pkg/front_end/testcases/bug31124.dart.direct.transformed.expect
new file mode 100644
index 0000000..e470ed2
--- /dev/null
+++ b/pkg/front_end/testcases/bug31124.dart.direct.transformed.expect
@@ -0,0 +1,8 @@
+library;
+import self as self;
+
+static method #main() → dynamic {
+ throw "pkg/front_end/testcases/bug31124.dart:1:1: Error: Duplicated name: a
+var a = () => 'b';a();
+^";
+}
diff --git a/pkg/front_end/testcases/bug31124.dart.strong.transformed.expect b/pkg/front_end/testcases/bug31124.dart.strong.transformed.expect
new file mode 100644
index 0000000..e470ed2
--- /dev/null
+++ b/pkg/front_end/testcases/bug31124.dart.strong.transformed.expect
@@ -0,0 +1,8 @@
+library;
+import self as self;
+
+static method #main() → dynamic {
+ throw "pkg/front_end/testcases/bug31124.dart:1:1: Error: Duplicated name: a
+var a = () => 'b';a();
+^";
+}
diff --git a/pkg/front_end/testcases/bug32426.dart.direct.transformed.expect b/pkg/front_end/testcases/bug32426.dart.direct.transformed.expect
new file mode 100644
index 0000000..1e86267
--- /dev/null
+++ b/pkg/front_end/testcases/bug32426.dart.direct.transformed.expect
@@ -0,0 +1,20 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+abstract class I extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ abstract method call() → void;
+}
+class C extends core::Object implements self::I {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method call([core::int x = null]) → void {}
+}
+static method main() → dynamic {
+ self::I i = new self::C::•();
+ ([core::int]) → void f = i;
+}
diff --git a/pkg/front_end/testcases/bug32426.dart.strong.transformed.expect b/pkg/front_end/testcases/bug32426.dart.strong.transformed.expect
new file mode 100644
index 0000000..4c681bf
--- /dev/null
+++ b/pkg/front_end/testcases/bug32426.dart.strong.transformed.expect
@@ -0,0 +1,20 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+abstract class I extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ abstract method call() → void;
+}
+class C extends core::Object implements self::I {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method call([core::int x = null]) → void {}
+}
+static method main() → dynamic {
+ self::I i = new self::C::•();
+ ([core::int]) → void f = (let final self::I #t1 = i in #t1.==(null) ?{() → void} null : #t1.{self::I::call}) as{TypeError} ([core::int]) → void;
+}
diff --git a/pkg/front_end/testcases/cascade.dart.direct.transformed.expect b/pkg/front_end/testcases/cascade.dart.direct.transformed.expect
new file mode 100644
index 0000000..f2cd187
--- /dev/null
+++ b/pkg/front_end/testcases/cascade.dart.direct.transformed.expect
@@ -0,0 +1,14 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+static method main() → dynamic {
+ dynamic list = let final dynamic #t1 = <dynamic>[1] in let final dynamic #t2 = #t1.add(2) in let final dynamic #t3 = #t1.add(3) in let final dynamic #t4 = #t1.addAll(<dynamic>[4, 5]) in #t1;
+ core::print(list);
+ let final dynamic #t5 = list in let final dynamic #t6 = #t5.add(2) in let final dynamic #t7 = #t5.length in let final dynamic #t8 = #t5.length = 0 in #t5;
+ core::print(list);
+ let final dynamic #t9 = list in let final dynamic #t10 = #t9.add(2) in let final dynamic #t11 = #t9.[](0) in let final dynamic #t12 = #t9.[]=(0, 87) in #t9;
+ core::print(list);
+ list = let final dynamic #t13 = <dynamic>[<dynamic>[1]] in let final dynamic #t14 = #t13.first.last.toString() in let final dynamic #t15 = #t13.first.[](0).toString() in let final dynamic #t16 = #t13.[](0).last.toString() in #t13;
+ core::print(list);
+}
diff --git a/pkg/front_end/testcases/casts.dart.direct.transformed.expect b/pkg/front_end/testcases/casts.dart.direct.transformed.expect
new file mode 100644
index 0000000..c75d8ec
--- /dev/null
+++ b/pkg/front_end/testcases/casts.dart.direct.transformed.expect
@@ -0,0 +1,18 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+static method main() → dynamic {
+ core::print("" as core::String);
+ core::print(1 as core::int);
+ core::print(1.0 as core::double);
+ core::print("" is core::String);
+ core::print("" is core::int);
+ core::print("" is core::double);
+ core::print(1 is core::String);
+ core::print(1 is core::int);
+ core::print(1 is core::double);
+ core::print(1.0 is core::String);
+ core::print(1.0 is core::int);
+ core::print(1.0 is core::double);
+}
diff --git a/pkg/front_end/testcases/check_deferred_allocation.dart.direct.transformed.expect b/pkg/front_end/testcases/check_deferred_allocation.dart.direct.transformed.expect
new file mode 100644
index 0000000..25dc9b8
--- /dev/null
+++ b/pkg/front_end/testcases/check_deferred_allocation.dart.direct.transformed.expect
@@ -0,0 +1,9 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "./deferred_lib.dart" as def;
+
+static method main() → dynamic {}
+static method test() → dynamic {
+ core::print(let final dynamic #t1 = CheckLibraryIsLoaded(lib) in new def::C::•());
+}
diff --git a/pkg/front_end/testcases/check_deferred_allocation.dart.strong.transformed.expect b/pkg/front_end/testcases/check_deferred_allocation.dart.strong.transformed.expect
new file mode 100644
index 0000000..d62c43e
--- /dev/null
+++ b/pkg/front_end/testcases/check_deferred_allocation.dart.strong.transformed.expect
@@ -0,0 +1,9 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "./deferred_lib.dart" as def;
+
+static method main() → dynamic {}
+static method test() → dynamic {
+ core::print(let final core::Object #t1 = CheckLibraryIsLoaded(lib) in new def::C::•());
+}
diff --git a/pkg/front_end/testcases/check_deferred_as_check.dart.direct.transformed.expect b/pkg/front_end/testcases/check_deferred_as_check.dart.direct.transformed.expect
new file mode 100644
index 0000000..d17f162
--- /dev/null
+++ b/pkg/front_end/testcases/check_deferred_as_check.dart.direct.transformed.expect
@@ -0,0 +1,7 @@
+library;
+import self as self;
+
+static method main() → dynamic {}
+static method test(dynamic x) → dynamic {
+ x as invalid-type;
+}
diff --git a/pkg/front_end/testcases/check_deferred_as_check.dart.strong.transformed.expect b/pkg/front_end/testcases/check_deferred_as_check.dart.strong.transformed.expect
new file mode 100644
index 0000000..142e594
--- /dev/null
+++ b/pkg/front_end/testcases/check_deferred_as_check.dart.strong.transformed.expect
@@ -0,0 +1,11 @@
+library;
+import self as self;
+
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/check_deferred_as_check.dart:9:8: Error: The type '#lib1::C' is deferred loaded via prefix 'lib' and can't be used as a type annotation.
+Try removing 'deferred' from the import of 'lib' or use a supertype of '#lib1::C' that isn't deferred.
+ x as lib.C;
+ ^^^"]/* from null */;
+static method main() → dynamic {}
+static method test(dynamic x) → dynamic {
+ x as invalid-type;
+}
diff --git a/pkg/front_end/testcases/check_deferred_before_args.dart.direct.transformed.expect b/pkg/front_end/testcases/check_deferred_before_args.dart.direct.transformed.expect
new file mode 100644
index 0000000..0ff5bf9
--- /dev/null
+++ b/pkg/front_end/testcases/check_deferred_before_args.dart.direct.transformed.expect
@@ -0,0 +1,11 @@
+library;
+import self as self;
+import "./deferred_lib.dart" as def;
+
+static method main() → dynamic {}
+static method test() → dynamic {
+ let final dynamic #t1 = CheckLibraryIsLoaded(lib) in def::x = self::m2();
+ let final dynamic #t2 = CheckLibraryIsLoaded(lib) in def::m(self::m2());
+}
+static method m2() → dynamic
+ return 1;
diff --git a/pkg/front_end/testcases/check_deferred_before_args.dart.strong.transformed.expect b/pkg/front_end/testcases/check_deferred_before_args.dart.strong.transformed.expect
new file mode 100644
index 0000000..74489ed
--- /dev/null
+++ b/pkg/front_end/testcases/check_deferred_before_args.dart.strong.transformed.expect
@@ -0,0 +1,12 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "./deferred_lib.dart" as def;
+
+static method main() → dynamic {}
+static method test() → dynamic {
+ let final core::Object #t1 = CheckLibraryIsLoaded(lib) in def::x = self::m2();
+ let final core::Object #t2 = CheckLibraryIsLoaded(lib) in def::m(self::m2());
+}
+static method m2() → dynamic
+ return 1;
diff --git a/pkg/front_end/testcases/check_deferred_before_args2.dart.direct.transformed.expect b/pkg/front_end/testcases/check_deferred_before_args2.dart.direct.transformed.expect
new file mode 100644
index 0000000..8716818
--- /dev/null
+++ b/pkg/front_end/testcases/check_deferred_before_args2.dart.direct.transformed.expect
@@ -0,0 +1,35 @@
+library;
+import self as self;
+import "dart:async" as asy;
+import "./deferred_lib.dart" as def;
+
+static method main() → dynamic {}
+static method test() → dynamic /* originally async */ {
+ final asy::Completer<dynamic> :completer = asy::Completer::sync<dynamic>();
+ asy::FutureOr<dynamic> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ dynamic :saved_try_context_var0;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L1:
+ {
+ final dynamic #t1 = CheckLibraryIsLoaded(lib);
+ [yield] let dynamic #t2 = asy::_awaitHelper(LoadLibrary(lib), :async_op_then, :async_op_error, :async_op) in null;
+ def::m(:result);
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+}
diff --git a/pkg/front_end/testcases/check_deferred_before_args2.dart.strong.transformed.expect b/pkg/front_end/testcases/check_deferred_before_args2.dart.strong.transformed.expect
new file mode 100644
index 0000000..342fff7
--- /dev/null
+++ b/pkg/front_end/testcases/check_deferred_before_args2.dart.strong.transformed.expect
@@ -0,0 +1,36 @@
+library;
+import self as self;
+import "dart:async" as asy;
+import "dart:core" as core;
+import "./deferred_lib.dart" as def;
+
+static method main() → dynamic {}
+static method test() → dynamic /* originally async */ {
+ final asy::Completer<dynamic> :completer = asy::Completer::sync<dynamic>();
+ asy::FutureOr<dynamic> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ dynamic :saved_try_context_var0;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L1:
+ {
+ final core::Object #t1 = CheckLibraryIsLoaded(lib);
+ [yield] let dynamic #t2 = asy::_awaitHelper(LoadLibrary(lib), :async_op_then, :async_op_error, :async_op) in null;
+ def::m(:result);
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+}
diff --git a/pkg/front_end/testcases/check_deferred_before_call.dart.direct.transformed.expect b/pkg/front_end/testcases/check_deferred_before_call.dart.direct.transformed.expect
new file mode 100644
index 0000000..9aef4cf
--- /dev/null
+++ b/pkg/front_end/testcases/check_deferred_before_call.dart.direct.transformed.expect
@@ -0,0 +1,8 @@
+library;
+import self as self;
+import "./deferred_lib.dart" as def;
+
+static method main() → dynamic {}
+static method test() → dynamic {
+ let final dynamic #t1 = CheckLibraryIsLoaded(lib) in def::m(3);
+}
diff --git a/pkg/front_end/testcases/check_deferred_before_call.dart.strong.transformed.expect b/pkg/front_end/testcases/check_deferred_before_call.dart.strong.transformed.expect
new file mode 100644
index 0000000..1eb7ae1
--- /dev/null
+++ b/pkg/front_end/testcases/check_deferred_before_call.dart.strong.transformed.expect
@@ -0,0 +1,9 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "./deferred_lib.dart" as def;
+
+static method main() → dynamic {}
+static method test() → dynamic {
+ let final core::Object #t1 = CheckLibraryIsLoaded(lib) in def::m(3);
+}
diff --git a/pkg/front_end/testcases/check_deferred_before_write.dart.direct.transformed.expect b/pkg/front_end/testcases/check_deferred_before_write.dart.direct.transformed.expect
new file mode 100644
index 0000000..2b7ef3d
--- /dev/null
+++ b/pkg/front_end/testcases/check_deferred_before_write.dart.direct.transformed.expect
@@ -0,0 +1,8 @@
+library;
+import self as self;
+import "./deferred_lib.dart" as def;
+
+static method main() → dynamic {}
+static method test() → dynamic {
+ let final dynamic #t1 = CheckLibraryIsLoaded(lib) in def::x = 2;
+}
diff --git a/pkg/front_end/testcases/check_deferred_before_write.dart.strong.transformed.expect b/pkg/front_end/testcases/check_deferred_before_write.dart.strong.transformed.expect
new file mode 100644
index 0000000..d51e9f3
--- /dev/null
+++ b/pkg/front_end/testcases/check_deferred_before_write.dart.strong.transformed.expect
@@ -0,0 +1,9 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "./deferred_lib.dart" as def;
+
+static method main() → dynamic {}
+static method test() → dynamic {
+ let final core::Object #t1 = CheckLibraryIsLoaded(lib) in def::x = 2;
+}
diff --git a/pkg/front_end/testcases/check_deferred_is_check.dart.direct.transformed.expect b/pkg/front_end/testcases/check_deferred_is_check.dart.direct.transformed.expect
new file mode 100644
index 0000000..8fa0c48
--- /dev/null
+++ b/pkg/front_end/testcases/check_deferred_is_check.dart.direct.transformed.expect
@@ -0,0 +1,8 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+static method main() → dynamic {}
+static method test(dynamic x) → dynamic {
+ core::print(x is invalid-type);
+}
diff --git a/pkg/front_end/testcases/check_deferred_is_check.dart.strong.transformed.expect b/pkg/front_end/testcases/check_deferred_is_check.dart.strong.transformed.expect
new file mode 100644
index 0000000..ef6d460
--- /dev/null
+++ b/pkg/front_end/testcases/check_deferred_is_check.dart.strong.transformed.expect
@@ -0,0 +1,12 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/check_deferred_is_check.dart:9:14: Error: The type '#lib1::C' is deferred loaded via prefix 'lib' and can't be used as a type annotation.
+Try removing 'deferred' from the import of 'lib' or use a supertype of '#lib1::C' that isn't deferred.
+ print(x is lib.C);
+ ^^^"]/* from null */;
+static method main() → dynamic {}
+static method test(dynamic x) → dynamic {
+ core::print(x is invalid-type);
+}
diff --git a/pkg/front_end/testcases/check_deferred_read.dart.direct.transformed.expect b/pkg/front_end/testcases/check_deferred_read.dart.direct.transformed.expect
new file mode 100644
index 0000000..5fd285b
--- /dev/null
+++ b/pkg/front_end/testcases/check_deferred_read.dart.direct.transformed.expect
@@ -0,0 +1,9 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "./deferred_lib.dart" as def;
+
+static method main() → dynamic {}
+static method test() → dynamic {
+ core::print((let final dynamic #t1 = CheckLibraryIsLoaded(lib) in def::x).+(1));
+}
diff --git a/pkg/front_end/testcases/check_deferred_read.dart.strong.transformed.expect b/pkg/front_end/testcases/check_deferred_read.dart.strong.transformed.expect
new file mode 100644
index 0000000..f01fe12
--- /dev/null
+++ b/pkg/front_end/testcases/check_deferred_read.dart.strong.transformed.expect
@@ -0,0 +1,9 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "./deferred_lib.dart" as def;
+
+static method main() → dynamic {}
+static method test() → dynamic {
+ core::print((let final core::Object #t1 = CheckLibraryIsLoaded(lib) in def::x).{core::num::+}(1));
+}
diff --git a/pkg/front_end/testcases/check_deferred_read_static_field.dart.direct.transformed.expect b/pkg/front_end/testcases/check_deferred_read_static_field.dart.direct.transformed.expect
new file mode 100644
index 0000000..7b3c2df
--- /dev/null
+++ b/pkg/front_end/testcases/check_deferred_read_static_field.dart.direct.transformed.expect
@@ -0,0 +1,9 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "./deferred_lib.dart" as def;
+
+static method main() → dynamic {}
+static method test() → dynamic {
+ core::print(let final dynamic #t1 = CheckLibraryIsLoaded(lib) in def::C::y);
+}
diff --git a/pkg/front_end/testcases/check_deferred_read_static_field.dart.strong.transformed.expect b/pkg/front_end/testcases/check_deferred_read_static_field.dart.strong.transformed.expect
new file mode 100644
index 0000000..a3557a6
--- /dev/null
+++ b/pkg/front_end/testcases/check_deferred_read_static_field.dart.strong.transformed.expect
@@ -0,0 +1,9 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "./deferred_lib.dart" as def;
+
+static method main() → dynamic {}
+static method test() → dynamic {
+ core::print(let final core::Object #t1 = CheckLibraryIsLoaded(lib) in def::C::y);
+}
diff --git a/pkg/front_end/testcases/check_deferred_read_type.dart.direct.transformed.expect b/pkg/front_end/testcases/check_deferred_read_type.dart.direct.transformed.expect
new file mode 100644
index 0000000..4c3620c
--- /dev/null
+++ b/pkg/front_end/testcases/check_deferred_read_type.dart.direct.transformed.expect
@@ -0,0 +1,9 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "./deferred_lib.dart" as def;
+
+static method main() → dynamic {}
+static method test() → dynamic {
+ core::print(let final dynamic #t1 = CheckLibraryIsLoaded(lib) in def::C);
+}
diff --git a/pkg/front_end/testcases/check_deferred_read_type.dart.strong.transformed.expect b/pkg/front_end/testcases/check_deferred_read_type.dart.strong.transformed.expect
new file mode 100644
index 0000000..555229f
--- /dev/null
+++ b/pkg/front_end/testcases/check_deferred_read_type.dart.strong.transformed.expect
@@ -0,0 +1,9 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "./deferred_lib.dart" as def;
+
+static method main() → dynamic {}
+static method test() → dynamic {
+ core::print(let final core::Object #t1 = CheckLibraryIsLoaded(lib) in def::C);
+}
diff --git a/pkg/front_end/testcases/check_deferred_static_method_call.dart.direct.transformed.expect b/pkg/front_end/testcases/check_deferred_static_method_call.dart.direct.transformed.expect
new file mode 100644
index 0000000..05236e5
--- /dev/null
+++ b/pkg/front_end/testcases/check_deferred_static_method_call.dart.direct.transformed.expect
@@ -0,0 +1,9 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "./deferred_lib.dart" as def;
+
+static method main() → dynamic {}
+static method test() → dynamic {
+ core::print(let final dynamic #t1 = CheckLibraryIsLoaded(lib) in def::C::m());
+}
diff --git a/pkg/front_end/testcases/check_deferred_static_method_call.dart.strong.transformed.expect b/pkg/front_end/testcases/check_deferred_static_method_call.dart.strong.transformed.expect
new file mode 100644
index 0000000..c5ab3c3
--- /dev/null
+++ b/pkg/front_end/testcases/check_deferred_static_method_call.dart.strong.transformed.expect
@@ -0,0 +1,9 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "./deferred_lib.dart" as def;
+
+static method main() → dynamic {}
+static method test() → dynamic {
+ core::print(let final core::Object #t1 = CheckLibraryIsLoaded(lib) in def::C::m());
+}
diff --git a/pkg/front_end/testcases/check_deferred_type_declaration.dart.direct.transformed.expect b/pkg/front_end/testcases/check_deferred_type_declaration.dart.direct.transformed.expect
new file mode 100644
index 0000000..fe4fe2e
--- /dev/null
+++ b/pkg/front_end/testcases/check_deferred_type_declaration.dart.direct.transformed.expect
@@ -0,0 +1,8 @@
+library;
+import self as self;
+
+static method main() → dynamic
+ return self::test();
+static method test() → dynamic {
+ invalid-type x = null;
+}
diff --git a/pkg/front_end/testcases/check_deferred_type_declaration.dart.strong.transformed.expect b/pkg/front_end/testcases/check_deferred_type_declaration.dart.strong.transformed.expect
new file mode 100644
index 0000000..4d6d46d
--- /dev/null
+++ b/pkg/front_end/testcases/check_deferred_type_declaration.dart.strong.transformed.expect
@@ -0,0 +1,12 @@
+library;
+import self as self;
+
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/check_deferred_type_declaration.dart:9:3: Error: The type '#lib1::C' is deferred loaded via prefix 'lib' and can't be used as a type annotation.
+Try removing 'deferred' from the import of 'lib' or use a supertype of '#lib1::C' that isn't deferred.
+ lib.C x = null;
+ ^^^"]/* from null */;
+static method main() → dynamic
+ return self::test();
+static method test() → dynamic {
+ invalid-type x = null;
+}
diff --git a/pkg/front_end/testcases/classes.dart.direct.transformed.expect b/pkg/front_end/testcases/classes.dart.direct.transformed.expect
new file mode 100644
index 0000000..8cb3ab3
--- /dev/null
+++ b/pkg/front_end/testcases/classes.dart.direct.transformed.expect
@@ -0,0 +1,31 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A extends core::Object {
+ final field core::int x;
+ final field core::int y;
+ constructor •(core::int y) → void
+ : self::A::y = y, self::A::x = 42, super core::Object::•()
+ ;
+ method method() → dynamic {
+ core::print("A.method x: ${this.{self::A::x}} y: ${this.{self::A::y}}");
+ core::print(this);
+ core::print(this.{core::Object::runtimeType});
+ }
+}
+class B extends self::A {
+ constructor •(dynamic x) → void
+ : super self::A::•(x)
+ ;
+ method method() → dynamic {
+ core::print("B.method x: ${this.{self::A::x}} y: ${this.{self::A::y}}");
+ super.{self::A::method}();
+ }
+}
+static method main() → dynamic {
+ self::A a = new self::A::•(87);
+ self::B b = new self::B::•(117);
+ a.method();
+ b.method();
+}
diff --git a/pkg/front_end/testcases/closure.dart.direct.transformed.expect b/pkg/front_end/testcases/closure.dart.direct.transformed.expect
new file mode 100644
index 0000000..edc6bf4
--- /dev/null
+++ b/pkg/front_end/testcases/closure.dart.direct.transformed.expect
@@ -0,0 +1,27 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class Foo extends core::Object {
+ field dynamic _field = new self::Bar::•();
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class Bar extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static method useCallback(dynamic callback) → dynamic {
+ dynamic _ = callback.call();
+}
+static method main() → dynamic {
+ dynamic x;
+ function inner() → dynamic {
+ x = new self::Foo::•();
+ return new self::Foo::•();
+ }
+ self::useCallback(inner);
+ dynamic _ = inner.call()._field;
+}
diff --git a/pkg/front_end/testcases/co19_language_metadata_syntax_t04.dart.direct.transformed.expect b/pkg/front_end/testcases/co19_language_metadata_syntax_t04.dart.direct.transformed.expect
new file mode 100644
index 0000000..7b807bd
--- /dev/null
+++ b/pkg/front_end/testcases/co19_language_metadata_syntax_t04.dart.direct.transformed.expect
@@ -0,0 +1,8 @@
+library;
+import self as self;
+
+static method #main() → dynamic {
+ throw "pkg/front_end/testcases/co19_language_metadata_syntax_t04.dart:16:9: Error: Duplicated name: A
+class A {
+ ^";
+}
diff --git a/pkg/front_end/testcases/co19_language_metadata_syntax_t04.dart.strong.transformed.expect b/pkg/front_end/testcases/co19_language_metadata_syntax_t04.dart.strong.transformed.expect
new file mode 100644
index 0000000..7b807bd
--- /dev/null
+++ b/pkg/front_end/testcases/co19_language_metadata_syntax_t04.dart.strong.transformed.expect
@@ -0,0 +1,8 @@
+library;
+import self as self;
+
+static method #main() → dynamic {
+ throw "pkg/front_end/testcases/co19_language_metadata_syntax_t04.dart:16:9: Error: Duplicated name: A
+class A {
+ ^";
+}
diff --git a/pkg/front_end/testcases/covariant_generic.dart.direct.transformed.expect b/pkg/front_end/testcases/covariant_generic.dart.direct.transformed.expect
new file mode 100644
index 0000000..6c077b6
--- /dev/null
+++ b/pkg/front_end/testcases/covariant_generic.dart.direct.transformed.expect
@@ -0,0 +1,39 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+typedef Callback<T extends core::Object> = (T) → void;
+class Foo<T extends core::Object> extends core::Object {
+ final field self::Foo::T finalField;
+ final field (self::Foo::T) → void callbackField;
+ field self::Foo::T mutableField = null;
+ field (self::Foo::T) → void mutableCallbackField = null;
+ constructor •(self::Foo::T finalField, (self::Foo::T) → void callbackField) → void
+ : self::Foo::finalField = finalField, self::Foo::callbackField = callbackField, super core::Object::•()
+ ;
+ method method(self::Foo::T x) → void {}
+ set setter(self::Foo::T x) → dynamic {}
+ method withCallback((self::Foo::T) → void callback) → void {
+ callback.call(this.{self::Foo::finalField});
+ }
+}
+static method main() → dynamic {
+ self::Foo<core::int> fooInt = new self::Foo::•<core::int>(1, (core::int x) → dynamic {});
+ fooInt.method(3);
+ fooInt.setter = 3;
+ fooInt.withCallback((core::int x) → dynamic {});
+ fooInt.withCallback((core::num x) → dynamic {});
+ fooInt.mutableField = 3;
+ fooInt.mutableCallbackField = (core::int x) → dynamic {};
+ self::Foo<core::num> fooNum = fooInt;
+ fooNum.method(3);
+ fooNum.method(2.5);
+ fooNum.setter = 3;
+ fooNum.setter = 2.5;
+ fooNum.withCallback((core::num x) → dynamic {});
+ fooNum.mutableField = 3;
+ fooNum.mutableField = 2.5;
+ fooNum.mutableCallbackField(3);
+ fooNum.mutableCallbackField(2.5);
+ fooNum.mutableCallbackField = (core::num x) → dynamic {};
+}
diff --git a/pkg/front_end/testcases/cycles.dart.direct.transformed.expect b/pkg/front_end/testcases/cycles.dart.direct.transformed.expect
new file mode 100644
index 0000000..930f646
--- /dev/null
+++ b/pkg/front_end/testcases/cycles.dart.direct.transformed.expect
@@ -0,0 +1,37 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class B extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class C extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class D extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/cycles.dart:5:7: Error: 'A' is a supertype of itself via 'B', 'C'.
+class A implements C {}
+ ^", "pkg/front_end/testcases/cycles.dart:7:7: Error: 'B' is a supertype of itself via 'A', 'C'.
+class B extends A {}
+ ^", "pkg/front_end/testcases/cycles.dart:9:7: Error: 'C' is a supertype of itself via 'A', 'B'.
+class C extends B implements D {}
+ ^"]/* from null */;
+static method main() → dynamic {
+ core::print(new self::A::•());
+ core::print(new self::B::•());
+ core::print(new self::C::•());
+ core::print(new self::D::•());
+}
diff --git a/pkg/front_end/testcases/default_values.dart.direct.transformed.expect b/pkg/front_end/testcases/default_values.dart.direct.transformed.expect
new file mode 100644
index 0000000..ac79608
--- /dev/null
+++ b/pkg/front_end/testcases/default_values.dart.direct.transformed.expect
@@ -0,0 +1,9 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+static method topLevel([dynamic a = 42]) → dynamic
+ return a;
+static method main() → dynamic {
+ core::print(self::topLevel());
+}
diff --git a/pkg/front_end/testcases/duplicated_named_args_3.dart.direct.transformed.expect b/pkg/front_end/testcases/duplicated_named_args_3.dart.direct.transformed.expect
new file mode 100644
index 0000000..e95737c
--- /dev/null
+++ b/pkg/front_end/testcases/duplicated_named_args_3.dart.direct.transformed.expect
@@ -0,0 +1,16 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class C extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ static method m({core::int a = 0}) → dynamic {}
+}
+static method test() → void {
+ self::C::m(a: invalid-expression "pkg/front_end/testcases/duplicated_named_args_3.dart:13:19: Error: Duplicated named argument 'a'.
+ C.m(a: 1, a: 2, a: 3);
+ ^");
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/duplicated_named_args_3.dart.strong.transformed.expect b/pkg/front_end/testcases/duplicated_named_args_3.dart.strong.transformed.expect
new file mode 100644
index 0000000..6fc51ce
--- /dev/null
+++ b/pkg/front_end/testcases/duplicated_named_args_3.dart.strong.transformed.expect
@@ -0,0 +1,16 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class C extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ static method m({core::int a = 0}) → dynamic {}
+}
+static method test() → void {
+ self::C::m(a: invalid-expression "pkg/front_end/testcases/duplicated_named_args_3.dart:13:19: Error: Duplicated named argument 'a'.
+ C.m(a: 1, a: 2, a: 3);
+ ^" as{TypeError} core::int);
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/dynamic_and_void.dart.direct.transformed.expect b/pkg/front_end/testcases/dynamic_and_void.dart.direct.transformed.expect
new file mode 100644
index 0000000..4b7b5f6
--- /dev/null
+++ b/pkg/front_end/testcases/dynamic_and_void.dart.direct.transformed.expect
@@ -0,0 +1,7 @@
+library;
+import self as self;
+
+static method testDynamic() → invalid-type
+ return 0;
+static method testVoid() → void {}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/escape.dart.direct.transformed.expect b/pkg/front_end/testcases/escape.dart.direct.transformed.expect
new file mode 100644
index 0000000..136725f
--- /dev/null
+++ b/pkg/front_end/testcases/escape.dart.direct.transformed.expect
@@ -0,0 +1,50 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A extends core::Object {
+ field dynamic field = null;
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class B extends core::Object {
+ field dynamic field = null;
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class C extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ operator ==(dynamic x) → dynamic
+ return false;
+}
+class X extends core::Object implements self::A, self::B {
+ field dynamic field = null;
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static method useAsA(self::A object) → void {
+ dynamic _ = object.field;
+}
+static method useAsB(self::B object) → void {
+ dynamic _ = object.field;
+ self::escape(object);
+}
+static method escape(dynamic x) → void {
+ x.==(null) ? x = "" : null;
+ x.==(null) ? x = 45 : null;
+ if(!(x is core::int) && !(x is core::String)) {
+ x.field = 45;
+ }
+}
+static method main() → dynamic {
+ dynamic object = new self::X::•();
+ self::useAsA(new self::A::•());
+ self::useAsA(object);
+ self::useAsB(new self::B::•());
+ self::useAsB(object);
+}
diff --git a/pkg/front_end/testcases/export_main.dart.direct.transformed.expect b/pkg/front_end/testcases/export_main.dart.direct.transformed.expect
new file mode 100644
index 0000000..9227cd5
--- /dev/null
+++ b/pkg/front_end/testcases/export_main.dart.direct.transformed.expect
@@ -0,0 +1,4 @@
+library;
+import self as self;
+import "./hello.dart" as hel;
+additionalExports = (hel::main)
diff --git a/pkg/front_end/testcases/export_main.dart.strong.transformed.expect b/pkg/front_end/testcases/export_main.dart.strong.transformed.expect
new file mode 100644
index 0000000..9227cd5
--- /dev/null
+++ b/pkg/front_end/testcases/export_main.dart.strong.transformed.expect
@@ -0,0 +1,4 @@
+library;
+import self as self;
+import "./hello.dart" as hel;
+additionalExports = (hel::main)
diff --git a/pkg/front_end/testcases/export_test.dart.direct.transformed.expect b/pkg/front_end/testcases/export_test.dart.direct.transformed.expect
new file mode 100644
index 0000000..40ce1cc
--- /dev/null
+++ b/pkg/front_end/testcases/export_test.dart.direct.transformed.expect
@@ -0,0 +1,9 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "dart:developer" as dev;
+additionalExports = (core::print)
+
+static method main() → dynamic {
+ core::print(dev::UserTag);
+}
diff --git a/pkg/front_end/testcases/export_test.dart.strong.transformed.expect b/pkg/front_end/testcases/export_test.dart.strong.transformed.expect
new file mode 100644
index 0000000..40ce1cc
--- /dev/null
+++ b/pkg/front_end/testcases/export_test.dart.strong.transformed.expect
@@ -0,0 +1,9 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "dart:developer" as dev;
+additionalExports = (core::print)
+
+static method main() → dynamic {
+ core::print(dev::UserTag);
+}
diff --git a/pkg/front_end/testcases/expressions.dart.direct.transformed.expect b/pkg/front_end/testcases/expressions.dart.direct.transformed.expect
new file mode 100644
index 0000000..7fece02
--- /dev/null
+++ b/pkg/front_end/testcases/expressions.dart.direct.transformed.expect
@@ -0,0 +1,79 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+static method foo({dynamic fisk = null}) → dynamic {
+ core::print(fisk);
+}
+static method caller(dynamic f) → dynamic {
+ f.call();
+}
+static method main() → dynamic {
+ core::int i = 0;
+ core::print(i.==(1) ? "bad" : "good");
+ core::print("${i}");
+ core::print("'${i}'");
+ core::print(" '${i}' ");
+ core::print(" '${i}' '${i}'");
+ core::print(" '${i}' '${i}'");
+ core::print("foobar");
+ core::print(" '${i}' '${i}' '${i}' '${i}'");
+ try {
+ throw "fisk";
+ }
+ on core::String catch(final core::String e, final core::StackTrace s) {
+ core::print(e);
+ if(!s.==(null))
+ core::print(s);
+ }
+ for (; false; ) {
+ }
+ dynamic list = <dynamic>["Hello, World!"];
+ core::print(list.[](i));
+ list.[]=(i, "Hello, Brave New World!");
+ core::print(list.[](i));
+ i = 87;
+ core::print(i.unary-());
+ core::print(i.~());
+ core::print(!i.==(42));
+ core::print(i = i.-(1));
+ core::print(i = i.+(1));
+ core::print(let final dynamic #t1 = i in let final dynamic #t2 = i = #t1.-(1) in #t1);
+ core::print(let final dynamic #t3 = i in let final dynamic #t4 = i = #t3.+(1) in #t3);
+ core::print(new core::Object::•());
+ core::print(const core::Object::•());
+ core::print(core::List::•<core::String>(2).runtimeType);
+ self::foo(fisk: "Blorp gulp");
+ function f() → dynamic {
+ core::print("f was called");
+ }
+ self::caller(f);
+ self::caller(() → dynamic {
+ core::print("<anon> was called");
+ });
+ function g([dynamic message = null]) → dynamic {
+ core::print(message);
+ }
+ g.call("Hello, World");
+ self::caller(([dynamic x = null]) → dynamic {
+ core::print("<anon> was called with ${x}");
+ });
+ function h({dynamic message = null}) → dynamic {
+ core::print(message);
+ }
+ h.call(message: "Hello, World");
+ self::caller(({dynamic x = null}) → dynamic {
+ core::print("<anon> was called with ${x}");
+ });
+ core::print(core::int.toString());
+ core::print(core::int);
+ core::print(let final dynamic #t5 = core::int in let final dynamic #t6 = #t5.toString() in #t5);
+ try {
+ core::print(throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#int.toString, 32, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))));
+ throw "Shouldn't work";
+ }
+ on core::NoSuchMethodError catch(final core::NoSuchMethodError e) {
+ core::print("As expected: ${e}");
+ }
+ core::print(core::int::parse("42"));
+}
diff --git a/pkg/front_end/testcases/expressions.dart.strong.transformed.expect b/pkg/front_end/testcases/expressions.dart.strong.transformed.expect
new file mode 100644
index 0000000..c122e52
--- /dev/null
+++ b/pkg/front_end/testcases/expressions.dart.strong.transformed.expect
@@ -0,0 +1,82 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/expressions.dart:74:16: Error: Method not found: 'int.toString'.
+ print(int?.toString());
+ ^^^^^^^^"]/* from null */;
+static method foo({dynamic fisk = null}) → dynamic {
+ core::print(fisk);
+}
+static method caller(dynamic f) → dynamic {
+ f.call();
+}
+static method main() → dynamic {
+ core::int i = 0;
+ core::print(i.{core::num::==}(1) ?{core::String} "bad" : "good");
+ core::print("${i}");
+ core::print("'${i}'");
+ core::print(" '${i}' ");
+ core::print(" '${i}' '${i}'");
+ core::print(" '${i}' '${i}'");
+ core::print("foobar");
+ core::print(" '${i}' '${i}' '${i}' '${i}'");
+ try {
+ throw "fisk";
+ }
+ on core::String catch(final core::String e, final core::StackTrace s) {
+ core::print(e);
+ if(!s.{core::Object::==}(null))
+ core::print(s);
+ }
+ for (; false; ) {
+ }
+ core::List<core::String> list = <core::String>["Hello, World!"];
+ core::print(list.{core::List::[]}(i));
+ list.{core::List::[]=}(i, "Hello, Brave New World!");
+ core::print(list.{core::List::[]}(i));
+ i = 87;
+ core::print(i.{core::int::unary-}());
+ core::print(i.{core::int::~}());
+ core::print(!i.{core::num::==}(42));
+ core::print(i = i.{core::num::-}(1));
+ core::print(i = i.{core::num::+}(1));
+ core::print(let final core::int #t1 = i in let final core::int #t2 = i = #t1.{core::num::-}(1) in #t1);
+ core::print(let final core::int #t3 = i in let final core::int #t4 = i = #t3.{core::num::+}(1) in #t3);
+ core::print(new core::Object::•());
+ core::print(const core::Object::•());
+ core::print(core::List::•<core::String>(2).{core::Object::runtimeType});
+ self::foo(fisk: "Blorp gulp");
+ function f() → core::Null {
+ core::print("f was called");
+ }
+ self::caller(f);
+ self::caller(() → core::Null {
+ core::print("<anon> was called");
+ });
+ function g([dynamic message = null]) → core::Null {
+ core::print(message);
+ }
+ g.call("Hello, World");
+ self::caller(([dynamic x = null]) → core::Null {
+ core::print("<anon> was called with ${x}");
+ });
+ function h({dynamic message = null}) → core::Null {
+ core::print(message);
+ }
+ h.call(message: "Hello, World");
+ self::caller(({dynamic x = null}) → core::Null {
+ core::print("<anon> was called with ${x}");
+ });
+ core::print(core::int.{core::Object::toString}());
+ core::print(core::int);
+ core::print(let final core::Type #t5 = core::int in let final core::String #t6 = #t5.{core::Object::toString}() in #t5);
+ try {
+ core::print(throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#int.toString, 32, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))));
+ throw "Shouldn't work";
+ }
+ on core::NoSuchMethodError catch(final core::NoSuchMethodError e) {
+ core::print("As expected: ${e}");
+ }
+ core::print(core::int::parse("42"));
+}
diff --git a/pkg/front_end/testcases/external.dart.direct.transformed.expect b/pkg/front_end/testcases/external.dart.direct.transformed.expect
new file mode 100644
index 0000000..273c277
--- /dev/null
+++ b/pkg/front_end/testcases/external.dart.direct.transformed.expect
@@ -0,0 +1,16 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "dart:isolate" as iso;
+
+static field dynamic subscription;
+static method onData(dynamic x) → void {
+ core::print(x);
+ self::subscription.cancel();
+}
+static method main() → dynamic {
+ dynamic string = core::String::fromCharCode(65);
+ dynamic port = iso::ReceivePort::•();
+ self::subscription = port.listen(self::onData);
+ port.sendPort.send(string);
+}
diff --git a/pkg/front_end/testcases/external_import.dart.direct.transformed.expect b/pkg/front_end/testcases/external_import.dart.direct.transformed.expect
new file mode 100644
index 0000000..145e77a
--- /dev/null
+++ b/pkg/front_end/testcases/external_import.dart.direct.transformed.expect
@@ -0,0 +1,7 @@
+@dart._internal::ExternalName::•("org-dartlang-testcase:///here")
+@dart._internal::ExternalName::•("org-dartlang-testcase:///there")
+@dart._internal::ExternalName::•("file:///usr/local/somewhere")
+library;
+import self as self;
+
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/external_import.dart.strong.transformed.expect b/pkg/front_end/testcases/external_import.dart.strong.transformed.expect
new file mode 100644
index 0000000..145e77a
--- /dev/null
+++ b/pkg/front_end/testcases/external_import.dart.strong.transformed.expect
@@ -0,0 +1,7 @@
+@dart._internal::ExternalName::•("org-dartlang-testcase:///here")
+@dart._internal::ExternalName::•("org-dartlang-testcase:///there")
+@dart._internal::ExternalName::•("file:///usr/local/somewhere")
+library;
+import self as self;
+
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/fibonacci.dart.direct.transformed.expect b/pkg/front_end/testcases/fibonacci.dart.direct.transformed.expect
new file mode 100644
index 0000000..c46429a
--- /dev/null
+++ b/pkg/front_end/testcases/fibonacci.dart.direct.transformed.expect
@@ -0,0 +1,14 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+static method fibonacci(core::int n) → core::int {
+ if(n.<(2))
+ return n;
+ return self::fibonacci(n.-(1)).+(self::fibonacci(n.-(2)));
+}
+static method main() → dynamic {
+ for (core::int i = 0; i.<(20); i = i.+(1)) {
+ core::print(self::fibonacci(i));
+ }
+}
diff --git a/pkg/front_end/testcases/for_in_scope.dart.direct.transformed.expect b/pkg/front_end/testcases/for_in_scope.dart.direct.transformed.expect
new file mode 100644
index 0000000..624010c
--- /dev/null
+++ b/pkg/front_end/testcases/for_in_scope.dart.direct.transformed.expect
@@ -0,0 +1,9 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+static method main(core::List<core::String> arguments) → dynamic {
+ for (core::String arguments in arguments) {
+ core::print(arguments);
+ }
+}
diff --git a/pkg/front_end/testcases/function_in_field.dart.direct.transformed.expect b/pkg/front_end/testcases/function_in_field.dart.direct.transformed.expect
new file mode 100644
index 0000000..f5a4253
--- /dev/null
+++ b/pkg/front_end/testcases/function_in_field.dart.direct.transformed.expect
@@ -0,0 +1,11 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+static field dynamic x = () → dynamic {
+ dynamic y = 42;
+ return y;
+};
+static method main() → dynamic {
+ core::print(self::x.call());
+}
diff --git a/pkg/front_end/testcases/function_type_is_check.dart.direct.transformed.expect b/pkg/front_end/testcases/function_type_is_check.dart.direct.transformed.expect
new file mode 100644
index 0000000..47e3281
--- /dev/null
+++ b/pkg/front_end/testcases/function_type_is_check.dart.direct.transformed.expect
@@ -0,0 +1,16 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "package:expect/expect.dart" as exp;
+
+static method test(dynamic f) → dynamic {
+ if(f is (core::Object, core::StackTrace) → void)
+ return 1;
+ if(f is (core::Object) → void)
+ return 10;
+ if(f is () → void)
+ return 100;
+}
+static method main() → dynamic {
+ exp::Expect::equals(111, self::test(() → dynamic => null).+(self::test((core::Object o) → dynamic => null)).+(self::test((core::Object o, core::StackTrace t) → dynamic => null)));
+}
diff --git a/pkg/front_end/testcases/function_type_is_check.dart.strong.transformed.expect b/pkg/front_end/testcases/function_type_is_check.dart.strong.transformed.expect
new file mode 100644
index 0000000..f827885
--- /dev/null
+++ b/pkg/front_end/testcases/function_type_is_check.dart.strong.transformed.expect
@@ -0,0 +1,16 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "package:expect/expect.dart" as exp;
+
+static method test(dynamic f) → dynamic {
+ if(f is (core::Object, core::StackTrace) → void)
+ return 1;
+ if(f is (core::Object) → void)
+ return 10;
+ if(f is () → void)
+ return 100;
+}
+static method main() → dynamic {
+ exp::Expect::equals(111, self::test(() → core::Null => null).+(self::test((core::Object o) → core::Null => null)).+(self::test((core::Object o, core::StackTrace t) → core::Null => null)));
+}
diff --git a/pkg/front_end/testcases/functions.dart.direct.transformed.expect b/pkg/front_end/testcases/functions.dart.direct.transformed.expect
new file mode 100644
index 0000000..a816760
--- /dev/null
+++ b/pkg/front_end/testcases/functions.dart.direct.transformed.expect
@@ -0,0 +1,13 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+static method main() → dynamic {
+ function local(({a: dynamic}) → void f) → void {
+ f.call(a: "Hello, World");
+ f.call();
+ }
+ local.call(({dynamic a = "Default greeting!"}) → dynamic {
+ core::print(a);
+ });
+}
diff --git a/pkg/front_end/testcases/future_or_test.dart.direct.transformed.expect b/pkg/front_end/testcases/future_or_test.dart.direct.transformed.expect
new file mode 100644
index 0000000..dbae521
--- /dev/null
+++ b/pkg/front_end/testcases/future_or_test.dart.direct.transformed.expect
@@ -0,0 +1,79 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "dart:async" as asy;
+
+class A extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method foo() → dynamic
+ return null;
+}
+class B extends core::Object {
+ field self::A a = null;
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method bar() → asy::Future<dynamic> /* originally async */ {
+ final asy::Completer<dynamic> :completer = asy::Completer::sync<dynamic>();
+ asy::FutureOr<dynamic> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L1:
+ {
+ :return_value = this.{self::B::a}.foo();
+ break #L1;
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+ }
+}
+class C extends core::Object {
+ field self::B b = new self::B::•();
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method baz() → asy::Future<core::int> /* originally async */ {
+ final asy::Completer<core::int> :completer = asy::Completer::sync<core::int>();
+ asy::FutureOr<core::int> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L2:
+ {
+ :return_value = this.{self::C::b}.bar();
+ break #L2;
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+ }
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/future_or_test.dart.strong.transformed.expect b/pkg/front_end/testcases/future_or_test.dart.strong.transformed.expect
new file mode 100644
index 0000000..b18f9fb
--- /dev/null
+++ b/pkg/front_end/testcases/future_or_test.dart.strong.transformed.expect
@@ -0,0 +1,79 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "dart:async" as asy;
+
+class A extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method foo() → dynamic
+ return null;
+}
+class B extends core::Object {
+ field self::A a = null;
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method bar() → asy::Future<dynamic> /* originally async */ {
+ final asy::Completer<dynamic> :completer = asy::Completer::sync<dynamic>();
+ asy::FutureOr<dynamic> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L1:
+ {
+ :return_value = this.{self::B::a}.{self::A::foo}();
+ break #L1;
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+ }
+}
+class C extends core::Object {
+ field self::B b = new self::B::•();
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method baz() → asy::Future<core::int> /* originally async */ {
+ final asy::Completer<core::int> :completer = asy::Completer::sync<core::int>();
+ asy::FutureOr<core::int> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L2:
+ {
+ :return_value = this.{self::C::b}.{self::B::bar}() as{TypeError} asy::FutureOr<core::int>;
+ break #L2;
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+ }
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/hello.dart.direct.transformed.expect b/pkg/front_end/testcases/hello.dart.direct.transformed.expect
new file mode 100644
index 0000000..fea7b39
--- /dev/null
+++ b/pkg/front_end/testcases/hello.dart.direct.transformed.expect
@@ -0,0 +1,7 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+static method main() → dynamic {
+ core::print("Hello, World!");
+}
diff --git a/pkg/front_end/testcases/illegal_named_function_expression.dart.direct.transformed.expect b/pkg/front_end/testcases/illegal_named_function_expression.dart.direct.transformed.expect
new file mode 100644
index 0000000..dc19dc1
--- /dev/null
+++ b/pkg/front_end/testcases/illegal_named_function_expression.dart.direct.transformed.expect
@@ -0,0 +1,18 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/illegal_named_function_expression.dart:6:11: Error: A function expression can't have a return type.
+ var x = void f<T>(T t) {};
+ ^^^^", "pkg/front_end/testcases/illegal_named_function_expression.dart:6:16: Error: A function expression can't have a name.
+ var x = void f<T>(T t) {};
+ ^", "pkg/front_end/testcases/illegal_named_function_expression.dart:8:9: Error: A function expression can't have a return type.
+ print(void g<T>(T t) {});
+ ^^^^", "pkg/front_end/testcases/illegal_named_function_expression.dart:8:14: Error: A function expression can't have a name.
+ print(void g<T>(T t) {});
+ ^"]/* from null */;
+static method main() → dynamic {
+ dynamic x = let final <T extends core::Object>(T) → void f = <T extends core::Object>(T t) → dynamic {} in f;
+ core::print(x.runtimeType);
+ core::print(let final <T extends core::Object>(T) → void g = <T extends core::Object>(T t) → dynamic {} in g);
+}
diff --git a/pkg/front_end/testcases/illegal_named_function_expression.dart.strong.transformed.expect b/pkg/front_end/testcases/illegal_named_function_expression.dart.strong.transformed.expect
new file mode 100644
index 0000000..f1c5274
--- /dev/null
+++ b/pkg/front_end/testcases/illegal_named_function_expression.dart.strong.transformed.expect
@@ -0,0 +1,18 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/illegal_named_function_expression.dart:6:11: Error: A function expression can't have a return type.
+ var x = void f<T>(T t) {};
+ ^^^^", "pkg/front_end/testcases/illegal_named_function_expression.dart:6:16: Error: A function expression can't have a name.
+ var x = void f<T>(T t) {};
+ ^", "pkg/front_end/testcases/illegal_named_function_expression.dart:8:9: Error: A function expression can't have a return type.
+ print(void g<T>(T t) {});
+ ^^^^", "pkg/front_end/testcases/illegal_named_function_expression.dart:8:14: Error: A function expression can't have a name.
+ print(void g<T>(T t) {});
+ ^"]/* from null */;
+static method main() → dynamic {
+ <T extends core::Object>(T) → core::Null x = let final <T extends core::Object>(T) → core::Null f = <T extends core::Object>(T t) → core::Null {} in f;
+ core::print(x.{core::Object::runtimeType});
+ core::print(let final <T extends core::Object>(T) → core::Null g = <T extends core::Object>(T t) → core::Null {} in g);
+}
diff --git a/pkg/front_end/testcases/illegal_named_function_expression_scope.dart.direct.transformed.expect b/pkg/front_end/testcases/illegal_named_function_expression_scope.dart.direct.transformed.expect
new file mode 100644
index 0000000..0bff178
--- /dev/null
+++ b/pkg/front_end/testcases/illegal_named_function_expression_scope.dart.direct.transformed.expect
@@ -0,0 +1,13 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/illegal_named_function_expression_scope.dart:7:9: Error: A function expression can't have a return type.
+ print(void f() {});
+ ^^^^", "pkg/front_end/testcases/illegal_named_function_expression_scope.dart:7:14: Error: A function expression can't have a name.
+ print(void f() {});
+ ^"]/* from null */;
+static method main() → dynamic {
+ function f() → void {}
+ core::print(let final () → void f = () → dynamic {} in f);
+}
diff --git a/pkg/front_end/testcases/illegal_named_function_expression_scope.dart.strong.transformed.expect b/pkg/front_end/testcases/illegal_named_function_expression_scope.dart.strong.transformed.expect
new file mode 100644
index 0000000..9c4d9bd
--- /dev/null
+++ b/pkg/front_end/testcases/illegal_named_function_expression_scope.dart.strong.transformed.expect
@@ -0,0 +1,13 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/illegal_named_function_expression_scope.dart:7:9: Error: A function expression can't have a return type.
+ print(void f() {});
+ ^^^^", "pkg/front_end/testcases/illegal_named_function_expression_scope.dart:7:14: Error: A function expression can't have a name.
+ print(void f() {});
+ ^"]/* from null */;
+static method main() → dynamic {
+ function f() → void {}
+ core::print(let final () → core::Null f = () → core::Null {} in f);
+}
diff --git a/pkg/front_end/testcases/implicit_new.dart.direct.transformed.expect b/pkg/front_end/testcases/implicit_new.dart.direct.transformed.expect
new file mode 100644
index 0000000..4262af7
--- /dev/null
+++ b/pkg/front_end/testcases/implicit_new.dart.direct.transformed.expect
@@ -0,0 +1,59 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class Foo extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ operator +(dynamic other) → dynamic
+ return null;
+}
+class Bar extends core::Object {
+ constructor named() → void
+ : super core::Object::•()
+ ;
+ operator +(dynamic other) → dynamic
+ return null;
+}
+class IndexTester extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ operator [](dynamic _) → dynamic
+ return null;
+ operator []=(dynamic _a, dynamic _b) → void {}
+}
+static method testNSM() → dynamic {
+ dynamic y = throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#Bar, 32, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{})));
+ throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#Bar, 32, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{})));
+}
+static method f(dynamic x) → dynamic
+ return x;
+static method main() → dynamic {
+ dynamic x = new self::Foo::•();
+ x = new self::Foo::•();
+ dynamic z = new self::Bar::named();
+ z = new self::Bar::named();
+ self::f(new self::Foo::•());
+ self::f(new self::Foo::•());
+ self::f(new self::Bar::named());
+ self::f(new self::Bar::named());
+ dynamic l = <dynamic>[new self::Foo::•(), new self::Bar::named()];
+ l = <dynamic>[new self::Foo::•(), new self::Bar::named()];
+ dynamic m = <dynamic, dynamic>{"foo": new self::Foo::•(), "bar": new self::Bar::named()};
+ m = <dynamic, dynamic>{"foo": new self::Foo::•(), "bar": new self::Bar::named()};
+ dynamic i = new self::IndexTester::•();
+ i.[](new self::Foo::•());
+ i.[](new self::Foo::•());
+ i.[](new self::Bar::named());
+ i.[](new self::Bar::named());
+ i.[]=(new self::Foo::•(), null);
+ i.[]=(new self::Foo::•(), null);
+ i.[]=(new self::Bar::named(), null);
+ i.[]=(new self::Bar::named(), null);
+ new self::Foo::•().+(new self::Bar::named());
+ new self::Foo::•().+(new self::Bar::named());
+ new self::Bar::named().+(new self::Foo::•());
+ new self::Bar::named().+(new self::Foo::•());
+}
diff --git a/pkg/front_end/testcases/implicit_new.dart.strong.transformed.expect b/pkg/front_end/testcases/implicit_new.dart.strong.transformed.expect
new file mode 100644
index 0000000..d959e33
--- /dev/null
+++ b/pkg/front_end/testcases/implicit_new.dart.strong.transformed.expect
@@ -0,0 +1,64 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class Foo extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ operator +(dynamic other) → dynamic
+ return null;
+}
+class Bar extends core::Object {
+ constructor named() → void
+ : super core::Object::•()
+ ;
+ operator +(dynamic other) → dynamic
+ return null;
+}
+class IndexTester extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ operator [](dynamic _) → dynamic
+ return null;
+ operator []=(dynamic _a, dynamic _b) → void {}
+}
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/implicit_new.dart:18:18: Error: Method not found: 'Bar'.
+ var y = prefix.Bar();
+ ^^^", "pkg/front_end/testcases/implicit_new.dart:19:10: Error: Method not found: 'Bar'.
+ prefix.Bar();
+ ^^^"]/* from null */;
+static method testNSM() → dynamic {
+ dynamic y = throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#Bar, 32, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{})));
+ throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#Bar, 32, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{})));
+}
+static method f(dynamic x) → dynamic
+ return x;
+static method main() → dynamic {
+ self::Foo x = new self::Foo::•();
+ x = new self::Foo::•();
+ self::Bar z = new self::Bar::named();
+ z = new self::Bar::named();
+ self::f(new self::Foo::•());
+ self::f(new self::Foo::•());
+ self::f(new self::Bar::named());
+ self::f(new self::Bar::named());
+ core::List<core::Object> l = <core::Object>[new self::Foo::•(), new self::Bar::named()];
+ l = <core::Object>[new self::Foo::•(), new self::Bar::named()];
+ core::Map<core::String, core::Object> m = <core::String, core::Object>{"foo": new self::Foo::•(), "bar": new self::Bar::named()};
+ m = <core::String, core::Object>{"foo": new self::Foo::•(), "bar": new self::Bar::named()};
+ self::IndexTester i = new self::IndexTester::•();
+ i.{self::IndexTester::[]}(new self::Foo::•());
+ i.{self::IndexTester::[]}(new self::Foo::•());
+ i.{self::IndexTester::[]}(new self::Bar::named());
+ i.{self::IndexTester::[]}(new self::Bar::named());
+ i.{self::IndexTester::[]=}(new self::Foo::•(), null);
+ i.{self::IndexTester::[]=}(new self::Foo::•(), null);
+ i.{self::IndexTester::[]=}(new self::Bar::named(), null);
+ i.{self::IndexTester::[]=}(new self::Bar::named(), null);
+ new self::Foo::•().{self::Foo::+}(new self::Bar::named());
+ new self::Foo::•().{self::Foo::+}(new self::Bar::named());
+ new self::Bar::named().{self::Bar::+}(new self::Foo::•());
+ new self::Bar::named().{self::Bar::+}(new self::Foo::•());
+}
diff --git a/pkg/front_end/testcases/implicit_scope_test.dart.direct.transformed.expect b/pkg/front_end/testcases/implicit_scope_test.dart.direct.transformed.expect
new file mode 100644
index 0000000..ef5e29a
--- /dev/null
+++ b/pkg/front_end/testcases/implicit_scope_test.dart.direct.transformed.expect
@@ -0,0 +1,47 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "package:expect/expect.dart" as exp;
+
+class ImplicitScopeTest extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ static method alwaysTrue() → core::bool {
+ return 1.+(1).==(2);
+ }
+ static method testMain() → dynamic {
+ dynamic a = "foo";
+ dynamic b;
+ if(self::ImplicitScopeTest::alwaysTrue()) {
+ dynamic a = "bar";
+ }
+ else {
+ dynamic b = a;
+ }
+ exp::Expect::equals("foo", a);
+ exp::Expect::equals(null, b);
+ while (!self::ImplicitScopeTest::alwaysTrue()) {
+ dynamic a = "bar";
+ dynamic b = "baz";
+ }
+ exp::Expect::equals("foo", a);
+ exp::Expect::equals(null, b);
+ for (core::int i = 0; i.<(10); i = i.+(1)) {
+ dynamic a = "bar";
+ dynamic b = "baz";
+ }
+ exp::Expect::equals("foo", a);
+ exp::Expect::equals(null, b);
+ do {
+ dynamic a = "bar";
+ dynamic b = "baz";
+ }
+ while ("black".==("white"))
+ exp::Expect::equals("foo", a);
+ exp::Expect::equals(null, b);
+ }
+}
+static method main() → dynamic {
+ self::ImplicitScopeTest::testMain();
+}
diff --git a/pkg/front_end/testcases/implicit_scope_test.dart.strong.transformed.expect b/pkg/front_end/testcases/implicit_scope_test.dart.strong.transformed.expect
new file mode 100644
index 0000000..9ac1d76
--- /dev/null
+++ b/pkg/front_end/testcases/implicit_scope_test.dart.strong.transformed.expect
@@ -0,0 +1,47 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "package:expect/expect.dart" as exp;
+
+class ImplicitScopeTest extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ static method alwaysTrue() → core::bool {
+ return 1.{core::num::+}(1).{core::num::==}(2);
+ }
+ static method testMain() → dynamic {
+ core::String a = "foo";
+ dynamic b;
+ if(self::ImplicitScopeTest::alwaysTrue()) {
+ dynamic a = "bar";
+ }
+ else {
+ dynamic b = a;
+ }
+ exp::Expect::equals("foo", a);
+ exp::Expect::equals(null, b);
+ while (!self::ImplicitScopeTest::alwaysTrue()) {
+ dynamic a = "bar";
+ dynamic b = "baz";
+ }
+ exp::Expect::equals("foo", a);
+ exp::Expect::equals(null, b);
+ for (core::int i = 0; i.{core::num::<}(10); i = i.{core::num::+}(1)) {
+ dynamic a = "bar";
+ dynamic b = "baz";
+ }
+ exp::Expect::equals("foo", a);
+ exp::Expect::equals(null, b);
+ do {
+ dynamic a = "bar";
+ dynamic b = "baz";
+ }
+ while ("black".{core::String::==}("white"))
+ exp::Expect::equals("foo", a);
+ exp::Expect::equals(null, b);
+ }
+}
+static method main() → dynamic {
+ self::ImplicitScopeTest::testMain();
+}
diff --git a/pkg/front_end/testcases/implicit_this.dart.direct.transformed.expect b/pkg/front_end/testcases/implicit_this.dart.direct.transformed.expect
new file mode 100644
index 0000000..a599fbe
--- /dev/null
+++ b/pkg/front_end/testcases/implicit_this.dart.direct.transformed.expect
@@ -0,0 +1,27 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class C extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method m() → dynamic {
+ core::print("Called m");
+ }
+ method testC() → dynamic {
+ this.{self::C::m}();
+ }
+}
+class D extends self::C {
+ synthetic constructor •() → void
+ : super self::C::•()
+ ;
+ method testD() → dynamic {
+ this.{self::C::m}();
+ }
+}
+static method main() → dynamic {
+ new self::C::•().testC();
+ new self::D::•().testD();
+}
diff --git a/pkg/front_end/testcases/inference/abstract_class_instantiation.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/abstract_class_instantiation.dart.direct.transformed.expect
new file mode 100644
index 0000000..3cd8d21
--- /dev/null
+++ b/pkg/front_end/testcases/inference/abstract_class_instantiation.dart.direct.transformed.expect
@@ -0,0 +1,20 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+abstract class C extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+abstract class D<T extends core::Object> extends core::Object {
+ constructor •(self::D::T t) → void
+ : super core::Object::•()
+ ;
+}
+static method test() → void {
+ dynamic x = throw new core::AbstractClassInstantiationError::•("C");
+ dynamic y = let final dynamic #t1 = 1 in throw new core::AbstractClassInstantiationError::•("D");
+ self::D<core::List<core::int>> z = let final dynamic #t2 = <dynamic>[] in throw new core::AbstractClassInstantiationError::•("D");
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/assert.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/assert.dart.direct.transformed.expect
new file mode 100644
index 0000000..e5a1b8f
--- /dev/null
+++ b/pkg/front_end/testcases/inference/assert.dart.direct.transformed.expect
@@ -0,0 +1,11 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+static method f<T extends core::Object>() → self::f::T
+ return null;
+static method test() → void {
+ assert(self::f<dynamic>());
+ assert(self::f<dynamic>(), self::f<dynamic>());
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/assert.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/assert.dart.strong.transformed.expect
new file mode 100644
index 0000000..004b776
--- /dev/null
+++ b/pkg/front_end/testcases/inference/assert.dart.strong.transformed.expect
@@ -0,0 +1,11 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+static method f<T extends core::Object>() → self::f::T
+ return null;
+static method test() → void {
+ assert(self::f<core::bool>());
+ assert(self::f<core::bool>(), self::f<dynamic>());
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/assert_initializer.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/assert_initializer.dart.direct.transformed.expect
new file mode 100644
index 0000000..602da12
--- /dev/null
+++ b/pkg/front_end/testcases/inference/assert_initializer.dart.direct.transformed.expect
@@ -0,0 +1,18 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class C extends core::Object {
+ constructor expressionOnly() → void
+ : assert(self::f<dynamic>()), super core::Object::•()
+ ;
+ constructor expressionAndMessage() → void
+ : assert(self::f<dynamic>(), self::f<dynamic>()), super core::Object::•()
+ ;
+}
+static method f<T extends core::Object>() → self::f::T
+ return null;
+static method main() → dynamic {
+ assert(self::f<dynamic>());
+ assert(self::f<dynamic>(), self::f<dynamic>());
+}
diff --git a/pkg/front_end/testcases/inference/assert_initializer.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/assert_initializer.dart.strong.transformed.expect
new file mode 100644
index 0000000..27f0c32
--- /dev/null
+++ b/pkg/front_end/testcases/inference/assert_initializer.dart.strong.transformed.expect
@@ -0,0 +1,18 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class C extends core::Object {
+ constructor expressionOnly() → void
+ : assert(self::f<core::bool>()), super core::Object::•()
+ ;
+ constructor expressionAndMessage() → void
+ : assert(self::f<core::bool>(), self::f<dynamic>()), super core::Object::•()
+ ;
+}
+static method f<T extends core::Object>() → self::f::T
+ return null;
+static method main() → dynamic {
+ assert(self::f<core::bool>());
+ assert(self::f<core::bool>(), self::f<dynamic>());
+}
diff --git a/pkg/front_end/testcases/inference/assign_local.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/assign_local.dart.direct.transformed.expect
new file mode 100644
index 0000000..92719ee
--- /dev/null
+++ b/pkg/front_end/testcases/inference/assign_local.dart.direct.transformed.expect
@@ -0,0 +1,22 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class A<T extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class B<T extends core::Object> extends self::A<self::B::T> {
+ synthetic constructor •() → void
+ : super self::A::•()
+ ;
+}
+static method main() → dynamic {
+ core::num x;
+ dynamic x1 = x = 1;
+ dynamic x2 = x = 1.0;
+ self::A<core::int> y;
+ dynamic y1 = y = new self::A::•<dynamic>();
+ dynamic y2 = y = new self::B::•<dynamic>();
+}
diff --git a/pkg/front_end/testcases/inference/assign_local.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/assign_local.dart.strong.transformed.expect
new file mode 100644
index 0000000..e8e11fe
--- /dev/null
+++ b/pkg/front_end/testcases/inference/assign_local.dart.strong.transformed.expect
@@ -0,0 +1,22 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class A<T extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class B<T extends core::Object> extends self::A<self::B::T> {
+ synthetic constructor •() → void
+ : super self::A::•()
+ ;
+}
+static method main() → dynamic {
+ core::num x;
+ core::int x1 = x = 1;
+ core::double x2 = x = 1.0;
+ self::A<core::int> y;
+ self::A<core::int> y1 = y = new self::A::•<core::int>();
+ self::B<core::int> y2 = y = new self::B::•<core::int>();
+}
diff --git a/pkg/front_end/testcases/inference/async_await.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/async_await.dart.direct.transformed.expect
new file mode 100644
index 0000000..40299a9
--- /dev/null
+++ b/pkg/front_end/testcases/inference/async_await.dart.direct.transformed.expect
@@ -0,0 +1,337 @@
+library test;
+import self as self;
+import "dart:core" as core;
+import "dart:async" as asy;
+
+abstract class MyFuture extends core::Object implements asy::Future<core::int> {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static method test() → void /* originally async */ {
+ final asy::Completer<dynamic> :completer = asy::Completer::sync<dynamic>();
+ asy::FutureOr<dynamic> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ dynamic :saved_try_context_var0;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L1:
+ {
+ core::int x0;
+ asy::Future<core::int> x1;
+ asy::Future<asy::Future<core::int>> x2;
+ asy::Future<asy::FutureOr<core::int>> x3;
+ asy::Future<self::MyFuture> x4;
+ asy::FutureOr<core::int> x5;
+ asy::FutureOr<asy::Future<core::int>> x6;
+ asy::FutureOr<asy::FutureOr<core::int>> x7;
+ asy::FutureOr<self::MyFuture> x8;
+ self::MyFuture x9;
+ function test0() → dynamic /* originally async */ {
+ final asy::Completer<dynamic> :completer = asy::Completer::sync<dynamic>();
+ asy::FutureOr<dynamic> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L2:
+ {
+ :return_value = x0;
+ break #L2;
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+ }
+ function test1() → dynamic /* originally async */ {
+ final asy::Completer<dynamic> :completer = asy::Completer::sync<dynamic>();
+ asy::FutureOr<dynamic> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L3:
+ {
+ :return_value = x1;
+ break #L3;
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+ }
+ function test2() → dynamic /* originally async */ {
+ final asy::Completer<dynamic> :completer = asy::Completer::sync<dynamic>();
+ asy::FutureOr<dynamic> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L4:
+ {
+ :return_value = x2;
+ break #L4;
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+ }
+ function test3() → dynamic /* originally async */ {
+ final asy::Completer<dynamic> :completer = asy::Completer::sync<dynamic>();
+ asy::FutureOr<dynamic> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L5:
+ {
+ :return_value = x3;
+ break #L5;
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+ }
+ function test4() → dynamic /* originally async */ {
+ final asy::Completer<dynamic> :completer = asy::Completer::sync<dynamic>();
+ asy::FutureOr<dynamic> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L6:
+ {
+ :return_value = x4;
+ break #L6;
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+ }
+ function test5() → dynamic /* originally async */ {
+ final asy::Completer<dynamic> :completer = asy::Completer::sync<dynamic>();
+ asy::FutureOr<dynamic> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L7:
+ {
+ :return_value = x5;
+ break #L7;
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+ }
+ function test6() → dynamic /* originally async */ {
+ final asy::Completer<dynamic> :completer = asy::Completer::sync<dynamic>();
+ asy::FutureOr<dynamic> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L8:
+ {
+ :return_value = x6;
+ break #L8;
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+ }
+ function test7() → dynamic /* originally async */ {
+ final asy::Completer<dynamic> :completer = asy::Completer::sync<dynamic>();
+ asy::FutureOr<dynamic> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L9:
+ {
+ :return_value = x7;
+ break #L9;
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+ }
+ function test8() → dynamic /* originally async */ {
+ final asy::Completer<dynamic> :completer = asy::Completer::sync<dynamic>();
+ asy::FutureOr<dynamic> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L10:
+ {
+ :return_value = x8;
+ break #L10;
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+ }
+ function test9() → dynamic /* originally async */ {
+ final asy::Completer<dynamic> :completer = asy::Completer::sync<dynamic>();
+ asy::FutureOr<dynamic> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L11:
+ {
+ :return_value = x9;
+ break #L11;
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+ }
+ [yield] let dynamic #t1 = asy::_awaitHelper(x0, :async_op_then, :async_op_error, :async_op) in null;
+ dynamic y0 = :result;
+ [yield] let dynamic #t2 = asy::_awaitHelper(x1, :async_op_then, :async_op_error, :async_op) in null;
+ dynamic y1 = :result;
+ [yield] let dynamic #t3 = asy::_awaitHelper(x2, :async_op_then, :async_op_error, :async_op) in null;
+ dynamic y2 = :result;
+ [yield] let dynamic #t4 = asy::_awaitHelper(x3, :async_op_then, :async_op_error, :async_op) in null;
+ dynamic y3 = :result;
+ [yield] let dynamic #t5 = asy::_awaitHelper(x4, :async_op_then, :async_op_error, :async_op) in null;
+ dynamic y4 = :result;
+ [yield] let dynamic #t6 = asy::_awaitHelper(x5, :async_op_then, :async_op_error, :async_op) in null;
+ dynamic y5 = :result;
+ [yield] let dynamic #t7 = asy::_awaitHelper(x6, :async_op_then, :async_op_error, :async_op) in null;
+ dynamic y6 = :result;
+ [yield] let dynamic #t8 = asy::_awaitHelper(x7, :async_op_then, :async_op_error, :async_op) in null;
+ dynamic y7 = :result;
+ [yield] let dynamic #t9 = asy::_awaitHelper(x8, :async_op_then, :async_op_error, :async_op) in null;
+ dynamic y8 = :result;
+ [yield] let dynamic #t10 = asy::_awaitHelper(x9, :async_op_then, :async_op_error, :async_op) in null;
+ dynamic y9 = :result;
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/async_await.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/async_await.dart.strong.transformed.expect
new file mode 100644
index 0000000..0c4ef21
--- /dev/null
+++ b/pkg/front_end/testcases/inference/async_await.dart.strong.transformed.expect
@@ -0,0 +1,338 @@
+library test;
+import self as self;
+import "dart:core" as core;
+import "dart:async" as asy;
+
+abstract class MyFuture extends core::Object implements asy::Future<core::int> {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ abstract forwarding-stub method timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<core::int> onTimeout}) → asy::Future<core::int>;
+}
+static method test() → void /* originally async */ {
+ final asy::Completer<dynamic> :completer = asy::Completer::sync<dynamic>();
+ asy::FutureOr<dynamic> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ dynamic :saved_try_context_var0;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L1:
+ {
+ core::int x0;
+ asy::Future<core::int> x1;
+ asy::Future<asy::Future<core::int>> x2;
+ asy::Future<asy::FutureOr<core::int>> x3;
+ asy::Future<self::MyFuture> x4;
+ asy::FutureOr<core::int> x5;
+ asy::FutureOr<asy::Future<core::int>> x6;
+ asy::FutureOr<asy::FutureOr<core::int>> x7;
+ asy::FutureOr<self::MyFuture> x8;
+ self::MyFuture x9;
+ function test0() → asy::Future<core::int> /* originally async */ {
+ final asy::Completer<core::int> :completer = asy::Completer::sync<core::int>();
+ asy::FutureOr<core::int> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L2:
+ {
+ :return_value = x0;
+ break #L2;
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+ }
+ function test1() → asy::Future<core::int> /* originally async */ {
+ final asy::Completer<core::int> :completer = asy::Completer::sync<core::int>();
+ asy::FutureOr<core::int> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L3:
+ {
+ :return_value = x1;
+ break #L3;
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+ }
+ function test2() → asy::Future<asy::Future<core::int>> /* originally async */ {
+ final asy::Completer<asy::Future<core::int>> :completer = asy::Completer::sync<asy::Future<core::int>>();
+ asy::FutureOr<asy::Future<core::int>> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L4:
+ {
+ :return_value = x2;
+ break #L4;
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+ }
+ function test3() → asy::Future<asy::FutureOr<core::int>> /* originally async */ {
+ final asy::Completer<asy::FutureOr<core::int>> :completer = asy::Completer::sync<asy::FutureOr<core::int>>();
+ asy::FutureOr<asy::FutureOr<core::int>> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L5:
+ {
+ :return_value = x3;
+ break #L5;
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+ }
+ function test4() → asy::Future<self::MyFuture> /* originally async */ {
+ final asy::Completer<self::MyFuture> :completer = asy::Completer::sync<self::MyFuture>();
+ asy::FutureOr<self::MyFuture> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L6:
+ {
+ :return_value = x4;
+ break #L6;
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+ }
+ function test5() → asy::Future<core::int> /* originally async */ {
+ final asy::Completer<core::int> :completer = asy::Completer::sync<core::int>();
+ asy::FutureOr<core::int> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L7:
+ {
+ :return_value = x5;
+ break #L7;
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+ }
+ function test6() → asy::Future<asy::Future<core::int>> /* originally async */ {
+ final asy::Completer<asy::Future<core::int>> :completer = asy::Completer::sync<asy::Future<core::int>>();
+ asy::FutureOr<asy::Future<core::int>> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L8:
+ {
+ :return_value = x6;
+ break #L8;
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+ }
+ function test7() → asy::Future<asy::FutureOr<core::int>> /* originally async */ {
+ final asy::Completer<asy::FutureOr<core::int>> :completer = asy::Completer::sync<asy::FutureOr<core::int>>();
+ asy::FutureOr<asy::FutureOr<core::int>> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L9:
+ {
+ :return_value = x7;
+ break #L9;
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+ }
+ function test8() → asy::Future<self::MyFuture> /* originally async */ {
+ final asy::Completer<self::MyFuture> :completer = asy::Completer::sync<self::MyFuture>();
+ asy::FutureOr<self::MyFuture> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L10:
+ {
+ :return_value = x8;
+ break #L10;
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+ }
+ function test9() → asy::Future<core::int> /* originally async */ {
+ final asy::Completer<core::int> :completer = asy::Completer::sync<core::int>();
+ asy::FutureOr<core::int> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L11:
+ {
+ :return_value = x9;
+ break #L11;
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+ }
+ [yield] let dynamic #t1 = asy::_awaitHelper(x0, :async_op_then, :async_op_error, :async_op) in null;
+ core::int y0 = :result;
+ [yield] let dynamic #t2 = asy::_awaitHelper(x1, :async_op_then, :async_op_error, :async_op) in null;
+ core::int y1 = :result;
+ [yield] let dynamic #t3 = asy::_awaitHelper(x2, :async_op_then, :async_op_error, :async_op) in null;
+ asy::Future<core::int> y2 = :result;
+ [yield] let dynamic #t4 = asy::_awaitHelper(x3, :async_op_then, :async_op_error, :async_op) in null;
+ asy::FutureOr<core::int> y3 = :result;
+ [yield] let dynamic #t5 = asy::_awaitHelper(x4, :async_op_then, :async_op_error, :async_op) in null;
+ self::MyFuture y4 = :result;
+ [yield] let dynamic #t6 = asy::_awaitHelper(x5, :async_op_then, :async_op_error, :async_op) in null;
+ core::int y5 = :result;
+ [yield] let dynamic #t7 = asy::_awaitHelper(x6, :async_op_then, :async_op_error, :async_op) in null;
+ asy::Future<core::int> y6 = :result;
+ [yield] let dynamic #t8 = asy::_awaitHelper(x7, :async_op_then, :async_op_error, :async_op) in null;
+ asy::FutureOr<core::int> y7 = :result;
+ [yield] let dynamic #t9 = asy::_awaitHelper(x8, :async_op_then, :async_op_error, :async_op) in null;
+ self::MyFuture y8 = :result;
+ [yield] let dynamic #t10 = asy::_awaitHelper(x9, :async_op_then, :async_op_error, :async_op) in null;
+ core::int y9 = :result;
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/async_closure_return_type_flatten.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/async_closure_return_type_flatten.dart.direct.transformed.expect
new file mode 100644
index 0000000..a111519
--- /dev/null
+++ b/pkg/front_end/testcases/inference/async_closure_return_type_flatten.dart.direct.transformed.expect
@@ -0,0 +1,38 @@
+library test;
+import self as self;
+import "dart:async" as asy;
+import "dart:core" as core;
+
+static field asy::Future<core::int> futureInt = null;
+static field dynamic f = () → dynamic => self::futureInt;
+static field dynamic g = () → asy::Future<dynamic> /* originally async */ {
+ final asy::Completer<dynamic> :completer = asy::Completer::sync<dynamic>();
+ asy::FutureOr<dynamic> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L1:
+ {
+ :return_value = self::futureInt;
+ break #L1;
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+};
+static method main() → dynamic {
+ self::f;
+ self::g;
+}
diff --git a/pkg/front_end/testcases/inference/async_closure_return_type_flatten.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/async_closure_return_type_flatten.dart.strong.transformed.expect
new file mode 100644
index 0000000..a6aca80
--- /dev/null
+++ b/pkg/front_end/testcases/inference/async_closure_return_type_flatten.dart.strong.transformed.expect
@@ -0,0 +1,38 @@
+library test;
+import self as self;
+import "dart:async" as asy;
+import "dart:core" as core;
+
+static field asy::Future<core::int> futureInt = null;
+static field () → asy::Future<core::int> f = () → asy::Future<core::int> => self::futureInt;
+static field () → asy::Future<core::int> g = () → asy::Future<core::int> /* originally async */ {
+ final asy::Completer<core::int> :completer = asy::Completer::sync<core::int>();
+ asy::FutureOr<core::int> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L1:
+ {
+ :return_value = self::futureInt;
+ break #L1;
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+};
+static method main() → dynamic {
+ self::f;
+ self::g;
+}
diff --git a/pkg/front_end/testcases/inference/async_closure_return_type_future.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/async_closure_return_type_future.dart.direct.transformed.expect
new file mode 100644
index 0000000..4bf2eb0
--- /dev/null
+++ b/pkg/front_end/testcases/inference/async_closure_return_type_future.dart.direct.transformed.expect
@@ -0,0 +1,34 @@
+library test;
+import self as self;
+import "dart:async" as asy;
+
+static field dynamic f = () → asy::Future<dynamic> /* originally async */ {
+ final asy::Completer<dynamic> :completer = asy::Completer::sync<dynamic>();
+ asy::FutureOr<dynamic> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L1:
+ {
+ :return_value = 0;
+ break #L1;
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+};
+static method main() → dynamic {
+ self::f;
+}
diff --git a/pkg/front_end/testcases/inference/async_closure_return_type_future.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/async_closure_return_type_future.dart.strong.transformed.expect
new file mode 100644
index 0000000..5af9546
--- /dev/null
+++ b/pkg/front_end/testcases/inference/async_closure_return_type_future.dart.strong.transformed.expect
@@ -0,0 +1,35 @@
+library test;
+import self as self;
+import "dart:async" as asy;
+import "dart:core" as core;
+
+static field () → asy::Future<core::int> f = () → asy::Future<core::int> /* originally async */ {
+ final asy::Completer<core::int> :completer = asy::Completer::sync<core::int>();
+ asy::FutureOr<core::int> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L1:
+ {
+ :return_value = 0;
+ break #L1;
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+};
+static method main() → dynamic {
+ self::f;
+}
diff --git a/pkg/front_end/testcases/inference/async_closure_return_type_future_or.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/async_closure_return_type_future_or.dart.direct.transformed.expect
new file mode 100644
index 0000000..7702de6
--- /dev/null
+++ b/pkg/front_end/testcases/inference/async_closure_return_type_future_or.dart.direct.transformed.expect
@@ -0,0 +1,38 @@
+library test;
+import self as self;
+import "dart:async" as asy;
+import "dart:core" as core;
+
+static field asy::FutureOr<core::int> futureOrInt = null;
+static field dynamic f = () → dynamic => self::futureOrInt;
+static field dynamic g = () → asy::Future<dynamic> /* originally async */ {
+ final asy::Completer<dynamic> :completer = asy::Completer::sync<dynamic>();
+ asy::FutureOr<dynamic> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L1:
+ {
+ :return_value = self::futureOrInt;
+ break #L1;
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+};
+static method main() → dynamic {
+ self::f;
+ self::g;
+}
diff --git a/pkg/front_end/testcases/inference/async_closure_return_type_future_or.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/async_closure_return_type_future_or.dart.strong.transformed.expect
new file mode 100644
index 0000000..f49a5d2
--- /dev/null
+++ b/pkg/front_end/testcases/inference/async_closure_return_type_future_or.dart.strong.transformed.expect
@@ -0,0 +1,38 @@
+library test;
+import self as self;
+import "dart:async" as asy;
+import "dart:core" as core;
+
+static field asy::FutureOr<core::int> futureOrInt = null;
+static field () → asy::FutureOr<core::int> f = () → asy::FutureOr<core::int> => self::futureOrInt;
+static field () → asy::Future<core::int> g = () → asy::Future<core::int> /* originally async */ {
+ final asy::Completer<core::int> :completer = asy::Completer::sync<core::int>();
+ asy::FutureOr<core::int> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L1:
+ {
+ :return_value = self::futureOrInt;
+ break #L1;
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+};
+static method main() → dynamic {
+ self::f;
+ self::g;
+}
diff --git a/pkg/front_end/testcases/inference/block_bodied_lambdas_async_all_returns_are_futures.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/block_bodied_lambdas_async_all_returns_are_futures.dart.direct.transformed.expect
new file mode 100644
index 0000000..ae1ed7a
--- /dev/null
+++ b/pkg/front_end/testcases/inference/block_bodied_lambdas_async_all_returns_are_futures.dart.direct.transformed.expect
@@ -0,0 +1,44 @@
+library test;
+import self as self;
+import "dart:async" as asy;
+import "dart:math" as math;
+import "dart:core" as core;
+
+static method test() → dynamic {
+ dynamic f = () → asy::Future<dynamic> /* originally async */ {
+ final asy::Completer<dynamic> :completer = asy::Completer::sync<dynamic>();
+ asy::FutureOr<dynamic> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L1:
+ {
+ if(math::Random::•().nextBool()) {
+ :return_value = asy::Future::value<core::int>(1);
+ break #L1;
+ }
+ else {
+ :return_value = asy::Future::value<core::double>(2.0);
+ break #L1;
+ }
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+ };
+ asy::Future<core::num> g = f.call();
+ asy::Future<core::int> h = f.call();
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/block_bodied_lambdas_async_all_returns_are_futures.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/block_bodied_lambdas_async_all_returns_are_futures.dart.strong.transformed.expect
new file mode 100644
index 0000000..649f426
--- /dev/null
+++ b/pkg/front_end/testcases/inference/block_bodied_lambdas_async_all_returns_are_futures.dart.strong.transformed.expect
@@ -0,0 +1,44 @@
+library test;
+import self as self;
+import "dart:async" as asy;
+import "dart:core" as core;
+import "dart:math" as math;
+
+static method test() → dynamic {
+ () → asy::Future<core::num> f = () → asy::Future<core::num> /* originally async */ {
+ final asy::Completer<core::num> :completer = asy::Completer::sync<core::num>();
+ asy::FutureOr<core::num> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L1:
+ {
+ if(math::Random::•().{math::Random::nextBool}()) {
+ :return_value = asy::Future::value<core::int>(1);
+ break #L1;
+ }
+ else {
+ :return_value = asy::Future::value<core::double>(2.0);
+ break #L1;
+ }
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+ };
+ asy::Future<core::num> g = f.call();
+ asy::Future<core::int> h = f.call() as{TypeError} asy::Future<core::int>;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/block_bodied_lambdas_async_all_returns_are_values.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/block_bodied_lambdas_async_all_returns_are_values.dart.direct.transformed.expect
new file mode 100644
index 0000000..93b15b0
--- /dev/null
+++ b/pkg/front_end/testcases/inference/block_bodied_lambdas_async_all_returns_are_values.dart.direct.transformed.expect
@@ -0,0 +1,44 @@
+library test;
+import self as self;
+import "dart:async" as asy;
+import "dart:math" as math;
+import "dart:core" as core;
+
+static method test() → dynamic {
+ dynamic f = () → asy::Future<dynamic> /* originally async */ {
+ final asy::Completer<dynamic> :completer = asy::Completer::sync<dynamic>();
+ asy::FutureOr<dynamic> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L1:
+ {
+ if(math::Random::•().nextBool()) {
+ :return_value = 1;
+ break #L1;
+ }
+ else {
+ :return_value = 2.0;
+ break #L1;
+ }
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+ };
+ asy::Future<core::num> g = f.call();
+ asy::Future<core::int> h = f.call();
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/block_bodied_lambdas_async_all_returns_are_values.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/block_bodied_lambdas_async_all_returns_are_values.dart.strong.transformed.expect
new file mode 100644
index 0000000..97e2f95
--- /dev/null
+++ b/pkg/front_end/testcases/inference/block_bodied_lambdas_async_all_returns_are_values.dart.strong.transformed.expect
@@ -0,0 +1,44 @@
+library test;
+import self as self;
+import "dart:async" as asy;
+import "dart:core" as core;
+import "dart:math" as math;
+
+static method test() → dynamic {
+ () → asy::Future<core::num> f = () → asy::Future<core::num> /* originally async */ {
+ final asy::Completer<core::num> :completer = asy::Completer::sync<core::num>();
+ asy::FutureOr<core::num> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L1:
+ {
+ if(math::Random::•().{math::Random::nextBool}()) {
+ :return_value = 1;
+ break #L1;
+ }
+ else {
+ :return_value = 2.0;
+ break #L1;
+ }
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+ };
+ asy::Future<core::num> g = f.call();
+ asy::Future<core::int> h = f.call() as{TypeError} asy::Future<core::int>;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/block_bodied_lambdas_async_mix_of_values_and_futures.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/block_bodied_lambdas_async_mix_of_values_and_futures.dart.direct.transformed.expect
new file mode 100644
index 0000000..8c968ee
--- /dev/null
+++ b/pkg/front_end/testcases/inference/block_bodied_lambdas_async_mix_of_values_and_futures.dart.direct.transformed.expect
@@ -0,0 +1,44 @@
+library test;
+import self as self;
+import "dart:async" as asy;
+import "dart:math" as math;
+import "dart:core" as core;
+
+static method test() → dynamic {
+ dynamic f = () → asy::Future<dynamic> /* originally async */ {
+ final asy::Completer<dynamic> :completer = asy::Completer::sync<dynamic>();
+ asy::FutureOr<dynamic> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L1:
+ {
+ if(math::Random::•().nextBool()) {
+ :return_value = asy::Future::value<core::int>(1);
+ break #L1;
+ }
+ else {
+ :return_value = 2.0;
+ break #L1;
+ }
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+ };
+ asy::Future<core::num> g = f.call();
+ asy::Future<core::int> h = f.call();
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/block_bodied_lambdas_async_mix_of_values_and_futures.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/block_bodied_lambdas_async_mix_of_values_and_futures.dart.strong.transformed.expect
new file mode 100644
index 0000000..45d5637
--- /dev/null
+++ b/pkg/front_end/testcases/inference/block_bodied_lambdas_async_mix_of_values_and_futures.dart.strong.transformed.expect
@@ -0,0 +1,44 @@
+library test;
+import self as self;
+import "dart:async" as asy;
+import "dart:core" as core;
+import "dart:math" as math;
+
+static method test() → dynamic {
+ () → asy::Future<core::num> f = () → asy::Future<core::num> /* originally async */ {
+ final asy::Completer<core::num> :completer = asy::Completer::sync<core::num>();
+ asy::FutureOr<core::num> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L1:
+ {
+ if(math::Random::•().{math::Random::nextBool}()) {
+ :return_value = asy::Future::value<core::int>(1);
+ break #L1;
+ }
+ else {
+ :return_value = 2.0;
+ break #L1;
+ }
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+ };
+ asy::Future<core::num> g = f.call();
+ asy::Future<core::int> h = f.call() as{TypeError} asy::Future<core::int>;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/block_bodied_lambdas_async_star.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/block_bodied_lambdas_async_star.dart.direct.transformed.expect
new file mode 100644
index 0000000..c8ab798
--- /dev/null
+++ b/pkg/front_end/testcases/inference/block_bodied_lambdas_async_star.dart.direct.transformed.expect
@@ -0,0 +1,48 @@
+library test;
+import self as self;
+import "dart:async" as asy;
+import "dart:core" as core;
+
+static method test() → dynamic {
+ dynamic f = () → asy::Stream<dynamic> /* originally async* */ {
+ asy::_AsyncStarStreamController<dynamic> :controller;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ dynamic :saved_try_context_var0;
+ dynamic :saved_try_context_var1;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try
+ try {
+ #L1:
+ {
+ if(:controller.{asy::_AsyncStarStreamController::add}(1))
+ return null;
+ else
+ [yield] null;
+ asy::Stream<core::double> s;
+ if(:controller.{asy::_AsyncStarStreamController::addStream}(s))
+ return null;
+ else
+ [yield] null;
+ }
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :controller.{asy::_AsyncStarStreamController::addError}(:exception, :stack_trace);
+ }
+ finally {
+ :controller.{asy::_AsyncStarStreamController::close}();
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ :controller = new asy::_AsyncStarStreamController::•<dynamic>(:async_op);
+ return :controller.{asy::_AsyncStarStreamController::stream};
+ };
+ asy::Stream<core::num> g = f.call();
+ asy::Stream<core::int> h = f.call();
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/block_bodied_lambdas_async_star.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/block_bodied_lambdas_async_star.dart.strong.transformed.expect
new file mode 100644
index 0000000..d13756d
--- /dev/null
+++ b/pkg/front_end/testcases/inference/block_bodied_lambdas_async_star.dart.strong.transformed.expect
@@ -0,0 +1,48 @@
+library test;
+import self as self;
+import "dart:async" as asy;
+import "dart:core" as core;
+
+static method test() → dynamic {
+ () → asy::Stream<core::num> f = () → asy::Stream<core::num> /* originally async* */ {
+ asy::_AsyncStarStreamController<core::num> :controller;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ dynamic :saved_try_context_var0;
+ dynamic :saved_try_context_var1;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try
+ try {
+ #L1:
+ {
+ if(:controller.{asy::_AsyncStarStreamController::add}(1))
+ return null;
+ else
+ [yield] null;
+ asy::Stream<core::double> s;
+ if(:controller.{asy::_AsyncStarStreamController::addStream}(s))
+ return null;
+ else
+ [yield] null;
+ }
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :controller.{asy::_AsyncStarStreamController::addError}(:exception, :stack_trace);
+ }
+ finally {
+ :controller.{asy::_AsyncStarStreamController::close}();
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ :controller = new asy::_AsyncStarStreamController::•<core::num>(:async_op);
+ return :controller.{asy::_AsyncStarStreamController::stream};
+ };
+ asy::Stream<core::num> g = f.call();
+ asy::Stream<core::int> h = f.call() as{TypeError} asy::Stream<core::int>;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/block_bodied_lambdas_basic.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/block_bodied_lambdas_basic.dart.direct.transformed.expect
new file mode 100644
index 0000000..aeecf2c
--- /dev/null
+++ b/pkg/front_end/testcases/inference/block_bodied_lambdas_basic.dart.direct.transformed.expect
@@ -0,0 +1,12 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+static method test1() → dynamic {
+ core::List<core::int> o;
+ dynamic y = o.map((dynamic x) → dynamic {
+ return x.+(1);
+ });
+ core::Iterable<core::int> z = y;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/block_bodied_lambdas_basic.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/block_bodied_lambdas_basic.dart.strong.transformed.expect
new file mode 100644
index 0000000..e5bcf8f
--- /dev/null
+++ b/pkg/front_end/testcases/inference/block_bodied_lambdas_basic.dart.strong.transformed.expect
@@ -0,0 +1,12 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+static method test1() → dynamic {
+ core::List<core::int> o;
+ core::Iterable<core::int> y = o.{core::Iterable::map}<core::int>((core::int x) → core::int {
+ return x.{core::num::+}(1);
+ });
+ core::Iterable<core::int> z = y;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/block_bodied_lambdas_basic_void.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/block_bodied_lambdas_basic_void.dart.direct.transformed.expect
new file mode 100644
index 0000000..6a30de0
--- /dev/null
+++ b/pkg/front_end/testcases/inference/block_bodied_lambdas_basic_void.dart.direct.transformed.expect
@@ -0,0 +1,11 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+static method f() → dynamic {
+ core::List<core::int> o;
+ o.where((dynamic i) → dynamic {
+ return i.==(0);
+ });
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/block_bodied_lambdas_basic_void.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/block_bodied_lambdas_basic_void.dart.strong.transformed.expect
new file mode 100644
index 0000000..86aa2ac
--- /dev/null
+++ b/pkg/front_end/testcases/inference/block_bodied_lambdas_basic_void.dart.strong.transformed.expect
@@ -0,0 +1,11 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+static method f() → dynamic {
+ core::List<core::int> o;
+ o.{core::Iterable::where}((core::int i) → core::bool {
+ return i.{core::num::==}(0);
+ });
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/block_bodied_lambdas_downwards_incompatible_with_upwards_inference.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/block_bodied_lambdas_downwards_incompatible_with_upwards_inference.dart.direct.transformed.expect
new file mode 100644
index 0000000..5c8ecc1
--- /dev/null
+++ b/pkg/front_end/testcases/inference/block_bodied_lambdas_downwards_incompatible_with_upwards_inference.dart.direct.transformed.expect
@@ -0,0 +1,12 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+static method main() → dynamic {
+ function f() → core::String
+ return null;
+ dynamic g = f;
+ g = () → dynamic {
+ return 1;
+ };
+}
diff --git a/pkg/front_end/testcases/inference/block_bodied_lambdas_downwards_incompatible_with_upwards_inference.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/block_bodied_lambdas_downwards_incompatible_with_upwards_inference.dart.strong.transformed.expect
new file mode 100644
index 0000000..33fd7df
--- /dev/null
+++ b/pkg/front_end/testcases/inference/block_bodied_lambdas_downwards_incompatible_with_upwards_inference.dart.strong.transformed.expect
@@ -0,0 +1,15 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+static method main() → dynamic {
+ function f() → core::String
+ return null;
+ () → core::String g = f;
+ g = () → core::String {
+ return let final core::int #t1 = 1 in let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/inference/block_bodied_lambdas_downwards_incompatible_with_upwards_inference.dart:12:45: Error: A value of type 'dart.core::int' can't be assigned to a variable of type 'dart.core::String'.
+Try changing the type of the left hand side, or casting the right hand side to 'dart.core::String'.
+ return /*error:RETURN_OF_INVALID_TYPE*/ 1;
+ ^";
+ };
+}
diff --git a/pkg/front_end/testcases/inference/block_bodied_lambdas_downwards_incompatible_with_upwards_inference_top_level.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/block_bodied_lambdas_downwards_incompatible_with_upwards_inference_top_level.dart.direct.transformed.expect
new file mode 100644
index 0000000..08eb46a
--- /dev/null
+++ b/pkg/front_end/testcases/inference/block_bodied_lambdas_downwards_incompatible_with_upwards_inference_top_level.dart.direct.transformed.expect
@@ -0,0 +1,10 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+static field dynamic g = self::f;
+static method f() → core::String
+ return null;
+static method main() → dynamic {
+ self::f;
+}
diff --git a/pkg/front_end/testcases/inference/block_bodied_lambdas_downwards_incompatible_with_upwards_inference_top_level.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/block_bodied_lambdas_downwards_incompatible_with_upwards_inference_top_level.dart.strong.transformed.expect
new file mode 100644
index 0000000..3860922
--- /dev/null
+++ b/pkg/front_end/testcases/inference/block_bodied_lambdas_downwards_incompatible_with_upwards_inference_top_level.dart.strong.transformed.expect
@@ -0,0 +1,10 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+static field () → core::String g = self::f;
+static method f() → core::String
+ return null;
+static method main() → dynamic {
+ self::f;
+}
diff --git a/pkg/front_end/testcases/inference/block_bodied_lambdas_infer_bottom_async.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/block_bodied_lambdas_infer_bottom_async.dart.direct.transformed.expect
new file mode 100644
index 0000000..04b9dad
--- /dev/null
+++ b/pkg/front_end/testcases/inference/block_bodied_lambdas_infer_bottom_async.dart.direct.transformed.expect
@@ -0,0 +1,62 @@
+library test;
+import self as self;
+import "dart:async" as asy;
+import "dart:core" as core;
+
+static method main() → dynamic /* originally async */ {
+ final asy::Completer<dynamic> :completer = asy::Completer::sync<dynamic>();
+ asy::FutureOr<dynamic> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ dynamic :saved_try_context_var0;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L1:
+ {
+ dynamic f = () → asy::Future<dynamic> /* originally async */ {
+ final asy::Completer<dynamic> :completer = asy::Completer::sync<dynamic>();
+ asy::FutureOr<dynamic> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L2:
+ {
+ :return_value = null;
+ break #L2;
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+ };
+ asy::Future<dynamic> y = f.call();
+ asy::Future<core::String> z = f.call();
+ [yield] let dynamic #t1 = asy::_awaitHelper(f.call(), :async_op_then, :async_op_error, :async_op) in null;
+ core::String s = :result;
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+}
diff --git a/pkg/front_end/testcases/inference/block_bodied_lambdas_infer_bottom_async.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/block_bodied_lambdas_infer_bottom_async.dart.strong.transformed.expect
new file mode 100644
index 0000000..1afc8d9
--- /dev/null
+++ b/pkg/front_end/testcases/inference/block_bodied_lambdas_infer_bottom_async.dart.strong.transformed.expect
@@ -0,0 +1,62 @@
+library test;
+import self as self;
+import "dart:async" as asy;
+import "dart:core" as core;
+
+static method main() → dynamic /* originally async */ {
+ final asy::Completer<dynamic> :completer = asy::Completer::sync<dynamic>();
+ asy::FutureOr<dynamic> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ dynamic :saved_try_context_var0;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L1:
+ {
+ () → asy::Future<core::Null> f = () → asy::Future<core::Null> /* originally async */ {
+ final asy::Completer<core::Null> :completer = asy::Completer::sync<core::Null>();
+ asy::FutureOr<core::Null> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L2:
+ {
+ :return_value = null;
+ break #L2;
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+ };
+ asy::Future<dynamic> y = f.call();
+ asy::Future<core::String> z = f.call();
+ [yield] let dynamic #t1 = asy::_awaitHelper(f.call(), :async_op_then, :async_op_error, :async_op) in null;
+ core::String s = :result;
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+}
diff --git a/pkg/front_end/testcases/inference/block_bodied_lambdas_infer_bottom_async_star.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/block_bodied_lambdas_infer_bottom_async_star.dart.direct.transformed.expect
new file mode 100644
index 0000000..e58820a
--- /dev/null
+++ b/pkg/front_end/testcases/inference/block_bodied_lambdas_infer_bottom_async_star.dart.direct.transformed.expect
@@ -0,0 +1,68 @@
+library test;
+import self as self;
+import "dart:async" as asy;
+import "dart:core" as core;
+
+static method main() → dynamic /* originally async */ {
+ final asy::Completer<dynamic> :completer = asy::Completer::sync<dynamic>();
+ asy::FutureOr<dynamic> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ dynamic :saved_try_context_var0;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L1:
+ {
+ dynamic f = () → asy::Stream<dynamic> /* originally async* */ {
+ asy::_AsyncStarStreamController<dynamic> :controller;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ dynamic :saved_try_context_var0;
+ dynamic :saved_try_context_var1;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try
+ try {
+ #L2:
+ {
+ if(:controller.{asy::_AsyncStarStreamController::add}(null))
+ return null;
+ else
+ [yield] null;
+ }
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :controller.{asy::_AsyncStarStreamController::addError}(:exception, :stack_trace);
+ }
+ finally {
+ :controller.{asy::_AsyncStarStreamController::close}();
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ :controller = new asy::_AsyncStarStreamController::•<dynamic>(:async_op);
+ return :controller.{asy::_AsyncStarStreamController::stream};
+ };
+ asy::Stream<dynamic> y = f.call();
+ asy::Stream<core::String> z = f.call();
+ [yield] let dynamic #t1 = asy::_awaitHelper(f.call().first, :async_op_then, :async_op_error, :async_op) in null;
+ core::String s = :result;
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+}
diff --git a/pkg/front_end/testcases/inference/block_bodied_lambdas_infer_bottom_async_star.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/block_bodied_lambdas_infer_bottom_async_star.dart.strong.transformed.expect
new file mode 100644
index 0000000..1d67b45
--- /dev/null
+++ b/pkg/front_end/testcases/inference/block_bodied_lambdas_infer_bottom_async_star.dart.strong.transformed.expect
@@ -0,0 +1,68 @@
+library test;
+import self as self;
+import "dart:async" as asy;
+import "dart:core" as core;
+
+static method main() → dynamic /* originally async */ {
+ final asy::Completer<dynamic> :completer = asy::Completer::sync<dynamic>();
+ asy::FutureOr<dynamic> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ dynamic :saved_try_context_var0;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L1:
+ {
+ () → asy::Stream<core::Null> f = () → asy::Stream<core::Null> /* originally async* */ {
+ asy::_AsyncStarStreamController<core::Null> :controller;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ dynamic :saved_try_context_var0;
+ dynamic :saved_try_context_var1;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try
+ try {
+ #L2:
+ {
+ if(:controller.{asy::_AsyncStarStreamController::add}(null))
+ return null;
+ else
+ [yield] null;
+ }
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :controller.{asy::_AsyncStarStreamController::addError}(:exception, :stack_trace);
+ }
+ finally {
+ :controller.{asy::_AsyncStarStreamController::close}();
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ :controller = new asy::_AsyncStarStreamController::•<core::Null>(:async_op);
+ return :controller.{asy::_AsyncStarStreamController::stream};
+ };
+ asy::Stream<dynamic> y = f.call();
+ asy::Stream<core::String> z = f.call();
+ [yield] let dynamic #t1 = asy::_awaitHelper(f.call().{asy::Stream::first}, :async_op_then, :async_op_error, :async_op) in null;
+ core::String s = :result;
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+}
diff --git a/pkg/front_end/testcases/inference/block_bodied_lambdas_infer_bottom_sync.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/block_bodied_lambdas_infer_bottom_sync.dart.direct.transformed.expect
new file mode 100644
index 0000000..3287dd0
--- /dev/null
+++ b/pkg/front_end/testcases/inference/block_bodied_lambdas_infer_bottom_sync.dart.direct.transformed.expect
@@ -0,0 +1,20 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+static field dynamic h = null;
+static method foo((core::Object) → core::int f) → void {}
+static method test() → dynamic {
+ dynamic f = (core::Object x) → dynamic {
+ return null;
+ };
+ core::String y = f.call(42);
+ f = (dynamic x) → dynamic => "hello";
+ self::foo((dynamic x) → dynamic {
+ return null;
+ });
+ self::foo((dynamic x) → dynamic {
+ throw "not implemented";
+ });
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/block_bodied_lambdas_infer_bottom_sync.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/block_bodied_lambdas_infer_bottom_sync.dart.strong.transformed.expect
new file mode 100644
index 0000000..ffc9a26
--- /dev/null
+++ b/pkg/front_end/testcases/inference/block_bodied_lambdas_infer_bottom_sync.dart.strong.transformed.expect
@@ -0,0 +1,20 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+static field dynamic h = null;
+static method foo((core::Object) → core::int f) → void {}
+static method test() → dynamic {
+ (core::Object) → core::Null f = (core::Object x) → core::Null {
+ return null;
+ };
+ core::String y = f.call(42);
+ f = (core::Object x) → core::Null => "hello" as{TypeError} core::Null;
+ self::foo((core::Object x) → core::Null {
+ return null;
+ });
+ self::foo((core::Object x) → core::Null {
+ throw "not implemented";
+ });
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/block_bodied_lambdas_infer_bottom_sync_star.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/block_bodied_lambdas_infer_bottom_sync_star.dart.direct.transformed.expect
new file mode 100644
index 0000000..f1c2713
--- /dev/null
+++ b/pkg/front_end/testcases/inference/block_bodied_lambdas_infer_bottom_sync_star.dart.direct.transformed.expect
@@ -0,0 +1,23 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+static method main() → dynamic {
+ dynamic f = () → core::Iterable<dynamic> /* originally sync* */ {
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ function :sync_op(core::_SyncIterator<dynamic> :iterator) → core::bool yielding {
+ {
+ {
+ :iterator.{core::_SyncIterator::_current} = null;
+ [yield] true;
+ }
+ }
+ return false;
+ }
+ return new core::_SyncIterable::•<dynamic>(:sync_op);
+ };
+ core::Iterable<dynamic> y = f.call();
+ core::Iterable<core::String> z = f.call();
+ core::String s = f.call().first;
+}
diff --git a/pkg/front_end/testcases/inference/block_bodied_lambdas_infer_bottom_sync_star.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/block_bodied_lambdas_infer_bottom_sync_star.dart.strong.transformed.expect
new file mode 100644
index 0000000..ef16872
--- /dev/null
+++ b/pkg/front_end/testcases/inference/block_bodied_lambdas_infer_bottom_sync_star.dart.strong.transformed.expect
@@ -0,0 +1,23 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+static method main() → dynamic {
+ () → core::Iterable<core::Null> f = () → core::Iterable<core::Null> /* originally sync* */ {
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ function :sync_op(core::_SyncIterator<core::Null> :iterator) → core::bool yielding {
+ {
+ {
+ :iterator.{core::_SyncIterator::_current} = null;
+ [yield] true;
+ }
+ }
+ return false;
+ }
+ return new core::_SyncIterable::•<core::Null>(:sync_op);
+ };
+ core::Iterable<dynamic> y = f.call();
+ core::Iterable<core::String> z = f.call();
+ core::String s = f.call().{core::Iterable::first};
+}
diff --git a/pkg/front_end/testcases/inference/block_bodied_lambdas_lub.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/block_bodied_lambdas_lub.dart.direct.transformed.expect
new file mode 100644
index 0000000..3f1899b
--- /dev/null
+++ b/pkg/front_end/testcases/inference/block_bodied_lambdas_lub.dart.direct.transformed.expect
@@ -0,0 +1,19 @@
+library test;
+import self as self;
+import "dart:core" as core;
+import "dart:math" as math;
+
+static method test2() → dynamic {
+ core::List<core::num> o;
+ dynamic y = o.map((dynamic x) → dynamic {
+ if(math::Random::•().nextBool()) {
+ return x.toInt().+(1);
+ }
+ else {
+ return x.toDouble();
+ }
+ });
+ core::Iterable<core::num> w = y;
+ core::Iterable<core::int> z = y;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/block_bodied_lambdas_lub.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/block_bodied_lambdas_lub.dart.strong.transformed.expect
new file mode 100644
index 0000000..6c27cd0
--- /dev/null
+++ b/pkg/front_end/testcases/inference/block_bodied_lambdas_lub.dart.strong.transformed.expect
@@ -0,0 +1,19 @@
+library test;
+import self as self;
+import "dart:core" as core;
+import "dart:math" as math;
+
+static method test2() → dynamic {
+ core::List<core::num> o;
+ core::Iterable<core::num> y = o.{core::Iterable::map}<core::num>((core::num x) → core::num {
+ if(math::Random::•().{math::Random::nextBool}()) {
+ return x.{core::num::toInt}().{core::num::+}(1);
+ }
+ else {
+ return x.{core::num::toDouble}();
+ }
+ });
+ core::Iterable<core::num> w = y;
+ core::Iterable<core::int> z = y as{TypeError} core::Iterable<core::int>;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/block_bodied_lambdas_nested_lambdas.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/block_bodied_lambdas_nested_lambdas.dart.direct.transformed.expect
new file mode 100644
index 0000000..c435423
--- /dev/null
+++ b/pkg/front_end/testcases/inference/block_bodied_lambdas_nested_lambdas.dart.direct.transformed.expect
@@ -0,0 +1,11 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+static method main() → dynamic {
+ dynamic f = () → dynamic {
+ return (core::int x) → dynamic {
+ return 2.0.*(x);
+ };
+ };
+}
diff --git a/pkg/front_end/testcases/inference/block_bodied_lambdas_nested_lambdas.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/block_bodied_lambdas_nested_lambdas.dart.strong.transformed.expect
new file mode 100644
index 0000000..1939518
--- /dev/null
+++ b/pkg/front_end/testcases/inference/block_bodied_lambdas_nested_lambdas.dart.strong.transformed.expect
@@ -0,0 +1,11 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+static method main() → dynamic {
+ () → (core::int) → core::double f = () → (core::int) → core::double {
+ return (core::int x) → core::double {
+ return 2.0.{core::double::*}(x);
+ };
+ };
+}
diff --git a/pkg/front_end/testcases/inference/block_bodied_lambdas_no_return.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/block_bodied_lambdas_no_return.dart.direct.transformed.expect
new file mode 100644
index 0000000..e318418
--- /dev/null
+++ b/pkg/front_end/testcases/inference/block_bodied_lambdas_no_return.dart.direct.transformed.expect
@@ -0,0 +1,10 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+static method test1() → dynamic {
+ core::List<core::int> o;
+ dynamic y = o.map((dynamic x) → dynamic {});
+ core::Iterable<core::int> z = y;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/block_bodied_lambdas_no_return.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/block_bodied_lambdas_no_return.dart.strong.transformed.expect
new file mode 100644
index 0000000..c8d8caa
--- /dev/null
+++ b/pkg/front_end/testcases/inference/block_bodied_lambdas_no_return.dart.strong.transformed.expect
@@ -0,0 +1,10 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+static method test1() → dynamic {
+ core::List<core::int> o;
+ core::Iterable<core::Null> y = o.{core::Iterable::map}<core::Null>((core::int x) → core::Null {});
+ core::Iterable<core::int> z = y;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/block_bodied_lambdas_returns.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/block_bodied_lambdas_returns.dart.direct.transformed.expect
new file mode 100644
index 0000000..895ff01
--- /dev/null
+++ b/pkg/front_end/testcases/inference/block_bodied_lambdas_returns.dart.direct.transformed.expect
@@ -0,0 +1,88 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+static method main() → dynamic {
+ dynamic a = () → dynamic {};
+ dynamic b = () → dynamic {
+ return;
+ };
+ dynamic c = () → dynamic {
+ return null;
+ };
+ dynamic d = () → dynamic {
+ return 0;
+ };
+ dynamic e = (core::bool b) → dynamic {
+ if(b) {
+ return;
+ }
+ else {
+ return;
+ }
+ };
+ dynamic f = (core::bool b) → dynamic {
+ if(b) {
+ return;
+ }
+ else {
+ return null;
+ }
+ };
+ dynamic g = (core::bool b) → dynamic {
+ if(b) {
+ return;
+ }
+ else {
+ return 0;
+ }
+ };
+ dynamic h = (core::bool b) → dynamic {
+ if(b) {
+ return null;
+ }
+ else {
+ return;
+ }
+ };
+ dynamic i = (core::bool b) → dynamic {
+ if(b) {
+ return null;
+ }
+ else {
+ return null;
+ }
+ };
+ dynamic j = (core::bool b) → dynamic {
+ if(b) {
+ return null;
+ }
+ else {
+ return 0;
+ }
+ };
+ dynamic k = (core::bool b) → dynamic {
+ if(b) {
+ return 0;
+ }
+ else {
+ return;
+ }
+ };
+ dynamic l = (core::bool b) → dynamic {
+ if(b) {
+ return 0;
+ }
+ else {
+ return null;
+ }
+ };
+ dynamic m = (core::bool b) → dynamic {
+ if(b) {
+ return 0;
+ }
+ else {
+ return 0;
+ }
+ };
+}
diff --git a/pkg/front_end/testcases/inference/block_bodied_lambdas_returns.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/block_bodied_lambdas_returns.dart.strong.transformed.expect
new file mode 100644
index 0000000..b0ec67b
--- /dev/null
+++ b/pkg/front_end/testcases/inference/block_bodied_lambdas_returns.dart.strong.transformed.expect
@@ -0,0 +1,88 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+static method main() → dynamic {
+ () → core::Null a = () → core::Null {};
+ () → core::Null b = () → core::Null {
+ return;
+ };
+ () → core::Null c = () → core::Null {
+ return null;
+ };
+ () → core::int d = () → core::int {
+ return 0;
+ };
+ (core::bool) → core::Null e = (core::bool b) → core::Null {
+ if(b) {
+ return;
+ }
+ else {
+ return;
+ }
+ };
+ (core::bool) → core::Null f = (core::bool b) → core::Null {
+ if(b) {
+ return;
+ }
+ else {
+ return null;
+ }
+ };
+ (core::bool) → core::int g = (core::bool b) → core::int {
+ if(b) {
+ return;
+ }
+ else {
+ return 0;
+ }
+ };
+ (core::bool) → core::Null h = (core::bool b) → core::Null {
+ if(b) {
+ return null;
+ }
+ else {
+ return;
+ }
+ };
+ (core::bool) → core::Null i = (core::bool b) → core::Null {
+ if(b) {
+ return null;
+ }
+ else {
+ return null;
+ }
+ };
+ (core::bool) → core::int j = (core::bool b) → core::int {
+ if(b) {
+ return null;
+ }
+ else {
+ return 0;
+ }
+ };
+ (core::bool) → core::int k = (core::bool b) → core::int {
+ if(b) {
+ return 0;
+ }
+ else {
+ return;
+ }
+ };
+ (core::bool) → core::int l = (core::bool b) → core::int {
+ if(b) {
+ return 0;
+ }
+ else {
+ return null;
+ }
+ };
+ (core::bool) → core::int m = (core::bool b) → core::int {
+ if(b) {
+ return 0;
+ }
+ else {
+ return 0;
+ }
+ };
+}
diff --git a/pkg/front_end/testcases/inference/block_bodied_lambdas_sync_star.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/block_bodied_lambdas_sync_star.dart.direct.transformed.expect
new file mode 100644
index 0000000..8a11ab5
--- /dev/null
+++ b/pkg/front_end/testcases/inference/block_bodied_lambdas_sync_star.dart.direct.transformed.expect
@@ -0,0 +1,27 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+static method test() → dynamic {
+ dynamic f = () → core::Iterable<dynamic> /* originally sync* */ {
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ function :sync_op(core::_SyncIterator<dynamic> :iterator) → core::bool yielding {
+ {
+ {
+ :iterator.{core::_SyncIterator::_current} = 1;
+ [yield] true;
+ }
+ {
+ :iterator.{core::_SyncIterator::_yieldEachIterable} = <dynamic>[3, 4.0];
+ [yield] true;
+ }
+ }
+ return false;
+ }
+ return new core::_SyncIterable::•<dynamic>(:sync_op);
+ };
+ core::Iterable<core::num> g = f.call();
+ core::Iterable<core::int> h = f.call();
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/block_bodied_lambdas_sync_star.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/block_bodied_lambdas_sync_star.dart.strong.transformed.expect
new file mode 100644
index 0000000..bc47beb
--- /dev/null
+++ b/pkg/front_end/testcases/inference/block_bodied_lambdas_sync_star.dart.strong.transformed.expect
@@ -0,0 +1,27 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+static method test() → dynamic {
+ () → core::Iterable<core::num> f = () → core::Iterable<core::num> /* originally sync* */ {
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ function :sync_op(core::_SyncIterator<core::num> :iterator) → core::bool yielding {
+ {
+ {
+ :iterator.{core::_SyncIterator::_current} = 1;
+ [yield] true;
+ }
+ {
+ :iterator.{core::_SyncIterator::_yieldEachIterable} = <core::num>[3, 4.0];
+ [yield] true;
+ }
+ }
+ return false;
+ }
+ return new core::_SyncIterable::•<core::num>(:sync_op);
+ };
+ core::Iterable<core::num> g = f.call();
+ core::Iterable<core::int> h = f.call() as{TypeError} core::Iterable<core::int>;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/block_bodied_lambdas_void_context.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/block_bodied_lambdas_void_context.dart.direct.transformed.expect
new file mode 100644
index 0000000..4273083
--- /dev/null
+++ b/pkg/front_end/testcases/inference/block_bodied_lambdas_void_context.dart.direct.transformed.expect
@@ -0,0 +1,11 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+static method f() → dynamic {
+ core::List<core::int> o;
+ o.forEach((dynamic i) → dynamic {
+ return i.+(1);
+ });
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/block_bodied_lambdas_void_context.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/block_bodied_lambdas_void_context.dart.strong.transformed.expect
new file mode 100644
index 0000000..bdd35f6
--- /dev/null
+++ b/pkg/front_end/testcases/inference/block_bodied_lambdas_void_context.dart.strong.transformed.expect
@@ -0,0 +1,11 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+static method f() → dynamic {
+ core::List<core::int> o;
+ o.{core::Iterable::forEach}((core::int i) → void {
+ return i.{core::num::+}(1);
+ });
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/bottom.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/bottom.dart.direct.transformed.expect
new file mode 100644
index 0000000..d841a5d
--- /dev/null
+++ b/pkg/front_end/testcases/inference/bottom.dart.direct.transformed.expect
@@ -0,0 +1,7 @@
+library test;
+import self as self;
+
+static field dynamic v = null;
+static method main() → dynamic {
+ self::v;
+}
diff --git a/pkg/front_end/testcases/inference/bottom.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/bottom.dart.strong.transformed.expect
new file mode 100644
index 0000000..d841a5d
--- /dev/null
+++ b/pkg/front_end/testcases/inference/bottom.dart.strong.transformed.expect
@@ -0,0 +1,7 @@
+library test;
+import self as self;
+
+static field dynamic v = null;
+static method main() → dynamic {
+ self::v;
+}
diff --git a/pkg/front_end/testcases/inference/bottom_in_closure.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/bottom_in_closure.dart.direct.transformed.expect
new file mode 100644
index 0000000..f08a258
--- /dev/null
+++ b/pkg/front_end/testcases/inference/bottom_in_closure.dart.direct.transformed.expect
@@ -0,0 +1,7 @@
+library test;
+import self as self;
+
+static field dynamic v = () → dynamic => null;
+static method main() → dynamic {
+ self::v;
+}
diff --git a/pkg/front_end/testcases/inference/bottom_in_closure.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/bottom_in_closure.dart.strong.transformed.expect
new file mode 100644
index 0000000..4ca225f
--- /dev/null
+++ b/pkg/front_end/testcases/inference/bottom_in_closure.dart.strong.transformed.expect
@@ -0,0 +1,8 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+static field () → core::Null v = () → core::Null => null;
+static method main() → dynamic {
+ self::v;
+}
diff --git a/pkg/front_end/testcases/inference/bug30251.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/bug30251.dart.direct.transformed.expect
new file mode 100644
index 0000000..fdfd49f
--- /dev/null
+++ b/pkg/front_end/testcases/inference/bug30251.dart.direct.transformed.expect
@@ -0,0 +1,13 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class C extends core::Object {
+ final field dynamic x;
+ constructor •(core::int p) → void
+ : self::C::x = self::f<dynamic>(1.+(p)), super core::Object::•()
+ ;
+}
+static method f<T extends core::Object>(self::f::T t) → self::f::T
+ return t;
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/bug30251.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/bug30251.dart.strong.transformed.expect
new file mode 100644
index 0000000..c3087fe
--- /dev/null
+++ b/pkg/front_end/testcases/inference/bug30251.dart.strong.transformed.expect
@@ -0,0 +1,13 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class C extends core::Object {
+ final field dynamic x;
+ constructor •(core::int p) → void
+ : self::C::x = self::f<core::int>(1.{core::num::+}(p)), super core::Object::•()
+ ;
+}
+static method f<T extends core::Object>(self::f::T t) → self::f::T
+ return t;
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/bug30620.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/bug30620.dart.direct.transformed.expect
new file mode 100644
index 0000000..11677c0
--- /dev/null
+++ b/pkg/front_end/testcases/inference/bug30620.dart.direct.transformed.expect
@@ -0,0 +1,15 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class A extends core::Object {
+ final field core::String foo;
+ constructor •(core::String foo) → void
+ : self::A::foo = foo, super core::Object::•()
+ ;
+ operator ==(core::Object other) → core::bool
+ return other is self::A && other{self::A}.foo.==(this.{self::A::foo});
+}
+static method main() → dynamic {
+ core::print(new self::A::•("hello").==(new self::A::•("hello")));
+}
diff --git a/pkg/front_end/testcases/inference/bug30620.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/bug30620.dart.strong.transformed.expect
new file mode 100644
index 0000000..b299931
--- /dev/null
+++ b/pkg/front_end/testcases/inference/bug30620.dart.strong.transformed.expect
@@ -0,0 +1,15 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class A extends core::Object {
+ final field core::String foo;
+ constructor •(core::String foo) → void
+ : self::A::foo = foo, super core::Object::•()
+ ;
+ operator ==(core::Object other) → core::bool
+ return other is self::A && other{self::A}.{self::A::foo}.{core::String::==}(this.{self::A::foo});
+}
+static method main() → dynamic {
+ core::print(new self::A::•("hello").{self::A::==}(new self::A::•("hello")));
+}
diff --git a/pkg/front_end/testcases/inference/bug30620_b.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/bug30620_b.dart.direct.transformed.expect
new file mode 100644
index 0000000..35648da
--- /dev/null
+++ b/pkg/front_end/testcases/inference/bug30620_b.dart.direct.transformed.expect
@@ -0,0 +1,15 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class A extends core::Object {
+ final field core::String foo;
+ constructor •(core::String foo) → void
+ : self::A::foo = foo, super core::Object::•()
+ ;
+ operator ==(core::Object other) → core::bool
+ return other is self::A && other{self::A}.foo.==(this.{self::A::foo}) && other{self::A}.foo.==(this.{self::A::foo});
+}
+static method main() → dynamic {
+ core::print(new self::A::•("hello").==(new self::A::•("hello")));
+}
diff --git a/pkg/front_end/testcases/inference/bug30620_b.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/bug30620_b.dart.strong.transformed.expect
new file mode 100644
index 0000000..ec87ef4
--- /dev/null
+++ b/pkg/front_end/testcases/inference/bug30620_b.dart.strong.transformed.expect
@@ -0,0 +1,15 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class A extends core::Object {
+ final field core::String foo;
+ constructor •(core::String foo) → void
+ : self::A::foo = foo, super core::Object::•()
+ ;
+ operator ==(core::Object other) → core::bool
+ return other is self::A && other{self::A}.{self::A::foo}.{core::String::==}(this.{self::A::foo}) && other{self::A}.{self::A::foo}.{core::String::==}(this.{self::A::foo});
+}
+static method main() → dynamic {
+ core::print(new self::A::•("hello").{self::A::==}(new self::A::•("hello")));
+}
diff --git a/pkg/front_end/testcases/inference/bug30620_c.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/bug30620_c.dart.direct.transformed.expect
new file mode 100644
index 0000000..239e30e
--- /dev/null
+++ b/pkg/front_end/testcases/inference/bug30620_c.dart.direct.transformed.expect
@@ -0,0 +1,20 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class A extends core::Object {
+ final field core::String foo;
+ constructor •(core::String foo) → void
+ : self::A::foo = foo, super core::Object::•()
+ ;
+ operator ==(core::Object other) → core::bool {
+ if(other is self::A && other{self::A}.foo.==(this.{self::A::foo})) {
+ if(other{self::A}.foo.==(this.{self::A::foo})) {
+ }
+ }
+ return true;
+ }
+}
+static method main() → dynamic {
+ core::print(new self::A::•("hello").==(new self::A::•("hello")));
+}
diff --git a/pkg/front_end/testcases/inference/bug30620_c.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/bug30620_c.dart.strong.transformed.expect
new file mode 100644
index 0000000..4d95231
--- /dev/null
+++ b/pkg/front_end/testcases/inference/bug30620_c.dart.strong.transformed.expect
@@ -0,0 +1,20 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class A extends core::Object {
+ final field core::String foo;
+ constructor •(core::String foo) → void
+ : self::A::foo = foo, super core::Object::•()
+ ;
+ operator ==(core::Object other) → core::bool {
+ if(other is self::A && other{self::A}.{self::A::foo}.{core::String::==}(this.{self::A::foo})) {
+ if(other{self::A}.{self::A::foo}.{core::String::==}(this.{self::A::foo})) {
+ }
+ }
+ return true;
+ }
+}
+static method main() → dynamic {
+ core::print(new self::A::•("hello").{self::A::==}(new self::A::•("hello")));
+}
diff --git a/pkg/front_end/testcases/inference/bug30620_d.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/bug30620_d.dart.direct.transformed.expect
new file mode 100644
index 0000000..1149d5f
--- /dev/null
+++ b/pkg/front_end/testcases/inference/bug30620_d.dart.direct.transformed.expect
@@ -0,0 +1,7 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+static method foo(dynamic obj) → core::String
+ return obj is core::String ? obj{core::String}.toUpperCase() : null;
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/bug30620_d.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/bug30620_d.dart.strong.transformed.expect
new file mode 100644
index 0000000..39bc32b
--- /dev/null
+++ b/pkg/front_end/testcases/inference/bug30620_d.dart.strong.transformed.expect
@@ -0,0 +1,7 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+static method foo(dynamic obj) → core::String
+ return obj is core::String ?{core::String} obj{core::String}.{core::String::toUpperCase}() : null;
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/bug30624.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/bug30624.dart.direct.transformed.expect
new file mode 100644
index 0000000..9a75e22
--- /dev/null
+++ b/pkg/front_end/testcases/inference/bug30624.dart.direct.transformed.expect
@@ -0,0 +1,33 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class C<E extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method barA([(self::C::E, self::C::E) → core::int cmp = null]) → void {
+ self::foo<dynamic>(this, let final dynamic #t1 = cmp in #t1.==(null) ? self::C::_default : #t1);
+ }
+ method barB([(self::C::E, self::C::E) → core::int cmp = null]) → void {
+ self::foo<dynamic>(this, let final dynamic #t2 = cmp in #t2.==(null) ? self::C::_default as (self::C::E, self::C::E) → core::int : #t2);
+ }
+ method barC([(self::C::E, self::C::E) → core::int cmp = null]) → void {
+ (self::C::E, self::C::E) → core::int v = self::C::_default;
+ self::foo<dynamic>(this, let final dynamic #t3 = cmp in #t3.==(null) ? v : #t3);
+ }
+ method barD([(self::C::E, self::C::E) → core::int cmp = null]) → void {
+ self::foo<self::C::E>(this, let final dynamic #t4 = cmp in #t4.==(null) ? self::C::_default : #t4);
+ }
+ method barE([(self::C::E, self::C::E) → core::int cmp = null]) → void {
+ self::foo<dynamic>(this, cmp.==(null) ? self::C::_default : cmp);
+ }
+ method barF([(self::C::E, self::C::E) → core::int cmp = null]) → void {
+ self::foo<dynamic>(this, !cmp.==(null) ? cmp : self::C::_default);
+ }
+ static method _default(dynamic a, dynamic b) → core::int {
+ return 1.unary-();
+ }
+}
+static method foo<E extends core::Object>(self::C<self::foo::E> c, (self::foo::E, self::foo::E) → core::int cmp) → void {}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/bug30624.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/bug30624.dart.strong.transformed.expect
new file mode 100644
index 0000000..1f952f5
--- /dev/null
+++ b/pkg/front_end/testcases/inference/bug30624.dart.strong.transformed.expect
@@ -0,0 +1,33 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class C<E extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method barA([(self::C::E, self::C::E) → core::int cmp = null]) → void {
+ self::foo<self::C::E>(this, let final (self::C::E, self::C::E) → core::int #t1 = cmp in #t1.==(null) ?{(self::C::E, self::C::E) → core::int} self::C::_default : #t1);
+ }
+ method barB([(self::C::E, self::C::E) → core::int cmp = null]) → void {
+ self::foo<self::C::E>(this, let final (self::C::E, self::C::E) → core::int #t2 = cmp in #t2.==(null) ?{(self::C::E, self::C::E) → core::int} self::C::_default as (self::C::E, self::C::E) → core::int : #t2);
+ }
+ method barC([(self::C::E, self::C::E) → core::int cmp = null]) → void {
+ (self::C::E, self::C::E) → core::int v = self::C::_default;
+ self::foo<self::C::E>(this, let final (self::C::E, self::C::E) → core::int #t3 = cmp in #t3.==(null) ?{(self::C::E, self::C::E) → core::int} v : #t3);
+ }
+ method barD([(self::C::E, self::C::E) → core::int cmp = null]) → void {
+ self::foo<self::C::E>(this, let final (self::C::E, self::C::E) → core::int #t4 = cmp in #t4.==(null) ?{(self::C::E, self::C::E) → core::int} self::C::_default : #t4);
+ }
+ method barE([(self::C::E, self::C::E) → core::int cmp = null]) → void {
+ self::foo<self::C::E>(this, cmp.{core::Object::==}(null) ?{(self::C::E, self::C::E) → core::int} self::C::_default : cmp);
+ }
+ method barF([(self::C::E, self::C::E) → core::int cmp = null]) → void {
+ self::foo<self::C::E>(this, !cmp.{core::Object::==}(null) ?{(self::C::E, self::C::E) → core::int} cmp : self::C::_default);
+ }
+ static method _default(dynamic a, dynamic b) → core::int {
+ return 1.{core::int::unary-}();
+ }
+}
+static method foo<E extends core::Object>(self::C<self::foo::E> c, (self::foo::E, self::foo::E) → core::int cmp) → void {}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/bug31132.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/bug31132.dart.direct.transformed.expect
new file mode 100644
index 0000000..29a4ab76
--- /dev/null
+++ b/pkg/front_end/testcases/inference/bug31132.dart.direct.transformed.expect
@@ -0,0 +1,20 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class B extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class C extends self::B {
+ field dynamic z = null;
+ synthetic constructor •() → void
+ : super self::B::•()
+ ;
+}
+static method test(self::B x) → void {
+ dynamic y = x is self::C ? x{self::C} : new self::C::•();
+ core::print(y.z);
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/bug31132.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/bug31132.dart.strong.transformed.expect
new file mode 100644
index 0000000..0aa0ff6
--- /dev/null
+++ b/pkg/front_end/testcases/inference/bug31132.dart.strong.transformed.expect
@@ -0,0 +1,20 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class B extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class C extends self::B {
+ field dynamic z = null;
+ synthetic constructor •() → void
+ : super self::B::•()
+ ;
+}
+static method test(self::B x) → void {
+ self::C y = x is self::C ?{self::C} x{self::C} : new self::C::•();
+ core::print(y.{self::C::z});
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/bug31133.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/bug31133.dart.direct.transformed.expect
new file mode 100644
index 0000000..b2a0cef
--- /dev/null
+++ b/pkg/front_end/testcases/inference/bug31133.dart.direct.transformed.expect
@@ -0,0 +1,15 @@
+library test;
+import self as self;
+
+static method test() → void {
+ dynamic i = 0;
+ for (final dynamic #t1 = i = i.+(1); i.<(10); i = i.+(1)) {
+ }
+ for (final dynamic #t2 = i = i.+(1); i.<(10); i = i.+(1)) {
+ }
+ for (final dynamic #t3 = i = i.-(1); i.>=(0); i = i.-(1)) {
+ }
+ for (final dynamic #t4 = i = i.-(1); i.>=(0); i = i.-(1)) {
+ }
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/bug31133.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/bug31133.dart.strong.transformed.expect
new file mode 100644
index 0000000..e333816
--- /dev/null
+++ b/pkg/front_end/testcases/inference/bug31133.dart.strong.transformed.expect
@@ -0,0 +1,16 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+static method test() → void {
+ core::int i = 0;
+ for (final dynamic #t1 = i = i.{core::num::+}(1); i.{core::num::<}(10); i = i.{core::num::+}(1)) {
+ }
+ for (final dynamic #t2 = i = i.{core::num::+}(1); i.{core::num::<}(10); i = i.{core::num::+}(1)) {
+ }
+ for (final dynamic #t3 = i = i.{core::num::-}(1); i.{core::num::>=}(0); i = i.{core::num::-}(1)) {
+ }
+ for (final dynamic #t4 = i = i.{core::num::-}(1); i.{core::num::>=}(0); i = i.{core::num::-}(1)) {
+ }
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/bug31436.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/bug31436.dart.direct.transformed.expect
new file mode 100644
index 0000000..e52bb02
--- /dev/null
+++ b/pkg/front_end/testcases/inference/bug31436.dart.direct.transformed.expect
@@ -0,0 +1,74 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+static method block_test() → void {
+ () → core::List<core::Object> g;
+ g = () → dynamic {
+ return <dynamic>[3];
+ };
+ assert(g is () → core::List<core::Object>);
+ assert(!(g is () → core::List<core::int>));
+ g.call().add("hello");
+ core::List<core::int> l = <dynamic>[3];
+ g = () → dynamic {
+ return l;
+ };
+ assert(g is () → core::List<core::Object>);
+ assert(g is () → core::List<core::int>);
+ try {
+ g.call().add("hello");
+ throw "expected a runtime error";
+ }
+ on core::TypeError catch(no-exception-var) {
+ }
+ core::Object o = l;
+ g = () → dynamic {
+ return o;
+ };
+ assert(g is () → core::List<core::Object>);
+ assert(!(g is () → core::List<core::int>));
+ assert(!(g is () → core::Object));
+ g.call();
+ o = 3;
+ try {
+ g.call();
+ throw "expected a runtime error";
+ }
+ on core::TypeError catch(no-exception-var) {
+ }
+}
+static method arrow_test() → void {
+ () → core::List<core::Object> g;
+ g = () → dynamic => <dynamic>[3];
+ assert(g is () → core::List<core::Object>);
+ assert(!(g is () → core::List<core::int>));
+ g.call().add("hello");
+ core::List<core::int> l = <dynamic>[3];
+ g = () → dynamic => l;
+ assert(g is () → core::List<core::Object>);
+ assert(g is () → core::List<core::int>);
+ try {
+ g.call().add("hello");
+ throw "expected a runtime error";
+ }
+ on core::TypeError catch(no-exception-var) {
+ }
+ core::Object o = l;
+ g = () → dynamic => o;
+ assert(g is () → core::List<core::Object>);
+ assert(!(g is () → core::List<core::int>));
+ assert(!(g is () → core::Object));
+ g.call();
+ o = 3;
+ try {
+ g.call();
+ throw "expected a runtime error";
+ }
+ on core::TypeError catch(no-exception-var) {
+ }
+}
+static method main() → dynamic {
+ self::block_test();
+ self::arrow_test();
+}
diff --git a/pkg/front_end/testcases/inference/bug31436.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/bug31436.dart.strong.transformed.expect
new file mode 100644
index 0000000..1f2d373
--- /dev/null
+++ b/pkg/front_end/testcases/inference/bug31436.dart.strong.transformed.expect
@@ -0,0 +1,74 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+static method block_test() → void {
+ () → core::List<core::Object> g;
+ g = () → core::List<core::Object> {
+ return <core::Object>[3];
+ };
+ assert(g is () → core::List<core::Object>);
+ assert(!(g is () → core::List<core::int>));
+ g.call().{core::List::add}("hello");
+ core::List<core::int> l = <core::int>[3];
+ g = () → core::List<core::int> {
+ return l;
+ };
+ assert(g is () → core::List<core::Object>);
+ assert(g is () → core::List<core::int>);
+ try {
+ g.call().{core::List::add}("hello");
+ throw "expected a runtime error";
+ }
+ on core::TypeError catch(no-exception-var) {
+ }
+ core::Object o = l;
+ g = () → core::List<core::Object> {
+ return o as{TypeError} core::List<core::Object>;
+ };
+ assert(g is () → core::List<core::Object>);
+ assert(!(g is () → core::List<core::int>));
+ assert(!(g is () → core::Object));
+ g.call();
+ o = 3;
+ try {
+ g.call();
+ throw "expected a runtime error";
+ }
+ on core::TypeError catch(no-exception-var) {
+ }
+}
+static method arrow_test() → void {
+ () → core::List<core::Object> g;
+ g = () → core::List<core::Object> => <core::Object>[3];
+ assert(g is () → core::List<core::Object>);
+ assert(!(g is () → core::List<core::int>));
+ g.call().{core::List::add}("hello");
+ core::List<core::int> l = <core::int>[3];
+ g = () → core::List<core::int> => l;
+ assert(g is () → core::List<core::Object>);
+ assert(g is () → core::List<core::int>);
+ try {
+ g.call().{core::List::add}("hello");
+ throw "expected a runtime error";
+ }
+ on core::TypeError catch(no-exception-var) {
+ }
+ core::Object o = l;
+ g = () → core::List<core::Object> => o as{TypeError} core::List<core::Object>;
+ assert(g is () → core::List<core::Object>);
+ assert(!(g is () → core::List<core::int>));
+ assert(!(g is () → core::Object));
+ g.call();
+ o = 3;
+ try {
+ g.call();
+ throw "expected a runtime error";
+ }
+ on core::TypeError catch(no-exception-var) {
+ }
+}
+static method main() → dynamic {
+ self::block_test();
+ self::arrow_test();
+}
diff --git a/pkg/front_end/testcases/inference/bug32291.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/bug32291.dart.direct.transformed.expect
new file mode 100644
index 0000000..f2dc0b2
--- /dev/null
+++ b/pkg/front_end/testcases/inference/bug32291.dart.direct.transformed.expect
@@ -0,0 +1,10 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+static method main() → void {
+ dynamic l = <dynamic>[<dynamic>["hi", "world"]];
+ dynamic i1 = l.map((dynamic ll) → dynamic => let final dynamic #t1 = ll in #t1.==(null) ? <dynamic>[] : #t1);
+ dynamic i2 = i1.map((core::List<core::String> l) → dynamic => l.length);
+ core::print(i2);
+}
diff --git a/pkg/front_end/testcases/inference/bug32291.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/bug32291.dart.strong.transformed.expect
new file mode 100644
index 0000000..6193515
--- /dev/null
+++ b/pkg/front_end/testcases/inference/bug32291.dart.strong.transformed.expect
@@ -0,0 +1,10 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+static method main() → void {
+ core::List<core::List<core::String>> l = <core::List<core::String>>[<core::String>["hi", "world"]];
+ core::Iterable<core::List<core::String>> i1 = l.{core::Iterable::map}<core::List<core::String>>((core::List<core::String> ll) → core::List<core::String> => let final core::List<core::String> #t1 = ll in #t1.==(null) ?{core::List<core::String>} <core::String>[] : #t1);
+ core::Iterable<core::int> i2 = i1.{core::Iterable::map}<core::int>((core::List<core::String> l) → core::int => l.{core::List::length});
+ core::print(i2);
+}
diff --git a/pkg/front_end/testcases/inference/call_corner_cases.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/call_corner_cases.dart.direct.transformed.expect
new file mode 100644
index 0000000..8283021
--- /dev/null
+++ b/pkg/front_end/testcases/inference/call_corner_cases.dart.direct.transformed.expect
@@ -0,0 +1,36 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class A extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method call() → core::int
+ return 0;
+}
+class B extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ get call() → self::A
+ return new self::A::•();
+}
+class D extends core::Object {
+ field self::A fieldA = new self::A::•();
+ field self::B fieldB = new self::B::•();
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ get getA() → self::A
+ return new self::A::•();
+ get getB() → self::B
+ return new self::B::•();
+}
+static method main() → dynamic {
+ dynamic callA = new self::A::•().call();
+ dynamic callFieldA = new self::D::•().fieldA();
+ dynamic callGetA = new self::D::•().getA();
+ dynamic callFieldB = new self::D::•().fieldB();
+ dynamic callGetB = new self::D::•().getB();
+}
diff --git a/pkg/front_end/testcases/inference/call_corner_cases.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/call_corner_cases.dart.strong.transformed.expect
new file mode 100644
index 0000000..6457f6f
--- /dev/null
+++ b/pkg/front_end/testcases/inference/call_corner_cases.dart.strong.transformed.expect
@@ -0,0 +1,36 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class A extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method call() → core::int
+ return 0;
+}
+class B extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ get call() → self::A
+ return new self::A::•();
+}
+class D extends core::Object {
+ field self::A fieldA = new self::A::•();
+ field self::B fieldB = new self::B::•();
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ get getA() → self::A
+ return new self::A::•();
+ get getB() → self::B
+ return new self::B::•();
+}
+static method main() → dynamic {
+ core::int callA = new self::A::•().{self::A::call}();
+ core::int callFieldA = new self::D::•().{self::D::fieldA}();
+ core::int callGetA = new self::D::•().{self::D::getA}();
+ dynamic callFieldB = new self::D::•().{self::D::fieldB}();
+ dynamic callGetB = new self::D::•().{self::D::getB}();
+}
diff --git a/pkg/front_end/testcases/inference/callable_generic_class.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/callable_generic_class.dart.direct.transformed.expect
new file mode 100644
index 0000000..b1b2544
--- /dev/null
+++ b/pkg/front_end/testcases/inference/callable_generic_class.dart.direct.transformed.expect
@@ -0,0 +1,27 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class ActionDispatcher<P extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method call([self::ActionDispatcher::P value = null]) → void {}
+}
+class Bar extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class FooActions extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ get foo() → self::ActionDispatcher<self::Bar>
+ return new self::ActionDispatcher::•<self::Bar>();
+}
+static method main() → void {
+ new self::FooActions::•().foo(new self::Bar::•());
+ new self::FooActions::•().foo.call(new self::Bar::•());
+ new self::FooActions::•().foo.call(new self::Bar::•());
+}
diff --git a/pkg/front_end/testcases/inference/callable_generic_class.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/callable_generic_class.dart.strong.transformed.expect
new file mode 100644
index 0000000..3e59656
--- /dev/null
+++ b/pkg/front_end/testcases/inference/callable_generic_class.dart.strong.transformed.expect
@@ -0,0 +1,27 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class ActionDispatcher<P extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method call([generic-covariant-impl generic-covariant-interface self::ActionDispatcher::P value = null]) → void {}
+}
+class Bar extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class FooActions extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ get foo() → self::ActionDispatcher<self::Bar>
+ return new self::ActionDispatcher::•<self::Bar>();
+}
+static method main() → void {
+ new self::FooActions::•().{self::FooActions::foo}(new self::Bar::•());
+ new self::FooActions::•().{self::FooActions::foo}.{self::ActionDispatcher::call}(new self::Bar::•());
+ new self::FooActions::•().{self::FooActions::foo}.{self::ActionDispatcher::call}(new self::Bar::•());
+}
diff --git a/pkg/front_end/testcases/inference/circular_method_inference.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/circular_method_inference.dart.direct.transformed.expect
new file mode 100644
index 0000000..e22e2f0
--- /dev/null
+++ b/pkg/front_end/testcases/inference/circular_method_inference.dart.direct.transformed.expect
@@ -0,0 +1,22 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+abstract class A extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ abstract method f(dynamic x) → dynamic;
+}
+abstract class B extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ abstract method f(dynamic x) → dynamic;
+}
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/inference/circular_method_inference.dart:12:16: Error: 'A' is a supertype of itself via 'B'.
+abstract class A extends B {
+ ^", "pkg/front_end/testcases/inference/circular_method_inference.dart:16:16: Error: 'B' is a supertype of itself via 'A'.
+abstract class B extends A {
+ ^"]/* from null */;
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/circular_method_inference.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/circular_method_inference.dart.strong.transformed.expect
new file mode 100644
index 0000000..e22e2f0
--- /dev/null
+++ b/pkg/front_end/testcases/inference/circular_method_inference.dart.strong.transformed.expect
@@ -0,0 +1,22 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+abstract class A extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ abstract method f(dynamic x) → dynamic;
+}
+abstract class B extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ abstract method f(dynamic x) → dynamic;
+}
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/inference/circular_method_inference.dart:12:16: Error: 'A' is a supertype of itself via 'B'.
+abstract class A extends B {
+ ^", "pkg/front_end/testcases/inference/circular_method_inference.dart:16:16: Error: 'B' is a supertype of itself via 'A'.
+abstract class B extends A {
+ ^"]/* from null */;
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/circular_reference_via_closures.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/circular_reference_via_closures.dart.direct.transformed.expect
new file mode 100644
index 0000000..fd3ef5e
--- /dev/null
+++ b/pkg/front_end/testcases/inference/circular_reference_via_closures.dart.direct.transformed.expect
@@ -0,0 +1,6 @@
+library test;
+import self as self;
+
+static field dynamic x = () → dynamic => self::y;
+static field dynamic y = () → dynamic => self::x;
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/circular_reference_via_closures.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/circular_reference_via_closures.dart.strong.transformed.expect
new file mode 100644
index 0000000..56ef48b
--- /dev/null
+++ b/pkg/front_end/testcases/inference/circular_reference_via_closures.dart.strong.transformed.expect
@@ -0,0 +1,13 @@
+library test;
+import self as self;
+
+static field dynamic x = () → dynamic => self::y;
+static field dynamic y = () → dynamic => self::x;
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/inference/circular_reference_via_closures.dart:10:67: Error: Can't infer the type of 'y': circularity found during type inference.
+Specify the type explicitly.
+var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ y = /*@returnType=dynamic*/ () =>
+ ^", "pkg/front_end/testcases/inference/circular_reference_via_closures.dart:8:67: Error: Can't infer the type of 'x': circularity found during type inference.
+Specify the type explicitly.
+var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ x = /*@returnType=dynamic*/ () =>
+ ^"]/* from null */;
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/circular_reference_via_closures_initializer_types.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/circular_reference_via_closures_initializer_types.dart.direct.transformed.expect
new file mode 100644
index 0000000..fd3ef5e
--- /dev/null
+++ b/pkg/front_end/testcases/inference/circular_reference_via_closures_initializer_types.dart.direct.transformed.expect
@@ -0,0 +1,6 @@
+library test;
+import self as self;
+
+static field dynamic x = () → dynamic => self::y;
+static field dynamic y = () → dynamic => self::x;
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/circular_reference_via_closures_initializer_types.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/circular_reference_via_closures_initializer_types.dart.strong.transformed.expect
new file mode 100644
index 0000000..8df972c
--- /dev/null
+++ b/pkg/front_end/testcases/inference/circular_reference_via_closures_initializer_types.dart.strong.transformed.expect
@@ -0,0 +1,13 @@
+library test;
+import self as self;
+
+static field dynamic x = () → dynamic => self::y;
+static field dynamic y = () → dynamic => self::x;
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/inference/circular_reference_via_closures_initializer_types.dart:10:67: Error: Can't infer the type of 'y': circularity found during type inference.
+Specify the type explicitly.
+var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ y = /*@returnType=dynamic*/ () =>
+ ^", "pkg/front_end/testcases/inference/circular_reference_via_closures_initializer_types.dart:8:67: Error: Can't infer the type of 'x': circularity found during type inference.
+Specify the type explicitly.
+var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ x = /*@returnType=dynamic*/ () =>
+ ^"]/* from null */;
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/closure_param_null_to_object.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/closure_param_null_to_object.dart.direct.transformed.expect
new file mode 100644
index 0000000..2a82c25
--- /dev/null
+++ b/pkg/front_end/testcases/inference/closure_param_null_to_object.dart.direct.transformed.expect
@@ -0,0 +1,8 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+static method test() → void {
+ (core::Null) → core::int f = (dynamic x) → dynamic => 1;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/closure_param_null_to_object.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/closure_param_null_to_object.dart.strong.transformed.expect
new file mode 100644
index 0000000..8bc94ac
--- /dev/null
+++ b/pkg/front_end/testcases/inference/closure_param_null_to_object.dart.strong.transformed.expect
@@ -0,0 +1,8 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+static method test() → void {
+ (core::Null) → core::int f = (core::Object x) → core::int => 1;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/coerce_bottom_and_null_types.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/coerce_bottom_and_null_types.dart.direct.transformed.expect
new file mode 100644
index 0000000..a77c338
--- /dev/null
+++ b/pkg/front_end/testcases/inference/coerce_bottom_and_null_types.dart.direct.transformed.expect
@@ -0,0 +1,21 @@
+library test;
+import self as self;
+
+static method f() → dynamic {
+ dynamic a = 0;
+ dynamic b = null;
+ dynamic c = throw "foo";
+ dynamic d = () → dynamic => 0;
+ dynamic e = () → dynamic => null;
+ dynamic f = () → dynamic => throw "foo";
+ dynamic g = () → dynamic {
+ return 0;
+ };
+ dynamic h = () → dynamic {
+ return null;
+ };
+ dynamic i = () → dynamic {
+ return throw "foo";
+ };
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/coerce_bottom_and_null_types.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/coerce_bottom_and_null_types.dart.strong.transformed.expect
new file mode 100644
index 0000000..5f679a5
--- /dev/null
+++ b/pkg/front_end/testcases/inference/coerce_bottom_and_null_types.dart.strong.transformed.expect
@@ -0,0 +1,22 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+static method f() → dynamic {
+ core::int a = 0;
+ dynamic b = null;
+ dynamic c = throw "foo";
+ () → core::int d = () → core::int => 0;
+ () → core::Null e = () → core::Null => null;
+ () → <BottomType>f = () → <BottomType>=> throw "foo";
+ () → core::int g = () → core::int {
+ return 0;
+ };
+ () → core::Null h = () → core::Null {
+ return null;
+ };
+ () → <BottomType>i = () → <BottomType>{
+ return throw "foo";
+ };
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/complex_predecrement.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/complex_predecrement.dart.direct.transformed.expect
new file mode 100644
index 0000000..482fc82
--- /dev/null
+++ b/pkg/front_end/testcases/inference/complex_predecrement.dart.direct.transformed.expect
@@ -0,0 +1,8 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+static method main() → dynamic {
+ dynamic foo = <dynamic>[1, 2, 3];
+ core::print(let final dynamic #t1 = foo in let final dynamic #t2 = 0 in let final dynamic #t3 = #t1.[](#t2).-(1) in let final dynamic #t4 = #t1.[]=(#t2, #t3) in #t3);
+}
diff --git a/pkg/front_end/testcases/inference/complex_predecrement.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/complex_predecrement.dart.strong.transformed.expect
new file mode 100644
index 0000000..4b3e283
--- /dev/null
+++ b/pkg/front_end/testcases/inference/complex_predecrement.dart.strong.transformed.expect
@@ -0,0 +1,8 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+static method main() → dynamic {
+ core::List<core::int> foo = <core::int>[1, 2, 3];
+ core::print(let final core::List<core::int> #t1 = foo in let final core::int #t2 = 0 in let final core::int #t3 = #t1.{core::List::[]}(#t2).{core::num::-}(1) in let final void #t4 = #t1.{core::List::[]=}(#t2, #t3) in #t3);
+}
diff --git a/pkg/front_end/testcases/inference/conditional_lub.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/conditional_lub.dart.direct.transformed.expect
new file mode 100644
index 0000000..42ba544
--- /dev/null
+++ b/pkg/front_end/testcases/inference/conditional_lub.dart.direct.transformed.expect
@@ -0,0 +1,11 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+static field core::bool b = true;
+static field core::int x = 0;
+static field core::double y = 0.0;
+static field dynamic z = self::b ? self::x : self::y;
+static method main() → dynamic {
+ dynamic z = self::b ? self::x : self::y;
+}
diff --git a/pkg/front_end/testcases/inference/conditional_lub.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/conditional_lub.dart.strong.transformed.expect
new file mode 100644
index 0000000..2de4bbec
--- /dev/null
+++ b/pkg/front_end/testcases/inference/conditional_lub.dart.strong.transformed.expect
@@ -0,0 +1,11 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+static field core::bool b = true;
+static field core::int x = 0;
+static field core::double y = 0.0;
+static field core::num z = self::b ?{core::num} self::x : self::y;
+static method main() → dynamic {
+ core::num z = self::b ?{core::num} self::x : self::y;
+}
diff --git a/pkg/front_end/testcases/inference/conditional_upwards_inference.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/conditional_upwards_inference.dart.direct.transformed.expect
new file mode 100644
index 0000000..8145e11
--- /dev/null
+++ b/pkg/front_end/testcases/inference/conditional_upwards_inference.dart.direct.transformed.expect
@@ -0,0 +1,17 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class C<T extends core::Object> extends core::Object {
+ constructor •(core::List<self::C::T> x) → void
+ : super core::Object::•()
+ ;
+}
+static method main() → dynamic {
+ core::bool b = false;
+ core::List<core::int> l1 = <dynamic>[1];
+ core::List<core::int> l2 = <dynamic>[2];
+ dynamic x = new self::C::•<dynamic>(l1);
+ dynamic y = new self::C::•<dynamic>(l2);
+ dynamic z = new self::C::•<dynamic>(b ? l1 : l2);
+}
diff --git a/pkg/front_end/testcases/inference/conditional_upwards_inference.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/conditional_upwards_inference.dart.strong.transformed.expect
new file mode 100644
index 0000000..a952ea0
--- /dev/null
+++ b/pkg/front_end/testcases/inference/conditional_upwards_inference.dart.strong.transformed.expect
@@ -0,0 +1,17 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class C<T extends core::Object> extends core::Object {
+ constructor •(core::List<self::C::T> x) → void
+ : super core::Object::•()
+ ;
+}
+static method main() → dynamic {
+ core::bool b = false;
+ core::List<core::int> l1 = <core::int>[1];
+ core::List<core::int> l2 = <core::int>[2];
+ self::C<core::int> x = new self::C::•<core::int>(l1);
+ self::C<core::int> y = new self::C::•<core::int>(l2);
+ self::C<core::int> z = new self::C::•<core::int>(b ?{core::List<core::int>} l1 : l2);
+}
diff --git a/pkg/front_end/testcases/inference/conflicts_can_happen.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/conflicts_can_happen.dart.direct.transformed.expect
new file mode 100644
index 0000000..569ad5d
--- /dev/null
+++ b/pkg/front_end/testcases/inference/conflicts_can_happen.dart.direct.transformed.expect
@@ -0,0 +1,43 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class I1 extends core::Object {
+ field core::int x = null;
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class I2 extends self::I1 {
+ field core::int y = null;
+ synthetic constructor •() → void
+ : super self::I1::•()
+ ;
+}
+class A extends core::Object {
+ final field self::I1 a = null;
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class B extends core::Object {
+ final field self::I2 a = null;
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class C1 extends core::Object implements self::A, self::B {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ get a() → dynamic
+ return null;
+}
+class C2 extends core::Object implements self::B, self::A {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ get a() → dynamic
+ return null;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/conflicts_can_happen2.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/conflicts_can_happen2.dart.direct.transformed.expect
new file mode 100644
index 0000000..a94ba90
--- /dev/null
+++ b/pkg/front_end/testcases/inference/conflicts_can_happen2.dart.direct.transformed.expect
@@ -0,0 +1,50 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class I1 extends core::Object {
+ field core::int x = null;
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class I2 extends core::Object {
+ field core::int y = null;
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class I3 extends core::Object implements self::I1, self::I2 {
+ field core::int x = null;
+ field core::int y = null;
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class A extends core::Object {
+ final field self::I1 a = null;
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class B extends core::Object {
+ final field self::I2 a = null;
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class C1 extends core::Object implements self::A, self::B {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ get a() → self::I3
+ return null;
+}
+class C2 extends core::Object implements self::A, self::B {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ get a() → dynamic
+ return null;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/constructors_downwards_with_constraint.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/constructors_downwards_with_constraint.dart.direct.transformed.expect
new file mode 100644
index 0000000..1def021
--- /dev/null
+++ b/pkg/front_end/testcases/inference/constructors_downwards_with_constraint.dart.direct.transformed.expect
@@ -0,0 +1,22 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class A extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class B extends self::A {
+ synthetic constructor •() → void
+ : super self::A::•()
+ ;
+}
+class Foo<T extends self::A> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static method main() → void {
+ self::Foo<self::B> foo = new self::Foo::•<dynamic>();
+}
diff --git a/pkg/front_end/testcases/inference/constructors_downwards_with_constraint.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/constructors_downwards_with_constraint.dart.strong.transformed.expect
new file mode 100644
index 0000000..4da3023
--- /dev/null
+++ b/pkg/front_end/testcases/inference/constructors_downwards_with_constraint.dart.strong.transformed.expect
@@ -0,0 +1,22 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class A extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class B extends self::A {
+ synthetic constructor •() → void
+ : super self::A::•()
+ ;
+}
+class Foo<T extends self::A> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static method main() → void {
+ self::Foo<self::B> foo = new self::Foo::•<self::B>();
+}
diff --git a/pkg/front_end/testcases/inference/constructors_infer_from_arguments.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/constructors_infer_from_arguments.dart.direct.transformed.expect
new file mode 100644
index 0000000..8a1923c
--- /dev/null
+++ b/pkg/front_end/testcases/inference/constructors_infer_from_arguments.dart.direct.transformed.expect
@@ -0,0 +1,20 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class C<T extends core::Object> extends core::Object {
+ field self::C::T t;
+ constructor •(self::C::T t) → void
+ : self::C::t = t, super core::Object::•()
+ ;
+}
+static method test() → dynamic {
+ dynamic x = new self::C::•<dynamic>(42);
+ core::num y;
+ self::C<core::int> c_int = new self::C::•<dynamic>(y);
+ self::C<core::num> c_num = new self::C::•<dynamic>(123);
+ self::C<core::num> c_num2 = let final dynamic #t1 = new self::C::•<dynamic>(456) in let final dynamic #t2 = #t1.t = 1.0 in #t1;
+ dynamic c_dynamic = new self::C::•<dynamic>(42);
+ x.t = "hello";
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/constructors_infer_from_arguments.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/constructors_infer_from_arguments.dart.strong.transformed.expect
new file mode 100644
index 0000000..ac8f929
--- /dev/null
+++ b/pkg/front_end/testcases/inference/constructors_infer_from_arguments.dart.strong.transformed.expect
@@ -0,0 +1,23 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class C<T extends core::Object> extends core::Object {
+ generic-covariant-impl generic-covariant-interface field self::C::T t;
+ constructor •(self::C::T t) → void
+ : self::C::t = t, super core::Object::•()
+ ;
+}
+static method test() → dynamic {
+ self::C<core::int> x = new self::C::•<core::int>(42);
+ core::num y;
+ self::C<core::int> c_int = new self::C::•<core::int>(y as{TypeError} core::int);
+ self::C<core::num> c_num = new self::C::•<core::num>(123);
+ self::C<core::num> c_num2 = let final self::C<core::num> #t1 = new self::C::•<core::num>(456) in let final core::double #t2 = #t1.{self::C::t} = 1.0 in #t1;
+ self::C<dynamic> c_dynamic = new self::C::•<dynamic>(42);
+ x.{self::C::t} = let final core::String #t3 = "hello" in let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/inference/constructors_infer_from_arguments.dart:26:56: Error: A value of type 'dart.core::String' can't be assigned to a variable of type 'dart.core::int'.
+Try changing the type of the left hand side, or casting the right hand side to 'dart.core::int'.
+ x. /*@target=C::t*/ t = /*error:INVALID_ASSIGNMENT*/ 'hello';
+ ^";
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_argument_not_assignable.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_argument_not_assignable.dart.direct.transformed.expect
new file mode 100644
index 0000000..619f0a3
--- /dev/null
+++ b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_argument_not_assignable.dart.direct.transformed.expect
@@ -0,0 +1,25 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+typedef F<T extends core::Object> = () → T;
+class A extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class C<T extends self::A> extends core::Object {
+ constructor •(() → self::C::T f) → void
+ : super core::Object::•()
+ ;
+}
+class NotA extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static method myF() → self::NotA
+ return null;
+static method main() → dynamic {
+ dynamic x = new self::C::•<dynamic>(self::myF);
+}
diff --git a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_const.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_const.dart.direct.transformed.expect
new file mode 100644
index 0000000..c3c0ebc
--- /dev/null
+++ b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_const.dart.direct.transformed.expect
@@ -0,0 +1,13 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class C<T extends core::Object> extends core::Object {
+ final field self::C::T t;
+ const constructor •(self::C::T t) → void
+ : self::C::t = t, super core::Object::•()
+ ;
+}
+static method main() → dynamic {
+ dynamic x = const self::C::•<dynamic>(42);
+}
diff --git a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_const.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_const.dart.strong.transformed.expect
new file mode 100644
index 0000000..366ee21
--- /dev/null
+++ b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_const.dart.strong.transformed.expect
@@ -0,0 +1,13 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class C<T extends core::Object> extends core::Object {
+ final field self::C::T t;
+ const constructor •(self::C::T t) → void
+ : self::C::t = t, super core::Object::•()
+ ;
+}
+static method main() → dynamic {
+ self::C<core::int> x = const self::C::•<core::int>(42);
+}
diff --git a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_const_with_upper_bound.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_const_with_upper_bound.dart.direct.transformed.expect
new file mode 100644
index 0000000..f4cec98
--- /dev/null
+++ b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_const_with_upper_bound.dart.direct.transformed.expect
@@ -0,0 +1,20 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class C<T extends core::num> extends core::Object {
+ final field self::C::T x;
+ const constructor •(self::C::T x) → void
+ : self::C::x = x, super core::Object::•()
+ ;
+}
+class D<T extends core::num> extends core::Object {
+ const constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static method main() → void {
+ const dynamic c = const self::C::•<dynamic>(0);
+ self::C<core::int> c2 = c;
+ const self::D<core::int> d = const self::D::•<dynamic>();
+}
diff --git a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_const_with_upper_bound.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_const_with_upper_bound.dart.strong.transformed.expect
new file mode 100644
index 0000000..97e2ca4
--- /dev/null
+++ b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_const_with_upper_bound.dart.strong.transformed.expect
@@ -0,0 +1,20 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class C<T extends core::num> extends core::Object {
+ final field self::C::T x;
+ const constructor •(self::C::T x) → void
+ : self::C::x = x, super core::Object::•()
+ ;
+}
+class D<T extends core::num> extends core::Object {
+ const constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static method main() → void {
+ const self::C<core::int> c = const self::C::•<core::int>(0);
+ self::C<core::int> c2 = c;
+ const self::D<core::int> d = const self::D::•<core::int>();
+}
diff --git a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_downwards_from_constructor.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_downwards_from_constructor.dart.direct.transformed.expect
new file mode 100644
index 0000000..1e8e0c0
--- /dev/null
+++ b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_downwards_from_constructor.dart.direct.transformed.expect
@@ -0,0 +1,15 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class C<T extends core::Object> extends core::Object {
+ constructor •(core::List<self::C::T> list) → void
+ : super core::Object::•()
+ ;
+}
+static method main() → dynamic {
+ dynamic x = new self::C::•<dynamic>(<dynamic>[123]);
+ self::C<core::int> y = x;
+ dynamic a = new self::C::•<dynamic>(<dynamic>[123]);
+ dynamic b = new self::C::•<core::Object>(<dynamic>[123]);
+}
diff --git a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_downwards_from_constructor.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_downwards_from_constructor.dart.strong.transformed.expect
new file mode 100644
index 0000000..2950d68
--- /dev/null
+++ b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_downwards_from_constructor.dart.strong.transformed.expect
@@ -0,0 +1,15 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class C<T extends core::Object> extends core::Object {
+ constructor •(core::List<self::C::T> list) → void
+ : super core::Object::•()
+ ;
+}
+static method main() → dynamic {
+ self::C<core::int> x = new self::C::•<core::int>(<core::int>[123]);
+ self::C<core::int> y = x;
+ self::C<dynamic> a = new self::C::•<dynamic>(<dynamic>[123]);
+ self::C<core::Object> b = new self::C::•<core::Object>(<core::Object>[123]);
+}
diff --git a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_factory.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_factory.dart.direct.transformed.expect
new file mode 100644
index 0000000..c9e1108
--- /dev/null
+++ b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_factory.dart.direct.transformed.expect
@@ -0,0 +1,20 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class C<T extends core::Object> extends core::Object {
+ field self::C::T t = null;
+ constructor _() → void
+ : super core::Object::•()
+ ;
+ static factory •<T extends core::Object>(self::C::•::T t) → self::C<self::C::•::T> {
+ dynamic x = new self::C::_<self::C::•::T>();
+ x.t = t;
+ return x;
+ }
+}
+static method test() → dynamic {
+ dynamic x = self::C::•<dynamic>(42);
+ x.t = "hello";
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_factory.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_factory.dart.strong.transformed.expect
new file mode 100644
index 0000000..5d9e9d6
--- /dev/null
+++ b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_factory.dart.strong.transformed.expect
@@ -0,0 +1,23 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class C<T extends core::Object> extends core::Object {
+ generic-covariant-impl generic-covariant-interface field self::C::T t = null;
+ constructor _() → void
+ : super core::Object::•()
+ ;
+ static factory •<T extends core::Object>(self::C::•::T t) → self::C<self::C::•::T> {
+ self::C<self::C::•::T> x = new self::C::_<self::C::•::T>();
+ x.{self::C::t} = t;
+ return x;
+ }
+}
+static method test() → dynamic {
+ self::C<core::int> x = self::C::•<core::int>(42);
+ x.{self::C::t} = let final core::String #t1 = "hello" in let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/inference/constructors_infer_from_arguments_factory.dart:22:56: Error: A value of type 'dart.core::String' can't be assigned to a variable of type 'dart.core::int'.
+Try changing the type of the left hand side, or casting the right hand side to 'dart.core::int'.
+ x. /*@target=C::t*/ t = /*error:INVALID_ASSIGNMENT*/ 'hello';
+ ^";
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_factory_calls_constructor.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_factory_calls_constructor.dart.direct.transformed.expect
new file mode 100644
index 0000000..538fd28
--- /dev/null
+++ b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_factory_calls_constructor.dart.direct.transformed.expect
@@ -0,0 +1,15 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class A<T extends core::Object> extends core::Object {
+ field self::A<self::A::T> f = new self::A::•<dynamic>();
+ constructor •() → void
+ : super core::Object::•()
+ ;
+ static factory factory<T extends core::Object>() → self::A<self::A::factory::T>
+ return new self::A::•<dynamic>();
+ method m() → self::A<self::A::T>
+ return new self::A::•<dynamic>();
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_factory_calls_constructor.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_factory_calls_constructor.dart.strong.transformed.expect
new file mode 100644
index 0000000..ba0820f
--- /dev/null
+++ b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_factory_calls_constructor.dart.strong.transformed.expect
@@ -0,0 +1,15 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class A<T extends core::Object> extends core::Object {
+ generic-covariant-impl generic-covariant-interface field self::A<self::A::T> f = new self::A::•<self::A::T>();
+ constructor •() → void
+ : super core::Object::•()
+ ;
+ static factory factory<T extends core::Object>() → self::A<self::A::factory::T>
+ return new self::A::•<self::A::factory::T>();
+ method m() → self::A<self::A::T>
+ return new self::A::•<self::A::T>();
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_named.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_named.dart.direct.transformed.expect
new file mode 100644
index 0000000..f244bce
--- /dev/null
+++ b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_named.dart.direct.transformed.expect
@@ -0,0 +1,13 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class C<T extends core::Object> extends core::Object {
+ field self::C::T t = null;
+ constructor named(core::List<self::C::T> t) → void
+ : super core::Object::•()
+ ;
+}
+static method main() → dynamic {
+ dynamic x = new self::C::named<dynamic>(<core::int>[]);
+}
diff --git a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_named.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_named.dart.strong.transformed.expect
new file mode 100644
index 0000000..0e487ea
--- /dev/null
+++ b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_named.dart.strong.transformed.expect
@@ -0,0 +1,13 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class C<T extends core::Object> extends core::Object {
+ generic-covariant-impl generic-covariant-interface field self::C::T t = null;
+ constructor named(core::List<self::C::T> t) → void
+ : super core::Object::•()
+ ;
+}
+static method main() → dynamic {
+ self::C<core::int> x = new self::C::named<core::int>(<core::int>[]);
+}
diff --git a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_named_factory.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_named_factory.dart.direct.transformed.expect
new file mode 100644
index 0000000..b56ab2c
--- /dev/null
+++ b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_named_factory.dart.direct.transformed.expect
@@ -0,0 +1,18 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class C<T extends core::Object> extends core::Object {
+ field self::C::T t = null;
+ constructor •() → void
+ : super core::Object::•()
+ ;
+ static factory named<T extends core::Object>(self::C::named::T t) → self::C<self::C::named::T> {
+ dynamic x = new self::C::•<self::C::named::T>();
+ x.t = t;
+ return x;
+ }
+}
+static method main() → dynamic {
+ dynamic x = self::C::named<dynamic>(42);
+}
diff --git a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_named_factory.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_named_factory.dart.strong.transformed.expect
new file mode 100644
index 0000000..1b757b3
--- /dev/null
+++ b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_named_factory.dart.strong.transformed.expect
@@ -0,0 +1,18 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class C<T extends core::Object> extends core::Object {
+ generic-covariant-impl generic-covariant-interface field self::C::T t = null;
+ constructor •() → void
+ : super core::Object::•()
+ ;
+ static factory named<T extends core::Object>(self::C::named::T t) → self::C<self::C::named::T> {
+ self::C<self::C::named::T> x = new self::C::•<self::C::named::T>();
+ x.{self::C::t} = t;
+ return x;
+ }
+}
+static method main() → dynamic {
+ self::C<core::int> x = self::C::named<core::int>(42);
+}
diff --git a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting.dart.direct.transformed.expect
new file mode 100644
index 0000000..41cb4fa
--- /dev/null
+++ b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting.dart.direct.transformed.expect
@@ -0,0 +1,16 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class C<T extends core::Object> extends core::Object {
+ field self::C::T t;
+ constructor •(self::C::T t) → void
+ : self::C::t = t, super core::Object::•()
+ ;
+ constructor named(core::List<self::C::T> t) → void
+ : this self::C::•(t.[](0))
+ ;
+}
+static method main() → dynamic {
+ dynamic x = new self::C::named<dynamic>(<core::int>[42]);
+}
diff --git a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting.dart.strong.transformed.expect
new file mode 100644
index 0000000..d250ca0
--- /dev/null
+++ b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting.dart.strong.transformed.expect
@@ -0,0 +1,16 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class C<T extends core::Object> extends core::Object {
+ generic-covariant-impl generic-covariant-interface field self::C::T t;
+ constructor •(self::C::T t) → void
+ : self::C::t = t, super core::Object::•()
+ ;
+ constructor named(core::List<self::C::T> t) → void
+ : this self::C::•(t.{core::List::[]}(0))
+ ;
+}
+static method main() → dynamic {
+ self::C<core::int> x = new self::C::named<core::int>(<core::int>[42]);
+}
diff --git a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory.dart.direct.transformed.expect
new file mode 100644
index 0000000..d2fa30a
--- /dev/null
+++ b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory.dart.direct.transformed.expect
@@ -0,0 +1,20 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+abstract class C<T extends core::Object> extends core::Object {
+ static field dynamic _redirecting# = <dynamic>[self::C::•];
+ abstract get t() → self::C::T;
+ abstract set t(self::C::T x) → void;
+ static factory •<T extends core::Object>(self::C::•::T t) → self::C<self::C::•::T>
+ let dynamic #redirecting_factory = self::CImpl::• in let self::C::•::T #typeArg0 = null in invalid-expression;
+}
+class CImpl<T extends core::Object> extends core::Object implements self::C<self::CImpl::T> {
+ field self::CImpl::T t;
+ constructor •(self::CImpl::T t) → void
+ : self::CImpl::t = t, super core::Object::•()
+ ;
+}
+static method main() → dynamic {
+ dynamic x = new self::CImpl::•<dynamic>(42);
+}
diff --git a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory.dart.strong.transformed.expect
new file mode 100644
index 0000000..b46bcd1
--- /dev/null
+++ b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory.dart.strong.transformed.expect
@@ -0,0 +1,20 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+abstract class C<T extends core::Object> extends core::Object {
+ static field dynamic _redirecting# = <dynamic>[self::C::•];
+ abstract get t() → self::C::T;
+ abstract set t(generic-covariant-impl generic-covariant-interface self::C::T x) → void;
+ static factory •<T extends core::Object>(self::C::•::T t) → self::C<self::C::•::T>
+ let<BottomType> #redirecting_factory = self::CImpl::• in let self::C::•::T #typeArg0 = null in invalid-expression;
+}
+class CImpl<T extends core::Object> extends core::Object implements self::C<self::CImpl::T> {
+ generic-covariant-impl generic-covariant-interface field self::CImpl::T t;
+ constructor •(self::CImpl::T t) → void
+ : self::CImpl::t = t, super core::Object::•()
+ ;
+}
+static method main() → dynamic {
+ self::C<core::int> x = new self::CImpl::•<core::int>(42);
+}
diff --git a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory_to_factory.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory_to_factory.dart.direct.transformed.expect
new file mode 100644
index 0000000..1975274
--- /dev/null
+++ b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory_to_factory.dart.direct.transformed.expect
@@ -0,0 +1,22 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+abstract class C<T extends core::Object> extends core::Object {
+ static field dynamic _redirecting# = <dynamic>[self::C::•];
+ abstract get t() → self::C::T;
+ abstract set t(self::C::T x) → void;
+ static factory •<T extends core::Object>(self::C::•::T t) → self::C<self::C::•::T>
+ let dynamic #redirecting_factory = self::CImpl::• in let self::C::•::T #typeArg0 = null in invalid-expression;
+}
+class CImpl<T extends core::Object> extends core::Object implements self::C<self::CImpl::T> {
+ field self::CImpl::T t;
+ constructor _(self::CImpl::T t) → void
+ : self::CImpl::t = t, super core::Object::•()
+ ;
+ static factory •<T extends core::Object>(self::CImpl::•::T t) → self::CImpl<self::CImpl::•::T>
+ return new self::CImpl::_<dynamic>(t);
+}
+static method main() → dynamic {
+ dynamic x = self::CImpl::•<dynamic>(42);
+}
diff --git a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory_to_factory.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory_to_factory.dart.strong.transformed.expect
new file mode 100644
index 0000000..e599360
--- /dev/null
+++ b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory_to_factory.dart.strong.transformed.expect
@@ -0,0 +1,22 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+abstract class C<T extends core::Object> extends core::Object {
+ static field dynamic _redirecting# = <dynamic>[self::C::•];
+ abstract get t() → self::C::T;
+ abstract set t(generic-covariant-impl generic-covariant-interface self::C::T x) → void;
+ static factory •<T extends core::Object>(self::C::•::T t) → self::C<self::C::•::T>
+ let <T extends core::Object>(self::CImpl::•::T) → self::CImpl<self::CImpl::•::T> #redirecting_factory = self::CImpl::• in let self::C::•::T #typeArg0 = null in invalid-expression;
+}
+class CImpl<T extends core::Object> extends core::Object implements self::C<self::CImpl::T> {
+ generic-covariant-impl generic-covariant-interface field self::CImpl::T t;
+ constructor _(self::CImpl::T t) → void
+ : self::CImpl::t = t, super core::Object::•()
+ ;
+ static factory •<T extends core::Object>(self::CImpl::•::T t) → self::CImpl<self::CImpl::•::T>
+ return new self::CImpl::_<self::CImpl::•::T>(t);
+}
+static method main() → dynamic {
+ self::C<core::int> x = self::CImpl::•<core::int>(42);
+}
diff --git a/pkg/front_end/testcases/inference/constructors_inference_f_bounded.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/constructors_inference_f_bounded.dart.direct.transformed.expect
new file mode 100644
index 0000000..25d5c94
--- /dev/null
+++ b/pkg/front_end/testcases/inference/constructors_inference_f_bounded.dart.direct.transformed.expect
@@ -0,0 +1,24 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class Clonable<T extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class Pair<T extends self::Clonable<self::Pair::T>, U extends self::Clonable<self::Pair::U>> extends core::Object {
+ field self::Pair::T t;
+ field self::Pair::U u;
+ constructor •(self::Pair::T t, self::Pair::U u) → void
+ : self::Pair::t = t, self::Pair::u = u, super core::Object::•()
+ ;
+ constructor _() → void
+ : self::Pair::u = null, self::Pair::t = null, super core::Object::•()
+ ;
+ get reversed() → self::Pair<self::Pair::U, self::Pair::T>
+ return new self::Pair::•<dynamic, dynamic>(this.{self::Pair::u}, this.{self::Pair::t});
+}
+static method main() → dynamic {
+ final dynamic x = new self::Pair::_<dynamic, dynamic>();
+}
diff --git a/pkg/front_end/testcases/inference/constructors_inference_f_bounded.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/constructors_inference_f_bounded.dart.strong.transformed.expect
new file mode 100644
index 0000000..6b36422
--- /dev/null
+++ b/pkg/front_end/testcases/inference/constructors_inference_f_bounded.dart.strong.transformed.expect
@@ -0,0 +1,27 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class Clonable<T extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class Pair<T extends self::Clonable<self::Pair::T>, U extends self::Clonable<self::Pair::U>> extends core::Object {
+ generic-covariant-impl generic-covariant-interface field self::Pair::T t;
+ generic-covariant-impl generic-covariant-interface field self::Pair::U u;
+ constructor •(self::Pair::T t, self::Pair::U u) → void
+ : self::Pair::t = t, self::Pair::u = u, super core::Object::•()
+ ;
+ constructor _() → void
+ : self::Pair::u = null, self::Pair::t = null, super core::Object::•()
+ ;
+ get reversed() → self::Pair<self::Pair::U, self::Pair::T>
+ return new self::Pair::•<self::Pair::U, self::Pair::T>(this.{self::Pair::u}, this.{self::Pair::t});
+}
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/inference/constructors_inference_f_bounded.dart:22:110: Error: Can't use a super-bounded type for instance creation. Got 'test::Pair<test::Clonable<dynamic>, test::Clonable<dynamic>>'.
+ new /*error:COULD_NOT_INFER,error:COULD_NOT_INFER*/ /*@typeArgs=Clonable<dynamic>, Clonable<dynamic>*/ Pair
+ ^"]/* from null */;
+static method main() → dynamic {
+ final self::Pair<self::Clonable<dynamic>, self::Clonable<dynamic>> x = new self::Pair::_<self::Clonable<dynamic>, self::Clonable<dynamic>>();
+}
diff --git a/pkg/front_end/testcases/inference/constructors_reverse_type_parameters.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/constructors_reverse_type_parameters.dart.direct.transformed.expect
new file mode 100644
index 0000000..dcf34f0
--- /dev/null
+++ b/pkg/front_end/testcases/inference/constructors_reverse_type_parameters.dart.direct.transformed.expect
@@ -0,0 +1,14 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class Pair<T extends core::Object, U extends core::Object> extends core::Object {
+ field self::Pair::T t;
+ field self::Pair::U u;
+ constructor •(self::Pair::T t, self::Pair::U u) → void
+ : self::Pair::t = t, self::Pair::u = u, super core::Object::•()
+ ;
+ get reversed() → self::Pair<self::Pair::U, self::Pair::T>
+ return new self::Pair::•<dynamic, dynamic>(this.{self::Pair::u}, this.{self::Pair::t});
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/constructors_reverse_type_parameters.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/constructors_reverse_type_parameters.dart.strong.transformed.expect
new file mode 100644
index 0000000..7db8910
--- /dev/null
+++ b/pkg/front_end/testcases/inference/constructors_reverse_type_parameters.dart.strong.transformed.expect
@@ -0,0 +1,14 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class Pair<T extends core::Object, U extends core::Object> extends core::Object {
+ generic-covariant-impl generic-covariant-interface field self::Pair::T t;
+ generic-covariant-impl generic-covariant-interface field self::Pair::U u;
+ constructor •(self::Pair::T t, self::Pair::U u) → void
+ : self::Pair::t = t, self::Pair::u = u, super core::Object::•()
+ ;
+ get reversed() → self::Pair<self::Pair::U, self::Pair::T>
+ return new self::Pair::•<self::Pair::U, self::Pair::T>(this.{self::Pair::u}, this.{self::Pair::t});
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/do_not_infer_overridden_fields_that_explicitly_say_dynamic_infer.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/do_not_infer_overridden_fields_that_explicitly_say_dynamic_infer.dart.direct.transformed.expect
new file mode 100644
index 0000000..015c282
--- /dev/null
+++ b/pkg/front_end/testcases/inference/do_not_infer_overridden_fields_that_explicitly_say_dynamic_infer.dart.direct.transformed.expect
@@ -0,0 +1,24 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class A extends core::Object {
+ final field core::int x = 2;
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class B extends core::Object implements self::A {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ get x() → dynamic
+ return 3;
+}
+static method foo() → dynamic {
+ core::String y = new self::B::•().x;
+ core::int z = new self::B::•().x;
+}
+static method main() → dynamic {
+ self::foo();
+}
diff --git a/pkg/front_end/testcases/inference/dont_infer_field_type_when_initializer_is_null.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/dont_infer_field_type_when_initializer_is_null.dart.direct.transformed.expect
new file mode 100644
index 0000000..e5d7297
--- /dev/null
+++ b/pkg/front_end/testcases/inference/dont_infer_field_type_when_initializer_is_null.dart.direct.transformed.expect
@@ -0,0 +1,19 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class A extends core::Object {
+ static field dynamic x = null;
+ static field dynamic y = 3;
+ field dynamic x2 = null;
+ field dynamic y2 = 3;
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static field dynamic x = null;
+static field dynamic y = 3;
+static method main() → dynamic {
+ self::x;
+ self::y;
+}
diff --git a/pkg/front_end/testcases/inference/dont_infer_field_type_when_initializer_is_null.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/dont_infer_field_type_when_initializer_is_null.dart.strong.transformed.expect
new file mode 100644
index 0000000..6bdbf8c
--- /dev/null
+++ b/pkg/front_end/testcases/inference/dont_infer_field_type_when_initializer_is_null.dart.strong.transformed.expect
@@ -0,0 +1,19 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class A extends core::Object {
+ static field dynamic x = null;
+ static field core::int y = 3;
+ field dynamic x2 = null;
+ field core::int y2 = 3;
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static field dynamic x = null;
+static field core::int y = 3;
+static method main() → dynamic {
+ self::x;
+ self::y;
+}
diff --git a/pkg/front_end/testcases/inference/dont_infer_type_on_dynamic.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/dont_infer_type_on_dynamic.dart.direct.transformed.expect
new file mode 100644
index 0000000..6fc489d
--- /dev/null
+++ b/pkg/front_end/testcases/inference/dont_infer_type_on_dynamic.dart.direct.transformed.expect
@@ -0,0 +1,10 @@
+library test;
+import self as self;
+
+static method test() → dynamic {
+ dynamic x = 3;
+ x = "hi";
+}
+static method main() → dynamic {
+ self::test();
+}
diff --git a/pkg/front_end/testcases/inference/dont_infer_type_on_dynamic.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/dont_infer_type_on_dynamic.dart.strong.transformed.expect
new file mode 100644
index 0000000..6fc489d
--- /dev/null
+++ b/pkg/front_end/testcases/inference/dont_infer_type_on_dynamic.dart.strong.transformed.expect
@@ -0,0 +1,10 @@
+library test;
+import self as self;
+
+static method test() → dynamic {
+ dynamic x = 3;
+ x = "hi";
+}
+static method main() → dynamic {
+ self::test();
+}
diff --git a/pkg/front_end/testcases/inference/dont_infer_type_when_initializer_is_null.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/dont_infer_type_when_initializer_is_null.dart.direct.transformed.expect
new file mode 100644
index 0000000..7dd89fd
--- /dev/null
+++ b/pkg/front_end/testcases/inference/dont_infer_type_when_initializer_is_null.dart.direct.transformed.expect
@@ -0,0 +1,11 @@
+library test;
+import self as self;
+
+static method test() → dynamic {
+ dynamic x = null;
+ x = "hi";
+ x = 3;
+}
+static method main() → dynamic {
+ self::test();
+}
diff --git a/pkg/front_end/testcases/inference/dont_infer_type_when_initializer_is_null.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/dont_infer_type_when_initializer_is_null.dart.strong.transformed.expect
new file mode 100644
index 0000000..7dd89fd
--- /dev/null
+++ b/pkg/front_end/testcases/inference/dont_infer_type_when_initializer_is_null.dart.strong.transformed.expect
@@ -0,0 +1,11 @@
+library test;
+import self as self;
+
+static method test() → dynamic {
+ dynamic x = null;
+ x = "hi";
+ x = 3;
+}
+static method main() → dynamic {
+ self::test();
+}
diff --git a/pkg/front_end/testcases/inference/downward_inference_fixes_no_upwards_errors.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/downward_inference_fixes_no_upwards_errors.dart.direct.transformed.expect
new file mode 100644
index 0000000..c510acf
--- /dev/null
+++ b/pkg/front_end/testcases/inference/downward_inference_fixes_no_upwards_errors.dart.direct.transformed.expect
@@ -0,0 +1,14 @@
+library test;
+import self as self;
+import "dart:core" as core;
+import "dart:math" as math;
+
+static method f() → dynamic {
+ core::num x;
+ dynamic y;
+ core::num a = math::max<dynamic>(x, y);
+ core::Object b = math::max<dynamic>(x, y);
+ dynamic c = math::max<dynamic>(x, y);
+ dynamic d = math::max<dynamic>(x, y);
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/downward_inference_fixes_no_upwards_errors.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/downward_inference_fixes_no_upwards_errors.dart.strong.transformed.expect
new file mode 100644
index 0000000..43da4369
--- /dev/null
+++ b/pkg/front_end/testcases/inference/downward_inference_fixes_no_upwards_errors.dart.strong.transformed.expect
@@ -0,0 +1,14 @@
+library test;
+import self as self;
+import "dart:core" as core;
+import "dart:math" as math;
+
+static method f() → dynamic {
+ core::num x;
+ dynamic y;
+ core::num a = math::max<core::num>(x, y as{TypeError} core::num);
+ core::Object b = math::max<core::num>(x, y as{TypeError} core::num);
+ dynamic c = math::max<dynamic>(x, y);
+ dynamic d = math::max<dynamic>(x, y);
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/downward_inference_miscellaneous.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/downward_inference_miscellaneous.dart.direct.transformed.expect
new file mode 100644
index 0000000..3fbf5b6
--- /dev/null
+++ b/pkg/front_end/testcases/inference/downward_inference_miscellaneous.dart.direct.transformed.expect
@@ -0,0 +1,25 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+typedef Function2<S extends core::Object, T extends core::Object> = (S) → T;
+class A<T extends core::Object> extends core::Object {
+ field (self::A::T) → self::A::T x;
+ constructor •((self::A::T) → self::A::T x) → void
+ : self::A::x = x, super core::Object::•()
+ ;
+}
+static method main() → void {
+ {
+ dynamic x = "hello";
+ dynamic y = 3;
+ function f(core::List<core::Map<core::int, core::String>> l) → void {}
+ ;
+ f.call(<dynamic>[<dynamic, dynamic>{y: x}]);
+ }
+ {
+ function f(core::int x) → core::int
+ return 0;
+ self::A<core::int> a = new self::A::•<dynamic>(f);
+ }
+}
diff --git a/pkg/front_end/testcases/inference/downward_inference_miscellaneous.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/downward_inference_miscellaneous.dart.strong.transformed.expect
new file mode 100644
index 0000000..33bcd2c
--- /dev/null
+++ b/pkg/front_end/testcases/inference/downward_inference_miscellaneous.dart.strong.transformed.expect
@@ -0,0 +1,25 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+typedef Function2<S extends core::Object, T extends core::Object> = (S) → T;
+class A<T extends core::Object> extends core::Object {
+ generic-covariant-impl generic-covariant-interface generic-contravariant field (self::A::T) → self::A::T x;
+ constructor •((self::A::T) → self::A::T x) → void
+ : self::A::x = x, super core::Object::•()
+ ;
+}
+static method main() → void {
+ {
+ core::String x = "hello";
+ core::int y = 3;
+ function f(core::List<core::Map<core::int, core::String>> l) → void {}
+ ;
+ f.call(<core::Map<core::int, core::String>>[<core::int, core::String>{y: x}]);
+ }
+ {
+ function f(core::int x) → core::int
+ return 0;
+ self::A<core::int> a = new self::A::•<core::int>(f);
+ }
+}
diff --git a/pkg/front_end/testcases/inference/downwards_context_from_inferred_field_type.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/downwards_context_from_inferred_field_type.dart.direct.transformed.expect
new file mode 100644
index 0000000..95f7601
--- /dev/null
+++ b/pkg/front_end/testcases/inference/downwards_context_from_inferred_field_type.dart.direct.transformed.expect
@@ -0,0 +1,17 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+abstract class A extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ abstract get foo() → core::Iterable<core::String>;
+}
+class B extends core::Object implements self::A {
+ final field dynamic foo = const <dynamic>[];
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static method main() → void {}
diff --git a/pkg/front_end/testcases/inference/downwards_context_from_inferred_field_type.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/downwards_context_from_inferred_field_type.dart.strong.transformed.expect
new file mode 100644
index 0000000..f7a8373
--- /dev/null
+++ b/pkg/front_end/testcases/inference/downwards_context_from_inferred_field_type.dart.strong.transformed.expect
@@ -0,0 +1,17 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+abstract class A extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ abstract get foo() → core::Iterable<core::String>;
+}
+class B extends core::Object implements self::A {
+ final field core::Iterable<core::String> foo = const <core::String>[];
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static method main() → void {}
diff --git a/pkg/front_end/testcases/inference/downwards_inference_annotations.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/downwards_inference_annotations.dart.direct.transformed.expect
new file mode 100644
index 0000000..38617da
--- /dev/null
+++ b/pkg/front_end/testcases/inference/downwards_inference_annotations.dart.direct.transformed.expect
@@ -0,0 +1,25 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class Foo extends core::Object {
+ const constructor •(core::List<core::String> l) → void
+ : super core::Object::•()
+ ;
+ const constructor named(core::List<core::String> l) → void
+ : super core::Object::•()
+ ;
+}
+@self::Foo::•(const <dynamic>[])
+class Bar extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+@self::Foo::named(const <dynamic>[])
+class Baz extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/downwards_inference_annotations.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/downwards_inference_annotations.dart.strong.transformed.expect
new file mode 100644
index 0000000..010338c
--- /dev/null
+++ b/pkg/front_end/testcases/inference/downwards_inference_annotations.dart.strong.transformed.expect
@@ -0,0 +1,25 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class Foo extends core::Object {
+ const constructor •(core::List<core::String> l) → void
+ : super core::Object::•()
+ ;
+ const constructor named(core::List<core::String> l) → void
+ : super core::Object::•()
+ ;
+}
+@self::Foo::•(const <core::String>[])
+class Bar extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+@self::Foo::named(const <core::String>[])
+class Baz extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/downwards_inference_annotations_class_members.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/downwards_inference_annotations_class_members.dart.direct.transformed.expect
new file mode 100644
index 0000000..56934bc
--- /dev/null
+++ b/pkg/front_end/testcases/inference/downwards_inference_annotations_class_members.dart.direct.transformed.expect
@@ -0,0 +1,20 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class Foo extends core::Object {
+ const constructor •(core::List<core::String> l) → void
+ : super core::Object::•()
+ ;
+}
+abstract class Bar extends core::Object {
+ @self::Foo::•(const <dynamic>[])
+ field dynamic x = null;
+ @self::Foo::•(const <dynamic>[])
+ constructor •() → void
+ : super core::Object::•()
+ ;
+ @self::Foo::•(const <dynamic>[])
+ abstract method f() → void;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/downwards_inference_annotations_class_members.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/downwards_inference_annotations_class_members.dart.strong.transformed.expect
new file mode 100644
index 0000000..32a28d4
--- /dev/null
+++ b/pkg/front_end/testcases/inference/downwards_inference_annotations_class_members.dart.strong.transformed.expect
@@ -0,0 +1,20 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class Foo extends core::Object {
+ const constructor •(core::List<core::String> l) → void
+ : super core::Object::•()
+ ;
+}
+abstract class Bar extends core::Object {
+ @self::Foo::•(const <core::String>[])
+ field dynamic x = null;
+ @self::Foo::•(const <core::String>[])
+ constructor •() → void
+ : super core::Object::•()
+ ;
+ @self::Foo::•(const <core::String>[])
+ abstract method f() → void;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/downwards_inference_annotations_for_loop_variable.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/downwards_inference_annotations_for_loop_variable.dart.direct.transformed.expect
new file mode 100644
index 0000000..84e4744
--- /dev/null
+++ b/pkg/front_end/testcases/inference/downwards_inference_annotations_for_loop_variable.dart.direct.transformed.expect
@@ -0,0 +1,16 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class Foo extends core::Object {
+ const constructor •(core::List<core::String> l) → void
+ : super core::Object::•()
+ ;
+}
+static method test() → void {
+ for (core::int i = 0; i.<(1); i = i.+(1)) {
+ }
+ for (core::int i in <dynamic>[0]) {
+ }
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/downwards_inference_annotations_locals_referring_to_locals.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/downwards_inference_annotations_locals_referring_to_locals.dart.direct.transformed.expect
new file mode 100644
index 0000000..d3afdb6
--- /dev/null
+++ b/pkg/front_end/testcases/inference/downwards_inference_annotations_locals_referring_to_locals.dart.direct.transformed.expect
@@ -0,0 +1,14 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class Foo extends core::Object {
+ const constructor •(dynamic l) → void
+ : super core::Object::•()
+ ;
+}
+static method test() → void {
+ const dynamic x = 0;
+ dynamic y;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/downwards_inference_annotations_parameter.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/downwards_inference_annotations_parameter.dart.direct.transformed.expect
new file mode 100644
index 0000000..306b574
--- /dev/null
+++ b/pkg/front_end/testcases/inference/downwards_inference_annotations_parameter.dart.direct.transformed.expect
@@ -0,0 +1,17 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class Foo extends core::Object {
+ const constructor •(core::List<core::String> l) → void
+ : super core::Object::•()
+ ;
+}
+class C extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method m(dynamic x) → void {}
+}
+static method f(dynamic x) → void {}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/downwards_inference_annotations_parameter_local.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/downwards_inference_annotations_parameter_local.dart.direct.transformed.expect
new file mode 100644
index 0000000..d53d84c
--- /dev/null
+++ b/pkg/front_end/testcases/inference/downwards_inference_annotations_parameter_local.dart.direct.transformed.expect
@@ -0,0 +1,14 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class Foo extends core::Object {
+ const constructor •(core::List<core::String> l) → void
+ : super core::Object::•()
+ ;
+}
+static method test() → void {
+ function f(dynamic x) → void {}
+ dynamic x = (dynamic x) → dynamic {};
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/downwards_inference_annotations_type_variable.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/downwards_inference_annotations_type_variable.dart.direct.transformed.expect
new file mode 100644
index 0000000..c798f57
--- /dev/null
+++ b/pkg/front_end/testcases/inference/downwards_inference_annotations_type_variable.dart.direct.transformed.expect
@@ -0,0 +1,23 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+typedef F<T extends core::Object> = () → void;
+class Foo extends core::Object {
+ const constructor •(core::List<core::String> l) → void
+ : super core::Object::•()
+ ;
+}
+class C<T extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class D extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method m<T extends core::Object>() → void {}
+}
+static method f<T extends core::Object>() → void {}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/downwards_inference_annotations_type_variable_local.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/downwards_inference_annotations_type_variable_local.dart.direct.transformed.expect
new file mode 100644
index 0000000..4d24a73
--- /dev/null
+++ b/pkg/front_end/testcases/inference/downwards_inference_annotations_type_variable_local.dart.direct.transformed.expect
@@ -0,0 +1,14 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class Foo extends core::Object {
+ const constructor •(core::List<core::String> l) → void
+ : super core::Object::•()
+ ;
+}
+static method test() → void {
+ function f<T extends core::Object>() → void {}
+ dynamic x = <T extends core::Object>() → dynamic {};
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/downwards_inference_annotations_typedef.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/downwards_inference_annotations_typedef.dart.direct.transformed.expect
new file mode 100644
index 0000000..b644cd1
--- /dev/null
+++ b/pkg/front_end/testcases/inference/downwards_inference_annotations_typedef.dart.direct.transformed.expect
@@ -0,0 +1,12 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+@self::Foo::•(const <dynamic>[])
+typedef F = () → void;
+class Foo extends core::Object {
+ const constructor •(core::List<core::String> l) → void
+ : super core::Object::•()
+ ;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/downwards_inference_annotations_typedef.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/downwards_inference_annotations_typedef.dart.strong.transformed.expect
new file mode 100644
index 0000000..848f2f0
--- /dev/null
+++ b/pkg/front_end/testcases/inference/downwards_inference_annotations_typedef.dart.strong.transformed.expect
@@ -0,0 +1,12 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+@self::Foo::•(const <core::String>[])
+typedef F = () → void;
+class Foo extends core::Object {
+ const constructor •(core::List<core::String> l) → void
+ : super core::Object::•()
+ ;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/downwards_inference_assignment_statements.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/downwards_inference_assignment_statements.dart.direct.transformed.expect
new file mode 100644
index 0000000..e801592
--- /dev/null
+++ b/pkg/front_end/testcases/inference/downwards_inference_assignment_statements.dart.direct.transformed.expect
@@ -0,0 +1,10 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+static method test() → void {
+ core::List<core::int> l;
+ l = <dynamic>["hello"];
+ l = l = <dynamic>[1];
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/downwards_inference_assignment_statements.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/downwards_inference_assignment_statements.dart.strong.transformed.expect
new file mode 100644
index 0000000..f630d02
--- /dev/null
+++ b/pkg/front_end/testcases/inference/downwards_inference_assignment_statements.dart.strong.transformed.expect
@@ -0,0 +1,13 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+static method test() → void {
+ core::List<core::int> l;
+ l = <core::int>[let final core::String #t1 = "hello" in let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/inference/downwards_inference_assignment_statements.dart:10:69: Error: A value of type 'dart.core::String' can't be assigned to a variable of type 'dart.core::int'.
+Try changing the type of the left hand side, or casting the right hand side to 'dart.core::int'.
+ l = /*@typeArgs=int*/ [/*error:LIST_ELEMENT_TYPE_NOT_ASSIGNABLE*/ \"hello\"];
+ ^"];
+ l = l = <core::int>[1];
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/downwards_inference_async_await.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/downwards_inference_async_await.dart.direct.transformed.expect
new file mode 100644
index 0000000..126c90b
--- /dev/null
+++ b/pkg/front_end/testcases/inference/downwards_inference_async_await.dart.direct.transformed.expect
@@ -0,0 +1,36 @@
+library test;
+import self as self;
+import "dart:async" as asy;
+import "dart:core" as core;
+
+static method main() → asy::Future<dynamic> /* originally async */ {
+ final asy::Completer<dynamic> :completer = asy::Completer::sync<dynamic>();
+ asy::FutureOr<dynamic> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ dynamic :saved_try_context_var0;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L1:
+ {
+ dynamic d;
+ [yield] let dynamic #t1 = asy::_awaitHelper(<dynamic>[d], :async_op_then, :async_op_error, :async_op) in null;
+ core::List<core::int> l0 = :result;
+ [yield] let dynamic #t2 = asy::_awaitHelper(asy::Future::value<dynamic>(<dynamic>[d]), :async_op_then, :async_op_error, :async_op) in null;
+ core::List<core::int> l1 = :result;
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+}
diff --git a/pkg/front_end/testcases/inference/downwards_inference_async_await.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/downwards_inference_async_await.dart.strong.transformed.expect
new file mode 100644
index 0000000..c7716b6
--- /dev/null
+++ b/pkg/front_end/testcases/inference/downwards_inference_async_await.dart.strong.transformed.expect
@@ -0,0 +1,36 @@
+library test;
+import self as self;
+import "dart:async" as asy;
+import "dart:core" as core;
+
+static method main() → asy::Future<dynamic> /* originally async */ {
+ final asy::Completer<dynamic> :completer = asy::Completer::sync<dynamic>();
+ asy::FutureOr<dynamic> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ dynamic :saved_try_context_var0;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L1:
+ {
+ dynamic d;
+ [yield] let dynamic #t1 = asy::_awaitHelper(<core::int>[d as{TypeError} core::int], :async_op_then, :async_op_error, :async_op) in null;
+ core::List<core::int> l0 = :result;
+ [yield] let dynamic #t2 = asy::_awaitHelper(asy::Future::value<core::List<core::int>>(<core::int>[d as{TypeError} core::int]), :async_op_then, :async_op_error, :async_op) in null;
+ core::List<core::int> l1 = :result;
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+}
diff --git a/pkg/front_end/testcases/inference/downwards_inference_for_each.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/downwards_inference_for_each.dart.direct.transformed.expect
new file mode 100644
index 0000000..ef5dc3a
--- /dev/null
+++ b/pkg/front_end/testcases/inference/downwards_inference_for_each.dart.direct.transformed.expect
@@ -0,0 +1,226 @@
+library test;
+import self as self;
+import "dart:core" as core;
+import "dart:async" as asy;
+
+abstract class MyStream<T extends core::Object> extends asy::Stream<self::MyStream::T> {
+ static factory •<T extends core::Object>() → self::MyStream<self::MyStream::•::T>
+ return null;
+}
+static method F<T extends core::Object>() → self::F::T
+ return null;
+static method f() → asy::Future<dynamic> /* originally async */ {
+ final asy::Completer<dynamic> :completer = asy::Completer::sync<dynamic>();
+ asy::FutureOr<dynamic> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ dynamic :saved_try_context_var0;
+ dynamic :saved_try_context_var1;
+ dynamic :exception0;
+ dynamic :stack_trace0;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L1:
+ {
+ dynamic d;
+ core::Object o;
+ for (dynamic x in self::F<dynamic>()) {
+ }
+ for (dynamic x in self::F<dynamic>()) {
+ }
+ for (core::Object x in self::F<dynamic>()) {
+ }
+ for (final dynamic #t1 in self::F<dynamic>()) {
+ d = #t1;
+ }
+ for (final dynamic #t2 in self::F<dynamic>()) {
+ o = #t2;
+ }
+ {
+ asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(self::F<dynamic>());
+ try
+ #L2:
+ while (true) {
+ [yield] let dynamic #t3 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null;
+ if(:result) {
+ dynamic x = :for-iterator.{asy::_StreamIterator::current};
+ {}
+ }
+ else
+ break #L2;
+ }
+ finally
+ if(!:for-iterator.{asy::_StreamIterator::_subscription}.{core::Object::==}(null)) {
+ [yield] let dynamic #t4 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::cancel}(), :async_op_then, :async_op_error, :async_op) in null;
+ :result;
+ }
+ }
+ {
+ asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(self::F<dynamic>());
+ try
+ #L3:
+ while (true) {
+ [yield] let dynamic #t5 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null;
+ if(:result) {
+ dynamic x = :for-iterator.{asy::_StreamIterator::current};
+ {}
+ }
+ else
+ break #L3;
+ }
+ finally
+ if(!:for-iterator.{asy::_StreamIterator::_subscription}.{core::Object::==}(null)) {
+ [yield] let dynamic #t6 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::cancel}(), :async_op_then, :async_op_error, :async_op) in null;
+ :result;
+ }
+ }
+ {
+ asy::_StreamIterator<core::Object> :for-iterator = new asy::_StreamIterator::•<core::Object>(self::F<dynamic>());
+ try
+ #L4:
+ while (true) {
+ [yield] let dynamic #t7 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null;
+ if(:result) {
+ core::Object x = :for-iterator.{asy::_StreamIterator::current};
+ {}
+ }
+ else
+ break #L4;
+ }
+ finally
+ if(!:for-iterator.{asy::_StreamIterator::_subscription}.{core::Object::==}(null)) {
+ [yield] let dynamic #t8 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::cancel}(), :async_op_then, :async_op_error, :async_op) in null;
+ :result;
+ }
+ }
+ {
+ asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(self::F<dynamic>());
+ try
+ #L5:
+ while (true) {
+ [yield] let dynamic #t9 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null;
+ if(:result) {
+ final dynamic #t10 = :for-iterator.{asy::_StreamIterator::current};
+ {
+ d = #t10;
+ }
+ }
+ else
+ break #L5;
+ }
+ finally
+ if(!:for-iterator.{asy::_StreamIterator::_subscription}.{core::Object::==}(null)) {
+ [yield] let dynamic #t11 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::cancel}(), :async_op_then, :async_op_error, :async_op) in null;
+ :result;
+ }
+ }
+ {
+ asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(self::F<dynamic>());
+ try
+ #L6:
+ while (true) {
+ [yield] let dynamic #t12 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null;
+ if(:result) {
+ final dynamic #t13 = :for-iterator.{asy::_StreamIterator::current};
+ {
+ o = #t13;
+ }
+ }
+ else
+ break #L6;
+ }
+ finally
+ if(!:for-iterator.{asy::_StreamIterator::_subscription}.{core::Object::==}(null)) {
+ [yield] let dynamic #t14 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::cancel}(), :async_op_then, :async_op_error, :async_op) in null;
+ :result;
+ }
+ }
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+}
+static method main() → asy::Future<dynamic> /* originally async */ {
+ final asy::Completer<dynamic> :completer = asy::Completer::sync<dynamic>();
+ asy::FutureOr<dynamic> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ dynamic :saved_try_context_var0;
+ dynamic :saved_try_context_var1;
+ dynamic :exception0;
+ dynamic :stack_trace0;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L7:
+ {
+ for (core::int x in <dynamic>[1, 2, 3]) {
+ }
+ for (core::num x in <dynamic>[1, 2, 3]) {
+ }
+ for (dynamic x in <dynamic>[1, 2, 3]) {
+ }
+ {
+ asy::_StreamIterator<core::int> :for-iterator = new asy::_StreamIterator::•<core::int>(self::MyStream::•<dynamic>());
+ try
+ #L8:
+ while (true) {
+ [yield] let dynamic #t15 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null;
+ if(:result) {
+ core::int x = :for-iterator.{asy::_StreamIterator::current};
+ {}
+ }
+ else
+ break #L8;
+ }
+ finally
+ if(!:for-iterator.{asy::_StreamIterator::_subscription}.{core::Object::==}(null)) {
+ [yield] let dynamic #t16 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::cancel}(), :async_op_then, :async_op_error, :async_op) in null;
+ :result;
+ }
+ }
+ {
+ asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(self::MyStream::•<core::int>());
+ try
+ #L9:
+ while (true) {
+ [yield] let dynamic #t17 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null;
+ if(:result) {
+ dynamic x = :for-iterator.{asy::_StreamIterator::current};
+ {}
+ }
+ else
+ break #L9;
+ }
+ finally
+ if(!:for-iterator.{asy::_StreamIterator::_subscription}.{core::Object::==}(null)) {
+ [yield] let dynamic #t18 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::cancel}(), :async_op_then, :async_op_error, :async_op) in null;
+ :result;
+ }
+ }
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+}
diff --git a/pkg/front_end/testcases/inference/downwards_inference_for_each.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/downwards_inference_for_each.dart.strong.transformed.expect
new file mode 100644
index 0000000..2138cb0
--- /dev/null
+++ b/pkg/front_end/testcases/inference/downwards_inference_for_each.dart.strong.transformed.expect
@@ -0,0 +1,226 @@
+library test;
+import self as self;
+import "dart:core" as core;
+import "dart:async" as asy;
+
+abstract class MyStream<T extends core::Object> extends asy::Stream<self::MyStream::T> {
+ static factory •<T extends core::Object>() → self::MyStream<self::MyStream::•::T>
+ return null;
+}
+static method F<T extends core::Object>() → self::F::T
+ return null;
+static method f() → asy::Future<dynamic> /* originally async */ {
+ final asy::Completer<dynamic> :completer = asy::Completer::sync<dynamic>();
+ asy::FutureOr<dynamic> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ dynamic :saved_try_context_var0;
+ dynamic :saved_try_context_var1;
+ dynamic :exception0;
+ dynamic :stack_trace0;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L1:
+ {
+ dynamic d;
+ core::Object o;
+ for (dynamic x in self::F<core::Iterable<dynamic>>()) {
+ }
+ for (dynamic x in self::F<core::Iterable<dynamic>>()) {
+ }
+ for (core::Object x in self::F<core::Iterable<core::Object>>()) {
+ }
+ for (final dynamic #t1 in self::F<core::Iterable<dynamic>>()) {
+ d = #t1;
+ }
+ for (final core::Object #t2 in self::F<core::Iterable<core::Object>>()) {
+ o = #t2;
+ }
+ {
+ asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(self::F<asy::Stream<dynamic>>());
+ try
+ #L2:
+ while (true) {
+ [yield] let dynamic #t3 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null;
+ if(:result) {
+ dynamic x = :for-iterator.{asy::_StreamIterator::current};
+ {}
+ }
+ else
+ break #L2;
+ }
+ finally
+ if(!:for-iterator.{asy::_StreamIterator::_subscription}.{core::Object::==}(null)) {
+ [yield] let dynamic #t4 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::cancel}(), :async_op_then, :async_op_error, :async_op) in null;
+ :result;
+ }
+ }
+ {
+ asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(self::F<asy::Stream<dynamic>>());
+ try
+ #L3:
+ while (true) {
+ [yield] let dynamic #t5 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null;
+ if(:result) {
+ dynamic x = :for-iterator.{asy::_StreamIterator::current};
+ {}
+ }
+ else
+ break #L3;
+ }
+ finally
+ if(!:for-iterator.{asy::_StreamIterator::_subscription}.{core::Object::==}(null)) {
+ [yield] let dynamic #t6 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::cancel}(), :async_op_then, :async_op_error, :async_op) in null;
+ :result;
+ }
+ }
+ {
+ asy::_StreamIterator<core::Object> :for-iterator = new asy::_StreamIterator::•<core::Object>(self::F<asy::Stream<core::Object>>());
+ try
+ #L4:
+ while (true) {
+ [yield] let dynamic #t7 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null;
+ if(:result) {
+ core::Object x = :for-iterator.{asy::_StreamIterator::current};
+ {}
+ }
+ else
+ break #L4;
+ }
+ finally
+ if(!:for-iterator.{asy::_StreamIterator::_subscription}.{core::Object::==}(null)) {
+ [yield] let dynamic #t8 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::cancel}(), :async_op_then, :async_op_error, :async_op) in null;
+ :result;
+ }
+ }
+ {
+ asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(self::F<asy::Stream<dynamic>>());
+ try
+ #L5:
+ while (true) {
+ [yield] let dynamic #t9 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null;
+ if(:result) {
+ final dynamic #t10 = :for-iterator.{asy::_StreamIterator::current};
+ {
+ d = #t10;
+ }
+ }
+ else
+ break #L5;
+ }
+ finally
+ if(!:for-iterator.{asy::_StreamIterator::_subscription}.{core::Object::==}(null)) {
+ [yield] let dynamic #t11 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::cancel}(), :async_op_then, :async_op_error, :async_op) in null;
+ :result;
+ }
+ }
+ {
+ asy::_StreamIterator<core::Object> :for-iterator = new asy::_StreamIterator::•<core::Object>(self::F<asy::Stream<core::Object>>());
+ try
+ #L6:
+ while (true) {
+ [yield] let dynamic #t12 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null;
+ if(:result) {
+ final core::Object #t13 = :for-iterator.{asy::_StreamIterator::current};
+ {
+ o = #t13;
+ }
+ }
+ else
+ break #L6;
+ }
+ finally
+ if(!:for-iterator.{asy::_StreamIterator::_subscription}.{core::Object::==}(null)) {
+ [yield] let dynamic #t14 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::cancel}(), :async_op_then, :async_op_error, :async_op) in null;
+ :result;
+ }
+ }
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+}
+static method main() → asy::Future<dynamic> /* originally async */ {
+ final asy::Completer<dynamic> :completer = asy::Completer::sync<dynamic>();
+ asy::FutureOr<dynamic> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ dynamic :saved_try_context_var0;
+ dynamic :saved_try_context_var1;
+ dynamic :exception0;
+ dynamic :stack_trace0;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L7:
+ {
+ for (core::int x in <core::int>[1, 2, 3]) {
+ }
+ for (core::num x in <core::num>[1, 2, 3]) {
+ }
+ for (core::int x in <core::int>[1, 2, 3]) {
+ }
+ {
+ asy::_StreamIterator<core::int> :for-iterator = new asy::_StreamIterator::•<core::int>(self::MyStream::•<core::int>());
+ try
+ #L8:
+ while (true) {
+ [yield] let dynamic #t15 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null;
+ if(:result) {
+ core::int x = :for-iterator.{asy::_StreamIterator::current};
+ {}
+ }
+ else
+ break #L8;
+ }
+ finally
+ if(!:for-iterator.{asy::_StreamIterator::_subscription}.{core::Object::==}(null)) {
+ [yield] let dynamic #t16 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::cancel}(), :async_op_then, :async_op_error, :async_op) in null;
+ :result;
+ }
+ }
+ {
+ asy::_StreamIterator<core::int> :for-iterator = new asy::_StreamIterator::•<core::int>(self::MyStream::•<core::int>());
+ try
+ #L9:
+ while (true) {
+ [yield] let dynamic #t17 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null;
+ if(:result) {
+ core::int x = :for-iterator.{asy::_StreamIterator::current};
+ {}
+ }
+ else
+ break #L9;
+ }
+ finally
+ if(!:for-iterator.{asy::_StreamIterator::_subscription}.{core::Object::==}(null)) {
+ [yield] let dynamic #t18 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::cancel}(), :async_op_then, :async_op_error, :async_op) in null;
+ :result;
+ }
+ }
+ }
+ :completer.{asy::Completer::complete}(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.{asy::Completer::future};
+}
diff --git a/pkg/front_end/testcases/inference/downwards_inference_initializing_formal_default_formal.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/downwards_inference_initializing_formal_default_formal.dart.direct.transformed.expect
new file mode 100644
index 0000000..cb0d81e
--- /dev/null
+++ b/pkg/front_end/testcases/inference/downwards_inference_initializing_formal_default_formal.dart.direct.transformed.expect
@@ -0,0 +1,17 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+typedef Function2<S extends core::Object, T extends core::Object> = ([S]) → T;
+class Foo extends core::Object {
+ field core::List<core::int> x;
+ constructor •([core::List<core::int> x = const <dynamic>[1]]) → void
+ : self::Foo::x = x, super core::Object::•()
+ ;
+ constructor named([core::List<core::int> x = const <dynamic>[1]]) → void
+ : self::Foo::x = null, super core::Object::•()
+ ;
+}
+static field ([core::List<core::int>]) → core::String g = ([dynamic llll = const <dynamic>[1]]) → dynamic => "hello";
+static method f([core::List<core::int> l = const <dynamic>[1]]) → void {}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/downwards_inference_initializing_formal_default_formal.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/downwards_inference_initializing_formal_default_formal.dart.strong.transformed.expect
new file mode 100644
index 0000000..29996bd
--- /dev/null
+++ b/pkg/front_end/testcases/inference/downwards_inference_initializing_formal_default_formal.dart.strong.transformed.expect
@@ -0,0 +1,17 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+typedef Function2<S extends core::Object, T extends core::Object> = ([S]) → T;
+class Foo extends core::Object {
+ field core::List<core::int> x;
+ constructor •([core::List<core::int> x = const <core::int>[1]]) → void
+ : self::Foo::x = x, super core::Object::•()
+ ;
+ constructor named([core::List<core::int> x = const <core::int>[1]]) → void
+ : self::Foo::x = null, super core::Object::•()
+ ;
+}
+static field ([core::List<core::int>]) → core::String g = ([core::List<core::int> llll = const <core::int>[1]]) → core::String => "hello";
+static method f([core::List<core::int> l = const <core::int>[1]]) → void {}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/downwards_inference_inside_top_level.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/downwards_inference_inside_top_level.dart.direct.transformed.expect
new file mode 100644
index 0000000..ca9246e
--- /dev/null
+++ b/pkg/front_end/testcases/inference/downwards_inference_inside_top_level.dart.direct.transformed.expect
@@ -0,0 +1,18 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class A extends core::Object {
+ field self::B<core::int> b = null;
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class B<T extends core::Object> extends core::Object {
+ constructor •(self::B::T x) → void
+ : super core::Object::•()
+ ;
+}
+static field dynamic t1 = let final dynamic #t1 = new self::A::•() in let final dynamic #t2 = #t1.b = new self::B::•<dynamic>(1) in #t1;
+static field dynamic t2 = <self::B<core::int>>[new self::B::•<dynamic>(2)];
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/downwards_inference_inside_top_level.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/downwards_inference_inside_top_level.dart.strong.transformed.expect
new file mode 100644
index 0000000..e377e03
--- /dev/null
+++ b/pkg/front_end/testcases/inference/downwards_inference_inside_top_level.dart.strong.transformed.expect
@@ -0,0 +1,18 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class A extends core::Object {
+ field self::B<core::int> b = null;
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class B<T extends core::Object> extends core::Object {
+ constructor •(self::B::T x) → void
+ : super core::Object::•()
+ ;
+}
+static field self::A t1 = let final self::A #t1 = new self::A::•() in let final self::B<core::int> #t2 = #t1.{self::A::b} = new self::B::•<core::int>(1) in #t1;
+static field core::List<self::B<core::int>> t2 = <self::B<core::int>>[new self::B::•<core::int>(2)];
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/downwards_inference_inside_top_level_2.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/downwards_inference_inside_top_level_2.dart.direct.transformed.expect
new file mode 100644
index 0000000..da516ac
--- /dev/null
+++ b/pkg/front_end/testcases/inference/downwards_inference_inside_top_level_2.dart.direct.transformed.expect
@@ -0,0 +1,11 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class A<T extends core::Object> extends core::Object {
+ constructor •(self::A::T x) → void
+ : super core::Object::•()
+ ;
+}
+static field dynamic t1 = <self::A<core::int>>[new self::A::•<dynamic>(1)];
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/downwards_inference_inside_top_level_2.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/downwards_inference_inside_top_level_2.dart.strong.transformed.expect
new file mode 100644
index 0000000..d0e29da
--- /dev/null
+++ b/pkg/front_end/testcases/inference/downwards_inference_inside_top_level_2.dart.strong.transformed.expect
@@ -0,0 +1,11 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class A<T extends core::Object> extends core::Object {
+ constructor •(self::A::T x) → void
+ : super core::Object::•()
+ ;
+}
+static field core::List<self::A<core::int>> t1 = <self::A<core::int>>[new self::A::•<core::int>(1)];
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/downwards_inference_on_constructor_arguments_infer_downwards.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/downwards_inference_on_constructor_arguments_infer_downwards.dart.direct.transformed.expect
new file mode 100644
index 0000000..58dbf9c
--- /dev/null
+++ b/pkg/front_end/testcases/inference/downwards_inference_on_constructor_arguments_infer_downwards.dart.direct.transformed.expect
@@ -0,0 +1,47 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class F0 extends core::Object {
+ constructor •(core::List<core::int> a) → void
+ : super core::Object::•() {}
+}
+class F1 extends core::Object {
+ constructor •({core::List<core::int> a = null}) → void
+ : super core::Object::•() {}
+}
+class F2 extends core::Object {
+ constructor •(core::Iterable<core::int> a) → void
+ : super core::Object::•() {}
+}
+class F3 extends core::Object {
+ constructor •(core::Iterable<core::Iterable<core::int>> a) → void
+ : super core::Object::•() {}
+}
+class F4 extends core::Object {
+ constructor •({core::Iterable<core::Iterable<core::int>> a = null}) → void
+ : super core::Object::•() {}
+}
+static method test() → void {
+ new self::F0::•(<dynamic>[]);
+ new self::F0::•(<dynamic>[3]);
+ new self::F0::•(<dynamic>["hello"]);
+ new self::F0::•(<dynamic>["hello", 3]);
+ new self::F1::•(a: <dynamic>[]);
+ new self::F1::•(a: <dynamic>[3]);
+ new self::F1::•(a: <dynamic>["hello"]);
+ new self::F1::•(a: <dynamic>["hello", 3]);
+ new self::F2::•(<dynamic>[]);
+ new self::F2::•(<dynamic>[3]);
+ new self::F2::•(<dynamic>["hello"]);
+ new self::F2::•(<dynamic>["hello", 3]);
+ new self::F3::•(<dynamic>[]);
+ new self::F3::•(<dynamic>[<dynamic>[3]]);
+ new self::F3::•(<dynamic>[<dynamic>["hello"]]);
+ new self::F3::•(<dynamic>[<dynamic>["hello"], <dynamic>[3]]);
+ new self::F4::•(a: <dynamic>[]);
+ new self::F4::•(a: <dynamic>[<dynamic>[3]]);
+ new self::F4::•(a: <dynamic>[<dynamic>["hello"]]);
+ new self::F4::•(a: <dynamic>[<dynamic>["hello"], <dynamic>[3]]);
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/downwards_inference_on_constructor_arguments_infer_downwards.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/downwards_inference_on_constructor_arguments_infer_downwards.dart.strong.transformed.expect
new file mode 100644
index 0000000..e235fe9
--- /dev/null
+++ b/pkg/front_end/testcases/inference/downwards_inference_on_constructor_arguments_infer_downwards.dart.strong.transformed.expect