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

Side by Side Diff: tests/language_strong/dynamic_set_test.dart

Issue 2847893002: fix #27258, don't allow dynamic set of a final field (Closed)
Patch Set: format Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/dev_compiler/tool/input_sdk/private/js_mirrors.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4 //
5 // Test that ensures that fields can be accessed dynamically.
6
7 import "package:expect/expect.dart";
8
9 class C {
10 final x = "hello";
11 get y => ", ";
12 m() => "world!";
13 }
14
15 // Regression test for https://github.com/dart-lang/sdk/issues/27258
16 main() {
17 dynamic c = new C();
18 Expect.equals(c.x + c.y + c.m(), "hello, world!");
19
20 Expect.throws(() {
21 c.x = 1;
22 });
23 Expect.throws(() {
24 c.x = '1';
25 });
26 Expect.throws(() {
27 c.y = '2';
28 });
29 Expect.throws(() {
30 c.m = '3';
31 });
32
33 Expect.equals(c.x + c.y + c.m(), "hello, world!");
34 }
OLDNEW
« no previous file with comments | « pkg/dev_compiler/tool/input_sdk/private/js_mirrors.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698