Commit graph

15966 commits

Author SHA1 Message Date
Konstantin Shcheglov 8f5c21ea68 Use SearchEngine.membersOfSubtypes() instead of actual elements in ImplementedComputer.
This makes 'implemented' notification 10x faster for files with
many types and implemented methods, like visitor.dart - from 400 ms
down to 36 ms. Still not as fast as I would like, but much better.

R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2955313003 .
2017-06-29 10:11:26 -07:00
Konstantin Shcheglov b3fe985371 Use AnalysisDriver.getCachedResult() for 'implemented' notification.
In general case we cannot use getResult() in this notification.
We generate these notifications after analysis is complete in scheduler.
But if there is no cached result, getResult() will schedule analysis.
So, we might get into a loop.

In practice this worked, because IDEA always makes files priority,
so their results cached, and then subscribes for notifications.
But in general case we need this protection.

This also means that the 'implemented' notification works (and will
work) only for priority files.

R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2965533002 .
2017-06-29 09:57:20 -07:00
Vijay Menon e84fd776cb Improve runtime error when a module is not loaded
R=alanknight@google.com

Review-Url: https://codereview.chromium.org/2959323002 .
2017-06-29 08:09:26 -07:00
Brian Wilkerson 84dd01904d Missed change to conform to other APIs
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2965453002 .
2017-06-29 06:15:38 -07:00
Johnni Winther 34290dca77 Split inference type-info accessors into members, parameters and local functions
This prepares for using LocalFunctionElement.callMethod as the key for local
functions instead of the local functions themselves - corresponding to the world
after closure conversion.

Main changes in
  elements/elements.dart
  inferrer/inferrer_engine.dart
  inferrer/type_graph_inferrer.dart
  inferrer/type_system.dart

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2955353002 .
2017-06-29 14:46:48 +02:00
Paul Berry 7ee5d4b3a2 Create an option to disable type inference and type promotion.
This is intended for profiling, to ensure that type inference and type
promotion do not slow down compilation too much.

Currently the option is just plumbed through to the kernel Target
class since I'm not exactly sure how we'll want to enable/disable this
option; we can plumb it the rest of the way in a future CL.

R=ahe@google.com

Review-Url: https://codereview.chromium.org/2962913002 .
2017-06-29 05:31:06 -07:00
Peter von der Ahé ba84f801f4 Change how unresolved super sends are handled.
The mixin transformer is now responsible for adding no-such-method calls.

Fixes https://github.com/dart-lang/sdk/issues/30000

R=paulberry@google.com, sigmund@google.com

Review-Url: https://codereview.chromium.org/2963763002 .
2017-06-29 12:21:49 +02:00
Johnni Winther fc1ec82757 Move locals and closure classes from kernel/ to js_model/
- and rename K* to J*

R=efortuna@google.com, sigmund@google.com

Review-Url: https://codereview.chromium.org/2960153002 .
2017-06-29 11:08:24 +02:00
Emily Fortuna 4250923832 Fix order of visitChildren in Constructors.
BUG=
R=ahe@google.com, kmillikin@google.com

Review-Url: https://codereview.chromium.org/2956153002 .
2017-06-28 18:12:46 -07:00
Konstantin Shcheglov 4484160ce9 Include types of ClassTypeAlias into subtyped names.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2963003002 .
2017-06-28 15:01:30 -07:00
Paul Berry 0958e40357 Adjust return types of spec-mode function expressions to match VM.
R=scheglov@google.com

