Merge branch 'grammarChecks' of https://github.com/Microsoft/TypeScript into grammarChecks

This commit is contained in:
Vladimir Matveev
2014-11-19 14:20:17 -08:00
19 changed files with 231 additions and 362 deletions

View File

@@ -1,10 +1,10 @@
tests/cases/compiler/accessorsInAmbientContext.ts(4,13): error TS1086: An accessor cannot be declared in an ambient context.
tests/cases/compiler/accessorsInAmbientContext.ts(4,19): error TS1036: Statements are not allowed in ambient contexts.
tests/cases/compiler/accessorsInAmbientContext.ts(5,13): error TS1086: An accessor cannot be declared in an ambient context.
tests/cases/compiler/accessorsInAmbientContext.ts(7,20): error TS1086: An accessor cannot be declared in an ambient context.
tests/cases/compiler/accessorsInAmbientContext.ts(7,26): error TS1036: Statements are not allowed in ambient contexts.
tests/cases/compiler/accessorsInAmbientContext.ts(8,20): error TS1086: An accessor cannot be declared in an ambient context.
tests/cases/compiler/accessorsInAmbientContext.ts(13,9): error TS1086: An accessor cannot be declared in an ambient context.
tests/cases/compiler/accessorsInAmbientContext.ts(13,15): error TS1036: Statements are not allowed in ambient contexts.
tests/cases/compiler/accessorsInAmbientContext.ts(14,9): error TS1086: An accessor cannot be declared in an ambient context.
tests/cases/compiler/accessorsInAmbientContext.ts(16,16): error TS1086: An accessor cannot be declared in an ambient context.
tests/cases/compiler/accessorsInAmbientContext.ts(16,22): error TS1036: Statements are not allowed in ambient contexts.
tests/cases/compiler/accessorsInAmbientContext.ts(17,16): error TS1086: An accessor cannot be declared in an ambient context.
@@ -13,15 +13,15 @@ tests/cases/compiler/accessorsInAmbientContext.ts(17,16): error TS1086: An acces
declare module M {
class C {
get X() { return 1; }
~
!!! error TS1086: An accessor cannot be declared in an ambient context.
~~~~~~
!!! error TS1036: Statements are not allowed in ambient contexts.
set X(v) { }
~
!!! error TS1086: An accessor cannot be declared in an ambient context.
static get Y() { return 1; }
~
!!! error TS1086: An accessor cannot be declared in an ambient context.
~~~~~~
!!! error TS1036: Statements are not allowed in ambient contexts.
static set Y(v) { }
~
!!! error TS1086: An accessor cannot be declared in an ambient context.
@@ -30,15 +30,15 @@ tests/cases/compiler/accessorsInAmbientContext.ts(17,16): error TS1086: An acces
declare class C {
get X() { return 1; }
~
!!! error TS1086: An accessor cannot be declared in an ambient context.
~~~~~~
!!! error TS1036: Statements are not allowed in ambient contexts.
set X(v) { }
~
!!! error TS1086: An accessor cannot be declared in an ambient context.
static get Y() { return 1; }
~
!!! error TS1086: An accessor cannot be declared in an ambient context.
~~~~~~
!!! error TS1036: Statements are not allowed in ambient contexts.
static set Y(v) { }
~
!!! error TS1086: An accessor cannot be declared in an ambient context.

View File

@@ -1,10 +1,5 @@
tests/cases/conformance/ambient/ambientErrors.ts(20,24): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/conformance/ambient/ambientErrors.ts(35,19): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/conformance/ambient/ambientErrors.ts(37,18): error TS1039: Initializers are not allowed in ambient contexts.
tests/cases/conformance/ambient/ambientErrors.ts(38,11): error TS1039: Initializers are not allowed in ambient contexts.
tests/cases/conformance/ambient/ambientErrors.ts(39,23): error TS1111: A constructor implementation cannot be declared in an ambient context.
tests/cases/conformance/ambient/ambientErrors.ts(40,14): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/conformance/ambient/ambientErrors.ts(41,22): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/conformance/ambient/ambientErrors.ts(6,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
tests/cases/conformance/ambient/ambientErrors.ts(17,22): error TS2371: A parameter initializer is only allowed in a function or constructor implementation.
tests/cases/conformance/ambient/ambientErrors.ts(47,20): error TS2435: Ambient external modules cannot be nested in other modules.
@@ -12,7 +7,7 @@ tests/cases/conformance/ambient/ambientErrors.ts(51,16): error TS2436: Ambient e
tests/cases/conformance/ambient/ambientErrors.ts(57,5): error TS2309: An export assignment cannot be used in a module with other exported elements.
==== tests/cases/conformance/ambient/ambientErrors.ts (12 errors) ====
==== tests/cases/conformance/ambient/ambientErrors.ts (7 errors) ====
// Ambient variable with an initializer
declare var x = 4;
@@ -37,8 +32,6 @@ tests/cases/conformance/ambient/ambientErrors.ts(57,5): error TS2309: An export
// Ambient function with function body
declare function fn4() { };
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
// Ambient enum with non - integer literal constant member
declare enum E1 {
@@ -54,8 +47,6 @@ tests/cases/conformance/ambient/ambientErrors.ts(57,5): error TS2309: An export
declare module M1 {
var x = 3;
function fn() { }
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
class C {
static x = 3;
~
@@ -64,14 +55,8 @@ tests/cases/conformance/ambient/ambientErrors.ts(57,5): error TS2309: An export
~
!!! error TS1039: Initializers are not allowed in ambient contexts.
constructor() { }
~
!!! error TS1111: A constructor implementation cannot be declared in an ambient context.
fn() { }
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
static sfn() { }
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
}
}

View File

@@ -1,5 +1,5 @@
tests/cases/compiler/ambientGetters.ts(3,9): error TS1086: An accessor cannot be declared in an ambient context.
tests/cases/compiler/ambientGetters.ts(7,9): error TS1086: An accessor cannot be declared in an ambient context.
tests/cases/compiler/ambientGetters.ts(7,20): error TS1036: Statements are not allowed in ambient contexts.
==== tests/cases/compiler/ambientGetters.ts (2 errors) ====
@@ -12,6 +12,6 @@ tests/cases/compiler/ambientGetters.ts(7,9): error TS1086: An accessor cannot be
declare class B {
get length() { return 0; }
~~~~~~
!!! error TS1086: An accessor cannot be declared in an ambient context.
~~~~~~
!!! error TS1036: Statements are not allowed in ambient contexts.
}

View File

@@ -0,0 +1,14 @@
tests/cases/compiler/ambientStatement1.ts(2,6): error TS1036: Statements are not allowed in ambient contexts.
tests/cases/compiler/ambientStatement1.ts(4,20): error TS1039: Initializers are not allowed in ambient contexts.
==== tests/cases/compiler/ambientStatement1.ts (2 errors) ====
declare module M1 {
while(true);
~~~~~
!!! error TS1036: Statements are not allowed in ambient contexts.
export var v1 = () => false;
~
!!! error TS1039: Initializers are not allowed in ambient contexts.
}

View File

@@ -1,19 +1,13 @@
tests/cases/compiler/exportDeclareClass1.ts(2,21): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/exportDeclareClass1.ts(2,24): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
tests/cases/compiler/exportDeclareClass1.ts(3,31): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/exportDeclareClass1.ts(3,34): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
==== tests/cases/compiler/exportDeclareClass1.ts (4 errors) ====
==== tests/cases/compiler/exportDeclareClass1.ts (2 errors) ====
export declare class eaC {
static tF() { };
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
~
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
static tsF(param:any) { };
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
~
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
};

View File

@@ -10,29 +10,12 @@ tests/cases/compiler/giant.ts(93,9): error TS1005: '{' expected.
tests/cases/compiler/giant.ts(95,9): error TS1005: '{' expected.
tests/cases/compiler/giant.ts(99,9): error TS1005: '{' expected.
tests/cases/compiler/giant.ts(101,5): error TS1005: '{' expected.
tests/cases/compiler/giant.ts(154,39): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(168,9): error TS1005: '{' expected.
tests/cases/compiler/giant.ts(170,9): error TS1005: '{' expected.
tests/cases/compiler/giant.ts(172,9): error TS1005: '{' expected.
tests/cases/compiler/giant.ts(174,9): error TS1005: '{' expected.
tests/cases/compiler/giant.ts(178,9): error TS1005: '{' expected.
tests/cases/compiler/giant.ts(180,5): error TS1005: '{' expected.
tests/cases/compiler/giant.ts(233,39): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(238,35): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(240,24): error TS1111: A constructor implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(243,21): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(244,22): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(245,22): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(247,31): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(249,23): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(251,32): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(254,21): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(255,31): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(257,22): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(262,22): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(262,25): error TS1036: Statements are not allowed in ambient contexts.
tests/cases/compiler/giant.ts(267,30): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(267,33): error TS1036: Statements are not allowed in ambient contexts.
tests/cases/compiler/giant.ts(283,5): error TS1005: '{' expected.
tests/cases/compiler/giant.ts(285,5): error TS1005: '{' expected.
tests/cases/compiler/giant.ts(287,5): error TS1005: '{' expected.
@@ -45,64 +28,16 @@ tests/cases/compiler/giant.ts(351,9): error TS1005: '{' expected.
tests/cases/compiler/giant.ts(353,9): error TS1005: '{' expected.
tests/cases/compiler/giant.ts(357,9): error TS1005: '{' expected.
tests/cases/compiler/giant.ts(359,5): error TS1005: '{' expected.
tests/cases/compiler/giant.ts(412,39): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(426,9): error TS1005: '{' expected.
tests/cases/compiler/giant.ts(428,9): error TS1005: '{' expected.
tests/cases/compiler/giant.ts(430,9): error TS1005: '{' expected.
tests/cases/compiler/giant.ts(432,9): error TS1005: '{' expected.
tests/cases/compiler/giant.ts(436,9): error TS1005: '{' expected.
tests/cases/compiler/giant.ts(438,5): error TS1005: '{' expected.
tests/cases/compiler/giant.ts(491,39): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(496,35): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(498,24): error TS1111: A constructor implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(501,21): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(502,22): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(503,22): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(505,31): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(507,23): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(509,32): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(512,21): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(513,31): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(515,22): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(520,22): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(520,25): error TS1036: Statements are not allowed in ambient contexts.
tests/cases/compiler/giant.ts(525,30): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(525,33): error TS1036: Statements are not allowed in ambient contexts.
tests/cases/compiler/giant.ts(532,31): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(534,20): error TS1111: A constructor implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(537,17): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(538,18): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(539,18): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(541,27): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(543,19): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(545,28): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(548,17): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(549,27): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(551,18): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(556,18): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(556,21): error TS1036: Statements are not allowed in ambient contexts.
tests/cases/compiler/giant.ts(558,24): error TS1111: A constructor implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(561,21): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(563,21): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(606,22): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(606,25): error TS1036: Statements are not allowed in ambient contexts.
tests/cases/compiler/giant.ts(611,30): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(611,33): error TS1036: Statements are not allowed in ambient contexts.
tests/cases/compiler/giant.ts(615,16): error TS1038: A 'declare' modifier cannot be used in an already ambient context.
tests/cases/compiler/giant.ts(616,16): error TS1038: A 'declare' modifier cannot be used in an already ambient context.
tests/cases/compiler/giant.ts(616,39): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(616,42): error TS1036: Statements are not allowed in ambient contexts.
tests/cases/compiler/giant.ts(617,16): error TS1038: A 'declare' modifier cannot be used in an already ambient context.
tests/cases/compiler/giant.ts(618,16): error TS1038: A 'declare' modifier cannot be used in an already ambient context.
tests/cases/compiler/giant.ts(621,26): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(621,29): error TS1036: Statements are not allowed in ambient contexts.
tests/cases/compiler/giant.ts(623,24): error TS1111: A constructor implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(626,21): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(628,21): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(672,22): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(672,25): error TS1036: Statements are not allowed in ambient contexts.
tests/cases/compiler/giant.ts(676,30): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(676,33): error TS1036: Statements are not allowed in ambient contexts.
tests/cases/compiler/giant.ts(23,12): error TS2300: Duplicate identifier 'pgF'.
tests/cases/compiler/giant.ts(24,16): error TS2300: Duplicate identifier 'pgF'.
tests/cases/compiler/giant.ts(24,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
@@ -239,7 +174,7 @@ tests/cases/compiler/giant.ts(602,9): error TS2386: Overload signatures must all
tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all be optional or required.
==== tests/cases/compiler/giant.ts (239 errors) ====
==== tests/cases/compiler/giant.ts (174 errors) ====
/*
Prefixes
@@ -482,8 +417,6 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
export module eM { };
export declare var eaV;
export declare function eaF() { };
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
export declare class eaC { };
export declare module eaM { };
}
@@ -607,54 +540,36 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
export module eM { };
export declare var eaV;
export declare function eaF() { };
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
export declare class eaC { };
export declare module eaM { };
}
export declare var eaV;
export declare function eaF() { };
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
export declare class eaC {
constructor () { }
~
!!! error TS1111: A constructor implementation cannot be declared in an ambient context.
public pV;
private rV;
public pF() { }
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
private rF() { }
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
public pgF() { }
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
~~~
!!! error TS2300: Duplicate identifier 'pgF'.
public get pgF()
~~~
!!! error TS2300: Duplicate identifier 'pgF'.
public psF(param:any) { }
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
~~~
!!! error TS2300: Duplicate identifier 'psF'.
public set psF(param:any)
~~~
!!! error TS2300: Duplicate identifier 'psF'.
private rgF() { }
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
~~~
!!! error TS2300: Duplicate identifier 'rgF'.
private get rgF()
~~~
!!! error TS2300: Duplicate identifier 'rgF'.
private rsF(param:any) { }
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
~~~
!!! error TS2300: Duplicate identifier 'rsF'.
private set rsF(param:any)
@@ -662,19 +577,13 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
!!! error TS2300: Duplicate identifier 'rsF'.
static tV;
static tF() { }
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
static tsF(param:any) { }
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
~~~
!!! error TS2300: Duplicate identifier 'tsF'.
static set tsF(param:any)
~~~
!!! error TS2300: Duplicate identifier 'tsF'.
static tgF() { }
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
~~~
!!! error TS2300: Duplicate identifier 'tgF'.
static get tgF()
@@ -684,19 +593,11 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
export declare module eaM {
var V;
function F() { };
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
~
!!! error TS1036: Statements are not allowed in ambient contexts.
class C { }
interface I { }
module M { }
export var eV;
export function eF() { };
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
~
!!! error TS1036: Statements are not allowed in ambient contexts.
export class eC { }
export interface eI { }
export module eM { }
@@ -930,8 +831,6 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
export module eM { };
export declare var eaV;
export declare function eaF() { };
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
export declare class eaC { };
export declare module eaM { };
}
@@ -1055,54 +954,36 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
export module eM { };
export declare var eaV;
export declare function eaF() { };
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
export declare class eaC { };
export declare module eaM { };
}
export declare var eaV;
export declare function eaF() { };
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
export declare class eaC {
constructor () { }
~
!!! error TS1111: A constructor implementation cannot be declared in an ambient context.
public pV;
private rV;
public pF() { }
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
private rF() { }
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
public pgF() { }
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
~~~
!!! error TS2300: Duplicate identifier 'pgF'.
public get pgF()
~~~
!!! error TS2300: Duplicate identifier 'pgF'.
public psF(param:any) { }
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
~~~
!!! error TS2300: Duplicate identifier 'psF'.
public set psF(param:any)
~~~
!!! error TS2300: Duplicate identifier 'psF'.
private rgF() { }
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
~~~
!!! error TS2300: Duplicate identifier 'rgF'.
private get rgF()
~~~
!!! error TS2300: Duplicate identifier 'rgF'.
private rsF(param:any) { }
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
~~~
!!! error TS2300: Duplicate identifier 'rsF'.
private set rsF(param:any)
@@ -1110,19 +991,13 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
!!! error TS2300: Duplicate identifier 'rsF'.
static tV;
static tF() { }
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
static tsF(param:any) { }
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
~~~
!!! error TS2300: Duplicate identifier 'tsF'.
static set tsF(param:any)
~~~
!!! error TS2300: Duplicate identifier 'tsF'.
static tgF() { }
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
~~~
!!! error TS2300: Duplicate identifier 'tgF'.
static get tgF()
@@ -1132,19 +1007,11 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
export declare module eaM {
var V;
function F() { };
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
~
!!! error TS1036: Statements are not allowed in ambient contexts.
class C { }
interface I { }
module M { }
export var eV;
export function eF() { };
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
~
!!! error TS1036: Statements are not allowed in ambient contexts.
export class eC { }
export interface eI { }
export module eM { }
@@ -1152,47 +1019,31 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
}
export declare var eaV;
export declare function eaF() { };
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
export declare class eaC {
constructor () { }
~
!!! error TS1111: A constructor implementation cannot be declared in an ambient context.
public pV;
private rV;
public pF() { }
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
private rF() { }
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
public pgF() { }
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
~~~
!!! error TS2300: Duplicate identifier 'pgF'.
public get pgF()
~~~
!!! error TS2300: Duplicate identifier 'pgF'.
public psF(param:any) { }
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
~~~
!!! error TS2300: Duplicate identifier 'psF'.
public set psF(param:any)
~~~
!!! error TS2300: Duplicate identifier 'psF'.
private rgF() { }
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
~~~
!!! error TS2300: Duplicate identifier 'rgF'.
private get rgF()
~~~
!!! error TS2300: Duplicate identifier 'rgF'.
private rsF(param:any) { }
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
~~~
!!! error TS2300: Duplicate identifier 'rsF'.
private set rsF(param:any)
@@ -1200,19 +1051,13 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
!!! error TS2300: Duplicate identifier 'rsF'.
static tV;
static tF() { }
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
static tsF(param:any) { }
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
~~~
!!! error TS2300: Duplicate identifier 'tsF'.
static set tsF(param:any)
~~~
!!! error TS2300: Duplicate identifier 'tsF'.
static tgF() { }
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
~~~
!!! error TS2300: Duplicate identifier 'tgF'.
static get tgF()
@@ -1222,23 +1067,13 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
export declare module eaM {
var V;
function F() { };
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
~
!!! error TS1036: Statements are not allowed in ambient contexts.
class C {
constructor () { }
~
!!! error TS1111: A constructor implementation cannot be declared in an ambient context.
public pV;
private rV;
public pF() { }
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
static tV;
static tF() { }
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
}
interface I {
//Call Signature
@@ -1284,19 +1119,11 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
module M {
var V;
function F() { };
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
~
!!! error TS1036: Statements are not allowed in ambient contexts.
class C { }
interface I { }
module M { }
export var eV;
export function eF() { };
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
~
!!! error TS1036: Statements are not allowed in ambient contexts.
export class eC { }
export interface eI { }
export module eM { }
@@ -1306,10 +1133,6 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
export declare function eaF() { };
~~~~~~~
!!! error TS1038: A 'declare' modifier cannot be used in an already ambient context.
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
~
!!! error TS1036: Statements are not allowed in ambient contexts.
export declare class eaC { }
~~~~~~~
!!! error TS1038: A 'declare' modifier cannot be used in an already ambient context.
@@ -1319,23 +1142,13 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
}
export var eV;
export function eF() { };
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
~
!!! error TS1036: Statements are not allowed in ambient contexts.
export class eC {
constructor () { }
~
!!! error TS1111: A constructor implementation cannot be declared in an ambient context.
public pV;
private rV;
public pF() { }
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
static tV
static tF() { }
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
}
export interface eI {
//Call Signature
@@ -1382,18 +1195,10 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
export module eM {
var V;
function F() { };
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
~
!!! error TS1036: Statements are not allowed in ambient contexts.
class C { }
module M { }
export var eV;
export function eF() { };
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
~
!!! error TS1036: Statements are not allowed in ambient contexts.
export class eC { }
export interface eI { }
export module eM { }

View File

@@ -1,10 +1,8 @@
tests/cases/conformance/externalModules/initializersInDeclarations.ts(5,7): error TS1039: Initializers are not allowed in ambient contexts.
tests/cases/conformance/externalModules/initializersInDeclarations.ts(6,14): error TS1039: Initializers are not allowed in ambient contexts.
tests/cases/conformance/externalModules/initializersInDeclarations.ts(7,16): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/conformance/externalModules/initializersInDeclarations.ts(16,2): error TS1036: Statements are not allowed in ambient contexts.
==== tests/cases/conformance/externalModules/initializersInDeclarations.ts (4 errors) ====
==== tests/cases/conformance/externalModules/initializersInDeclarations.ts (2 errors) ====
// Errors: Initializers & statements in declaration file
@@ -16,8 +14,6 @@ tests/cases/conformance/externalModules/initializersInDeclarations.ts(16,2): err
~
!!! error TS1039: Initializers are not allowed in ambient contexts.
fn(): boolean {
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
return false;
}
}
@@ -27,8 +23,6 @@ tests/cases/conformance/externalModules/initializersInDeclarations.ts(16,2): err
declare module M1 {
while(true);
~~~~~
!!! error TS1036: Statements are not allowed in ambient contexts.
export var v1 = () => false;
}

View File

@@ -0,0 +1,13 @@
tests/cases/compiler/methodInAmbientClass1.ts(2,20): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/methodInAmbientClass1.ts(2,12): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement.
==== tests/cases/compiler/methodInAmbientClass1.ts (2 errors) ====
declare class Foo {
fn(): boolean {
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
~~~~~~~
!!! error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement.
}
}

View File

@@ -1,9 +1,9 @@
tests/cases/conformance/parser/ecmascript5/Accessors/parserAccessors5.ts(2,7): error TS1086: An accessor cannot be declared in an ambient context.
tests/cases/conformance/parser/ecmascript5/Accessors/parserAccessors5.ts(2,15): error TS1036: Statements are not allowed in ambient contexts.
==== tests/cases/conformance/parser/ecmascript5/Accessors/parserAccessors5.ts (1 errors) ====
declare class C {
get foo() { return 0; }
~~~
!!! error TS1086: An accessor cannot be declared in an ambient context.
~~~~~~
!!! error TS1036: Statements are not allowed in ambient contexts.
}

View File

@@ -39,22 +39,22 @@ tests/cases/compiler/parserConstructorDeclaration12.ts(9,3): error TS2392: Multi
~~~~~~~~~~~~~~~~~~~~~
!!! error TS2392: Multiple constructor implementations are not allowed.
constructor< >() { }
~~
~~~
!!! error TS1098: Type parameter list cannot be empty.
~~~~~~~~~~~~~~~~~~~~
!!! error TS2392: Multiple constructor implementations are not allowed.
constructor< > () { }
~~
~~~
!!! error TS1098: Type parameter list cannot be empty.
~~~~~~~~~~~~~~~~~~~~~
!!! error TS2392: Multiple constructor implementations are not allowed.
constructor < >() { }
~~
~~~
!!! error TS1098: Type parameter list cannot be empty.
~~~~~~~~~~~~~~~~~~~~~
!!! error TS2392: Multiple constructor implementations are not allowed.
constructor < > () { }
~~
~~~
!!! error TS1098: Type parameter list cannot be empty.
~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2392: Multiple constructor implementations are not allowed.

View File

@@ -1,10 +1,10 @@
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ExtendsOrImplementsClauses/parserErrorRecovery_ExtendsOrImplementsClause4.ts(1,19): error TS1097: 'implements' list cannot be empty.
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ExtendsOrImplementsClauses/parserErrorRecovery_ExtendsOrImplementsClause4.ts(1,29): error TS1097: 'implements' list cannot be empty.
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ExtendsOrImplementsClauses/parserErrorRecovery_ExtendsOrImplementsClause4.ts(1,17): error TS2304: Cannot find name 'A'.
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ExtendsOrImplementsClauses/parserErrorRecovery_ExtendsOrImplementsClause4.ts (2 errors) ====
class C extends A implements {
~~~~~~~~~~
!!! error TS1097: 'implements' list cannot be empty.
~
!!! error TS2304: Cannot find name 'A'.

View File

@@ -1,7 +1,7 @@
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ExtendsOrImplementsClauses/parserErrorRecovery_ExtendsOrImplementsClause6.ts(1,13): error TS1097: 'extends' list cannot be empty.
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ExtendsOrImplementsClauses/parserErrorRecovery_ExtendsOrImplementsClause6.ts(1,20): error TS1097: 'extends' list cannot be empty.
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ExtendsOrImplementsClauses/parserErrorRecovery_ExtendsOrImplementsClause6.ts (1 errors) ====
interface I extends { }
~~~~~~~
!!! error TS1097: 'extends' list cannot be empty.

View File

@@ -1,11 +1,8 @@
tests/cases/conformance/parser/ecmascript5/FunctionDeclarations/parserFunctionDeclaration2.d.ts(1,1): error TS1046: A 'declare' modifier is required for a top level declaration in a .d.ts file.
tests/cases/conformance/parser/ecmascript5/FunctionDeclarations/parserFunctionDeclaration2.d.ts(1,14): error TS1037: A function implementation cannot be declared in an ambient context.
==== tests/cases/conformance/parser/ecmascript5/FunctionDeclarations/parserFunctionDeclaration2.d.ts (2 errors) ====
==== tests/cases/conformance/parser/ecmascript5/FunctionDeclarations/parserFunctionDeclaration2.d.ts (1 errors) ====
function F() {
~~~~~~~~
!!! error TS1046: A 'declare' modifier is required for a top level declaration in a .d.ts file.
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
}

View File

@@ -1,15 +1,7 @@
tests/cases/compiler/switchStatementsWithMultipleDefaults.ts(9,5): error TS1113: A 'default' clause cannot appear more than once in a 'switch' statement.
tests/cases/compiler/switchStatementsWithMultipleDefaults.ts(10,5): error TS1113: A 'default' clause cannot appear more than once in a 'switch' statement.
tests/cases/compiler/switchStatementsWithMultipleDefaults.ts(21,13): error TS1113: A 'default' clause cannot appear more than once in a 'switch' statement.
tests/cases/compiler/switchStatementsWithMultipleDefaults.ts(25,13): error TS1113: A 'default' clause cannot appear more than once in a 'switch' statement.
tests/cases/compiler/switchStatementsWithMultipleDefaults.ts(26,13): error TS1113: A 'default' clause cannot appear more than once in a 'switch' statement.
tests/cases/compiler/switchStatementsWithMultipleDefaults.ts(28,13): error TS1113: A 'default' clause cannot appear more than once in a 'switch' statement.
tests/cases/compiler/switchStatementsWithMultipleDefaults.ts(28,22): error TS1108: A 'return' statement can only be used within a function body.
tests/cases/compiler/switchStatementsWithMultipleDefaults.ts(29,13): error TS1113: A 'default' clause cannot appear more than once in a 'switch' statement.
tests/cases/compiler/switchStatementsWithMultipleDefaults.ts(29,22): error TS1113: A 'default' clause cannot appear more than once in a 'switch' statement.
==== tests/cases/compiler/switchStatementsWithMultipleDefaults.ts (9 errors) ====
==== tests/cases/compiler/switchStatementsWithMultipleDefaults.ts (1 errors) ====
var x = 10;
@@ -19,11 +11,7 @@ tests/cases/compiler/switchStatementsWithMultipleDefaults.ts(29,22): error TS111
default: // No issues.
break;
default: // Error; second 'default' clause.
~~~~~~~~
!!! error TS1113: A 'default' clause cannot appear more than once in a 'switch' statement.
default: // Error; third 'default' clause.
~~~~~~~~
!!! error TS1113: A 'default' clause cannot appear more than once in a 'switch' statement.
case 3:
x *= x;
}
@@ -35,27 +23,15 @@ tests/cases/compiler/switchStatementsWithMultipleDefaults.ts(29,22): error TS111
switch (x * x) {
default: // No issues.
default: // Error; second 'default' clause.
~~~~~~~~
!!! error TS1113: A 'default' clause cannot appear more than once in a 'switch' statement.
break;
case 10000:
x /= x;
default: // Error, third 'default' clause
~~~~~~~~
!!! error TS1113: A 'default' clause cannot appear more than once in a 'switch' statement.
def\u0061ult: // Error, fourth 'default' clause.
~~~~~~~~~~~~~
!!! error TS1113: A 'default' clause cannot appear more than once in a 'switch' statement.
// Errors on fifth-seventh
default: return;
~~~~~~~~
!!! error TS1113: A 'default' clause cannot appear more than once in a 'switch' statement.
~~~~~~
!!! error TS1108: A 'return' statement can only be used within a function body.
default: default:
~~~~~~~~
!!! error TS1113: A 'default' clause cannot appear more than once in a 'switch' statement.
~~~~~~~~
!!! error TS1113: A 'default' clause cannot appear more than once in a 'switch' statement.
}
}

View File

@@ -0,0 +1,21 @@
tests/cases/compiler/switchStatementsWithMultipleDefaults1.ts(8,9): error TS1113: A 'default' clause cannot appear more than once in a 'switch' statement.
tests/cases/compiler/switchStatementsWithMultipleDefaults1.ts(9,9): error TS1113: A 'default' clause cannot appear more than once in a 'switch' statement.
==== tests/cases/compiler/switchStatementsWithMultipleDefaults1.ts (2 errors) ====
var x = 10;
switch (x) {
case 1:
case 2:
default: // No issues.
break;
default: // Error; second 'default' clause.
~~~~~~~~
!!! error TS1113: A 'default' clause cannot appear more than once in a 'switch' statement.
default: // Error; third 'default' clause.
~~~~~~~~
!!! error TS1113: A 'default' clause cannot appear more than once in a 'switch' statement.
case 3:
x *= x;
}

View File

@@ -0,0 +1,5 @@
declare module M1 {
while(true);
export var v1 = () => false;
}

View File

@@ -0,0 +1,4 @@
declare class Foo {
fn(): boolean {
}
}

View File

@@ -0,0 +1,12 @@
var x = 10;
switch (x) {
case 1:
case 2:
default: // No issues.
break;
default: // Error; second 'default' clause.
default: // Error; third 'default' clause.
case 3:
x *= x;
}