Accepting new baselines

This commit is contained in:
Anders Hejlsberg
2016-02-06 15:34:32 -08:00
parent 4540998289
commit 788ba3c6ac
3 changed files with 289 additions and 0 deletions

View File

@@ -0,0 +1,57 @@
//// [operatorsAndIntersectionTypes.ts]
type Guid = string & { $Guid }; // Tagged string type
type SerialNo = number & { $SerialNo }; // Tagged number type
function createGuid() {
return "21EC2020-3AEA-4069-A2DD-08002B30309D" as Guid;
}
function createSerialNo() {
return 12345 as SerialNo;
}
let map1: { [x: string]: number } = {};
let guid = createGuid();
map1[guid] = 123; // Can with tagged string
let map2: { [x: number]: string } = {};
let serialNo = createSerialNo();
map2[serialNo] = "hello"; // Can index with tagged number
const s1 = "{" + guid + "}";
const s2 = guid.toLowerCase();
const s3 = guid + guid;
const s4 = guid + serialNo;
const s5 = serialNo.toPrecision(0);
const n1 = serialNo * 3;
const n2 = serialNo + serialNo;
const b1 = guid === "";
const b2 = guid === guid;
const b3 = serialNo === 0;
const b4 = serialNo === serialNo;
//// [operatorsAndIntersectionTypes.js]
function createGuid() {
return "21EC2020-3AEA-4069-A2DD-08002B30309D";
}
function createSerialNo() {
return 12345;
}
var map1 = {};
var guid = createGuid();
map1[guid] = 123; // Can with tagged string
var map2 = {};
var serialNo = createSerialNo();
map2[serialNo] = "hello"; // Can index with tagged number
var s1 = "{" + guid + "}";
var s2 = guid.toLowerCase();
var s3 = guid + guid;
var s4 = guid + serialNo;
var s5 = serialNo.toPrecision(0);
var n1 = serialNo * 3;
var n2 = serialNo + serialNo;
var b1 = guid === "";
var b2 = guid === guid;
var b3 = serialNo === 0;
var b4 = serialNo === serialNo;

View File

