Commit Graph

673 Commits

Author SHA1 Message Date
Paul Berry 87c6790bb9 Add tests demonstrating bug #25605.
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1650783002 .
2016-01-31 05:43:02 -08:00
Bob Nystrom 434f5bc922 Implement the spec's notion of LUB for function types.
Fixes #23381.

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

Review URL: https://codereview.chromium.org/1648063002 .
2016-01-29 10:37:58 -08:00
Brian Wilkerson 18482981d3 Fix an exception caused by malformed code
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1648923003 .
2016-01-29 10:26:30 -08:00
Konstantin Shcheglov 2546e179a9 Make constant map literal ordered.
Plus couple fixes for spelling problems.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1643253002 .
2016-01-29 09:31:03 -08:00
Konstantin Shcheglov df5d6bd6e1 Move more constant tests to constant_test.dart file.
I found out that we use HashMap for constant map literals.
But then I realized that I we could move more tests into the right
place.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1647183002 .
2016-01-29 08:58:41 -08:00
pq e902b07ed4 Engine test fix to keep up with SourceFactory changes.
BUG=
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1645173002 .
2016-01-28 12:57:45 -08:00
Bob Nystrom 4af641864f A missing enum case in a switch is a warning, not a compile-time error.
Fixes #25576.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1644683002 .
2016-01-28 11:12:25 -08:00
Brian Wilkerson b33f1380d0 Add tests, including test for issue
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1647613002 .
2016-01-27 12:44:14 -08:00
Paul Berry 4e86a006db Stop precomputing ClassElement.isValidMixin.
Previously, we would precompute the value of ClassElement.isValidMixin
and store it in the Modifier.MIXIN.  But this didn't really save any
time, because (a) isValidMixin isn't used inside analyzer, and (b) it
is easily derivable from other information already present in the
element model.

Also, we were computing it incorrectly when the `--supermixin` flag
was present.

This CL replaces the precomputation logic with a direct implementation
in ClassElement.isValidMixin which is correct regardless of the
presence of the `--supermixin` flag.  The tests are beefed up so that
(a) they validate correct behavior for both states of the flag, (b)
they validate correct behavior in the presence of factory
constructors, and (c) they validate that the behavior of
`isValidMixin` is consistent with the error messages produced by the
analyzer.

In addition to fixing bugs, the removal of Modifier.MIXIN means we
have one less piece of information to store in summaries.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1635063003 .
2016-01-26 07:29:48 -08:00
Brian Slesinsky ccf3870ffc final fields shouldn't be dependencies of const variables
(They are only dependencies of const constructors.)

This was causing bogus error messages to appear
when a const expression mistakenly references
a final field.

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

Review URL: https://codereview.chromium.org/1620963003 .
2016-01-25 15:53:41 -08:00
Brian Slesinsky 28ecd1bbef Oops, move ReferenceTest to constant_test.dart as well
BUG=
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1623673003 .
2016-01-25 13:28:05 -08:00
Brian Wilkerson dd0c42cb72 Moved the AST related tests to their new locations
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1612933006 .
2016-01-23 09:45:01 -08:00
Konstantin Shcheglov 0025a8383e Copy 'ConstructorName.staticElement' in ConstantAstCloner.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1625473004 .
2016-01-22 15:19:06 -08:00
Brian Slesinsky 001f64b564 print nicer errors for a const dependency graph failure
BUG=
R=brianwilkerson@google.com, paulberry@google.com

Review URL: https://codereview.chromium.org/1618103002 .
2016-01-22 14:47:18 -08:00
John Messerly 9a4b1c36ce fixes #25482, flatten futures in strong mode so Future.then works
Also fixes https://github.com/dart-lang/dev_compiler/issues/228

A few tweaks were made to the propagatedType inference for Future.then:
* only record type if better than static type
* only go down this path when strong mode is off

also renames tests: test_pseudoGeneric to test_genericMethod.

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

Review URL: https://codereview.chromium.org/1609093003 .
2016-01-22 13:29:58 -08:00
Brian Slesinsky 771fea4502 move constant tests to constant_test.dart
BUG=
R=brianwilkerson@google.com, paulberry@google.com

