| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 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 | 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 // Test that built-in identifiers can be used as library prefixes. | 5 // Test that built-in identifiers can be used as library prefixes. |
| 6 | 6 |
| 7 // From The Dart Programming Language Specification, section 11.30 | 7 // From The Dart Programming Language Specification, section 11.30 |
| 8 // "Identifier Reference": | 8 // "Identifier Reference": |
| 9 // | 9 // |
| 10 // "A built-in identifier is one of the identifiers produced by the | 10 // "A built-in identifier is one of the identifiers produced by the |
| 11 // production BUILT IN IDENTIFIER. It is a compile-time error if a | 11 // production BUILT IN IDENTIFIER. It is a compile-time error if a |
| 12 // built-in identifier is used as the declared name of a class, type | 12 // built-in identifier is used as the declared name of a class, type |
| 13 // parameter or type alias. It is a compile-time error to use a | 13 // parameter or type alias. It is a compile-time error to use a |
| 14 // built-in identifier other than dynamic as a type annotation." | 14 // built-in identifier other than dynamic as a type annotation." |
| 15 // | 15 // |
| 16 // Observation: it is not illegal to use a built-in identifier as a library | 16 // Observation: it is not illegal to use a built-in identifier as a library |
| 17 // prefix. | 17 // prefix. |
| 18 // | 18 // |
| 19 // Observation: it is not legal to use a built-in identifer as a type | 19 // Observation: it is not legal to use a built-in identifer as a type |
| 20 // annotation. A type annotation is not fully defined in the | 20 // annotation. A type annotation is not fully defined in the |
| 21 // specification, so we assume this means that the grammar production | 21 // specification, so we assume this means that the grammar production |
| 22 // "type" cannot match a built-in identifier. Unfortunately, this | 22 // "type" cannot match a built-in identifier. Unfortunately, this |
| 23 // doesn't prevent us from using built-in identifiers *in* type | 23 // doesn't prevent us from using built-in identifiers *in* type |
| 24 // annotations. For example, "final abstract foo;" is illegal as | 24 // annotations. For example, "final abstract foo;" is illegal as |
| 25 // "abstract" is used as a type annotation. However, "final | 25 // "abstract" is used as a type annotation. However, "final |
| 26 // abstract<dynamic> foo;" is not illegal because "abstract" is used | 26 // abstract<dynamic> foo;" is not illegal because "abstract" is used |
| 27 // as a typeName. | 27 // as a typeName. |
| 28 | 28 |
| 29 import "package:expect/expect.dart"; | |
| 30 import 'built_in_identifier_prefix_library_abstract.dart' as abstract; | 29 import 'built_in_identifier_prefix_library_abstract.dart' as abstract; |
| 31 import 'built_in_identifier_prefix_library_as.dart' as as; | 30 import 'built_in_identifier_prefix_library_as.dart' as as; |
| 32 import 'built_in_identifier_prefix_library_dynamic.dart' as dynamic; | 31 import 'built_in_identifier_prefix_library_dynamic.dart' as dynamic; |
| 33 import 'built_in_identifier_prefix_library_export.dart' as export; | 32 import 'built_in_identifier_prefix_library_export.dart' as export; |
| 34 import 'built_in_identifier_prefix_library_external.dart' as external; | 33 import 'built_in_identifier_prefix_library_external.dart' as external; |
| 35 import 'built_in_identifier_prefix_library_factory.dart' as factory; | 34 import 'built_in_identifier_prefix_library_factory.dart' as factory; |
| 36 import 'built_in_identifier_prefix_library_get.dart' as get; | 35 import 'built_in_identifier_prefix_library_get.dart' as get; |
| 37 import 'built_in_identifier_prefix_library_implements.dart' as implements; | 36 import 'built_in_identifier_prefix_library_implements.dart' as implements; |
| 38 import 'built_in_identifier_prefix_library_import.dart' as import; | 37 import 'built_in_identifier_prefix_library_import.dart' as import; |
| 39 import 'built_in_identifier_prefix_library_library.dart' as library; | 38 import 'built_in_identifier_prefix_library_library.dart' as library; |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 Expect.isTrue(parameterized_B_get is get.B); | 206 Expect.isTrue(parameterized_B_get is get.B); |
| 208 Expect.isTrue(parameterized_B_implements is implements.B); | 207 Expect.isTrue(parameterized_B_implements is implements.B); |
| 209 Expect.isTrue(parameterized_B_import is import.B); | 208 Expect.isTrue(parameterized_B_import is import.B); |
| 210 Expect.isTrue(parameterized_B_library is library.B); | 209 Expect.isTrue(parameterized_B_library is library.B); |
| 211 Expect.isTrue(parameterized_B_operator is operator.B); | 210 Expect.isTrue(parameterized_B_operator is operator.B); |
| 212 Expect.isTrue(parameterized_B_part is part.B); | 211 Expect.isTrue(parameterized_B_part is part.B); |
| 213 Expect.isTrue(parameterized_B_set is set.B); | 212 Expect.isTrue(parameterized_B_set is set.B); |
| 214 Expect.isTrue(parameterized_B_static is static.B); | 213 Expect.isTrue(parameterized_B_static is static.B); |
| 215 Expect.isTrue(parameterized_B_typedef is typedef.B); | 214 Expect.isTrue(parameterized_B_typedef is typedef.B); |
| 216 } | 215 } |
| OLD | NEW |