mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 08:11:30 -06:00
commit
5af72b5f02
@ -2059,12 +2059,12 @@ namespace ts {
|
||||
// Name in member declaration or property name in property access
|
||||
return (<NamedDeclaration | PropertyAccessExpression>parent).name === node;
|
||||
case SyntaxKind.QualifiedName:
|
||||
// Name on right hand side of dot in a type query
|
||||
// Name on right hand side of dot in a type query or type reference
|
||||
if ((<QualifiedName>parent).right === node) {
|
||||
while (parent.kind === SyntaxKind.QualifiedName) {
|
||||
parent = parent.parent;
|
||||
}
|
||||
return parent.kind === SyntaxKind.TypeQuery;
|
||||
return parent.kind === SyntaxKind.TypeQuery || parent.kind === SyntaxKind.TypeReference;
|
||||
}
|
||||
return false;
|
||||
case SyntaxKind.BindingElement:
|
||||
|
||||
@ -0,0 +1,16 @@
|
||||
//// [strictModeEnumMemberNameReserved.ts]
|
||||
"use strict";
|
||||
enum E {
|
||||
static
|
||||
}
|
||||
|
||||
const x1: E.static = E.static;
|
||||
|
||||
|
||||
//// [strictModeEnumMemberNameReserved.js]
|
||||
"use strict";
|
||||
var E;
|
||||
(function (E) {
|
||||
E[E["static"] = 0] = "static";
|
||||
})(E || (E = {}));
|
||||
var x1 = E.static;
|
||||
@ -0,0 +1,17 @@
|
||||
=== tests/cases/compiler/strictModeEnumMemberNameReserved.ts ===
|
||||
"use strict";
|
||||
enum E {
|
||||
>E : Symbol(E, Decl(strictModeEnumMemberNameReserved.ts, 0, 13))
|
||||
|
||||
static
|
||||
>static : Symbol(E.static, Decl(strictModeEnumMemberNameReserved.ts, 1, 8))
|
||||
}
|
||||
|
||||
const x1: E.static = E.static;
|
||||
>x1 : Symbol(x1, Decl(strictModeEnumMemberNameReserved.ts, 5, 5))
|
||||
>E : Symbol(E, Decl(strictModeEnumMemberNameReserved.ts, 0, 13))
|
||||
>static : Symbol(E.static, Decl(strictModeEnumMemberNameReserved.ts, 1, 8))
|
||||
>E.static : Symbol(E.static, Decl(strictModeEnumMemberNameReserved.ts, 1, 8))
|
||||
>E : Symbol(E, Decl(strictModeEnumMemberNameReserved.ts, 0, 13))
|
||||
>static : Symbol(E.static, Decl(strictModeEnumMemberNameReserved.ts, 1, 8))
|
||||
|
||||
@ -0,0 +1,19 @@
|
||||
=== tests/cases/compiler/strictModeEnumMemberNameReserved.ts ===
|
||||
"use strict";
|
||||
>"use strict" : "use strict"
|
||||
|
||||
enum E {
|
||||
>E : E
|
||||
|
||||
static
|
||||
>static : E
|
||||
}
|
||||
|
||||
const x1: E.static = E.static;
|
||||
>x1 : E
|
||||
>E : any
|
||||
>static : E
|
||||
>E.static : E
|
||||
>E : typeof E
|
||||
>static : E
|
||||
|
||||
@ -28,22 +28,17 @@ tests/cases/compiler/strictModeReservedWord.ts(19,21): error TS1212: Identifier
|
||||
tests/cases/compiler/strictModeReservedWord.ts(19,21): error TS2503: Cannot find namespace 'private'.
|
||||
tests/cases/compiler/strictModeReservedWord.ts(20,22): error TS1212: Identifier expected. 'private' is a reserved word in strict mode.
|
||||
tests/cases/compiler/strictModeReservedWord.ts(20,22): error TS2503: Cannot find namespace 'private'.
|
||||
tests/cases/compiler/strictModeReservedWord.ts(20,30): error TS1212: Identifier expected. 'package' is a reserved word in strict mode.
|
||||
tests/cases/compiler/strictModeReservedWord.ts(21,22): error TS1212: Identifier expected. 'private' is a reserved word in strict mode.
|
||||
tests/cases/compiler/strictModeReservedWord.ts(21,22): error TS2503: Cannot find namespace 'private'.
|
||||
tests/cases/compiler/strictModeReservedWord.ts(21,30): error TS1212: Identifier expected. 'package' is a reserved word in strict mode.
|
||||
tests/cases/compiler/strictModeReservedWord.ts(21,38): error TS1212: Identifier expected. 'protected' is a reserved word in strict mode.
|
||||
tests/cases/compiler/strictModeReservedWord.ts(22,9): error TS2300: Duplicate identifier 'b'.
|
||||
tests/cases/compiler/strictModeReservedWord.ts(22,12): error TS1212: Identifier expected. 'interface' is a reserved word in strict mode.
|
||||
tests/cases/compiler/strictModeReservedWord.ts(22,12): error TS2503: Cannot find namespace 'interface'.
|
||||
tests/cases/compiler/strictModeReservedWord.ts(22,22): error TS1212: Identifier expected. 'package' is a reserved word in strict mode.
|
||||
tests/cases/compiler/strictModeReservedWord.ts(22,30): error TS1212: Identifier expected. 'implements' is a reserved word in strict mode.
|
||||
tests/cases/compiler/strictModeReservedWord.ts(23,5): error TS2552: Cannot find name 'ublic'. Did you mean 'public'?
|
||||
tests/cases/compiler/strictModeReservedWord.ts(24,5): error TS1212: Identifier expected. 'static' is a reserved word in strict mode.
|
||||
tests/cases/compiler/strictModeReservedWord.ts(24,5): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'String' has no compatible call signatures.
|
||||
|
||||
|
||||
==== tests/cases/compiler/strictModeReservedWord.ts (43 errors) ====
|
||||
==== tests/cases/compiler/strictModeReservedWord.ts (38 errors) ====
|
||||
let let = 10;
|
||||
~~~
|
||||
!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
|
||||
@ -124,17 +119,11 @@ tests/cases/compiler/strictModeReservedWord.ts(24,5): error TS2349: Cannot invok
|
||||
!!! error TS1212: Identifier expected. 'private' is a reserved word in strict mode.
|
||||
~~~~~~~
|
||||
!!! error TS2503: Cannot find namespace 'private'.
|
||||
~~~~~~~
|
||||
!!! error TS1212: Identifier expected. 'package' is a reserved word in strict mode.
|
||||
function foo2(x: private.package.protected) { }
|
||||
~~~~~~~
|
||||
!!! error TS1212: Identifier expected. 'private' is a reserved word in strict mode.
|
||||
~~~~~~~
|
||||
!!! error TS2503: Cannot find namespace 'private'.
|
||||
~~~~~~~
|
||||
!!! error TS1212: Identifier expected. 'package' is a reserved word in strict mode.
|
||||
~~~~~~~~~
|
||||
!!! error TS1212: Identifier expected. 'protected' is a reserved word in strict mode.
|
||||
let b: interface.package.implements.B;
|
||||
~
|
||||
!!! error TS2300: Duplicate identifier 'b'.
|
||||
@ -142,10 +131,6 @@ tests/cases/compiler/strictModeReservedWord.ts(24,5): error TS2349: Cannot invok
|
||||
!!! error TS1212: Identifier expected. 'interface' is a reserved word in strict mode.
|
||||
~~~~~~~~~
|
||||
!!! error TS2503: Cannot find namespace 'interface'.
|
||||
~~~~~~~
|
||||
!!! error TS1212: Identifier expected. 'package' is a reserved word in strict mode.
|
||||
~~~~~~~~~~
|
||||
!!! error TS1212: Identifier expected. 'implements' is a reserved word in strict mode.
|
||||
ublic();
|
||||
~~~~~
|
||||
!!! error TS2552: Cannot find name 'ublic'. Did you mean 'public'?
|
||||
|
||||
6
tests/cases/compiler/strictModeEnumMemberNameReserved.ts
Normal file
6
tests/cases/compiler/strictModeEnumMemberNameReserved.ts
Normal file
@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
enum E {
|
||||
static
|
||||
}
|
||||
|
||||
const x1: E.static = E.static;
|
||||
Loading…
x
Reference in New Issue
Block a user