The spec is unclear about what is supposed to happen here (see
https://github.com/dart-lang/sdk/issues/30044).  Matching the VM
behavior allows us to pass the existing tests.
Review-Url: https://codereview.chromium.org/2958363002 .
2017-06-28 14:36:00 -07:00
Konstantin Shcheglov 256d6fa704 Remove the stale test for discarding notifications.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2961173002 .
2017-06-28 14:27:38 -07:00
Konstantin Shcheglov ef45b380fc Record ClassTypeAlias(s) as subtypes.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2956403002 .
2017-06-28 14:26:16 -07:00
Emily Fortuna 7c89075a4f Entity-ify BoxLocal.
BUG=
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2956393002 .
2017-06-28 14:21:28 -07:00
Konstantin Shcheglov e0f4c7b467 Report only private members in the same library as overrides.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2959273002 .
2017-06-28 13:47:33 -07:00
Konstantin Shcheglov 911263f240 Remove the old index.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2963773003 .
2017-06-28 13:44:05 -07:00
Konstantin Shcheglov f09be80615 Record only names of instance members in subtypes.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2961143002 .
2017-06-28 12:55:07 -07:00
Paul Berry 0efe02372b In non-strong mode, don't infer the type of for-in loop variables.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2960003003 .
2017-06-28 12:43:05 -07:00
Paul Berry c99f11cf80 More fixes for missing interface targets when not in strong mode.
In my previous CL, I only addressed method invocation targets.  This
CL addresses getter and setter interface targets.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2963833002 .
2017-06-28 12:20:56 -07:00
Konstantin Shcheglov 2b64bbed6a Add SearchEngine.membersOfSubtypes().
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2962023002 .
2017-06-28 11:44:48 -07:00
Brian Wilkerson 7bd9e6c443 Add a mixin for assists similar to that for fixes
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2956353002 .
2017-06-28 11:44:22 -07:00
Paul Berry 37a5c124ee Fix for missing interface targets when not in strong mode.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2959213002 .
2017-06-28 11:23:01 -07:00
Konstantin Shcheglov 166c47d771 Issue 29968. When a file is added, and it is already known, refresh it.
R=brianwilkerson@google.com
BUG= https://github.com/dart-lang/sdk/issues/29968

Review-Url: https://codereview.chromium.org/2959903005 .
2017-06-28 11:05:57 -07:00
Brian Wilkerson 6248e7cab2 Add support code to make fixes easier in plugins
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2962903002 .
2017-06-28 10:52:06 -07:00
Brian Wilkerson 563720617c Allow trailing comma in assert
R=danrubel@google.com

Review-Url: https://codereview.chromium.org/2961063002 .
2017-06-28 10:46:44 -07:00
Konstantin Shcheglov 7d7689ab5c Implement search for direct subtypes in a single AnalysisDriver.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2956193003 .
2017-06-28 10:35:16 -07:00
Devon Carew 83d9e3fc91 Fix a few unused imports and symbol warnings.
BUG=
R=messick@google.com

Review-Url: https://codereview.chromium.org/2961013002 .
2017-06-28 09:44:38 -07:00
Paul Berry 919d7965b7 Annotate remaining type inference failures with issue numbers.
R=ahe@google.com

Review-Url: https://codereview.chromium.org/2958993005 .
2017-06-28 09:24:56 -07:00
Konstantin Shcheglov c175f4bf75 Index subtypes with supertypes, and names of members they declare.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2957203002 .
2017-06-28 08:28:14 -07:00
Brian Wilkerson 9ddb832e10 Generate constants in server as we do in plugin
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2960073002 .
2017-06-28 08:21:33 -07:00
Paul Berry 9fb886e709 Fix inferMethodInvocation in the case where interfaceMember is null.
R=ahe@google.com

Review-Url: https://codereview.chromium.org/2956243003 .
2017-06-28 06:54:35 -07:00
Paul Berry 9994caf4e2 Add type inference of annotations.
Note that some locations where annotations can occur are not yet
supported by kernel and/or fasta, so there are some test failures.

R=ahe@google.com

Review-Url: https://codereview.chromium.org/2963703002 .
2017-06-28 05:30:23 -07:00
Florian Loitsch 978213d427 Revert "Make Zone API strong mode clean."
This reverts commit 0b35711d48.

BUG=

Review-Url: https://codereview.chromium.org/2963743002 .
2017-06-28 13:31:32 +02:00
Florian Loitsch 0b35711d48 Make Zone API strong mode clean.
Review-Url: https://codereview.chromium.org/2959163002 .
2017-06-28 13:16:39 +02:00
Johnni Winther a6127e7361 Steps towards handling new Element.div()
- need to have a closure class for this.

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2958013002 .
2017-06-28 10:30:09 +02:00
Peter von der Ahé 77683dcc2f Make all helper methods related to isValidMethodTypeArguments local functions.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2961803002 .
2017-06-28 10:11:03 +02:00
Peter von der Ahé 643b54f7a9 Remove unneeded arguments.
R=danrubel@google.com

Review-Url: https://codereview.chromium.org/2959023002 .
2017-06-28 10:10:00 +02:00
Peter von der Ahé 616da7ea04 Generate type variable events before parsing return type.
R=danrubel@google.com

Review-Url: https://codereview.chromium.org/2963473004 .
2017-06-28 10:08:10 +02:00
Peter von der Ahé 97454851b8 Remove all type-related peeking.
R=danrubel@google.com

Review-Url: https://codereview.chromium.org/2958073002 .
2017-06-28 10:07:21 +02:00
Peter von der Ahé f10bdc6872 Reorganize parseType.
R=danrubel@google.com

Review-Url: https://codereview.chromium.org/2961673003 .
2017-06-28 10:03:17 +02:00
Johnni Winther 4d26bc56b4 Handle super-method call
+ add BackendUsage.isMirrorUsed

(yes, these were related!)

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2960723004 .
2017-06-28 10:02:00 +02:00
Peter von der Ahé 90fb88710f Rename handleFunctionType to endFunctionType.
R=danrubel@google.com

Review-Url: https://codereview.chromium.org/2961813002 .
2017-06-28 10:00:57 +02:00
Peter von der Ahé 08cfa29ec9 Use correct URI for field inference.
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2955063003 .
2017-06-28 09:58:42 +02:00
Johnni Winther a9fca6fba9 Split KernelToElementMap mixins to match interfaces
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2955093002 .
2017-06-28 09:43:01 +02:00
Paul Berry faee811e20 Fix bogus comment on ClassHierarchy.forEachCrossOverridePair.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2960033002 .
2017-06-27 22:00:08 -07:00
Paul Berry 474d5e5d7f Test of type inference when super calls are unresolved.
See https://github.com/dart-lang/sdk/issues/30000 for an illustration
of why this is necessary.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2958113002 .
2017-06-27 14:10:05 -07:00
Konstantin Shcheglov dcc66e6fa9 Store subtyped names in Analysis Driver unlinked units.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2955163002 .
2017-06-27 12:38:36 -07:00
Konstantin Shcheglov 3d831505a4 Cache AnalysisOptionsImpl objects for context directories.
This fixes the performance degradation which we had to introduce
in the previous CL.

R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2963583002 .
2017-06-27 12:18:41 -07:00
Konstantin Shcheglov bc34583661 Issue 29960. Both CommandLineOptions and AnalysisOptions must be equal to reuse the context.
Unfortunately this makes running shared tests about 30% slower, because we have to perform I/O while trying to find analysis_options.yaml files corresponding to the files to be analyzed.

R=brianwilkerson@google.com
BUG= https://github.com/dart-lang/sdk/issues/29960

Review-Url: https://codereview.chromium.org/2956093002 .
2017-06-27 09:33:00 -07:00
Vijay Menon fd6164cce4 Handle toString on DOM types
R=jmesserly@google.com

Review-Url: https://codereview.chromium.org/2952363003 .
2017-06-27 09:22:25 -07:00
Brian Wilkerson d129b0261c Fix recovery to prevent generating a parameter with no name and no type (issue 30020)
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2955063004 .
2017-06-27 09:19:25 -07:00
Konstantin Shcheglov dab293af60 Compute subtyped names.
This is a step to optimizing implemented classes / members feature.

The idea is that we don't need to know elements to make this feature
work. We just need to know whether at least one exists. So, use these
subtyped names to pre-filter files, then read resolved units for special
type of index (to be implemented) with resolved subtyped classes with
overridden class members, then recurse. I think this would be much
faster than to actually resynthesize elements.

R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2961773002 .
2017-06-27 09:18:42 -07:00
Brian Wilkerson 0ea6b89770 Fix a lint
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2955113002 .
2017-06-27 08:36:59 -07:00
Paul Berry 12186bb40b Add a test to verify that variables declared in for-loops can be type promoted.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2960723003 .
2017-06-27 08:29:52 -07:00
Paul Berry fc32e0e72b Remove hack from KernelTypePromoter.isPromotionCandidate.
All variable declarations encountered by type inference are now of
type KernelVariableDeclaration, so we no longer need a hack to handle
ordinary VariableDeclaration objects.

Removing the hack avoids covering up bugs.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2961723002 .
2017-06-27 06:00:01 -07:00
Johnni Winther bba44b4f5a Conditionally add default argument to metadata
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2958753002 .
2017-06-27 11:17:14 +02:00
Johnni Winther 7d026b538e Handle continue and break in for-in and while loops
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2956883002 .
2017-06-27 11:07:18 +02:00
Johnni Winther e7ba4959ca Split KernelToElementMap into sub-interfaces
This prepares for a more direct implementation of J-elements by
splitting out the parts needed for world-impact vs ssa-building.

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2960633002 .
2017-06-27 10:28:29 +02:00
Johnni Winther 07b0f45181 Add compile_from_dill_fast_startup_test
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2959683002 .
2017-06-27 09:59:23 +02:00
Konstantin Shcheglov 020241b021 Fix for crash because of missing type of default generic function typed parameters.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2956923003 .
2017-06-26 17:43:37 -07:00
Emily Fortuna 6960d77fbc Hopefully the last bit of restructuring between closture classes and loop boxing, etc.
BUG=
R=johnniwinther@google.com, sigmund@google.com

Review-Url: https://codereview.chromium.org/2961563003 .
2017-06-26 15:49:27 -07:00
Paul Berry 2f7c6d61f5 Add type inference for break and continue statements.
Note that no actual type inference needs to be performed, but we still
need to implement the _inferStatement() methods so that we can get rid
of the hack in KernelTypeInferrer.inferStatement.  Also, we need to
call into the listener so that once this logic is hooked into
AstBuilder, analyzer will stay in sync with type inference.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2962583002 .
2017-06-26 14:51:07 -07:00
Konstantin Shcheglov 9775892109 Attempt to fix DartEditBuilderImplTest on Windows.
TBR

R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2958803003 .
2017-06-26 14:39:41 -07:00
Paul Berry 93ab0f107e Implement type inference for symbol literals.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2958813002 .
2017-06-26 14:28:48 -07:00
Erik Corry 3c543bb210 Revert "VM: Reland Inline instance object hash code into object header on 64bit."
This reverts commit 8378b8fdbf due to
mysterious crashes on 32 bit ARM with the Flutter Gallery app.

R=aam@google.com
BUG=

Review-Url: https://codereview.chromium.org/2962543002 .
2017-06-26 23:06:09 +02:00
Paul Berry d13f09c9e0 Add listener calls to ThisExpression and KernelTypeLiteral.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2961693002 .
2017-06-26 13:45:31 -07:00
Paul Berry 9f078625d4 Add type inference for super property gets.
I implemented the correct logic for both SuperPropertyGet and
DirectPropertyGet, since there are TODO comments in the code
indicating that the former will be replaced by the latter when
possible.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2959823002 .
2017-06-26 13:40:06 -07:00
Konstantin Shcheglov a2f18fdb73 Fixes and tests for adding library imports.
R=brianwilkerson@google.com, pquitslund@google.com
BUG= https://github.com/flutter/flutter-intellij/issues/1119

Review-Url: https://codereview.chromium.org/2955913002 .
2017-06-26 13:16:19 -07:00
Steve Messick 8c50e08e64 Add integration tests for postfix serer api
R=brianwilkerson@google.com

Review-Url: https://codereview.chromium.org/2961683002 .
2017-06-26 13:13:21 -07:00
Paul Berry e24eab66d9 Add type inference for super method invocations.
I implemented the correct logic for both SuperMethodInvocation and
DirectMethodInvocation, since there are TODO comments in the code
indicating that the former will be replaced by the latter when
possible.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2954403002 .
2017-06-26 12:42:46 -07:00
Steve Messick 4c8e1b9132 Update coverage.md
R=brianwilkerson@google.com

Review-Url: https://codereview.chromium.org/2960683002 .
2017-06-26 11:21:50 -07:00
Paul Berry 5cd3c2c8dc Add type inference for assert statements.
Note that since the first argument of an assert statement may be
either of type `bool` or `() -> bool`, and the second argument may be
any object, no type context is passed down in downward inference; the
only inference we need to do is to recursively invoke
`inferExpression` to ensure that subexpressions are inferred properly.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2959763002 .
2017-06-26 10:05:08 -07:00
Steve Messick c26c2774ca This defines some postfix completion templates for use in the IntelliJ editor.
R=brianwilkerson@google.com

To use it, you'll need a version of the Dart plugin with this PR patched in:
https://github.com/JetBrains/intellij-plugins/pull/534
Review-Url: https://codereview.chromium.org/2917943002 .
2017-06-26 09:53:02 -07:00
Brian Wilkerson 66986042af Add support for running pub for plugins
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2949893002 .
2017-06-26 09:21:11 -07:00
Brian Wilkerson 5946ce552f Add AnalysisSession to analyzer
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2954153002 .
2017-06-26 09:16:11 -07:00
Paul Berry 213c2080a5 Add type inference for while and do loops.
Analyzer does not type infer these constructs correctly (it uses an
empty context for the loop condition, instead of bool), so the tests
are in inference_new.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2954253002 .
2017-06-26 09:07:27 -07:00
Paul Berry 7553b2e75c Implement type inference for try/catch blocks.
Note that the types of the exception and stack trace variables are set
in the BodyBuilder since they do not depend on inference of other
parts of the function.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2954823002 .
2017-06-26 08:57:00 -07:00
Paul Berry b94fdceadc Add type inference for switch statements.
Analyzer does not infer switch cases correctly (it uses an empty
context for the case expression, instead of the type of the switch
expression), so the tests are in inference_new.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2953423002 .
2017-06-26 08:49:01 -07:00
Brian Wilkerson c9dce504cc Remove more dead code
R=devoncarew@google.com

Review-Url: https://codereview.chromium.org/2959713002 .
2017-06-26 07:31:25 -07:00
Peter von der Ahé 28084d1f85 Don't peek when parsing mixin applications.
R=danrubel@google.com

Review-Url: https://codereview.chromium.org/2957503003 .
2017-06-26 14:13:37 +02:00
Johnni Winther aa345515fe Handle break as continue
Review-Url: https://codereview.chromium.org/2954663002 .
2017-06-26 13:28:18 +02:00
Peter von der Ahé a1ad4e4feb Remove peeking from parseTypedef and parseClassOrNamedMixinApplication.
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2948383002 .
2017-06-26 13:15:47 +02:00
Johnni Winther ecb5767bba Remove special casing of == null
This avoid reversing the operands for `null == x`
- and make Hello World! fully equivalent.

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2954123002 .
2017-06-26 12:47:17 +02:00
Johnni Winther 52f1f25d34 Sort type tests.
- and match sorting of injected members with patched_dart2js_sdk in test

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2958553002 .
2017-06-26 12:20:03 +02:00
Johnni Winther 1298af3bd3 Fix computation of default values for named parameters.
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2957583003 .
2017-06-26 11:37:17 +02:00
Johnni Winther 2e6521678a Less inequivalence on Hello World!
- generate runtime types from kernel
- remove Compiler.types and add ClosedWorld.types
- start checking emitter equivalence including Program model equivalence

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2954493002 .
2017-06-26 11:30:11 +02:00
Johnni Winther 14dda16482 Handle for-loop with simple break in compile_from_dill_test
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2950303002 .
2017-06-26 11:10:30 +02:00
Johnni Winther f7f4d6133b Refactoring to prepare for kernel based jump targets
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2954463002 .
2017-06-26 10:35:13 +02:00
Peter von der Ahé 2c53bcbf12 Document where the parser uses peeking.
R=danrubel@google.com

Review-Url: https://codereview.chromium.org/2950393003 .
2017-06-26 10:17:42 +02:00
Devon Carew de5cf42579 Fix an issue calculating analysis server cpu usage.
BUG=
R=brianwilkerson@google.com

Review-Url: https://codereview.chromium.org/2959643002 .
2017-06-25 18:59:41 -07:00
Erik Corry 029b1cb948 Spelling fixes e to i.
R=kevmoo@google.com
BUG=

Review-Url: https://codereview.chromium.org/2957593002 .
2017-06-24 13:41:39 +02:00
Paul Berry 3b6f276c84 Implement inference tests for logical operators.
The tests for this are placed in inference_new because the analyzer
implemenation doesn't do proper downward inference.

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2956723002 .
2017-06-23 14:47:41 -07:00
Paul Berry 2d0bfe2d54 Resolve type parameter bounds when looking up interface members.
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2954133002 .
2017-06-23 14:39:19 -07:00
Paul Berry 312b4ae52c Add/fix/cleanup type inference for throw and rethrow.
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2954693002 .
2017-06-23 14:32:58 -07:00
Paul Berry 0c1dab2933 Re-introduce corrupted type inference tests.
These two tests were added some time ago, but they became corrupted
(presumably due to a formatter bug that has since been fixed).  Later,
I moved the corrupted tests into the inference_new folder because they
didn't infer correctly with analyzer.

This CL re-introduces the original uncorrupted tests so that we don't
lose test coverage.

Note that these tests make use of a syntax that Fasta doesn't support
yet, so they are marked as failing.

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2958623002 .
2017-06-23 14:26:53 -07:00
Emily Fortuna b3812ffc8e Add ScopeInfo class for variable information that doesn't actually involve closures.
BUG=
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2949293002 .
2017-06-23 14:20:23 -07:00
Brian Wilkerson 4fab4a1f52 Clean up type parameters in comments
R=devoncarew@google.com

Review-Url: https://codereview.chromium.org/2948393002 .
2017-06-23 12:53:11 -07:00
Brian Wilkerson 4a10003924 Update the plugin API
R=maxkim@google.com, mfairhurst@google.com

Review-Url: https://codereview.chromium.org/2953093002 .
2017-06-23 12:31:00 -07:00
Kevin Moore 4d642466fb Update pkg/analyzer dependency on pkg/args to include v1.x
pkg/analyzer currently does not create an AgrParser so the breaking
behavior charge that came w/ the bump to args v1 does not affect any
code

R=brianwilkerson@google.com

Review-Url: https://codereview.chromium.org/2955583003 .
2017-06-23 11:47:01 -07:00
Paul Berry 82561d8fa7 Avoid a crash if an initializing formal appears in the wrong context.
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2947363003 .
2017-06-23 11:03:03 -07:00
Paul Berry 20c25f5cfc Small fixes to top level type inference.
This CL makes two fixes:

1. When a field is visited for the second time (to infer
subexpressions), don't use the inferred field type as the context;
this can change the inference results in a few rare circumstances,
making it different from what would be inferred inside a method body.

2. When doing extended top level type inference is enabled, only skip
subexpressions whose type is not needed.

Note that some tests had to be moved (either partially or completely)
into pkg/front_end/testcases/inference_new to reflect the fact that
front_end type inference now produces more correct results than
analyzer.  Also, the annotation comments in
pkg/front_end/testcases/inference_new/dependency_only_if_generic_method.dart
were completely bogus and needed to be changed.

R=ahe@google.com

Review-Url: https://codereview.chromium.org/2954063002 .
2017-06-23 10:47:58 -07:00
Paul Berry f09c561a06 Fix type inference of PropertySet when the receiver is a generic class.
R=ahe@google.com

Review-Url: https://codereview.chromium.org/2952883004 .
2017-06-23 10:41:47 -07:00
Paul Berry a9cf031831 Implement type inference for type literals
R=ahe@google.com

Review-Url: https://codereview.chromium.org/2952313002 .
2017-06-23 10:35:52 -07:00
Brian Wilkerson 8cd2a4924d Disable a not-yet-defined lint
R=pquitslund@google.com

Review-Url: https://codereview.chromium.org/2955583002 .
2017-06-23 09:37:34 -07:00
danrubel b8b9e3eae4 add test for internal scanner API
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2952153003 .
2017-06-23 12:35:09 -04:00
Brian Wilkerson 55d735911b Remove the unused operations queue
R=devoncarew@google.com

Review-Url: https://codereview.chromium.org/2957643002 .
2017-06-23 09:04:13 -07:00
Paul Berry a7ab70eb06 Move tests {list,map}_literals_can_infer_null_top_level to inference_new
These tests' expectations reflect a drawback in analyzer's type
inference--it doesn't infer the correct types lists and maps
containing `null` when those structures occur outside a method body.
The new front_end type inference engine does the right thing.

Accordingly, we have to move the test to inference_new, so that we can
update its expectations without breaking analyzer's test code.

R=ahe@google.com

Review-Url: https://codereview.chromium.org/2951373002 .
2017-06-23 07:40:52 -07:00
Paul Berry c4ecf098aa Move test infer_use_of_void to inference_new
This test's expectations reflect a drawback in analyzer's type
inference--it doesn't infer the correct types for calls to methods
returning `void` when those calls occur outside of a method body.  The
new front_end type inference engine does the right thing.

Accordingly, we have to move the test to inference_new, so that we can
update its expectations without breaking analyzer's test code.

R=ahe@google.com

Review-Url: https://codereview.chromium.org/2953903002 .
2017-06-23 07:33:50 -07:00
Paul Berry 6ac836fbb3 Make the kernel API for promoted type parameter bounds less error-prone.
I'm about to start introducing usages of TypeParameterType.bound, and
nearly all of the usage sites will need to fall back on
TypeParameter.bound if there is no bound stored in the
TypeParameterType.  This CL places the fallback behavior in the
TypeParameterType.bound getter so that we won't have to duplicate it
at every usage site (and risk making mistakes).  The few call sites
that don't want the fallback behavior (such as the one in
ast_to_binary.dart) can avoid it by referring to
TypeParameterType.promotedBound directly.

