Commit Graph

7128 Commits

Author SHA1 Message Date
Konstantin Shcheglov 8ecdb19fb2 Fix for type parameters of a local generic function in a static generic method of a generic class.
R=brianwilkerson@google.com, jmesserly@google.com
BUG=

Review URL: https://codereview.chromium.org/1692993004 .
2016-02-15 12:08:35 -08:00
Konstantin Shcheglov 8246f147e9 Validate cache results in incremental resolution tests.
It is OK to keep default parameter elements in the cache and so keep
all the analysis results that depend on constants in the cache.
Parameters don't use their offset in their locations, so they don't
get "lost" during incremental resolution.

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

Review URL: https://codereview.chromium.org/1693243002 .
2016-02-14 09:17:30 -08:00
Brian Wilkerson 71e7ed86c0 Move scanner out of generated and clean up imports
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1693083004 .
2016-02-14 07:48:44 -08:00
Brian Wilkerson eca9d45bd8 Fix source used in tests
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1698733002 .
2016-02-13 11:13:57 -08:00
Konstantin Shcheglov a41b1fcfb6 Ignore enclosing class type parameters in resynthesizing static class members.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1695033002 .
2016-02-13 09:27:31 -08:00
Konstantin Shcheglov b3ce2e1d28 Any field formal parameter has DefaultFieldFormalParameterElementImpl.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1690423002 .
2016-02-12 12:54:00 -08:00
Paul Berry 27fa44fe6b Test and fix resynthesis of nested generic functions.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1694763003 .
2016-02-12 11:44:57 -08:00
Konstantin Shcheglov 18808696db Add support for requesting units from resynthesizer.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1694873002 .
2016-02-12 11:42:20 -08:00
Brian Wilkerson 0616f707dd Fix parsing of generic local functions (issue 25769)
R=paulberry@google.com

Review URL: https://codereview.chromium.org/1693963002 .
2016-02-12 11:38:02 -08:00
Konstantin Shcheglov 878f3b9b1b Validate that (actual) resynthesized elements have the same runtimeType as originals.
Also some tweaks for the found inconsistencies.

R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1688233004 .
2016-02-12 11:32:04 -08:00
Bob Nystrom b0719aa402 Remove unused or unneeded stuff from java_core.dart.
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1688113004 .
2016-02-12 11:10:48 -08:00
Paul Berry 92ad0e0cba Store enums in summary file as bytes.
Reduces SDK summary file size by about 1%.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1690183003 .
2016-02-12 10:57:14 -08:00
John Messerly d15416bdca change static method types to not have the class type parameters
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1683343005 .
2016-02-12 09:39:28 -08:00
Konstantin Shcheglov 1f5f2bc14f Resynthesize positional/named parameters as DefaultParameterElementImpl.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1695773002 .
2016-02-12 08:56:54 -08:00
Konstantin Shcheglov ea249124fe Mark FunctionExpression elements as used in DeclarationResolver.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1692533004 .
2016-02-12 07:05:49 -08:00
Bob Nystrom 1fb9cebd6e Get rid of redundant MockSdk.
The two in src/mock_sdk.dart and src/context/mock_sdk.dart were almost
identical. The former was only used in one place, so I made the latter
support that case.

Also cleaned up a few other minor things I noticed along the way.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1691603002 .
2016-02-11 15:20:04 -08:00
Konstantin Shcheglov 9184f3862e Issue 25385. Set documentation comment for enum constants.
R=brianwilkerson@google.com, paulberry@google.com
BUG= https://github.com/dart-lang/sdk/issues/25385

Review URL: https://codereview.chromium.org/1689303002 .
2016-02-11 14:37:23 -08:00
Konstantin Shcheglov 6038ea770c Serialize parameters visible ranges.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1689283002 .
2016-02-11 14:26:54 -08:00
Konstantin Shcheglov d846e36373 Resynthesize local variables and functions.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1687403003 .
2016-02-11 13:54:11 -08:00
John Messerly f97640745e fix part of #25200, we now reject non-generic fn subtype of generic fn
A few other fixes:
* inference of generic function expressions now works. It was broken because they ignored type parameters.

