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 <lrn@google.com> Commit-Queue: Erik Ernst <eernst@google.com>
This commit is contained in:
committed by
commit-bot@chromium.org
parent
d66ee882d3
commit
f68e5231b4
+26
-26
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user