Commit Graph

7128 Commits

Author SHA1 Message Date
Konstantin Shcheglov d2ea3330d8 Fix tests with 'part' without 'library'.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//1180043006.
2015-06-12 11:27:36 -07:00
Konstantin Shcheglov 61c01b2231 Fix for computeResolvedCompilationUnitAsync().
This fixes the last Analysis Server unit tests.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//1181223002.
2015-06-12 10:27:02 -07:00
Konstantin Shcheglov b7b087cecd Schedule unknown priority source analysis.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//1179173005.
2015-06-12 09:12:45 -07:00
Brian Wilkerson 585402d77f Attempt to fix the build by backing out HTML support
Review URL: https://codereview.chromium.org//1177983003.
2015-06-11 14:44:00 -07:00
Brian Wilkerson 980978c967 Support for parsing HTML in the new task model
R=scheglov@google.com

Review URL: https://codereview.chromium.org//1185443002.
2015-06-11 13:24:20 -07:00
Konstantin Shcheglov c2cc0387a8 Create LibraryElement with SDK context for SDK sources.
This fixes 3 or 6 failing Analysis Server tests.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//1180673008.
2015-06-11 11:57:23 -07:00
Konstantin Shcheglov b8067b5fb9 Compute RESOLVED_UNIT for all units in all of the libraries of the closure before verifying.
This fixes many co19 tests, so I guess it might solve the problems with constants you mentioned.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//1183533002.
2015-06-11 10:47:26 -07:00
Konstantin Shcheglov cdced40bd5 Add AnalysisContext.onResultComputed().
Add RESOLVED_UNIT_NO_CONSTANTS as a public result.

Document results that are computed with the task model.
We need this to be able to use onResultComputed() in Analysis Server and
know that we will get enough information.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//1181603004.
2015-06-11 10:44:11 -07:00
Paul Berry b715b97147 Don't visit named argument labels when computing constant dependencies.
This fixes some crashes with the new task model.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org//1178203002.
2015-06-11 10:36:36 -07:00
Konstantin Shcheglov ad2ac9f1fe Add AnalysisDriver.onResultComputed().
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//1179753002.
2015-06-11 08:12:31 -07:00
Konstantin Shcheglov f584413999 Build LIBRARY_ELEMENT after RESOLVED_UNIT6 for all units in the closure of a library.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//1177963002.
2015-06-11 08:05:59 -07:00
Brian Wilkerson caa03b0b9f Capture more errors and improve duplicate error removal
R=scheglov@google.com

Review URL: https://codereview.chromium.org//1176983002.
2015-06-10 16:32:45 -07:00
Paul Berry c03b8fe451 Ensure that prefix?.loadLibrary() generates the proper compile-time error.
loadLibrary() is special-cased in analyzer, so we need special-case
code to make sure that it can't be invoked using "?.".

Fixes #23463.

R=scheglov@google.com

Review URL: https://codereview.chromium.org//1177833002.
2015-06-10 14:43:46 -07:00
Paul Berry 2f610a3ff5 Report a compile-time error if a const field is multiply initialized.
This CL makes analyzer consistent with the VM and the spec, by
producing a compile-time error for code such as:

    class C {
      final x = 1;
      const C() : x = 2;
    }
    main() {
      const C();
    }

Note that Dart2js also produces an error in this circumstance, but its
error is too general (the error should only be produced if the const
constructor is invoked using "const"; if the const constructor is
invoked using "new", or is not invoked at all, it should only be a
warning).  See #23618.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org//1175073002.
2015-06-10 14:02:43 -07:00
Brian Wilkerson f2954e5237 Fix a test to work with the new task model
R=scheglov@google.com

Review URL: https://codereview.chromium.org//1175843003.
2015-06-10 09:05:41 -07:00
Konstantin Shcheglov c5c4d5e788 Use ConstantVerifier in VerifyUnitTask.
Number of failing tests: 126 -> 30.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//1174763002.
2015-06-09 15:26:19 -07:00
Konstantin Shcheglov a2e4e671e9 Build full LIBRARY_ELEMENT for every library source in the import/export closure, when resolve a unit.
This fixed 8 Analysis Server tests.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//1165283006.
2015-06-09 14:02:43 -07:00
Paul Berry 4e36247eea In constant evaluation, consistently handle const depending on non-const.
It is a compile-time error for a constant value to depend on a
non-constant value (or a non-constant constructor), however the
analyzer still needs to be able to handle it.

This CL adjusts the ConstantEvaluationEngine so that it consistently
reports all the dependencies of a given constant (whether those
dependencies are constant are not), but which is tolerant of being
asked to compute a constant value of a non-constant.

