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 .
- uniform quotes
- uniform naming of methods in _checkGrowable
- use .slice(0), it is slightly faster than .slice()
- avoid bounds and type checks in removeWhere/retainWhere
BUG=
R=sigmund@google.com
Review-Url: https://codereview.chromium.org/2880643005 .
Previously, these classes were generic because we anticapted re-using
them with analyzer AST objects in order to do analyzer type inference.
But we've decided on a new technique for doing analyzer type
inference: infer at the kernel level and then transfer the inference
data to analyzer using the TypeInferenceListener.
So the generic parameters are no longer needed.
R=scheglov@google.com
Review-Url: https://codereview.chromium.org/2885873002 .
This eliminates much of the duplication between the two token hierarchies
by merging much of the fasta.Token hierarchy into the analyzer.Token.
* merge token hierarchies
* cleanup fasta.Token.copy()
* set preceedingComments field via constructor
* replace isBuiltInIdentifier --> type.isBuiltIn
* change all fasta.Token references to analyzer.Token
* move fasta.Token.value() implementation into analyzer.SimpleToken
R=scheglov@google.com
Review-Url: https://codereview.chromium.org/2890523002 .
- 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 .
- Make the parser less error tolerant. The expression parser used to
ignore any unrecognized tokens, which means a status like
"RuntimeError CompileError" (not the missing comma) was parsed as
simply "RuntimeError", which seems bad. Now it reports an error.
Fixed a couple of status files that thought they were setting statuses
that they weren't (!).
- Separate out parsing a status file from applying the environment to
determine which sections are active. This makes it possible to, for
example, generate expectation sets for multiple environments without
having to reparse each time.
- Simplify expression parsing. Remove set expressions since they weren't
used for anything useful. A test's expectations are a simple
comma-separated list and don't need anything beyond that. Merge
Scanner and Tokenizer since the latter was a glorified function.
- Make more names private so that it's clearer what's used outside of
various libraries.
- Generally modernize the style.
- Add *lots* of documentation.
Again, there should be no behavioral changes. I ran:
./tools/test.py -m release,debug -c none,dart2js,dart2analyzer -r none,vm,d8 corelib
Before and after the change and verified that the output was the same
(aside from timing).
BUG=
R=whesse@google.com
Review-Url: https://codereview.chromium.org/2875203005 .
This doesn't get rid of all implicit dynamic and casts, but it covers
many of them.
Also did some minor modernization when I noticed it:
- Using "var" for local variables where inference does the right thing.
- camelCase for variable names.
- More collection literals.
There are (or should be!) zero behavioral changes.
R=whesse@google.com
Review-Url: https://codereview.chromium.org/2863253002 .