Accepted baselines.

This commit is contained in:
Daniel Rosenwasser 2015-10-08 14:10:15 -07:00
parent f7a6ac7e0c
commit a440f06cac
8 changed files with 839 additions and 0 deletions

View File

@ -0,0 +1,104 @@
//// [stringLiteralTypesOverloads03.ts]
interface Base {
x: string;
y: number;
}
interface HelloOrWorld extends Base {
p1: boolean;
}
interface JustHello extends Base {
p2: boolean;
}
interface JustWorld extends Base {
p3: boolean;
}
let hello: "hello";
let world: "world";
let helloOrWorld: "hello" | "world";
function f(p: "hello"): JustHello;
function f(p: "hello" | "world"): HelloOrWorld;
function f(p: "world"): JustWorld;
function f(p: string): Base;
function f(...args: any[]): any {
return undefined;
}
let fResult1 = f(hello);
let fResult2 = f(world);
let fResult3 = f(helloOrWorld);
function g(p: string): Base;
function g(p: "hello"): JustHello;
function g(p: "hello" | "world"): HelloOrWorld;
function g(p: "world"): JustWorld;
function g(...args: any[]): any {
return undefined;
}
let gResult1 = g(hello);
let gResult2 = g(world);
let gResult3 = g(helloOrWorld);
//// [stringLiteralTypesOverloads03.js]
var hello;
var world;
var helloOrWorld;
function f() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i - 0] = arguments[_i];
}
return undefined;
}
var fResult1 = f(hello);
var fResult2 = f(world);
var fResult3 = f(helloOrWorld);
function g() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i - 0] = arguments[_i];
}
return undefined;
}
var gResult1 = g(hello);
var gResult2 = g(world);
var gResult3 = g(helloOrWorld);
//// [stringLiteralTypesOverloads03.d.ts]
interface Base {
x: string;
y: number;
}
interface HelloOrWorld extends Base {
p1: boolean;
}
interface JustHello extends Base {
p2: boolean;
}
interface JustWorld extends Base {
p3: boolean;
}
declare let hello: "hello";
declare let world: "world";
declare let helloOrWorld: "hello" | "world";
declare function f(p: "hello"): JustHello;
declare function f(p: "hello" | "world"): HelloOrWorld;
declare function f(p: "world"): JustWorld;
declare function f(p: string): Base;
declare let fResult1: JustHello;
declare let fResult2: JustWorld;
declare let fResult3: HelloOrWorld;
declare function g(p: string): Base;
declare function g(p: "hello"): JustHello;
declare function g(p: "hello" | "world"): HelloOrWorld;
declare function g(p: "world"): JustWorld;
declare let gResult1: JustHello;
declare let gResult2: JustWorld;
declare let gResult3: Base;

View File

