mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-30 01:04:49 -05:00
Merge branch 'master' into getOccurrences
This commit is contained in:
@@ -557,11 +557,11 @@ declare var i1_ncf: (b: number) => number;
|
||||
declare var i1_ncr: number;
|
||||
declare var i1_ncprop: number;
|
||||
declare var i1_s_p: number;
|
||||
declare var i1_s_f: typeof s2;
|
||||
declare var i1_s_f: typeof c1.s2;
|
||||
declare var i1_s_r: number;
|
||||
declare var i1_s_prop: number;
|
||||
declare var i1_s_nc_p: number;
|
||||
declare var i1_s_ncf: typeof nc_s2;
|
||||
declare var i1_s_ncf: typeof c1.nc_s2;
|
||||
declare var i1_s_ncr: number;
|
||||
declare var i1_s_ncprop: number;
|
||||
declare var i1_c: typeof c1;
|
||||
@@ -577,111 +577,3 @@ declare class cProperties {
|
||||
private y;
|
||||
}
|
||||
declare var cProperties_i: cProperties;
|
||||
|
||||
|
||||
//// [DtsFileErrors]
|
||||
|
||||
|
||||
==== tests/cases/compiler/commentsClassMembers.d.ts (2 errors) ====
|
||||
/** This is comment for c1*/
|
||||
declare class c1 {
|
||||
/** p1 is property of c1*/
|
||||
p1: number;
|
||||
/** sum with property*/
|
||||
p2(/** number to add*/ b: number): number;
|
||||
/** getter property*/
|
||||
/** setter property*/
|
||||
p3: number;
|
||||
/** pp1 is property of c1*/
|
||||
private pp1;
|
||||
/** sum with property*/
|
||||
private pp2(/** number to add*/ b);
|
||||
/** getter property*/
|
||||
/** setter property*/
|
||||
private pp3;
|
||||
/** Constructor method*/
|
||||
constructor();
|
||||
/** s1 is static property of c1*/
|
||||
static s1: number;
|
||||
/** static sum with property*/
|
||||
static s2(/** number to add*/ b: number): number;
|
||||
/** static getter property*/
|
||||
/** setter property*/
|
||||
static s3: number;
|
||||
nc_p1: number;
|
||||
nc_p2(b: number): number;
|
||||
nc_p3: number;
|
||||
private nc_pp1;
|
||||
private nc_pp2(b);
|
||||
private nc_pp3;
|
||||
static nc_s1: number;
|
||||
static nc_s2(b: number): number;
|
||||
static nc_s3: number;
|
||||
a_p1: number;
|
||||
a_p2(b: number): number;
|
||||
a_p3: number;
|
||||
private a_pp1;
|
||||
private a_pp2(b);
|
||||
private a_pp3;
|
||||
static a_s1: number;
|
||||
static a_s2(b: number): number;
|
||||
static a_s3: number;
|
||||
/** p1 is property of c1 */
|
||||
b_p1: number;
|
||||
/** sum with property */
|
||||
b_p2(b: number): number;
|
||||
/** getter property */
|
||||
/** setter property */
|
||||
b_p3: number;
|
||||
/** pp1 is property of c1 */
|
||||
private b_pp1;
|
||||
/** sum with property */
|
||||
private b_pp2(b);
|
||||
/** getter property */
|
||||
/** setter property */
|
||||
private b_pp3;
|
||||
/** s1 is static property of c1 */
|
||||
static b_s1: number;
|
||||
/** static sum with property */
|
||||
static b_s2(b: number): number;
|
||||
/** static getter property
|
||||
*/
|
||||
/** setter property
|
||||
*/
|
||||
static b_s3: number;
|
||||
}
|
||||
declare var i1: c1;
|
||||
declare var i1_p: number;
|
||||
declare var i1_f: (b: number) => number;
|
||||
declare var i1_r: number;
|
||||
declare var i1_prop: number;
|
||||
declare var i1_nc_p: number;
|
||||
declare var i1_ncf: (b: number) => number;
|
||||
declare var i1_ncr: number;
|
||||
declare var i1_ncprop: number;
|
||||
declare var i1_s_p: number;
|
||||
declare var i1_s_f: typeof s2;
|
||||
~~
|
||||
!!! Cannot find name 's2'.
|
||||
declare var i1_s_r: number;
|
||||
declare var i1_s_prop: number;
|
||||
declare var i1_s_nc_p: number;
|
||||
declare var i1_s_ncf: typeof nc_s2;
|
||||
~~~~~
|
||||
!!! Cannot find name 'nc_s2'.
|
||||
declare var i1_s_ncr: number;
|
||||
declare var i1_s_ncprop: number;
|
||||
declare var i1_c: typeof c1;
|
||||
declare class cProperties {
|
||||
private val;
|
||||
/** getter only property*/
|
||||
p1: number;
|
||||
nc_p1: number;
|
||||
/**setter only property*/
|
||||
p2: number;
|
||||
nc_p2: number;
|
||||
x: number;
|
||||
private y;
|
||||
}
|
||||
declare var cProperties_i: cProperties;
|
||||
|
||||
15
tests/baselines/reference/errorWithTruncatedType.errors.txt
Normal file
15
tests/baselines/reference/errorWithTruncatedType.errors.txt
Normal file
@@ -0,0 +1,15 @@
|
||||
==== tests/cases/compiler/errorWithTruncatedType.ts (1 errors) ====
|
||||
|
||||
var x: {
|
||||
propertyWithAnExceedinglyLongName1: string;
|
||||
propertyWithAnExceedinglyLongName2: string;
|
||||
propertyWithAnExceedinglyLongName3: string;
|
||||
propertyWithAnExceedinglyLongName4: string;
|
||||
propertyWithAnExceedinglyLongName5: string;
|
||||
};
|
||||
|
||||
// String representation of type of 'x' should be truncated in error message
|
||||
var s: string = x;
|
||||
~
|
||||
!!! Type '{ propertyWithAnExceedinglyLongName1: string; propertyWithAnExceedinglyLongName2: string; propert...' is not assignable to type 'string'.
|
||||
|
||||
18
tests/baselines/reference/errorWithTruncatedType.js
Normal file
18
tests/baselines/reference/errorWithTruncatedType.js
Normal file
@@ -0,0 +1,18 @@
|
||||
//// [errorWithTruncatedType.ts]
|
||||
|
||||
var x: {
|
||||
propertyWithAnExceedinglyLongName1: string;
|
||||
propertyWithAnExceedinglyLongName2: string;
|
||||
propertyWithAnExceedinglyLongName3: string;
|
||||
propertyWithAnExceedinglyLongName4: string;
|
||||
propertyWithAnExceedinglyLongName5: string;
|
||||
};
|
||||
|
||||
// String representation of type of 'x' should be truncated in error message
|
||||
var s: string = x;
|
||||
|
||||
|
||||
//// [errorWithTruncatedType.js]
|
||||
var x;
|
||||
// String representation of type of 'x' should be truncated in error message
|
||||
var s = x;
|
||||
@@ -10,9 +10,9 @@
|
||||
// more args not allowed
|
||||
var r2 = foo({ cb: <T>(x: T, y: T) => '' }); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Argument of type '{ cb: <T>(x: T, y: T) => string; }' is not assignable to parameter of type '{ cb: (t: any) => string; }'.
|
||||
!!! Argument of type '{ cb: <T>(x: T, y: T) => string; }' is not assignable to parameter of type '{ cb: (t: {}) => string; }'.
|
||||
!!! Types of property 'cb' are incompatible:
|
||||
!!! Type '<T>(x: T, y: T) => string' is not assignable to type '(t: any) => string'.
|
||||
!!! Type '<T>(x: T, y: T) => string' is not assignable to type '(t: {}) => string'.
|
||||
var r3 = foo({ cb: (x: string, y: number) => '' }); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Argument of type '{ cb: (x: string, y: number) => string; }' is not assignable to parameter of type '{ cb: (t: string) => string; }'.
|
||||
|
||||
@@ -20,10 +20,10 @@ declare function identity<V>(y: V): V;
|
||||
>V : V
|
||||
|
||||
var s = map("", () => { return { x: identity }; });
|
||||
>s : any
|
||||
>map("", () => { return { x: identity }; }) : any
|
||||
>s : string
|
||||
>map("", () => { return { x: identity }; }) : string
|
||||
>map : <T, U>(x: T, f: () => { x: (s: T) => U; }) => U
|
||||
>() => { return { x: identity }; } : () => { x: <V>(y: V) => V; }
|
||||
>() => { return { x: identity }; } : () => { x: (y: string) => string; }
|
||||
>{ x: identity } : { x: <V>(y: V) => V; }
|
||||
>x : <V>(y: V) => V
|
||||
>identity : <V>(y: V) => V
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
==== tests/cases/compiler/noImplicitAnyInCastExpression.ts (1 errors) ====
|
||||
|
||||
// verify no noImplictAny errors reported with cast expression
|
||||
|
||||
interface IFoo {
|
||||
a: number;
|
||||
b: string;
|
||||
}
|
||||
|
||||
// Expr type not assignable to target type
|
||||
(<IFoo>{ a: null });
|
||||
|
||||
// Expr type assignable to target type
|
||||
(<IFoo>{ a: 2, b: undefined });
|
||||
|
||||
// Neither types is assignable to each other
|
||||
(<IFoo>{ c: null });
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! Neither type '{ c: null; }' nor type 'IFoo' is assignable to the other:
|
||||
!!! Property 'a' is missing in type '{ c: null; }'.
|
||||
26
tests/baselines/reference/noImplicitAnyInCastExpression.js
Normal file
26
tests/baselines/reference/noImplicitAnyInCastExpression.js
Normal file
@@ -0,0 +1,26 @@
|
||||
//// [noImplicitAnyInCastExpression.ts]
|
||||
|
||||
// verify no noImplictAny errors reported with cast expression
|
||||
|
||||
interface IFoo {
|
||||
a: number;
|
||||
b: string;
|
||||
}
|
||||
|
||||
// Expr type not assignable to target type
|
||||
(<IFoo>{ a: null });
|
||||
|
||||
// Expr type assignable to target type
|
||||
(<IFoo>{ a: 2, b: undefined });
|
||||
|
||||
// Neither types is assignable to each other
|
||||
(<IFoo>{ c: null });
|
||||
|
||||
//// [noImplicitAnyInCastExpression.js]
|
||||
// verify no noImplictAny errors reported with cast expression
|
||||
// Expr type not assignable to target type
|
||||
{ a: null };
|
||||
// Expr type assignable to target type
|
||||
{ a: 2, b: undefined };
|
||||
// Neither types is assignable to each other
|
||||
{ c: null };
|
||||
@@ -2,5 +2,5 @@
|
||||
function =>
|
||||
~~
|
||||
!!! Identifier expected.
|
||||
|
||||
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
@@ -8,5 +8,5 @@
|
||||
!!! ',' expected.
|
||||
|
||||
!!! ')' expected.
|
||||
|
||||
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
@@ -1,4 +1,4 @@
|
||||
==== tests/cases/conformance/parser/ecmascript5/VariableDeclarations/parserVariableDeclaration6.ts (1 errors) ====
|
||||
var
|
||||
|
||||
~~~
|
||||
!!! Variable declaration list cannot be empty.
|
||||
@@ -1,4 +1,4 @@
|
||||
==== tests/cases/conformance/parser/ecmascript5/VariableDeclarations/parserVariableDeclaration8.ts (1 errors) ====
|
||||
var ;
|
||||
|
||||
~~~~~
|
||||
!!! Variable declaration list cannot be empty.
|
||||
@@ -3,8 +3,8 @@ class C {
|
||||
>C : C
|
||||
|
||||
static g(t: typeof C.g){ }
|
||||
>g : (t: typeof g) => void
|
||||
>t : (t: typeof g) => void
|
||||
>g : (t: typeof C.g) => void
|
||||
>t : (t: typeof C.g) => void
|
||||
>C : typeof C
|
||||
>g : (t: typeof g) => void
|
||||
>g : (t: typeof C.g) => void
|
||||
}
|
||||
|
||||
12
tests/cases/compiler/errorWithTruncatedType.ts
Normal file
12
tests/cases/compiler/errorWithTruncatedType.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
// @errortruncation: true
|
||||
|
||||
var x: {
|
||||
propertyWithAnExceedinglyLongName1: string;
|
||||
propertyWithAnExceedinglyLongName2: string;
|
||||
propertyWithAnExceedinglyLongName3: string;
|
||||
propertyWithAnExceedinglyLongName4: string;
|
||||
propertyWithAnExceedinglyLongName5: string;
|
||||
};
|
||||
|
||||
// String representation of type of 'x' should be truncated in error message
|
||||
var s: string = x;
|
||||
17
tests/cases/compiler/noImplicitAnyInCastExpression.ts
Normal file
17
tests/cases/compiler/noImplicitAnyInCastExpression.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
//@noImplicitAny: true
|
||||
|
||||
// verify no noImplictAny errors reported with cast expression
|
||||
|
||||
interface IFoo {
|
||||
a: number;
|
||||
b: string;
|
||||
}
|
||||
|
||||
// Expr type not assignable to target type
|
||||
(<IFoo>{ a: null });
|
||||
|
||||
// Expr type assignable to target type
|
||||
(<IFoo>{ a: 2, b: undefined });
|
||||
|
||||
// Neither types is assignable to each other
|
||||
(<IFoo>{ c: null });
|
||||
@@ -227,11 +227,15 @@ function handleRequestOperation(req: http.ServerRequest, res: http.ServerRespons
|
||||
send('success', res, null);
|
||||
break;
|
||||
case RequestType.DeleteFile:
|
||||
fs.unlinkSync(reqPath);
|
||||
if (fs.existsSync(reqPath)) {
|
||||
fs.unlinkSync(reqPath);
|
||||
}
|
||||
send('success', res, null);
|
||||
break;
|
||||
case RequestType.DeleteDir:
|
||||
fs.rmdirSync(reqPath);
|
||||
if (fs.existsSync(reqPath)) {
|
||||
fs.rmdirSync(reqPath);
|
||||
}
|
||||
send('success', res, null);
|
||||
break;
|
||||
case RequestType.AppendFile:
|
||||
|
||||
Reference in New Issue
Block a user