mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Adding test
This commit is contained in:
@@ -103,6 +103,23 @@ function f5(x: string | number) {
|
||||
}
|
||||
x; // string | number
|
||||
}
|
||||
|
||||
function f6() {
|
||||
let x: string | undefined | null;
|
||||
x!.slice();
|
||||
x = "";
|
||||
x!.slice();
|
||||
x = undefined;
|
||||
x!.slice();
|
||||
x = null;
|
||||
x!.slice();
|
||||
x = <undefined | null>undefined;
|
||||
x!.slice();
|
||||
x = <string | undefined>"";
|
||||
x!.slice();
|
||||
x = <string | null>"";
|
||||
x!.slice();
|
||||
}
|
||||
|
||||
|
||||
//// [typeGuardsAsAssertions.js]
|
||||
@@ -194,3 +211,19 @@ function f5(x) {
|
||||
}
|
||||
x; // string | number
|
||||
}
|
||||
function f6() {
|
||||
var x;
|
||||
x.slice();
|
||||
x = "";
|
||||
x.slice();
|
||||
x = undefined;
|
||||
x.slice();
|
||||
x = null;
|
||||
x.slice();
|
||||
x = undefined;
|
||||
x.slice();
|
||||
x = "";
|
||||
x.slice();
|
||||
x = "";
|
||||
x.slice();
|
||||
}
|
||||
|
||||
@@ -251,3 +251,65 @@ function f5(x: string | number) {
|
||||
>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 95, 12))
|
||||
}
|
||||
|
||||
function f6() {
|
||||
>f6 : Symbol(f6, Decl(typeGuardsAsAssertions.ts, 103, 1))
|
||||
|
||||
let x: string | undefined | null;
|
||||
>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 106, 7))
|
||||
|
||||
x!.slice();
|
||||
>x!.slice : Symbol(String.slice, Decl(lib.d.ts, --, --))
|
||||
>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 106, 7))
|
||||
>slice : Symbol(String.slice, Decl(lib.d.ts, --, --))
|
||||
|
||||
x = "";
|
||||
>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 106, 7))
|
||||
|
||||
x!.slice();
|
||||
>x!.slice : Symbol(String.slice, Decl(lib.d.ts, --, --))
|
||||
>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 106, 7))
|
||||
>slice : Symbol(String.slice, Decl(lib.d.ts, --, --))
|
||||
|
||||
x = undefined;
|
||||
>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 106, 7))
|
||||
>undefined : Symbol(undefined)
|
||||
|
||||
x!.slice();
|
||||
>x!.slice : Symbol(String.slice, Decl(lib.d.ts, --, --))
|
||||
>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 106, 7))
|
||||
>slice : Symbol(String.slice, Decl(lib.d.ts, --, --))
|
||||
|
||||
x = null;
|
||||
>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 106, 7))
|
||||
|
||||
x!.slice();
|
||||
>x!.slice : Symbol(String.slice, Decl(lib.d.ts, --, --))
|
||||
>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 106, 7))
|
||||
>slice : Symbol(String.slice, Decl(lib.d.ts, --, --))
|
||||
|
||||
x = <undefined | null>undefined;
|
||||
>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 106, 7))
|
||||
>undefined : Symbol(undefined)
|
||||
|
||||
x!.slice();
|
||||
>x!.slice : Symbol(String.slice, Decl(lib.d.ts, --, --))
|
||||
>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 106, 7))
|
||||
>slice : Symbol(String.slice, Decl(lib.d.ts, --, --))
|
||||
|
||||
x = <string | undefined>"";
|
||||
>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 106, 7))
|
||||
|
||||
x!.slice();
|
||||
>x!.slice : Symbol(String.slice, Decl(lib.d.ts, --, --))
|
||||
>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 106, 7))
|
||||
>slice : Symbol(String.slice, Decl(lib.d.ts, --, --))
|
||||
|
||||
x = <string | null>"";
|
||||
>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 106, 7))
|
||||
|
||||
x!.slice();
|
||||
>x!.slice : Symbol(String.slice, Decl(lib.d.ts, --, --))
|
||||
>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 106, 7))
|
||||
>slice : Symbol(String.slice, Decl(lib.d.ts, --, --))
|
||||
}
|
||||
|
||||
|
||||
@@ -291,3 +291,95 @@ function f5(x: string | number) {
|
||||
>x : number | string
|
||||
}
|
||||
|
||||
function f6() {
|
||||
>f6 : () => void
|
||||
|
||||
let x: string | undefined | null;
|
||||
>x : string | null | undefined
|
||||
>null : null
|
||||
|
||||
x!.slice();
|
||||
>x!.slice() : string
|
||||
>x!.slice : (start?: number | undefined, end?: number | undefined) => string
|
||||
>x! : string
|
||||
>x : string | null | undefined
|
||||
>slice : (start?: number | undefined, end?: number | undefined) => string
|
||||
|
||||
x = "";
|
||||
>x = "" : string
|
||||
>x : string | null | undefined
|
||||
>"" : string
|
||||
|
||||
x!.slice();
|
||||
>x!.slice() : string
|
||||
>x!.slice : (start?: number | undefined, end?: number | undefined) => string
|
||||
>x! : string
|
||||
>x : string
|
||||
>slice : (start?: number | undefined, end?: number | undefined) => string
|
||||
|
||||
x = undefined;
|
||||
>x = undefined : undefined
|
||||
>x : string | null | undefined
|
||||
>undefined : undefined
|
||||
|
||||
x!.slice();
|
||||
>x!.slice() : string
|
||||
>x!.slice : (start?: number | undefined, end?: number | undefined) => string
|
||||
>x! : string
|
||||
>x : string | null | undefined
|
||||
>slice : (start?: number | undefined, end?: number | undefined) => string
|
||||
|
||||
x = null;
|
||||
>x = null : null
|
||||
>x : string | null | undefined
|
||||
>null : null
|
||||
|
||||
x!.slice();
|
||||
>x!.slice() : string
|
||||
>x!.slice : (start?: number | undefined, end?: number | undefined) => string
|
||||
>x! : string
|
||||
>x : string | null | undefined
|
||||
>slice : (start?: number | undefined, end?: number | undefined) => string
|
||||
|
||||
x = <undefined | null>undefined;
|
||||
>x = <undefined | null>undefined : null | undefined
|
||||
>x : string | null | undefined
|
||||
><undefined | null>undefined : null | undefined
|
||||
>null : null
|
||||
>undefined : undefined
|
||||
|
||||
x!.slice();
|
||||
>x!.slice() : string
|
||||
>x!.slice : (start?: number | undefined, end?: number | undefined) => string
|
||||
>x! : string
|
||||
>x : string | null | undefined
|
||||
>slice : (start?: number | undefined, end?: number | undefined) => string
|
||||
|
||||
x = <string | undefined>"";
|
||||
>x = <string | undefined>"" : string | undefined
|
||||
>x : string | null | undefined
|
||||
><string | undefined>"" : string | undefined
|
||||
>"" : string
|
||||
|
||||
x!.slice();
|
||||
>x!.slice() : string
|
||||
>x!.slice : (start?: number | undefined, end?: number | undefined) => string
|
||||
>x! : string
|
||||
>x : string | undefined
|
||||
>slice : (start?: number | undefined, end?: number | undefined) => string
|
||||
|
||||
x = <string | null>"";
|
||||
>x = <string | null>"" : string | null
|
||||
>x : string | null | undefined
|
||||
><string | null>"" : string | null
|
||||
>null : null
|
||||
>"" : string
|
||||
|
||||
x!.slice();
|
||||
>x!.slice() : string
|
||||
>x!.slice : (start?: number | undefined, end?: number | undefined) => string
|
||||
>x! : string
|
||||
>x : string | null
|
||||
>slice : (start?: number | undefined, end?: number | undefined) => string
|
||||
}
|
||||
|
||||
|
||||
@@ -103,3 +103,20 @@ function f5(x: string | number) {
|
||||
}
|
||||
x; // string | number
|
||||
}
|
||||
|
||||
function f6() {
|
||||
let x: string | undefined | null;
|
||||
x!.slice();
|
||||
x = "";
|
||||
x!.slice();
|
||||
x = undefined;
|
||||
x!.slice();
|
||||
x = null;
|
||||
x!.slice();
|
||||
x = <undefined | null>undefined;
|
||||
x!.slice();
|
||||
x = <string | undefined>"";
|
||||
x!.slice();
|
||||
x = <string | null>"";
|
||||
x!.slice();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user