@ -0,0 +1,131 @@
=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads03.ts ===
interface Base {
>Base : Symbol(Base, Decl(stringLiteralTypesOverloads03.ts, 0, 0))
x: string;
>x : Symbol(x, Decl(stringLiteralTypesOverloads03.ts, 1, 16))
y: number;
>y : Symbol(y, Decl(stringLiteralTypesOverloads03.ts, 2, 14))
}
interface HelloOrWorld extends Base {
>HelloOrWorld : Symbol(HelloOrWorld, Decl(stringLiteralTypesOverloads03.ts, 4, 1))
>Base : Symbol(Base, Decl(stringLiteralTypesOverloads03.ts, 0, 0))
p1: boolean;
>p1 : Symbol(p1, Decl(stringLiteralTypesOverloads03.ts, 6, 37))
}
interface JustHello extends Base {
>JustHello : Symbol(JustHello, Decl(stringLiteralTypesOverloads03.ts, 8, 1))
>Base : Symbol(Base, Decl(stringLiteralTypesOverloads03.ts, 0, 0))
p2: boolean;
>p2 : Symbol(p2, Decl(stringLiteralTypesOverloads03.ts, 10, 34))
}
interface JustWorld extends Base {
>JustWorld : Symbol(JustWorld, Decl(stringLiteralTypesOverloads03.ts, 12, 1))
>Base : Symbol(Base, Decl(stringLiteralTypesOverloads03.ts, 0, 0))
p3: boolean;
>p3 : Symbol(p3, Decl(stringLiteralTypesOverloads03.ts, 14, 34))
}
let hello: "hello";
>hello : Symbol(hello, Decl(stringLiteralTypesOverloads03.ts, 18, 3))
let world: "world";
>world : Symbol(world, Decl(stringLiteralTypesOverloads03.ts, 19, 3))
let helloOrWorld: "hello" | "world";
>helloOrWorld : Symbol(helloOrWorld, Decl(stringLiteralTypesOverloads03.ts, 20, 3))
function f(p: "hello"): JustHello;
>f : Symbol(f, Decl(stringLiteralTypesOverloads03.ts, 20, 36), Decl(stringLiteralTypesOverloads03.ts, 22, 34), Decl(stringLiteralTypesOverloads03.ts, 23, 47), Decl(stringLiteralTypesOverloads03.ts, 24, 34), Decl(stringLiteralTypesOverloads03.ts, 25, 28))
>p : Symbol(p, Decl(stringLiteralTypesOverloads03.ts, 22, 11))
>JustHello : Symbol(JustHello, Decl(stringLiteralTypesOverloads03.ts, 8, 1))
function f(p: "hello" | "world"): HelloOrWorld;
>f : Symbol(f, Decl(stringLiteralTypesOverloads03.ts, 20, 36), Decl(stringLiteralTypesOverloads03.ts, 22, 34), Decl(stringLiteralTypesOverloads03.ts, 23, 47), Decl(stringLiteralTypesOverloads03.ts, 24, 34), Decl(stringLiteralTypesOverloads03.ts, 25, 28))
>p : Symbol(p, Decl(stringLiteralTypesOverloads03.ts, 23, 11))
>HelloOrWorld : Symbol(HelloOrWorld, Decl(stringLiteralTypesOverloads03.ts, 4, 1))
function f(p: "world"): JustWorld;
>f : Symbol(f, Decl(stringLiteralTypesOverloads03.ts, 20, 36), Decl(stringLiteralTypesOverloads03.ts, 22, 34), Decl(stringLiteralTypesOverloads03.ts, 23, 47), Decl(stringLiteralTypesOverloads03.ts, 24, 34), Decl(stringLiteralTypesOverloads03.ts, 25, 28))
>p : Symbol(p, Decl(stringLiteralTypesOverloads03.ts, 24, 11))
>JustWorld : Symbol(JustWorld, Decl(stringLiteralTypesOverloads03.ts, 12, 1))
function f(p: string): Base;
>f : Symbol(f, Decl(stringLiteralTypesOverloads03.ts, 20, 36), Decl(stringLiteralTypesOverloads03.ts, 22, 34), Decl(stringLiteralTypesOverloads03.ts, 23, 47), Decl(stringLiteralTypesOverloads03.ts, 24, 34), Decl(stringLiteralTypesOverloads03.ts, 25, 28))
>p : Symbol(p, Decl(stringLiteralTypesOverloads03.ts, 25, 11))
>Base : Symbol(Base, Decl(stringLiteralTypesOverloads03.ts, 0, 0))
function f(...args: any[]): any {
>f : Symbol(f, Decl(stringLiteralTypesOverloads03.ts, 20, 36), Decl(stringLiteralTypesOverloads03.ts, 22, 34), Decl(stringLiteralTypesOverloads03.ts, 23, 47), Decl(stringLiteralTypesOverloads03.ts, 24, 34), Decl(stringLiteralTypesOverloads03.ts, 25, 28))
>args : Symbol(args, Decl(stringLiteralTypesOverloads03.ts, 26, 11))
return undefined;
>undefined : Symbol(undefined)
}
let fResult1 = f(hello);
>fResult1 : Symbol(fResult1, Decl(stringLiteralTypesOverloads03.ts, 30, 3))
>f : Symbol(f, Decl(stringLiteralTypesOverloads03.ts, 20, 36), Decl(stringLiteralTypesOverloads03.ts, 22, 34), Decl(stringLiteralTypesOverloads03.ts, 23, 47), Decl(stringLiteralTypesOverloads03.ts, 24, 34), Decl(stringLiteralTypesOverloads03.ts, 25, 28))
>hello : Symbol(hello, Decl(stringLiteralTypesOverloads03.ts, 18, 3))
let fResult2 = f(world);
>fResult2 : Symbol(fResult2, Decl(stringLiteralTypesOverloads03.ts, 31, 3))
>f : Symbol(f, Decl(stringLiteralTypesOverloads03.ts, 20, 36), Decl(stringLiteralTypesOverloads03.ts, 22, 34), Decl(stringLiteralTypesOverloads03.ts, 23, 47), Decl(stringLiteralTypesOverloads03.ts, 24, 34), Decl(stringLiteralTypesOverloads03.ts, 25, 28))
>world : Symbol(world, Decl(stringLiteralTypesOverloads03.ts, 19, 3))
let fResult3 = f(helloOrWorld);
>fResult3 : Symbol(fResult3, Decl(stringLiteralTypesOverloads03.ts, 32, 3))
>f : Symbol(f, Decl(stringLiteralTypesOverloads03.ts, 20, 36), Decl(stringLiteralTypesOverloads03.ts, 22, 34), Decl(stringLiteralTypesOverloads03.ts, 23, 47), Decl(stringLiteralTypesOverloads03.ts, 24, 34), Decl(stringLiteralTypesOverloads03.ts, 25, 28))
>helloOrWorld : Symbol(helloOrWorld, Decl(stringLiteralTypesOverloads03.ts, 20, 3))
function g(p: string): Base;
>g : Symbol(g, Decl(stringLiteralTypesOverloads03.ts, 32, 31), Decl(stringLiteralTypesOverloads03.ts, 34, 28), Decl(stringLiteralTypesOverloads03.ts, 35, 34), Decl(stringLiteralTypesOverloads03.ts, 36, 47), Decl(stringLiteralTypesOverloads03.ts, 37, 34))
>p : Symbol(p, Decl(stringLiteralTypesOverloads03.ts, 34, 11))
>Base : Symbol(Base, Decl(stringLiteralTypesOverloads03.ts, 0, 0))
function g(p: "hello"): JustHello;
>g : Symbol(g, Decl(stringLiteralTypesOverloads03.ts, 32, 31), Decl(stringLiteralTypesOverloads03.ts, 34, 28), Decl(stringLiteralTypesOverloads03.ts, 35, 34), Decl(stringLiteralTypesOverloads03.ts, 36, 47), Decl(stringLiteralTypesOverloads03.ts, 37, 34))
>p : Symbol(p, Decl(stringLiteralTypesOverloads03.ts, 35, 11))
>JustHello : Symbol(JustHello, Decl(stringLiteralTypesOverloads03.ts, 8, 1))
function g(p: "hello" | "world"): HelloOrWorld;
>g : Symbol(g, Decl(stringLiteralTypesOverloads03.ts, 32, 31), Decl(stringLiteralTypesOverloads03.ts, 34, 28), Decl(stringLiteralTypesOverloads03.ts, 35, 34), Decl(stringLiteralTypesOverloads03.ts, 36, 47), Decl(stringLiteralTypesOverloads03.ts, 37, 34))
>p : Symbol(p, Decl(stringLiteralTypesOverloads03.ts, 36, 11))
>HelloOrWorld : Symbol(HelloOrWorld, Decl(stringLiteralTypesOverloads03.ts, 4, 1))
function g(p: "world"): JustWorld;
>g : Symbol(g, Decl(stringLiteralTypesOverloads03.ts, 32, 31), Decl(stringLiteralTypesOverloads03.ts, 34, 28), Decl(stringLiteralTypesOverloads03.ts, 35, 34), Decl(stringLiteralTypesOverloads03.ts, 36, 47), Decl(stringLiteralTypesOverloads03.ts, 37, 34))
>p : Symbol(p, Decl(stringLiteralTypesOverloads03.ts, 37, 11))
>JustWorld : Symbol(JustWorld, Decl(stringLiteralTypesOverloads03.ts, 12, 1))
function g(...args: any[]): any {
>g : Symbol(g, Decl(stringLiteralTypesOverloads03.ts, 32, 31), Decl(stringLiteralTypesOverloads03.ts, 34, 28), Decl(stringLiteralTypesOverloads03.ts, 35, 34), Decl(stringLiteralTypesOverloads03.ts, 36, 47), Decl(stringLiteralTypesOverloads03.ts, 37, 34))
>args : Symbol(args, Decl(stringLiteralTypesOverloads03.ts, 38, 11))
return undefined;
>undefined : Symbol(undefined)
}
let gResult1 = g(hello);
>gResult1 : Symbol(gResult1, Decl(stringLiteralTypesOverloads03.ts, 42, 3))
>g : Symbol(g, Decl(stringLiteralTypesOverloads03.ts, 32, 31), Decl(stringLiteralTypesOverloads03.ts, 34, 28), Decl(stringLiteralTypesOverloads03.ts, 35, 34), Decl(stringLiteralTypesOverloads03.ts, 36, 47), Decl(stringLiteralTypesOverloads03.ts, 37, 34))
>hello : Symbol(hello, Decl(stringLiteralTypesOverloads03.ts, 18, 3))
let gResult2 = g(world);
>gResult2 : Symbol(gResult2, Decl(stringLiteralTypesOverloads03.ts, 43, 3))
>g : Symbol(g, Decl(stringLiteralTypesOverloads03.ts, 32, 31), Decl(stringLiteralTypesOverloads03.ts, 34, 28), Decl(stringLiteralTypesOverloads03.ts, 35, 34), Decl(stringLiteralTypesOverloads03.ts, 36, 47), Decl(stringLiteralTypesOverloads03.ts, 37, 34))
>world : Symbol(world, Decl(stringLiteralTypesOverloads03.ts, 19, 3))
let gResult3 = g(helloOrWorld);
>gResult3 : Symbol(gResult3, Decl(stringLiteralTypesOverloads03.ts, 44, 3))
>g : Symbol(g, Decl(stringLiteralTypesOverloads03.ts, 32, 31), Decl(stringLiteralTypesOverloads03.ts, 34, 28), Decl(stringLiteralTypesOverloads03.ts, 35, 34), Decl(stringLiteralTypesOverloads03.ts, 36, 47), Decl(stringLiteralTypesOverloads03.ts, 37, 34))
>helloOrWorld : Symbol(helloOrWorld, Decl(stringLiteralTypesOverloads03.ts, 20, 3))

