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

Issue 1620963003: final fields shouldn't be dependencies of const variables (Closed)

Created:
4 years, 11 months ago by skybrian
Modified:
4 years, 11 months ago
CC:
reviews_dartlang.org
Base URL:
git@github.com:dart-lang/sdk.git@movetest
Target Ref:
refs/heads/master
Visibility:
Public.

Description

final fields shouldn't be dependencies of const variables (They are only dependencies of const constructors.) This was causing bogus error messages to appear when a const expression mistakenly references a final field. BUG=https://github.com/dart-lang/sdk/issues/25526 R=brianwilkerson@google.com Committed: https://github.com/dart-lang/sdk/commit/ccf3870ffcec6f6418dd7471f924be86674f22ce

Patch Set 1 #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+39 lines, -31 lines) Patch
M pkg/analyzer/lib/src/generated/constant.dart View 2 chunks +1 line, -8 lines 0 comments Download
M pkg/analyzer/test/generated/compile_time_error_code_test.dart View 15 chunks +38 lines, -18 lines 4 comments Download
M pkg/analyzer/test/generated/constant_test.dart View 1 chunk +0 lines, -5 lines 0 comments Download

Depends on Patchset:

Messages

Total messages: 7 (2 generated)
skybrian
4 years, 11 months ago (2016-01-23 04:06:15 UTC) #2
skybrian
https://codereview.chromium.org/1620963003/diff/1/pkg/analyzer/test/generated/compile_time_error_code_test.dart File pkg/analyzer/test/generated/compile_time_error_code_test.dart (right): https://codereview.chromium.org/1620963003/diff/1/pkg/analyzer/test/generated/compile_time_error_code_test.dart#newcode1307 pkg/analyzer/test/generated/compile_time_error_code_test.dart:1307: CompileTimeErrorCode I believe this is reversing a dartfmt I ...
4 years, 11 months ago (2016-01-23 04:07:36 UTC) #3
Brian Wilkerson
LGTM https://codereview.chromium.org/1620963003/diff/1/pkg/analyzer/test/generated/compile_time_error_code_test.dart File pkg/analyzer/test/generated/compile_time_error_code_test.dart (right): https://codereview.chromium.org/1620963003/diff/1/pkg/analyzer/test/generated/compile_time_error_code_test.dart#newcode1269 pkg/analyzer/test/generated/compile_time_error_code_test.dart:1269: void test_constInitializedWithNonConstValue_finalField() { Seems like we ought to ...
4 years, 11 months ago (2016-01-23 17:32:26 UTC) #4
skybrian
Committed patchset #1 (id:1) manually as ccf3870ffcec6f6418dd7471f924be86674f22ce (presubmit successful).
4 years, 11 months ago (2016-01-25 23:53:45 UTC) #6
skybrian
4 years, 11 months ago (2016-01-26 02:07:14 UTC) #7
Message was sent while issue was closed.
https://codereview.chromium.org/1620963003/diff/1/pkg/analyzer/test/generated...
File pkg/analyzer/test/generated/compile_time_error_code_test.dart (right):

https://codereview.chromium.org/1620963003/diff/1/pkg/analyzer/test/generated...
pkg/analyzer/test/generated/compile_time_error_code_test.dart:1269: void
test_constInitializedWithNonConstValue_finalField() {
On 2016/01/23 17:32:26, Brian Wilkerson wrote:
> Seems like we ought to have at least one test of the case where we were
> generating a false positive to ensure that we don't regress. (I think it
should
> go in NonErrorResolverTest.)


This test is implicitly a regression test. It shows two errors instead of one
error (as expected) if I run it without the fix applied. (Added a comment to
explain this.)

There needs to be a const expression pointing at a final field to reproduce the
bug, so I don't think there's a way to do it using Dart code that has no errors
(which seems to be true of all the tests in NonErrorResolverTest).

Powered by Google App Engine
This is Rietveld 408576698