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

Issue 1175073002: Report a compile-time error if a const field is multiply initialized. (Closed)

Created:
5 years, 6 months ago by Paul Berry
Modified:
5 years, 6 months ago
Reviewers:
Brian Wilkerson
CC:
reviews_dartlang.org
Base URL:
git@github.com:dart-lang/sdk.git@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Report a compile-time error if a const field is multiply initialized. This CL makes analyzer consistent with the VM and the spec, by producing a compile-time error for code such as: class C { final x = 1; const C() : x = 2; } main() { const C(); } Note that Dart2js also produces an error in this circumstance, but its error is too general (the error should only be produced if the const constructor is invoked using "const"; if the const constructor is invoked using "new", or is not invoked at all, it should only be a warning). See #23618. R=brianwilkerson@google.com Committed: https://github.com/dart-lang/sdk/commit/2f610a3ff53413efa688b8e58e0842f599e6c8fa

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+80 lines, -0 lines) Patch
M pkg/analyzer/lib/src/generated/constant.dart View 2 chunks +8 lines, -0 lines 0 comments Download
M pkg/analyzer/test/generated/compile_time_error_code_test.dart View 1 chunk +41 lines, -0 lines 0 comments Download
A tests/language/const_error_multiply_initialized_test.dart View 1 chunk +28 lines, -0 lines 0 comments Download
M tests/language/language_dart2js.status View 1 chunk +3 lines, -0 lines 0 comments Download

Messages

Total messages: 4 (1 generated)
Paul Berry
5 years, 6 months ago (2015-06-10 20:50:20 UTC) #2
Brian Wilkerson
LGTM
5 years, 6 months ago (2015-06-10 20:55:57 UTC) #3
Paul Berry
5 years, 6 months ago (2015-06-10 21:02:48 UTC) #4
Message was sent while issue was closed.
Committed patchset #1 (id:1) manually as
2f610a3ff53413efa688b8e58e0842f599e6c8fa (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698