Commit Graph

6388 Commits

Author SHA1 Message Date
Martin Kustermann 9634e053cb [analyzer/ffi] Remove Struct type parameter in analyzer mock SDK
Change-Id: Ifb178f3128082629ade5d7bf9b1b23736b8dfc98
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121840
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2019-10-16 10:27:41 +00:00
Konstantin Shcheglov e221f83feb Set nullability for function typed formal parameters.
This covers the issue, but function typed field formal parameters
are still to be supported.

Bug: https://github.com/dart-lang/sdk/issues/38811
Change-Id: Ibcee1b5a76aee4d80f9bb6085a918955cf9fb05e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121801
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-10-15 23:23:12 +00:00
Martin Kustermann 65813f5856 [analyzer/ffi] Extends dart:ffi specific analyzer checks
This makes all tests in the ffi test suite pass:

   % tools/test.py -cdart2analyzer -mrelease -ax64 ffi

Issue https://github.com/dart-lang/sdk/issues/35777

Change-Id: I93338ee530041e5e8cb1eb5958b12fbf1517496e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121711
Auto-Submit: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-10-15 21:33:27 +00:00
Sam Rawlins 3778839976 Fix version number that first supports ui-as-code; fixes #37898
Change-Id: Iaaec4dedbe8f9b2b5331fa9c69c39d5032383d75
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113743
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2019-10-15 19:35:49 +00:00
Daco Harkes d82ca1a9c7 [vm/ffi] Remove Struct type argument
This has coupled changes in package:ffi and package:tflite_native which are pinned in DEPS.

This CL includes the required analyzer changes from https://dart-review.googlesource.com/c/sdk/+/121647.

Issue: https://github.com/dart-lang/sdk/issues/38611

Change-Id: I712a886fd28ce0a2954fc42c90e1dfa495057732
Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,app-kernel-linux-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-dartkb-linux-debug-simarm64-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-dartkb-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-dartkb-linux-release-x64-abi-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-reload-mac-release-simdbc64-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-precomp-mac-release-simarm_x64-try,dart-sdk-linux-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121422
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-10-15 18:35:57 +00:00
Konstantin Shcheglov abecefd1ac Forward compatible portion of CL that does not set types for identifiers that are not expressions.
The full CL:
https://dart-review.googlesource.com/c/sdk/+/119761

Change-Id: I9c909a4e1eec5d05f5718849ea45da79f01c5291
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121643
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-10-15 17:29:07 +00:00
Konstantin Shcheglov 15fe929bbb Don't use LocalElementBuilder in top-level inference.
Change-Id: Ia390441fae26ac53abcd4fff65e8244f727e152d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121648
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-10-14 22:15:57 +00:00
Paul Berry c9c8e4d84f Resolver fix: set auxiliaryElements properly for property accesses.
Previously we only set it for index expressions, prefixed identifiers,
and simple identifiers.

Change-Id: Ib666aa936f0e7bf7421cb74e491d35ab5507d412
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121520
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-10-14 19:44:10 +00:00
Konstantin Shcheglov 10ad0c3830 Don't use '.type' in FindElement.
R=brianwilkerson@google.com

Change-Id: I8c73bea747f1ad771351f06cd7bea41b2ade6e8c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121661
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-10-14 19:03:48 +00:00
Brian Wilkerson af671211ab Add more ffi related checks
There are still two checks that I'm aware of that are not being performed
(there are TODOs for them) and two diagnostics that need to be removed
because `Struct` will soon not take a type argument.

Change-Id: I17424a32225eeff7e3b2c0e0f36cfc6ccd45e0a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121640
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-10-14 18:36:25 +00:00
Konstantin Shcheglov dc0db066e6 Remove ChangeSet from engine.dart
Change-Id: I289c5edd0c3e52a873013f8c52d8202bf29cf3be
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121560
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-10-14 17:45:56 +00:00
Konstantin Shcheglov aeacf565ab Check for missing required arguments using parameter elements.
Bug: https://buganizer.corp.google.com/issues/140314870
Change-Id: I42a615fbd17af2b3d3b424f847a4b75463415377
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121540
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-10-14 17:40:36 +00:00
Konstantin Shcheglov 6ad5c2e0b9 Combine elements building with TypeName(s) resolution.
This CL passes presubmit in google3.
https://test.corp.google.com/ui#id=OCL:273879967:BASE:274371532:1570918058929:7943e848

