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

Issue 1780783002: Don't report redundant type errors in strong mode. (Closed)

Created:
4 years, 9 months ago by Bob Nystrom
Modified:
4 years, 9 months ago
Reviewers:
Leaf, Brian Wilkerson
CC:
reviews_dartlang.org
Base URL:
https://github.com/dart-lang/sdk.git@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Don't report redundant type errors in strong mode. Currently, "sideways casts" -- type errors where one type is assigned to an unrelated type -- are reported by both ErrorVerifier and strong mode's Checker. This leads to duplicate errors that the user can see. ErrorVerifier's errors are generally better: they give the user more contextual information and are easier to read. So this CL eliminates Checker's reporting of these errors and only uses ErrorVerifier's. However, in strong mode, type errors like this are fatal: DDC can't generate correct code. So this also automatically upgrades all static type warnings to errors when strong mode is enabled. R=brianwilkerson@google.com, leafp@google.com Committed: https://github.com/dart-lang/sdk/commit/2ef00b0c3d0182b5e4ea5ca55fd00b9d038ae40d

Patch Set 1 #

Total comments: 24

Patch Set 2 : Clarify some warnings. #

Patch Set 3 : Stop type propagation in test. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+718 lines, -593 lines) Patch
M pkg/analyzer/lib/source/error_processor.dart View 1 chunk +29 lines, -1 line 0 comments Download
M pkg/analyzer/lib/src/generated/error_verifier.dart View 5 chunks +50 lines, -60 lines 0 comments Download
M pkg/analyzer/lib/src/generated/type_system.dart View 1 chunk +12 lines, -0 lines 0 comments Download
M pkg/analyzer/lib/src/task/strong/checker.dart View 8 chunks +23 lines, -28 lines 0 comments Download
M pkg/analyzer/lib/src/task/strong/info.dart View 1 chunk +3 lines, -0 lines 0 comments Download
M pkg/analyzer/test/source/error_processor_test.dart View 1 2 chunks +10 lines, -2 lines 0 comments Download
M pkg/analyzer/test/src/context/mock_sdk.dart View 1 chunk +10 lines, -9 lines 0 comments Download
M pkg/analyzer/test/src/task/dart_test.dart View 1 1 chunk +3 lines, -4 lines 0 comments Download
M pkg/analyzer/test/src/task/strong/checker_test.dart View 1 2 86 chunks +330 lines, -297 lines 0 comments Download
M pkg/analyzer/test/src/task/strong/inferred_type_test.dart View 1 62 chunks +238 lines, -188 lines 0 comments Download
M pkg/analyzer/test/src/task/strong/strong_test_helper.dart View 1 chunk +10 lines, -4 lines 0 comments Download

Messages

