Factory constructors are represented as static methods with dynamic
return type; in order to type infer them properly we must use the type
of the enclosing class as the return type (with type parameters
substituted appropriately).
R=scheglov@google.com
Review-Url: https://codereview.chromium.org/2900553003 .
This reverts commit d9e9382373.
There were bot failures on incremental_kernel_generator test and in
incremental_resolved_ast_test, I'm not sure yet why tests passed locally though.
BUG=
Review-Url: https://codereview.chromium.org/2894273002 .
Some details:
- Adds the tree-shaker logic and unit tests for it,
Note: I'm still not clear on what degree of tree-shaking we can get away
with. For now I have a mode to delete anything that is not seen explicitly.
This passes verification for all of our tests so far, but breaks both the
mixin and the async/await transformer in some scenarios.
- Writes a prototype of kernelForBuildUnit (although no automated tests for it
yet).
- Moves a few more pieces to ProcessedOptions
R=scheglov@google.com
Review-Url: https://codereview.chromium.org/2893493004 .
In the future we might want to re-add this, but for now, no one needs to know
that a function was async/async*/sync*. This also allows the async/await
transformer to ignore external references without any special logic.
R=scheglov@google.com
Review-Url: https://codereview.chromium.org/2888823004 .
This CL makes the following fixes:
- Updates analyzer's front_end_inference_test to represent the bottom
type as "<BottomType>" (consistent with Kernel).
- Implements type inference of "throw" expressions.
- Does not coerce bottom to dynamic when inferring the return type of
a closure.
- Does not coerce Null to dynamic when inferring the return type of a
block closure.
- Ignores bare "return;" statements when inferring the return type of
a block closure.
- Infers Null when a block closure lacks "return <expression>;"
statements.
- Implements correct rules for LUB(Null, x), by treating Null as
bottom.
R=scheglov@google.com
Review-Url: https://codereview.chromium.org/2886873005 .
- Add num::== and Iterable::where to analyzer mock SDK.
- Do not default parameter types to dynamic in BodyBuilder or
KernelFormalParameterBuilder. This is now handled by the
KernelVariableDeclaration constructor.
- Only infer function expression parameter types in strong mode.
- Record inferred function expression parameter types to
instrumentation.
R=scheglov@google.com
Review-Url: https://codereview.chromium.org/2886443003 .
We need to compute the interface target in order to do the inference
anyway, so this is a reasonable time to store it.
Also annotate the inference tests with interface targets so that we
can verify that the interface targets computed by analyzer match those
computed by Fasta. Note that this causes a few strong mode tests to
fail that were previously passing, due to the fact that type inference
in Fasta is incomplete.
R=scheglov@google.com
Review-Url: https://codereview.chromium.org/2874033003 .
This was broken for three reasons:
- We weren't recording the fact that the type parameters were
explicitly provided, so the inference code path to handle this case
wasn't being exercised.
- The inference code path to handle this case was accidentally
referring to the `inferredTypes` variable, which is `null` in this
case.
- We were not checking for the case where the user provided the wrong
number of type parameters.
R=scheglov@google.com
Review-Url: https://codereview.chromium.org/2874053002 .
Previously, we only annotated "promotedType" for local variables; we
need to annotate it for function parameters as well.
Note that a few Fasta tests start failing as a result of this change,
due to the fact that the Fasta type promotion/inference logic is not
yet complete.
R=scheglov@google.com
Review-Url: https://codereview.chromium.org/2868133002 .
Three problems are fixed:
- I forgot to pass the `downwards` flag when doing downwards inference.
- I forgot to initialize the `formalTypes` and `actualTypes` arrays.
- I wasn't tracking whether constructor type arguments were implicit
or explicit, so constructor type inference wasn't actually
happening.
R=scheglov@google.com
Review-Url: https://codereview.chromium.org/2864853002 .
Front_end wants to annotate instance creations like this:
new /*@typeArgs=Foo*/ bar();
Whereas the existing tests use this style:
/*@typeArgs=Foo*/ new bar();
It's easier to modify the analyzer code to use the front_end style
than to update the front_end to use the analyzer style, and besides, I
think the front_end style makes more sense.
I've also added a boolean to front_end_inference_test.dart to allow
expectations to be updated more easily in the future.
R=scheglov@google.com
Review-Url: https://codereview.chromium.org/2867113002 .