Commit Graph

61 Commits

Author SHA1 Message Date
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 da75135c7d Revert "Revert "Issue 37608. Use instantiated FunctionType for tear-off(s).""
This reverts commit b31e71e990.

https://github.com/dart-lang/sdk/issues/38546 was fixed.
https://github.com/dart-lang/source_gen/pull/430 fixed source_gen.
source_gen rolled into google3.
So, I think it is safe to re-apply this change.

Change-Id: Ia40830b733fce2ba4473a847df1af3c30cf139a0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119182
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-09-28 14:24:45 +00:00
Konstantin Shcheglov b31e71e990 Revert "Issue 37608. Use instantiated FunctionType for tear-off(s)."
This reverts commit acac9ab11b.

Reason for revert: breaks source_gen, see https://github.com/dart-lang/sdk/issues/38546

Original change's description:
> Issue 37608. Use instantiated FunctionType for tear-off(s).
> 
> I was working of switching runtimeTypeMatch() to purely
> typeSystem.isSubtypeOf(), without working around dartbug.com/35993
> and dartbug.com/33441, but bots were failing. I think that was because
> of this issue with incorrect tear-off types. We have to fix it before
> switching to less generous TypeSystem.
> 
> R=​brianwilkerson@google.com, paulberry@google.com
> 
> Bug: https://github.com/dart-lang/sdk/issues/37608
> Change-Id: I1f5dfc5e86553a352d72e772e791978772fe8fa4
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118379
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>

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

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: https://github.com/dart-lang/sdk/issues/37608
Change-Id: Icb6bf93f9b39d3af1d13e9b103afea5364b9169a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118646
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-09-25 18:06:16 +00:00
Konstantin Shcheglov acac9ab11b Issue 37608. Use instantiated FunctionType for tear-off(s).
I was working of switching runtimeTypeMatch() to purely
typeSystem.isSubtypeOf(), without working around dartbug.com/35993
and dartbug.com/33441, but bots were failing. I think that was because
of this issue with incorrect tear-off types. We have to fix it before
switching to less generous TypeSystem.

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

Bug: https://github.com/dart-lang/sdk/issues/37608
Change-Id: I1f5dfc5e86553a352d72e772e791978772fe8fa4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118379
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-09-23 20:22:07 +00:00
Paul Berry 2cac8637d6 Flow analysis: separate nullability and reachability tests.
Change-Id: I875493ff504f094ade2818f29539525fdd75a808
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112020
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-08-05 22:12:26 +00:00
Paul Berry 612825900e Only create FlowAnalysisResult data structure when running internal tests.
The data structure isn't optimized (recording data into it takes
O(n^2) time, where n is the number of unreachable nodes in the file),
and we don't need it for normal execution anyhow.

Following the model used by CFE and dart2js, the analysis driver has a
new flag `retainDataForTesting` to control whether the test data is
gathered, so that under normal execution there is no overhead.  The
testing data is stored in a new class `TestingData`; we can expand
this class in the future if we need to record other intermediate
analysis results for testing.

Change-Id: I7e79d31b9f3c9c45121dceb49094be802e4d286f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/111481
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-08-05 21:12:43 +00:00
Paul Berry 6c1523410f Flow analysis: Create definite assignment test cases.
The test cases are based on
pkg/analyzer/test/src/dart/resolution/definite_assignment_test.dart,
however those tests are removed because they exercise the old definite
assignment logic (which was never hooked up to the rest of the
analyzer, and was abandoned in favor of flow analysis).  This CL also
removes the old definite assignment logic itself.

There are two behavioral regressions compared to the old definite
assignment logic:

- Assignments inside assert bodies are erroneously assumed to always
  execute (they don't, because assertions may be disabled).

- Flow analysis does not yet understand that a function may be known
  to never return (with NNBD, such a function would have a return type
  of Never).

These regressions have been flagged with TODO comments (in the test
files assert.dart and if.dart respectively), and will be addressed in
later CLs.

Change-Id: I4a3923f667b151fe31cdcca69373ee1f8fb85607
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110400
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-07-31 13:55:54 +00:00
Paul Berry 7557a14a74 Move test cases from type_promotion_test.dart into front end.
We still verify that the analyzer passes these tests, but we now do
the verification using the "ID test" mechanism that's shared with the
CFE.  This will allow the front end to run these tests as soon as its
integration with flow analysis is complete.

Change-Id: I1a7e5ef9698ebac72a72d992f4d765723224fc95
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110343
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-07-31 13:55:54 +00:00
Konstantin Shcheglov c49eeadd2a Remove workarounds for http://dartbug.com/37587
R=brianwilkerson@google.com, paulberry@google.com

Bug: https://github.com/dart-lang/sdk/issues/37587
Change-Id: Ic97738593996bbd1a77b1d62a967fa703ecb6e32
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110700
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-07-26 16:37:21 +00:00
Paul Berry bf4bde6ea2 Move test cases from flow_analysis_test.dart into front end.
We still verify that the analyzer passes these tests, but we now do
the verification using the "ID test" mechanism that's shared with the
CFE.  This will allow the front end to run these tests as soon as its
integration with flow analysis is complete.

Still to do: migrate tests of type promotion and definite assignment
so that they can be shared by the front end.

Change-Id: I3c2ac6ff8b66e3a27110dcdb1f1d2dece447c18d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110260
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-07-24 20:20:09 +00:00
Paul Berry 6c43390cd8 Begin running the shared "ID tests" for constants on the analyzer.
This exposed an analyzer bug--see #37608.

Change-Id: I96af785ce81ebb7b142b4f71cb43942b2b15f879
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110123
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-07-23 22:08:12 +00:00