R=ahe@google.com

Review-Url: https://codereview.chromium.org/2952883003 .
2017-06-23 05:44:58 -07:00
Peter von der Ahé 03aad06299 Add regression tests from Luke's bug reports. Part 2.
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2959463003 .
2017-06-23 14:37:27 +02:00
Paul Berry 7b60c094d7 Implement type inference for conventional for-loops.
R=ahe@google.com

Review-Url: https://codereview.chromium.org/2951033004 .
2017-06-23 05:36:41 -07:00
Peter von der Ahé f1b7a97744 Move testing.json and status files to more natural locations.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2957623002 .
2017-06-23 14:27:53 +02:00
Peter von der Ahé 2434dc606a Add regression tests from Luke's bug reports. Part 1.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2955443002 .
2017-06-23 14:25:26 +02:00
Vijay Menon daf960d5a4 Fix Object method tearoffs
R=jmesserly@google.com

Review-Url: https://codereview.chromium.org/2953933002 .
2017-06-22 15:59:45 -07:00
Vijay Menon 7d73159017 Fix ddc build
Not sure why this just started breaking.  I don't think Ben added this
param - just a use of it.  Our patch script might not be catching the
mismatch.

TBR=jmesserly@google.com,bkonyi@google.com

Review-Url: https://codereview.chromium.org/2954513003 .
2017-06-22 14:27:22 -07:00
Jennifer Messerly 635d95fccf cleanup unused useDisplayName parameter
R=vsm@google.com

