Commit Graph

4276 Commits

Author SHA1 Message Date
Konstantin Shcheglov d380e888b5 Every enum has toString() method.
R=brianwilkerson@google.com, paulberry@google.com

Bug:
Change-Id: I48ca2da1099bee9cab7a8661d0b7be67eb568793
Reviewed-on: https://dart-review.googlesource.com/34307
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-01-12 16:59:20 +00:00
Mike Fairhurst 095232c71f Expansion of https://dart-review.googlesource.com/c/sdk/+/33660, which
solves the generic function type scoping problem (fixes the test).

Includes further failures documented here:
https://github.com/dart-lang/sdk/issues/31804 with @failingTests.

These do seem to fail today as is, so it should be safe to land.

Bug:
Change-Id: Ice384b6fee35f1b1c4235bb0e4de7a90e2379937
Reviewed-on: https://dart-review.googlesource.com/33582
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2018-01-11 21:45:48 +00:00
Konstantin Shcheglov b7eb0241ee Push UnknownInferredType for implicitly types for-in variables.
This fixes a problem introduced in:
https://dart-review.googlesource.com/c/sdk/+/32861

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

Bug:
Change-Id: I9c8637dd7671dbf409cabbe3a707e615b2e553a2
Reviewed-on: https://dart-review.googlesource.com/34223
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-01-11 20:56:59 +00:00
Konstantin Shcheglov 2ba489c65a Fix resynthesize tests for Windows.
Fixes #31832

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

Bug: https://github.com/dart-lang/sdk/issues/31832
Change-Id: Ie0b1dd9742415fe9cf97b3d3843eeaf3af878308
Reviewed-on: https://dart-review.googlesource.com/33982
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-01-10 20:24:39 +00:00
Konstantin Shcheglov 1514e3f276 Resolve labels while applying resolution.
R=brianwilkerson@google.com, paulberry@google.com

Bug:
Change-Id: I1d50d251e04a51a1ba0c6038592982988c3281b2
Reviewed-on: https://dart-review.googlesource.com/33666
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-01-10 16:53:09 +00:00
Mike Fairhurst 4c1cbe1c8f Solve generic function serialization, but not type param scoping.
This is based on https://dart-review.googlesource.com/c/sdk/+/20481/10,
which required a rollback due to numerous secondary revealed issues.

Rather than deserializing function types with the proper scope, and
breaking inherited function type params, ie, `m(x)` where `x`
implicitly gets the type of `x` from `super.m(... x)`, deserialize
generic types incorrectly so that `const x = <Function<T>(T)>[]` fails
but `m(x)` works.