Fixes test failures with the new task model enabled.  No behavioral
change with the new task model disabled.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org//1167413005.
2015-06-09 13:48:43 -07:00
Paul Berry fc83ce5ba9 Fix analyzer's handling of import prefixes not followed by '.'.
If 'p' is an import prefix, then 'p = ...' is treated as synonymous
with 'this.p = ...', and 'p()' is treated as synonymous with
'this.p()'.  In all other circumstances where 'p' is not followed by
'.', the spec calls for a compile time error.

Previous to this CL, 'p' not followed by '.' was being treated as
synonymous with 'this.p' under all circumstances.  This CL brings
analyzer in line with the spec, and updates the tests in
tests/language accordingly.

The VM and Dart2js currently fail to implement the compile-time error
properly.  See issues #23611 and #23612.

Fixes issue #23461.

R=scheglov@google.com

Review URL: https://codereview.chromium.org//1173523002.
2015-06-09 13:38:53 -07:00
Konstantin Shcheglov da82786e2a Don't run HTML tests with the new task model.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//1174553003.
2015-06-09 13:21:33 -07:00
Brian Wilkerson db0b64475d Include more errors when computing complete list
R=scheglov@google.com

Review URL: https://codereview.chromium.org//1171893007.
2015-06-09 13:14:17 -07:00
Konstantin Shcheglov d2f80cfaec Fix the test to remove extra hint.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//1174563003.
2015-06-09 10:49:33 -07:00
Konstantin Shcheglov 51c8a30440 Fix for comment references tests.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//1173633002.
2015-06-09 08:52:20 -07:00
Konstantin Shcheglov 25620e2e59 Remove extra CompileTimeErrorCode.DUPLICATE_DEFINITION.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//1170863002
2015-06-08 22:58:32 -07:00
Paul Berry 12696cafe9 Fix a corner case of constant constructor dependency computation.
If a constant constructor does not contain an explicit call to
super(), and the base class lacks an explicit constructor, we need to
avoid marking the implicit base class constructor as a dependency,
since it is non-const.  (Note: this shouldn't occur very often in
real-world usage since is a compile-time error, but we still need to
be able to analyze it without throwing an exception).

Fixes the following test when the new task model is switched on:
co19/Language/07_Classes/6_Constructors/3_Constant_Constructors_A03_t02

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org//1168563004
2015-06-08 11:23:32 -07:00
Konstantin Shcheglov b916cbffa4 Don't run old implementation tests with 'useTaskModel == true'.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//1159153004
2015-06-08 11:03:35 -07:00
Brian Wilkerson 7230007d52 Fix several tests when the new task model is enabled
R=scheglov@google.com

Review URL: https://codereview.chromium.org//1164223002
2015-06-07 19:31:04 -07:00
Brian Wilkerson add5a6910d Remove many explicit references to AnalysisContextImpl and enable testing of the new task model
R=scheglov@google.com

Review URL: https://codereview.chromium.org//1150863007
2015-06-06 08:30:38 -07:00
Konstantin Shcheglov 811877df42 Invalidate resolution of analysisOptions/sourceFactory changes.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//1167483004
2015-06-05 14:09:12 -07:00
Konstantin Shcheglov 787e9fcf7f Reanalyze after creating a referenced part.
We need to finish linking CompilationUnitElement(s) to LibraryElement(s)
even for not existing sources. Otherwise we get NPE later and leave
model in the ERROR state.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//1168743002
2015-06-05 11:29:04 -07:00
Brian Wilkerson ba4523df1a Add correct test for issue 23523
R=scheglov@google.com

Review URL: https://codereview.chromium.org//1166503004
2015-06-05 09:20:54 -07:00
Konstantin Shcheglov 32f4b9aca5 Only units with 'part of' and no other directives are parts.
Invalidate CONTAINING_LIBRARIES as needed.

R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org//1160873004
2015-06-04 14:03:07 -07:00
Brian Wilkerson 5d2cbd5d55 Added test for issue 23523
R=scheglov@google.com

Review URL: https://codereview.chromium.org//1166653006
2015-06-04 13:34:13 -07:00
Brian Wilkerson 56be513cf9 Add isExternal accessor to element model
R=scheglov@google.com

Review URL: https://codereview.chromium.org//1158793004
2015-06-04 12:38:31 -07:00
Konstantin Shcheglov a24d84ecd9 Ensure types are resolved for combined import/export closures.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//1166983005
2015-06-04 11:48:56 -07:00
Konstantin Shcheglov b35d54a8b7 Decide if unit without directives is a part or a library.
1. When there is a library containing it while we are parsing a part.

