Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(669)

Issue 2667343005: Infer Null for return type of functions with empty returns. (Closed)

Created:
3 years, 10 months ago by Leaf
Modified:
3 years, 10 months ago
CC:
reviews_dartlang.org
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Infer Null for return type of functions with empty returns. This allows inference to infer Null as the return type of functions which have no return statements, or which return with no value. Also allows inference to propagate Null. Fixes https://github.com/dart-lang/sdk/issues/28602 Fixes https://github.com/dart-lang/sdk/issues/28630 BUG= R=brianwilkerson@google.com, jmesserly@google.com Committed: https://github.com/dart-lang/sdk/commit/a3b4366f11bee47b818b263b75adf0617f319563

Patch Set 1 #

Patch Set 2 : Avoid merge conflict #

Total comments: 4

Patch Set 3 : Address comments, fix 28630, ddc expectations #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+1766 lines, -1592 lines) Patch
M pkg/analyzer/lib/src/generated/error_verifier.dart View 1 2 3 chunks +3 lines, -3 lines 0 comments Download
M pkg/analyzer/lib/src/generated/resolver.dart View 1 2 6 chunks +15 lines, -4 lines 1 comment Download
M pkg/analyzer/lib/src/generated/testing/test_type_provider.dart View 2 chunks +13 lines, -0 lines 0 comments Download
M pkg/analyzer/lib/src/generated/type_system.dart View 1 chunk +0 lines, -1 line 0 comments Download
M pkg/analyzer/lib/src/summary/link.dart View 1 2 chunks +5 lines, -0 lines 0 comments Download
M pkg/analyzer/lib/src/summary/summary_sdk.dart View 2 chunks +8 lines, -0 lines 0 comments Download
M pkg/analyzer/lib/src/task/strong/checker.dart View 1 2 1 chunk +4 lines, -3 lines 2 comments Download
M pkg/analyzer/test/generated/strong_mode_test.dart View 1 2 5 chunks +70 lines, -0 lines 0 comments Download
M pkg/analyzer/test/src/summary/resynthesize_ast_test.dart View 2 chunks +28 lines, -4 lines 0 comments Download
M pkg/analyzer/test/src/task/strong/checker_test.dart View 1 2 3 chunks +34 lines, -4 lines 0 comments Download
M pkg/analyzer/test/src/task/strong/inferred_type_test.dart View 1 2 6 chunks +69 lines, -65 lines 0 comments Download
M pkg/analyzer/test/utils.dart View 1 chunk +5 lines, -0 lines 0 comments Download
M pkg/dev_compiler/lib/js/amd/dart_sdk.js View 1 2 218 chunks +375 lines, -372 lines 0 comments Download
M pkg/dev_compiler/lib/js/common/dart_sdk.js View 1 2 218 chunks +375 lines, -372 lines 0 comments Download
M pkg/dev_compiler/lib/js/es6/dart_sdk.js View 1 2 217 chunks +373 lines, -370 lines 0 comments Download
M pkg/dev_compiler/lib/js/legacy/dart_sdk.js View 1 2 218 chunks +375 lines, -372 lines 0 comments Download
M pkg/dev_compiler/test/codegen_expected/BenchmarkBase.js View 1 2 2 chunks +3 lines, -3 lines 0 comments Download
M pkg/dev_compiler/test/codegen_expected/closure.js View 1 2 2 chunks +3 lines, -3 lines 0 comments Download
M pkg/dev_compiler/tool/sdk_expected_errors.txt View 1 2 2 chunks +0 lines, -8 lines 0 comments Download
M tests/lib_strong/collection/hash_map_test.dart View 1 2 2 chunks +4 lines, -4 lines 0 comments Download
M tests/lib_strong/collection/hash_set_test.dart View 1 2 2 chunks +4 lines, -4 lines 0 comments Download

Messages

Total messages: 11 (4 generated)
Leaf
3 years, 10 months ago (2017-02-03 02:42:10 UTC) #2
Brian Wilkerson
lgtm https://codereview.chromium.org/2667343005/diff/20001/pkg/analyzer/test/generated/strong_mode_test.dart File pkg/analyzer/test/generated/strong_mode_test.dart (right): https://codereview.chromium.org/2667343005/diff/20001/pkg/analyzer/test/generated/strong_mode_test.dart#newcode1175 pkg/analyzer/test/generated/strong_mode_test.dart:1175: test_futureOrNill_no_return_value() async { "Nill" --> "Null"
3 years, 10 months ago (2017-02-03 14:41:45 UTC) #3
Jennifer Messerly
https://codereview.chromium.org/2667343005/diff/20001/pkg/analyzer/lib/src/generated/error_verifier.dart File pkg/analyzer/lib/src/generated/error_verifier.dart (right): https://codereview.chromium.org/2667343005/diff/20001/pkg/analyzer/lib/src/generated/error_verifier.dart#newcode2312 pkg/analyzer/lib/src/generated/error_verifier.dart:2312: expectedReturnType, _typeProvider.futureOrNullType)) { If I have: Future<Null> foo() { ...
3 years, 10 months ago (2017-02-03 18:47:53 UTC) #4
Leaf
PTAL, thanks! I piggy backed on a small fix for 28630, since it was blocking ...
3 years, 10 months ago (2017-02-06 18:27:15 UTC) #6
Jennifer Messerly
lgtm! https://codereview.chromium.org/2667343005/diff/40001/pkg/analyzer/lib/src/task/strong/checker.dart File pkg/analyzer/lib/src/task/strong/checker.dart (right): https://codereview.chromium.org/2667343005/diff/40001/pkg/analyzer/lib/src/task/strong/checker.dart#newcode57 pkg/analyzer/lib/src/task/strong/checker.dart:57: } else if (expression is NamedExpression) { On ...
3 years, 10 months ago (2017-02-06 20:08:09 UTC) #7
Leaf
Committed patchset #3 (id:40001) manually as a3b4366f11bee47b818b263b75adf0617f319563 (presubmit successful).
3 years, 10 months ago (2017-02-06 20:24:50 UTC) #9
Paul Berry
3 years, 10 months ago (2017-02-07 18:13:03 UTC) #11
Message was sent while issue was closed.
https://codereview.chromium.org/2667343005/diff/40001/pkg/analyzer/lib/src/ge...
File pkg/analyzer/lib/src/generated/resolver.dart (right):

https://codereview.chromium.org/2667343005/diff/40001/pkg/analyzer/lib/src/ge...
pkg/analyzer/lib/src/generated/resolver.dart:9512: _futureOrNullType =
_futureOrType.instantiate(<DartType>[_nullType]);
This line needs to be after line 9517, or a null reference exception will happen
when analyzer is used with old dart SDKs that lack FutureOr<T>.

Fix is here: https://codereview.chromium.org/2683683002

Powered by Google App Engine
This is Rietveld 408576698