Commit Graph

7128 Commits

Author SHA1 Message Date
Konstantin Shcheglov 69526e6512 Depecate many AnalysisOptions fields.
Change-Id: Ibe219527d9abdad38bb99390d3023e7ee6bb8420
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143251
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-04-15 18:36:52 +00:00
Alexander Thomas 3c85da7778 [release] Bump version to 2.9
Change-Id: I2fc393cbb7a9111f4c09db6a2a7a202eeb88992c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142996
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2020-04-15 18:36:42 +00:00
Konstantin Shcheglov d16eacd5e9 Add FileResolver.getErrors() to use instead of resolve() for diagnostics in Cider.
Change-Id: I4eeab48a15d2ada7df16859d61a7fc013f2f8cc3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143480
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-04-15 17:50:03 +00:00
Konstantin Shcheglov aa636281a9 Don't do TOP_MERGE when computing inheritedMap.
Bug: https://github.com/dart-lang/sdk/issues/41470
Change-Id: I9a97ab0b505e4614a338ae20c011ccef7f9026c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143382
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Janice Collins <jcollins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-04-14 20:33:05 +00:00
Johnni Winther dc97454b63 [analyzer,cfe,dart2js] Add pretty printing to id testing
Adds support for pretty printing verbose annotations.
Adds support for force updating annotation texts useful for applying
the pretty printing to valid annotations.

Change-Id: I8fe9b6d2f8198bd5e160854053c8d964ef832a8d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129710
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-04-14 13:24:09 +00:00
Konstantin Shcheglov dd033a6ab7 Report HintCode.NULLABLE_TYPE_IN_CATCH_CLAUSE.
Change-Id: I747fa9992243f811b4a98320a4ebd169f35daec0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143326
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-04-13 20:21:42 +00:00
Konstantin Shcheglov f5b3a0abb0 Save state in FileResolver
Change-Id: I926346c66a5438b3dc97e638ccc34869457f7968
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143014
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2020-04-13 19:03:32 +00:00
Konstantin Shcheglov ec3dd52462 The type 'dynamic' is defined in dart:core.
This makes fixes to analyzer and update the test for updated spec.

Change-Id: Ie5222bcf9056d5cbb7f18437dec04d5af21ff314
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143245
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-04-13 17:55:36 +00:00
Konstantin Shcheglov 3d19be30b5 Report errors for enum constants conflics.
This should fix:
language/enum/syntax_test/05
language/enum/syntax_test/06

Change-Id: Id9cfc9ebd3a39d7234ed7e898196b8d30f417877
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143244
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-04-13 17:52:32 +00:00
Konstantin Shcheglov c57fe977f0 Make exception and stack trace variables final.
This should fix:
language/exception/try_catch_on_syntax_test/10

Bug: https://github.com/dart-lang/sdk/issues/41460
Change-Id: Id300deeeab5d25c5ab8062c8b8f5a887dc8c318b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143243
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-04-13 17:30:52 +00:00
Konstantin Shcheglov 5d703a5c9c Fix computing annotation values when referencing opt-in from opt-out.
Bug: https://buganizer.corp.google.com/issues/153801444
Change-Id: If3297aebd9f72b5d774af5b4570ac9f76638da8b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143250
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-04-13 16:42:31 +00:00
Konstantin Shcheglov f290ae0696 Issue 40554. Apply NORM and TOP_MERGE only when one of the interfaces is not syntactically equal.
Bug: https://github.com/dart-lang/sdk/issues/40554
Change-Id: Ib96873a825a5a33142655231881562e278b586d1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143249
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-04-13 16:42:13 +00:00
Sam Rawlins c9710e5059 analyzer: Do not report on a bad type of return expression if function has illegal return type
Fixes #38188 and fixes #41439

Change-Id: Id6339529afba331750858fb34771bed627ece0be
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143248
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-04-13 03:42:35 +00:00
Konstantin Shcheglov 23a8788f6a Issue 41378. Update on-catch and throw for the spec changes.
Now it is not an error to use a potentially nullable type in on-catch.

But it is an error for throw an expression of type that is not
assignable to Object.

Bug: https://github.com/dart-lang/sdk/issues/41378
Change-Id: If0a198ae618cd01d03f45a46aa1efa6179df76ee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143220
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-04-11 20:08:03 +00:00
Konstantin Shcheglov 89b0f67261 Implement InterfaceType.asInstanceOf() using allSupertypes.
Change-Id: I2e67f68dd924d1abc9718f5e822980692ce47408
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143221
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-04-11 18:39:53 +00:00
Sam Rawlins 5ddea4b8f6 analyzer: Fix analyzer crash when spreading a mixin
Fixes #41424