2. When a part was parsed, but then we found a library containing it.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//1167733004
2015-06-02 16:01:01 -07:00
Konstantin Shcheglov 958638ca20 Record SourceKind.UNKNOWN for not existing sources.
So, they are not returned as library sources.
This fixes one of the Quick Fix tests.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//1167773002
2015-06-02 13:18:56 -07:00
Konstantin Shcheglov 2888728de0 Remove an unused local variable in the test.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org//1155613010
2015-06-02 13:16:52 -07:00
Konstantin Shcheglov 250992aad8 Ignore not existing parts.
We decided to produce an empty token streams, so empty units for them.
So, we need to have a separate check for not existing Source later.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//1160543003
2015-06-02 11:09:27 -07:00
Konstantin Shcheglov b9dbeedb54 Prepare CompilationUnitElementDelta in IncrementalCompilationUnitElementBuilder.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//1155543005
2015-06-02 11:03:03 -07:00
Brian Wilkerson d614533a9e Fix NPE in building element model when part URI could not be resolved
R=scheglov@google.com

Review URL: https://codereview.chromium.org//1155693004
2015-06-02 10:40:03 -07:00
Brian Wilkerson a82c880bb1 Fix NPE when computing dependencies of enum constants
R=paulberry@google.com

Review URL: https://codereview.chromium.org//1156893006
2015-06-02 09:46:21 -07:00
Paul Berry 62f7ac8c5d Fix handling of nested typedefs (for real this time).
This is a re-fix of dartbug.com/21912, which I previously fixed
incorrectly.  Previously, our approach to avoiding infinite loops when
comparing types was to maintain a set of typedefs being expanded on
the stack, and prune the comparison whenever an attempt was made to
expand a typedef that was already being expanded.  However, this was
too strict, since there are legal (non-circular) types which invole
expanding a given typedef in reentrant fashion; we can't prune these
types without producing incorrect semantics.  An example (from the bug
report) is the type of f in the code below:

    typedef T Function2<S, T>(S z);
    Function2<Function2<A, B>, Function2<B, A>> f;

The solution is to maintain the list of typedefs being expanded inside
each FunctionTypeImpl object (and InterfaceTypeImpl object) rather
than on the stack during the comparison; this allows us to distinguish
the situations where we need to prune (those having to do exclusively
with expansion of a typedef) from the situations where we shouldn't
prune (those having to do with substitution of a type parameter).

A beneficial side effect of this change is that code that interacts
with types no longer needs to worry about typedef circularities, since
the circularities will automatically be pruned while exploring the
type definitions.  This simplifies the implementation of
isAssignableTo, isSubtypeOf, operator==, and hashCode.  (Note,
however, that code still needs to cope with circularities in the
inheritance hierarchy).

BUG=dartbug.com/21912
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org//1143003007
2015-06-01 12:45:27 -07:00
Konstantin Shcheglov f1d4ef9164 Issue 23409. Don't set 'propagatedType' in (vs. after) 'name is Type'.
This fixes the corresponding 'Extract Method' issue.

R=brianwilkerson@google.com
BUG=https://code.google.com/p/dart/issues/detail?id=23409

Review URL: https://codereview.chromium.org//1161343002
2015-06-01 12:40:30 -07:00
Konstantin Shcheglov 9a70cb5333 Remove AnalysisContext.visibleLibraries getter.
It is not used anymore.
It's functionality is not clear.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//1156223005
2015-06-01 09:40:30 -07:00
Konstantin Shcheglov 9dc5bc79f1 Issue 23518. Match prefixes of prefixed types.
R=brianwilkerson@google.com
BUG= https://code.google.com/p/dart/issues/detail?id=23518

Review URL: https://codereview.chromium.org//1149953005
2015-06-01 09:27:29 -07:00
Konstantin Shcheglov 4f7799c258 Fix two applyChanges() tests.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//1152553005
2015-06-01 08:30:28 -07:00
Paul Berry 1017ea0fca Verify that new task manager invalidation code handles cycles.
R=scheglov@google.com

Review URL: https://codereview.chromium.org//1165573002
2015-05-29 11:07:33 -07:00
Brian Wilkerson fb983067bd Rename Element.node
Review URL: https://codereview.chromium.org//1163573002
2015-05-28 08:27:23 -07:00
Konstantin Shcheglov 8bcdd16e06 Schedule ChangeNotice results only after parse/resolve/errors.
We have too many steps to compute all the errors.
It does not worth to send them every time.

This helps to save 500 ms on the analyzer project.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//1154033002
2015-05-24 10:02:44 -07:00