View File

@ -0,0 +1,137 @@
=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads03.ts ===
interface Base {
>Base : Base
x: string;
>x : string
y: number;
>y : number
}
interface HelloOrWorld extends Base {
>HelloOrWorld : HelloOrWorld
>Base : Base
p1: boolean;
>p1 : boolean
}
interface JustHello extends Base {
>JustHello : JustHello
>Base : Base
p2: boolean;
>p2 : boolean
}
interface JustWorld extends Base {
>JustWorld : JustWorld
>Base : Base
p3: boolean;
>p3 : boolean
}
let hello: "hello";
>hello : "hello"
let world: "world";
>world : "world"
let helloOrWorld: "hello" | "world";
>helloOrWorld : "hello" | "world"
function f(p: "hello"): JustHello;
>f : { (p: "hello"): JustHello; (p: "hello" | "world"): HelloOrWorld; (p: "world"): JustWorld; (p: string): Base; }
>p : "hello"
>JustHello : JustHello
function f(p: "hello" | "world"): HelloOrWorld;
>f : { (p: "hello"): JustHello; (p: "hello" | "world"): HelloOrWorld; (p: "world"): JustWorld; (p: string): Base; }
>p : "hello" | "world"
>HelloOrWorld : HelloOrWorld
function f(p: "world"): JustWorld;
>f : { (p: "hello"): JustHello; (p: "hello" | "world"): HelloOrWorld; (p: "world"): JustWorld; (p: string): Base; }
>p : "world"
>JustWorld : JustWorld
function f(p: string): Base;
>f : { (p: "hello"): JustHello; (p: "hello" | "world"): HelloOrWorld; (p: "world"): JustWorld; (p: string): Base; }
>p : string
>Base : Base
function f(...args: any[]): any {
>f : { (p: "hello"): JustHello; (p: "hello" | "world"): HelloOrWorld; (p: "world"): JustWorld; (p: string): Base; }
>args : any[]
return undefined;
>undefined : undefined
}
let fResult1 = f(hello);
>fResult1 : JustHello
>f(hello) : JustHello
>f : { (p: "hello"): JustHello; (p: "hello" | "world"): HelloOrWorld; (p: "world"): JustWorld; (p: string): Base; }
>hello : "hello"
let fResult2 = f(world);
>fResult2 : JustWorld
>f(world) : JustWorld
>f : { (p: "hello"): JustHello; (p: "hello" | "world"): HelloOrWorld; (p: "world"): JustWorld; (p: string): Base; }
>world : "world"
let fResult3 = f(helloOrWorld);
>fResult3 : HelloOrWorld
>f(helloOrWorld) : HelloOrWorld
>f : { (p: "hello"): JustHello; (p: "hello" | "world"): HelloOrWorld; (p: "world"): JustWorld; (p: string): Base; }
>helloOrWorld : "hello" | "world"
function g(p: string): Base;
>g : { (p: string): Base; (p: "hello"): JustHello; (p: "hello" | "world"): HelloOrWorld; (p: "world"): JustWorld; }
>p : string
>Base : Base
function g(p: "hello"): JustHello;
>g : { (p: string): Base; (p: "hello"): JustHello; (p: "hello" | "world"): HelloOrWorld; (p: "world"): JustWorld; }
>p : "hello"
>JustHello : JustHello
function g(p: "hello" | "world"): HelloOrWorld;
>g : { (p: string): Base; (p: "hello"): JustHello; (p: "hello" | "world"): HelloOrWorld; (p: "world"): JustWorld; }
>p : "hello" | "world"
>HelloOrWorld : HelloOrWorld
function g(p: "world"): JustWorld;
>g : { (p: string): Base; (p: "hello"): JustHello; (p: "hello" | "world"): HelloOrWorld; (p: "world"): JustWorld; }
>p : "world"
>JustWorld : JustWorld
function g(...args: any[]): any {
>g : { (p: string): Base; (p: "hello"): JustHello; (p: "hello" | "world"): HelloOrWorld; (p: "world"): JustWorld; }
>args : any[]
return undefined;
>undefined : undefined
}
let gResult1 = g(hello);
>gResult1 : JustHello
>g(hello) : JustHello
>g : { (p: string): Base; (p: "hello"): JustHello; (p: "hello" | "world"): HelloOrWorld; (p: "world"): JustWorld; }
>hello : "hello"
let gResult2 = g(world);
>gResult2 : JustWorld
>g(world) : JustWorld
>g : { (p: string): Base; (p: "hello"): JustHello; (p: "hello" | "world"): HelloOrWorld; (p: "world"): JustWorld; }
>world : "world"
let gResult3 = g(helloOrWorld);
>gResult3 : Base
>g(helloOrWorld) : Base
>g : { (p: string): Base; (p: "hello"): JustHello; (p: "hello" | "world"): HelloOrWorld; (p: "world"): JustWorld; }
>helloOrWorld : "hello" | "world"