Change-Id: I2093b02d325f1593f36c4752dd665601d6d0422c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143141
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2020-04-10 23:50:12 +00:00
Mike Fairhurst 353ebdc251 [analyzer] Fix windows test path in micro file resolution
Change-Id: I67b63187894bb59450a50bf5243a60ce85ccf73f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143120
Auto-Submit: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-04-10 19:41:54 +00:00
Sam Rawlins 2c420267b7 analyzer: Do not allow errors to be ignored inline. Fixes #27218
Change-Id: If37dabba3ec18a9f79f44c4ea38d6920a4013019
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140142
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2020-04-10 17:16:24 +00:00
Konstantin Shcheglov 830bfd8886 Rename several FunctionExpressionTest, use shared method.
Change-Id: Id73036441bf1ec165ee84f3b6580eedec87bba28
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143012
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-04-10 16:02:29 +00:00
Konstantin Shcheglov 450ae848f6 Applying a mixin replaces corresponding names in the interface.
Change-Id: I5e2ada71af50aa580f5d236773ccb122fca5591c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143060
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-04-10 15:57:44 +00:00
Konstantin Shcheglov 516f297d87 Generator function bodies don't need a return.
This should fix:
language/async_star/yield_expressions_test

Change-Id: Ifa1dc86f442ca36b292a587d67a208fc15d370dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143011
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-04-10 15:07:34 +00:00
Konstantin Shcheglov fa3a4eb956 Update TOP_MERGE according to the spec change.
Bug: https://github.com/dart-lang/sdk/issues/41412
Change-Id: If61638188e594cb1b4272e0011ff0ebd5dbb2772
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142942
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-04-09 16:28:09 +00:00
Sam Rawlins 38be00f971 analyzer: Do not mark any enum values as unused if the values accessor is accessed
Fixes #41377

Change-Id: I8c3c03c033a18c6770ab7fbe00435eccb747fb49
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142960
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2020-04-09 15:51:49 +00:00
Konstantin Shcheglov f72378eb1b Test that hints are reported.
R=brianwilkerson@google.com, keertip@google.com

Change-Id: Ief4be0bf88e22c7a1462495d4319a9c0ba3cbb08
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142888
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-04-09 01:24:56 +00:00
Konstantin Shcheglov f557fbd943 Support for TypedLiteral in LinterContext.canBeConst().
Bug: https://github.com/dart-lang/linter/issues/2058
Change-Id: I8a037cec8d0b3488733f8cb34eddb3ff2cce5600
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142907
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-04-08 22:04:15 +00:00
Konstantin Shcheglov bcdfdeb280 Issue 41399. Check for 'dynamic' and 'Never' when verifying EXPORT_LEGACY_SYMBOL.
R=brianwilkerson@google.com, paulberry@google.com

Bug: https://github.com/dart-lang/sdk/issues/41399
Change-Id: I7d36c16085bed80460269f477dcb13fdddfd8603
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142900
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-04-08 17:18:53 +00:00
Konstantin Shcheglov d43eb2b368 Support for analysis options in FileResolver.
Change-Id: Ifaebeaf87abdac0260c0084090c39d64c699585e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142821
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
2020-04-08 16:19:15 +00:00
Konstantin Shcheglov ed38c78397 Don't report MISSING_DEFAULT_VALUE_FOR_PARAMETE for external factory constructors.
See https://dart-review.googlesource.com/c/sdk/+/142555 for the context.

Change-Id: I0d20c7ef40f6e59e184a2891b061d82492329545
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142822
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-04-08 15:53:24 +00:00
Konstantin Shcheglov 2d47db7424 Improve DOWN for FutureOr vs. FutureOr or Future.
https://github.com/dart-lang/language/pull/903
https://github.com/dart-lang/sdk/issues/41363

Change-Id: Ieedd4468bbf44b2fec9abba22955eac9b8905a24
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141846
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-04-07 18:35:21 +00:00
Konstantin Shcheglov fa66c73fea Implement hasTypeParameterReference using RecursiveTypeVisitor.
Change-Id: I351f2b03e1866a15528ed781689e2c894a20d466
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142720
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-04-07 18:27:36 +00:00
Konstantin Shcheglov 91b581fb2c Fix LinterContext().canBeConst() - compute dependencies.
Change-Id: Ibcf08f79a9990ca714dd69a0dd0cc856e99335c4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142581
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-04-07 16:38:34 +00:00
Konstantin Shcheglov dcdc71d763 Report CONFLICTING_GENERIC_INTERFACES using ClassHierarchy.
Change-Id: Ib5d79403358efffd5365ac4931c3163d746d933a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142567
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-04-07 15:50:28 +00:00
Konstantin Shcheglov 8a8c2e74d2 Update constants_2018/constant_types_test to allow type parameters in 'as'.
Change-Id: I37b0413914d6677e2be53fb0ce98c51f81694edb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142568
Reviewed-by: Leaf Petersen <leafp@google.com>
2020-04-07 06:50:28 +00:00
Konstantin Shcheglov 92f6b03513 Update ClassHierarchy for legacy support, record errors.
Change-Id: I6a07a750293fa0a16c5b101142e023c8105a85aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142544
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-04-06 23:07:37 +00:00
Konstantin Shcheglov e5e9bc74db Allow potentially constant type expression in 'as'.
Change-Id: I6790816daa0c02dd3d12ffd4aba00f514bf03922
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142449
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-04-06 17:06:14 +00:00
Konstantin Shcheglov bac08fb339 Implement interfaces subtyping check using allSupertypes.
Change-Id: I43a4b98bae913895c7e176dd24a17fc5df7666e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142480
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-04-06 00:20:10 +00:00
Johnni Winther 05103dfe5a [cfe] Implement factor function
+ share test with analyzer