Review-Url: https://codereview.chromium.org/2953883002 .
2017-06-22 14:17:44 -07:00
Paul Berry dd0a00f581 Infer the return types of local functions where appropriate.
Note that we do this in order to be consistent with type inference of
function expressions.  See https://codereview.chromium.org/2209293002.

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2950213002 .
2017-06-22 12:17:10 -07:00
Brian Wilkerson ec8505fc79 Fix hints and clean-up obsolete comment syntax (TBR)
Review-Url: https://codereview.chromium.org/2952233002 .
2017-06-22 10:59:26 -07:00
Zachary Anderson ac16656161 Remove MIPS support
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2858623002 .
2017-06-22 08:49:22 -07:00
Brian Wilkerson a420a1fbb5 Remove more dead code from analysis server
R=devoncarew@google.com

Review-Url: https://codereview.chromium.org/2949103003 .
2017-06-22 08:21:03 -07:00
Brian Wilkerson e28064f405 Restore partial analysis of analysis options files
R=devoncarew@google.com

Review-Url: https://codereview.chromium.org/2946313003 .
2017-06-22 08:00:50 -07:00
danrubel ebdc0eda11 add Parser.withoutFasta constructor
This renames an existing private Parser constructor as a short term fix
so that the angular plugin can extend the Parser.