@@ -0,0 +1,100 @@
=== tests/cases/conformance/types/intersection/operatorsAndIntersectionTypes.ts ===
type Guid = string & { $Guid }; // Tagged string type
>Guid : Symbol(Guid, Decl(operatorsAndIntersectionTypes.ts, 0, 0))
>$Guid : Symbol($Guid, Decl(operatorsAndIntersectionTypes.ts, 0, 22))
type SerialNo = number & { $SerialNo }; // Tagged number type
>SerialNo : Symbol(SerialNo, Decl(operatorsAndIntersectionTypes.ts, 0, 31))
>$SerialNo : Symbol($SerialNo, Decl(operatorsAndIntersectionTypes.ts, 1, 26))
function createGuid() {
>createGuid : Symbol(createGuid, Decl(operatorsAndIntersectionTypes.ts, 1, 39))
return "21EC2020-3AEA-4069-A2DD-08002B30309D" as Guid;
>Guid : Symbol(Guid, Decl(operatorsAndIntersectionTypes.ts, 0, 0))
}
function createSerialNo() {
>createSerialNo : Symbol(createSerialNo, Decl(operatorsAndIntersectionTypes.ts, 5, 1))
return 12345 as SerialNo;
>SerialNo : Symbol(SerialNo, Decl(operatorsAndIntersectionTypes.ts, 0, 31))
}
let map1: { [x: string]: number } = {};
>map1 : Symbol(map1, Decl(operatorsAndIntersectionTypes.ts, 11, 3))
>x : Symbol(x, Decl(operatorsAndIntersectionTypes.ts, 11, 13))
let guid = createGuid();
>guid : Symbol(guid, Decl(operatorsAndIntersectionTypes.ts, 12, 3))
>createGuid : Symbol(createGuid, Decl(operatorsAndIntersectionTypes.ts, 1, 39))
map1[guid] = 123; // Can with tagged string
>map1 : Symbol(map1, Decl(operatorsAndIntersectionTypes.ts, 11, 3))
>guid : Symbol(guid, Decl(operatorsAndIntersectionTypes.ts, 12, 3))
let map2: { [x: number]: string } = {};
>map2 : Symbol(map2, Decl(operatorsAndIntersectionTypes.ts, 15, 3))
>x : Symbol(x, Decl(operatorsAndIntersectionTypes.ts, 15, 13))
let serialNo = createSerialNo();
>serialNo : Symbol(serialNo, Decl(operatorsAndIntersectionTypes.ts, 16, 3))
>createSerialNo : Symbol(createSerialNo, Decl(operatorsAndIntersectionTypes.ts, 5, 1))
map2[serialNo] = "hello"; // Can index with tagged number
>map2 : Symbol(map2, Decl(operatorsAndIntersectionTypes.ts, 15, 3))
>serialNo : Symbol(serialNo, Decl(operatorsAndIntersectionTypes.ts, 16, 3))
const s1 = "{" + guid + "}";
>s1 : Symbol(s1, Decl(operatorsAndIntersectionTypes.ts, 19, 5))
>guid : Symbol(guid, Decl(operatorsAndIntersectionTypes.ts, 12, 3))
const s2 = guid.toLowerCase();
>s2 : Symbol(s2, Decl(operatorsAndIntersectionTypes.ts, 20, 5))
>guid.toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, --, --))
>guid : Symbol(guid, Decl(operatorsAndIntersectionTypes.ts, 12, 3))
>toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, --, --))
const s3 = guid + guid;
>s3 : Symbol(s3, Decl(operatorsAndIntersectionTypes.ts, 21, 5))
>guid : Symbol(guid, Decl(operatorsAndIntersectionTypes.ts, 12, 3))
>guid : Symbol(guid, Decl(operatorsAndIntersectionTypes.ts, 12, 3))
const s4 = guid + serialNo;
>s4 : Symbol(s4, Decl(operatorsAndIntersectionTypes.ts, 22, 5))
>guid : Symbol(guid, Decl(operatorsAndIntersectionTypes.ts, 12, 3))
>serialNo : Symbol(serialNo, Decl(operatorsAndIntersectionTypes.ts, 16, 3))
const s5 = serialNo.toPrecision(0);
>s5 : Symbol(s5, Decl(operatorsAndIntersectionTypes.ts, 23, 5))
>serialNo.toPrecision : Symbol(Number.toPrecision, Decl(lib.d.ts, --, --))
>serialNo : Symbol(serialNo, Decl(operatorsAndIntersectionTypes.ts, 16, 3))
>toPrecision : Symbol(Number.toPrecision, Decl(lib.d.ts, --, --))
const n1 = serialNo * 3;
>n1 : Symbol(n1, Decl(operatorsAndIntersectionTypes.ts, 24, 5))
>serialNo : Symbol(serialNo, Decl(operatorsAndIntersectionTypes.ts, 16, 3))
const n2 = serialNo + serialNo;
>n2 : Symbol(n2, Decl(operatorsAndIntersectionTypes.ts, 25, 5))
>serialNo : Symbol(serialNo, Decl(operatorsAndIntersectionTypes.ts, 16, 3))
>serialNo : Symbol(serialNo, Decl(operatorsAndIntersectionTypes.ts, 16, 3))
const b1 = guid === "";
>b1 : Symbol(b1, Decl(operatorsAndIntersectionTypes.ts, 26, 5))
>guid : Symbol(guid, Decl(operatorsAndIntersectionTypes.ts, 12, 3))
const b2 = guid === guid;
>b2 : Symbol(b2, Decl(operatorsAndIntersectionTypes.ts, 27, 5))
>guid : Symbol(guid, Decl(operatorsAndIntersectionTypes.ts, 12, 3))
>guid : Symbol(guid, Decl(operatorsAndIntersectionTypes.ts, 12, 3))
const b3 = serialNo === 0;
>b3 : Symbol(b3, Decl(operatorsAndIntersectionTypes.ts, 28, 5))
>serialNo : Symbol(serialNo, Decl(operatorsAndIntersectionTypes.ts, 16, 3))
const b4 = serialNo === serialNo;
>b4 : Symbol(b4, Decl(operatorsAndIntersectionTypes.ts, 29, 5))
>serialNo : Symbol(serialNo, Decl(operatorsAndIntersectionTypes.ts, 16, 3))
>serialNo : Symbol(serialNo, Decl(operatorsAndIntersectionTypes.ts, 16, 3))