Change-Id: Ie19a8746e65986f46f75c1bdd6bac3e79aedb922
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142369
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-04-05 18:16:00 +00:00
Konstantin Shcheglov 806ff47b0f Match InterfaceType(s) using allSupertypes.
Change-Id: I6694f4c4c0df74dd1d7c1bc9f00792bc419c83bd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142421
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-04-04 00:06:27 +00:00
Konstantin Shcheglov be76b03b1a Update MockSdkElements to create only migrated SDK.
Also update TestAnalysisContext to set AnalysisSessionImpl.

R=brianwilkerson@google.com

Change-Id: I21aafdc602ab049280c199b990ec9df5563fa494
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142340
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-04-03 17:08:07 +00:00
Jens Johansen cd629791d2 [analyzer] Regression test for constructor with operator name
This is a follow up to
https://dart-review.googlesource.com/c/sdk/+/142161

Change-Id: I735854eb74e064ad714d69f8280532d1448fd914
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142153
Auto-Submit: Jens Johansen <jensj@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-04-03 14:09:35 +00:00
Konstantin Shcheglov 1ad0ee1444 Infer when nullable type parameter type.
R=brianwilkerson@google.com

Change-Id: Ifd59905c25cbe979d1c7090e92159124c9fa2ef4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142207
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-04-02 21:11:19 +00:00
Konstantin Shcheglov c147b3dfce More work on ConstraintMatchingTest.
R=brianwilkerson@google.com

Change-Id: I49fa8cd4839ae452d18d49a92b150d57c68be2b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142261
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-04-02 19:11:59 +00:00
Konstantin Shcheglov 6ef554958f Remove typeParameterType() and replace with typeParameterTypeStar() mostly.
R=brianwilkerson@google.com

Change-Id: I66f9323859ecaba9f3f3270132b670c3fe596deb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142069
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-04-02 15:54:09 +00:00
Konstantin Shcheglov b6317c881c Replace interfaceType() with interfaceTypeNone() in ConstraintMatchingTest.
R=brianwilkerson@google.com

Change-Id: I4c0c369c37d51293c2d647046a29df9882cd1541
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142070
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-04-02 15:43:24 +00:00
Konstantin Shcheglov a373aa7ce1 Convert GenericInferrer tests to non-nullable.
I.e. print types with nullabilities, and use 'none' types in tests.

R=brianwilkerson@google.com

Change-Id: Ia53885ebe7077b0de12e01ac5171711ca8b57e46
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142086
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-04-01 22:36:18 +00:00
Konstantin Shcheglov 3af491ecd8 Move additional tests and remove GreatestLowerBoundTest.
Change-Id: I463e4dacb5226d417e6ee13b53540c7c6b76cfc2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142065
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-04-01 21:38:48 +00:00
Konstantin Shcheglov 191be51124 Extract GenericInferrer and type schema.
Change-Id: Ic306342609911e3e232dbf95f30b60cff94c34be
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142062
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-04-01 20:54:48 +00:00
Konstantin Shcheglov cf5620fa9e Use the deep-most packages.
Change-Id: I8c03e67d16a58f48e0ac334c216b21dcf2e532c0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141921
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-04-01 17:42:52 +00:00
Konstantin Shcheglov 0e5b596e0d Extract GreatestLowerBoundHelper and LeastUpperBoundHelper.
Change-Id: I1e10798d2dfe231ab5e6fb87a5eed42e81e43998
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141905
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-04-01 17:41:42 +00:00
Johnni Winther d68f552e70 [analyzer,cfe] Handle (un)assigned state in try-statement
This handles (un)assigned state in try-statement that do not
complete normally. In this case we could create a variable model
for an unreachable state that would be both assigned and unassigned
leading to an assertion failure.

Closes #41284

Change-Id: Id4c7689bc7c614338af3542eb342c964696fca1e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141981
Auto-Submit: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-04-01 15:46:15 +00:00