Review URL: https://codereview.chromium.org/1616743006 .
2016-01-22 12:44:15 -08:00
Konstantin Shcheglov 068b886543 Disable incremental resolution for constructor parameter names changes.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1620453002 .
2016-01-21 14:33:42 -08:00
Konstantin Shcheglov b78decfa8f Issue 25522. Insert a synthetic '>' for incomplete type arguments.
If we don't do this and insert 'f' instead, later when we attempt to
search 'f' by its offset we find the type instead of the identifier 'f'.

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

Review URL: https://codereview.chromium.org/1615963003 .
2016-01-21 13:03:24 -08:00
Konstantin Shcheglov 0a495243c6 Validate that int values that we write to summaries are >= 0.
Also make tweaks for TestTypeProvider to ensure that this is true.

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

Review URL: https://codereview.chromium.org/1605763007 .
2016-01-20 13:38:10 -08:00
Konstantin Shcheglov 203e16919a Issue 25515. Don't incrementally resolve if a constructor initializer is changed.
R=brianwilkerson@google.com
BUG= https://github.com/dart-lang/sdk/issues/25515

Review URL: https://codereview.chromium.org/1606103003 .
2016-01-20 08:49:29 -08:00
Konstantin Shcheglov 23e9fbcf30 Issue 25514. Harden parents validation in incremental resolver.
R=brianwilkerson@google.com, skybrian@google.com
BUG= https://github.com/dart-lang/sdk/issues/25514

Review URL: https://codereview.chromium.org/1605263002 .
2016-01-20 08:02:07 -08:00
Konstantin Shcheglov 07f8831bc2 Serialize constant initializers.
No implementation for element references in this CL.

R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1602203004 .
2016-01-19 13:42:51 -08:00
Brian Wilkerson 21ecb14548 Clean-up imports
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1602803002 .
2016-01-18 15:42:16 -08:00
Konstantin Shcheglov 78aad4c282 Fix the build - add the new field.
TBR

R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1598183003 .
2016-01-17 09:41:21 -08:00
Brian Wilkerson d116322f7d Do not produce hint on constructor when class is deprectated (issue 25503)
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1598773004 .
2016-01-16 15:09:56 -08:00
Konstantin Shcheglov 6b56451788 Issue 25504. Fix for ignoring expression bodies in incremental resolver.
R=brianwilkerson@google.com
BUG= https://github.com/dart-lang/sdk/issues/25504

Review URL: https://codereview.chromium.org/1584653007 .
2016-01-15 12:20:49 -08:00
Dan Rubel b7303a3409 plumb through enableAsync
and mock async library elements if enableAsync is false

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1591653003 .
2016-01-15 14:15:02 -05:00
John Messerly 9da8970cdf fix #25486, promote from dynamic in strong mode
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1585323003 .
2016-01-14 16:19:27 -08:00
John Messerly 9098ae50ae fix #25425, more inference of generic methods
this adds support for function expr invocation, as well as other element types besides executable elements

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

Review URL: https://codereview.chromium.org/1586813002 .
2016-01-14 13:27:34 -08:00
John Messerly 724492ca82 fixes #25340, propagatedType now finds the instantiated generic method's return type
R=brianwilkerson@google.com, leafp@google.com

Review URL: https://codereview.chromium.org/1582863003 .
2016-01-14 13:20:13 -08:00
John Messerly 154959c762 fixes #25407, generic list and map literal type comments
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1589663002 .
2016-01-14 13:18:59 -08:00
danrubel 559fb01244 assert isAsynchronous and isGenerator false if parseAsync is false
and fix ASYNC_NOT_SUPPORTED error code

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

Review URL: https://codereview.chromium.org/1584823003 .
2016-01-14 14:52:23 -05:00
Brian Wilkerson 1e9326d13f Add tests for computation of constant expressions involving ??
R=paulberry@google.com

Review URL: https://codereview.chromium.org/1589043002 .
2016-01-14 10:55:21 -08:00
Konstantin Shcheglov 9484bfe1c9 Issue 25064. Incrementally resolve comments only if both are documentation.
R=brianwilkerson@google.com, skybrian@google.com
BUG= https://github.com/dart-lang/sdk/issues/25064

Review URL: https://codereview.chromium.org/1581293002 .
2016-01-14 08:38:37 -08:00
Konstantin Shcheglov 0d8a31e0a6 Create LibraryElement.loadLibrary during resynth.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1583613002 .
2016-01-13 09:35:37 -08:00
John Messerly 351ccc586f fix generic function expressions, part of #25175
R=leafp@google.com