View File

@ -0,0 +1,86 @@
//// [stringLiteralTypesWithVariousOperators01.ts]
let abc: "ABC" = "ABC";
let xyz: "XYZ" = "XYZ";
let abcOrXyz: "ABC" | "XYZ" = abc || xyz;
let abcOrXyzOrNumber: "ABC" | "XYZ" | number = abcOrXyz || 100;
let a = "" + abc;
let b = abc + "";
let c = 10 + abc;
let d = abc + 10;
let e = xyz + abc;
let f = abc + xyz;
let g = true + abc;
let h = abc + true;
let i = abc + abcOrXyz + xyz;
let j = abcOrXyz + abcOrXyz;
let k = +abcOrXyz;
let l = -abcOrXyz;
let m = abcOrXyzOrNumber + "";
let n = "" + abcOrXyzOrNumber;
let o = abcOrXyzOrNumber + abcOrXyz;
let p = abcOrXyz + abcOrXyzOrNumber;
let q = !abcOrXyzOrNumber;
let r = ~abcOrXyzOrNumber;
let s = abcOrXyzOrNumber < abcOrXyzOrNumber;
let t = abcOrXyzOrNumber >= abcOrXyz;
let u = abc === abcOrXyz;
let v = abcOrXyz === abcOrXyzOrNumber;
//// [stringLiteralTypesWithVariousOperators01.js]
var abc = "ABC";
var xyz = "XYZ";
var abcOrXyz = abc || xyz;
var abcOrXyzOrNumber = abcOrXyz || 100;
var a = "" + abc;
var b = abc + "";
var c = 10 + abc;
var d = abc + 10;
var e = xyz + abc;
var f = abc + xyz;
var g = true + abc;
var h = abc + true;
var i = abc + abcOrXyz + xyz;
var j = abcOrXyz + abcOrXyz;
var k = +abcOrXyz;
var l = -abcOrXyz;
var m = abcOrXyzOrNumber + "";
var n = "" + abcOrXyzOrNumber;
var o = abcOrXyzOrNumber + abcOrXyz;
var p = abcOrXyz + abcOrXyzOrNumber;
var q = !abcOrXyzOrNumber;
var r = ~abcOrXyzOrNumber;
var s = abcOrXyzOrNumber < abcOrXyzOrNumber;
var t = abcOrXyzOrNumber >= abcOrXyz;
var u = abc === abcOrXyz;
var v = abcOrXyz === abcOrXyzOrNumber;
//// [stringLiteralTypesWithVariousOperators01.d.ts]
declare let abc: "ABC";
declare let xyz: "XYZ";
declare let abcOrXyz: "ABC" | "XYZ";
declare let abcOrXyzOrNumber: "ABC" | "XYZ" | number;
declare let a: string;
declare let b: string;
declare let c: string;
declare let d: string;
declare let e: string;
declare let f: string;
declare let g: string;
declare let h: string;
declare let i: string;
declare let j: string;
declare let k: number;
declare let l: number;
declare let m: string;
declare let n: string;
declare let o: string;
declare let p: string;
declare let q: boolean;
declare let r: number;
declare let s: boolean;
declare let t: boolean;
declare let u: boolean;
declare let v: boolean;