Total messages: 12 (2 generated)
Bob Nystrom
I think this gets rid of the main chunk of duplicate error reporting. I'm guessing ...
4 years, 9 months ago (2016-03-09 23:10:28 UTC) #2
Brian Wilkerson
https://codereview.chromium.org/1780783002/diff/1/pkg/analyzer/test/src/context/mock_sdk.dart File pkg/analyzer/test/src/context/mock_sdk.dart (right): https://codereview.chromium.org/1780783002/diff/1/pkg/analyzer/test/src/context/mock_sdk.dart#newcode155 pkg/analyzer/test/src/context/mock_sdk.dart:155: List(); What's the motivation for these changes? Both List ...
4 years, 9 months ago (2016-03-10 00:09:34 UTC) #3
Bob Nystrom
https://codereview.chromium.org/1780783002/diff/1/pkg/analyzer/test/src/context/mock_sdk.dart File pkg/analyzer/test/src/context/mock_sdk.dart (right): https://codereview.chromium.org/1780783002/diff/1/pkg/analyzer/test/src/context/mock_sdk.dart#newcode155 pkg/analyzer/test/src/context/mock_sdk.dart:155: List(); On 2016/03/10 00:09:33, Brian Wilkerson wrote: > What's ...
4 years, 9 months ago (2016-03-10 00:40:55 UTC) #4
Brian Wilkerson
LGTM https://codereview.chromium.org/1780783002/diff/1/pkg/analyzer/test/src/context/mock_sdk.dart File pkg/analyzer/test/src/context/mock_sdk.dart (right): https://codereview.chromium.org/1780783002/diff/1/pkg/analyzer/test/src/context/mock_sdk.dart#newcode155 pkg/analyzer/test/src/context/mock_sdk.dart:155: List(); I believe that we've been reproducing the ...
4 years, 9 months ago (2016-03-10 00:44:22 UTC) #5
Leaf
I have a couple of questions about the changes in the error codes. Also, I ...
4 years, 9 months ago (2016-03-10 22:58:25 UTC) #6
Bob Nystrom
On 2016/03/10 22:58:25, Leaf wrote: > I have a couple of questions about the changes ...
4 years, 9 months ago (2016-03-15 00:08:01 UTC) #7
Bob Nystrom
https://codereview.chromium.org/1780783002/diff/1/pkg/analyzer/test/src/task/strong/checker_test.dart File pkg/analyzer/test/src/task/strong/checker_test.dart (right): https://codereview.chromium.org/1780783002/diff/1/pkg/analyzer/test/src/task/strong/checker_test.dart#newcode120 pkg/analyzer/test/src/task/strong/checker_test.dart:120: /*info:DYNAMIC_INVOKE*/f.col(/*info:ARGUMENT_TYPE_NOT_ASSIGNABLE*/3); On 2016/03/10 22:58:25, Leaf wrote: > Interesting. I ...
4 years, 9 months ago (2016-03-15 00:08:13 UTC) #8
Leaf
LGTM, thanks! https://codereview.chromium.org/1780783002/diff/1/pkg/analyzer/test/src/task/strong/checker_test.dart File pkg/analyzer/test/src/task/strong/checker_test.dart (right): https://codereview.chromium.org/1780783002/diff/1/pkg/analyzer/test/src/task/strong/checker_test.dart#newcode1344 pkg/analyzer/test/src/task/strong/checker_test.dart:1344: mOfOs = /*info:DOWN_CAST_IMPLICIT, info:INVALID_ASSIGNMENT*/lOfDs; On 2016/03/15 00:08:13, ...
4 years, 9 months ago (2016-03-15 00:28:04 UTC) #9
Bob Nystrom
Committed patchset #3 (id:40001) manually as 2ef00b0c3d0182b5e4ea5ca55fd00b9d038ae40d (presubmit successful).
4 years, 9 months ago (2016-03-15 19:14:16 UTC) #11
Bob Nystrom
4 years, 9 months ago (2016-03-15 19:14:34 UTC) #12
Message was sent while issue was closed.
https://codereview.chromium.org/1780783002/diff/1/pkg/analyzer/test/src/task/...
File pkg/analyzer/test/src/task/strong/checker_test.dart (right):

https://codereview.chromium.org/1780783002/diff/1/pkg/analyzer/test/src/task/...
pkg/analyzer/test/src/task/strong/checker_test.dart:1344: mOfOs =
/*info:DOWN_CAST_IMPLICIT, info:INVALID_ASSIGNMENT*/lOfDs;
On 2016/03/15 00:28:04, Leaf wrote:
> On 2016/03/15 00:08:13, Bob Nystrom wrote:
> > On 2016/03/10 22:58:25, Leaf wrote:
> > > Why did these show up?  I think this is just an implicit downcast for us.
> > 
> > I believe it's a hint coming from type propagation at:
> > 
> > lOfDs = lOfAs;
> > 
> > It knows lOfDs is actually lOfAs, so you get the same warning as on line
1346,
> > though downgraded to a hint. Want me to rearrange the code to nullify the
type
> > propagation?
> 
> I see.  Not a big deal, but it might be better to null the assigned variable
at
> the end of each block since this is essentially just noise for the purposes of
> the test.

Done.

Powered by Google App Engine
This is Rietveld 408576698