R=brianwilkerson@google.com

Review-Url: https://codereview.chromium.org/2952113002 .
2017-06-22 09:41:46 -04:00
Erik Corry 8378b8fdbf VM: Reland Inline instance object hash code into object header on 64bit.
Inline instance object hash code into object header on 64 bit.

64 bit objects have 32 bits of free space in the header word.
This is used for the hash code in string objects. We take it
for the default hash code on all objects that don't override
the hashCode getter.

This is both faster and a memory reduction. Eg it makes the
MegaHashCode part of the Megamorphic benchmark 6 times faster.

This is a reland of https://codereview.chromium.org/2912863006/
It fixes issues with the 32 bit compare-swap instruction on
ARM64 and fixes a fragile tree shaking test that is sensitive
to which private methods are in the core libraries.

R=kustermann@google.com, vegorov@google.com
BUG=

Review-Url: https://codereview.chromium.org/2954453002 .
2017-06-22 14:56:24 +02:00
Peter von der Ahé 94a44e0290 Refactor parseType in preparation for bigger changes.
R=danrubel@google.com

Review-Url: https://codereview.chromium.org/2951463002 .
2017-06-22 12:47:53 +02:00
Vijay Menon febded6052 Fix mocked operator methods
R=jacobr@google.com

Review-Url: https://codereview.chromium.org/2949123002 .
2017-06-21 16:54:08 -07:00
Vijay Menon ecca1e1c2a Add FallThroughError patch
TBR=jensj@google.com,rnystrom@google.com