I have work towards fixing this issue, but it is incomplete (#31804),
and had to be rolled back and the fix is only getting more tangled:
https://dart-review.googlesource.com/c/sdk/+/33582.

For now, this will allow people to use Function types *without* type
parameters with no issues, and introduce no secondary issues, and
hopefully be a more straightforward change in and of itself.

-- From Rolled Back CL --

Remove field formal parameter test from other branch


Test genericFunctionType summarization deeper: params, return.

Didn't see a standard way of testing 'void' in the test so far, so I
followed some other tests and used isNotNull, which could be improved.

Fix type arguments vs parameters.

Fix #30858, generic function types not serializable when const.

Previously declaring for instance const lists (or even final lists) of
generic function types ie `final x = <void Function()>[]` would throw
errors during summarization.

The type parameters don't seem correctly stored yet, but that is an
edge case. Left a TODO, for now this should go in to prevent the
analyzer crash.

One thing I changed as well is that `serializeType` assumed it was
getting a type name, and `serializeTypeName` accepted types but threw
when it didn't get a type name. I flipped the names so that
`serializeTypeName` accepts a type name and `serializeType` accepts a
type in general and decides whether its a type name or a generic
function type to proceed with specialization.

Bug:
Change-Id: I98f5a362c9b2e8b3a7e87532ff4645b5963277ab
Reviewed-on: https://dart-review.googlesource.com/33660
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-01-10 00:16:19 +00:00
Konstantin Shcheglov 527f91a11d Throw FileSystemException from Analyzer's implementation of FileSystem.
R=brianwilkerson@google.com, paulberry@google.com

Bug:
Change-Id: I3c7ea1995085380025b0abb7350b20d20ce16d16
Reviewed-on: https://dart-review.googlesource.com/33584
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-01-09 21:30:29 +00:00
Konstantin Shcheglov 4e9e5d0569 Assign analyzer codes to several FrontEnd errors.
R=brianwilkerson@google.com, paulberry@google.com

Bug:
Change-Id: I2cf2a948048245e016f0f3d316dcf889c4bde31d
Reviewed-on: https://dart-review.googlesource.com/33583
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-01-09 21:25:48 +00:00
Konstantin Shcheglov 8ed12e00ce Use FrontEndCompiler in ResynthesizeKernelStrongTest.
R=brianwilkerson@google.com, paulberry@google.com

Bug:
Change-Id: Ia27b1a4cd85c5ae50e22870e895edfa9f03a3cd5
Reviewed-on: https://dart-review.googlesource.com/33560
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-01-09 21:03:39 +00:00
Mike Fairhurst 428b2013ee Fix new finding from https://dart-review.googlesource.com/c/sdk/+/20481
new errors since the parameter type inference logic was changed:

analyzing pkg/analyzer...
  error • Inconsistent declarations of 'getAncestor' are inherited from
<E>(dynamic) → E, <E extends Element>((Element) → bool) → E at
pkg/analyzer/lib/src/fasta/mock_element.dart:174:16 •
inconsistent_method_inheritance
  error • Inconsistent declarations of 'getAncestor' are inherited from
<E>(dynamic) → E, <E extends Element>((Element) → bool) → E at
pkg/analyzer/lib/src/fasta/mock_element.dart:262:16 •
inconsistent_method_inheritance
  error • Inconsistent declarations of 'getAncestor' are inherited from
<E>(dynamic) → E, <E extends Element>((Element) → bool) → E at
pkg/analyzer/lib/src/fasta/mock_element.dart:315:16 •
inconsistent_method_inheritance
  error • Inconsistent declarations of 'getAncestor' are inherited from
<E>(dynamic) → E, <E extends Element>((Element) → bool) → E at
pkg/analyzer/lib/src/fasta/mock_element.dart:467:16 •
inconsistent_method_inheritance
  error • Inconsistent declarations of 'getAncestor' are inherited from
<E>(dynamic) → E, <E extends Element>((Element) → bool) → E at
pkg/analyzer/lib/src/fasta/mock_element.dart:488:16 •
inconsistent_method_inheritance
  error • Inconsistent declarations of 'getAncestor' are inherited from
<E>(dynamic) → E, <E extends Element>((Element) → bool) → E at
pkg/analyzer/lib/src/fasta/mock_element.dart:501:16 •
inconsistent_method_inheritance
6 errors found.

Bug:
Change-Id: I48b98e287bd6496b0745a1fcb42f87450cbfba9c
Reviewed-on: https://dart-review.googlesource.com/33180
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2018-01-09 16:58:09 +00:00
Konstantin Shcheglov bb52d1afaa Type inference should always infer the return type of operator []= as void.
R=brianwilkerson@google.com, paulberry@google.com

Bug: https://github.com/dart-lang/sdk/issues/31779
Change-Id: I1c396cce3f148585218e02ff4e41bc2f85cc924a
     https://github.com/dart-lang/sdk/issues/31638
Reviewed-on: https://dart-review.googlesource.com/32687
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-01-09 16:57:59 +00:00
Konstantin Shcheglov f99d3628d1 FrontEndCompiler that computes all information about many libraries at once.
Before we used a hack to request resolution information for a single
library as needed, and requested kernels separately. This was hugely
inefficient (but faster to implement as a steel thread). We had then
recompile large library cycles many times, and take just one library.

Before: 480 seconds to compile analyzer (ouch!).
Now: 16 seconds (30 times faster).

Without --previewDart2: 14 seconds.

I will check why it is still slower later.

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

Bug:
Change-Id: Ic3d47684daa74c53f0336523e17b656f26328acf
Reviewed-on: https://dart-review.googlesource.com/33144
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2018-01-09 07:05:54 +00:00
Mike Fairhurst 19920f08e6 Revert "Fix #30858, generic function types not serializable when const."
This reverts commit 60ee2c0dcd.

Reason for revert: Requires https://dart-review.googlesource.com/c/sdk/+/33180 which can land first.

Original change's description:
> Fix #30858, generic function types not serializable when const.
> 
> Previously declaring for instance const lists (or even final lists) of
> generic function types ie `final x = <void Function()>[]` would throw
> errors during summarization.
> 
> The type parameters don't seem correctly stored yet, but that is an
> edge case. Left a TODO, for now this should go in to prevent the
> analyzer crash.
> 
> One thing I changed as well is that `serializeType` assumed it was
> getting a type name, and `serializeTypeName` accepted types but threw
> when it didn't get a type name. I flipped the names so that
> `serializeTypeName` accepts a type name and `serializeType` accepts a
> type in general and decides whether its a type name or a generic
> function type to proceed with specialization.
> 
> Bug: 30858
> Change-Id: Id128f8625cbf03bb94d05ff0efdbac3b158e637e
> Reviewed-on: https://dart-review.googlesource.com/20481
> Reviewed-by: Paul Berry <paulberry@google.com>
> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>

TBR=paulberry@google.com,scheglov@google.com,mfairhurst@google.com

Change-Id: I6fae28335f7815b1e8c43597fb9451519a13335e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 30858
Reviewed-on: https://dart-review.googlesource.com/33200
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2018-01-09 00:37:46 +00:00
Konstantin Shcheglov dd8decb695 Fix for explicit 'call' invocation and property get.
R=brianwilkerson@google.com, paulberry@google.com

Bug:
Change-Id: I17b11d2cfe53ed69ce251d8a7363f9aaf278e89b
Reviewed-on: https://dart-review.googlesource.com/33145
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-01-09 00:18:56 +00:00
Mike Fairhurst 60ee2c0dcd Fix #30858, generic function types not serializable when const.
Previously declaring for instance const lists (or even final lists) of
generic function types ie `final x = <void Function()>[]` would throw
errors during summarization.

The type parameters don't seem correctly stored yet, but that is an
edge case. Left a TODO, for now this should go in to prevent the
analyzer crash.

One thing I changed as well is that `serializeType` assumed it was
getting a type name, and `serializeTypeName` accepted types but threw
when it didn't get a type name. I flipped the names so that
`serializeTypeName` accepts a type name and `serializeType` accepts a
type in general and decides whether its a type name or a generic
function type to proceed with specialization.

Bug: 30858
Change-Id: Id128f8625cbf03bb94d05ff0efdbac3b158e637e
Reviewed-on: https://dart-review.googlesource.com/20481
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-01-08 23:55:54 +00:00
Jaime Wren cd878bc433 Create the new flag --use-cfe in the analyzer, analysis server and analyzer_cli and migrate the old behavior of --preview-dart-2 to --use-cfe. The --preview-dart-2 flag is now a no-op, with functionality coming soon.
See https://github.com/dart-lang/sdk/issues/31640

Change-Id: I2db2e7ef6a324cbd5d369b807e331495fed167df
Reviewed-on: https://dart-review.googlesource.com/33121
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Jaime Wren <jwren@google.com>
2018-01-08 22:37:05 +00:00
Aske Simon Christensen 0c03458717 Reland "Treat most warnings as errors in strong mode."
Reland of https://dart-review.googlesource.com/c/sdk/+/29160

Adds a 'severity' field to diagnostic messages and replaces all
addWarning and addNit functions by a generic addProblem, which uses
the intrinsic severity of the message. Eventually, errors should
also be reported this way.

A special severity value maps into either warning or error for Dart 1
and Dart 2, respectively. Most Dart 1 warnings are in this category.

Fixes some 320 failures of DDK test expecting a compile-time error.
These were previously masked by a workaround in the DDC error handler
which has now been removed.

Closes https://github.com/dart-lang/sdk/issues/31286

Change-Id: Id3b3b7f1fc6a101639fc908c90f3ec7d304a7b4b
Reviewed-on: https://dart-review.googlesource.com/32580
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2018-01-08 09:20:02 +00:00
Konstantin Shcheglov e839405b0f Improve compound assignment inference.
Fixes #31484

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

Bug: https://github.com/dart-lang/sdk/issues/31638
Change-Id: I94a571978a4052adca4c85df06941ccf56998bac
Reviewed-on: https://dart-review.googlesource.com/32863
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-01-08 05:54:53 +00:00
Konstantin Shcheglov 7784ba0056 Correctly infer List<Null> and Map<Null, null> types when outside a method body.
R=brianwilkerson@google.com, paulberry@google.com

Bug:
Change-Id: Ib9c1e86c9514a9e3d2a57400cea394dd25e2e25b
Reviewed-on: https://dart-review.googlesource.com/32802
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2018-01-08 04:18:22 +00:00
Konstantin Shcheglov 27de84923b Use “bool” as the downward inference context for assert conditions, while/do cycles, if/for conditions, and logical operators.
R=brianwilkerson@google.com, paulberry@google.com

Bug: https://github.com/dart-lang/sdk/issues/31638
Change-Id: I869d958515eb29994e570aac8343b90878d30e98
Reviewed-on: https://dart-review.googlesource.com/32880
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-01-08 03:56:32 +00:00
Konstantin Shcheglov 9c05a32fe7 Use the type of the switch expression as the context for case expressions.
R=brianwilkerson@google.com, paulberry@google.com

Bug:
Change-Id: I7a2615f9448dbdd3d22a52fc45312b87e52cd76e
Reviewed-on: https://dart-review.googlesource.com/32881
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-01-08 03:36:13 +00:00
Konstantin Shcheglov a8ebc3115c Use the same rule for inference in expression function bodies as in block bodies.
Bug: https://github.com/dart-lang/sdk/issues/31436
Change-Id: I535c39383d42862f035b54e2fb5c143367605697
     https://github.com/dart-lang/sdk/issues/31638
Reviewed-on: https://dart-review.googlesource.com/32860
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-01-07 20:46:31 +00:00
Konstantin Shcheglov bbd835f322 Improve for-in statement inference.
R=brianwilkerson@google.com, paulberry@google.com

Bug: https://github.com/dart-lang/sdk/issues/31638
Change-Id: Ie15486387a6b5955e42e9fe5fc00cdba4f2ba68a
     https://github.com/dart-lang/sdk/issues/31440
Reviewed-on: https://dart-review.googlesource.com/32861
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-01-07 18:57:11 +00:00
Konstantin Shcheglov 32e310d8c6 Infer closure parameter types as Object instead of Null.
R=brianwilkerson@google.com, paulberry@google.com

Bug: https://github.com/dart-lang/sdk/issues/31638
Change-Id: If739da50a1d7e21c6a1e18da18d1f85f788663da
     https://github.com/dart-lang/sdk/issues/31546
Reviewed-on: https://dart-review.googlesource.com/32669
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2018-01-06 02:31:19 +00:00
Konstantin Shcheglov b275d523b4 Fix summarizing for 64 bit limits.
R=brianwilkerson@google.com

Bug:
Change-Id: I7116f6b3ffc15de5c02db96d993d9c3028359043
Reviewed-on: https://dart-review.googlesource.com/32660
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-01-06 00:30:00 +00:00
Sam Rawlins 43a86d4a60 Fix a few @visibleForTesting enforcement bugs.
Fixes #31742, #31786, #31787

Bug: https://github.com/dart-lang/sdk/issues/31786
Change-Id: Iaa9ee2708ee9e89f1dd84a0223114f1415ef8261
Reviewed-on: https://dart-review.googlesource.com/32666
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2018-01-05 23:44:08 +00:00
Mike Fairhurst e34aae20ce Fix \#31680 function types in type parameter bounds
Bug: 31680
Change-Id: Ib031bb89c3ca1dc3ce96ca10b4d98cf46d7b705b
Reviewed-on: https://dart-review.googlesource.com/32661
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2018-01-05 20:47:09 +00:00
Mike Fairhurst 20c2e06a9d Partial fix of \#31708, parse error with void generic functions in for loop.
Blocked by https://dart-review.googlesource.com/c/sdk/+/32447, or else
an invalid syntax error would become a crash.

With this CL and that one, \#31708 is fully fixed.

Bug: 31708
Change-Id: Iac92d1e61e275e43fdb2fe841c2fb0fee4aa155e
Reviewed-on: https://dart-review.googlesource.com/32448
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-01-05 01:11:56 +00:00
Mike Fairhurst 277274b733 Solve analyzer crash when using a function type in a foreach
Looks like the best place to put this is in the type builder, which has
special logic for foreaches. Previously, that special logic did not
include a need to visit the type, but with [GenericFunctionType]s, its
now necessary.

New test added; fails with kernel.

Bug: 31708
Change-Id: I6536be816a84458cf81d9037289ce6415ed13985
Reviewed-on: https://dart-review.googlesource.com/32447
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-01-05 00:05:57 +00:00
Konstantin Shcheglov 9f7af9963a Convert UNDEFINED_SUPER_METHOD errors.
We don't grab parsing errors with previewDart2 anymore, because the
same errors are reported during compilation.

R=brianwilkerson@google.com

Bug:
Change-Id: I58dc8c098fe4c8b2009c3adb9cbbbc334a748f61
Reviewed-on: https://dart-review.googlesource.com/32444
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-01-04 23:00:36 +00:00
Paul Berry 879badb850 Implement method type override checking rules in front_end.
Test failures introduced by this change have been marked with issue #31616.

Change-Id: Iddbcedb972b5ad2cf12e3fe588bd38aec76816df
Reviewed-on: https://dart-review.googlesource.com/29742
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-01-04 22:46:26 +00:00
Konstantin Shcheglov 2401b16846 Report HintCode.ABSTRACT_SUPER_MEMBER_REFERENCE even if the superclass has noSuchMethod().
See the bug.
This does not make it a compile time error though.

R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/31593
Change-Id: Iefef8eecec43b6b8afaac74198bffbeae1c8b104
Reviewed-on: https://dart-review.googlesource.com/28120
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-01-04 20:32:05 +00:00
Konstantin Shcheglov 7a65a18f83 Fixes to applying resolution to prefixed annotations.
Bug:
Change-Id: I04082a5c3d1047ec9ff908be8b50b4600a2d985f
Reviewed-on: https://dart-review.googlesource.com/32221
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2018-01-04 19:47:45 +00:00
Brian Wilkerson 8d7219a5b6 Add utility method to test the validity of integer literals
Change-Id: I500abe604246a74fb4d574442757ffae5864f96d
Reviewed-on: https://dart-review.googlesource.com/32400
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-01-04 19:21:55 +00:00
Dan Rubel 29f703dd9b Add fasta parser empty named/optional parameter recovery
Change-Id: I440b6cb5aa8b503080e4623a3b87a6046de906a3
Reviewed-on: https://dart-review.googlesource.com/32300
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-01-04 17:06:06 +00:00
Aske Simon Christensen 5402f02cbc Revert "Treat most warnings as errors in strong mode."
This reverts commit 3303df8102.

Reason for revert: Tests failing

TBR=ahe@google.com,askesc@google.com

Change-Id: Ifc8c9def6d134ab1b0c5f094a02a4f57a3581f19
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/32360
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2018-01-04 15:35:17 +00:00
Aske Simon Christensen 3303df8102 Treat most warnings as errors in strong mode.
Adds a 'severity' field to diagnostic messages and replaces all
addWarning and addNit functions by a generic addProblem, which uses
the intrinsic severity of the message. Eventually, errors should
also be reported this way.

A special severity value maps into either warning or error for Dart 1
and Dart 2, respectively. Most Dart 1 warnings are in this category.

Fixes some 320 failures of DDK test expecting a compile-time error.
These were previously masked by a workaround in the DDC error handler
which has now been removed.

Closes https://github.com/dart-lang/sdk/issues/31286

Change-Id: I6acea31b8cba7dec8b318e081d28f4eb4ebbf75c
Reviewed-on: https://dart-review.googlesource.com/29160
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-01-04 14:56:46 +00:00
Kevin Millikin 6fa813d818 Change handling of Kernel static errors
Before: Kernel static errors were represented by throwing a distinguished
error or else by calling a distinguished library const constructor.

Now: Kernel static errors are represented by InvalidExpression.  To support
error reporting, InvalidExpression has an optional message and a file
offset.  A back end can choose to signal these errors at any time; for
example, when deserializing the binary, or when compiling the procedure
containing the static error, or when the erroneous expression is evaluated
at run time.

InvalidStatement is removed because it can be encoded as ExpressionStatement
of InvalidExpression.

Future work:

* supporting static errors where an expression cannot appear in the AST
* allowing InvalidExpression to contain an Expression for error recovery
* adding a top-level list of static errors and warnings to the binary

Bug: https://github.com/dart-lang/sdk/issues/29840
Change-Id: Ifdfe9a76cee6cefed28061bf245be70531d2f413
Reviewed-on: https://dart-review.googlesource.com/31320
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-01-04 11:00:25 +00:00
Konstantin Shcheglov a0abc35f60 Resynthesize function types in constants.
R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/31554#issuecomment-354624024
Change-Id: Id5dc525f5d803c455e5336f460523d57ec832ace
Reviewed-on: https://dart-review.googlesource.com/32147
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-01-03 22:42:25 +00:00
Konstantin Shcheglov ad66944dfd Resolve references to parameters in named arguments.
R=brianwilkerson@google.com

Bug:
Change-Id: I1ae09971b72e1833c21bd6e725981fe99fe02fc4
Reviewed-on: https://dart-review.googlesource.com/32146
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-01-03 21:58:14 +00:00
Konstantin Shcheglov 76c5a9a6c8 Convert errors from FrontEnd into Analyzer.
R=brianwilkerson@google.com, paulberry@google.com

Bug:
Change-Id: I94f219e378437e0bcff3ee8e2ca0598594e59afc
Reviewed-on: https://dart-review.googlesource.com/32143
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-01-03 20:05:25 +00:00
Brian Wilkerson 55a2155a59 Ignore assets that start with "packages/" until we can correctly verify them
Change-Id: I971ce87c957cc2977adf90d161379d5a4cd26afc
Reviewed-on: https://dart-review.googlesource.com/32160
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
2018-01-03 18:05:14 +00:00
Konstantin Shcheglov f57a0511a4 Apply import prefixes in type annotations.
R=brianwilkerson@google.com, paulberry@google.com

Bug:
Change-Id: I185b9860aac8650856c8c13b6784b63f3fe2f379
Reviewed-on: https://dart-review.googlesource.com/32000
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-01-02 22:34:04 +00:00
Konstantin Shcheglov 6b4ae0c7b6 Apply resolution to instance creation with import prefix.
Bug:
Change-Id: Ia032f7e9870531bc7337dc4517f438dacf7779ff
Reviewed-on: https://dart-review.googlesource.com/31746
Reviewed-by: Paul Berry <paulberry@google.com>
2018-01-02 20:15:08 +00:00
Konstantin Shcheglov 6d5f2f09aa Apply resolution to function expression invocations.
Bug:
Change-Id: I895cf9765664f1e9608ec612e4b1897f42cb9d70
Reviewed-on: https://dart-review.googlesource.com/31881
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-01-02 19:34:23 +00:00
Brian Wilkerson c40d9821dc Prepare for optional new/const
Change-Id: I138fffc3f03f2925d5b33cd7f340543789d4b6e6
Reviewed-on: https://dart-review.googlesource.com/31960
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-01-02 16:33:24 +00:00
Brian Wilkerson 8e7781ea9e Convert remaining tests to use ResourceProviderMixin
Change-Id: I7bd0941a415737bd3c9c55e9650f2a982937f777
Reviewed-on: https://dart-review.googlesource.com/31961
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-01-02 16:33:14 +00:00
Konstantin Shcheglov 9b54b25f3e Fix error reporting when it makes tests behave differently in checked and unchecked modes.
R=brianwilkerson@google.com

Bug:
Change-Id: Ib5f7b3c531bfd767e5640ff45e1ad9e7ef0148a9
Reviewed-on: https://dart-review.googlesource.com/31882
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-01-02 05:01:34 +00:00
Brian Wilkerson 1d8a5d77c1 Convert more tests to use ResourceProviderMixin
Change-Id: Ia4cce51e33c79c82a989bfda9b8303dfaa72e103
Reviewed-on: https://dart-review.googlesource.com/31880
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-01-02 00:47:34 +00:00
Brian Wilkerson 706d3382ed Extract common test utilities into a mixin and use them in one class
Change-Id: I4f4b0cc29854b9a5168bf861667a9d87c5be7966
Reviewed-on: https://dart-review.googlesource.com/31821
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2017-12-30 19:50:40 +00:00