Accepts baselines

This commit is contained in:
Tingan Ho 2015-07-07 11:11:56 +08:00
parent 951084fc85
commit 08a7744254
3 changed files with 44 additions and 18 deletions

View file

@ -26,6 +26,10 @@ export function fooWithSingleOverload(a: any) {
return a;
}
export function fooWithTypePredicate(a: any): a is number {
return true;
}
/** This comment should appear for nonExportedFoo*/
function nonExportedFoo() {
}
@ -92,6 +96,10 @@ function fooWithSingleOverload(a) {
return a;
}
exports.fooWithSingleOverload = fooWithSingleOverload;
function fooWithTypePredicate(a) {
return true;
}
exports.fooWithTypePredicate = fooWithTypePredicate;
/** This comment should appear for nonExportedFoo*/
function nonExportedFoo() {
}
@ -144,6 +152,7 @@ export declare function fooWithRestParameters(a: string, ...rests: string[]): st
export declare function fooWithOverloads(a: string): string;
export declare function fooWithOverloads(a: number): number;
export declare function fooWithSingleOverload(a: string): string;
export declare function fooWithTypePredicate(a: any): a is number;
//// [declFileFunctions_1.d.ts]
/** This comment should appear for foo*/
declare function globalfoo(): void;

View file

@ -57,49 +57,57 @@ export function fooWithSingleOverload(a: any) {
>a : Symbol(a, Decl(declFileFunctions_0.ts, 21, 38))
}
export function fooWithTypePredicate(a: any): a is number {
>fooWithTypePredicate : Symbol(fooWithTypePredicate, Decl(declFileFunctions_0.ts, 23, 1))
>a : Symbol(a, Decl(declFileFunctions_0.ts, 25, 37))
>a : Symbol(a, Decl(declFileFunctions_0.ts, 25, 37))
return true;
}
/** This comment should appear for nonExportedFoo*/
function nonExportedFoo() {
>nonExportedFoo : Symbol(nonExportedFoo, Decl(declFileFunctions_0.ts, 23, 1))
>nonExportedFoo : Symbol(nonExportedFoo, Decl(declFileFunctions_0.ts, 27, 1))
}
/** This is comment for function signature*/
function nonExportedFooWithParameters(/** this is comment about a*/a: string,
>nonExportedFooWithParameters : Symbol(nonExportedFooWithParameters, Decl(declFileFunctions_0.ts, 27, 1))
>a : Symbol(a, Decl(declFileFunctions_0.ts, 29, 38))
>nonExportedFooWithParameters : Symbol(nonExportedFooWithParameters, Decl(declFileFunctions_0.ts, 31, 1))
>a : Symbol(a, Decl(declFileFunctions_0.ts, 33, 38))
/** this is comment for b*/
b: number) {
>b : Symbol(b, Decl(declFileFunctions_0.ts, 29, 77))
>b : Symbol(b, Decl(declFileFunctions_0.ts, 33, 77))
var d = a;
>d : Symbol(d, Decl(declFileFunctions_0.ts, 32, 7))
>a : Symbol(a, Decl(declFileFunctions_0.ts, 29, 38))
>d : Symbol(d, Decl(declFileFunctions_0.ts, 36, 7))
>a : Symbol(a, Decl(declFileFunctions_0.ts, 33, 38))
}
function nonExportedFooWithRestParameters(a: string, ...rests: string[]) {
>nonExportedFooWithRestParameters : Symbol(nonExportedFooWithRestParameters, Decl(declFileFunctions_0.ts, 33, 1))
>a : Symbol(a, Decl(declFileFunctions_0.ts, 34, 42))
>rests : Symbol(rests, Decl(declFileFunctions_0.ts, 34, 52))
>nonExportedFooWithRestParameters : Symbol(nonExportedFooWithRestParameters, Decl(declFileFunctions_0.ts, 37, 1))
>a : Symbol(a, Decl(declFileFunctions_0.ts, 38, 42))
>rests : Symbol(rests, Decl(declFileFunctions_0.ts, 38, 52))
return a + rests.join("");
>a : Symbol(a, Decl(declFileFunctions_0.ts, 34, 42))
>a : Symbol(a, Decl(declFileFunctions_0.ts, 38, 42))
>rests.join : Symbol(Array.join, Decl(lib.d.ts, 1035, 31))
>rests : Symbol(rests, Decl(declFileFunctions_0.ts, 34, 52))
>rests : Symbol(rests, Decl(declFileFunctions_0.ts, 38, 52))
>join : Symbol(Array.join, Decl(lib.d.ts, 1035, 31))
}
function nonExportedFooWithOverloads(a: string): string;
>nonExportedFooWithOverloads : Symbol(nonExportedFooWithOverloads, Decl(declFileFunctions_0.ts, 36, 1), Decl(declFileFunctions_0.ts, 38, 56), Decl(declFileFunctions_0.ts, 39, 56))
>a : Symbol(a, Decl(declFileFunctions_0.ts, 38, 37))
>nonExportedFooWithOverloads : Symbol(nonExportedFooWithOverloads, Decl(declFileFunctions_0.ts, 40, 1), Decl(declFileFunctions_0.ts, 42, 56), Decl(declFileFunctions_0.ts, 43, 56))
>a : Symbol(a, Decl(declFileFunctions_0.ts, 42, 37))
function nonExportedFooWithOverloads(a: number): number;
>nonExportedFooWithOverloads : Symbol(nonExportedFooWithOverloads, Decl(declFileFunctions_0.ts, 36, 1), Decl(declFileFunctions_0.ts, 38, 56), Decl(declFileFunctions_0.ts, 39, 56))
>a : Symbol(a, Decl(declFileFunctions_0.ts, 39, 37))
>nonExportedFooWithOverloads : Symbol(nonExportedFooWithOverloads, Decl(declFileFunctions_0.ts, 40, 1), Decl(declFileFunctions_0.ts, 42, 56), Decl(declFileFunctions_0.ts, 43, 56))
>a : Symbol(a, Decl(declFileFunctions_0.ts, 43, 37))
function nonExportedFooWithOverloads(a: any): any {
>nonExportedFooWithOverloads : Symbol(nonExportedFooWithOverloads, Decl(declFileFunctions_0.ts, 36, 1), Decl(declFileFunctions_0.ts, 38, 56), Decl(declFileFunctions_0.ts, 39, 56))
>a : Symbol(a, Decl(declFileFunctions_0.ts, 40, 37))
>nonExportedFooWithOverloads : Symbol(nonExportedFooWithOverloads, Decl(declFileFunctions_0.ts, 40, 1), Decl(declFileFunctions_0.ts, 42, 56), Decl(declFileFunctions_0.ts, 43, 56))
>a : Symbol(a, Decl(declFileFunctions_0.ts, 44, 37))
return a;
>a : Symbol(a, Decl(declFileFunctions_0.ts, 40, 37))
>a : Symbol(a, Decl(declFileFunctions_0.ts, 44, 37))
}
=== tests/cases/compiler/declFileFunctions_1.ts ===

View file

@ -60,6 +60,15 @@ export function fooWithSingleOverload(a: any) {
>a : any
}
export function fooWithTypePredicate(a: any): a is number {
>fooWithTypePredicate : (a: any) => boolean
>a : any
>a : any
return true;
>true : boolean
}
/** This comment should appear for nonExportedFoo*/
function nonExportedFoo() {
>nonExportedFoo : () => void