Review-Url: https://codereview.chromium.org/2953693002 .
2017-06-21 16:33:31 -07:00
Paul Berry 945540c8bb Clean up duplicate type inference code for fetching parameter types.
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2950193002 .
2017-06-21 14:57:43 -07:00
Paul Berry 95aaba5085 In strong mode, properly infer the return types of setters as void
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2952873002 .
2017-06-21 14:51:40 -07:00
Paul Berry 348b42c98b Properly type infer for-in loops when the iterator type is a type parameter.
Also, fix a minor bug in variable declaration inference that was
preventing a local variable without an initializer from having its
type properly "inferred" as `dynamic`.

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2949093002 .
2017-06-21 14:46:54 -07:00
Paul Berry b2c4b0ac0a Implement override-based type inference for instance methods.
Also, fix a rare infinite loop bug in analyzer exposed by one of the
tests.

R=brianwilkerson@google.com, sigmund@google.com

Review-Url: https://codereview.chromium.org/2946273002 .
2017-06-21 13:56:04 -07:00
Brian Wilkerson fcb23e967c Remove the unused class SingleContextManager
R=devoncarew@google.com

Review-Url: https://codereview.chromium.org/2945313002 .
2017-06-21 11:21:25 -07:00
Emily Fortuna a721f87f99 More rearranging the deck chairs on the titanic.
According to the comments, only closures proper have free variables. Running tests support this. So let's move it into that branch.

