Merge branch 'master' into getRenameInfo

Conflicts:
	src/services/services.ts
This commit is contained in:
Cyrus Najmabadi
2014-09-17 15:36:26 -07:00
2309 changed files with 34560 additions and 14620 deletions

View File

@@ -1,6 +1,9 @@
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction1.ts(1,13): error TS1110: Type expected.
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction1.ts (1 errors) ====
var v = (a: ) => {
~
!!! Type expected.
!!! error TS1110: Type expected.
};

View File

@@ -1,8 +1,12 @@
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction2.ts(1,14): error TS1009: Trailing comma not allowed.
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction2.ts(1,13): error TS2304: Cannot find name 'b'.
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction2.ts (2 errors) ====
var v = (a: b,) => {
~
!!! Trailing comma not allowed.
!!! error TS1009: Trailing comma not allowed.
~
!!! Cannot find name 'b'.
!!! error TS2304: Cannot find name 'b'.
};

View File

@@ -1,10 +1,15 @@
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction3.ts(1,12): error TS1005: ',' expected.
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction3.ts(1,14): error TS1005: ';' expected.
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction3.ts(1,10): error TS2304: Cannot find name 'a'.
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction3.ts (3 errors) ====
var v = (a): => {
~
!!! ',' expected.
!!! error TS1005: ',' expected.
~~
!!! ';' expected.
!!! error TS1005: ';' expected.
~
!!! Cannot find name 'a'.
!!! error TS2304: Cannot find name 'a'.
};

View File

@@ -1,4 +1,7 @@
tests/cases/compiler/ArrowFunctionExpression1.ts(1,10): error TS2369: A parameter property is only allowed in a constructor implementation.
==== tests/cases/compiler/ArrowFunctionExpression1.ts (1 errors) ====
var v = (public x: string) => { };
~~~~~~~~~~~~~~~~
!!! A parameter property is only allowed in a constructor implementation.
!!! error TS2369: A parameter property is only allowed in a constructor implementation.

View File

