From f68e5231b4e7b9d5e6012adda142cf0cfdecfa6a Mon Sep 17 00:00:00 2001 From: Erik Ernst Date: Thu, 16 Nov 2017 12:34:14 +0000 Subject: [PATCH] Renewed tests from built_in_identifier_prefix The test language_2/built_in_identifier_prefix_test stated 'it is not illegal to use a built-in identifier as a library prefix', which has been untrue for quite a while, and then proceeded to check a number of cases where said situation was used in practice. All of that is now obsolete, so that test was split into several tests, each of which was adjusted to test something which is relevant today. The new tests include checks for the use of "known" identifiers (such as `of`, `show`, `on` and a few more) which are mentioned explicitly in the grammar, but which are neither built-in identifiers nor reserved words. The new tests gave rise to a number of status entries, including 25 crashes (so it is not just "expect `MissingCompileTimeError` here because it's not strong mode"). Note that `Function` is considered to be a built-in identifier. This makes no difference for the grammar, but it means that there are no cases where `Function` is used as a library prefix. If we insist that `Function` cannot be a built-in identifier then we just need to add a few more grammar rules to all such things as `import .. as Function;`, but I considered it less confusing to include `Function` among the built-in identifiers and avoid adding support for this. Note that we haven't said anywhere that `Function` is a built-in identifier, so we would need to adjust an informal/*.md file to say that, to finish this off. Change-Id: Ifa5bbd95022498480b7ee2e94605f81cd11d9696 Reviewed-on: https://dart-review.googlesource.com/21080 Reviewed-by: Lasse R.H. Nielsen Commit-Queue: Erik Ernst --- docs/language/Dart.g | 52 +-- .../built_in_identifier_illegal_test.dart | 28 +- .../built_in_identifier_not_prefix_test.dart | 91 +++++ ...in_identifier_prefix_library_abstract.dart | 11 - ...lt_in_identifier_prefix_library_async.dart | 11 + ...lt_in_identifier_prefix_library_await.dart | 11 + ..._in_identifier_prefix_library_dynamic.dart | 11 - ...t_in_identifier_prefix_library_export.dart | 11 - ...in_identifier_prefix_library_external.dart | 11 - ..._in_identifier_prefix_library_factory.dart | 11 - ...lt_in_identifier_prefix_library_hide.dart} | 2 +- ..._identifier_prefix_library_implements.dart | 11 - ...t_in_identifier_prefix_library_import.dart | 11 - ...uilt_in_identifier_prefix_library_of.dart} | 2 +- ...uilt_in_identifier_prefix_library_on.dart} | 2 +- ...in_identifier_prefix_library_operator.dart | 11 - ...lt_in_identifier_prefix_library_show.dart} | 2 +- ...t_in_identifier_prefix_library_static.dart | 11 - ...ilt_in_identifier_prefix_library_sync.dart | 11 + ..._in_identifier_prefix_library_typedef.dart | 11 - ...lt_in_identifier_prefix_library_yield.dart | 11 + .../built_in_identifier_prefix_test.dart | 216 ---------- ...lt_in_identifier_type_annotation_test.dart | 117 ++++++ .../known_identifier_prefix_error_test.dart | 78 ++++ .../known_identifier_prefix_test.dart | 78 ++++ .../known_identifier_usage_error_test.dart | 73 ++++ .../known_identifier_usage_test.dart | 370 ++++++++++++++++++ tests/language_2/language_2.status | 2 + tests/language_2/language_2_analyzer.status | 24 ++ tests/language_2/language_2_dart2js.status | 47 ++- tests/language_2/language_2_dartdevc.status | 1 + tests/language_2/language_2_kernel.status | 90 +++++ tests/language_2/language_2_vm.status | 1 + 33 files changed, 1059 insertions(+), 371 deletions(-) create mode 100644 tests/language_2/built_in_identifier_not_prefix_test.dart delete mode 100644 tests/language_2/built_in_identifier_prefix_library_abstract.dart create mode 100644 tests/language_2/built_in_identifier_prefix_library_async.dart create mode 100644 tests/language_2/built_in_identifier_prefix_library_await.dart delete mode 100644 tests/language_2/built_in_identifier_prefix_library_dynamic.dart delete mode 100644 tests/language_2/built_in_identifier_prefix_library_export.dart delete mode 100644 tests/language_2/built_in_identifier_prefix_library_external.dart delete mode 100644 tests/language_2/built_in_identifier_prefix_library_factory.dart rename tests/language_2/{built_in_identifier_prefix_library_part.dart => built_in_identifier_prefix_library_hide.dart} (94%) delete mode 100644 tests/language_2/built_in_identifier_prefix_library_implements.dart delete mode 100644 tests/language_2/built_in_identifier_prefix_library_import.dart rename tests/language_2/{built_in_identifier_prefix_library_as.dart => built_in_identifier_prefix_library_of.dart} (95%) rename tests/language_2/{built_in_identifier_prefix_library_get.dart => built_in_identifier_prefix_library_on.dart} (95%) delete mode 100644 tests/language_2/built_in_identifier_prefix_library_operator.dart rename tests/language_2/{built_in_identifier_prefix_library_set.dart => built_in_identifier_prefix_library_show.dart} (94%) delete mode 100644 tests/language_2/built_in_identifier_prefix_library_static.dart create mode 100644 tests/language_2/built_in_identifier_prefix_library_sync.dart delete mode 100644 tests/language_2/built_in_identifier_prefix_library_typedef.dart create mode 100644 tests/language_2/built_in_identifier_prefix_library_yield.dart delete mode 100644 tests/language_2/built_in_identifier_prefix_test.dart create mode 100644 tests/language_2/built_in_identifier_type_annotation_test.dart create mode 100644 tests/language_2/known_identifier_prefix_error_test.dart create mode 100644 tests/language_2/known_identifier_prefix_test.dart create mode 100644 tests/language_2/known_identifier_usage_error_test.dart create mode 100644 tests/language_2/known_identifier_usage_test.dart diff --git a/docs/language/Dart.g b/docs/language/Dart.g index d185b634c4a..aa70500cc7e 100644 --- a/docs/language/Dart.g +++ b/docs/language/Dart.g @@ -189,7 +189,7 @@ topLevelDefinition EXTERNAL setterSignature ';' | (getterSignature functionBodyPrefix) => getterSignature functionBody | (type? SET identifier '(') => setterSignature functionBody - | (type? identifierNotFunction typeParameters? '(') => + | (type? identifierNotFUNCTION typeParameters? '(') => functionSignature functionBody | (FINAL | CONST) type? staticFinalDeclarationList ';' | topLevelVariableDeclaration ';' @@ -223,7 +223,7 @@ initializedIdentifierList ; functionSignature - : type? identifierNotFunction formalParameterPart + : type? identifierNotFUNCTION formalParameterPart ; functionBodyPrefix @@ -276,7 +276,7 @@ normalFormalParameter ; normalFormalParameterNoMetadata - : (COVARIANT? type? identifierNotFunction formalParameterPart) => + : (COVARIANT? type? identifierNotFUNCTION formalParameterPart) => functionFormalParameter | (finalConstVarOrType? THIS) => fieldFormalParameter | simpleFormalParameter @@ -284,7 +284,7 @@ normalFormalParameterNoMetadata // NB: It is an anomaly that a functionFormalParameter cannot be FINAL. functionFormalParameter - : COVARIANT? type? identifierNotFunction formalParameterPart + : COVARIANT? type? identifierNotFUNCTION formalParameterPart ; simpleFormalParameter @@ -329,7 +329,7 @@ classMemberDefinition methodSignature : (constructorSignature ':') => constructorSignature initializers | (FACTORY constructorName '(') => factoryConstructorSignature - | (STATIC? type? identifierNotFunction typeParameters? '(') => + | (STATIC? type? identifierNotFUNCTION typeParameters? '(') => STATIC? functionSignature | (STATIC? type? GET) => STATIC? getterSignature | (STATIC? type? SET) => STATIC? setterSignature @@ -854,25 +854,25 @@ assignableSelector | '?.' identifier ; -identifierNotFunction +identifierNotFUNCTION : IDENTIFIER - | ABSTRACT - | AS - | COVARIANT - | DEFERRED - | DYNAMIC - | EXPORT - | EXTERNAL - | FACTORY - | GET - | IMPLEMENTS - | IMPORT - | LIBRARY - | OPERATOR - | PART - | SET - | STATIC - | TYPEDEF + | ABSTRACT // Built-in identifier. + | AS // Built-in identifier. + | COVARIANT // Built-in identifier. + | DEFERRED // Built-in identifier. + | DYNAMIC // Built-in identifier. + | EXPORT // Built-in identifier. + | EXTERNAL // Built-in identifier. + | FACTORY // Built-in identifier. + | GET // Built-in identifier. + | IMPLEMENTS // Built-in identifier. + | IMPORT // Built-in identifier. + | LIBRARY // Built-in identifier. + | OPERATOR // Built-in identifier. + | PART // Built-in identifier. + | SET // Built-in identifier. + | STATIC // Built-in identifier. + | TYPEDEF // Built-in identifier. | HIDE // Not a built-in identifier. | OF // Not a built-in identifier. | ON // Not a built-in identifier. @@ -882,8 +882,8 @@ identifierNotFunction ; identifier - : identifierNotFunction - | FUNCTION // Not a built-in identifier. + : identifierNotFUNCTION + | FUNCTION // Built-in identifier that can be used as a type. ; qualified @@ -894,7 +894,7 @@ qualified typeIdentifier : IDENTIFIER - | DYNAMIC // The only built-in identifier that can be used as a type. + | DYNAMIC // Built-in identifier that can be used as a type. | HIDE // Not a built-in identifier. | OF // Not a built-in identifier. | ON // Not a built-in identifier. diff --git a/tests/language_2/built_in_identifier_illegal_test.dart b/tests/language_2/built_in_identifier_illegal_test.dart index 36cdeec1380..d3bb320aaa3 100644 --- a/tests/language_2/built_in_identifier_illegal_test.dart +++ b/tests/language_2/built_in_identifier_illegal_test.dart @@ -4,20 +4,20 @@ // Check that we cannot use a pseudo keyword at the class level code. // Pseudo keywords are not allowed to be used as class names. -class abstract { } // //# 01: compile-time error -class as { } // //# 19: compile-time error +class abstract { } // //# 01: syntax error +class as { } // //# 19: syntax error class dynamic { } // //# 04: compile-time error -class export { } // //# 17: compile-time error -class external { } // //# 20: compile-time error -class factory { } // //# 05: compile-time error -class get { } // //# 06: compile-time error -class implements { } // //# 07: compile-time error -class import { } // //# 08: compile-time error -class library { } // //# 10: compile-time error -class operator { } // //# 12: compile-time error -class part { } // //# 18: compile-time error -class set { } // //# 13: compile-time error -class static { } // //# 15: compile-time error -class typedef { } // //# 16: compile-time error +class export { } // //# 17: syntax error +class external { } // //# 20: syntax error +class factory { } // //# 05: syntax error +class get { } // //# 06: syntax error +class implements { } // //# 07: syntax error +class import { } // //# 08: syntax error +class library { } // //# 10: syntax error +class operator { } // //# 12: syntax error +class part { } // //# 18: syntax error +class set { } // //# 13: syntax error +class static { } // //# 15: syntax error +class typedef { } // //# 16: syntax error main() {} diff --git a/tests/language_2/built_in_identifier_not_prefix_test.dart b/tests/language_2/built_in_identifier_not_prefix_test.dart new file mode 100644 index 00000000000..7666032b6a0 --- /dev/null +++ b/tests/language_2/built_in_identifier_not_prefix_test.dart @@ -0,0 +1,91 @@ +// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +// From The Dart Programming Language Specification, section 16.33 +// "Identifier Reference": +// +// "A built-in identifier is one of the identifiers produced by the +// production BUILT_IN_IDENTIFIER. It is a compile-time error if a +// built-in identifier is used as the declared name of a prefix, class, +// type parameter or type alias. It is a compile-time error to use a +// built-in identifier other than dynamic in a type annotation or type +// parameter." +// +// Observation: it is illegal to use a built-in identifier as a library +// prefix. + +// Dart test for using a built-in identifier as a library prefix. + +import 'dart:core' deferred as abstract; // //# 01: compile-time error +import 'dart:core' deferred as as; // //# 02: compile-time error +import 'dart:core' deferred as covariant; // //# 03: compile-time error +import 'dart:core' deferred as deferred; // //# 04: compile-time error +import 'dart:core' deferred as dynamic; // //# 05: compile-time error +import 'dart:core' deferred as export; // //# 06: compile-time error +import 'dart:core' deferred as external; // //# 07: compile-time error +import 'dart:core' deferred as factory; // //# 08: compile-time error +import 'dart:core' deferred as get; // //# 09: compile-time error +import 'dart:core' deferred as implements; // //# 10: compile-time error +import 'dart:core' deferred as import; // //# 11: compile-time error +import 'dart:core' deferred as library; // //# 12: compile-time error +import 'dart:core' deferred as operator; // //# 13: compile-time error +import 'dart:core' deferred as part; // //# 14: compile-time error +import 'dart:core' deferred as set; // //# 15: compile-time error +import 'dart:core' deferred as static; // //# 16: compile-time error +import 'dart:core' deferred as typedef; // //# 17: compile-time error +import 'dart:core' as abstract; // //# 18: syntax error +import 'dart:core' as as; // //# 19: syntax error +import 'dart:core' as covariant; // //# 20: syntax error +import 'dart:core' as deferred; // //# 21: syntax error +import 'dart:core' as dynamic; // //# 22: compile-time error +import 'dart:core' as export; // //# 23: syntax error +import 'dart:core' as external; // //# 24: syntax error +import 'dart:core' as factory; // //# 25: syntax error +import 'dart:core' as get; // //# 26: syntax error +import 'dart:core' as implements; // //# 27: syntax error +import 'dart:core' as import; // //# 28: syntax error +import 'dart:core' as library; // //# 29: syntax error +import 'dart:core' as operator; // //# 30: syntax error +import 'dart:core' as part; // //# 31: syntax error +import 'dart:core' as set; // //# 32: syntax error +import 'dart:core' as static; // //# 33: syntax error +import 'dart:core' as typedef; // //# 34: syntax error + +main() { + abstract.loadLibrary(); // //# 01: continued + as.loadLibrary(); // //# 02: continued + covariant.loadLibrary(); // //# 03: continued + deferred.loadLibrary(); // //# 04: continued + dynamic.loadLibrary(); // //# 05: continued + export.loadLibrary(); // //# 06: continued + external.loadLibrary(); // //# 07: continued + factory.loadLibrary(); // //# 08: continued + get.loadLibrary(); // //# 09: continued + implements.loadLibrary(); // //# 10: continued + import.loadLibrary(); // //# 11: continued + library.loadLibrary(); // //# 12: continued + operator.loadLibrary(); // //# 13: continued + part.loadLibrary(); // //# 14: continued + set.loadLibrary(); // //# 15: continued + static.loadLibrary(); // //# 16: continued + typedef.loadLibrary(); // //# 17: continued + + abstract.int x = 42; // //# 18: continued + as.int x = 42; // //# 19: continued + covariant.int x = 42; // //# 20: continued + deferred.int x = 42; // //# 21: continued + dynamic.int x = 42; // //# 22: continued + export.int x = 42; // //# 23: continued + external.int x = 42; // //# 24: continued + factory.int x = 42; // //# 25: continued + get.int x = 42; // //# 26: continued + implements.int x = 42; // //# 27: continued + import.int x = 42; // //# 28: continued + library.int x = 42; // //# 29: continued + operator.int x = 42; // //# 30: continued + part.int x = 42; // //# 31: continued + set.int x = 42; // //# 32: continued + static.int x = 42; // //# 33: continued + typedef.int x = 42; // //# 34: continued +} diff --git a/tests/language_2/built_in_identifier_prefix_library_abstract.dart b/tests/language_2/built_in_identifier_prefix_library_abstract.dart deleted file mode 100644 index cdcabb4ff18..00000000000 --- a/tests/language_2/built_in_identifier_prefix_library_abstract.dart +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -library abstract; - -class A {} - -class B {} - -class C {} diff --git a/tests/language_2/built_in_identifier_prefix_library_async.dart b/tests/language_2/built_in_identifier_prefix_library_async.dart new file mode 100644 index 00000000000..5662daef8f3 --- /dev/null +++ b/tests/language_2/built_in_identifier_prefix_library_async.dart @@ -0,0 +1,11 @@ +// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +library async; + +class A {} + +class B {} + +class C {} diff --git a/tests/language_2/built_in_identifier_prefix_library_await.dart b/tests/language_2/built_in_identifier_prefix_library_await.dart new file mode 100644 index 00000000000..c4f5d3795c1 --- /dev/null +++ b/tests/language_2/built_in_identifier_prefix_library_await.dart @@ -0,0 +1,11 @@ +// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +library await; + +class A {} + +class B {} + +class C {} diff --git a/tests/language_2/built_in_identifier_prefix_library_dynamic.dart b/tests/language_2/built_in_identifier_prefix_library_dynamic.dart deleted file mode 100644 index 3d54eeeafe3..00000000000 --- a/tests/language_2/built_in_identifier_prefix_library_dynamic.dart +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -library dynamic; - -class A {} - -class B {} - -class C {} diff --git a/tests/language_2/built_in_identifier_prefix_library_export.dart b/tests/language_2/built_in_identifier_prefix_library_export.dart deleted file mode 100644 index 6f068ebab1c..00000000000 --- a/tests/language_2/built_in_identifier_prefix_library_export.dart +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -library export; - -class A {} - -class B {} - -class C {} diff --git a/tests/language_2/built_in_identifier_prefix_library_external.dart b/tests/language_2/built_in_identifier_prefix_library_external.dart deleted file mode 100644 index 68d2ba503b4..00000000000 --- a/tests/language_2/built_in_identifier_prefix_library_external.dart +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -library external; - -class A {} - -class B {} - -class C {} diff --git a/tests/language_2/built_in_identifier_prefix_library_factory.dart b/tests/language_2/built_in_identifier_prefix_library_factory.dart deleted file mode 100644 index a2416f8ee00..00000000000 --- a/tests/language_2/built_in_identifier_prefix_library_factory.dart +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -library factory; - -class A {} - -class B {} - -class C {} diff --git a/tests/language_2/built_in_identifier_prefix_library_part.dart b/tests/language_2/built_in_identifier_prefix_library_hide.dart similarity index 94% rename from tests/language_2/built_in_identifier_prefix_library_part.dart rename to tests/language_2/built_in_identifier_prefix_library_hide.dart index 2193a4584ae..6c686a0c90d 100644 --- a/tests/language_2/built_in_identifier_prefix_library_part.dart +++ b/tests/language_2/built_in_identifier_prefix_library_hide.dart @@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -library part; +library hide; class A {} diff --git a/tests/language_2/built_in_identifier_prefix_library_implements.dart b/tests/language_2/built_in_identifier_prefix_library_implements.dart deleted file mode 100644 index c7ab2cecd87..00000000000 --- a/tests/language_2/built_in_identifier_prefix_library_implements.dart +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -library implements; - -class A {} - -class B {} - -class C {} diff --git a/tests/language_2/built_in_identifier_prefix_library_import.dart b/tests/language_2/built_in_identifier_prefix_library_import.dart deleted file mode 100644 index 6ed83ccb9b3..00000000000 --- a/tests/language_2/built_in_identifier_prefix_library_import.dart +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -library import; - -class A {} - -class B {} - -class C {} diff --git a/tests/language_2/built_in_identifier_prefix_library_as.dart b/tests/language_2/built_in_identifier_prefix_library_of.dart similarity index 95% rename from tests/language_2/built_in_identifier_prefix_library_as.dart rename to tests/language_2/built_in_identifier_prefix_library_of.dart index 6e5a581284e..e2fec7d57cf 100644 --- a/tests/language_2/built_in_identifier_prefix_library_as.dart +++ b/tests/language_2/built_in_identifier_prefix_library_of.dart @@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -library as; +library of; class A {} diff --git a/tests/language_2/built_in_identifier_prefix_library_get.dart b/tests/language_2/built_in_identifier_prefix_library_on.dart similarity index 95% rename from tests/language_2/built_in_identifier_prefix_library_get.dart rename to tests/language_2/built_in_identifier_prefix_library_on.dart index f3edee65ce7..861eac937fa 100644 --- a/tests/language_2/built_in_identifier_prefix_library_get.dart +++ b/tests/language_2/built_in_identifier_prefix_library_on.dart @@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -library get; +library on; class A {} diff --git a/tests/language_2/built_in_identifier_prefix_library_operator.dart b/tests/language_2/built_in_identifier_prefix_library_operator.dart deleted file mode 100644 index d64f0b8364b..00000000000 --- a/tests/language_2/built_in_identifier_prefix_library_operator.dart +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -library operator; - -class A {} - -class B {} - -class C {} diff --git a/tests/language_2/built_in_identifier_prefix_library_set.dart b/tests/language_2/built_in_identifier_prefix_library_show.dart similarity index 94% rename from tests/language_2/built_in_identifier_prefix_library_set.dart rename to tests/language_2/built_in_identifier_prefix_library_show.dart index 5b4d49ba89f..12f2e7bc1ab 100644 --- a/tests/language_2/built_in_identifier_prefix_library_set.dart +++ b/tests/language_2/built_in_identifier_prefix_library_show.dart @@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -library set; +library show; class A {} diff --git a/tests/language_2/built_in_identifier_prefix_library_static.dart b/tests/language_2/built_in_identifier_prefix_library_static.dart deleted file mode 100644 index 74bb77d0424..00000000000 --- a/tests/language_2/built_in_identifier_prefix_library_static.dart +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -library static; - -class A {} - -class B {} - -class C {} diff --git a/tests/language_2/built_in_identifier_prefix_library_sync.dart b/tests/language_2/built_in_identifier_prefix_library_sync.dart new file mode 100644 index 00000000000..e63a2b2decb --- /dev/null +++ b/tests/language_2/built_in_identifier_prefix_library_sync.dart @@ -0,0 +1,11 @@ +// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +library sync; + +class A {} + +class B {} + +class C {} diff --git a/tests/language_2/built_in_identifier_prefix_library_typedef.dart b/tests/language_2/built_in_identifier_prefix_library_typedef.dart deleted file mode 100644 index c27c96c1d93..00000000000 --- a/tests/language_2/built_in_identifier_prefix_library_typedef.dart +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -library typedef; - -class A {} - -class B {} - -class C {} diff --git a/tests/language_2/built_in_identifier_prefix_library_yield.dart b/tests/language_2/built_in_identifier_prefix_library_yield.dart new file mode 100644 index 00000000000..2b97a2c6803 --- /dev/null +++ b/tests/language_2/built_in_identifier_prefix_library_yield.dart @@ -0,0 +1,11 @@ +// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +library yield; + +class A {} + +class B {} + +class C {} diff --git a/tests/language_2/built_in_identifier_prefix_test.dart b/tests/language_2/built_in_identifier_prefix_test.dart deleted file mode 100644 index 6c3934ad8f3..00000000000 --- a/tests/language_2/built_in_identifier_prefix_test.dart +++ /dev/null @@ -1,216 +0,0 @@ -// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -// Test that built-in identifiers can be used as library prefixes. - -// From The Dart Programming Language Specification, section 11.30 -// "Identifier Reference": -// -// "A built-in identifier is one of the identifiers produced by the -// production BUILT IN IDENTIFIER. It is a compile-time error if a -// built-in identifier is used as the declared name of a class, type -// parameter or type alias. It is a compile-time error to use a -// built-in identifier other than dynamic as a type annotation." -// -// Observation: it is not illegal to use a built-in identifier as a library -// prefix. -// -// Observation: it is not legal to use a built-in identifier as a type -// annotation. A type annotation is not fully defined in the -// specification, so we assume this means that the grammar production -// "type" cannot match a built-in identifier. Unfortunately, this -// doesn't prevent us from using built-in identifiers *in* type -// annotations. For example, "final abstract foo;" is illegal as -// "abstract" is used as a type annotation. However, "final -// abstract foo;" is not illegal because "abstract" is used -// as a typeName. - -import "package:expect/expect.dart"; -import 'built_in_identifier_prefix_library_abstract.dart' as abstract; -import 'built_in_identifier_prefix_library_as.dart' as as; -import 'built_in_identifier_prefix_library_dynamic.dart' as dynamic; -import 'built_in_identifier_prefix_library_export.dart' as export; -import 'built_in_identifier_prefix_library_external.dart' as external; -import 'built_in_identifier_prefix_library_factory.dart' as factory; -import 'built_in_identifier_prefix_library_get.dart' as get; -import 'built_in_identifier_prefix_library_implements.dart' as implements; -import 'built_in_identifier_prefix_library_import.dart' as import; -import 'built_in_identifier_prefix_library_library.dart' as library; -import 'built_in_identifier_prefix_library_operator.dart' as operator; -import 'built_in_identifier_prefix_library_part.dart' as part; -import 'built_in_identifier_prefix_library_set.dart' as set; -import 'built_in_identifier_prefix_library_static.dart' as static; -import 'built_in_identifier_prefix_library_typedef.dart' as typedef; - -abstract.A _abstract = new abstract.A(); -as.A _as = new as.A(); -dynamic.A _dynamic = new dynamic.A(); -export.A _export = new export.A(); -external.A _external = new external.A(); -factory.A _factory = new factory.A(); -get.A _get = new get.A(); -implements.A _implements = new implements.A(); -import.A _import = new import.A(); -library.A _library = new library.A(); -operator.A _operator = new operator.A(); -part.A _part = new part.A(); -set.A _set = new set.A(); -static.A _static = new static.A(); -typedef.A _typedef = new typedef.A(); - -abstract generic_abstract = new abstract.A(); -as generic_as = new as.A(); -dynamic generic_dynamic = new dynamic.A(); -export generic_export = new export.A(); -external generic_external = new external.A(); -factory generic_factory = new factory.A(); -get generic_get = new get.A(); -implements generic_implements = new implements.A(); -import generic_import = new import.A(); -library generic_library = new library.A(); -operator generic_operator = new operator.A(); -part generic_part = new part.A(); -set generic_set = new set.A(); -static generic_static = new static.A(); -typedef generic_typedef = new typedef.A(); - -abstract.B dynamic_B_abstract = new abstract.B(); -as.B dynamic_B_as = new as.B(); -dynamic.B dynamic_B_dynamic = new dynamic.B(); -export.B dynamic_B_export = new export.B(); -external.B dynamic_B_external = new external.B(); -factory.B dynamic_B_factory = new factory.B(); -get.B dynamic_B_get = new get.B(); -implements.B dynamic_B_implements = new implements.B(); -import.B dynamic_B_import = new import.B(); -library.B dynamic_B_library = new library.B(); -operator.B dynamic_B_operator = new operator.B(); -part.B dynamic_B_part = new part.B(); -set.B dynamic_B_set = new set.B(); -static.B dynamic_B_static = new static.B(); -typedef.B dynamic_B_typedef = new typedef.B(); - -abstract.B> parameterized_B_abstract = new abstract.B(); -as.B> parameterized_B_as = new as.B(); -dynamic.B> parameterized_B_dynamic = new dynamic.B(); -export.B> parameterized_B_export = new export.B(); -external.B> parameterized_B_external = new external.B(); -factory.B> parameterized_B_factory = new factory.B(); -get.B> parameterized_B_get = new get.B(); -implements.B> parameterized_B_implements = - new implements.B(); -import.B> parameterized_B_import = new import.B(); -library.B> parameterized_B_library = new library.B(); -operator.B> parameterized_B_operator = new operator.B(); -part.B> parameterized_B_part = new part.B(); -set.B> parameterized_B_set = new set.B(); -static.B> parameterized_B_static = new static.B(); -typedef.B> parameterized_B_typedef = new typedef.B(); - -class UseA { - abstract.A abstract = new abstract.A(); - as.A as = new as.A(); - dynamic.A dynamic = new dynamic.A(); - export.A export = new export.A(); - external.A external = new external.A(); - factory.A factory = new factory.A(); - get.A get = new get.A(); - implements.A implements = new implements.A(); - import.A import = new import.A(); - library.A library = new library.A(); - operator.A operator = new operator.A(); - part.A part = new part.A(); - set.A set = new set.A(); - static.A static = new static.A(); - typedef.A typedef = new typedef.A(); -} - -main() { - bool assertionsEnabled = false; - assert(assertionsEnabled = true); - - Expect.isTrue(_abstract is abstract.A); - Expect.isTrue(_as is as.A); - Expect.isTrue(_dynamic is dynamic.A); - Expect.isTrue(_export is export.A); - Expect.isTrue(_external is external.A); - Expect.isTrue(_factory is factory.A); - Expect.isTrue(_get is get.A); - Expect.isTrue(_implements is implements.A); - Expect.isTrue(_import is import.A); - Expect.isTrue(_library is library.A); - Expect.isTrue(_operator is operator.A); - Expect.isTrue(_part is part.A); - Expect.isTrue(_set is set.A); - Expect.isTrue(_static is static.A); - Expect.isTrue(_typedef is typedef.A); - - Expect.isTrue(dynamic_B_abstract is abstract.B); - Expect.isTrue(dynamic_B_as is as.B); - Expect.isTrue(dynamic_B_dynamic is dynamic.B); - Expect.isTrue(dynamic_B_export is export.B); - Expect.isTrue(dynamic_B_external is external.B); - Expect.isTrue(dynamic_B_factory is factory.B); - Expect.isTrue(dynamic_B_get is get.B); - Expect.isTrue(dynamic_B_implements is implements.B); - Expect.isTrue(dynamic_B_import is import.B); - Expect.isTrue(dynamic_B_library is library.B); - Expect.isTrue(dynamic_B_operator is operator.B); - Expect.isTrue(dynamic_B_part is part.B); - Expect.isTrue(dynamic_B_set is set.B); - Expect.isTrue(dynamic_B_static is static.B); - Expect.isTrue(dynamic_B_typedef is typedef.B); - - var x = new UseA(); - Expect.isTrue(x.abstract is abstract.A); - Expect.isTrue(x.as is as.A); - Expect.isTrue(x.dynamic is dynamic.A); - Expect.isTrue(x.export is export.A); - Expect.isTrue(x.external is external.A); - Expect.isTrue(x.factory is factory.A); - Expect.isTrue(x.get is get.A); - Expect.isTrue(x.implements is implements.A); - Expect.isTrue(x.import is import.A); - Expect.isTrue(x.library is library.A); - Expect.isTrue(x.operator is operator.A); - Expect.isTrue(x.part is part.A); - Expect.isTrue(x.set is set.A); - Expect.isTrue(x.static is static.A); - Expect.isTrue(x.typedef is typedef.A); - - // Most of the following variables have malformed type annotations. - if (assertionsEnabled) return; - - Expect.isTrue(generic_abstract is abstract.A); - Expect.isTrue(generic_as is as.A); - Expect.isTrue(generic_dynamic is dynamic.A); - Expect.isTrue(generic_export is export.A); - Expect.isTrue(generic_external is external.A); - Expect.isTrue(generic_factory is factory.A); - Expect.isTrue(generic_get is get.A); - Expect.isTrue(generic_implements is implements.A); - Expect.isTrue(generic_import is import.A); - Expect.isTrue(generic_library is library.A); - Expect.isTrue(generic_operator is operator.A); - Expect.isTrue(generic_part is part.A); - Expect.isTrue(generic_set is set.A); - Expect.isTrue(generic_static is static.A); - Expect.isTrue(generic_typedef is typedef.A); - - Expect.isTrue(parameterized_B_abstract is abstract.B); - Expect.isTrue(parameterized_B_as is as.B); - Expect.isTrue(parameterized_B_dynamic is dynamic.B); - Expect.isTrue(parameterized_B_export is export.B); - Expect.isTrue(parameterized_B_external is external.B); - Expect.isTrue(parameterized_B_factory is factory.B); - Expect.isTrue(parameterized_B_get is get.B); - Expect.isTrue(parameterized_B_implements is implements.B); - Expect.isTrue(parameterized_B_import is import.B); - Expect.isTrue(parameterized_B_library is library.B); - Expect.isTrue(parameterized_B_operator is operator.B); - Expect.isTrue(parameterized_B_part is part.B); - Expect.isTrue(parameterized_B_set is set.B); - Expect.isTrue(parameterized_B_static is static.B); - Expect.isTrue(parameterized_B_typedef is typedef.B); -} diff --git a/tests/language_2/built_in_identifier_type_annotation_test.dart b/tests/language_2/built_in_identifier_type_annotation_test.dart new file mode 100644 index 00000000000..2fbd24e9b97 --- /dev/null +++ b/tests/language_2/built_in_identifier_type_annotation_test.dart @@ -0,0 +1,117 @@ +// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +// From The Dart Programming Language Specification, section 16.33 +// "Identifier Reference": +// +// "A built-in identifier is one of the identifiers produced by the +// production BUILT_IN_IDENTIFIER. It is a compile-time error if a +// built-in identifier is used as the declared name of a prefix, class, +// type parameter or type alias. It is a compile-time error to use a +// built-in identifier other than dynamic in a type annotation or type +// parameter." +// +// Observation: it is illegal to use a built-in identifier other than +// `dynamic` in a type annotation. A type annotation is not fully defined +// in the specification, so we assume this means that the grammar +// production "type" cannot be a built-in identifier, and it cannot contain +// a built-in identifier at a location where it must denote a type. +// +// Note that we have several ways to use built-in identifiers other than +// `dynamic` in other locations in a type, e.g., `Function(int set)`. + +abstract x = null; // //# 01: syntax error +as x = null; // //# 02: syntax error +covariant x = null; // //# 03: syntax error +deferred x = null; // //# 04: syntax error +dynamic x = null; // //# 05: ok +export x = null; // //# 06: syntax error +external x = null; // //# 07: syntax error +factory x = null; // //# 08: syntax error +get x = null; // //# 09: syntax error +implements x = null; // //# 10: syntax error +import x = null; // //# 11: syntax error +library x = null; // //# 12: syntax error +operator x = null; // //# 13: syntax error +part x = null; // //# 14: syntax error +set x = null; // //# 15: syntax error +static x = null; // //# 16: syntax error +typedef x = null; // //# 17: syntax error + +abstract x = null; // //# 18: syntax error +as x = null; // //# 19: syntax error +covariant x = null; // //# 20: syntax error +deferred x = null; // //# 21: syntax error +dynamic x = null; // //# 22: compile-time error +export x = null; // //# 23: syntax error +external x = null; // //# 24: syntax error +factory x = null; // //# 25: syntax error +get x = null; // //# 26: syntax error +implements x = null; // //# 27: syntax error +import x = null; // //# 28: syntax error +library x = null; // //# 29: syntax error +operator x = null; // //# 30: syntax error +part x = null; // //# 31: syntax error +set x = null; // //# 32: syntax error +static x = null; // //# 33: syntax error +typedef x = null; // //# 34: syntax error + +List x = null; // //# 35: syntax error +List x = null; // //# 36: syntax error +List x = null; // //# 37: syntax error +List x = null; // //# 38: syntax error +List x = null; // //# 39: ok +List x = null; // //# 40: syntax error +List x = null; // //# 41: syntax error +List x = null; // //# 42: syntax error +List x = null; // //# 43: syntax error +List x = null; // //# 44: syntax error +List x = null; // //# 45: syntax error +List x = null; // //# 46: syntax error +List x = null; // //# 47: syntax error +List x = null; // //# 48: syntax error +List x = null; // //# 49: syntax error +List x = null; // //# 50: syntax error +List x = null; // //# 51: syntax error + +Function(abstract) x = null; // //# 52: syntax error +Function(as) x = null; // //# 53: syntax error +Function(covariant) x = null; // //# 54: syntax error +Function(deferred) x = null; // //# 55: syntax error +Function(dynamic) x = null; // //# 56: ok +Function(export) x = null; // //# 57: syntax error +Function(external) x = null; // //# 58: syntax error +Function(factory) x = null; // //# 59: syntax error +Function(get) x = null; // //# 60: syntax error +Function(implements) x = null; // //# 61: syntax error +Function(import) x = null; // //# 62: syntax error +Function(library) x = null; // //# 63: syntax error +Function(operator) x = null; // //# 64: syntax error +Function(part) x = null; // //# 65: syntax error +Function(set) x = null; // //# 66: syntax error +Function(static) x = null; // //# 67: syntax error +Function(typedef) x = null; // //# 68: syntax error + +abstract Function() x = null; // //# 69: syntax error +as Function() x = null; // //# 70: syntax error +covariant Function() x = null; // //# 71: syntax error +deferred Function() x = null; // //# 72: syntax error +dynamic Function() x = null; // //# 73: ok +export Function() x = null; // //# 74: syntax error +external Function() x = null; // //# 75: syntax error +factory Function() x = null; // //# 76: syntax error +get Function() x = null; // //# 77: syntax error +implements Function() x = null; // //# 78: syntax error +import Function() x = null; // //# 79: syntax error +library Function() x = null; // //# 80: syntax error +operator Function() x = null; // //# 81: syntax error +part Function() x = null; // //# 82: syntax error +set Function() x = null; // //# 83: syntax error +static Function() x = null; // //# 84: syntax error +typedef Function() x = null; // //# 85: syntax error + +main() { + var x = null; // //# none: ok + x.toString(); +} diff --git a/tests/language_2/known_identifier_prefix_error_test.dart b/tests/language_2/known_identifier_prefix_error_test.dart new file mode 100644 index 00000000000..78829655982 --- /dev/null +++ b/tests/language_2/known_identifier_prefix_error_test.dart @@ -0,0 +1,78 @@ +// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +// Test that identifiers which are used explicitly in the grammar but are +// not built-in identifiers can be used as library prefixes. + +// The identifiers listed below are mentioned in the grammar, but none of +// them is a reserved word or a built-in identifier. Such an identifier can +// be used as a library prefix; this test puts such prefixes in wrong +// locations to verify that this is being handled. Here are the 'known' +// identifiers: `async`, `await`, `hide`, `of`, `on`, `show`, `sync`, `yield`. + +import "package:expect/expect.dart"; +import 'built_in_identifier_prefix_library_async.dart' as async; +import 'built_in_identifier_prefix_library_await.dart' as await; +import 'built_in_identifier_prefix_library_hide.dart' as hide; +import 'built_in_identifier_prefix_library_of.dart' as of; +import 'built_in_identifier_prefix_library_on.dart' as on; +import 'built_in_identifier_prefix_library_show.dart' as show; +import 'built_in_identifier_prefix_library_sync.dart' as sync; +import 'built_in_identifier_prefix_library_yield.dart' as yield; + +async _async = new async.A(); //# 01: compile-time error +await _await = new await.A(); //# 02: compile-time error +hide _hide = new hide.A(); //# 03: compile-time error +of _of = new of.A(); //# 04: compile-time error +on _on = new on.A(); //# 05: compile-time error +show _show = new show.A(); //# 06: compile-time error +sync _sync = new sync.A(); //# 07: compile-time error +yield _yield = new yield.A(); //# 08: compile-time error + +async.B _B_async = new async.B(); //# 09: compile-time error +await.B _B_await = new await.B(); //# 10: compile-time error +hide.B _B_hide = new hide.B(); //# 11: compile-time error +of.B _B_of = new of.B(); //# 12: compile-time error +on.B _B_on = new on.B(); //# 13: compile-time error +show.B _B_show = new show.B(); //# 14: compile-time error +sync.B _B_sync = new sync.B(); //# 15: compile-time error +yield.B _B_yield = new yield.B(); //# 16: compile-time error + +async.B> _B2_async = new async.B(); //# 17: compile-time error +await.B> _B2_await = new await.B(); //# 18: compile-time error +hide.B> _B2_hide = new hide.B(); //# 19: compile-time error +of.B> _B2_of = new of.B(); //# 20: compile-time error +on.B> _B2_on = new on.B(); //# 21: compile-time error +show.B> _B2_show = new show.B(); //# 22: compile-time error +sync.B> _B2_sync = new sync.B(); //# 23: compile-time error +yield.B> _B2_yield = new yield.B(); //# 24: compile-time error + +main() { + Expect.isTrue(_async is async.A); //# 01: continued + Expect.isTrue(_await is await.A); //# 02: continued + Expect.isTrue(_hide is hide.A); //# 03: continued + Expect.isTrue(_of is of.A); //# 04: continued + Expect.isTrue(_on is on.A); //# 05: continued + Expect.isTrue(_show is show.A); //# 06: continued + Expect.isTrue(_sync is sync.A); //# 07: continued + Expect.isTrue(_yield is yield.A); //# 08: continued + + Expect.isTrue(_B_async is async.B); //# 09: continued + Expect.isTrue(_B_await is await.B); //# 10: continued + Expect.isTrue(_B_hide is hide.B); //# 11: continued + Expect.isTrue(_B_of is of.B); //# 12: continued + Expect.isTrue(_B_on is on.B); //# 13: continued + Expect.isTrue(_B_show is show.B); //# 14: continued + Expect.isTrue(_B_sync is sync.B); //# 15: continued + Expect.isTrue(_B_yield is yield.B); //# 16: continued + + Expect.isTrue(_B2_async is async.B); //# 17: continued + Expect.isTrue(_B2_await is await.B); //# 18: continued + Expect.isTrue(_B2_hide is hide.B); //# 19: continued + Expect.isTrue(_B2_of is of.B); //# 20: continued + Expect.isTrue(_B2_on is on.B); //# 21: continued + Expect.isTrue(_B2_show is show.B); //# 22: continued + Expect.isTrue(_B2_sync is sync.B); //# 23: continued + Expect.isTrue(_B2_yield is yield.B); //# 24: continued +} diff --git a/tests/language_2/known_identifier_prefix_test.dart b/tests/language_2/known_identifier_prefix_test.dart new file mode 100644 index 00000000000..2768a3b36d4 --- /dev/null +++ b/tests/language_2/known_identifier_prefix_test.dart @@ -0,0 +1,78 @@ +// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +// The identifiers listed below are mentioned in the grammar, but none of +// them is a reserved word or a built-in identifier. Such an identifier can +// be used as library prefix. Here are said 'known' identifiers: +// +// `async`, `await`, `hide`, `of`, `on`, `show`, `sync`, `yield`. + +import "package:expect/expect.dart"; +import 'built_in_identifier_prefix_library_async.dart' as async; +import 'built_in_identifier_prefix_library_await.dart' as await; +import 'built_in_identifier_prefix_library_hide.dart' as hide; +import 'built_in_identifier_prefix_library_of.dart' as of; +import 'built_in_identifier_prefix_library_on.dart' as on; +import 'built_in_identifier_prefix_library_show.dart' as show; +import 'built_in_identifier_prefix_library_sync.dart' as sync; +import 'built_in_identifier_prefix_library_yield.dart' as yield; + +async.A _async = new async.A(); +await.A _await = new await.A(); +hide.A _hide = new hide.A(); +of.A _of = new of.A(); +on.A _on = new on.A(); +show.A _show = new show.A(); +sync.A _sync = new sync.A(); +yield.A _yield = new yield.A(); + +async.B dynamic_B_async = new async.B(); +await.B dynamic_B_await = new await.B(); +hide.B dynamic_B_hide = new hide.B(); +of.B dynamic_B_of = new of.B(); +on.B dynamic_B_on = new on.B(); +show.B dynamic_B_show = new show.B(); +sync.B dynamic_B_sync = new sync.B(); +yield.B dynamic_B_yield = new yield.B(); + +class UseA { + async.A _async = new async.A(); + await.A _await = new await.A(); + hide.A _hide = new hide.A(); + of.A _of = new of.A(); + on.A _on = new on.A(); + show.A _show = new show.A(); + sync.A _sync = new sync.A(); + yield.A _yield = new yield.A(); +} + +main() { + Expect.isTrue(_async is async.A); + Expect.isTrue(_await is await.A); + Expect.isTrue(_hide is hide.A); + Expect.isTrue(_of is of.A); + Expect.isTrue(_on is on.A); + Expect.isTrue(_show is show.A); + Expect.isTrue(_sync is sync.A); + Expect.isTrue(_yield is yield.A); + + Expect.isTrue(dynamic_B_async is async.B); + Expect.isTrue(dynamic_B_await is await.B); + Expect.isTrue(dynamic_B_hide is hide.B); + Expect.isTrue(dynamic_B_of is of.B); + Expect.isTrue(dynamic_B_on is on.B); + Expect.isTrue(dynamic_B_show is show.B); + Expect.isTrue(dynamic_B_sync is sync.B); + Expect.isTrue(dynamic_B_yield is yield.B); + + var x = new UseA(); + Expect.isTrue(x._async is async.A); + Expect.isTrue(x._await is await.A); + Expect.isTrue(x._hide is hide.A); + Expect.isTrue(x._of is of.A); + Expect.isTrue(x._on is on.A); + Expect.isTrue(x._show is show.A); + Expect.isTrue(x._sync is sync.A); + Expect.isTrue(x._yield is yield.A); +} diff --git a/tests/language_2/known_identifier_usage_error_test.dart b/tests/language_2/known_identifier_usage_error_test.dart new file mode 100644 index 00000000000..9c96dc1e2be --- /dev/null +++ b/tests/language_2/known_identifier_usage_error_test.dart @@ -0,0 +1,73 @@ +// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +// The identifiers listed below are mentioned in the grammar, but none of +// them is a reserved word or a built-in identifier. Such an identifier can +// be used just like all other identifiers, with the exceptions mentioned +// below. Here are said 'known' identifiers: +// +// `async`, `await`, `hide`, `of`, `on`, `show`, `sync`, `yield` +// +// The following exceptions apply: +// +// It is a compile-time error to use `async`, `await`, or `yield` as an +// identifier in the body of a function marked `async`, `async*`, or +// `sync*`. +// +// It is a compile-time error if an asynchronous for-in appears inside a +// synchronous function. + +import 'dart:async'; + +Future f1() async { + int async = 1; //# 01: syntax error + int await = 1; //# 02: syntax error + int yield = 1; //# 03: syntax error + + Stream s = new Stream.fromFuture(new Future.value(1)); + await for (int i in s) { + return i + 1; + } +} + +Stream f2() async* { + int async = 1; //# 04: syntax error + int await = 1; //# 05: syntax error + int yield = 1; //# 06: syntax error + + Stream s = new Stream.fromFuture(new Future.value(1)); + await for (var i in s) { + yield i + 1; + } +} + +Iterable f3() sync* { + int async = 1; //# 07: syntax error + int await = 1; //# 08: syntax error + int yield = 1; //# 09: syntax error + + Stream s = new Stream.fromFuture(new Future.value(1)); + await for (int i in s) { //# 10: compile-time error + yield i + 1; //# 10: continued + } //# 10: continued +} + +int f4() { + int async = 1; + int await = 1; + int yield = 1; + + Stream s = new Stream.fromFuture(new Future.value(1)); + await for (int i in s) { //# 11: compile-time error + return i + 1; //# 11: continued + } //# 11: continued + +} + +main() { + Future f = f1(); + Stream s = f2(); + Iterable i = f3(); + int x = f4(); +} diff --git a/tests/language_2/known_identifier_usage_test.dart b/tests/language_2/known_identifier_usage_test.dart new file mode 100644 index 00000000000..51eaf83c04c --- /dev/null +++ b/tests/language_2/known_identifier_usage_test.dart @@ -0,0 +1,370 @@ +// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +// The identifiers listed below are mentioned in the grammar, but none of +// them is a reserved word or a built-in identifier. Such an identifier can +// be used just like all other identifiers, with a few exceptions. Here are +// said 'known' identifiers: +// +// `async`, `await`, `hide`, `of`, `on`, `show`, `sync`, `yield` +// +// This test contains various declarations of entities whose name is one of +// these known identifiers. + +// Top level. + +var async; //# 01: ok +var await; //# 01: continued +var hide; //# 01: continued +var of; //# 01: continued +var on; //# 01: continued +var show; //# 01: continued +var sync; //# 01: continued +var yield; //# 01: continued + +int async; //# 02: ok +int await; //# 02: continued +int hide; //# 02: continued +int of; //# 02: continued +int on; //# 02: continued +int show; //# 02: continued +int sync; //# 02: continued +int yield; //# 02: continued + +final String async = ""; //# 03: ok +final String await = ""; //# 03: continued +final String hide = ""; //# 03: continued +final String of = ""; //# 03: continued +final String on = ""; //# 03: continued +final String show = ""; //# 03: continued +final String sync = ""; //# 03: continued +final String yield = ""; //# 03: continued + +const async = null; //# 04: ok +const await = null; //# 04: continued +const hide = null; //# 04: continued +const of = null; //# 04: continued +const on = null; //# 04: continued +const show = null; //# 04: continued +const sync = null; //# 04: continued +const yield = null; //# 04: continued + +void async() {} //# 05: ok +void await() {} //# 05: continued +void hide() {} //# 05: continued +void of() {} //# 05: continued +void on() {} //# 05: continued +void show() {} //# 05: continued +void sync() {} //# 05: continued +void yield() {} //# 05: continued + +void f1(async, await, hide, of, on, show, sync, yield) {} +void f2([async, await, hide, of, on, show, sync, yield]) {} +void f3({async, await, hide, of, on, show, sync, yield}) {} + +void f4( + int async, + int await, + int hide, + int of, + int on, + int show, + int sync, + int yield, +) {} + +void f5([ + int async, + int await, + int hide, + int of, + int on, + int show, + int sync, + int yield, +]) {} + +void f6({ + int async, + int await, + int hide, + int of, + int on, + int show, + int sync, + int yield, +}) {} + +class A { + var async; //# 01: continued + var await; //# 01: continued + var hide; //# 01: continued + var of; //# 01: continued + var on; //# 01: continued + var show; //# 01: continued + var sync; //# 01: continued + var yield; //# 01: continued + + num async; //# 02: continued + num await; //# 02: continued + num hide; //# 02: continued + num of; //# 02: continued + num on; //# 02: continued + num show; //# 02: continued + num sync; //# 02: continued + num yield; //# 02: continued + + final String async = ""; //# 03: continued + final String await = ""; //# 03: continued + final String hide = ""; //# 03: continued + final String of = ""; //# 03: continued + final String on = ""; //# 03: continued + final String show = ""; //# 03: continued + final String sync = ""; //# 03: continued + final String yield = ""; //# 03: continued + + String get async => ""; //# 04: continued + String get await => ""; //# 04: continued + String get hide => ""; //# 04: continued + String get of => ""; //# 04: continued + String get on => ""; //# 04: continued + String get show => ""; //# 04: continued + String get sync => ""; //# 04: continued + String get yield => ""; //# 04: continued + + void async() {} //# 05: ok + void await() {} //# 05: continued + void hide() {} //# 05: continued + void of() {} //# 05: continued + void on() {} //# 05: continued + void show() {} //# 05: continued + void sync() {} //# 05: continued + void yield() {} //# 05: continued + + A(); + + A.c1( //# 01: continued + this.async, //# 01: continued + this.await, //# 01: continued + this.hide, //# 01: continued + this.of, //# 01: continued + this.on, //# 01: continued + this.show, //# 01: continued + this.sync, //# 01: continued + this.yield, //# 01: continued + ) {} //# 01: continued + + A.c2([ //# 01: continued + this.async, //# 01: continued + this.await, //# 01: continued + this.hide, //# 01: continued + this.of, //# 01: continued + this.on, //# 01: continued + this.show, //# 01: continued + this.sync, //# 01: continued + this.yield, //# 01: continued + ]) {} //# 01: continued + + A.c3({ //# 01: continued + this.async, //# 01: continued + this.await, //# 01: continued + this.hide, //# 01: continued + this.of, //# 01: continued + this.on, //# 01: continued + this.show, //# 01: continued + this.sync, //# 01: continued + this.yield, //# 01: continued + }) {} //# 01: continued + + A.c4( //# 02: continued + int this.async, //# 02: continued + int this.await, //# 02: continued + int this.hide, //# 02: continued + int this.of, //# 02: continued + int this.on, //# 02: continued + int this.show, //# 02: continued + int this.sync, //# 02: continued + int this.yield, //# 02: continued + ) {} //# 02: continued + + A.c5([ //# 02: continued + int this.async, //# 02: continued + int this.await, //# 02: continued + int this.hide, //# 02: continued + int this.of, //# 02: continued + int this.on, //# 02: continued + int this.show, //# 02: continued + int this.sync, //# 02: continued + int this.yield, //# 02: continued + ]) {} //# 02: continued + + A.c6({ //# 02: continued + int this.async, //# 02: continued + int this.await, //# 02: continued + int this.hide, //# 02: continued + int this.of, //# 02: continued + int this.on, //# 02: continued + int this.show, //# 02: continued + int this.sync, //# 02: continued + int this.yield, //# 02: continued + }) {} //# 02: continued + + void method1( + covariant int async, + covariant int await, + covariant int hide, + covariant int of, + covariant int on, + covariant int show, + covariant int sync, + covariant int yield, + ) {} + + void method2([ + covariant int async, + covariant int await, + covariant int hide, + covariant int of, + covariant int on, + covariant int show, + covariant int sync, + covariant int yield, + ]) {} + + void method3({ + covariant int async, + covariant int await, + covariant int hide, + covariant int of, + covariant int on, + covariant int show, + covariant int sync, + covariant int yield, + }) {} +} + +class B { + static var async; //# 01: continued + static var await; //# 01: continued + static var hide; //# 01: continued + static var of; //# 01: continued + static var on; //# 01: continued + static var show; //# 01: continued + static var sync; //# 01: continued + static var yield; //# 01: continued + + static num async; //# 02: continued + static num await; //# 02: continued + static num hide; //# 02: continued + static num of; //# 02: continued + static num on; //# 02: continued + static num show; //# 02: continued + static num sync; //# 02: continued + static num yield; //# 02: continued + + static final String async = ""; //# 03: continued + static final String await = ""; //# 03: continued + static final String hide = ""; //# 03: continued + static final String of = ""; //# 03: continued + static final String on = ""; //# 03: continued + static final String show = ""; //# 03: continued + static final String sync = ""; //# 03: continued + static final String yield = ""; //# 03: continued + + static const async = null; //# 04: continued + static const await = null; //# 04: continued + static const hide = null; //# 04: continued + static const of = null; //# 04: continued + static const on = null; //# 04: continued + static const show = null; //# 04: continued + static const sync = null; //# 04: continued + static const yield = null; //# 04: continued + + static get async => null; //# 05: continued + static get await => null; //# 05: continued + static get hide => null; //# 05: continued + static get of => null; //# 05: continued + static get on => null; //# 05: continued + static get show => null; //# 05: continued + static get sync => null; //# 05: continued + static get yield => null; //# 05: continued +} + +main() { + /* //# none: ok + + // Except none: Use a top-level declaration. + var top_async = async; + var top_await = await; + var top_hide = hide; + var top_of = of; + var top_on = on; + var top_show = show; + var top_sync = sync; + var top_yield = yield; + + // Except none: Use an instance member of A. + A a = new A(); + var instance_async = a.async; + var instance_await = a.await; + var instance_hide = a.hide; + var instance_of = a.of; + var instance_on = a.on; + var instance_show = a.show; + var instance_sync = a.sync; + var instance_yield = a.yield; + + // Except none: Use a static member of B. + + var static_async = B.async; + var static_await = B.await; + var static_hide = B.hide; + var static_of = B.of; + var static_on = B.on; + var static_show = B.show; + var static_sync = B.sync; + var static_yield = B.yield; + + */ //# none: continued + + var a1 = new A.c1(1, 1, 1, 1, 1, 1, 1, 1); //# 01: continued + var a2 = new A.c2(); //# 01: continued + var a3 = new A.c3( //# 01: continued + async: 1, //# 01: continued + await: 1, //# 01: continued + hide: 1, //# 01: continued + of: 1, //# 01: continued + on: 1, //# 01: continued + show: 1, //# 01: continued + sync: 1, //# 01: continued + yield: 1, //# 01: continued + ); //# 01: continued + + var a4 = new A.c4(1, 1, 1, 1, 1, 1, 1, 1); //# 02: continued + var a5 = new A.c5(); //# 02: continued + var a6 = new A.c6( //# 02: continued + async: 1, //# 02: continued + await: 1, //# 02: continued + hide: 1, //# 02: continued + of: 1, //# 02: continued + on: 1, //# 02: continued + show: 1, //# 02: continued + sync: 1, //# 02: continued + yield: 1, //# 02: continued + ); //# 02: continued + + var aa = new A(); + aa.method1(1, 1, 1, 1, 1, 1, 1, 1); + aa.method2(); + aa.method3( + async: 1, + await: 1, + hide: 1, + of: 1, + on: 1, + show: 1, + sync: 1, + yield: 1, + ); +} diff --git a/tests/language_2/language_2.status b/tests/language_2/language_2.status index 9b88c642537..3353c3d92ad 100644 --- a/tests/language_2/language_2.status +++ b/tests/language_2/language_2.status @@ -116,6 +116,8 @@ issue1363_test/01: MissingCompileTimeError # Requires strong mode issue15606_test/01: MissingCompileTimeError # Requires strong mode issue18628_1_test/01: MissingCompileTimeError # Requires strong mode issue18628_2_test/01: MissingCompileTimeError # Requires strong mode +known_identifier_prefix_error_test/none: Pass +known_identifier_prefix_error_test/*: MissingCompileTimeError # Requires strong mode map_literal3_test/01: MissingCompileTimeError map_literal3_test/02: MissingCompileTimeError map_literal3_test/03: MissingCompileTimeError diff --git a/tests/language_2/language_2_analyzer.status b/tests/language_2/language_2_analyzer.status index 9446e2a6a52..d1a92a6d653 100644 --- a/tests/language_2/language_2_analyzer.status +++ b/tests/language_2/language_2_analyzer.status @@ -467,6 +467,8 @@ mixin_invalid_bound_test/10: MissingCompileTimeError [ $compiler == dart2analyzer ] generic_no_such_method_dispatcher_simple_test: Skip # This test is just for kernel. fuzzy_arrows_test/01: MissingCompileTimeError +built_in_identifier_type_annotation_test/22: MissingCompileTimeError # Issue 28813 +built_in_identifier_type_annotation_test/85: Crash # Issue 28813 [ $compiler == dart2analyzer && $checked ] assertion_initializer_const_error2_test/none: Pass @@ -1209,6 +1211,26 @@ async_congruence_local_test/02: MissingCompileTimeError async_congruence_method_test/01: MissingCompileTimeError async_congruence_unnamed_test/01: MissingCompileTimeError async_congruence_unnamed_test/02: MissingCompileTimeError +built_in_identifier_type_annotation_test/35: MissingCompileTimeError # Issue 28813 +built_in_identifier_type_annotation_test/36: MissingCompileTimeError # Issue 28813 +built_in_identifier_type_annotation_test/37: MissingCompileTimeError # Issue 28813 +built_in_identifier_type_annotation_test/38: MissingCompileTimeError # Issue 28813 +built_in_identifier_type_annotation_test/40: MissingCompileTimeError # Issue 28813 +built_in_identifier_type_annotation_test/41: MissingCompileTimeError # Issue 28813 +built_in_identifier_type_annotation_test/42: MissingCompileTimeError # Issue 28813 +built_in_identifier_type_annotation_test/43: MissingCompileTimeError # Issue 28813 +built_in_identifier_type_annotation_test/44: MissingCompileTimeError # Issue 28813 +built_in_identifier_type_annotation_test/45: MissingCompileTimeError # Issue 28813 +built_in_identifier_type_annotation_test/46: MissingCompileTimeError # Issue 28813 +built_in_identifier_type_annotation_test/47: MissingCompileTimeError # Issue 28813 +built_in_identifier_type_annotation_test/48: MissingCompileTimeError # Issue 28813 +built_in_identifier_type_annotation_test/49: MissingCompileTimeError # Issue 28813 +built_in_identifier_type_annotation_test/50: MissingCompileTimeError # Issue 28813 +built_in_identifier_type_annotation_test/51: MissingCompileTimeError # Issue 28813 +built_in_identifier_type_annotation_test/70: MissingCompileTimeError # Issue 28813 +built_in_identifier_type_annotation_test/72: MissingCompileTimeError # Issue 28813 +built_in_identifier_type_annotation_test/78: MissingCompileTimeError # Issue 28813 +built_in_identifier_type_annotation_test/81: MissingCompileTimeError # Issue 28813 cast_test/04: MissingCompileTimeError cast_test/05: MissingCompileTimeError checked_null_test/01: MissingCompileTimeError @@ -1359,6 +1381,8 @@ initializing_formal_type_test: MissingCompileTimeError instantiate_type_variable_test/01: StaticWarning interceptor6_test: StaticWarning invocation_mirror_test: StaticWarning +known_identifier_prefix_error_test/none: Pass +known_identifier_prefix_error_test/*: MissingCompileTimeError # Error only in strong mode. least_upper_bound_expansive_test/01: MissingCompileTimeError least_upper_bound_expansive_test/02: MissingCompileTimeError least_upper_bound_expansive_test/03: MissingCompileTimeError diff --git a/tests/language_2/language_2_dart2js.status b/tests/language_2/language_2_dart2js.status index 8f244b9dcc4..090eea25e0a 100644 --- a/tests/language_2/language_2_dart2js.status +++ b/tests/language_2/language_2_dart2js.status @@ -797,6 +797,26 @@ assertion_initializer_const_error2_test/*: Crash # Issue 30038 assertion_initializer_test: Crash bad_constructor_test/05: CompileTimeError bad_typedef_test/00: Crash # Issue 28214 +built_in_identifier_type_annotation_test/13: Crash # Issue 28815 +built_in_identifier_type_annotation_test/22: MissingCompileTimeError # Error only in strong mode +built_in_identifier_type_annotation_test/30: Crash # Issue 28815 +built_in_identifier_type_annotation_test/52: Crash # Issue 28815 +built_in_identifier_type_annotation_test/53: Crash # Issue 28815 +built_in_identifier_type_annotation_test/54: Crash # Issue 28815 +built_in_identifier_type_annotation_test/55: Crash # Issue 28815 +built_in_identifier_type_annotation_test/57: Crash # Issue 28815 +built_in_identifier_type_annotation_test/58: Crash # Issue 28815 +built_in_identifier_type_annotation_test/59: Crash # Issue 28815 +built_in_identifier_type_annotation_test/60: Crash # Issue 28815 +built_in_identifier_type_annotation_test/61: Crash # Issue 28815 +built_in_identifier_type_annotation_test/62: Crash # Issue 28815 +built_in_identifier_type_annotation_test/63: Crash # Issue 28815 +built_in_identifier_type_annotation_test/64: Crash # Issue 28815 +built_in_identifier_type_annotation_test/65: Crash # Issue 28815 +built_in_identifier_type_annotation_test/66: Crash # Issue 28815 +built_in_identifier_type_annotation_test/67: Crash # Issue 28815 +built_in_identifier_type_annotation_test/68: Crash # Issue 28815 +built_in_identifier_type_annotation_test/81: Crash # Issue 28815 call_function_apply_test: RuntimeError # Issue 23873 canonical_const2_test: RuntimeError, OK # Issue 1533 compile_time_constant_o_test/01: MissingCompileTimeError @@ -3161,6 +3181,23 @@ yieldstar_pause_test: RuntimeError checked_setter_test: RuntimeError # Issue 31128 checked_setter2_test: RuntimeError # Issue 31128 checked_setter3_test: RuntimeError # Issue 31128 +built_in_identifier_type_annotation_test/22: Crash # Issue 28815 +built_in_identifier_type_annotation_test/52: MissingCompileTimeError # Issue 28815 +built_in_identifier_type_annotation_test/53: MissingCompileTimeError # Issue 28815 +built_in_identifier_type_annotation_test/54: MissingCompileTimeError # Issue 28815 +built_in_identifier_type_annotation_test/55: MissingCompileTimeError # Issue 28815 +built_in_identifier_type_annotation_test/57: MissingCompileTimeError # Issue 28815 +built_in_identifier_type_annotation_test/58: MissingCompileTimeError # Issue 28815 +built_in_identifier_type_annotation_test/59: MissingCompileTimeError # Issue 28815 +built_in_identifier_type_annotation_test/60: MissingCompileTimeError # Issue 28815 +built_in_identifier_type_annotation_test/61: MissingCompileTimeError # Issue 28815 +built_in_identifier_type_annotation_test/62: MissingCompileTimeError # Issue 28815 +built_in_identifier_type_annotation_test/63: MissingCompileTimeError # Issue 28815 +built_in_identifier_type_annotation_test/64: MissingCompileTimeError # Issue 28815 +built_in_identifier_type_annotation_test/65: MissingCompileTimeError # Issue 28815 +built_in_identifier_type_annotation_test/66: MissingCompileTimeError # Issue 28815 +built_in_identifier_type_annotation_test/67: MissingCompileTimeError # Issue 28815 +built_in_identifier_type_annotation_test/68: MissingCompileTimeError # Issue 28815 [ $compiler == dart2js && $dart2js_with_kernel && !$checked ] assertion_initializer_const_error2_test/none: Pass @@ -3169,6 +3206,15 @@ implicit_downcast_during_assignment_test: RuntimeError implicit_downcast_during_compound_assignment_test: RuntimeError implicit_downcast_during_if_null_assignment_test: RuntimeError +[ $compiler == dart2js && $dart2js_with_kernel && $checked ] +known_identifier_usage_error_test/none: RuntimeError # Issue 28815 +built_in_identifier_test: RuntimeError # Issue 28815 +built_in_identifier_type_annotation_test/none: RuntimeError # Issue 28815 +built_in_identifier_type_annotation_test/05: RuntimeError # Issue 28815 +built_in_identifier_type_annotation_test/39: RuntimeError # Issue 28815 +built_in_identifier_type_annotation_test/56: RuntimeError # Issue 28815 +built_in_identifier_type_annotation_test/73: RuntimeError # Issue 28815 + [ $compiler == dart2js && $dart2js_with_kernel && $minified && $checked ] inline_super_field_test: Crash typedef_is_test: Crash @@ -3338,4 +3384,3 @@ regress_26855_test/4: Crash # Issue 26867 [ $compiler == dart2js && $csp && $browser && !$fast_startup ] conditional_import_string_test: Fail # Issue 30615 conditional_import_test: Fail # Issue 30615 - diff --git a/tests/language_2/language_2_dartdevc.status b/tests/language_2/language_2_dartdevc.status index 132353664bd..4bde37d9fb5 100644 --- a/tests/language_2/language_2_dartdevc.status +++ b/tests/language_2/language_2_dartdevc.status @@ -14,6 +14,7 @@ assertion_initializer_const_function_test/01: Crash assertion_initializer_test: CompileTimeError black_listed_test/none: fail # Issue 14228 built_in_identifier_prefix_test: CompileTimeError +built_in_identifier_type_annotation_test/22: MissingCompileTimeError # Issue 28816 conflicting_type_variable_and_setter_test: CompileTimeError const_for_in_variable_test/01: MissingCompileTimeError const_types_test/07: MissingCompileTimeError diff --git a/tests/language_2/language_2_kernel.status b/tests/language_2/language_2_kernel.status index 5cb369c80b2..564bd20fd40 100644 --- a/tests/language_2/language_2_kernel.status +++ b/tests/language_2/language_2_kernel.status @@ -15,6 +15,23 @@ arithmetic2_test: RuntimeError # Throws CastError instead of TypeError async_star_cancel_while_paused_test: RuntimeError async_star_pause_test: Fail, OK +built_in_identifier_type_annotation_test/22: DartkCrash # Issue 28814 +built_in_identifier_type_annotation_test/52: MissingCompileTimeError # Issue 28814 +built_in_identifier_type_annotation_test/53: MissingCompileTimeError # Issue 28814 +built_in_identifier_type_annotation_test/54: MissingCompileTimeError # Issue 28814 +built_in_identifier_type_annotation_test/55: MissingCompileTimeError # Issue 28814 +built_in_identifier_type_annotation_test/57: MissingCompileTimeError # Issue 28814 +built_in_identifier_type_annotation_test/58: MissingCompileTimeError # Issue 28814 +built_in_identifier_type_annotation_test/59: MissingCompileTimeError # Issue 28814 +built_in_identifier_type_annotation_test/60: MissingCompileTimeError # Issue 28814 +built_in_identifier_type_annotation_test/61: MissingCompileTimeError # Issue 28814 +built_in_identifier_type_annotation_test/62: MissingCompileTimeError # Issue 28814 +built_in_identifier_type_annotation_test/63: MissingCompileTimeError # Issue 28814 +built_in_identifier_type_annotation_test/64: MissingCompileTimeError # Issue 28814 +built_in_identifier_type_annotation_test/65: MissingCompileTimeError # Issue 28814 +built_in_identifier_type_annotation_test/66: MissingCompileTimeError # Issue 28814 +built_in_identifier_type_annotation_test/67: MissingCompileTimeError # Issue 28814 +built_in_identifier_type_annotation_test/68: MissingCompileTimeError # Issue 28814 closure_invoked_through_interface_target_field_test: MissingCompileTimeError const_error_multiply_initialized_test/02: MissingCompileTimeError const_error_multiply_initialized_test/04: MissingCompileTimeError @@ -271,6 +288,23 @@ assertion_test: Crash bool_check_test: RuntimeError bool_condition_check_test: RuntimeError built_in_identifier_prefix_test: CompileTimeError +built_in_identifier_type_annotation_test/22: DartkCrash # Issue 28814 +built_in_identifier_type_annotation_test/52: MissingCompileTimeError # Issue 28814 +built_in_identifier_type_annotation_test/53: MissingCompileTimeError # Issue 28814 +built_in_identifier_type_annotation_test/54: MissingCompileTimeError # Issue 28814 +built_in_identifier_type_annotation_test/55: MissingCompileTimeError # Issue 28814 +built_in_identifier_type_annotation_test/57: MissingCompileTimeError # Issue 28814 +built_in_identifier_type_annotation_test/58: MissingCompileTimeError # Issue 28814 +built_in_identifier_type_annotation_test/59: MissingCompileTimeError # Issue 28814 +built_in_identifier_type_annotation_test/60: MissingCompileTimeError # Issue 28814 +built_in_identifier_type_annotation_test/61: MissingCompileTimeError # Issue 28814 +built_in_identifier_type_annotation_test/62: MissingCompileTimeError # Issue 28814 +built_in_identifier_type_annotation_test/63: MissingCompileTimeError # Issue 28814 +built_in_identifier_type_annotation_test/64: MissingCompileTimeError # Issue 28814 +built_in_identifier_type_annotation_test/65: MissingCompileTimeError # Issue 28814 +built_in_identifier_type_annotation_test/66: MissingCompileTimeError # Issue 28814 +built_in_identifier_type_annotation_test/67: MissingCompileTimeError # Issue 28814 +built_in_identifier_type_annotation_test/68: MissingCompileTimeError # Issue 28814 checked_null_test/01: MissingCompileTimeError checked_setter2_test: MissingCompileTimeError checked_setter3_test/01: MissingCompileTimeError @@ -337,6 +371,32 @@ assertion_initializer_const_function_test/01: Crash assertion_initializer_const_function_test/none: Crash regress_30339_test: Crash +[ $compiler == dartkp && $runtime == dart_precompiled && $checked && $strong ] +known_identifier_prefix_error_test/01: MissingCompileTimeError # Issue 28814 +known_identifier_prefix_error_test/02: MissingCompileTimeError # Issue 28814 +known_identifier_prefix_error_test/03: MissingCompileTimeError # Issue 28814 +known_identifier_prefix_error_test/04: MissingCompileTimeError # Issue 28814 +known_identifier_prefix_error_test/05: MissingCompileTimeError # Issue 28814 +known_identifier_prefix_error_test/06: MissingCompileTimeError # Issue 28814 +known_identifier_prefix_error_test/07: MissingCompileTimeError # Issue 28814 +known_identifier_prefix_error_test/08: MissingCompileTimeError # Issue 28814 +known_identifier_prefix_error_test/09: MissingCompileTimeError # Issue 28814 +known_identifier_prefix_error_test/10: MissingCompileTimeError # Issue 28814 +known_identifier_prefix_error_test/11: MissingCompileTimeError # Issue 28814 +known_identifier_prefix_error_test/12: MissingCompileTimeError # Issue 28814 +known_identifier_prefix_error_test/13: MissingCompileTimeError # Issue 28814 +known_identifier_prefix_error_test/14: MissingCompileTimeError # Issue 28814 +known_identifier_prefix_error_test/15: MissingCompileTimeError # Issue 28814 +known_identifier_prefix_error_test/16: MissingCompileTimeError # Issue 28814 +known_identifier_prefix_error_test/17: MissingCompileTimeError # Issue 28814 +known_identifier_prefix_error_test/18: MissingCompileTimeError # Issue 28814 +known_identifier_prefix_error_test/19: MissingCompileTimeError # Issue 28814 +known_identifier_prefix_error_test/20: MissingCompileTimeError # Issue 28814 +known_identifier_prefix_error_test/21: MissingCompileTimeError # Issue 28814 +known_identifier_prefix_error_test/22: MissingCompileTimeError # Issue 28814 +known_identifier_prefix_error_test/23: MissingCompileTimeError # Issue 28814 +known_identifier_prefix_error_test/24: MissingCompileTimeError # Issue 28814 + # dartk: checked mode failures [ ($compiler == dartk || $compiler == dartkp) && $strong && $checked ] assert_initializer_test/31: MissingCompileTimeError # KernelVM bug: Constant evaluation. @@ -833,6 +893,30 @@ issue18628_1_test/01: MissingCompileTimeError issue18628_2_test/01: MissingCompileTimeError issue_25671b_test/01: DartkCrash list_is_test: RuntimeError +known_identifier_prefix_error_test/01: MissingCompileTimeError # Issue 28814 +known_identifier_prefix_error_test/02: MissingCompileTimeError # Issue 28814 +known_identifier_prefix_error_test/03: MissingCompileTimeError # Issue 28814 +known_identifier_prefix_error_test/04: MissingCompileTimeError # Issue 28814 +known_identifier_prefix_error_test/05: MissingCompileTimeError # Issue 28814 +known_identifier_prefix_error_test/06: MissingCompileTimeError # Issue 28814 +known_identifier_prefix_error_test/07: MissingCompileTimeError # Issue 28814 +known_identifier_prefix_error_test/08: MissingCompileTimeError # Issue 28814 +known_identifier_prefix_error_test/09: MissingCompileTimeError # Issue 28814 +known_identifier_prefix_error_test/10: MissingCompileTimeError # Issue 28814 +known_identifier_prefix_error_test/11: MissingCompileTimeError # Issue 28814 +known_identifier_prefix_error_test/12: MissingCompileTimeError # Issue 28814 +known_identifier_prefix_error_test/13: MissingCompileTimeError # Issue 28814 +known_identifier_prefix_error_test/14: MissingCompileTimeError # Issue 28814 +known_identifier_prefix_error_test/15: MissingCompileTimeError # Issue 28814 +known_identifier_prefix_error_test/16: MissingCompileTimeError # Issue 28814 +known_identifier_prefix_error_test/17: MissingCompileTimeError # Issue 28814 +known_identifier_prefix_error_test/18: MissingCompileTimeError # Issue 28814 +known_identifier_prefix_error_test/19: MissingCompileTimeError # Issue 28814 +known_identifier_prefix_error_test/20: MissingCompileTimeError # Issue 28814 +known_identifier_prefix_error_test/21: MissingCompileTimeError # Issue 28814 +known_identifier_prefix_error_test/22: MissingCompileTimeError # Issue 28814 +known_identifier_prefix_error_test/23: MissingCompileTimeError # Issue 28814 +known_identifier_prefix_error_test/24: MissingCompileTimeError # Issue 28814 map_literal11_test/none: MissingRuntimeError map_literal1_test/01: MissingCompileTimeError map_literal3_test/01: MissingCompileTimeError @@ -997,6 +1081,9 @@ void_type_usage_test/paren_stmt: CompileTimeError void_type_usage_test/setter_assign: CompileTimeError wrong_number_type_arguments_test/none: Pass +[ $compiler == dartk && $strong && $checked ] +known_identifier_usage_error_test/none: RuntimeError # Issue 28814 + [ $compiler == dartkp && $strong ] abstract_syntax_test/01: MissingCompileTimeError assertion_initializer_const_error_test/01: Pass @@ -1015,6 +1102,8 @@ async_star_test/02: Crash bad_constructor_test/00: MissingCompileTimeError bad_constructor_test/01: MissingCompileTimeError bad_named_parameters_test/04: Crash +built_in_identifier_type_annotation_test/22: Crash # Issue 28814 +built_in_identifier_type_annotation_test/74: MissingCompileTimeError # Issue 28814 built_in_identifier_illegal_test/01: MissingCompileTimeError built_in_identifier_illegal_test/04: MissingCompileTimeError built_in_identifier_illegal_test/05: MissingCompileTimeError @@ -1029,6 +1118,7 @@ built_in_identifier_illegal_test/17: MissingCompileTimeError built_in_identifier_illegal_test/18: MissingCompileTimeError built_in_identifier_illegal_test/19: MissingCompileTimeError built_in_identifier_illegal_test/20: MissingCompileTimeError +built_in_identifier_not_prefix_test/22: MissingCompileTimeError # Issue 28814 call_function_test: CompileTimeError class_cycle_test/02: MissingCompileTimeError class_cycle_test/03: MissingCompileTimeError diff --git a/tests/language_2/language_2_vm.status b/tests/language_2/language_2_vm.status index 8c0fff951b2..6361437ee98 100644 --- a/tests/language_2/language_2_vm.status +++ b/tests/language_2/language_2_vm.status @@ -63,6 +63,7 @@ bit_operations_test/02: MissingCompileTimeError bit_operations_test/03: MissingCompileTimeError bit_operations_test/04: MissingCompileTimeError built_in_identifier_prefix_test: CompileTimeError +built_in_identifier_type_annotation_test/22: MissingCompileTimeError # Error only in strong mode call_constructor_on_unresolvable_class_test/01: MissingCompileTimeError call_constructor_on_unresolvable_class_test/02: MissingCompileTimeError call_constructor_on_unresolvable_class_test/03: MissingCompileTimeError