BUG=
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2951923002 .
2017-06-21 10:47:54 -07:00
Brian Wilkerson 53e01faa43 Remove unused implementation of SearchEngine and rename the driver-based implementation
R=devoncarew@google.com

Review-Url: https://codereview.chromium.org/2949823002 .
2017-06-21 09:33:51 -07:00
Brian Wilkerson 6e89075952 Disable finding plugin locations in the pubspec
R=devoncarew@google.com

Review-Url: https://codereview.chromium.org/2947153002 .
2017-06-21 09:30:32 -07:00
Brian Wilkerson ab8158f582 Revert status change after disabling problematic test
R=devoncarew@google.com

Review-Url: https://codereview.chromium.org/2951773003 .
2017-06-21 08:45:12 -07:00
Brian Wilkerson 6e8453ed94 Fix invalid initializing formal by adding a field
R=pquitslund@google.com

Review-Url: https://codereview.chromium.org/2946093002 .
2017-06-21 07:56:26 -07:00
Jens Johansen 80860e7fb7 [kernel] Stream kernel_reader
Mostly stream kernel_reader, i.e. the code that sets up the libraries,
classes, methods etc.

Mostly because it still takes a "Program" ast node, and looks at the
"Library" ast nodes to get their kernel offset in the binary.
Currently the scripts (containing breakable points etc) are also created
from the ast nodes.