@@ -1,3 +1,10 @@
tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts(10,19): error TS2304: Cannot find name 'T'.
tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts(20,12): error TS2304: Cannot find name 'T'.
tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts(22,23): error TS2304: Cannot find name 'T'.
tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts(35,26): error TS2304: Cannot find name 'T'.
tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts(46,15): error TS2304: Cannot find name 'T'.
==== tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts (5 errors) ====
// all expected to be errors
@@ -10,7 +17,7 @@
module clodule1 {
function f(x: T) { }
~
!!! Cannot find name 'T'.
!!! error TS2304: Cannot find name 'T'.
}
class clodule2<T>{
@@ -22,11 +29,11 @@
module clodule2 {
var x: T;
~
!!! Cannot find name 'T'.
!!! error TS2304: Cannot find name 'T'.
class D<U extends T>{
~
!!! Cannot find name 'T'.
!!! error TS2304: Cannot find name 'T'.
id: string;
value: U;
}
@@ -41,7 +48,7 @@
module clodule3 {
export var y = { id: T };
~
!!! Cannot find name 'T'.
!!! error TS2304: Cannot find name 'T'.
}
class clodule4<T>{
@@ -54,7 +61,7 @@
class D {
name: T;
~
!!! Cannot find name 'T'.
!!! error TS2304: Cannot find name 'T'.
}
}

View File

@@ -1,3 +1,6 @@
tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.ts(10,21): error TS2300: Duplicate identifier 'fn'.
==== tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.ts (1 errors) ====
class clodule<T> {
id: string;
@@ -10,7 +13,7 @@
// error: duplicate identifier expected
export function fn<T>(x: T, y: T): T {
~~
!!! Duplicate identifier 'fn'.
!!! error TS2300: Duplicate identifier 'fn'.
return x;
}
}

View File

@@ -1,3 +1,6 @@
tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.ts(10,21): error TS2300: Duplicate identifier 'fn'.
==== tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.ts (1 errors) ====
class clodule<T> {
id: string;
@@ -10,7 +13,7 @@
// error: duplicate identifier expected
export function fn<T>(x: T, y: T): T {
~~
!!! Duplicate identifier 'fn'.
!!! error TS2300: Duplicate identifier 'fn'.
return x;
}
}

View File

@@ -1,3 +1,6 @@
tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.ts(11,16): error TS2341: Property 'clodule.sfn' is inaccessible.
==== tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.ts (1 errors) ====
class clodule<T> {
id: string;
@@ -11,7 +14,7 @@
export function fn<T>(x: T, y: T): number {
return clodule.sfn('a');
~~~~~~~~~~~
!!! Property 'clodule.sfn' is inaccessible.
!!! error TS2341: Property 'clodule.sfn' is inaccessible.
}
}

View File

@@ -1,3 +1,7 @@
tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.ts(8,21): error TS2300: Duplicate identifier 'Origin'.
tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.ts(20,25): error TS2300: Duplicate identifier 'Origin'.
==== tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.ts (2 errors) ====
class Point {
constructor(public x: number, public y: number) { }
@@ -8,7 +12,7 @@
module Point {
export function Origin() { return null; } //expected duplicate identifier error
~~~~~~
!!! Duplicate identifier 'Origin'.
!!! error TS2300: Duplicate identifier 'Origin'.
}
@@ -22,6 +26,6 @@
export module Point {
export function Origin() { return ""; }//expected duplicate identifier error
~~~~~~
!!! Duplicate identifier 'Origin'.
!!! error TS2300: Duplicate identifier 'Origin'.
}
}

View File

@@ -1,3 +1,7 @@
tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.ts(8,16): error TS2300: Duplicate identifier 'Origin'.
tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.ts(20,20): error TS2300: Duplicate identifier 'Origin'.
==== tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.ts (2 errors) ====
class Point {
constructor(public x: number, public y: number) { }
@@ -8,7 +12,7 @@
module Point {
export var Origin = ""; //expected duplicate identifier error
~~~~~~
!!! Duplicate identifier 'Origin'.
!!! error TS2300: Duplicate identifier 'Origin'.
}
@@ -22,6 +26,6 @@
export module Point {
export var Origin = ""; //expected duplicate identifier error
~~~~~~
!!! Duplicate identifier 'Origin'.
!!! error TS2300: Duplicate identifier 'Origin'.
}
}

View File

@@ -1,3 +1,6 @@
tests/cases/conformance/internalModules/DeclarationMerging/module.ts(2,19): error TS2433: A module declaration cannot be in a different file from a class or function with which it is merged
==== tests/cases/conformance/internalModules/DeclarationMerging/class.ts (0 errors) ====
module X.Y {
export class Point {
@@ -14,7 +17,7 @@
module X.Y {
export module Point {
~~~~~
!!! A module declaration cannot be in a different file from a class or function with which it is merged
!!! error TS2433: A module declaration cannot be in a different file from a class or function with which it is merged
export var Origin = new Point(0, 0);
}
}

View File

@@ -1,9 +1,13 @@
tests/cases/compiler/ClassDeclaration10.ts(2,4): error TS2390: Constructor implementation is missing.
tests/cases/compiler/ClassDeclaration10.ts(3,4): error TS2391: Function implementation is missing or not immediately following the declaration.
==== tests/cases/compiler/ClassDeclaration10.ts (2 errors) ====
class C {
constructor();
~~~~~~~~~~~~~~
!!! Constructor implementation is missing.
!!! error TS2390: Constructor implementation is missing.
foo();
~~~
!!! Function implementation is missing or not immediately following the declaration.
!!! error TS2391: Function implementation is missing or not immediately following the declaration.
}

View File

@@ -1,7 +1,10 @@
tests/cases/compiler/ClassDeclaration11.ts(2,4): error TS2390: Constructor implementation is missing.
==== tests/cases/compiler/ClassDeclaration11.ts (1 errors) ====
class C {
constructor();
~~~~~~~~~~~~~~
!!! Constructor implementation is missing.
!!! error TS2390: Constructor implementation is missing.
foo() { }
}

View File

@@ -1,7 +1,10 @@
tests/cases/compiler/ClassDeclaration13.ts(3,4): error TS2389: Function implementation name must be 'foo'.
==== tests/cases/compiler/ClassDeclaration13.ts (1 errors) ====
class C {
foo();
bar() { }
~~~
!!! Function implementation name must be 'foo'.
!!! error TS2389: Function implementation name must be 'foo'.
}

View File

@@ -1,9 +1,13 @@
tests/cases/compiler/ClassDeclaration14.ts(2,4): error TS2391: Function implementation is missing or not immediately following the declaration.
tests/cases/compiler/ClassDeclaration14.ts(3,4): error TS2390: Constructor implementation is missing.
==== tests/cases/compiler/ClassDeclaration14.ts (2 errors) ====
class C {
foo();
~~~
!!! Function implementation is missing or not immediately following the declaration.
!!! error TS2391: Function implementation is missing or not immediately following the declaration.
constructor();
~~~~~~~~~~~~~~
!!! Constructor implementation is missing.
!!! error TS2390: Constructor implementation is missing.
}

View File

@@ -1,7 +1,10 @@
tests/cases/compiler/ClassDeclaration15.ts(2,4): error TS2391: Function implementation is missing or not immediately following the declaration.
==== tests/cases/compiler/ClassDeclaration15.ts (1 errors) ====
class C {
foo();
~~~
!!! Function implementation is missing or not immediately following the declaration.
!!! error TS2391: Function implementation is missing or not immediately following the declaration.
constructor() { }
}

View File

@@ -1,7 +1,10 @@
tests/cases/compiler/ClassDeclaration21.ts(3,5): error TS2389: Function implementation name must be '0'.
==== tests/cases/compiler/ClassDeclaration21.ts (1 errors) ====
class C {
0();
1() { }
~
!!! Function implementation name must be '0'.
!!! error TS2389: Function implementation name must be '0'.
}

View File

@@ -1,7 +1,10 @@
tests/cases/compiler/ClassDeclaration22.ts(3,5): error TS2389: Function implementation name must be '"foo"'.
==== tests/cases/compiler/ClassDeclaration22.ts (1 errors) ====
class C {
"foo"();
"bar"() { }
~~~~~
!!! Function implementation name must be '"foo"'.
!!! error TS2389: Function implementation name must be '"foo"'.
}

View File

@@ -1,5 +1,8 @@
tests/cases/compiler/ClassDeclaration24.ts(1,7): error TS2414: Class name cannot be 'any'
==== tests/cases/compiler/ClassDeclaration24.ts (1 errors) ====
class any {
~~~
!!! Class name cannot be 'any'
!!! error TS2414: Class name cannot be 'any'
}

View File

@@ -1,3 +1,7 @@
tests/cases/compiler/ClassDeclaration25.ts(6,5): error TS2391: Function implementation is missing or not immediately following the declaration.
tests/cases/compiler/ClassDeclaration25.ts(7,5): error TS2391: Function implementation is missing or not immediately following the declaration.
==== tests/cases/compiler/ClassDeclaration25.ts (2 errors) ====
interface IList<T> {
data(): T;
@@ -6,9 +10,9 @@
class List<U> implements IList<U> {
data(): U;
~~~~
!!! Function implementation is missing or not immediately following the declaration.
!!! error TS2391: Function implementation is missing or not immediately following the declaration.
next(): string;
~~~~
!!! Function implementation is missing or not immediately following the declaration.
!!! error TS2391: Function implementation is missing or not immediately following the declaration.
}

View File

@@ -1,6 +1,9 @@
tests/cases/compiler/ClassDeclaration8.ts(2,3): error TS2390: Constructor implementation is missing.
==== tests/cases/compiler/ClassDeclaration8.ts (1 errors) ====
class C {
constructor();
~~~~~~~~~~~~~~
!!! Constructor implementation is missing.
!!! error TS2390: Constructor implementation is missing.
}

View File

@@ -1,6 +1,9 @@
tests/cases/compiler/ClassDeclaration9.ts(2,4): error TS2391: Function implementation is missing or not immediately following the declaration.
==== tests/cases/compiler/ClassDeclaration9.ts (1 errors) ====
class C {
foo();
~~~
!!! Function implementation is missing or not immediately following the declaration.
!!! error TS2391: Function implementation is missing or not immediately following the declaration.
}

View File

@@ -1,11 +1,16 @@
tests/cases/compiler/ExportAssignment7.ts(1,14): error TS1148: Cannot compile external modules unless the '--module' flag is provided.
tests/cases/compiler/ExportAssignment7.ts(4,1): error TS2304: Cannot find name 'B'.
tests/cases/compiler/ExportAssignment7.ts(4,1): error TS2309: An export assignment cannot be used in a module with other exported elements.
==== tests/cases/compiler/ExportAssignment7.ts (3 errors) ====
export class C {
~
!!! Cannot compile external modules unless the '--module' flag is provided.
!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided.
}
export = B;
~~~~~~~~~~~
!!! Cannot find name 'B'.
!!! error TS2304: Cannot find name 'B'.
~~~~~~~~~~~
!!! An export assignment cannot be used in a module with other exported elements.
!!! error TS2309: An export assignment cannot be used in a module with other exported elements.

View File

@@ -1,11 +1,16 @@
tests/cases/compiler/ExportAssignment8.ts(1,1): error TS1148: Cannot compile external modules unless the '--module' flag is provided.
tests/cases/compiler/ExportAssignment8.ts(1,1): error TS2304: Cannot find name 'B'.
tests/cases/compiler/ExportAssignment8.ts(1,1): error TS2309: An export assignment cannot be used in a module with other exported elements.
==== tests/cases/compiler/ExportAssignment8.ts (3 errors) ====
export = B;
~~~~~~~~~~~
!!! Cannot compile external modules unless the '--module' flag is provided.
!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided.
~~~~~~~~~~~
!!! Cannot find name 'B'.
!!! error TS2304: Cannot find name 'B'.
~~~~~~~~~~~
!!! An export assignment cannot be used in a module with other exported elements.
!!! error TS2309: An export assignment cannot be used in a module with other exported elements.
export class C {
}

View File

@@ -1,3 +1,8 @@
tests/cases/conformance/internalModules/exportDeclarations/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.ts(8,27): error TS1005: ';' expected.
tests/cases/conformance/internalModules/exportDeclarations/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.ts(8,43): error TS1005: ';' expected.
tests/cases/conformance/internalModules/exportDeclarations/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.ts(9,30): error TS1005: ';' expected.
==== tests/cases/conformance/internalModules/exportDeclarations/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.ts (3 errors) ====
module A {
@@ -8,11 +13,11 @@
export var UnitSquare : {
top: { left: Point, right: Point },
~
!!! ';' expected.
!!! error TS1005: ';' expected.
~
!!! ';' expected.
!!! error TS1005: ';' expected.
bottom: { left: Point, right: Point }
~
!!! ';' expected.
!!! error TS1005: ';' expected.
} = null;
}

View File

@@ -1,3 +1,8 @@
tests/cases/conformance/internalModules/DeclarationMerging/module.ts(2,19): error TS2433: A module declaration cannot be in a different file from a class or function with which it is merged
tests/cases/conformance/internalModules/DeclarationMerging/simple.ts(13,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'fn' must be of type '() => { x: number; y: number; }', but here has type 'typeof Point'.
tests/cases/conformance/internalModules/DeclarationMerging/test.ts(2,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'fn' must be of type '() => { x: number; y: number; }', but here has type 'typeof Point'.
==== tests/cases/conformance/internalModules/DeclarationMerging/function.ts (0 errors) ====
module A {
export function Point() {
@@ -9,7 +14,7 @@
module A {
export module Point {
~~~~~
!!! A module declaration cannot be in a different file from a class or function with which it is merged
!!! error TS2433: A module declaration cannot be in a different file from a class or function with which it is merged
export var Origin = { x: 0, y: 0 };
}
}
@@ -18,7 +23,7 @@
var fn: () => { x: number; y: number };
var fn = A.Point;
~~
!!! Subsequent variable declarations must have the same type. Variable 'fn' must be of type '() => { x: number; y: number; }', but here has type 'typeof Point'.
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'fn' must be of type '() => { x: number; y: number; }', but here has type 'typeof Point'.
var cl: { x: number; y: number; }
var cl = A.Point();
@@ -40,7 +45,7 @@
var fn: () => { x: number; y: number };
var fn = B.Point; // not expected to be an error. bug 840000: [corelang] Function of fundule not assignalbe as expected
~~
!!! Subsequent variable declarations must have the same type. Variable 'fn' must be of type '() => { x: number; y: number; }', but here has type 'typeof Point'.
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'fn' must be of type '() => { x: number; y: number; }', but here has type 'typeof Point'.
var cl: { x: number; y: number; }
var cl = B.Point();

View File

@@ -1,4 +1,7 @@
tests/cases/compiler/FunctionDeclaration3.ts(1,10): error TS2391: Function implementation is missing or not immediately following the declaration.
==== tests/cases/compiler/FunctionDeclaration3.ts (1 errors) ====
function foo();
~~~
!!! Function implementation is missing or not immediately following the declaration.
!!! error TS2391: Function implementation is missing or not immediately following the declaration.

View File

@@ -1,5 +1,8 @@
tests/cases/compiler/FunctionDeclaration4.ts(2,10): error TS2389: Function implementation name must be 'foo'.
==== tests/cases/compiler/FunctionDeclaration4.ts (1 errors) ====
function foo();
function bar() { }
~~~
!!! Function implementation name must be 'foo'.
!!! error TS2389: Function implementation name must be 'foo'.

View File

@@ -1,7 +1,10 @@
tests/cases/compiler/FunctionDeclaration6.ts(3,14): error TS2389: Function implementation name must be 'foo'.
==== tests/cases/compiler/FunctionDeclaration6.ts (1 errors) ====
{
function foo();
function bar() { }
~~~
!!! Function implementation name must be 'foo'.
!!! error TS2389: Function implementation name must be 'foo'.
}

View File

@@ -1,6 +1,9 @@
tests/cases/compiler/FunctionDeclaration7.ts(2,13): error TS2391: Function implementation is missing or not immediately following the declaration.
==== tests/cases/compiler/FunctionDeclaration7.ts (1 errors) ====
module M {
function foo();
~~~
!!! Function implementation is missing or not immediately following the declaration.
!!! error TS2391: Function implementation is missing or not immediately following the declaration.
}

View File

@@ -1,5 +1,8 @@
tests/cases/compiler/InterfaceDeclaration8.ts(1,11): error TS2427: Interface name cannot be 'string'
==== tests/cases/compiler/InterfaceDeclaration8.ts (1 errors) ====
interface string {
~~~~~~
!!! Interface name cannot be 'string'
!!! error TS2427: Interface name cannot be 'string'
}

View File

@@ -1,3 +1,7 @@
tests/cases/conformance/internalModules/moduleDeclarations/InvalidNonInstantiatedModule.ts(5,9): error TS2304: Cannot find name 'M'.
tests/cases/conformance/internalModules/moduleDeclarations/InvalidNonInstantiatedModule.ts(7,15): error TS2304: Cannot find name 'M'.
==== tests/cases/conformance/internalModules/moduleDeclarations/InvalidNonInstantiatedModule.ts (2 errors) ====
module M {
export interface Point { x: number; y: number }
@@ -5,9 +9,9 @@
var m = M; // Error, not instantiated can not be used as var
~
!!! Cannot find name 'M'.
!!! error TS2304: Cannot find name 'M'.
var x: typeof M; // Error only a namespace
~
!!! Cannot find name 'M'.
!!! error TS2304: Cannot find name 'M'.

View File

@@ -1,8 +1,12 @@
tests/cases/compiler/MemberAccessorDeclaration15.ts(2,8): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/MemberAccessorDeclaration15.ts(2,12): error TS2369: A parameter property is only allowed in a constructor implementation.
==== tests/cases/compiler/MemberAccessorDeclaration15.ts (2 errors) ====
class C {
set Foo(public a: number) { }
~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
~~~~~~~~~~~~~~~~
!!! A parameter property is only allowed in a constructor implementation.
!!! error TS2369: A parameter property is only allowed in a constructor implementation.
}

View File

@@ -1,8 +1,12 @@
tests/cases/conformance/internalModules/DeclarationMerging/module.ts(2,19): error TS2433: A module declaration cannot be in a different file from a class or function with which it is merged
tests/cases/conformance/internalModules/DeclarationMerging/simple.ts(1,8): error TS2434: A module declaration cannot be located prior to a class or function with which it is merged
==== tests/cases/conformance/internalModules/DeclarationMerging/module.ts (1 errors) ====
module X.Y {
export module Point {
~~~~~
!!! A module declaration cannot be in a different file from a class or function with which it is merged
!!! error TS2433: A module declaration cannot be in a different file from a class or function with which it is merged
export var Origin = new Point(0, 0);
}
}
@@ -23,7 +27,7 @@
==== tests/cases/conformance/internalModules/DeclarationMerging/simple.ts (1 errors) ====
module A {
~
!!! A module declaration cannot be located prior to a class or function with which it is merged
!!! error TS2434: A module declaration cannot be located prior to a class or function with which it is merged
export var Instance = new A();
}

View File

@@ -1,8 +1,12 @@
tests/cases/conformance/internalModules/DeclarationMerging/module.ts(2,19): error TS2433: A module declaration cannot be in a different file from a class or function with which it is merged
tests/cases/conformance/internalModules/DeclarationMerging/simple.ts(3,19): error TS2434: A module declaration cannot be located prior to a class or function with which it is merged
==== tests/cases/conformance/internalModules/DeclarationMerging/module.ts (1 errors) ====
module A {
export module Point {
~~~~~
!!! A module declaration cannot be in a different file from a class or function with which it is merged
!!! error TS2433: A module declaration cannot be in a different file from a class or function with which it is merged
export var Origin = { x: 0, y: 0 };
}
}
@@ -20,7 +24,7 @@
export module Point {
~~~~~
!!! A module declaration cannot be located prior to a class or function with which it is merged
!!! error TS2434: A module declaration cannot be located prior to a class or function with which it is merged
export var Origin = { x: 0, y: 0 };
}

View File

@@ -1,3 +1,7 @@
tests/cases/conformance/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedClasses.ts(30,16): error TS2339: Property 'A2' does not exist on type 'typeof A'.
tests/cases/conformance/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedClasses.ts(31,17): error TS2339: Property 'A2' does not exist on type 'typeof A'.
==== tests/cases/conformance/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedClasses.ts (2 errors) ====
module A {
export class A {
@@ -30,9 +34,9 @@
// errors expected, these are not exported
var a2 = new A.A2();
~~
!!! Property 'A2' does not exist on type 'typeof A'.
!!! error TS2339: Property 'A2' does not exist on type 'typeof A'.
var ag2 = new A.A2<string, number>();
~~
!!! Property 'A2' does not exist on type 'typeof A'.
!!! error TS2339: Property 'A2' does not exist on type 'typeof A'.

View File

@@ -1,3 +1,6 @@
tests/cases/conformance/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedEnums.ts(10,11): error TS2339: Property 'Day' does not exist on type 'typeof A'.
==== tests/cases/conformance/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedEnums.ts (1 errors) ====
module A {
export enum Color { Red, Blue }
@@ -10,5 +13,5 @@
// error not exported
var b = A.Day.Monday;
~~~
!!! Property 'Day' does not exist on type 'typeof A'.
!!! error TS2339: Property 'Day' does not exist on type 'typeof A'.

View File

@@ -1,3 +1,7 @@
tests/cases/conformance/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedFunctions.ts(28,13): error TS2339: Property 'fn2' does not exist on type 'typeof A'.
tests/cases/conformance/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedFunctions.ts(29,14): error TS2339: Property 'fng2' does not exist on type 'typeof A'.
==== tests/cases/conformance/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedFunctions.ts (2 errors) ====
module A {
@@ -28,7 +32,7 @@
// these should be errors since the functions are not exported
var fn2 = A.fn2;
~~~
!!! Property 'fn2' does not exist on type 'typeof A'.
!!! error TS2339: Property 'fn2' does not exist on type 'typeof A'.
var fng2 = A.fng2;
~~~~
!!! Property 'fng2' does not exist on type 'typeof A'.
!!! error TS2339: Property 'fng2' does not exist on type 'typeof A'.

View File

@@ -1,3 +1,6 @@
tests/cases/conformance/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedImportAlias.ts(37,21): error TS2339: Property 'Lines' does not exist on type 'typeof Geometry'.
==== tests/cases/conformance/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedImportAlias.ts (1 errors) ====
module A {
export interface Point {
@@ -37,6 +40,6 @@
// not expected to work since non are exported
var line = Geometry.Lines.Line;
~~~~~
!!! Property 'Lines' does not exist on type 'typeof Geometry'.
!!! error TS2339: Property 'Lines' does not exist on type 'typeof Geometry'.

View File

@@ -1,3 +1,6 @@
tests/cases/conformance/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedVariables.ts(11,11): error TS2339: Property 'y' does not exist on type 'typeof A'.
==== tests/cases/conformance/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedVariables.ts (1 errors) ====
module A {
export var x = 'hello world'
@@ -11,5 +14,5 @@
// Error, since y is not exported
var y = A.y;
~
!!! Property 'y' does not exist on type 'typeof A'.
!!! error TS2339: Property 'y' does not exist on type 'typeof A'.

View File

@@ -1,6 +1,9 @@
tests/cases/compiler/ParameterList13.ts(2,10): error TS2369: A parameter property is only allowed in a constructor implementation.
==== tests/cases/compiler/ParameterList13.ts (1 errors) ====
interface I {
new (public x);
~~~~~~~~
!!! A parameter property is only allowed in a constructor implementation.
!!! error TS2369: A parameter property is only allowed in a constructor implementation.
}

View File

@@ -1,5 +1,8 @@
tests/cases/compiler/ParameterList4.ts(1,12): error TS2369: A parameter property is only allowed in a constructor implementation.
==== tests/cases/compiler/ParameterList4.ts (1 errors) ====
function F(public A) {
~~~~~~~~
!!! A parameter property is only allowed in a constructor implementation.
!!! error TS2369: A parameter property is only allowed in a constructor implementation.
}

View File

@@ -1,9 +1,14 @@
tests/cases/compiler/ParameterList5.ts(1,15): 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/ParameterList5.ts(1,16): error TS2369: A parameter property is only allowed in a constructor implementation.
tests/cases/compiler/ParameterList5.ts(1,29): error TS2304: Cannot find name 'C'.
==== tests/cases/compiler/ParameterList5.ts (3 errors) ====
function A(): (public B) => C {
~~~~~~~~~~~~~~~
!!! A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement.
!!! error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement.
~~~~~~~~
!!! A parameter property is only allowed in a constructor implementation.
!!! error TS2369: A parameter property is only allowed in a constructor implementation.
~
!!! Cannot find name 'C'.
!!! error TS2304: Cannot find name 'C'.
}

View File

@@ -1,7 +1,10 @@
tests/cases/compiler/ParameterList6.ts(2,19): error TS2369: A parameter property is only allowed in a constructor implementation.
==== tests/cases/compiler/ParameterList6.ts (1 errors) ====
class C {
constructor(C: (public A) => any) {
~~~~~~~~
!!! A parameter property is only allowed in a constructor implementation.
!!! error TS2369: A parameter property is only allowed in a constructor implementation.
}
}

View File

@@ -1,10 +1,14 @@
tests/cases/compiler/ParameterList7.ts(2,14): error TS2369: A parameter property is only allowed in a constructor implementation.
tests/cases/compiler/ParameterList7.ts(3,14): error TS2369: A parameter property is only allowed in a constructor implementation.
==== tests/cases/compiler/ParameterList7.ts (2 errors) ====
class C1 {
constructor(public p1:string); // ERROR
~~~~~~~~~~~~~~~~
!!! A parameter property is only allowed in a constructor implementation.
!!! error TS2369: A parameter property is only allowed in a constructor implementation.
constructor(private p2:number); // ERROR
~~~~~~~~~~~~~~~~~
!!! A parameter property is only allowed in a constructor implementation.
!!! error TS2369: A parameter property is only allowed in a constructor implementation.
constructor(public p3:any) {} // OK
}

View File

@@ -1,12 +1,17 @@
tests/cases/compiler/ParameterList8.ts(2,14): error TS2369: A parameter property is only allowed in a constructor implementation.
tests/cases/compiler/ParameterList8.ts(3,14): error TS2369: A parameter property is only allowed in a constructor implementation.
tests/cases/compiler/ParameterList8.ts(4,14): error TS2369: A parameter property is only allowed in a constructor implementation.
==== tests/cases/compiler/ParameterList8.ts (3 errors) ====
declare class C2 {
constructor(public p1:string); // ERROR
~~~~~~~~~~~~~~~~
!!! A parameter property is only allowed in a constructor implementation.
!!! error TS2369: A parameter property is only allowed in a constructor implementation.
constructor(private p2:number); // ERROR
~~~~~~~~~~~~~~~~~
!!! A parameter property is only allowed in a constructor implementation.
!!! error TS2369: A parameter property is only allowed in a constructor implementation.
constructor(public p3:any); // ERROR
~~~~~~~~~~~~~
!!! A parameter property is only allowed in a constructor implementation.
!!! error TS2369: A parameter property is only allowed in a constructor implementation.
}

View File

@@ -1,3 +1,7 @@
tests/cases/conformance/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.ts(10,18): error TS2300: Duplicate identifier 'Point'.
tests/cases/conformance/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.ts(26,26): error TS2300: Duplicate identifier 'Line'.
==== tests/cases/conformance/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.ts (2 errors) ====
module A {
export class Point {
@@ -10,7 +14,7 @@
// expected error
export class Point {
~~~~~
!!! Duplicate identifier 'Point'.
!!! error TS2300: Duplicate identifier 'Point'.
origin: number;
angle: number;
}
@@ -28,7 +32,7 @@
// expected error
export class Line {
~~~~
!!! Duplicate identifier 'Line'.
!!! error TS2300: Duplicate identifier 'Line'.
name: string;
}
}

View File

@@ -1,7 +1,13 @@
tests/cases/conformance/internalModules/DeclarationMerging/part1.ts(1,15): error TS1148: Cannot compile external modules unless the '--module' flag is provided.
tests/cases/conformance/internalModules/DeclarationMerging/part2.ts(3,24): error TS2304: Cannot find name 'Point'.
tests/cases/conformance/internalModules/DeclarationMerging/part2.ts(7,36): error TS2304: Cannot find name 'Point'.
tests/cases/conformance/internalModules/DeclarationMerging/part2.ts(7,54): error TS2304: Cannot find name 'Point'.
==== tests/cases/conformance/internalModules/DeclarationMerging/part1.ts (1 errors) ====
export module A {
~
!!! Cannot compile external modules unless the '--module' flag is provided.
!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided.
export interface Point {
x: number;
y: number;
@@ -21,15 +27,15 @@
// collision with 'Origin' var in other part of merged module
export var Origin: Point = { x: 0, y: 0 };
~~~~~
!!! Cannot find name 'Point'.
!!! error TS2304: Cannot find name 'Point'.
export module Utils {
export class Plane {
constructor(public tl: Point, public br: Point) { }
~~~~~
!!! Cannot find name 'Point'.
!!! error TS2304: Cannot find name 'Point'.
~~~~~
!!! Cannot find name 'Point'.
!!! error TS2304: Cannot find name 'Point'.
}
}
}

View File

@@ -1,12 +1,19 @@
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/TypeArgumentLists/TypeArgumentList1.ts(1,9): error TS1127: Invalid character.
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/TypeArgumentLists/TypeArgumentList1.ts(1,1): error TS2304: Cannot find name 'Foo'.
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/TypeArgumentLists/TypeArgumentList1.ts(1,5): error TS2304: Cannot find name 'A'.
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/TypeArgumentLists/TypeArgumentList1.ts(1,7): error TS2304: Cannot find name 'B'.
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/TypeArgumentLists/TypeArgumentList1.ts(1,11): error TS2304: Cannot find name 'C'.
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/TypeArgumentLists/TypeArgumentList1.ts (5 errors) ====
Foo<A,B,\ C>(4, 5, 6);
!!! Invalid character.
!!! error TS1127: Invalid character.
~~~
!!! Cannot find name 'Foo'.
!!! error TS2304: Cannot find name 'Foo'.
~
!!! Cannot find name 'A'.
!!! error TS2304: Cannot find name 'A'.
~
!!! Cannot find name 'B'.
!!! error TS2304: Cannot find name 'B'.
~
!!! Cannot find name 'C'.
!!! error TS2304: Cannot find name 'C'.

View File

@@ -1,14 +1,20 @@
tests/cases/compiler/accessorParameterAccessibilityModifier.ts(3,9): error TS2369: A parameter property is only allowed in a constructor implementation.
tests/cases/compiler/accessorParameterAccessibilityModifier.ts(4,16): error TS2369: A parameter property is only allowed in a constructor implementation.
tests/cases/compiler/accessorParameterAccessibilityModifier.ts(3,11): error TS2369: A parameter property is only allowed in a constructor implementation.
tests/cases/compiler/accessorParameterAccessibilityModifier.ts(4,18): error TS2369: A parameter property is only allowed in a constructor implementation.
==== tests/cases/compiler/accessorParameterAccessibilityModifier.ts (4 errors) ====
class C {
set X(public v) { }
~
!!! A parameter property is only allowed in a constructor implementation.
!!! error TS2369: A parameter property is only allowed in a constructor implementation.
~~~~~~~~
!!! A parameter property is only allowed in a constructor implementation.
!!! error TS2369: A parameter property is only allowed in a constructor implementation.
static set X(public v2) { }
~
!!! A parameter property is only allowed in a constructor implementation.
!!! error TS2369: A parameter property is only allowed in a constructor implementation.
~~~~~~~~~
!!! A parameter property is only allowed in a constructor implementation.
!!! error TS2369: A parameter property is only allowed in a constructor implementation.
}

View File

@@ -1,3 +1,9 @@
tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorWithES3.ts(5,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorWithES3.ts(11,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorWithES3.ts(16,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorWithES3.ts(20,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
==== tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorWithES3.ts (4 errors) ====
// error to use accessors in ES3 mode
@@ -5,7 +11,7 @@
class C {
get x() {
~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
return 1;
}
}
@@ -13,18 +19,18 @@
class D {
set x(v) {
~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
}
}
var x = {
get a() { return 1 }
~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
}
var y = {
set b(v) { }
~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
}

View File

@@ -1,10 +1,14 @@
tests/cases/compiler/accessorWithInitializer.ts(3,9): error TS1052: A 'set' accessor parameter cannot have an initializer.
tests/cases/compiler/accessorWithInitializer.ts(4,16): error TS1052: A 'set' accessor parameter cannot have an initializer.
==== tests/cases/compiler/accessorWithInitializer.ts (2 errors) ====
class C {
set X(v = 0) { }
~
!!! A 'set' accessor parameter cannot have an initializer.
!!! error TS1052: A 'set' accessor parameter cannot have an initializer.
static set X(v2 = 0) { }
~
!!! A 'set' accessor parameter cannot have an initializer.
!!! error TS1052: A 'set' accessor parameter cannot have an initializer.
}

View File

@@ -1,10 +1,14 @@
tests/cases/compiler/accessorWithRestParam.ts(3,9): error TS1053: A 'set' accessor cannot have rest parameter.
tests/cases/compiler/accessorWithRestParam.ts(4,16): error TS1053: A 'set' accessor cannot have rest parameter.
==== tests/cases/compiler/accessorWithRestParam.ts (2 errors) ====
class C {
set X(...v) { }
~
!!! A 'set' accessor cannot have rest parameter.
!!! error TS1053: A 'set' accessor cannot have rest parameter.
static set X(...v2) { }
~
!!! A 'set' accessor cannot have rest parameter.
!!! error TS1053: A 'set' accessor cannot have rest parameter.
}

View File

@@ -1,15 +1,19 @@
tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorsAreNotContextuallyTyped.ts(4,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorsAreNotContextuallyTyped.ts(7,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
==== tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorsAreNotContextuallyTyped.ts (2 errors) ====
// accessors are not contextually typed
class C {
set x(v: (a: string) => string) {
~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
}
get x() {
~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
return (x: string) => "";
}
}

View File

@@ -1,10 +1,14 @@
tests/cases/compiler/accessorsEmit.ts(4,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/accessorsEmit.ts(11,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
==== tests/cases/compiler/accessorsEmit.ts (2 errors) ====
class Result { }
class Test {
get Property(): Result {
~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
var x = 1;
return null;
}
@@ -13,7 +17,7 @@
class Test2 {
get Property() {
~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
var x = 1;
return null;
}

View File

@@ -1,35 +1,45 @@
tests/cases/compiler/accessorsInAmbientContext.ts(4,13): error TS1086: An accessor cannot be declared in an ambient context.
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(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(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(17,16): error TS1086: An accessor cannot be declared in an ambient context.
==== tests/cases/compiler/accessorsInAmbientContext.ts (8 errors) ====
declare module M {
class C {
get X() { return 1; }
~
!!! An accessor cannot be declared in an ambient context.
!!! error TS1086: An accessor cannot be declared in an ambient context.
set X(v) { }
~
!!! An accessor cannot be declared in an ambient context.
!!! error TS1086: An accessor cannot be declared in an ambient context.
static get Y() { return 1; }
~
!!! An accessor cannot be declared in an ambient context.
!!! error TS1086: An accessor cannot be declared in an ambient context.
static set Y(v) { }
~
!!! An accessor cannot be declared in an ambient context.
!!! error TS1086: An accessor cannot be declared in an ambient context.
}
}
declare class C {
get X() { return 1; }
~
!!! An accessor cannot be declared in an ambient context.
!!! error TS1086: An accessor cannot be declared in an ambient context.
set X(v) { }
~
!!! An accessor cannot be declared in an ambient context.
!!! error TS1086: An accessor cannot be declared in an ambient context.
static get Y() { return 1; }
~
!!! An accessor cannot be declared in an ambient context.
!!! error TS1086: An accessor cannot be declared in an ambient context.
static set Y(v) { }
~
!!! An accessor cannot be declared in an ambient context.
!!! error TS1086: An accessor cannot be declared in an ambient context.
}

View File

@@ -1,11 +1,15 @@
tests/cases/compiler/accessorsNotAllowedInES3.ts(3,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/accessorsNotAllowedInES3.ts(5,15): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
==== tests/cases/compiler/accessorsNotAllowedInES3.ts (2 errors) ====
class C {
get x(): number { return 1; }
~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
}
var y = { get foo() { return 3; } };
~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.

View File

@@ -1,38 +1,52 @@
tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(2,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(3,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(5,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(6,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(8,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(9,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(11,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(12,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(3,55): error TS2323: Type 'string' is not assignable to type 'number'.
tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(5,54): error TS2323: Type 'string' is not assignable to type 'number'.
tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(9,52): error TS2323: Type 'number' is not assignable to type 'string'.
tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(11,51): error TS2323: Type 'number' is not assignable to type 'string'.
==== tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts (12 errors) ====
class LanguageSpec_section_4_5_error_cases {
public set AnnotatedSetter_SetterFirst(a: number) { }
~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
public get AnnotatedSetter_SetterFirst() { return ""; }
~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
~~
!!! Type 'string' is not assignable to type 'number'.
!!! error TS2323: Type 'string' is not assignable to type 'number'.
public get AnnotatedSetter_SetterLast() { return ""; }
~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
~~
!!! Type 'string' is not assignable to type 'number'.
!!! error TS2323: Type 'string' is not assignable to type 'number'.
public set AnnotatedSetter_SetterLast(a: number) { }
~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
public get AnnotatedGetter_GetterFirst(): string { return ""; }
~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
public set AnnotatedGetter_GetterFirst(aStr) { aStr = 0; }
~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
~~~~
!!! Type 'number' is not assignable to type 'string'.
!!! error TS2323: Type 'number' is not assignable to type 'string'.
public set AnnotatedGetter_GetterLast(aStr) { aStr = 0; }
~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
~~~~
!!! Type 'number' is not assignable to type 'string'.
!!! error TS2323: Type 'number' is not assignable to type 'string'.
public get AnnotatedGetter_GetterLast(): string { return ""; }
~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
}

View File

@@ -1,3 +1,17 @@
tests/cases/compiler/accessors_spec_section-4.5_inference.ts(6,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/accessors_spec_section-4.5_inference.ts(7,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/accessors_spec_section-4.5_inference.ts(9,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/accessors_spec_section-4.5_inference.ts(10,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/accessors_spec_section-4.5_inference.ts(13,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/accessors_spec_section-4.5_inference.ts(14,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/accessors_spec_section-4.5_inference.ts(16,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/accessors_spec_section-4.5_inference.ts(17,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/accessors_spec_section-4.5_inference.ts(19,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/accessors_spec_section-4.5_inference.ts(20,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/accessors_spec_section-4.5_inference.ts(22,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/accessors_spec_section-4.5_inference.ts(23,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
==== tests/cases/compiler/accessors_spec_section-4.5_inference.ts (12 errors) ====
class A { }
class B extends A { }
@@ -6,44 +20,44 @@
public set InferredGetterFromSetterAnnotation(a: A) { }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
public get InferredGetterFromSetterAnnotation() { return new B(); }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
public get InferredGetterFromSetterAnnotation_GetterFirst() { return new B(); }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
public set InferredGetterFromSetterAnnotation_GetterFirst(a: A) { }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
public get InferredFromGetter() { return new B(); }
~~~~~~~~~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
public set InferredFromGetter(a) { }
~~~~~~~~~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
public set InferredFromGetter_SetterFirst(a) { }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
public get InferredFromGetter_SetterFirst() { return new B(); }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
public set InferredSetterFromGetterAnnotation(a) { }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
public get InferredSetterFromGetterAnnotation() : A { return new B(); }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
public get InferredSetterFromGetterAnnotation_GetterFirst() : A { return new B(); }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
public set InferredSetterFromGetterAnnotation_GetterFirst(a) { }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
}

View File

@@ -1,3 +1,8 @@
tests/cases/compiler/addMoreOverloadsToBaseSignature.ts(5,11): error TS2429: Interface 'Bar' incorrectly extends interface 'Foo':
Types of property 'f' are incompatible:
Type '(key: string) => string' is not assignable to type '() => string'.
==== tests/cases/compiler/addMoreOverloadsToBaseSignature.ts (1 errors) ====
interface Foo {
f(): string;
@@ -5,9 +10,9 @@
interface Bar extends Foo {
~~~
!!! Interface 'Bar' incorrectly extends interface 'Foo':
!!! Types of property 'f' are incompatible:
!!! Type '(key: string) => string' is not assignable to type '() => string'.
!!! error TS2429: Interface 'Bar' incorrectly extends interface 'Foo':
!!! error TS2429: Types of property 'f' are incompatible:
!!! error TS2429: Type '(key: string) => string' is not assignable to type '() => string'.
f(key: string): string;
}

View File

@@ -1,3 +1,24 @@
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(15,10): error TS2365: Operator '+' cannot be applied to types 'boolean' and 'boolean'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(16,10): error TS2365: Operator '+' cannot be applied to types 'boolean' and 'number'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(17,10): error TS2365: Operator '+' cannot be applied to types 'boolean' and 'Object'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(20,10): error TS2365: Operator '+' cannot be applied to types 'number' and 'boolean'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(22,10): error TS2365: Operator '+' cannot be applied to types 'number' and 'Object'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(25,10): error TS2365: Operator '+' cannot be applied to types 'Object' and 'boolean'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(26,10): error TS2365: Operator '+' cannot be applied to types 'Object' and 'number'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(27,10): error TS2365: Operator '+' cannot be applied to types 'Object' and 'Object'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(30,11): error TS2365: Operator '+' cannot be applied to types 'boolean' and 'boolean'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(31,11): error TS2365: Operator '+' cannot be applied to types 'boolean' and 'boolean'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(32,11): error TS2365: Operator '+' cannot be applied to types 'boolean' and 'number'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(33,11): error TS2365: Operator '+' cannot be applied to types '{}' and '{}'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(34,11): error TS2365: Operator '+' cannot be applied to types 'number' and 'Number'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(35,11): error TS2365: Operator '+' cannot be applied to types 'number' and '() => void'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(36,11): error TS2365: Operator '+' cannot be applied to types 'number' and 'void'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(37,11): error TS2365: Operator '+' cannot be applied to types 'number' and 'typeof C'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(38,11): error TS2365: Operator '+' cannot be applied to types 'E' and 'C'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(39,11): error TS2365: Operator '+' cannot be applied to types 'E' and 'void'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(40,11): error TS2365: Operator '+' cannot be applied to types 'E' and 'typeof M'.
==== tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts (19 errors) ====
function foo() { }
class C {
@@ -15,65 +36,65 @@
// boolean + every type except any and string
var r1 = a + a;
~~~~~
!!! Operator '+' cannot be applied to types 'boolean' and 'boolean'.
!!! error TS2365: Operator '+' cannot be applied to types 'boolean' and 'boolean'.
var r2 = a + b;
~~~~~
!!! Operator '+' cannot be applied to types 'boolean' and 'number'.
!!! error TS2365: Operator '+' cannot be applied to types 'boolean' and 'number'.
var r3 = a + c;
~~~~~
!!! Operator '+' cannot be applied to types 'boolean' and 'Object'.
!!! error TS2365: Operator '+' cannot be applied to types 'boolean' and 'Object'.
// number + every type except any and string
var r4 = b + a;
~~~~~
!!! Operator '+' cannot be applied to types 'number' and 'boolean'.
!!! error TS2365: Operator '+' cannot be applied to types 'number' and 'boolean'.
var r5 = b + b; // number + number is valid
var r6 = b + c;
~~~~~
!!! Operator '+' cannot be applied to types 'number' and 'Object'.
!!! error TS2365: Operator '+' cannot be applied to types 'number' and 'Object'.
// object + every type except any and string
var r7 = c + a;
~~~~~
!!! Operator '+' cannot be applied to types 'Object' and 'boolean'.
!!! error TS2365: Operator '+' cannot be applied to types 'Object' and 'boolean'.
var r8 = c + b;
~~~~~
!!! Operator '+' cannot be applied to types 'Object' and 'number'.
!!! error TS2365: Operator '+' cannot be applied to types 'Object' and 'number'.
var r9 = c + c;
~~~~~
!!! Operator '+' cannot be applied to types 'Object' and 'Object'.
!!! error TS2365: Operator '+' cannot be applied to types 'Object' and 'Object'.
// other cases
var r10 = a + true;
~~~~~~~~
!!! Operator '+' cannot be applied to types 'boolean' and 'boolean'.
!!! error TS2365: Operator '+' cannot be applied to types 'boolean' and 'boolean'.
var r11 = true + false;
~~~~~~~~~~~~
!!! Operator '+' cannot be applied to types 'boolean' and 'boolean'.
!!! error TS2365: Operator '+' cannot be applied to types 'boolean' and 'boolean'.
var r12 = true + 123;
~~~~~~~~~~
!!! Operator '+' cannot be applied to types 'boolean' and 'number'.
!!! error TS2365: Operator '+' cannot be applied to types 'boolean' and 'number'.
var r13 = {} + {};
~~~~~~~
!!! Operator '+' cannot be applied to types '{}' and '{}'.
!!! error TS2365: Operator '+' cannot be applied to types '{}' and '{}'.
var r14 = b + d;
~~~~~
!!! Operator '+' cannot be applied to types 'number' and 'Number'.
!!! error TS2365: Operator '+' cannot be applied to types 'number' and 'Number'.
var r15 = b + foo;
~~~~~~~
!!! Operator '+' cannot be applied to types 'number' and '() => void'.
!!! error TS2365: Operator '+' cannot be applied to types 'number' and '() => void'.
var r16 = b + foo();
~~~~~~~~~
!!! Operator '+' cannot be applied to types 'number' and 'void'.
!!! error TS2365: Operator '+' cannot be applied to types 'number' and 'void'.
var r17 = b + C;
~~~~~
!!! Operator '+' cannot be applied to types 'number' and 'typeof C'.
!!! error TS2365: Operator '+' cannot be applied to types 'number' and 'typeof C'.
var r18 = E.a + new C();
~~~~~~~~~~~~~
!!! Operator '+' cannot be applied to types 'E' and 'C'.
!!! error TS2365: Operator '+' cannot be applied to types 'E' and 'C'.
var r19 = E.a + C.foo();
~~~~~~~~~~~~~
!!! Operator '+' cannot be applied to types 'E' and 'void'.
!!! error TS2365: Operator '+' cannot be applied to types 'E' and 'void'.
var r20 = E.a + M;
~~~~~~~
!!! Operator '+' cannot be applied to types 'E' and 'typeof M'.
!!! error TS2365: Operator '+' cannot be applied to types 'E' and 'typeof M'.

View File

@@ -1,3 +1,16 @@
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(11,10): error TS2365: Operator '+' cannot be applied to types 'boolean' and 'boolean'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(12,10): error TS2365: Operator '+' cannot be applied to types 'Object' and 'Object'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(13,10): error TS2365: Operator '+' cannot be applied to types 'void' and 'void'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(14,10): error TS2365: Operator '+' cannot be applied to types 'boolean' and 'boolean'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(15,10): error TS2365: Operator '+' cannot be applied to types 'Object' and 'Object'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(16,10): error TS2365: Operator '+' cannot be applied to types 'void' and 'void'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(19,10): error TS2365: Operator '+' cannot be applied to types 'Number' and 'Number'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(20,10): error TS2365: Operator '+' cannot be applied to types 'boolean' and 'boolean'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(21,10): error TS2365: Operator '+' cannot be applied to types '{ a: string; }' and '{ a: string; }'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(22,11): error TS2365: Operator '+' cannot be applied to types 'void' and 'void'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(23,11): error TS2365: Operator '+' cannot be applied to types '() => void' and '() => void'.
==== tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts (11 errors) ====
// If one operand is the null or undefined value, it is treated as having the type of the other operand.
@@ -11,36 +24,36 @@
// null + boolean/Object
var r1 = null + a;
~~~~~~~~
!!! Operator '+' cannot be applied to types 'boolean' and 'boolean'.
!!! error TS2365: Operator '+' cannot be applied to types 'boolean' and 'boolean'.
var r2 = null + b;
~~~~~~~~
!!! Operator '+' cannot be applied to types 'Object' and 'Object'.
!!! error TS2365: Operator '+' cannot be applied to types 'Object' and 'Object'.
var r3 = null + c;
~~~~~~~~
!!! Operator '+' cannot be applied to types 'void' and 'void'.
!!! error TS2365: Operator '+' cannot be applied to types 'void' and 'void'.
var r4 = a + null;
~~~~~~~~
!!! Operator '+' cannot be applied to types 'boolean' and 'boolean'.
!!! error TS2365: Operator '+' cannot be applied to types 'boolean' and 'boolean'.
var r5 = b + null;
~~~~~~~~
!!! Operator '+' cannot be applied to types 'Object' and 'Object'.
!!! error TS2365: Operator '+' cannot be applied to types 'Object' and 'Object'.
var r6 = null + c;
~~~~~~~~
!!! Operator '+' cannot be applied to types 'void' and 'void'.
!!! error TS2365: Operator '+' cannot be applied to types 'void' and 'void'.
// other cases
var r7 = null + d;
~~~~~~~~
!!! Operator '+' cannot be applied to types 'Number' and 'Number'.
!!! error TS2365: Operator '+' cannot be applied to types 'Number' and 'Number'.
var r8 = null + true;
~~~~~~~~~~~
!!! Operator '+' cannot be applied to types 'boolean' and 'boolean'.
!!! error TS2365: Operator '+' cannot be applied to types 'boolean' and 'boolean'.
var r9 = null + { a: '' };
~~~~~~~~~~~~~~~~
!!! Operator '+' cannot be applied to types '{ a: string; }' and '{ a: string; }'.
!!! error TS2365: Operator '+' cannot be applied to types '{ a: string; }' and '{ a: string; }'.
var r10 = null + foo();
~~~~~~~~~~~~
!!! Operator '+' cannot be applied to types 'void' and 'void'.
!!! error TS2365: Operator '+' cannot be applied to types 'void' and 'void'.
var r11 = null + (() => { });
~~~~~~~~~~~~~~~~~~
!!! Operator '+' cannot be applied to types '() => void' and '() => void'.
!!! error TS2365: Operator '+' cannot be applied to types '() => void' and '() => void'.

View File

@@ -1,14 +1,20 @@
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithOnlyNullValueOrUndefinedValue.ts(2,10): error TS2365: Operator '+' cannot be applied to types 'null' and 'null'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithOnlyNullValueOrUndefinedValue.ts(3,10): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithOnlyNullValueOrUndefinedValue.ts(4,10): error TS2365: Operator '+' cannot be applied to types 'null' and 'null'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithOnlyNullValueOrUndefinedValue.ts(5,10): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'.
==== tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithOnlyNullValueOrUndefinedValue.ts (4 errors) ====
// bug 819721
var r1 = null + null;
~~~~~~~~~~~
!!! Operator '+' cannot be applied to types 'null' and 'null'.
!!! error TS2365: Operator '+' cannot be applied to types 'null' and 'null'.
var r2 = null + undefined;
~~~~~~~~~~~~~~~~
!!! Operator '+' cannot be applied to types 'undefined' and 'undefined'.
!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'.
var r3 = undefined + null;
~~~~~~~~~~~~~~~~
!!! Operator '+' cannot be applied to types 'null' and 'null'.
!!! error TS2365: Operator '+' cannot be applied to types 'null' and 'null'.
var r4 = undefined + undefined;
~~~~~~~~~~~~~~~~~~~~~
!!! Operator '+' cannot be applied to types 'undefined' and 'undefined'.
!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'.

View File

@@ -1,3 +1,21 @@
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter.ts(15,14): error TS2365: Operator '+' cannot be applied to types 'T' and 'boolean'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter.ts(16,14): error TS2365: Operator '+' cannot be applied to types 'T' and 'number'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter.ts(18,14): error TS2365: Operator '+' cannot be applied to types 'T' and 'Object'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter.ts(19,14): error TS2365: Operator '+' cannot be applied to types 'T' and 'E'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter.ts(20,14): error TS2365: Operator '+' cannot be applied to types 'T' and 'void'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter.ts(24,14): error TS2365: Operator '+' cannot be applied to types 'boolean' and 'T'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter.ts(25,15): error TS2365: Operator '+' cannot be applied to types 'number' and 'T'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter.ts(27,15): error TS2365: Operator '+' cannot be applied to types 'Object' and 'T'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter.ts(28,15): error TS2365: Operator '+' cannot be applied to types 'E' and 'T'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter.ts(29,15): error TS2365: Operator '+' cannot be applied to types 'void' and 'T'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter.ts(32,15): error TS2365: Operator '+' cannot be applied to types 'T' and 'T'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter.ts(33,15): error TS2365: Operator '+' cannot be applied to types 'T' and 'T'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter.ts(34,15): error TS2365: Operator '+' cannot be applied to types 'T' and 'T'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter.ts(35,15): error TS2365: Operator '+' cannot be applied to types 'T' and 'U'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter.ts(36,15): error TS2365: Operator '+' cannot be applied to types 'T' and '() => void'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter.ts(37,15): error TS2365: Operator '+' cannot be applied to types 'T' and 'undefined[]'.
==== tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter.ts (16 errors) ====
// type parameter type is not a valid operand of addition operator
enum E { a, b }
@@ -15,57 +33,57 @@
var r1: any = t + a; // ok, one operand is any
var r2 = t + b;
~~~~~
!!! Operator '+' cannot be applied to types 'T' and 'boolean'.
!!! error TS2365: Operator '+' cannot be applied to types 'T' and 'boolean'.
var r3 = t + c;
~~~~~
!!! Operator '+' cannot be applied to types 'T' and 'number'.
!!! error TS2365: Operator '+' cannot be applied to types 'T' and 'number'.
var r4 = t + d; // ok, one operand is string
var r5 = t + e;
~~~~~
!!! Operator '+' cannot be applied to types 'T' and 'Object'.
!!! error TS2365: Operator '+' cannot be applied to types 'T' and 'Object'.
var r6 = t + g;
~~~~~
!!! Operator '+' cannot be applied to types 'T' and 'E'.
!!! error TS2365: Operator '+' cannot be applied to types 'T' and 'E'.
var r7 = t + f;
~~~~~
!!! Operator '+' cannot be applied to types 'T' and 'void'.
!!! error TS2365: Operator '+' cannot be applied to types 'T' and 'void'.
// type parameter as right operand
var r8 = a + t; // ok, one operand is any
var r9 = b + t;
~~~~~
!!! Operator '+' cannot be applied to types 'boolean' and 'T'.
!!! error TS2365: Operator '+' cannot be applied to types 'boolean' and 'T'.
var r10 = c + t;
~~~~~
!!! Operator '+' cannot be applied to types 'number' and 'T'.
!!! error TS2365: Operator '+' cannot be applied to types 'number' and 'T'.
var r11 = d + t; // ok, one operand is string
var r12 = e + t;
~~~~~
!!! Operator '+' cannot be applied to types 'Object' and 'T'.
!!! error TS2365: Operator '+' cannot be applied to types 'Object' and 'T'.
var r13 = g + t;
~~~~~
!!! Operator '+' cannot be applied to types 'E' and 'T'.
!!! error TS2365: Operator '+' cannot be applied to types 'E' and 'T'.
var r14 = f + t;
~~~~~
!!! Operator '+' cannot be applied to types 'void' and 'T'.
!!! error TS2365: Operator '+' cannot be applied to types 'void' and 'T'.
// other cases
var r15 = t + null;
~~~~~~~~
!!! Operator '+' cannot be applied to types 'T' and 'T'.
!!! error TS2365: Operator '+' cannot be applied to types 'T' and 'T'.
var r16 = t + undefined;
~~~~~~~~~~~~~
!!! Operator '+' cannot be applied to types 'T' and 'T'.
!!! error TS2365: Operator '+' cannot be applied to types 'T' and 'T'.
var r17 = t + t;
~~~~~
!!! Operator '+' cannot be applied to types 'T' and 'T'.
!!! error TS2365: Operator '+' cannot be applied to types 'T' and 'T'.
var r18 = t + u;
~~~~~
!!! Operator '+' cannot be applied to types 'T' and 'U'.
!!! error TS2365: Operator '+' cannot be applied to types 'T' and 'U'.
var r19 = t + (() => { });
~~~~~~~~~~~~~~~
!!! Operator '+' cannot be applied to types 'T' and '() => void'.
!!! error TS2365: Operator '+' cannot be applied to types 'T' and '() => void'.
var r20 = t + [];
~~~~~~
!!! Operator '+' cannot be applied to types 'T' and 'undefined[]'.
!!! error TS2365: Operator '+' cannot be applied to types 'T' and 'undefined[]'.
}

View File

@@ -1,3 +1,16 @@
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(11,10): error TS2365: Operator '+' cannot be applied to types 'boolean' and 'boolean'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(12,10): error TS2365: Operator '+' cannot be applied to types 'Object' and 'Object'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(13,10): error TS2365: Operator '+' cannot be applied to types 'void' and 'void'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(14,10): error TS2365: Operator '+' cannot be applied to types 'boolean' and 'boolean'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(15,10): error TS2365: Operator '+' cannot be applied to types 'Object' and 'Object'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(16,10): error TS2365: Operator '+' cannot be applied to types 'void' and 'void'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(19,10): error TS2365: Operator '+' cannot be applied to types 'Number' and 'Number'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(20,10): error TS2365: Operator '+' cannot be applied to types 'boolean' and 'boolean'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(21,10): error TS2365: Operator '+' cannot be applied to types '{ a: string; }' and '{ a: string; }'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(22,11): error TS2365: Operator '+' cannot be applied to types 'void' and 'void'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(23,11): error TS2365: Operator '+' cannot be applied to types '() => void' and '() => void'.
==== tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts (11 errors) ====
// If one operand is the null or undefined value, it is treated as having the type of the other operand.
@@ -11,36 +24,36 @@
// undefined + boolean/Object
var r1 = undefined + a;
~~~~~~~~~~~~~
!!! Operator '+' cannot be applied to types 'boolean' and 'boolean'.
!!! error TS2365: Operator '+' cannot be applied to types 'boolean' and 'boolean'.
var r2 = undefined + b;
~~~~~~~~~~~~~
!!! Operator '+' cannot be applied to types 'Object' and 'Object'.
!!! error TS2365: Operator '+' cannot be applied to types 'Object' and 'Object'.
var r3 = undefined + c;
~~~~~~~~~~~~~
!!! Operator '+' cannot be applied to types 'void' and 'void'.
!!! error TS2365: Operator '+' cannot be applied to types 'void' and 'void'.
var r4 = a + undefined;
~~~~~~~~~~~~~
!!! Operator '+' cannot be applied to types 'boolean' and 'boolean'.
!!! error TS2365: Operator '+' cannot be applied to types 'boolean' and 'boolean'.
var r5 = b + undefined;
~~~~~~~~~~~~~
!!! Operator '+' cannot be applied to types 'Object' and 'Object'.
!!! error TS2365: Operator '+' cannot be applied to types 'Object' and 'Object'.
var r6 = undefined + c;
~~~~~~~~~~~~~
!!! Operator '+' cannot be applied to types 'void' and 'void'.
!!! error TS2365: Operator '+' cannot be applied to types 'void' and 'void'.
// other cases
var r7 = undefined + d;
~~~~~~~~~~~~~
!!! Operator '+' cannot be applied to types 'Number' and 'Number'.
!!! error TS2365: Operator '+' cannot be applied to types 'Number' and 'Number'.
var r8 = undefined + true;
~~~~~~~~~~~~~~~~
!!! Operator '+' cannot be applied to types 'boolean' and 'boolean'.
!!! error TS2365: Operator '+' cannot be applied to types 'boolean' and 'boolean'.
var r9 = undefined + { a: '' };
~~~~~~~~~~~~~~~~~~~~~
!!! Operator '+' cannot be applied to types '{ a: string; }' and '{ a: string; }'.
!!! error TS2365: Operator '+' cannot be applied to types '{ a: string; }' and '{ a: string; }'.
var r10 = undefined + foo();
~~~~~~~~~~~~~~~~~
!!! Operator '+' cannot be applied to types 'void' and 'void'.
!!! error TS2365: Operator '+' cannot be applied to types 'void' and 'void'.
var r11 = undefined + (() => { });
~~~~~~~~~~~~~~~~~~~~~~~
!!! Operator '+' cannot be applied to types '() => void' and '() => void'.
!!! error TS2365: Operator '+' cannot be applied to types '() => void' and '() => void'.

View File

@@ -1,14 +1,19 @@
tests/cases/compiler/aliasAssignments_1.ts(3,1): error TS2322: Type 'number' is not assignable to type 'typeof "tests/cases/compiler/aliasAssignments_moduleA"':
Property 'someClass' is missing in type 'Number'.
tests/cases/compiler/aliasAssignments_1.ts(5,1): error TS2323: Type 'typeof "tests/cases/compiler/aliasAssignments_moduleA"' is not assignable to type 'number'.
==== tests/cases/compiler/aliasAssignments_1.ts (2 errors) ====
import moduleA = require("aliasAssignments_moduleA");
var x = moduleA;
x = 1; // Should be error
~
!!! Type 'number' is not assignable to type 'typeof "tests/cases/compiler/aliasAssignments_moduleA"':
!!! Property 'someClass' is missing in type 'Number'.
!!! error TS2322: Type 'number' is not assignable to type 'typeof "tests/cases/compiler/aliasAssignments_moduleA"':
!!! error TS2322: Property 'someClass' is missing in type 'Number'.
var y = 1;
y = moduleA; // should be error
~
!!! Type 'typeof "tests/cases/compiler/aliasAssignments_moduleA"' is not assignable to type 'number'.
!!! error TS2323: Type 'typeof "tests/cases/compiler/aliasAssignments_moduleA"' is not assignable to type 'number'.
==== tests/cases/compiler/aliasAssignments_moduleA.ts (0 errors) ====
export class someClass {

View File

@@ -1,3 +1,6 @@
tests/cases/compiler/aliasBug.ts(17,10): error TS2305: Module 'foo.bar.baz' has no exported member 'bar'.
==== tests/cases/compiler/aliasBug.ts (1 errors) ====
module foo {
@@ -17,7 +20,7 @@
var p2: foo.Provide;
var p3:booz.bar;
~~~~~~~~
!!! Module 'foo.bar.baz' has no exported member 'bar'.
!!! error TS2305: Module 'foo.bar.baz' has no exported member 'bar'.
var p22 = new provide.Provide();
}

View File

@@ -1,3 +1,12 @@
tests/cases/compiler/aliasErrors.ts(13,12): error TS1003: Identifier expected.
tests/cases/compiler/aliasErrors.ts(14,12): error TS1003: Identifier expected.
tests/cases/compiler/aliasErrors.ts(15,12): error TS1003: Identifier expected.
tests/cases/compiler/aliasErrors.ts(11,1): error TS2304: Cannot find name 'no'.
tests/cases/compiler/aliasErrors.ts(12,1): error TS2304: Cannot find name 'no'.
tests/cases/compiler/aliasErrors.ts(16,1): error TS2304: Cannot find name 'undefined'.
tests/cases/compiler/aliasErrors.ts(26,10): error TS2305: Module 'foo.bar.baz' has no exported member 'bar'.
==== tests/cases/compiler/aliasErrors.ts (7 errors) ====
module foo {
export class Provide {
@@ -11,22 +20,22 @@
import m = no;
~~~~~~~~~~~~~~
!!! Cannot find name 'no'.
!!! error TS2304: Cannot find name 'no'.
import m2 = no.mod;
~~~~~~~~~~~~~~~~~~~
!!! Cannot find name 'no'.
!!! error TS2304: Cannot find name 'no'.
import n = 5;
~
!!! Identifier expected.
!!! error TS1003: Identifier expected.
import o = "s";
~~~
!!! Identifier expected.
!!! error TS1003: Identifier expected.
import q = null;
~~~~
!!! Identifier expected.
!!! error TS1003: Identifier expected.
import r = undefined;
~~~~~~~~~~~~~~~~~~~~~
!!! Cannot find name 'undefined'.
!!! error TS2304: Cannot find name 'undefined'.
var p = new provide.Provide();
@@ -38,7 +47,7 @@
var p2: foo.Provide;
var p3:booz.bar;
~~~~~~~~
!!! Module 'foo.bar.baz' has no exported member 'bar'.
!!! error TS2305: Module 'foo.bar.baz' has no exported member 'bar'.
var p22 = new provide.Provide();
}

View File

@@ -1,8 +1,11 @@
tests/cases/compiler/aliasInaccessibleModule.ts(4,5): error TS4000: Import declaration 'X' is using private name 'N'.
==== tests/cases/compiler/aliasInaccessibleModule.ts (1 errors) ====
module M {
module N {
}
export import X = N;
~~~~~~~~~~~~~~~~~~~~
!!! Import declaration 'X' is using private name 'N'.
!!! error TS4000: Import declaration 'X' is using private name 'N'.
}

View File

@@ -1,3 +1,6 @@
tests/cases/compiler/aliasInaccessibleModule2.ts(7,5): error TS4000: Import declaration 'R' is using private name 'N'.
==== tests/cases/compiler/aliasInaccessibleModule2.ts (1 errors) ====
module M {
module N {
@@ -7,6 +10,6 @@
}
import R = N;
~~~~~~~~~~~~~
!!! Import declaration 'R' is using private name 'N'.
!!! error TS4000: Import declaration 'R' is using private name 'N'.
export import X = R;
}

View File

@@ -1,3 +1,6 @@
tests/cases/compiler/aliasOnMergedModuleInterface_1.ts(5,16): error TS2304: Cannot find name 'foo'.
==== tests/cases/compiler/aliasOnMergedModuleInterface_1.ts (1 errors) ====
///<reference path='aliasOnMergedModuleInterface_0.ts' />
import foo = require("foo")
@@ -5,7 +8,7 @@
z.bar("hello"); // This should be ok
var x: foo.A = foo.bar("hello"); // foo.A should be ok but foo.bar should be error
~~~
!!! Cannot find name 'foo'.
!!! error TS2304: Cannot find name 'foo'.
==== tests/cases/compiler/aliasOnMergedModuleInterface_0.ts (0 errors) ====
declare module "foo"

View File

@@ -1,8 +1,11 @@
tests/cases/compiler/aliasWithInterfaceExportAssignmentUsedInVarInitializer_1.ts(2,9): error TS2304: Cannot find name 'b'.
==== tests/cases/compiler/aliasWithInterfaceExportAssignmentUsedInVarInitializer_1.ts (1 errors) ====
import moduleA = require("aliasWithInterfaceExportAssignmentUsedInVarInitializer_0");
var d = b.q3;
~
!!! Cannot find name 'b'.
!!! error TS2304: Cannot find name 'b'.
==== tests/cases/compiler/aliasWithInterfaceExportAssignmentUsedInVarInitializer_0.ts (0 errors) ====
interface c {
q3: number;

View File

@@ -1,6 +1,9 @@
tests/cases/compiler/ambientClassOverloadForFunction.ts(2,10): error TS2300: Duplicate identifier 'foo'.
==== tests/cases/compiler/ambientClassOverloadForFunction.ts (1 errors) ====
declare class foo{};
function foo() { return null; }
~~~
!!! Duplicate identifier 'foo'.
!!! error TS2300: Duplicate identifier 'foo'.

View File

@@ -1,8 +1,11 @@
tests/cases/conformance/ambient/consumer.ts(2,1): error TS1148: Cannot compile external modules unless the '--module' flag is provided.
==== tests/cases/conformance/ambient/consumer.ts (1 errors) ====
/// <reference path="decls.ts" />
import imp1 = require('equ');
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Cannot compile external modules unless the '--module' flag is provided.
!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided.
// Ambient external module members are always exported with or without export keyword when module lacks export assignment

View File

@@ -1,6 +1,9 @@
tests/cases/compiler/ambientEnumElementInitializer3.ts(2,2): error TS1066: Ambient enum elements can only have integer literal initializers.
==== tests/cases/compiler/ambientEnumElementInitializer3.ts (1 errors) ====
declare enum E {
e = 3.3 // Decimal
~
!!! Ambient enum elements can only have integer literal initializers.
!!! error TS1066: Ambient enum elements can only have integer literal initializers.
}

View File

@@ -1,14 +1,32 @@
tests/cases/conformance/ambient/ambientErrors.ts(2,15): error TS1039: Initializers are not allowed in ambient contexts.
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(24,5): error TS1066: Ambient enum elements can only have integer literal initializers.
tests/cases/conformance/ambient/ambientErrors.ts(29,5): error TS1066: Ambient enum elements can only have integer literal initializers.
tests/cases/conformance/ambient/ambientErrors.ts(34,11): error TS1039: Initializers are not allowed in ambient contexts.
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.
tests/cases/conformance/ambient/ambientErrors.ts(51,16): error TS2436: Ambient external module declaration cannot specify relative module name.
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 (16 errors) ====
// Ambient variable with an initializer
declare var x = 4;
~
!!! Initializers are not allowed in ambient contexts.
!!! error TS1039: Initializers are not allowed in ambient contexts.
// Ambient functions with invalid overloads
declare function fn(x: number): string;
declare function fn(x: 'foo'): number;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Specialized overload signature is not assignable to any non-specialized signature.
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
// Ambient functions with duplicate signatures
declare function fn1(x: number): string;
@@ -21,51 +39,51 @@
// Ambient function with default parameter values
declare function fn3(x = 3);
~~~~~
!!! A parameter initializer is only allowed in a function or constructor implementation.
!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation.
// Ambient function with function body
declare function fn4() { };
~
!!! A function implementation cannot be declared in an ambient context.
!!! error TS1037: A function implementation cannot be declared in an ambient context.
// Ambient enum with non - integer literal constant member
declare enum E1 {
y = 4.23
~
!!! Ambient enum elements can only have integer literal initializers.
!!! error TS1066: Ambient enum elements can only have integer literal initializers.
}
// Ambient enum with computer member
declare enum E2 {
x = 'foo'.length
~
!!! Ambient enum elements can only have integer literal initializers.
!!! error TS1066: Ambient enum elements can only have integer literal initializers.
}
// Ambient module with initializers for values, bodies for functions / classes
declare module M1 {
var x = 3;
~
!!! Initializers are not allowed in ambient contexts.
!!! error TS1039: Initializers are not allowed in ambient contexts.
function fn() { }
~
!!! A function implementation cannot be declared in an ambient context.
!!! error TS1037: A function implementation cannot be declared in an ambient context.
class C {
static x = 3;
~
!!! Initializers are not allowed in ambient contexts.
!!! error TS1039: Initializers are not allowed in ambient contexts.
y = 4;
~
!!! Initializers are not allowed in ambient contexts.
!!! error TS1039: Initializers are not allowed in ambient contexts.
constructor() { }
~
!!! A constructor implementation cannot be declared in an ambient context.
!!! error TS1111: A constructor implementation cannot be declared in an ambient context.
fn() { }
~
!!! A function implementation cannot be declared in an ambient context.
!!! error TS1037: A function implementation cannot be declared in an ambient context.
static sfn() { }
~
!!! A function implementation cannot be declared in an ambient context.
!!! error TS1037: A function implementation cannot be declared in an ambient context.
}
}
@@ -73,13 +91,13 @@
module M2 {
declare module 'nope' { }
~~~~~~
!!! Ambient external modules cannot be nested in other modules.
!!! error TS2435: Ambient external modules cannot be nested in other modules.
}
// Ambient external module with a string literal name that isn't a top level external module name
declare module '../foo' { }
~~~~~~~~
!!! Ambient external module declaration cannot specify relative module name.
!!! error TS2436: Ambient external module declaration cannot specify relative module name.
// Ambient external module with export assignment and other exported members
declare module 'bar' {
@@ -87,6 +105,6 @@
export var q;
export = n;
~~~~~~~~~~~
!!! An export assignment cannot be used in a module with other exported elements.
!!! error TS2309: An export assignment cannot be used in a module with other exported elements.
}

View File

@@ -1,3 +1,7 @@
tests/cases/compiler/ambientExternalModuleInAnotherExternalModule.ts(5,16): error TS2435: Ambient external modules cannot be nested in other modules.
tests/cases/compiler/ambientExternalModuleInAnotherExternalModule.ts(10,22): error TS2307: Cannot find external module 'ext'.
==== tests/cases/compiler/ambientExternalModuleInAnotherExternalModule.ts (2 errors) ====
class D { }
@@ -5,12 +9,12 @@
declare module "ext" {
~~~~~
!!! Ambient external modules cannot be nested in other modules.
!!! error TS2435: Ambient external modules cannot be nested in other modules.
export class C { }
}
// Cannot resolve this ext module reference
import ext = require("ext");
~~~~~
!!! Cannot find external module 'ext'.
!!! error TS2307: Cannot find external module 'ext'.
var x = ext;

View File

@@ -1,6 +1,9 @@
tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbient.ts(2,27): error TS2435: Ambient external modules cannot be nested in other modules.
==== tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbient.ts (1 errors) ====
module M {
export declare module "M" { }
~~~
!!! Ambient external modules cannot be nested in other modules.
!!! error TS2435: Ambient external modules cannot be nested in other modules.
}

View File

@@ -1,4 +1,7 @@
tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbientExternalModule.ts(1,23): error TS2435: Ambient external modules cannot be nested in other modules.
==== tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbientExternalModule.ts (1 errors) ====
export declare module "M" { }
~~~
!!! Ambient external modules cannot be nested in other modules.
!!! error TS2435: Ambient external modules cannot be nested in other modules.

View File

@@ -1,10 +1,14 @@
tests/cases/compiler/ambientExternalModuleWithRelativeExternalImportDeclaration.ts(2,5): error TS2439: Import declaration in an ambient external module declaration cannot reference external module through relative external module name.
tests/cases/compiler/ambientExternalModuleWithRelativeExternalImportDeclaration.ts(2,25): error TS2307: Cannot find external module './SubModule'.
==== tests/cases/compiler/ambientExternalModuleWithRelativeExternalImportDeclaration.ts (2 errors) ====
declare module "OuterModule" {
import m2 = require("./SubModule");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Import declaration in an ambient external module declaration cannot reference external module through relative external module name.
!!! error TS2439: Import declaration in an ambient external module declaration cannot reference external module through relative external module name.
~~~~~~~~~~~~~
!!! Cannot find external module './SubModule'.
!!! error TS2307: Cannot find external module './SubModule'.
class SubModule {
public static StaticVar: number;
public InstanceVar: number;

View File

@@ -1,12 +1,16 @@
tests/cases/compiler/ambientExternalModuleWithRelativeModuleName.ts(1,16): error TS2436: Ambient external module declaration cannot specify relative module name.
tests/cases/compiler/ambientExternalModuleWithRelativeModuleName.ts(5,16): error TS2436: Ambient external module declaration cannot specify relative module name.
==== tests/cases/compiler/ambientExternalModuleWithRelativeModuleName.ts (2 errors) ====
declare module "./relativeModule" {
~~~~~~~~~~~~~~~~~~
!!! Ambient external module declaration cannot specify relative module name.
!!! error TS2436: Ambient external module declaration cannot specify relative module name.
var x: string;
}
declare module ".\\relativeModule" {
~~~~~~~~~~~~~~~~~~~
!!! Ambient external module declaration cannot specify relative module name.
!!! error TS2436: Ambient external module declaration cannot specify relative module name.
var x: string;
}

View File

@@ -1,13 +1,17 @@
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 (2 errors) ====
declare class A {
get length() : number;
~~~~~~
!!! An accessor cannot be declared in an ambient context.
!!! error TS1086: An accessor cannot be declared in an ambient context.
}
declare class B {
get length() { return 0; }
~~~~~~
!!! An accessor cannot be declared in an ambient context.
!!! error TS1086: An accessor cannot be declared in an ambient context.
}

View File

@@ -1,38 +1,55 @@
tests/cases/compiler/ambientWithStatements.ts(2,5): error TS1036: Statements are not allowed in ambient contexts.
tests/cases/compiler/ambientWithStatements.ts(3,5): error TS1036: Statements are not allowed in ambient contexts.
tests/cases/compiler/ambientWithStatements.ts(4,5): error TS1036: Statements are not allowed in ambient contexts.
tests/cases/compiler/ambientWithStatements.ts(5,5): error TS1036: Statements are not allowed in ambient contexts.
tests/cases/compiler/ambientWithStatements.ts(7,5): error TS1036: Statements are not allowed in ambient contexts.
tests/cases/compiler/ambientWithStatements.ts(8,5): error TS1036: Statements are not allowed in ambient contexts.
tests/cases/compiler/ambientWithStatements.ts(9,5): error TS1036: Statements are not allowed in ambient contexts.
tests/cases/compiler/ambientWithStatements.ts(10,5): error TS1036: Statements are not allowed in ambient contexts.
tests/cases/compiler/ambientWithStatements.ts(11,5): error TS1036: Statements are not allowed in ambient contexts.
tests/cases/compiler/ambientWithStatements.ts(12,5): error TS1036: Statements are not allowed in ambient contexts.
tests/cases/compiler/ambientWithStatements.ts(18,5): error TS1036: Statements are not allowed in ambient contexts.
tests/cases/compiler/ambientWithStatements.ts(19,5): error TS1036: Statements are not allowed in ambient contexts.
tests/cases/compiler/ambientWithStatements.ts(25,5): error TS1036: Statements are not allowed in ambient contexts.
tests/cases/compiler/ambientWithStatements.ts(7,15): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.
tests/cases/compiler/ambientWithStatements.ts(25,11): error TS2410: All symbols within a 'with' block will be resolved to 'any'.
==== tests/cases/compiler/ambientWithStatements.ts (15 errors) ====
declare module M {
break;
~~~~~
!!! Statements are not allowed in ambient contexts.
!!! error TS1036: Statements are not allowed in ambient contexts.
continue;
~~~~~~~~
!!! Statements are not allowed in ambient contexts.
!!! error TS1036: Statements are not allowed in ambient contexts.
debugger;
~~~~~~~~
!!! Statements are not allowed in ambient contexts.
!!! error TS1036: Statements are not allowed in ambient contexts.
do { } while (true);
~~
!!! Statements are not allowed in ambient contexts.
!!! error TS1036: Statements are not allowed in ambient contexts.
var x;
for (x in null) { }
~~~
!!! Statements are not allowed in ambient contexts.
!!! error TS1036: Statements are not allowed in ambient contexts.
~~~~
!!! The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.
!!! error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.
if (true) { } else { }
~~
!!! Statements are not allowed in ambient contexts.
!!! error TS1036: Statements are not allowed in ambient contexts.
1;
~
!!! Statements are not allowed in ambient contexts.
!!! error TS1036: Statements are not allowed in ambient contexts.
L: var y;
~
!!! Statements are not allowed in ambient contexts.
!!! error TS1036: Statements are not allowed in ambient contexts.
return;
~~~~~~
!!! Statements are not allowed in ambient contexts.
!!! error TS1036: Statements are not allowed in ambient contexts.
switch (x) {
~~~~~~
!!! Statements are not allowed in ambient contexts.
!!! error TS1036: Statements are not allowed in ambient contexts.
case 1:
break;
default:
@@ -40,10 +57,10 @@
}
throw "nooo";
~~~~~
!!! Statements are not allowed in ambient contexts.
!!! error TS1036: Statements are not allowed in ambient contexts.
try {
~~~
!!! Statements are not allowed in ambient contexts.
!!! error TS1036: Statements are not allowed in ambient contexts.
}
catch (e) {
}
@@ -51,8 +68,8 @@
}
with (x) {
~~~~
!!! Statements are not allowed in ambient contexts.
!!! error TS1036: Statements are not allowed in ambient contexts.
~
!!! All symbols within a 'with' block will be resolved to 'any'.
!!! error TS2410: All symbols within a 'with' block will be resolved to 'any'.
}
}

View File

@@ -1,16 +1,23 @@
tests/cases/compiler/ambiguousGenericAssertion1.ts(4,10): error TS1109: Expression expected.
tests/cases/compiler/ambiguousGenericAssertion1.ts(4,16): error TS1005: ')' expected.
tests/cases/compiler/ambiguousGenericAssertion1.ts(4,19): error TS1005: ',' expected.
tests/cases/compiler/ambiguousGenericAssertion1.ts(4,21): error TS1005: ';' expected.
tests/cases/compiler/ambiguousGenericAssertion1.ts(4,15): error TS2304: Cannot find name 'x'.
==== tests/cases/compiler/ambiguousGenericAssertion1.ts (5 errors) ====
function f<T>(x: T): T { return null; }
var r = <T>(x: T) => x;
var r2 = < <T>(x: T) => T>f; // valid
var r3 = <<T>(x: T) => T>f; // ambiguous, appears to the parser as a << operation
~~
!!! Expression expected.
!!! error TS1109: Expression expected.
~
!!! ')' expected.
!!! error TS1005: ')' expected.
~
!!! ',' expected.
!!! error TS1005: ',' expected.
~~
!!! ';' expected.
!!! error TS1005: ';' expected.
~
!!! Cannot find name 'x'.
!!! error TS2304: Cannot find name 'x'.

View File

@@ -1,3 +1,7 @@
tests/cases/compiler/ambiguousOverload.ts(5,5): error TS2323: Type 'number' is not assignable to type 'string'.
tests/cases/compiler/ambiguousOverload.ts(11,5): error TS2323: Type 'string' is not assignable to type 'number'.
==== tests/cases/compiler/ambiguousOverload.ts (2 errors) ====
function foof(bar: string, y): number;
function foof(bar: string, x): string;
@@ -5,7 +9,7 @@
var x: number = foof("s", null);
var y: string = foof("s", null);
~
!!! Type 'number' is not assignable to type 'string'.
!!! error TS2323: Type 'number' is not assignable to type 'string'.
function foof2(bar: string, x): string;
function foof2(bar: string, y): number;
@@ -13,4 +17,4 @@
var x2: string = foof2("s", null);
var y2: number = foof2("s", null);
~~
!!! Type 'string' is not assignable to type 'number'.
!!! error TS2323: Type 'string' is not assignable to type 'number'.

View File

@@ -1,7 +1,10 @@
tests/cases/compiler/amdDependencyComment1.ts(3,21): error TS2307: Cannot find external module 'm2'.
==== tests/cases/compiler/amdDependencyComment1.ts (1 errors) ====
///<amd-dependency path='bar'/>
import m1 = require("m2")
~~~~
!!! Cannot find external module 'm2'.
!!! error TS2307: Cannot find external module 'm2'.
m1.f();

View File

@@ -1,7 +1,10 @@
tests/cases/compiler/amdDependencyComment2.ts(3,21): error TS2307: Cannot find external module 'm2'.
==== tests/cases/compiler/amdDependencyComment2.ts (1 errors) ====
///<amd-dependency path='bar'/>
import m1 = require("m2")
~~~~
!!! Cannot find external module 'm2'.
!!! error TS2307: Cannot find external module 'm2'.
m1.f();

View File

@@ -1,40 +1,55 @@
tests/cases/compiler/anonymousModules.ts(1,8): error TS1005: ';' expected.
tests/cases/compiler/anonymousModules.ts(2,2): error TS1129: Statement expected.
tests/cases/compiler/anonymousModules.ts(2,2): error TS1148: Cannot compile external modules unless the '--module' flag is provided.
tests/cases/compiler/anonymousModules.ts(4,9): error TS1005: ';' expected.
tests/cases/compiler/anonymousModules.ts(5,3): error TS1129: Statement expected.
tests/cases/compiler/anonymousModules.ts(6,2): error TS1128: Declaration or statement expected.
tests/cases/compiler/anonymousModules.ts(10,9): error TS1005: ';' expected.
tests/cases/compiler/anonymousModules.ts(13,1): error TS1128: Declaration or statement expected.
tests/cases/compiler/anonymousModules.ts(1,1): error TS2304: Cannot find name 'module'.
tests/cases/compiler/anonymousModules.ts(4,2): error TS2304: Cannot find name 'module'.
tests/cases/compiler/anonymousModules.ts(5,14): error TS2395: Individual declarations in merged declaration bar must be all exported or all local.
tests/cases/compiler/anonymousModules.ts(8,6): error TS2395: Individual declarations in merged declaration bar must be all exported or all local.
tests/cases/compiler/anonymousModules.ts(10,2): error TS2304: Cannot find name 'module'.
==== tests/cases/compiler/anonymousModules.ts (13 errors) ====
module {
~
!!! ';' expected.
!!! error TS1005: ';' expected.
~~~~~~
!!! Cannot find name 'module'.
!!! error TS2304: Cannot find name 'module'.
export var foo = 1;
~~~~~~
!!! Statement expected.
!!! error TS1129: Statement expected.
~~~~~~~~~~~~~~~~~~~
!!! Cannot compile external modules unless the '--module' flag is provided.
!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided.
module {
~
!!! ';' expected.
!!! error TS1005: ';' expected.
~~~~~~
!!! Cannot find name 'module'.
!!! error TS2304: Cannot find name 'module'.
export var bar = 1;
~~~~~~
!!! Statement expected.
!!! error TS1129: Statement expected.
~~~
!!! Individual declarations in merged declaration bar must be all exported or all local.
!!! error TS2395: Individual declarations in merged declaration bar must be all exported or all local.
}
~
!!! Declaration or statement expected.
!!! error TS1128: Declaration or statement expected.
var bar = 2;
~~~
!!! Individual declarations in merged declaration bar must be all exported or all local.
!!! error TS2395: Individual declarations in merged declaration bar must be all exported or all local.
module {
~
!!! ';' expected.
!!! error TS1005: ';' expected.
~~~~~~
!!! Cannot find name 'module'.
!!! error TS2304: Cannot find name 'module'.
var x = bar;
}
}
~
!!! Declaration or statement expected.
!!! error TS1128: Declaration or statement expected.

View File

@@ -1,3 +1,6 @@
tests/cases/conformance/types/any/anyAsConstructor.ts(10,9): error TS2347: Untyped function calls may not accept type arguments.
==== tests/cases/conformance/types/any/anyAsConstructor.ts (1 errors) ====
// any is considered an untyped function call
// can be called except with type arguments which is an error
@@ -10,4 +13,4 @@
// grammar allows this for constructors
var d = new x<any>(x); // no error
~~~~~~~~~~~~~
!!! Untyped function calls may not accept type arguments.
!!! error TS2347: Untyped function calls may not accept type arguments.

View File

@@ -1,3 +1,9 @@
tests/cases/conformance/types/any/anyAsGenericFunctionCall.ts(5,9): error TS2347: Untyped function calls may not accept type arguments.
tests/cases/conformance/types/any/anyAsGenericFunctionCall.ts(6,9): error TS2347: Untyped function calls may not accept type arguments.
tests/cases/conformance/types/any/anyAsGenericFunctionCall.ts(9,9): error TS2347: Untyped function calls may not accept type arguments.
tests/cases/conformance/types/any/anyAsGenericFunctionCall.ts(10,9): error TS2347: Untyped function calls may not accept type arguments.
==== tests/cases/conformance/types/any/anyAsGenericFunctionCall.ts (4 errors) ====
// any is considered an untyped function call
// can be called except with type arguments which is an error
@@ -5,15 +11,15 @@
var x: any;
var a = x<number>();
~~~~~~~~~~~
!!! Untyped function calls may not accept type arguments.
!!! error TS2347: Untyped function calls may not accept type arguments.
var b = x<string>('hello');
~~~~~~~~~~~~~~~~~~
!!! Untyped function calls may not accept type arguments.
!!! error TS2347: Untyped function calls may not accept type arguments.
class C { foo: string; }
var c = x<C>(x);
~~~~~~~
!!! Untyped function calls may not accept type arguments.
!!! error TS2347: Untyped function calls may not accept type arguments.
var d = x<any>(x);
~~~~~~~~~
!!! Untyped function calls may not accept type arguments.
!!! error TS2347: Untyped function calls may not accept type arguments.

View File

@@ -1,3 +1,6 @@
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType2.ts(114,18): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType2.ts (1 errors) ====
// any is not a subtype of any other types, but is assignable, all the below should work
@@ -114,7 +117,7 @@
interface I18<T, U extends T> {
~~~~~~~~~~~
!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
[x: string]: U;
foo: any;
}

View File

@@ -1,9 +1,12 @@
tests/cases/compiler/anyDeclare.ts(4,14): error TS2300: Duplicate identifier 'myFn'.
==== tests/cases/compiler/anyDeclare.ts (1 errors) ====
declare var x: any;
module myMod {
var myFn;
function myFn() { }
~~~~
!!! Duplicate identifier 'myFn'.
!!! error TS2300: Duplicate identifier 'myFn'.
}

View File

@@ -1,19 +1,24 @@
tests/cases/compiler/anyIdenticalToItself.ts(6,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/anyIdenticalToItself.ts(10,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/anyIdenticalToItself.ts(1,1): error TS2394: Overload signature is not compatible with function implementation.
==== tests/cases/compiler/anyIdenticalToItself.ts (3 errors) ====
function foo(x: any);
~~~~~~~~~~~~~~~~~~~~~
!!! Overload signature is not compatible with function implementation.
!!! error TS2394: Overload signature is not compatible with function implementation.
function foo(x: any);
function foo(x: any, y: number) { }
class C {
get X(): any {
~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
var y: any;
return y;
}
set X(v: any) {
~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
}
}

View File

@@ -1,3 +1,8 @@
tests/cases/conformance/types/typeRelationships/apparentType/apparentTypeSubtyping.ts(9,7): error TS2416: Class 'Derived<U>' incorrectly extends base class 'Base<string>':
Types of property 'x' are incompatible:
Type 'String' is not assignable to type 'string'.
==== tests/cases/conformance/types/typeRelationships/apparentType/apparentTypeSubtyping.ts (1 errors) ====
// subtype checks use the apparent type of the target type
// S is a subtype of a type T, and T is a supertype of S, if one of the following is true, where S' denotes the apparent type (section 3.8.1) of S:
@@ -9,9 +14,9 @@
// is String (S) a subtype of U extends String (T)? Would only be true if we used the apparent type of U (T)
class Derived<U> extends Base<string> { // error
~~~~~~~
!!! Class 'Derived<U>' incorrectly extends base class 'Base<string>':
!!! Types of property 'x' are incompatible:
!!! Type 'String' is not assignable to type 'string'.
!!! error TS2416: Class 'Derived<U>' incorrectly extends base class 'Base<string>':
!!! error TS2416: Types of property 'x' are incompatible:
!!! error TS2416: Type 'String' is not assignable to type 'string'.
x: String;
}

View File

@@ -1,3 +1,8 @@
tests/cases/conformance/types/typeRelationships/apparentType/apparentTypeSupertype.ts(9,7): error TS2416: Class 'Derived<U>' incorrectly extends base class 'Base':
Types of property 'x' are incompatible:
Type 'U' is not assignable to type 'string'.
==== tests/cases/conformance/types/typeRelationships/apparentType/apparentTypeSupertype.ts (1 errors) ====
// subtype checks use the apparent type of the target type
// S is a subtype of a type T, and T is a supertype of S, if one of the following is true, where S' denotes the apparent type (section 3.8.1) of S:
@@ -9,8 +14,8 @@
// is String (S) a subtype of U extends String (T)? Would only be true if we used the apparent type of U (T)
class Derived<U extends String> extends Base { // error
~~~~~~~
!!! Class 'Derived<U>' incorrectly extends base class 'Base':
!!! Types of property 'x' are incompatible:
!!! Type 'U' is not assignable to type 'string'.
!!! error TS2416: Class 'Derived<U>' incorrectly extends base class 'Base':
!!! error TS2416: Types of property 'x' are incompatible:
!!! error TS2416: Type 'U' is not assignable to type 'string'.
x: U;
}

View File

@@ -1,8 +1,12 @@
tests/cases/compiler/argumentsBindsToFunctionScopeArgumentList.ts(3,5): error TS2322: Type 'number' is not assignable to type 'IArguments':
Property 'length' is missing in type 'Number'.
==== tests/cases/compiler/argumentsBindsToFunctionScopeArgumentList.ts (1 errors) ====
var arguments = 10;
function foo(a) {
arguments = 10; /// This shouldnt be of type number and result in error.
~~~~~~~~~
!!! Type 'number' is not assignable to type 'IArguments':
!!! Property 'length' is missing in type 'Number'.
!!! error TS2322: Type 'number' is not assignable to type 'IArguments':
!!! error TS2322: Property 'length' is missing in type 'Number'.
}

View File

@@ -1,39 +1,53 @@
tests/cases/compiler/arithAssignTyping.ts(3,1): error TS2364: Invalid left-hand side of assignment expression.
tests/cases/compiler/arithAssignTyping.ts(4,1): error TS2365: Operator '+=' cannot be applied to types 'typeof f' and 'number'.
tests/cases/compiler/arithAssignTyping.ts(5,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/compiler/arithAssignTyping.ts(6,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/compiler/arithAssignTyping.ts(7,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/compiler/arithAssignTyping.ts(8,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/compiler/arithAssignTyping.ts(9,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/compiler/arithAssignTyping.ts(10,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/compiler/arithAssignTyping.ts(11,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/compiler/arithAssignTyping.ts(12,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/compiler/arithAssignTyping.ts(13,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/compiler/arithAssignTyping.ts(14,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
==== tests/cases/compiler/arithAssignTyping.ts (12 errors) ====
class f { }
f += ''; // error
~
!!! Invalid left-hand side of assignment expression.
!!! error TS2364: Invalid left-hand side of assignment expression.
f += 1; // error
~~~~~~
!!! Operator '+=' cannot be applied to types 'typeof f' and 'number'.
!!! error TS2365: Operator '+=' cannot be applied to types 'typeof f' and 'number'.
f -= 1; // error
~
!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
f *= 1; // error
~
!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
f /= 1; // error
~
!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
f %= 1; // error
~
!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
f &= 1; // error
~
!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
f |= 1; // error
~
!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
f <<= 1; // error
~
!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
f >>= 1; // error
~
!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
f >>>= 1; // error
~
!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
f ^= 1; // error
~
!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.

View File

@@ -1,21 +1,30 @@
tests/cases/compiler/arithmeticOnInvalidTypes.ts(3,9): error TS2365: Operator '+' cannot be applied to types 'Number' and 'Number'.
tests/cases/compiler/arithmeticOnInvalidTypes.ts(4,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/compiler/arithmeticOnInvalidTypes.ts(4,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/compiler/arithmeticOnInvalidTypes.ts(5,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/compiler/arithmeticOnInvalidTypes.ts(5,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/compiler/arithmeticOnInvalidTypes.ts(6,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/compiler/arithmeticOnInvalidTypes.ts(6,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
==== tests/cases/compiler/arithmeticOnInvalidTypes.ts (7 errors) ====
var x: Number;
var y: Number;
var z = x + y;
~~~~~
!!! Operator '+' cannot be applied to types 'Number' and 'Number'.
!!! error TS2365: Operator '+' cannot be applied to types 'Number' and 'Number'.
var z2 = x - y;
~
!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
~
!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
var z3 = x * y;
~
!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
~
!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
var z4 = x / y;
~
!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
~
!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.

View File

@@ -1,22 +1,31 @@
tests/cases/compiler/arithmeticOnInvalidTypes2.ts(2,14): error TS2365: Operator '+' cannot be applied to types 'T' and 'T'.
tests/cases/compiler/arithmeticOnInvalidTypes2.ts(3,14): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/compiler/arithmeticOnInvalidTypes2.ts(3,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/compiler/arithmeticOnInvalidTypes2.ts(4,14): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/compiler/arithmeticOnInvalidTypes2.ts(4,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/compiler/arithmeticOnInvalidTypes2.ts(5,14): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/compiler/arithmeticOnInvalidTypes2.ts(5,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
==== tests/cases/compiler/arithmeticOnInvalidTypes2.ts (7 errors) ====
var obj = function f<T>(a: T, b: T) {
var z1 = a + b;
~~~~~
!!! Operator '+' cannot be applied to types 'T' and 'T'.
!!! error TS2365: Operator '+' cannot be applied to types 'T' and 'T'.
var z2 = a - b;
~
!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
~
!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
var z3 = a * b;
~
!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
~
!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
var z4 = a / b;
~
!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
~
!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
return a;
};

Some files were not shown because too many files have changed in this diff Show More