diff --git a/tests/baselines/reference/asiPreventsParsingAsInterface01.js b/tests/baselines/reference/asiPreventsParsingAsInterface01.js index 43692b6e19..024ad54371 100644 --- a/tests/baselines/reference/asiPreventsParsingAsInterface01.js +++ b/tests/baselines/reference/asiPreventsParsingAsInterface01.js @@ -8,3 +8,6 @@ I // This should be the identifier 'I' //// [asiPreventsParsingAsInterface01.js] var interface, I; +interface; // This should be the identifier 'interface' +I; // This should be the identifier 'I' +{ } // This should be a block body diff --git a/tests/baselines/reference/asiPreventsParsingAsInterface01.symbols b/tests/baselines/reference/asiPreventsParsingAsInterface01.symbols index 5973e99f67..d92c13e8ce 100644 --- a/tests/baselines/reference/asiPreventsParsingAsInterface01.symbols +++ b/tests/baselines/reference/asiPreventsParsingAsInterface01.symbols @@ -2,10 +2,12 @@ var interface: number, I: string; >interface : Symbol(interface, Decl(asiPreventsParsingAsInterface01.ts, 1, 3)) ->I : Symbol(I, Decl(asiPreventsParsingAsInterface01.ts, 1, 22), Decl(asiPreventsParsingAsInterface01.ts, 1, 33)) +>I : Symbol(I, Decl(asiPreventsParsingAsInterface01.ts, 1, 22)) interface // This should be the identifier 'interface' +>interface : Symbol(interface, Decl(asiPreventsParsingAsInterface01.ts, 1, 3)) + I // This should be the identifier 'I' ->I : Symbol(I, Decl(asiPreventsParsingAsInterface01.ts, 1, 22), Decl(asiPreventsParsingAsInterface01.ts, 1, 33)) +>I : Symbol(I, Decl(asiPreventsParsingAsInterface01.ts, 1, 22)) {} // This should be a block body diff --git a/tests/baselines/reference/asiPreventsParsingAsInterface01.types b/tests/baselines/reference/asiPreventsParsingAsInterface01.types index d6f0e4bff8..03c1b9fc41 100644 --- a/tests/baselines/reference/asiPreventsParsingAsInterface01.types +++ b/tests/baselines/reference/asiPreventsParsingAsInterface01.types @@ -5,7 +5,9 @@ var interface: number, I: string; >I : string interface // This should be the identifier 'interface' +>interface : number + I // This should be the identifier 'I' ->I : I +>I : string {} // This should be a block body diff --git a/tests/baselines/reference/asiPreventsParsingAsInterface02.js b/tests/baselines/reference/asiPreventsParsingAsInterface02.js index f562126926..0ea0421550 100644 --- a/tests/baselines/reference/asiPreventsParsingAsInterface02.js +++ b/tests/baselines/reference/asiPreventsParsingAsInterface02.js @@ -8,4 +8,7 @@ function f(interface: number, I: string) { //// [asiPreventsParsingAsInterface02.js] function f(interface, I) { + interface; // This should be the identifier 'interface' + I; // This should be the identifier 'I' + { } // This should be a block body } diff --git a/tests/baselines/reference/asiPreventsParsingAsInterface02.symbols b/tests/baselines/reference/asiPreventsParsingAsInterface02.symbols index 9f152e1bd0..e1e4febe38 100644 --- a/tests/baselines/reference/asiPreventsParsingAsInterface02.symbols +++ b/tests/baselines/reference/asiPreventsParsingAsInterface02.symbols @@ -3,11 +3,13 @@ function f(interface: number, I: string) { >f : Symbol(f, Decl(asiPreventsParsingAsInterface02.ts, 0, 0)) >interface : Symbol(interface, Decl(asiPreventsParsingAsInterface02.ts, 1, 11)) ->I : Symbol(I, Decl(asiPreventsParsingAsInterface02.ts, 1, 29), Decl(asiPreventsParsingAsInterface02.ts, 1, 42)) +>I : Symbol(I, Decl(asiPreventsParsingAsInterface02.ts, 1, 29)) interface // This should be the identifier 'interface' +>interface : Symbol(interface, Decl(asiPreventsParsingAsInterface02.ts, 1, 11)) + I // This should be the identifier 'I' ->I : Symbol(I, Decl(asiPreventsParsingAsInterface02.ts, 1, 29), Decl(asiPreventsParsingAsInterface02.ts, 1, 42)) +>I : Symbol(I, Decl(asiPreventsParsingAsInterface02.ts, 1, 29)) {} // This should be a block body } diff --git a/tests/baselines/reference/asiPreventsParsingAsInterface02.types b/tests/baselines/reference/asiPreventsParsingAsInterface02.types index ceb7c87ae2..7989cc810a 100644 --- a/tests/baselines/reference/asiPreventsParsingAsInterface02.types +++ b/tests/baselines/reference/asiPreventsParsingAsInterface02.types @@ -6,8 +6,10 @@ function f(interface: number, I: string) { >I : string interface // This should be the identifier 'interface' +>interface : number + I // This should be the identifier 'I' ->I : I +>I : string {} // This should be a block body } diff --git a/tests/baselines/reference/asiPreventsParsingAsInterface03.js b/tests/baselines/reference/asiPreventsParsingAsInterface03.js index 99dee27537..3b3c836f7f 100644 --- a/tests/baselines/reference/asiPreventsParsingAsInterface03.js +++ b/tests/baselines/reference/asiPreventsParsingAsInterface03.js @@ -10,3 +10,9 @@ namespace n { //// [asiPreventsParsingAsInterface03.js] var interface, I; +var n; +(function (n) { + interface; // This should be the identifier 'interface' + I; // This should be the identifier 'I' + { } // This should be a block body +})(n || (n = {})); diff --git a/tests/baselines/reference/asiPreventsParsingAsInterface03.symbols b/tests/baselines/reference/asiPreventsParsingAsInterface03.symbols index f628543c00..e8c95cf124 100644 --- a/tests/baselines/reference/asiPreventsParsingAsInterface03.symbols +++ b/tests/baselines/reference/asiPreventsParsingAsInterface03.symbols @@ -8,8 +8,10 @@ namespace n { >n : Symbol(n, Decl(asiPreventsParsingAsInterface03.ts, 1, 33)) interface // This should be the identifier 'interface' +>interface : Symbol(interface, Decl(asiPreventsParsingAsInterface03.ts, 1, 3)) + I // This should be the identifier 'I' ->I : Symbol(I, Decl(asiPreventsParsingAsInterface03.ts, 3, 13)) +>I : Symbol(I, Decl(asiPreventsParsingAsInterface03.ts, 1, 22)) {} // This should be a block body } diff --git a/tests/baselines/reference/asiPreventsParsingAsInterface03.types b/tests/baselines/reference/asiPreventsParsingAsInterface03.types index 9087d816fa..a58d502fc2 100644 --- a/tests/baselines/reference/asiPreventsParsingAsInterface03.types +++ b/tests/baselines/reference/asiPreventsParsingAsInterface03.types @@ -5,11 +5,13 @@ var interface: number, I: string; >I : string namespace n { ->n : any +>n : typeof n interface // This should be the identifier 'interface' +>interface : number + I // This should be the identifier 'I' ->I : I +>I : string {} // This should be a block body } diff --git a/tests/baselines/reference/asiPreventsParsingAsInterface04.js b/tests/baselines/reference/asiPreventsParsingAsInterface04.js index 5aced8231f..1700636e52 100644 --- a/tests/baselines/reference/asiPreventsParsingAsInterface04.js +++ b/tests/baselines/reference/asiPreventsParsingAsInterface04.js @@ -10,3 +10,6 @@ I // This should be the identifier 'I' //// [asiPreventsParsingAsInterface04.js] var declare, interface, I; declare; // This should be the identifier 'declare' +interface; // This should be the identifier 'interface' +I; // This should be the identifier 'I' +{ } // This should be a block body diff --git a/tests/baselines/reference/asiPreventsParsingAsInterface04.symbols b/tests/baselines/reference/asiPreventsParsingAsInterface04.symbols index c60a680abe..094411ebed 100644 --- a/tests/baselines/reference/asiPreventsParsingAsInterface04.symbols +++ b/tests/baselines/reference/asiPreventsParsingAsInterface04.symbols @@ -3,13 +3,15 @@ var declare: boolean, interface: number, I: string; >declare : Symbol(declare, Decl(asiPreventsParsingAsInterface04.ts, 1, 3)) >interface : Symbol(interface, Decl(asiPreventsParsingAsInterface04.ts, 1, 21)) ->I : Symbol(I, Decl(asiPreventsParsingAsInterface04.ts, 1, 40), Decl(asiPreventsParsingAsInterface04.ts, 3, 7)) +>I : Symbol(I, Decl(asiPreventsParsingAsInterface04.ts, 1, 40)) declare // This should be the identifier 'declare' >declare : Symbol(declare, Decl(asiPreventsParsingAsInterface04.ts, 1, 3)) interface // This should be the identifier 'interface' +>interface : Symbol(interface, Decl(asiPreventsParsingAsInterface04.ts, 1, 21)) + I // This should be the identifier 'I' ->I : Symbol(I, Decl(asiPreventsParsingAsInterface04.ts, 1, 40), Decl(asiPreventsParsingAsInterface04.ts, 3, 7)) +>I : Symbol(I, Decl(asiPreventsParsingAsInterface04.ts, 1, 40)) {} // This should be a block body diff --git a/tests/baselines/reference/asiPreventsParsingAsInterface04.types b/tests/baselines/reference/asiPreventsParsingAsInterface04.types index 342ff15558..f6d29749ae 100644 --- a/tests/baselines/reference/asiPreventsParsingAsInterface04.types +++ b/tests/baselines/reference/asiPreventsParsingAsInterface04.types @@ -9,7 +9,9 @@ declare // This should be the identifier 'declare' >declare : boolean interface // This should be the identifier 'interface' +>interface : number + I // This should be the identifier 'I' ->I : I +>I : string {} // This should be a block body diff --git a/tests/baselines/reference/asiPreventsParsingAsInterface05.errors.txt b/tests/baselines/reference/asiPreventsParsingAsInterface05.errors.txt index 717ea86a0c..e070305fdf 100644 --- a/tests/baselines/reference/asiPreventsParsingAsInterface05.errors.txt +++ b/tests/baselines/reference/asiPreventsParsingAsInterface05.errors.txt @@ -1,7 +1,9 @@ tests/cases/conformance/interfaces/interfaceDeclarations/asiPreventsParsingAsInterface05.ts(3,5): error TS1212: Identifier expected. 'interface' is a reserved word in strict mode +tests/cases/conformance/interfaces/interfaceDeclarations/asiPreventsParsingAsInterface05.ts(10,1): error TS1212: Identifier expected. 'interface' is a reserved word in strict mode +tests/cases/conformance/interfaces/interfaceDeclarations/asiPreventsParsingAsInterface05.ts(11,1): error TS2304: Cannot find name 'I'. -==== tests/cases/conformance/interfaces/interfaceDeclarations/asiPreventsParsingAsInterface05.ts (1 errors) ==== +==== tests/cases/conformance/interfaces/interfaceDeclarations/asiPreventsParsingAsInterface05.ts (3 errors) ==== "use strict" var interface: number; @@ -14,5 +16,9 @@ tests/cases/conformance/interfaces/interfaceDeclarations/asiPreventsParsingAsInt // declarations such that their identifier must follow 'interface' on the same line. interface // This should be the identifier 'interface' + ~~~~~~~~~ +!!! error TS1212: Identifier expected. 'interface' is a reserved word in strict mode I // This should be the identifier 'I' + ~ +!!! error TS2304: Cannot find name 'I'. { } // This should be a block body \ No newline at end of file diff --git a/tests/baselines/reference/asiPreventsParsingAsInterface05.js b/tests/baselines/reference/asiPreventsParsingAsInterface05.js index 1e67795f1a..85c19be447 100644 --- a/tests/baselines/reference/asiPreventsParsingAsInterface05.js +++ b/tests/baselines/reference/asiPreventsParsingAsInterface05.js @@ -15,3 +15,10 @@ I // This should be the identifier 'I' //// [asiPreventsParsingAsInterface05.js] "use strict"; var interface; +// 'interface' is a strict mode reserved word, and so it would be permissible +// to allow 'interface' and the name of the interface to be on separate lines; +// however, this complicates things, and so it is preferable to restrict interface +// declarations such that their identifier must follow 'interface' on the same line. +interface; // This should be the identifier 'interface' +I; // This should be the identifier 'I' +{ } // This should be a block body diff --git a/tests/baselines/reference/interfacesWithPredefinedTypesAsNames.errors.txt b/tests/baselines/reference/interfacesWithPredefinedTypesAsNames.errors.txt index 91cd267b59..902e4b448b 100644 --- a/tests/baselines/reference/interfacesWithPredefinedTypesAsNames.errors.txt +++ b/tests/baselines/reference/interfacesWithPredefinedTypesAsNames.errors.txt @@ -2,10 +2,11 @@ tests/cases/conformance/interfaces/interfaceDeclarations/interfacesWithPredefine tests/cases/conformance/interfaces/interfaceDeclarations/interfacesWithPredefinedTypesAsNames.ts(2,11): error TS2427: Interface name cannot be 'number' tests/cases/conformance/interfaces/interfaceDeclarations/interfacesWithPredefinedTypesAsNames.ts(3,11): error TS2427: Interface name cannot be 'string' tests/cases/conformance/interfaces/interfaceDeclarations/interfacesWithPredefinedTypesAsNames.ts(4,11): error TS2427: Interface name cannot be 'boolean' -tests/cases/conformance/interfaces/interfaceDeclarations/interfacesWithPredefinedTypesAsNames.ts(5,11): error TS1003: Identifier expected. +tests/cases/conformance/interfaces/interfaceDeclarations/interfacesWithPredefinedTypesAsNames.ts(5,1): error TS2304: Cannot find name 'interface'. +tests/cases/conformance/interfaces/interfaceDeclarations/interfacesWithPredefinedTypesAsNames.ts(5,11): error TS1005: ';' expected. -==== tests/cases/conformance/interfaces/interfaceDeclarations/interfacesWithPredefinedTypesAsNames.ts (5 errors) ==== +==== tests/cases/conformance/interfaces/interfaceDeclarations/interfacesWithPredefinedTypesAsNames.ts (6 errors) ==== interface any { } ~~~ !!! error TS2427: Interface name cannot be 'any' @@ -19,5 +20,7 @@ tests/cases/conformance/interfaces/interfaceDeclarations/interfacesWithPredefine ~~~~~~~ !!! error TS2427: Interface name cannot be 'boolean' interface void {} + ~~~~~~~~~ +!!! error TS2304: Cannot find name 'interface'. ~~~~ -!!! error TS1003: Identifier expected. \ No newline at end of file +!!! error TS1005: ';' expected. \ No newline at end of file diff --git a/tests/baselines/reference/interfacesWithPredefinedTypesAsNames.js b/tests/baselines/reference/interfacesWithPredefinedTypesAsNames.js index b79dfc12a0..ca186b1cef 100644 --- a/tests/baselines/reference/interfacesWithPredefinedTypesAsNames.js +++ b/tests/baselines/reference/interfacesWithPredefinedTypesAsNames.js @@ -6,4 +6,5 @@ interface boolean { } interface void {} //// [interfacesWithPredefinedTypesAsNames.js] +interface; void {};