View File

@ -0,0 +1,116 @@
=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators01.ts ===
let abc: "ABC" = "ABC";
>abc : Symbol(abc, Decl(stringLiteralTypesWithVariousOperators01.ts, 1, 3))
let xyz: "XYZ" = "XYZ";
>xyz : Symbol(xyz, Decl(stringLiteralTypesWithVariousOperators01.ts, 2, 3))
let abcOrXyz: "ABC" | "XYZ" = abc || xyz;
>abcOrXyz : Symbol(abcOrXyz, Decl(stringLiteralTypesWithVariousOperators01.ts, 3, 3))
>abc : Symbol(abc, Decl(stringLiteralTypesWithVariousOperators01.ts, 1, 3))
>xyz : Symbol(xyz, Decl(stringLiteralTypesWithVariousOperators01.ts, 2, 3))
let abcOrXyzOrNumber: "ABC" | "XYZ" | number = abcOrXyz || 100;
>abcOrXyzOrNumber : Symbol(abcOrXyzOrNumber, Decl(stringLiteralTypesWithVariousOperators01.ts, 4, 3))
>abcOrXyz : Symbol(abcOrXyz, Decl(stringLiteralTypesWithVariousOperators01.ts, 3, 3))
let a = "" + abc;
>a : Symbol(a, Decl(stringLiteralTypesWithVariousOperators01.ts, 6, 3))
>abc : Symbol(abc, Decl(stringLiteralTypesWithVariousOperators01.ts, 1, 3))
let b = abc + "";
>b : Symbol(b, Decl(stringLiteralTypesWithVariousOperators01.ts, 7, 3))
>abc : Symbol(abc, Decl(stringLiteralTypesWithVariousOperators01.ts, 1, 3))
let c = 10 + abc;
>c : Symbol(c, Decl(stringLiteralTypesWithVariousOperators01.ts, 8, 3))
>abc : Symbol(abc, Decl(stringLiteralTypesWithVariousOperators01.ts, 1, 3))
let d = abc + 10;
>d : Symbol(d, Decl(stringLiteralTypesWithVariousOperators01.ts, 9, 3))
>abc : Symbol(abc, Decl(stringLiteralTypesWithVariousOperators01.ts, 1, 3))
let e = xyz + abc;
>e : Symbol(e, Decl(stringLiteralTypesWithVariousOperators01.ts, 10, 3))
>xyz : Symbol(xyz, Decl(stringLiteralTypesWithVariousOperators01.ts, 2, 3))
>abc : Symbol(abc, Decl(stringLiteralTypesWithVariousOperators01.ts, 1, 3))
let f = abc + xyz;
>f : Symbol(f, Decl(stringLiteralTypesWithVariousOperators01.ts, 11, 3))
>abc : Symbol(abc, Decl(stringLiteralTypesWithVariousOperators01.ts, 1, 3))
>xyz : Symbol(xyz, Decl(stringLiteralTypesWithVariousOperators01.ts, 2, 3))
let g = true + abc;
>g : Symbol(g, Decl(stringLiteralTypesWithVariousOperators01.ts, 12, 3))
>abc : Symbol(abc, Decl(stringLiteralTypesWithVariousOperators01.ts, 1, 3))
let h = abc + true;
>h : Symbol(h, Decl(stringLiteralTypesWithVariousOperators01.ts, 13, 3))
>abc : Symbol(abc, Decl(stringLiteralTypesWithVariousOperators01.ts, 1, 3))
let i = abc + abcOrXyz + xyz;
>i : Symbol(i, Decl(stringLiteralTypesWithVariousOperators01.ts, 14, 3))
>abc : Symbol(abc, Decl(stringLiteralTypesWithVariousOperators01.ts, 1, 3))
>abcOrXyz : Symbol(abcOrXyz, Decl(stringLiteralTypesWithVariousOperators01.ts, 3, 3))
>xyz : Symbol(xyz, Decl(stringLiteralTypesWithVariousOperators01.ts, 2, 3))
let j = abcOrXyz + abcOrXyz;
>j : Symbol(j, Decl(stringLiteralTypesWithVariousOperators01.ts, 15, 3))
>abcOrXyz : Symbol(abcOrXyz, Decl(stringLiteralTypesWithVariousOperators01.ts, 3, 3))
>abcOrXyz : Symbol(abcOrXyz, Decl(stringLiteralTypesWithVariousOperators01.ts, 3, 3))
let k = +abcOrXyz;
>k : Symbol(k, Decl(stringLiteralTypesWithVariousOperators01.ts, 16, 3))
>abcOrXyz : Symbol(abcOrXyz, Decl(stringLiteralTypesWithVariousOperators01.ts, 3, 3))
let l = -abcOrXyz;
>l : Symbol(l, Decl(stringLiteralTypesWithVariousOperators01.ts, 17, 3))
>abcOrXyz : Symbol(abcOrXyz, Decl(stringLiteralTypesWithVariousOperators01.ts, 3, 3))
let m = abcOrXyzOrNumber + "";
>m : Symbol(m, Decl(stringLiteralTypesWithVariousOperators01.ts, 18, 3))
>abcOrXyzOrNumber : Symbol(abcOrXyzOrNumber, Decl(stringLiteralTypesWithVariousOperators01.ts, 4, 3))
let n = "" + abcOrXyzOrNumber;
>n : Symbol(n, Decl(stringLiteralTypesWithVariousOperators01.ts, 19, 3))
>abcOrXyzOrNumber : Symbol(abcOrXyzOrNumber, Decl(stringLiteralTypesWithVariousOperators01.ts, 4, 3))
let o = abcOrXyzOrNumber + abcOrXyz;
>o : Symbol(o, Decl(stringLiteralTypesWithVariousOperators01.ts, 20, 3))
>abcOrXyzOrNumber : Symbol(abcOrXyzOrNumber, Decl(stringLiteralTypesWithVariousOperators01.ts, 4, 3))
>abcOrXyz : Symbol(abcOrXyz, Decl(stringLiteralTypesWithVariousOperators01.ts, 3, 3))
let p = abcOrXyz + abcOrXyzOrNumber;
>p : Symbol(p, Decl(stringLiteralTypesWithVariousOperators01.ts, 21, 3))
>abcOrXyz : Symbol(abcOrXyz, Decl(stringLiteralTypesWithVariousOperators01.ts, 3, 3))
>abcOrXyzOrNumber : Symbol(abcOrXyzOrNumber, Decl(stringLiteralTypesWithVariousOperators01.ts, 4, 3))
let q = !abcOrXyzOrNumber;
>q : Symbol(q, Decl(stringLiteralTypesWithVariousOperators01.ts, 22, 3))
>abcOrXyzOrNumber : Symbol(abcOrXyzOrNumber, Decl(stringLiteralTypesWithVariousOperators01.ts, 4, 3))
let r = ~abcOrXyzOrNumber;
>r : Symbol(r, Decl(stringLiteralTypesWithVariousOperators01.ts, 23, 3))
>abcOrXyzOrNumber : Symbol(abcOrXyzOrNumber, Decl(stringLiteralTypesWithVariousOperators01.ts, 4, 3))
let s = abcOrXyzOrNumber < abcOrXyzOrNumber;
>s : Symbol(s, Decl(stringLiteralTypesWithVariousOperators01.ts, 24, 3))
>abcOrXyzOrNumber : Symbol(abcOrXyzOrNumber, Decl(stringLiteralTypesWithVariousOperators01.ts, 4, 3))
>abcOrXyzOrNumber : Symbol(abcOrXyzOrNumber, Decl(stringLiteralTypesWithVariousOperators01.ts, 4, 3))
let t = abcOrXyzOrNumber >= abcOrXyz;
>t : Symbol(t, Decl(stringLiteralTypesWithVariousOperators01.ts, 25, 3))
>abcOrXyzOrNumber : Symbol(abcOrXyzOrNumber, Decl(stringLiteralTypesWithVariousOperators01.ts, 4, 3))
>abcOrXyz : Symbol(abcOrXyz, Decl(stringLiteralTypesWithVariousOperators01.ts, 3, 3))
let u = abc === abcOrXyz;
>u : Symbol(u, Decl(stringLiteralTypesWithVariousOperators01.ts, 26, 3))
>abc : Symbol(abc, Decl(stringLiteralTypesWithVariousOperators01.ts, 1, 3))
>abcOrXyz : Symbol(abcOrXyz, Decl(stringLiteralTypesWithVariousOperators01.ts, 3, 3))
let v = abcOrXyz === abcOrXyzOrNumber;
>v : Symbol(v, Decl(stringLiteralTypesWithVariousOperators01.ts, 27, 3))
>abcOrXyz : Symbol(abcOrXyz, Decl(stringLiteralTypesWithVariousOperators01.ts, 3, 3))
>abcOrXyzOrNumber : Symbol(abcOrXyzOrNumber, Decl(stringLiteralTypesWithVariousOperators01.ts, 4, 3))

