| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 // | 4 // |
| 5 // Check that private names cannot be imported even if the library imports | 5 // Check that private names cannot be imported even if the library imports |
| 6 // itself. | 6 // itself. |
| 7 | 7 |
| 8 library import_self; | 8 library import_self; |
| 9 | 9 |
| 10 import "package:expect/expect.dart"; | 10 import "package:expect/expect.dart"; |
| 11 | 11 |
| 12 // Eliminate the import of the unmodified file or else the analyzer | 12 // Eliminate the import of the unmodified file or else the analyzer |
| 13 // will generate the static warning in the import_self_test_none case. | 13 // will generate the static warning in the import_self_test_none case. |
| 14 import "import_self_test.dart" as p; /// 01: continued | 14 import "import_self_test.dart" as p; // /// 01: continued |
| 15 | 15 |
| 16 var _x = "The quick brown fox jumps over the dazy log"; | 16 var _x = "The quick brown fox jumps over the dazy log"; |
| 17 | 17 |
| 18 main() { | 18 main() { |
| 19 var t = "Falsches Üben von Xylophonmusik quält jeden größeren Zwerg"; | 19 var t = "Falsches Üben von Xylophonmusik quält jeden größeren Zwerg"; |
| 20 | 20 |
| 21 // Check that referencing p._x causes a warning from the analyzer, | 21 // Check that referencing p._x causes a warning from the analyzer, |
| 22 // and the runtime fails to resolve p._x, even though it refers to | 22 // and the runtime fails to resolve p._x, even though it refers to |
| 23 // top level variable _x of this file. | 23 // top level variable _x of this file. |
| 24 Expect.throws(() { t = p._x; }, /// 01: static type warning | 24 Expect.throws(() { t = p._x; }, // /// 01: static type warning |
| 25 (e) => e is NoSuchMethodError); /// 01: continued | 25 (e) => e is NoSuchMethodError); // /// 01: continued |
| 26 | 26 |
| 27 Expect.isTrue(t.endsWith("Zwerg")); | 27 Expect.isTrue(t.endsWith("Zwerg")); |
| 28 } | 28 } |
| OLD | NEW |