Review URL: https://codereview.chromium.org/1579303002 .
2016-01-12 16:04:57 -08:00
Brian Slesinsky 5cc87405aa Don't log stack trace for a bad package URL in a source file.
BUG=https://github.com/dart-lang/sdk/issues/25367
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1572073003 .
2016-01-11 15:53:49 -08:00
John Messerly bc7843b025 fix #25280, treat setters as returning void in strong mode
this gives better checking for an incorrect "return" in a setter

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1531313002 .
2016-01-11 14:42:48 -08:00
John Messerly 8c1e862a90 support generic methods in FunctionExpressionInvocation node
fixes part of #25175

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

Review URL: https://codereview.chromium.org/1561233003 .
2016-01-11 12:56:07 -08:00
Paul Berry 8a29a99286 Properly set UnlinkedReference.prefixReference in summaries.
This information will be necessary when a change to a file forces
summaries to be relinked.

Note that the way we determine the prefix is a bit kludgy: we look at
the export namespaces of the imported libraries and arbitrarily choose
a prefix that points to the given element.  This will give subtly
incorrect results if a name is reachable via multiple prefixes,
however this is unlikely to pose a problem in non-contrived use cases.
See the test
`fail_type_reference_to_type_visible_via_multiple_import_prefixes` for
a more detailed explanation of what might go wrong.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1574763002 .
2016-01-09 15:25:40 -08:00
danrubel b852ddc41a add parser parseAsync flag
add new ASYNC_NOT_SUPPORTED error code
update ParseTask to support enableAsync
add AnalysisOptions.enableAsync flag

partially addresses https://github.com/dart-lang/sdk/issues/25373

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1570183002 .
2016-01-08 15:50:38 -05:00
Paul Berry 306625d1bb Fix computation of documentationComment for class type aliases.
R=brianwilkerson@google.com, pquitslund@google.com

Review URL: https://codereview.chromium.org/1567243002 .
2016-01-08 10:37:13 -08:00
Paul Berry daf4b9b49b Fix a few missed references to boundTypeParameters.
In 924f2f97b7, this was renamed to
`typeFormals`.

R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1563383002 .
2016-01-07 15:40:33 -08:00
John Messerly 924f2f97b7 clean up generic methods in resolution
Introduces MethodInvocation.staticInvokeType to track the type of this invocation. This provides a natural place to store the instantiated generic function type. We then use this type when we are computing corresponding parameters or return types. As a result we do not need FunctionMember, and some of the code around generics becomes simpler/more uniform.

This approach should be a straightforward way to add support for generics in FunctionExpressionInvocation, in a follow up (see issue #25175).

Also renames "boundTypeParameters" to "typeFormals". "formals" and "actuals" is a pretty common way to describe these, I'm not sure why I didn't think of that better name originally. :)

Also removes broken ParameterMember.== that I had added in a previous CL. And the broken FunctionTypeImpl.originalFunction/instantiatedTypeArguments getters.

Finally, this fixes #23252 in the process of adding this. The return type of a "call" method was not being statically analyzed if the target was a VariableElement.

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

Review URL: https://codereview.chromium.org/1568643002 .
2016-01-07 14:51:36 -08:00
Leaf Petersen d11800e8f5 Fix type parameter element resolution for generics
BUG=
R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1567733002 .
2016-01-06 14:15:48 -08:00
Leaf Petersen 6d4e37cddc Add some generic method tests (currently failing).
This adds tests for some cases where explicit or inferred invocation
of generic methods is not working yet, and also for an issue around
function typed parameters.  The tests currently fail.

It also adds some missing calls to super.setUp that were preventing
solo_test from working correctly.

BUG=
R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1568653002 .
2016-01-06 13:43:21 -08:00
John Messerly e2fa77776c fix hints from analyzer in analyzer
R=paulberry@google.com

Review URL: https://codereview.chromium.org/1559923006 .
2016-01-05 15:19:04 -08:00
Konstantin Shcheglov 3d3b875661 Parse generic function declarations with/without type.
Currently we parse only 'void' generic function declarations.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1560663004 .
2016-01-05 14:52:41 -08:00
John Messerly fcc84d1a03 fix #25305, DeclarationResolver.visitTypeParameter now handles generic methods
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1555213002 .
2016-01-04 15:22:48 -08:00
Konstantin Shcheglov 0eb91d0eef Test for changing method to/from getter/setter.
It does not match, so is not incrementally resolved.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1560433002 .
2016-01-04 13:29:22 -08:00