* fixes subtype of generic functions in the "normal" type system. These types are only possible if generic methods support is enabled, which can be accessed via a flag. The generic methods DEP is designed to work with the normal Dart type system, too, so we try to keep these code paths working. ("normal" type equality for function types already handled this correctly.) This is also needed because strong mode delegates to normal type system for some cases, e.g. to pick warning vs error.

* also refactors structural comparison of two generic function types, along the lines of recent changes, so there is less code duplication. This was my original motivation, but reviewing the code led to the discovery of the other issues.

* refactors strong_test_helper. The existing way of matching up errors did not work with generic function expressions like: /*<T>*/(x) => x. Simplified it to just look for the right offset. This also exposed a bug in a test -- previously, it was possible to have an error that wasn't validated.

R=leafp@google.com, rnystrom@google.com

Review URL: https://codereview.chromium.org/1678313002 .
2016-02-11 13:42:49 -08:00
Konstantin Shcheglov c4602b0c8b Don't use Set when collecting constant targets in a unit.
This forces location / hashCode computation and caching, and the unit
is not linked to its library, so the cached values are not valid.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1691943002 .
2016-02-11 12:35:33 -08:00
Paul Berry 71b593f89e Minor improvements to list representation in flatbuffers.
This CL makes the following changes:

- Renames _FbInt32List to _FbGenericList, and makes it able to
  represent lists of entities whose size isn't 4.

- Adds Uint32ListReader and _FbUint32List classes, which are
  specialized to handle lists of 32-bit unsigned ints.

- Moves common elements of all _Fb*List classes to the _FbList base
  class.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1685263003 .
2016-02-11 12:14:29 -08:00
John Messerly 66e1a1d5f2 fixes #25740, substitute type parameter bound taking into account outer scope type params
FunctionTypeImpl's "typeFormals" now works like its "parameters". typeFormals now propagates the substitution down to the List<TypeParameterElement>, like we already did for List<ParameterElement>.

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

Review URL: https://codereview.chromium.org/1685273002 .
2016-02-11 12:13:21 -08:00
Bob Nystrom e19c6dd79d Consolidate the code that replaces a TypeParameter with its bound.
In the process, I fixed a bug where one version of this same lump of
code wasn't correct anymore now that you can have arbitrarily long
chains of type parameters.

DartType isn't maybe the ideal place for resolveToBound(). I wanted it
somewhere that:

1. Would be obvious enough that someone coming along later would
   discover it instead of reinventing it again.
2. Had access to the various data it needs.
3. Wouldn't need a "is TypeParameterType" guard at every callsite
   before it could be used.

I could put it on TypeProvider instead, since it needs access to Object,
but that felt arbitrary.

It could be a top level function, but then I don't think it would be
very discoverable.

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

Review URL: https://codereview.chromium.org/1686893002 .
2016-02-11 11:27:01 -08:00
Konstantin Shcheglov 201a8d5570 Serialize local functions and variables.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1691693002 .
2016-02-11 11:20:34 -08:00
Paul Berry 4726810f05 Fix table size in flatbuffers.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1691033002 .
2016-02-11 11:05:01 -08:00
Paul Berry be167539ac Test summarization of redirected factory constructors from imported libraries.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1687173002 .
2016-02-11 10:29:24 -08:00
John Messerly 6bf029a5c7 fixes #25641, error message when type arguments do not match
R=rnystrom@google.com

Review URL: https://codereview.chromium.org/1683203002 .
2016-02-10 14:46:31 -08:00
Paul Berry cd94acd7e2 Clear up confusion between type arguments and type parameters in summary tests
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1688683003 .
2016-02-10 14:14:10 -08:00
Paul Berry b18cdd3f77 Ensure that element handles never refer to Member objects.
This is necessary in order for "is" checks (e.g. `element is
ConstructorMember`) to function properly in the presence of element
handles.

To make this possible, it was necessary to lazify the `type` getter in
ExecutableMember, so that attempting to wrap an element handle inside
an ExecutableMember doesn't force the actual element to be
resynthesized.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1686283002 .
2016-02-10 14:11:13 -08:00
Paul Berry 6b492b06a4 Test references from resynthesized const ASTs to ConstructorMembers.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1686253002 .
2016-02-10 13:29:47 -08:00
Paul Berry 1f4d5390b9 Fix summarization of generic redirecting constructors (again).
In the previous fix (4b5d30abba) I
neglected to account for the fact that
ConstructorElement.redirectedConstructor is sometimes a
ConstructorMember, not a ConstructorElementImpl.