Change-Id: Icea75f6544dcdb01602ff3ef1a899bb59729c6a8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120820
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-10-14 16:57:51 +00:00
Paul Berry 61790a17b6 Flow analysis: add support for non-null assertion operator.
Change-Id: I7a60944a4389b6f7c8e182d5c9b402fcbb05b624
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121100
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-10-12 03:11:03 +00:00
Paul Berry 4e9220efdb Flow analysis: change the way parenthesized expressions are handled.
Instead of forcing the client to provide a way to de-parenthesize an
expression, the client informs flow analysis when a parenthesized
expression is encountered.  This reduces the runtime overhead to zero
for non-parenthesized expressions, and it saves the front end from
having to worry about support for parenthesized expressions (since its
internal representation doesn't care about parentheses).

Change-Id: I0bb6e91c87acaa05591e1b075da18700b11e4aae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121080
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
2019-10-12 03:11:03 +00:00
Kallen Tu ff8c704e9b Clean up handleVarianceModifier error handling and move to endTypeVariable.
Change-Id: I526e41511f57b48010d52dbcb7f7d7feb79600da
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120932
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2019-10-11 18:39:28 +00:00
Brian Wilkerson a2e00066ff Add an error if a field in a struct class does not have a type annotation
Change-Id: Ie38354045f0b5d1d8a335c6bb2d14689c2b49d6d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121460
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-10-11 18:11:58 +00:00
Brian Wilkerson 3f80de6dc5 Generate errors rather than hints for ffi conformance checks
Change-Id: Icb3a3b393200ae7b2cd0d0b603472e90174c970b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121403
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-10-11 17:18:09 +00:00
Brian Wilkerson 5facc76ad9 Initial set of hints for ffi
This should cover the checks under "Subtyping restrictions" and
"Struct rules". The remaining checks will be in a follow-on CL.

Change-Id: Iaa328dad545e4f9cddd413c6039f7c15744db5b7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121146
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-10-10 22:27:24 +00:00
Konstantin Shcheglov 0dd6ea1354 Deprecate 'useDart2jsPaths' in SdkLibrariesReader_LibraryBuilder.
Change-Id: Id9a7bf06e270572d7df1dc4c78c2ea72c6e5eaf6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121145
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-10-10 21:13:03 +00:00
Konstantin Shcheglov 58c70b8e55 Store the actual static type of IntegerLiteral(s) in summary.
Fixes #35993
Fixes #33441

Change-Id: I369da4e4437db5ae31fb1c4eb7d3ab0657d9ceb5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120520
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2019-10-10 20:03:28 +00:00
Paul Berry fd60a3eeba Flow analysis: generalize handling of ==.
This moves the logic for detecting the patterns `variable == null` and
`null == variable` into flow analysis, so that they don't need to be
replicated in each client.  It also opens the door to potential future
improvements (e.g. allowing `x == expr` to promote `x` to non-nullable
if expr has a non-nullable type).

Change-Id: I51fd9df822e3df1eb8bad5884f767c8b61c496ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120934
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-10-10 19:55:22 +00:00
pq 795949de00 fix loopVariable null access
See: https://github.com/dart-lang/linter/issues/1759

Addresses Object.noSuchMethod:

00:53 +313 -3: rule dart (config: nnbd) omit_local_variable_types [E]
  NoSuchMethodError: The getter 'declaredElement' was called on null.
  Receiver: null
  Tried calling: declaredElement
  #0      Object.noSuchMethod (dart:core-patch/object_patch.dart:51:5)
  #1      ResolverVisitor.visitForStatementInScope (package:analyzer/src/generated/resolver.dart:3993:30)
  #2      ScopedVisitor.visitForStatement (package:analyzer/src/generated/resolver.dart:5477:7)
  #3      ForStatementImpl.accept (package:analyzer/src/dart/ast/ast.dart:4772:49)
  #4      NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:7682:20)
  #5      BlockImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:1115:17)
  #6      ResolverVisitor.visitNode (package:analyzer/src/generated/resolver.dart:4286:10)
  #7      UnifyingAstVisitor.visitBlock (package:analyzer/dart/ast/visitor.dart:3128:31)
  #8      ScopedVisitor.visitBlock (package:analyzer/src/generated/resolver.dart:5187:13)
  #9      BlockImpl.accept (package:analyzer/src/dart/ast/ast.dart:1111:49)
  #10     BlockFunctionBodyImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:1070:13)
  #11     ResolverVisitor.visitNode (package:analyzer/src/generated/resolver.dart:4286:10)
  #12     UnifyingAstVisitor.visitBlockFunctionBody (package:analyzer/dart/ast/visitor.dart:3131:55)
  #13     ScopedVisitor.visitBlockFunctionBody (package:analyzer/src/generated/resolver.dart:5198:13)
  #14     ResolverVisitor.visitBlockFunctionBody (package:analyzer/src/generated/resolver.dart:3522:13)
  #15     BlockFunctionBodyImpl.accept (package:analyzer/src/dart/ast/ast.dart:1066:49)
  #16     FunctionExpressionImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:5088:12)
  #17     ResolverVisitor.visitNode (package:analyzer/src/generated/resolver.dart:4286:10)
  #18     UnifyingAstVisitor.visitFunctionExpression (package:analyzer/dart/ast/visitor.dart:3263:57)
  #19     ScopedVisitor.visitFunctionExpression (package:analyzer/src/generated/resolver.dart:5524:13)
  #20     ResolverVisitor.visitFunctionExpression (package:analyzer/src/generated/resolver.dart:4050:13)
  #21     FunctionExpressionImpl.accept (package:analyzer/src/dart/ast/ast.dart:5082:49)
  #22     FunctionDeclarationImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:4941:26)
  #23     ResolverVisitor.visitNode (package:analyzer/src/generated/resolver.dart:4286:10)
  #24     UnifyingAstVisitor.visitFunctionDeclaration (package:analyzer/dart/ast/visitor.dart:3256:59)
  #25     ScopedVisitor.visitFunctionDeclarationInScope (package:analyzer/src/generated/resolver.dart:5517:11)
  #26     ResolverVisitor.visitFunctionDeclarationInScope (package:analyzer/src/generated/resolver.dart:4025:11)
  #27     ScopedVisitor.visitFunctionDeclaration (package:analyzer/src/generated/resolver.dart:5510:7)
  #28     ResolverVisitor.visitFunctionDeclaration (package:analyzer/src/generated/resolver.dart:4016:13)
  #29     FunctionDeclarationImpl.accept (package:analyzer/src/dart/ast/ast.dart:4934:49)
  #30     ResolverVisitor.visitCompilationUnit (package:analyzer/src/generated/resolver.dart:3608:23)
  #31     CompilationUnitImpl.accept (package:analyzer/src/dart/ast/ast.dart:2140:49)
  #32     LibraryAnalyzer._resolveFile (package:analyzer/src/dart/analysis/library_analyzer.dart:680:10)
  #33     LibraryAnalyzer.analyzeSync.<anonymous closure> (package:analyzer/src/dart/analysis/library_analyzer.dart:151:7)
  #34     _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:377:8)
  #35     LibraryAnalyzer.analyzeSync (package:analyzer/src/dart/analysis/library_analyzer.dart:150:11)
  #36     LibraryAnalyzer.analyze.<anonymous closure> (package:analyzer/src/dart/analysis/library_analyzer.dart:113:14)
  #37     _PerformanceTagImpl.makeCurrentWhile (package:analyzer/src/generated/utilities_general.dart:258:15)
  #38     LibraryAnalyzer.analyze (package:analyzer/src/dart/analysis/library_analyzer.dart:112:43)
  #39     AnalysisDriver._computeAnalysisResult.<anonymous closure> (package:analyzer/src/dart/analysis/driver.dart:1261:63)
  #40     PerformanceLog.run (package:analyzer/src/dart/analysis/performance_logger.dart:34:15)
  #41     AnalysisDriver._computeAnalysisResult (package:analyzer/src/dart/analysis/driver.dart:1237:20)
  #42     AnalysisDriver.getErrors (package:analyzer/src/dart/analysis/driver.dart:548:41)
  <asynchronous suspension>
  #43     LintDriver.analyze (package:analyzer/src/lint/analysis.dart:220:32)
  <asynchronous suspension>
  #44     DartLinter.lintFiles (package:analyzer/src/lint/linter.dart:87:36)
  <asynchronous suspension>
  #45     testRule.<anonymous closure> (file:///Users/pquitslund/src/repos/linter/test/rule_test.dart:262:54)
  <asynchronous suspension>
  #46     Declarer.test.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:test_api/src/backend/declarer.dart:168:27)
  <asynchronous suspension>
  #47     Invoker.waitForOutstandingCallbacks.<anonymous closure> (package:test_api/src/backend/invoker.dart:242:15)
  <asynchronous suspension>
  #48     _rootRun (dart:async/zone.dart:1124:13)
  #49     _CustomZone.run (dart:async/zone.dart:1021:19)
  #50     _runZoned (dart:async/zone.dart:1516:10)
  #51     runZoned (dart:async/zone.dart:1463:12)
  #52     Invoker.waitForOutstandingCallbacks (package:test_api/src/backend/invoker.dart:239:5)
  #53     Declarer.test.<anonymous closure>.<anonymous closure> (package:test_api/src/backend/declarer.dart:166:33)
  #54     _rootRun (dart:async/zone.dart:1124:13)
  #55     _CustomZone.run (dart:async/zone.dart:1021:19)
  #56     _runZoned (dart:async/zone.dart:1516:10)
  #57     runZoned (dart:async/zone.dart:1463:12)
  #58     Declarer.test.<anonymous closure> (package:test_api/src/backend/declarer.dart:165:13)
  <asynchronous suspension>
  #59     Invoker._onRun.<anonymous closure>.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:test_api/src/backend/invoker.dart:392:25)
  <asynchronous suspension>
  #60     new Future.<anonymous closure> (dart:async/future.dart:176:37)
  #61     StackZoneSpecification._run (package:stack_trace/src/stack_zone_specification.dart:209:15)
  #62     StackZoneSpecification._registerCallback.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:119:48)
  #63     _rootRun (dart:async/zone.dart:1120:38)
  #64     _CustomZone.run (dart:async/zone.dart:1021:19)
  #65     _CustomZone.runGuarded (dart:async/zone.dart:923:7)
  #66     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:963:23)
  #67     StackZoneSpecification._run (package:stack_trace/src/stack_zone_specification.dart:209:15)
  #68     StackZoneSpecification._registerCallback.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:119:48)
  #69     _rootRun (dart:async/zone.dart:1124:13)
  #70     _CustomZone.run (dart:async/zone.dart:1021:19)
  #71     _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:947:23)
  #72     Timer._createTimer.<anonymous closure> (dart:async-patch/timer_patch.dart:21:15)
  #73     _Timer._runTimers (dart:isolate-patch/timer_impl.dart:382:19)
  #74     _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:416:5)
  #75     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:12)




Change-Id: I15b2298f88ee986475736807ef8fd15133e18472
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120928
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2019-10-09 23:02:40 +00:00
Paul Berry 88b76997c4 Flow analysis: rework handling of closures.
Rather than suppress all promotions for variables written to in
closures, we track whether a closure might exist that captures a write
to a variable, and only suppress promotions once such a closure
exists.  This is consistent with what is proposed in
https://github.com/dart-lang/language/pull/473.

Contains a repro of #38791.

Change-Id: I4683581908703b510a3231b8fa8ed697121b09da
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120680
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-10-09 18:24:08 +00:00
Paul Berry 144b8eda81 Flow analysis: track variables captured in closures more accurately.
Previously, we considered a variable to be captured by a closure if a
write to that variable occurred anywhere inside a local function.  But
that was overly broad; it meant that we incorrectly classified all
written-to local variables of a local function to be captured.

This CL makes the AssignedVariables logic aware of variable
declaration sites, so that it only considers a variable to be captured
if it is written to at a lower level of local function nesting than
its declaration.  As a side bonus, it means that it can now exclude
out-of-scope variables from all sets of closed-upon and written-to
variables, which should make flow analysis faster by preventing it
from spending a lot of time accounting for variables that aren't
visible.

It also adds tracking of the set of all variables written to and
captured within each top level function.

This partially reverts commit 55466fd3cc.

Change-Id: Ibcd6476445addebed13cfc5ecc470d644e519148
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120800
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-10-09 17:34:51 +00:00
Paul Berry 2f1e430646 Flow analysis: track assigned variables separately for each top level declaration.
In a follow-up CL, I'm going to add logic to track the complete set of
assigned and captured variables seen so far.  We will need these sets
in order to properly cancel promotions on entry to a closure or nested
function.  But for performance reasons we don't want these sets to
include all variables seen in the entire file; just the local function
is sufficient.

Change-Id: I32a42075916be791f2fb7798814cec4c020e8b3b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120751
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-10-09 17:34:51 +00:00
Paul Berry 1325e0ff96 Flow analysis: create flow analysis on entry to top level declarations.
Previously we created flow analysis on entry to a function/method's
block, but that meant that we would miss promotions that occurred
inside constructor initializers.

Contains test cases for #38761

Change-Id: I566fb77173d9ce6b3aae994c525955f3cbe06fff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120503
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-10-08 16:14:21 +00:00
Konstantin Shcheglov f9e7761895 Stop using lazy FunctionType where possible.
We have to keep it for now for GenericFunctionType nodes, because
of the way we build types - we first build elements, for example
GenericFunctionTypeElement, and set the type of the GenericFunctionType
nodes to a lazy FunctionType on top of not-yet-resolved element.
Then on the next step TypeResolverVisitor goes over the AST second
time and updates elements with actual types for TypeName(s).

There is no need for doing this now when we are using summary2, it
has its own way to solve forward references with creating elements for
unresolved AST nodes, and breaking cycles with TypeBuilder(s). But the
current implementation is quite big, and it will take some time for me
to try one or another approach to restructure it.

Change-Id: Ic0b8594a6723f715bc5484f9946324c46e30ffb2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120620
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-10-08 15:25:51 +00:00
Konstantin Shcheglov 3260bb29e0 Remove references to ElementHandle in analyzer and DDC.
Change-Id: I890d263552d3d08a00ff6f9fdf7291a03e8760db
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120630
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-10-08 15:25:14 +00:00
Jens Johansen 8f477fd84a [parser] Disallow covariant on extension method parameters
Fixes #38560.

Change-Id: I4c941fb6713983cc01efbe143c7924d0643efe73
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119332
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-10-08 13:01:40 +00:00
Konstantin Shcheglov a389015083 Rewrite MethodInvocation to FunctionExpressionInvocation when the target is not a method.
Failing tests for DDC are tracked in the following issue:
https://github.com/dart-lang/sdk/issues/38749

Change-Id: I96e0fe9bc87509b99ba982be4572d4ad4f133cca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120342
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-10-08 00:22:39 +00:00
Konstantin Shcheglov ad47b1ca64 Remove summary1, part 2.
Change-Id: I050b62bbbd77db6bd6a2d815e70cfe92cc9432a2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119220
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2019-10-07 17:35:55 +00:00
Konstantin Shcheglov 0881a4a691 Reland "Deprecate TypeParameterTypeImpl.getTypes()"
This is a reland of aa0bd58926

Original change's description:
> Deprecate TypeParameterTypeImpl.getTypes()
> 
> Presubmit in google3 looks green.
> https://test.corp.google.com/ui#id=OCL:272795904:BASE:272795986:1570167013170:de765f48
> 
> Change-Id: I9ef25658a8a8e806b7fcc23b8d9d4e1d297ebff8
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120003
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>

Change-Id: Idbe4fb391711f2f3a03fe9fb32c136af71a7ef04
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120421
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-10-07 17:28:45 +00:00
Konstantin Shcheglov 5f7b837195 Remove unused FunctionElementImpl_forLUB.
R=brianwilkerson@google.com

Change-Id: Ib2147ba3873f8ce9038f4a37db6281bf4a96c58c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120540
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-10-07 14:18:44 +00:00
Konstantin Shcheglov 2c75771611 Write and read the static type of IntegerLiteral.
This is the first part of a bigger change, that should be rolled into
google3, so we can safely assume that this type is right for integer
literals in constant and remove the workaround in runtimeTypeMatch().

https://dart-review.googlesource.com/c/sdk/+/120520

R=brianwilkerson@google.com

Change-Id: I518c898fb84b8c34ead8cdf81b96ef6213b41fa5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120560
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-10-07 14:10:59 +00:00
Paul Berry 897e197dd4 Flow analysis: Update AssignedVariablesVisitor to track functions/methods.
The groundwork for this CL was laid in
https://dart-review.googlesource.com/c/sdk/+/114960 but had not been
used yet.

Change-Id: I5af46ece7fcb6191f70e1d06c6f853c54439d5c0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120502
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-10-07 13:45:59 +00:00
Paul Berry 0a5cf36f14 Make exitFunctionBody safer.
There's no functional change here; it was wrong to have mismatched
exit/enter of a function body before, and it's still wrong.  But this
change makes it easier to track down problems if an exception gets
thrown debug visiting, causing a mismatch; if that happens we can
temporarily comment out the assert to avoid covering up the exception.

Change-Id: Iad1e820f65387b4b2a0537d763b887df18d7fbf4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120480
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-10-07 13:45:59 +00:00
Michael Thomsen 2a8ce5be5a Clarify error message for instantiating abstract classes
Fixes https://github.com/dart-lang/sdk/issues/38695

Consistent with terminology in https://dart.dev/guides/language/language-tour#abstract-classes

Closes #38706
https://github.com/dart-lang/sdk/pull/38706

GitOrigin-RevId: 37eccff807c51c2a08c0fb14fa9128158412b3ca
Change-Id: Ia9434b8b7957f1009fe1d987cbcf5bf878ba540b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119880
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-10-07 09:32:31 +00:00
Sam Rawlins ebc0a88154 Error for assert initializer in redirecting constructor; fixes #37867
Bug: https://github.com/dart-lang/sdk/issues/37867
Change-Id: I74a809f2202e7ea1beeb45a8ce5d62613f102045
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120100
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-10-07 05:33:35 +00:00
Brian Wilkerson 4f309f04e7 Get more information when AstBuilder throws an exception
Change-Id: If095650e6e70efccdf6627f6007e70825ef81216
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120240
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-10-05 19:38:24 +00:00
Konstantin Shcheglov 2c674e9ba9 Consider MultiplyDefinedElement as null for summary serialization.
Bug: https://buganizer.corp.google.com/issues/142145283
Change-Id: I4de873d322236d97fb942dbb0ae3f4fc22a0687e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120440
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-10-05 16:02:24 +00:00
Brian Wilkerson 04910d62f5 Include the deprecation message in diagnostics (issue 38667)
Change-Id: Ib1fa24fa4b112b9675d1f1900cbdda15319080a5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119780
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-10-04 16:27:07 +00:00
Konstantin Shcheglov 3cdfd90481 Revert "Deprecate TypeParameterTypeImpl.getTypes()"
This reverts commit aa0bd58926.

Reason for revert: https://dart-review.googlesource.com/c/sdk/+/119587 was reverted. So, this change now breaks bots because of deprecated
getTypes() usage in DDC.

Original change's description:
> Deprecate TypeParameterTypeImpl.getTypes()
> 
> Presubmit in google3 looks green.
> https://test.corp.google.com/ui#id=OCL:272795904:BASE:272795986:1570167013170:de765f48
> 
> Change-Id: I9ef25658a8a8e806b7fcc23b8d9d4e1d297ebff8
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120003
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>

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

Change-Id: I3dc1a700f496c25eea9898de658a31138bbedcce
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120141
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-10-04 16:04:07 +00:00
Konstantin Shcheglov aa0bd58926 Deprecate TypeParameterTypeImpl.getTypes()
Presubmit in google3 looks green.
https://test.corp.google.com/ui#id=OCL:272795904:BASE:272795986:1570167013170:de765f48

Change-Id: I9ef25658a8a8e806b7fcc23b8d9d4e1d297ebff8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120003
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-10-04 14:32:25 +00:00
Konstantin Shcheglov f480d43f08 Remove DeferredFunctionTypeImpl.
Change-Id: I8d45608867866a50202355fa7e3cf41f6391a3e2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119824
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-10-03 16:53:33 +00:00
Konstantin Shcheglov 0cd0d9a744 Remove FunctionTypeImpl.forTypedef()
Change-Id: I4d54ef8046a8dd5b06b9f815e89d28e5a8a985d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119823
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-10-03 16:25:33 +00:00
Konstantin Shcheglov c1e6533c0e Remove TypeArgumentsComputer and lazy InterfaceType arguments.
Change-Id: I48ca04ca30eb737c832440ef3fe391b169fd323e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119825
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-10-03 14:32:47 +00:00
Konstantin Shcheglov bd30cbff30 Remove FunctionTypeImpl.fresh()
Change-Id: Ie57af4228e9e58ff09dc9ca568392e539997a82c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119822
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-10-03 14:32:37 +00:00
Konstantin Shcheglov a4e1b08e25 Stop using 'Element.type' in TypeSystem.
Change-Id: Ice12345ee8acc58f4f05311fb4b68ad24eadf33d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119769
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-10-03 14:24:42 +00:00
Konstantin Shcheglov 4b1cf2aa10 Stop using 'Element.type' in ElementFactory, AstTestFactory, _OverrideChecker.
Change-Id: I064ec8ae3ab207b686d450c6dcd5fa23b5caca62
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119800
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-10-03 14:24:33 +00:00