View File

@@ -0,0 +1,132 @@
=== tests/cases/conformance/types/intersection/operatorsAndIntersectionTypes.ts ===
type Guid = string & { $Guid }; // Tagged string type
>Guid : string & { $Guid: any; }
>$Guid : any
type SerialNo = number & { $SerialNo }; // Tagged number type
>SerialNo : number & { $SerialNo: any; }
>$SerialNo : any
function createGuid() {
>createGuid : () => string & { $Guid: any; }
return "21EC2020-3AEA-4069-A2DD-08002B30309D" as Guid;
>"21EC2020-3AEA-4069-A2DD-08002B30309D" as Guid : string & { $Guid: any; }
>"21EC2020-3AEA-4069-A2DD-08002B30309D" : string
>Guid : string & { $Guid: any; }
}
function createSerialNo() {
>createSerialNo : () => number & { $SerialNo: any; }
return 12345 as SerialNo;
>12345 as SerialNo : number & { $SerialNo: any; }
>12345 : number
>SerialNo : number & { $SerialNo: any; }
}
let map1: { [x: string]: number } = {};
>map1 : { [x: string]: number; }
>x : string
>{} : { [x: string]: undefined; }
let guid = createGuid();
>guid : string & { $Guid: any; }
>createGuid() : string & { $Guid: any; }
>createGuid : () => string & { $Guid: any; }
map1[guid] = 123; // Can with tagged string
>map1[guid] = 123 : number
>map1[guid] : number
>map1 : { [x: string]: number; }
>guid : string & { $Guid: any; }
>123 : number
let map2: { [x: number]: string } = {};
>map2 : { [x: number]: string; }
>x : number
>{} : { [x: number]: undefined; }
let serialNo = createSerialNo();
>serialNo : number & { $SerialNo: any; }
>createSerialNo() : number & { $SerialNo: any; }
>createSerialNo : () => number & { $SerialNo: any; }
map2[serialNo] = "hello"; // Can index with tagged number
>map2[serialNo] = "hello" : string
>map2[serialNo] : string
>map2 : { [x: number]: string; }
>serialNo : number & { $SerialNo: any; }
>"hello" : string
const s1 = "{" + guid + "}";
>s1 : string
>"{" + guid + "}" : string
>"{" + guid : string
>"{" : string
>guid : string & { $Guid: any; }
>"}" : string
const s2 = guid.toLowerCase();
>s2 : string
>guid.toLowerCase() : string
>guid.toLowerCase : () => string
>guid : string & { $Guid: any; }
>toLowerCase : () => string
const s3 = guid + guid;
>s3 : string
>guid + guid : string
>guid : string & { $Guid: any; }
>guid : string & { $Guid: any; }
const s4 = guid + serialNo;
>s4 : string
>guid + serialNo : string
>guid : string & { $Guid: any; }
>serialNo : number & { $SerialNo: any; }
const s5 = serialNo.toPrecision(0);
>s5 : string
>serialNo.toPrecision(0) : string
>serialNo.toPrecision : (precision?: number) => string
>serialNo : number & { $SerialNo: any; }
>toPrecision : (precision?: number) => string
>0 : number
const n1 = serialNo * 3;
>n1 : number
>serialNo * 3 : number
>serialNo : number & { $SerialNo: any; }
>3 : number
const n2 = serialNo + serialNo;
>n2 : number
>serialNo + serialNo : number
>serialNo : number & { $SerialNo: any; }
>serialNo : number & { $SerialNo: any; }
const b1 = guid === "";
>b1 : boolean
>guid === "" : boolean
>guid : string & { $Guid: any; }
>"" : string
const b2 = guid === guid;
>b2 : boolean
>guid === guid : boolean
>guid : string & { $Guid: any; }
>guid : string & { $Guid: any; }
const b3 = serialNo === 0;
>b3 : boolean
>serialNo === 0 : boolean
>serialNo : number & { $SerialNo: any; }
>0 : number
const b4 = serialNo === serialNo;
>b4 : boolean
>serialNo === serialNo : boolean
>serialNo : number & { $SerialNo: any; }
>serialNo : number & { $SerialNo: any; }