View File

@ -0,0 +1,152 @@
=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators01.ts ===
let abc: "ABC" = "ABC";
>abc : "ABC"
>"ABC" : "ABC"
let xyz: "XYZ" = "XYZ";
>xyz : "XYZ"
>"XYZ" : "XYZ"
let abcOrXyz: "ABC" | "XYZ" = abc || xyz;
>abcOrXyz : "ABC" | "XYZ"
>abc || xyz : "ABC" | "XYZ"
>abc : "ABC"
>xyz : "XYZ"
let abcOrXyzOrNumber: "ABC" | "XYZ" | number = abcOrXyz || 100;
>abcOrXyzOrNumber : "ABC" | "XYZ" | number
>abcOrXyz || 100 : "ABC" | "XYZ" | number
>abcOrXyz : "ABC" | "XYZ"
>100 : number
let a = "" + abc;
>a : string
>"" + abc : string
>"" : string
>abc : "ABC"
let b = abc + "";
>b : string
>abc + "" : string
>abc : "ABC"
>"" : string
let c = 10 + abc;
>c : string
>10 + abc : string
>10 : number
>abc : "ABC"
let d = abc + 10;
>d : string
>abc + 10 : string
>abc : "ABC"
>10 : number
let e = xyz + abc;
>e : string
>xyz + abc : string
>xyz : "XYZ"
>abc : "ABC"
let f = abc + xyz;
>f : string
>abc + xyz : string
>abc : "ABC"
>xyz : "XYZ"
let g = true + abc;
>g : string
>true + abc : string
>true : boolean
>abc : "ABC"
let h = abc + true;
>h : string
>abc + true : string
>abc : "ABC"
>true : boolean
let i = abc + abcOrXyz + xyz;
>i : string
>abc + abcOrXyz + xyz : string
>abc + abcOrXyz : string
>abc : "ABC"
>abcOrXyz : "ABC" | "XYZ"
>xyz : "XYZ"
let j = abcOrXyz + abcOrXyz;
>j : string
>abcOrXyz + abcOrXyz : string
>abcOrXyz : "ABC" | "XYZ"
>abcOrXyz : "ABC" | "XYZ"
let k = +abcOrXyz;
>k : number
>+abcOrXyz : number
>abcOrXyz : "ABC" | "XYZ"
let l = -abcOrXyz;
>l : number
>-abcOrXyz : number
>abcOrXyz : "ABC" | "XYZ"
let m = abcOrXyzOrNumber + "";
>m : string
>abcOrXyzOrNumber + "" : string
>abcOrXyzOrNumber : "ABC" | "XYZ" | number
>"" : string
let n = "" + abcOrXyzOrNumber;
>n : string
>"" + abcOrXyzOrNumber : string
>"" : string
>abcOrXyzOrNumber : "ABC" | "XYZ" | number
let o = abcOrXyzOrNumber + abcOrXyz;
>o : string
>abcOrXyzOrNumber + abcOrXyz : string
>abcOrXyzOrNumber : "ABC" | "XYZ" | number
>abcOrXyz : "ABC" | "XYZ"
let p = abcOrXyz + abcOrXyzOrNumber;
>p : string
>abcOrXyz + abcOrXyzOrNumber : string
>abcOrXyz : "ABC" | "XYZ"
>abcOrXyzOrNumber : "ABC" | "XYZ" | number
let q = !abcOrXyzOrNumber;
>q : boolean
>!abcOrXyzOrNumber : boolean
>abcOrXyzOrNumber : "ABC" | "XYZ" | number
let r = ~abcOrXyzOrNumber;
>r : number
>~abcOrXyzOrNumber : number
>abcOrXyzOrNumber : "ABC" | "XYZ" | number
let s = abcOrXyzOrNumber < abcOrXyzOrNumber;
>s : boolean
>abcOrXyzOrNumber < abcOrXyzOrNumber : boolean
>abcOrXyzOrNumber : "ABC" | "XYZ" | number
>abcOrXyzOrNumber : "ABC" | "XYZ" | number
let t = abcOrXyzOrNumber >= abcOrXyz;
>t : boolean
>abcOrXyzOrNumber >= abcOrXyz : boolean
>abcOrXyzOrNumber : "ABC" | "XYZ" | number
>abcOrXyz : "ABC" | "XYZ"
let u = abc === abcOrXyz;
>u : boolean
>abc === abcOrXyz : boolean
>abc : "ABC"
>abcOrXyz : "ABC" | "XYZ"
let v = abcOrXyz === abcOrXyzOrNumber;
>v : boolean
>abcOrXyz === abcOrXyzOrNumber : boolean
>abcOrXyz : "ABC" | "XYZ"
>abcOrXyzOrNumber : "ABC" | "XYZ" | number

