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

Side by Side Diff: tests/language/list_literal4_test.dart

Issue 10368004: Properly set the element type of literal lists. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/raw_object_snapshot.cc ('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
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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. 3 // BSD-style license that can be found in the LICENSE file.
4 // VMOptions=--enable_type_checks 4 // VMOptions=--enable_type_checks
5 // 5 //
6 // Dart test program testing type checks in list literals. 6 // Dart test program testing type checks in list literals.
7 7
8 class ListLiteral4Test<T> { 8 class ListLiteral4Test<T> {
9 test() { 9 test() {
10 int result = 0; 10 int result = 0;
(...skipping 23 matching lines...) Expand all
34 m["0"] = 1; // "0" is not an int. 34 m["0"] = 1; // "0" is not an int.
35 } catch (TypeError error) { 35 } catch (TypeError error) {
36 result += 10000; 36 result += 10000;
37 } 37 }
38 try { 38 try {
39 var m = const <int>[0, 1]; 39 var m = const <int>[0, 1];
40 m["0"] = 1; // "0" is not an int. 40 m["0"] = 1; // "0" is not an int.
41 } catch (TypeError error) { 41 } catch (TypeError error) {
42 result += 100000; 42 result += 100000;
43 } 43 }
44 try {
45 var m = <T>[0, 1]; // OK. Tested above.
46 List<String> ls = m; // m is a List<int>, not a List<String>.
47 } catch (TypeError error) {
48 result += 1000000;
49 }
50
44 return result; 51 return result;
45 } 52 }
46 } 53 }
47 54
48 main() { 55 main() {
49 var t = new ListLiteral4Test<int>(); 56 var t = new ListLiteral4Test<int>();
50 Expect.equals(110111, t.test()); 57 Expect.equals(1110111, t.test());
51 } 58 }
52 59
53 60
OLDNEW
« no previous file with comments | « runtime/vm/raw_object_snapshot.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698