The rest is now streamed.
This also means that more ast visitors could be deleted.

R=kmillikin@google.com

Review-Url: https://codereview.chromium.org/2931813002 .
2017-06-21 14:58:58 +02:00
Johnni Winther 0600f0ad9a Add closure_test for kernel based members
+ change id_equivalence_test to check kernel from .dill

R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2951723002 .
2017-06-21 09:52:46 +02:00
Jens Johansen be9a3043aa [kernel] Make fasta call a new constructor on FallThroughError
On a switch fall through error, Fasta currently generates
```
throw new core::FallThroughError::•();
```

which generates the error-message via the VM:
```
'null': Switch case fall-through at line null.
```

This introduces a new constructor taking a url and a linenumber,
which then can give a better error message.

BUG=
R=ahe@google.com

Review-Url: https://codereview.chromium.org/2951453002 .
2017-06-21 08:40:59 +02:00
Paul Berry e981c6fdbc Add tests of null-aware constructs in void contexts.
Fasta desugares some expressions differently in void contexts, so to
be on the safe side, we should test that null-aware invocations and
property accesses work in both void and non-void contexts.

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2948843002 .
2017-06-20 15:12:01 -07:00
Paul Berry 5dd84a802e Only set types of conditional expressions in strong mode.
In spec mode the types aren't meaningful anyway (due to the fact that
the spec mode type system is unsound), and they don't match the
behavior of Rasta (causing bot failures).

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2953503002 .
2017-06-20 14:59:29 -07:00
Paul Berry d514347a44 Add type inference for null-aware method invocations.
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2950923002 .
2017-06-20 12:16:34 -07:00
Mike Fairhurst 47c9dcad97 Update plugin whitelist to accomodate angular plugin rename
BUG=
R=brianwilkerson@google.com

Review-Url: https://codereview.chromium.org/2947953002 .
2017-06-20 12:01:51 -07:00
Paul Berry eadfe2816b Record static types in the desugaring of null-aware property gets.
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2946943002 .
2017-06-20 11:29:50 -07:00
Brian Wilkerson 5582824e3c Rename the plugin location key and directory name
R=mfairhurst@google.com

Review-Url: https://codereview.chromium.org/2952583003 .
2017-06-20 11:06:39 -07:00
Paul Berry d0f8a47f33 Rename "field" -> "accessor" in several type inference methods.
No functional change.  This just adjusts nomenclature to reflect the
fact that much of the type inference logic for dealing with fields
also applies to getters/setters.

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2948773002 .
2017-06-20 10:34:27 -07:00
Jennifer Messerly 070f31a899 optimize null safe ops by using DDC's let abstraction
We were already using it for most other things (increment ops, op assign, ??, cascades, etc)

R=vsm@google.com

Review-Url: https://codereview.chromium.org/2944413002 .
2017-06-20 10:31:30 -07:00
Dan Rubel d0910ce078 translate fasta parser error to analyzer error
* translate fasta parser BuiltInIdentifierAsType error to analyzer error
* remove unused error listener field

R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2944383002 .
2017-06-20 13:18:48 -04:00
Dan Rubel 966d1a4701 integrating fasta parser
* start integrating fasta parser into analyzer
* extract new Scanner.fasta factory

R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2948473002 .
2017-06-20 12:24:13 -04:00
Brian Wilkerson 24996fbfe7 Add support to pass the location of the analysis options file to plugins
R=mfairhurst@google.com

Review-Url: https://codereview.chromium.org/2947743002 .
2017-06-20 07:41:03 -07:00