View File

@ -0,0 +1,57 @@
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(7,9): error TS2365: Operator '+' cannot be applied to types '"ABC" | "XYZ" | number' and 'number'.
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(8,9): error TS2365: Operator '+' cannot be applied to types 'number' and '"ABC" | "XYZ" | number'.
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(9,9): error TS2365: Operator '+' cannot be applied to types '"ABC" | "XYZ" | number' and '"ABC" | "XYZ" | number'.
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(10,9): error TS2365: Operator '+' cannot be applied to types '"ABC" | "XYZ" | number' and 'boolean'.
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(11,9): error TS2365: Operator '+' cannot be applied to types 'boolean' and '"ABC" | "XYZ" | number'.
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(12,9): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(13,11): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(14,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(15,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(16,9): error TS2365: Operator '<' cannot be applied to types '"ABC"' and '"XYZ"'.
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(17,9): error TS2365: Operator '===' cannot be applied to types '"ABC"' and '"XYZ"'.
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(18,9): error TS2365: Operator '!=' cannot be applied to types '"ABC"' and '"XYZ"'.
==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts (12 errors) ====
let abc: "ABC" = "ABC";
let xyz: "XYZ" = "XYZ";
let abcOrXyz: "ABC" | "XYZ" = abc || xyz;
let abcOrXyzOrNumber: "ABC" | "XYZ" | number = abcOrXyz || 100;
let a = abcOrXyzOrNumber + 100;
~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2365: Operator '+' cannot be applied to types '"ABC" | "XYZ" | number' and 'number'.
let b = 100 + abcOrXyzOrNumber;
~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2365: Operator '+' cannot be applied to types 'number' and '"ABC" | "XYZ" | number'.
let c = abcOrXyzOrNumber + abcOrXyzOrNumber;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2365: Operator '+' cannot be applied to types '"ABC" | "XYZ" | number' and '"ABC" | "XYZ" | number'.
let d = abcOrXyzOrNumber + true;
~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2365: Operator '+' cannot be applied to types '"ABC" | "XYZ" | number' and 'boolean'.
let e = false + abcOrXyzOrNumber;
~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2365: Operator '+' cannot be applied to types 'boolean' and '"ABC" | "XYZ" | number'.
let f = abcOrXyzOrNumber++;
~~~~~~~~~~~~~~~~
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
let g = --abcOrXyzOrNumber;
~~~~~~~~~~~~~~~~
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
let h = abcOrXyzOrNumber ^ 10;
~~~~~~~~~~~~~~~~
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
let i = abcOrXyzOrNumber | 10;
~~~~~~~~~~~~~~~~
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
let j = abc < xyz;
~~~~~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '"ABC"' and '"XYZ"'.
let k = abc === xyz;
~~~~~~~~~~~
!!! error TS2365: Operator '===' cannot be applied to types '"ABC"' and '"XYZ"'.
let l = abc != xyz;
~~~~~~~~~~
!!! error TS2365: Operator '!=' cannot be applied to types '"ABC"' and '"XYZ"'.

View File

@ -0,0 +1,56 @@
//// [stringLiteralTypesWithVariousOperators02.ts]
let abc: "ABC" = "ABC";
let xyz: "XYZ" = "XYZ";
let abcOrXyz: "ABC" | "XYZ" = abc || xyz;
let abcOrXyzOrNumber: "ABC" | "XYZ" | number = abcOrXyz || 100;
let a = abcOrXyzOrNumber + 100;
let b = 100 + abcOrXyzOrNumber;
let c = abcOrXyzOrNumber + abcOrXyzOrNumber;
let d = abcOrXyzOrNumber + true;
let e = false + abcOrXyzOrNumber;
let f = abcOrXyzOrNumber++;
let g = --abcOrXyzOrNumber;
let h = abcOrXyzOrNumber ^ 10;
let i = abcOrXyzOrNumber | 10;
let j = abc < xyz;
let k = abc === xyz;
let l = abc != xyz;
//// [stringLiteralTypesWithVariousOperators02.js]
var abc = "ABC";
var xyz = "XYZ";
var abcOrXyz = abc || xyz;
var abcOrXyzOrNumber = abcOrXyz || 100;
var a = abcOrXyzOrNumber + 100;
var b = 100 + abcOrXyzOrNumber;
var c = abcOrXyzOrNumber + abcOrXyzOrNumber;
var d = abcOrXyzOrNumber + true;
var e = false + abcOrXyzOrNumber;
var f = abcOrXyzOrNumber++;
var g = --abcOrXyzOrNumber;
var h = abcOrXyzOrNumber ^ 10;
var i = abcOrXyzOrNumber | 10;
var j = abc < xyz;
var k = abc === xyz;
var l = abc != xyz;
//// [stringLiteralTypesWithVariousOperators02.d.ts]
declare let abc: "ABC";
declare let xyz: "XYZ";
declare let abcOrXyz: "ABC" | "XYZ";
declare let abcOrXyzOrNumber: "ABC" | "XYZ" | number;
declare let a: any;
declare let b: any;
declare let c: any;
declare let d: any;
declare let e: any;
declare let f: number;
declare let g: number;
declare let h: number;
declare let i: number;
declare let j: boolean;
declare let k: boolean;
declare let l: boolean;