mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-22 02:35:48 -05:00
Merge branch 'master' into Fix8415
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
//// [asyncFunctionsAndStrictNullChecks.ts]
|
||||
|
||||
declare namespace Windows.Foundation {
|
||||
interface IPromise<TResult> {
|
||||
then<U>(success?: (value: TResult) => IPromise<U>, error?: (error: any) => IPromise<U>, progress?: (progress: any) => void): IPromise<U>;
|
||||
then<U>(success?: (value: TResult) => IPromise<U>, error?: (error: any) => U, progress?: (progress: any) => void): IPromise<U>;
|
||||
then<U>(success?: (value: TResult) => U, error?: (error: any) => IPromise<U>, progress?: (progress: any) => void): IPromise<U>;
|
||||
then<U>(success?: (value: TResult) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise<U>;
|
||||
done<U>(success?: (value: TResult) => any, error?: (error: any) => any, progress?: (progress: any) => void): void;
|
||||
|
||||
cancel(): void;
|
||||
}
|
||||
}
|
||||
|
||||
async function sample(promise: Windows.Foundation.IPromise<number>) {
|
||||
var number = await promise;
|
||||
}
|
||||
|
||||
|
||||
declare function resolve1<T>(value: T): Promise<T>;
|
||||
declare function resolve2<T>(value: T): Windows.Foundation.IPromise<T>;
|
||||
|
||||
async function sample2(x?: number) {
|
||||
let x1 = await resolve1(x);
|
||||
let x2 = await resolve2(x);
|
||||
}
|
||||
|
||||
|
||||
//// [asyncFunctionsAndStrictNullChecks.js]
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments)).next());
|
||||
});
|
||||
};
|
||||
function sample(promise) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
var number = yield promise;
|
||||
});
|
||||
}
|
||||
function sample2(x) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let x1 = yield resolve1(x);
|
||||
let x2 = yield resolve2(x);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
=== tests/cases/compiler/asyncFunctionsAndStrictNullChecks.ts ===
|
||||
|
||||
declare namespace Windows.Foundation {
|
||||
>Windows : Symbol(Windows, Decl(asyncFunctionsAndStrictNullChecks.ts, 0, 0))
|
||||
>Foundation : Symbol(Foundation, Decl(asyncFunctionsAndStrictNullChecks.ts, 1, 26))
|
||||
|
||||
interface IPromise<TResult> {
|
||||
>IPromise : Symbol(IPromise, Decl(asyncFunctionsAndStrictNullChecks.ts, 1, 38))
|
||||
>TResult : Symbol(TResult, Decl(asyncFunctionsAndStrictNullChecks.ts, 2, 23))
|
||||
|
||||
then<U>(success?: (value: TResult) => IPromise<U>, error?: (error: any) => IPromise<U>, progress?: (progress: any) => void): IPromise<U>;
|
||||
>then : Symbol(IPromise.then, Decl(asyncFunctionsAndStrictNullChecks.ts, 2, 33), Decl(asyncFunctionsAndStrictNullChecks.ts, 3, 145), Decl(asyncFunctionsAndStrictNullChecks.ts, 4, 135), Decl(asyncFunctionsAndStrictNullChecks.ts, 5, 135))
|
||||
>U : Symbol(U, Decl(asyncFunctionsAndStrictNullChecks.ts, 3, 13))
|
||||
>success : Symbol(success, Decl(asyncFunctionsAndStrictNullChecks.ts, 3, 16))
|
||||
>value : Symbol(value, Decl(asyncFunctionsAndStrictNullChecks.ts, 3, 27))
|
||||
>TResult : Symbol(TResult, Decl(asyncFunctionsAndStrictNullChecks.ts, 2, 23))
|
||||
>IPromise : Symbol(IPromise, Decl(asyncFunctionsAndStrictNullChecks.ts, 1, 38))
|
||||
>U : Symbol(U, Decl(asyncFunctionsAndStrictNullChecks.ts, 3, 13))
|
||||
>error : Symbol(error, Decl(asyncFunctionsAndStrictNullChecks.ts, 3, 58))
|
||||
>error : Symbol(error, Decl(asyncFunctionsAndStrictNullChecks.ts, 3, 68))
|
||||
>IPromise : Symbol(IPromise, Decl(asyncFunctionsAndStrictNullChecks.ts, 1, 38))
|
||||
>U : Symbol(U, Decl(asyncFunctionsAndStrictNullChecks.ts, 3, 13))
|
||||
>progress : Symbol(progress, Decl(asyncFunctionsAndStrictNullChecks.ts, 3, 95))
|
||||
>progress : Symbol(progress, Decl(asyncFunctionsAndStrictNullChecks.ts, 3, 108))
|
||||
>IPromise : Symbol(IPromise, Decl(asyncFunctionsAndStrictNullChecks.ts, 1, 38))
|
||||
>U : Symbol(U, Decl(asyncFunctionsAndStrictNullChecks.ts, 3, 13))
|
||||
|
||||
then<U>(success?: (value: TResult) => IPromise<U>, error?: (error: any) => U, progress?: (progress: any) => void): IPromise<U>;
|
||||
>then : Symbol(IPromise.then, Decl(asyncFunctionsAndStrictNullChecks.ts, 2, 33), Decl(asyncFunctionsAndStrictNullChecks.ts, 3, 145), Decl(asyncFunctionsAndStrictNullChecks.ts, 4, 135), Decl(asyncFunctionsAndStrictNullChecks.ts, 5, 135))
|
||||
>U : Symbol(U, Decl(asyncFunctionsAndStrictNullChecks.ts, 4, 13))
|
||||
>success : Symbol(success, Decl(asyncFunctionsAndStrictNullChecks.ts, 4, 16))
|
||||
>value : Symbol(value, Decl(asyncFunctionsAndStrictNullChecks.ts, 4, 27))
|
||||
>TResult : Symbol(TResult, Decl(asyncFunctionsAndStrictNullChecks.ts, 2, 23))
|
||||
>IPromise : Symbol(IPromise, Decl(asyncFunctionsAndStrictNullChecks.ts, 1, 38))
|
||||
>U : Symbol(U, Decl(asyncFunctionsAndStrictNullChecks.ts, 4, 13))
|
||||
>error : Symbol(error, Decl(asyncFunctionsAndStrictNullChecks.ts, 4, 58))
|
||||
>error : Symbol(error, Decl(asyncFunctionsAndStrictNullChecks.ts, 4, 68))
|
||||
>U : Symbol(U, Decl(asyncFunctionsAndStrictNullChecks.ts, 4, 13))
|
||||
>progress : Symbol(progress, Decl(asyncFunctionsAndStrictNullChecks.ts, 4, 85))
|
||||
>progress : Symbol(progress, Decl(asyncFunctionsAndStrictNullChecks.ts, 4, 98))
|
||||
>IPromise : Symbol(IPromise, Decl(asyncFunctionsAndStrictNullChecks.ts, 1, 38))
|
||||
>U : Symbol(U, Decl(asyncFunctionsAndStrictNullChecks.ts, 4, 13))
|
||||
|
||||
then<U>(success?: (value: TResult) => U, error?: (error: any) => IPromise<U>, progress?: (progress: any) => void): IPromise<U>;
|
||||
>then : Symbol(IPromise.then, Decl(asyncFunctionsAndStrictNullChecks.ts, 2, 33), Decl(asyncFunctionsAndStrictNullChecks.ts, 3, 145), Decl(asyncFunctionsAndStrictNullChecks.ts, 4, 135), Decl(asyncFunctionsAndStrictNullChecks.ts, 5, 135))
|
||||
>U : Symbol(U, Decl(asyncFunctionsAndStrictNullChecks.ts, 5, 13))
|
||||
>success : Symbol(success, Decl(asyncFunctionsAndStrictNullChecks.ts, 5, 16))
|
||||
>value : Symbol(value, Decl(asyncFunctionsAndStrictNullChecks.ts, 5, 27))
|
||||
>TResult : Symbol(TResult, Decl(asyncFunctionsAndStrictNullChecks.ts, 2, 23))
|
||||
>U : Symbol(U, Decl(asyncFunctionsAndStrictNullChecks.ts, 5, 13))
|
||||
>error : Symbol(error, Decl(asyncFunctionsAndStrictNullChecks.ts, 5, 48))
|
||||
>error : Symbol(error, Decl(asyncFunctionsAndStrictNullChecks.ts, 5, 58))
|
||||
>IPromise : Symbol(IPromise, Decl(asyncFunctionsAndStrictNullChecks.ts, 1, 38))
|
||||
>U : Symbol(U, Decl(asyncFunctionsAndStrictNullChecks.ts, 5, 13))
|
||||
>progress : Symbol(progress, Decl(asyncFunctionsAndStrictNullChecks.ts, 5, 85))
|
||||
>progress : Symbol(progress, Decl(asyncFunctionsAndStrictNullChecks.ts, 5, 98))
|
||||
>IPromise : Symbol(IPromise, Decl(asyncFunctionsAndStrictNullChecks.ts, 1, 38))
|
||||
>U : Symbol(U, Decl(asyncFunctionsAndStrictNullChecks.ts, 5, 13))
|
||||
|
||||
then<U>(success?: (value: TResult) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise<U>;
|
||||
>then : Symbol(IPromise.then, Decl(asyncFunctionsAndStrictNullChecks.ts, 2, 33), Decl(asyncFunctionsAndStrictNullChecks.ts, 3, 145), Decl(asyncFunctionsAndStrictNullChecks.ts, 4, 135), Decl(asyncFunctionsAndStrictNullChecks.ts, 5, 135))
|
||||
>U : Symbol(U, Decl(asyncFunctionsAndStrictNullChecks.ts, 6, 13))
|
||||
>success : Symbol(success, Decl(asyncFunctionsAndStrictNullChecks.ts, 6, 16))
|
||||
>value : Symbol(value, Decl(asyncFunctionsAndStrictNullChecks.ts, 6, 27))
|
||||
>TResult : Symbol(TResult, Decl(asyncFunctionsAndStrictNullChecks.ts, 2, 23))
|
||||
>U : Symbol(U, Decl(asyncFunctionsAndStrictNullChecks.ts, 6, 13))
|
||||
>error : Symbol(error, Decl(asyncFunctionsAndStrictNullChecks.ts, 6, 48))
|
||||
>error : Symbol(error, Decl(asyncFunctionsAndStrictNullChecks.ts, 6, 58))
|
||||
>U : Symbol(U, Decl(asyncFunctionsAndStrictNullChecks.ts, 6, 13))
|
||||
>progress : Symbol(progress, Decl(asyncFunctionsAndStrictNullChecks.ts, 6, 75))
|
||||
>progress : Symbol(progress, Decl(asyncFunctionsAndStrictNullChecks.ts, 6, 88))
|
||||
>IPromise : Symbol(IPromise, Decl(asyncFunctionsAndStrictNullChecks.ts, 1, 38))
|
||||
>U : Symbol(U, Decl(asyncFunctionsAndStrictNullChecks.ts, 6, 13))
|
||||
|
||||
done<U>(success?: (value: TResult) => any, error?: (error: any) => any, progress?: (progress: any) => void): void;
|
||||
>done : Symbol(IPromise.done, Decl(asyncFunctionsAndStrictNullChecks.ts, 6, 125))
|
||||
>U : Symbol(U, Decl(asyncFunctionsAndStrictNullChecks.ts, 7, 13))
|
||||
>success : Symbol(success, Decl(asyncFunctionsAndStrictNullChecks.ts, 7, 16))
|
||||
>value : Symbol(value, Decl(asyncFunctionsAndStrictNullChecks.ts, 7, 27))
|
||||
>TResult : Symbol(TResult, Decl(asyncFunctionsAndStrictNullChecks.ts, 2, 23))
|
||||
>error : Symbol(error, Decl(asyncFunctionsAndStrictNullChecks.ts, 7, 50))
|
||||
>error : Symbol(error, Decl(asyncFunctionsAndStrictNullChecks.ts, 7, 60))
|
||||
>progress : Symbol(progress, Decl(asyncFunctionsAndStrictNullChecks.ts, 7, 79))
|
||||
>progress : Symbol(progress, Decl(asyncFunctionsAndStrictNullChecks.ts, 7, 92))
|
||||
|
||||
cancel(): void;
|
||||
>cancel : Symbol(IPromise.cancel, Decl(asyncFunctionsAndStrictNullChecks.ts, 7, 122))
|
||||
}
|
||||
}
|
||||
|
||||
async function sample(promise: Windows.Foundation.IPromise<number>) {
|
||||
>sample : Symbol(sample, Decl(asyncFunctionsAndStrictNullChecks.ts, 11, 1))
|
||||
>promise : Symbol(promise, Decl(asyncFunctionsAndStrictNullChecks.ts, 13, 22))
|
||||
>Windows : Symbol(Windows, Decl(asyncFunctionsAndStrictNullChecks.ts, 0, 0))
|
||||
>Foundation : Symbol(Windows.Foundation, Decl(asyncFunctionsAndStrictNullChecks.ts, 1, 26))
|
||||
>IPromise : Symbol(Windows.Foundation.IPromise, Decl(asyncFunctionsAndStrictNullChecks.ts, 1, 38))
|
||||
|
||||
var number = await promise;
|
||||
>number : Symbol(number, Decl(asyncFunctionsAndStrictNullChecks.ts, 14, 7))
|
||||
>promise : Symbol(promise, Decl(asyncFunctionsAndStrictNullChecks.ts, 13, 22))
|
||||
}
|
||||
|
||||
|
||||
declare function resolve1<T>(value: T): Promise<T>;
|
||||
>resolve1 : Symbol(resolve1, Decl(asyncFunctionsAndStrictNullChecks.ts, 15, 1))
|
||||
>T : Symbol(T, Decl(asyncFunctionsAndStrictNullChecks.ts, 18, 26))
|
||||
>value : Symbol(value, Decl(asyncFunctionsAndStrictNullChecks.ts, 18, 29))
|
||||
>T : Symbol(T, Decl(asyncFunctionsAndStrictNullChecks.ts, 18, 26))
|
||||
>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
|
||||
>T : Symbol(T, Decl(asyncFunctionsAndStrictNullChecks.ts, 18, 26))
|
||||
|
||||
declare function resolve2<T>(value: T): Windows.Foundation.IPromise<T>;
|
||||
>resolve2 : Symbol(resolve2, Decl(asyncFunctionsAndStrictNullChecks.ts, 18, 51))
|
||||
>T : Symbol(T, Decl(asyncFunctionsAndStrictNullChecks.ts, 19, 26))
|
||||
>value : Symbol(value, Decl(asyncFunctionsAndStrictNullChecks.ts, 19, 29))
|
||||
>T : Symbol(T, Decl(asyncFunctionsAndStrictNullChecks.ts, 19, 26))
|
||||
>Windows : Symbol(Windows, Decl(asyncFunctionsAndStrictNullChecks.ts, 0, 0))
|
||||
>Foundation : Symbol(Windows.Foundation, Decl(asyncFunctionsAndStrictNullChecks.ts, 1, 26))
|
||||
>IPromise : Symbol(Windows.Foundation.IPromise, Decl(asyncFunctionsAndStrictNullChecks.ts, 1, 38))
|
||||
>T : Symbol(T, Decl(asyncFunctionsAndStrictNullChecks.ts, 19, 26))
|
||||
|
||||
async function sample2(x?: number) {
|
||||
>sample2 : Symbol(sample2, Decl(asyncFunctionsAndStrictNullChecks.ts, 19, 71))
|
||||
>x : Symbol(x, Decl(asyncFunctionsAndStrictNullChecks.ts, 21, 23))
|
||||
|
||||
let x1 = await resolve1(x);
|
||||
>x1 : Symbol(x1, Decl(asyncFunctionsAndStrictNullChecks.ts, 22, 7))
|
||||
>resolve1 : Symbol(resolve1, Decl(asyncFunctionsAndStrictNullChecks.ts, 15, 1))
|
||||
>x : Symbol(x, Decl(asyncFunctionsAndStrictNullChecks.ts, 21, 23))
|
||||
|
||||
let x2 = await resolve2(x);
|
||||
>x2 : Symbol(x2, Decl(asyncFunctionsAndStrictNullChecks.ts, 23, 7))
|
||||
>resolve2 : Symbol(resolve2, Decl(asyncFunctionsAndStrictNullChecks.ts, 18, 51))
|
||||
>x : Symbol(x, Decl(asyncFunctionsAndStrictNullChecks.ts, 21, 23))
|
||||
}
|
||||
|
||||
@@ -0,0 +1,141 @@
|
||||
=== tests/cases/compiler/asyncFunctionsAndStrictNullChecks.ts ===
|
||||
|
||||
declare namespace Windows.Foundation {
|
||||
>Windows : any
|
||||
>Foundation : any
|
||||
|
||||
interface IPromise<TResult> {
|
||||
>IPromise : IPromise<TResult>
|
||||
>TResult : TResult
|
||||
|
||||
then<U>(success?: (value: TResult) => IPromise<U>, error?: (error: any) => IPromise<U>, progress?: (progress: any) => void): IPromise<U>;
|
||||
>then : { <U>(success?: ((value: TResult) => IPromise<U>) | undefined, error?: ((error: any) => IPromise<U>) | undefined, progress?: ((progress: any) => void) | undefined): IPromise<U>; <U>(success?: ((value: TResult) => IPromise<U>) | undefined, error?: ((error: any) => U) | undefined, progress?: ((progress: any) => void) | undefined): IPromise<U>; <U>(success?: ((value: TResult) => U) | undefined, error?: ((error: any) => IPromise<U>) | undefined, progress?: ((progress: any) => void) | undefined): IPromise<U>; <U>(success?: ((value: TResult) => U) | undefined, error?: ((error: any) => U) | undefined, progress?: ((progress: any) => void) | undefined): IPromise<U>; }
|
||||
>U : U
|
||||
>success : ((value: TResult) => IPromise<U>) | undefined
|
||||
>value : TResult
|
||||
>TResult : TResult
|
||||
>IPromise : IPromise<TResult>
|
||||
>U : U
|
||||
>error : ((error: any) => IPromise<U>) | undefined
|
||||
>error : any
|
||||
>IPromise : IPromise<TResult>
|
||||
>U : U
|
||||
>progress : ((progress: any) => void) | undefined
|
||||
>progress : any
|
||||
>IPromise : IPromise<TResult>
|
||||
>U : U
|
||||
|
||||
then<U>(success?: (value: TResult) => IPromise<U>, error?: (error: any) => U, progress?: (progress: any) => void): IPromise<U>;
|
||||
>then : { <U>(success?: ((value: TResult) => IPromise<U>) | undefined, error?: ((error: any) => IPromise<U>) | undefined, progress?: ((progress: any) => void) | undefined): IPromise<U>; <U>(success?: ((value: TResult) => IPromise<U>) | undefined, error?: ((error: any) => U) | undefined, progress?: ((progress: any) => void) | undefined): IPromise<U>; <U>(success?: ((value: TResult) => U) | undefined, error?: ((error: any) => IPromise<U>) | undefined, progress?: ((progress: any) => void) | undefined): IPromise<U>; <U>(success?: ((value: TResult) => U) | undefined, error?: ((error: any) => U) | undefined, progress?: ((progress: any) => void) | undefined): IPromise<U>; }
|
||||
>U : U
|
||||
>success : ((value: TResult) => IPromise<U>) | undefined
|
||||
>value : TResult
|
||||
>TResult : TResult
|
||||
>IPromise : IPromise<TResult>
|
||||
>U : U
|
||||
>error : ((error: any) => U) | undefined
|
||||
>error : any
|
||||
>U : U
|
||||
>progress : ((progress: any) => void) | undefined
|
||||
>progress : any
|
||||
>IPromise : IPromise<TResult>
|
||||
>U : U
|
||||
|
||||
then<U>(success?: (value: TResult) => U, error?: (error: any) => IPromise<U>, progress?: (progress: any) => void): IPromise<U>;
|
||||
>then : { <U>(success?: ((value: TResult) => IPromise<U>) | undefined, error?: ((error: any) => IPromise<U>) | undefined, progress?: ((progress: any) => void) | undefined): IPromise<U>; <U>(success?: ((value: TResult) => IPromise<U>) | undefined, error?: ((error: any) => U) | undefined, progress?: ((progress: any) => void) | undefined): IPromise<U>; <U>(success?: ((value: TResult) => U) | undefined, error?: ((error: any) => IPromise<U>) | undefined, progress?: ((progress: any) => void) | undefined): IPromise<U>; <U>(success?: ((value: TResult) => U) | undefined, error?: ((error: any) => U) | undefined, progress?: ((progress: any) => void) | undefined): IPromise<U>; }
|
||||
>U : U
|
||||
>success : ((value: TResult) => U) | undefined
|
||||
>value : TResult
|
||||
>TResult : TResult
|
||||
>U : U
|
||||
>error : ((error: any) => IPromise<U>) | undefined
|
||||
>error : any
|
||||
>IPromise : IPromise<TResult>
|
||||
>U : U
|
||||
>progress : ((progress: any) => void) | undefined
|
||||
>progress : any
|
||||
>IPromise : IPromise<TResult>
|
||||
>U : U
|
||||
|
||||
then<U>(success?: (value: TResult) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise<U>;
|
||||
>then : { <U>(success?: ((value: TResult) => IPromise<U>) | undefined, error?: ((error: any) => IPromise<U>) | undefined, progress?: ((progress: any) => void) | undefined): IPromise<U>; <U>(success?: ((value: TResult) => IPromise<U>) | undefined, error?: ((error: any) => U) | undefined, progress?: ((progress: any) => void) | undefined): IPromise<U>; <U>(success?: ((value: TResult) => U) | undefined, error?: ((error: any) => IPromise<U>) | undefined, progress?: ((progress: any) => void) | undefined): IPromise<U>; <U>(success?: ((value: TResult) => U) | undefined, error?: ((error: any) => U) | undefined, progress?: ((progress: any) => void) | undefined): IPromise<U>; }
|
||||
>U : U
|
||||
>success : ((value: TResult) => U) | undefined
|
||||
>value : TResult
|
||||
>TResult : TResult
|
||||
>U : U
|
||||
>error : ((error: any) => U) | undefined
|
||||
>error : any
|
||||
>U : U
|
||||
>progress : ((progress: any) => void) | undefined
|
||||
>progress : any
|
||||
>IPromise : IPromise<TResult>
|
||||
>U : U
|
||||
|
||||
done<U>(success?: (value: TResult) => any, error?: (error: any) => any, progress?: (progress: any) => void): void;
|
||||
>done : <U>(success?: ((value: TResult) => any) | undefined, error?: ((error: any) => any) | undefined, progress?: ((progress: any) => void) | undefined) => void
|
||||
>U : U
|
||||
>success : ((value: TResult) => any) | undefined
|
||||
>value : TResult
|
||||
>TResult : TResult
|
||||
>error : ((error: any) => any) | undefined
|
||||
>error : any
|
||||
>progress : ((progress: any) => void) | undefined
|
||||
>progress : any
|
||||
|
||||
cancel(): void;
|
||||
>cancel : () => void
|
||||
}
|
||||
}
|
||||
|
||||
async function sample(promise: Windows.Foundation.IPromise<number>) {
|
||||
>sample : (promise: Windows.Foundation.IPromise<number>) => Promise<void>
|
||||
>promise : Windows.Foundation.IPromise<number>
|
||||
>Windows : any
|
||||
>Foundation : any
|
||||
>IPromise : Windows.Foundation.IPromise<TResult>
|
||||
|
||||
var number = await promise;
|
||||
>number : number
|
||||
>await promise : number
|
||||
>promise : Windows.Foundation.IPromise<number>
|
||||
}
|
||||
|
||||
|
||||
declare function resolve1<T>(value: T): Promise<T>;
|
||||
>resolve1 : <T>(value: T) => Promise<T>
|
||||
>T : T
|
||||
>value : T
|
||||
>T : T
|
||||
>Promise : Promise<T>
|
||||
>T : T
|
||||
|
||||
declare function resolve2<T>(value: T): Windows.Foundation.IPromise<T>;
|
||||
>resolve2 : <T>(value: T) => Windows.Foundation.IPromise<T>
|
||||
>T : T
|
||||
>value : T
|
||||
>T : T
|
||||
>Windows : any
|
||||
>Foundation : any
|
||||
>IPromise : Windows.Foundation.IPromise<TResult>
|
||||
>T : T
|
||||
|
||||
async function sample2(x?: number) {
|
||||
>sample2 : (x?: number | undefined) => Promise<void>
|
||||
>x : number | undefined
|
||||
|
||||
let x1 = await resolve1(x);
|
||||
>x1 : number | undefined
|
||||
>await resolve1(x) : number | undefined
|
||||
>resolve1(x) : Promise<number | undefined>
|
||||
>resolve1 : <T>(value: T) => Promise<T>
|
||||
>x : number | undefined
|
||||
|
||||
let x2 = await resolve2(x);
|
||||
>x2 : number | undefined
|
||||
>await resolve2(x) : number | undefined
|
||||
>resolve2(x) : Windows.Foundation.IPromise<number | undefined>
|
||||
>resolve2 : <T>(value: T) => Windows.Foundation.IPromise<T>
|
||||
>x : number | undefined
|
||||
}
|
||||
|
||||
84
tests/baselines/reference/equalityStrictNulls.errors.txt
Normal file
84
tests/baselines/reference/equalityStrictNulls.errors.txt
Normal file
@@ -0,0 +1,84 @@
|
||||
tests/cases/conformance/types/typeRelationships/comparable/equalityStrictNulls.ts(60,9): error TS2365: Operator '>' cannot be applied to types 'number' and 'undefined'.
|
||||
tests/cases/conformance/types/typeRelationships/comparable/equalityStrictNulls.ts(62,9): error TS2365: Operator '<' cannot be applied to types 'number' and 'undefined'.
|
||||
tests/cases/conformance/types/typeRelationships/comparable/equalityStrictNulls.ts(64,9): error TS2365: Operator '>=' cannot be applied to types 'number' and 'undefined'.
|
||||
tests/cases/conformance/types/typeRelationships/comparable/equalityStrictNulls.ts(66,9): error TS2365: Operator '<=' cannot be applied to types 'number' and 'undefined'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/typeRelationships/comparable/equalityStrictNulls.ts (4 errors) ====
|
||||
|
||||
function f1(x: string) {
|
||||
if (x == undefined) {
|
||||
}
|
||||
if (x != undefined) {
|
||||
}
|
||||
if (x === undefined) {
|
||||
}
|
||||
if (x !== undefined) {
|
||||
}
|
||||
if (x == null) {
|
||||
}
|
||||
if (x != null) {
|
||||
}
|
||||
if (x === null) {
|
||||
}
|
||||
if (x !== null) {
|
||||
}
|
||||
if (undefined == x) {
|
||||
}
|
||||
if (undefined != x) {
|
||||
}
|
||||
if (undefined === x) {
|
||||
}
|
||||
if (undefined !== x) {
|
||||
}
|
||||
if (null == x) {
|
||||
}
|
||||
if (null != x) {
|
||||
}
|
||||
if (null === x) {
|
||||
}
|
||||
if (null !== x) {
|
||||
}
|
||||
}
|
||||
|
||||
function f2() {
|
||||
if (undefined == undefined) {
|
||||
}
|
||||
if (undefined == null) {
|
||||
}
|
||||
if (null == undefined) {
|
||||
}
|
||||
if (null == null) {
|
||||
}
|
||||
}
|
||||
|
||||
function f3(a: number, b: boolean, c: { x: number }, d: number | string) {
|
||||
if (a == null) {
|
||||
}
|
||||
if (b == null) {
|
||||
}
|
||||
if (c == null) {
|
||||
}
|
||||
if (d == null) {
|
||||
}
|
||||
}
|
||||
|
||||
function f4(x: number) {
|
||||
if (x > undefined) {
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '>' cannot be applied to types 'number' and 'undefined'.
|
||||
}
|
||||
if (x < undefined) {
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types 'number' and 'undefined'.
|
||||
}
|
||||
if (x >= undefined) {
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '>=' cannot be applied to types 'number' and 'undefined'.
|
||||
}
|
||||
if (x <= undefined) {
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '<=' cannot be applied to types 'number' and 'undefined'.
|
||||
}
|
||||
}
|
||||
|
||||
136
tests/baselines/reference/equalityStrictNulls.js
Normal file
136
tests/baselines/reference/equalityStrictNulls.js
Normal file
@@ -0,0 +1,136 @@
|
||||
//// [equalityStrictNulls.ts]
|
||||
|
||||
function f1(x: string) {
|
||||
if (x == undefined) {
|
||||
}
|
||||
if (x != undefined) {
|
||||
}
|
||||
if (x === undefined) {
|
||||
}
|
||||
if (x !== undefined) {
|
||||
}
|
||||
if (x == null) {
|
||||
}
|
||||
if (x != null) {
|
||||
}
|
||||
if (x === null) {
|
||||
}
|
||||
if (x !== null) {
|
||||
}
|
||||
if (undefined == x) {
|
||||
}
|
||||
if (undefined != x) {
|
||||
}
|
||||
if (undefined === x) {
|
||||
}
|
||||
if (undefined !== x) {
|
||||
}
|
||||
if (null == x) {
|
||||
}
|
||||
if (null != x) {
|
||||
}
|
||||
if (null === x) {
|
||||
}
|
||||
if (null !== x) {
|
||||
}
|
||||
}
|
||||
|
||||
function f2() {
|
||||
if (undefined == undefined) {
|
||||
}
|
||||
if (undefined == null) {
|
||||
}
|
||||
if (null == undefined) {
|
||||
}
|
||||
if (null == null) {
|
||||
}
|
||||
}
|
||||
|
||||
function f3(a: number, b: boolean, c: { x: number }, d: number | string) {
|
||||
if (a == null) {
|
||||
}
|
||||
if (b == null) {
|
||||
}
|
||||
if (c == null) {
|
||||
}
|
||||
if (d == null) {
|
||||
}
|
||||
}
|
||||
|
||||
function f4(x: number) {
|
||||
if (x > undefined) {
|
||||
}
|
||||
if (x < undefined) {
|
||||
}
|
||||
if (x >= undefined) {
|
||||
}
|
||||
if (x <= undefined) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//// [equalityStrictNulls.js]
|
||||
function f1(x) {
|
||||
if (x == undefined) {
|
||||
}
|
||||
if (x != undefined) {
|
||||
}
|
||||
if (x === undefined) {
|
||||
}
|
||||
if (x !== undefined) {
|
||||
}
|
||||
if (x == null) {
|
||||
}
|
||||
if (x != null) {
|
||||
}
|
||||
if (x === null) {
|
||||
}
|
||||
if (x !== null) {
|
||||
}
|
||||
if (undefined == x) {
|
||||
}
|
||||
if (undefined != x) {
|
||||
}
|
||||
if (undefined === x) {
|
||||
}
|
||||
if (undefined !== x) {
|
||||
}
|
||||
if (null == x) {
|
||||
}
|
||||
if (null != x) {
|
||||
}
|
||||
if (null === x) {
|
||||
}
|
||||
if (null !== x) {
|
||||
}
|
||||
}
|
||||
function f2() {
|
||||
if (undefined == undefined) {
|
||||
}
|
||||
if (undefined == null) {
|
||||
}
|
||||
if (null == undefined) {
|
||||
}
|
||||
if (null == null) {
|
||||
}
|
||||
}
|
||||
function f3(a, b, c, d) {
|
||||
if (a == null) {
|
||||
}
|
||||
if (b == null) {
|
||||
}
|
||||
if (c == null) {
|
||||
}
|
||||
if (d == null) {
|
||||
}
|
||||
}
|
||||
function f4(x) {
|
||||
if (x > undefined) {
|
||||
}
|
||||
if (x < undefined) {
|
||||
}
|
||||
if (x >= undefined) {
|
||||
}
|
||||
if (x <= undefined) {
|
||||
}
|
||||
}
|
||||
22
tests/baselines/reference/iteratorsAndStrictNullChecks.js
Normal file
22
tests/baselines/reference/iteratorsAndStrictNullChecks.js
Normal file
@@ -0,0 +1,22 @@
|
||||
//// [iteratorsAndStrictNullChecks.ts]
|
||||
|
||||
// for..of
|
||||
for (const x of ["a", "b"]) {
|
||||
x.substring;
|
||||
}
|
||||
|
||||
// Spread
|
||||
const xs = [1, 2, 3];
|
||||
const ys = [4, 5];
|
||||
xs.push(...ys);
|
||||
|
||||
|
||||
//// [iteratorsAndStrictNullChecks.js]
|
||||
// for..of
|
||||
for (const x of ["a", "b"]) {
|
||||
x.substring;
|
||||
}
|
||||
// Spread
|
||||
const xs = [1, 2, 3];
|
||||
const ys = [4, 5];
|
||||
xs.push(...ys);
|
||||
@@ -0,0 +1,25 @@
|
||||
=== tests/cases/compiler/iteratorsAndStrictNullChecks.ts ===
|
||||
|
||||
// for..of
|
||||
for (const x of ["a", "b"]) {
|
||||
>x : Symbol(x, Decl(iteratorsAndStrictNullChecks.ts, 2, 10))
|
||||
|
||||
x.substring;
|
||||
>x.substring : Symbol(String.substring, Decl(lib.es5.d.ts, --, --))
|
||||
>x : Symbol(x, Decl(iteratorsAndStrictNullChecks.ts, 2, 10))
|
||||
>substring : Symbol(String.substring, Decl(lib.es5.d.ts, --, --))
|
||||
}
|
||||
|
||||
// Spread
|
||||
const xs = [1, 2, 3];
|
||||
>xs : Symbol(xs, Decl(iteratorsAndStrictNullChecks.ts, 7, 5))
|
||||
|
||||
const ys = [4, 5];
|
||||
>ys : Symbol(ys, Decl(iteratorsAndStrictNullChecks.ts, 8, 5))
|
||||
|
||||
xs.push(...ys);
|
||||
>xs.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||||
>xs : Symbol(xs, Decl(iteratorsAndStrictNullChecks.ts, 7, 5))
|
||||
>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||||
>ys : Symbol(ys, Decl(iteratorsAndStrictNullChecks.ts, 8, 5))
|
||||
|
||||
37
tests/baselines/reference/iteratorsAndStrictNullChecks.types
Normal file
37
tests/baselines/reference/iteratorsAndStrictNullChecks.types
Normal file
@@ -0,0 +1,37 @@
|
||||
=== tests/cases/compiler/iteratorsAndStrictNullChecks.ts ===
|
||||
|
||||
// for..of
|
||||
for (const x of ["a", "b"]) {
|
||||
>x : string
|
||||
>["a", "b"] : string[]
|
||||
>"a" : string
|
||||
>"b" : string
|
||||
|
||||
x.substring;
|
||||
>x.substring : (start: number, end?: number | undefined) => string
|
||||
>x : string
|
||||
>substring : (start: number, end?: number | undefined) => string
|
||||
}
|
||||
|
||||
// Spread
|
||||
const xs = [1, 2, 3];
|
||||
>xs : number[]
|
||||
>[1, 2, 3] : number[]
|
||||
>1 : number
|
||||
>2 : number
|
||||
>3 : number
|
||||
|
||||
const ys = [4, 5];
|
||||
>ys : number[]
|
||||
>[4, 5] : number[]
|
||||
>4 : number
|
||||
>5 : number
|
||||
|
||||
xs.push(...ys);
|
||||
>xs.push(...ys) : number
|
||||
>xs.push : (...items: number[]) => number
|
||||
>xs : number[]
|
||||
>push : (...items: number[]) => number
|
||||
>...ys : number
|
||||
>ys : number[]
|
||||
|
||||
27
tests/cases/compiler/asyncFunctionsAndStrictNullChecks.ts
Normal file
27
tests/cases/compiler/asyncFunctionsAndStrictNullChecks.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
// @target: es6
|
||||
// @strictNullChecks: true
|
||||
|
||||
declare namespace Windows.Foundation {
|
||||
interface IPromise<TResult> {
|
||||
then<U>(success?: (value: TResult) => IPromise<U>, error?: (error: any) => IPromise<U>, progress?: (progress: any) => void): IPromise<U>;
|
||||
then<U>(success?: (value: TResult) => IPromise<U>, error?: (error: any) => U, progress?: (progress: any) => void): IPromise<U>;
|
||||
then<U>(success?: (value: TResult) => U, error?: (error: any) => IPromise<U>, progress?: (progress: any) => void): IPromise<U>;
|
||||
then<U>(success?: (value: TResult) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise<U>;
|
||||
done<U>(success?: (value: TResult) => any, error?: (error: any) => any, progress?: (progress: any) => void): void;
|
||||
|
||||
cancel(): void;
|
||||
}
|
||||
}
|
||||
|
||||
async function sample(promise: Windows.Foundation.IPromise<number>) {
|
||||
var number = await promise;
|
||||
}
|
||||
|
||||
|
||||
declare function resolve1<T>(value: T): Promise<T>;
|
||||
declare function resolve2<T>(value: T): Windows.Foundation.IPromise<T>;
|
||||
|
||||
async function sample2(x?: number) {
|
||||
let x1 = await resolve1(x);
|
||||
let x2 = await resolve2(x);
|
||||
}
|
||||
12
tests/cases/compiler/iteratorsAndStrictNullChecks.ts
Normal file
12
tests/cases/compiler/iteratorsAndStrictNullChecks.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
// @target : ES6
|
||||
// @strictNullChecks: true
|
||||
|
||||
// for..of
|
||||
for (const x of ["a", "b"]) {
|
||||
x.substring;
|
||||
}
|
||||
|
||||
// Spread
|
||||
const xs = [1, 2, 3];
|
||||
const ys = [4, 5];
|
||||
xs.push(...ys);
|
||||
@@ -0,0 +1,69 @@
|
||||
// @strictNullChecks: true
|
||||
|
||||
function f1(x: string) {
|
||||
if (x == undefined) {
|
||||
}
|
||||
if (x != undefined) {
|
||||
}
|
||||
if (x === undefined) {
|
||||
}
|
||||
if (x !== undefined) {
|
||||
}
|
||||
if (x == null) {
|
||||
}
|
||||
if (x != null) {
|
||||
}
|
||||
if (x === null) {
|
||||
}
|
||||
if (x !== null) {
|
||||
}
|
||||
if (undefined == x) {
|
||||
}
|
||||
if (undefined != x) {
|
||||
}
|
||||
if (undefined === x) {
|
||||
}
|
||||
if (undefined !== x) {
|
||||
}
|
||||
if (null == x) {
|
||||
}
|
||||
if (null != x) {
|
||||
}
|
||||
if (null === x) {
|
||||
}
|
||||
if (null !== x) {
|
||||
}
|
||||
}
|
||||
|
||||
function f2() {
|
||||
if (undefined == undefined) {
|
||||
}
|
||||
if (undefined == null) {
|
||||
}
|
||||
if (null == undefined) {
|
||||
}
|
||||
if (null == null) {
|
||||
}
|
||||
}
|
||||
|
||||
function f3(a: number, b: boolean, c: { x: number }, d: number | string) {
|
||||
if (a == null) {
|
||||
}
|
||||
if (b == null) {
|
||||
}
|
||||
if (c == null) {
|
||||
}
|
||||
if (d == null) {
|
||||
}
|
||||
}
|
||||
|
||||
function f4(x: number) {
|
||||
if (x > undefined) {
|
||||
}
|
||||
if (x < undefined) {
|
||||
}
|
||||
if (x >= undefined) {
|
||||
}
|
||||
if (x <= undefined) {
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user