Fixing this required properly storing the redirected constructor's
type arguments in the summary.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1683813005 .
2016-02-10 12:55:10 -08:00
Konstantin Shcheglov 6be32fee2d Fix for recording 'null' as a defined element.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1681493005 .
2016-02-10 08:50:10 -08:00
Paul Berry 9717305de4 Remove irrelevant TODOs from summary code.
Also remove the annotation `private` from idl.dart (it was never used).

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1687793003 .
2016-02-10 08:34:05 -08:00
Paul Berry 4b5d30abba Fix summarization of generic redirecting constructors.
This should allow the SDK to be summarized again.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1687513003 .
2016-02-10 08:31:54 -08:00
Konstantin Shcheglov 135be23107 Issue dev_compiler@443. Clone beginToken.
R=brianwilkerson@google.com
BUG= https://github.com/dart-lang/dev_compiler/issues/443

Review URL: https://codereview.chromium.org/1686653003 .
2016-02-09 19:24:14 -08:00
Paul Berry c5b3141564 Deprecate PrefixElement.importedLibraries.
It has never worked.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1686863002 .
2016-02-09 14:59:57 -08:00
Paul Berry e3f246c696 Add support for redirectedConstructor to summaries.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1686713002 .
2016-02-09 14:07:41 -08:00
Paul Berry 8797494885 Rework UnlinkedPublicName.constMembers.
This CL makes the following changes to UnlinkedPublicName.constMembers:

- Includes non-const constructors in it.  This will allow a future CL
  to make use of it for redirected constructors.

- Omits unnamed constructors from it--they were never used, and just
  took up extra space.

- Renames it to UnlinkedPublicName.members to be consistent with the
  fact that it no longer just stores const members.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1685713002 .
2016-02-09 12:38:47 -08:00
Konstantin Shcheglov 854890836c Include dart/test_all into src/test_all and fix element tests.
R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1681153002 .
2016-02-09 08:41:23 -08:00
Konstantin Shcheglov 5c58d884aa Fix for constant instance creation without type arguments.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1686453002 .
2016-02-08 18:26:09 -08:00
Bob Nystrom 3f3b242f39 Probably don't need an unused re-implementation of addAll(). :)
R=paulberry@google.com

Review URL: https://codereview.chromium.org/1674963002 .
2016-02-08 15:12:10 -08:00
Paul Berry 41187534f1 Delete a TODO task that has been taken care of.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1679683005 .
2016-02-08 13:08:37 -08:00
Paul Berry 6841968ea6 Test some corner cases of shadowing between scopes when summarizing constants.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1673373002 .
2016-02-08 12:52:11 -08:00
Konstantin Shcheglov 1b7a84ce3e Resynthesize constructor initializers.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1679923002 .
2016-02-08 12:42:31 -08:00
Konstantin Shcheglov 84cb715bdd Resynthesize invalid constants as unresolved identifiers.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1681513003 .
2016-02-08 12:26:54 -08:00
Paul Berry 68d3b46c6a Fix summarization of unqualified references to class members.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1675393002 .
2016-02-08 12:14:44 -08:00
Konstantin Shcheglov 0a3b938409 Add UnlinkedConst.isValid and set it during summarizing.
Several final fields in SDK have not valid constant expression
initializers, which is OK because the enclosing classes don't have
constant constructors. However we were throwing exceptions and failing
building SDK summaries.

Alternatively we could just ignore final field initializers in classes
without a constant constructor. But it seems to me that we need to
catch exceptions anyway, just in case of invalid code.

R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1674073002 .
2016-02-08 09:11:10 -08:00
Konstantin Shcheglov 46850c69ab Summarize constructor initializers.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1678753002 .
2016-02-08 08:30:58 -08:00
William Hesse b201036951 Remove import of AnalysisException from wrong library.
The class comes from generated/java_engine.dart, not generated/engine.dart

BUG=
R=paulberry@google.com

Review URL: https://codereview.chromium.org/1680703002 .
2016-02-08 17:27:24 +01:00