From 007d28daa6681cc52acd3ff50fb302ac35c9d7c0 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Thu, 21 Jun 2018 21:42:14 -0700 Subject: [PATCH] Accepted baselines. --- ...OnWeakTypeIntersectionTargets01.errors.txt | 94 ++++++++++++++++++ .../errorsOnWeakTypeIntersectionTargets01.js | 73 ++++++++++++++ ...orsOnWeakTypeIntersectionTargets01.symbols | 84 ++++++++++++++++ ...rrorsOnWeakTypeIntersectionTargets01.types | 99 +++++++++++++++++++ 4 files changed, 350 insertions(+) create mode 100644 tests/baselines/reference/errorsOnWeakTypeIntersectionTargets01.errors.txt create mode 100644 tests/baselines/reference/errorsOnWeakTypeIntersectionTargets01.js create mode 100644 tests/baselines/reference/errorsOnWeakTypeIntersectionTargets01.symbols create mode 100644 tests/baselines/reference/errorsOnWeakTypeIntersectionTargets01.types diff --git a/tests/baselines/reference/errorsOnWeakTypeIntersectionTargets01.errors.txt b/tests/baselines/reference/errorsOnWeakTypeIntersectionTargets01.errors.txt new file mode 100644 index 00000000000..97405007089 --- /dev/null +++ b/tests/baselines/reference/errorsOnWeakTypeIntersectionTargets01.errors.txt @@ -0,0 +1,94 @@ +tests/cases/compiler/errorsOnWeakTypeIntersectionTargets01.ts(10,12): error TS2322: Type '{ a: number; b: number; }' is not assignable to type 'A & B'. + Type '{ a: number; b: number; }' is not assignable to type 'B'. + Types of property 'b' are incompatible. + Type 'number' is not assignable to type 'string'. +tests/cases/compiler/errorsOnWeakTypeIntersectionTargets01.ts(16,12): error TS2322: Type '{ a: string; b: string; }' is not assignable to type 'A & B'. + Type '{ a: string; b: string; }' is not assignable to type 'A'. + Types of property 'a' are incompatible. + Type 'string' is not assignable to type 'number'. +tests/cases/compiler/errorsOnWeakTypeIntersectionTargets01.ts(22,12): error TS2322: Type '{ a: string; }' is not assignable to type 'A & B'. + Type '{ a: string; }' is not assignable to type 'A'. + Types of property 'a' are incompatible. + Type 'string' is not assignable to type 'number'. +tests/cases/compiler/errorsOnWeakTypeIntersectionTargets01.ts(27,12): error TS2322: Type '{ a: string; b: number; }' is not assignable to type 'A & B'. + Type '{ a: string; b: number; }' is not assignable to type 'A'. + Types of property 'a' are incompatible. + Type 'string' is not assignable to type 'number'. +tests/cases/compiler/errorsOnWeakTypeIntersectionTargets01.ts(33,12): error TS2322: Type '{ b: number; }' is not assignable to type 'A & B'. + Type '{ b: number; }' is not assignable to type 'A'. + Property 'a' is missing in type '{ b: number; }'. +tests/cases/compiler/errorsOnWeakTypeIntersectionTargets01.ts(38,12): error TS2322: Type '{ b: string; }' is not assignable to type 'A & B'. + Type '{ b: string; }' is not assignable to type 'A'. + Property 'a' is missing in type '{ b: string; }'. + + +==== tests/cases/compiler/errorsOnWeakTypeIntersectionTargets01.ts (6 errors) ==== + interface A { + a: number; + } + + interface B { + b?: string; + } + + // 'b' is incompatible. + export let x1: A & B = { + ~~ +!!! error TS2322: Type '{ a: number; b: number; }' is not assignable to type 'A & B'. +!!! error TS2322: Type '{ a: number; b: number; }' is not assignable to type 'B'. +!!! error TS2322: Types of property 'b' are incompatible. +!!! error TS2322: Type 'number' is not assignable to type 'string'. + a: 0, + b: 12, + } + + // 'a' is incompatible, 'b' is present and compatible. + export let x2: A & B = { + ~~ +!!! error TS2322: Type '{ a: string; b: string; }' is not assignable to type 'A & B'. +!!! error TS2322: Type '{ a: string; b: string; }' is not assignable to type 'A'. +!!! error TS2322: Types of property 'a' are incompatible. +!!! error TS2322: Type 'string' is not assignable to type 'number'. + a: "hello", + b: "hello", + } + + // 'a' is incompatible, 'b' is absent. + export let x3: A & B = { + ~~ +!!! error TS2322: Type '{ a: string; }' is not assignable to type 'A & B'. +!!! error TS2322: Type '{ a: string; }' is not assignable to type 'A'. +!!! error TS2322: Types of property 'a' are incompatible. +!!! error TS2322: Type 'string' is not assignable to type 'number'. + a: "hello", + } + + // Both 'a' and 'b' are incompatible + export let x4: A & B = { + ~~ +!!! error TS2322: Type '{ a: string; b: number; }' is not assignable to type 'A & B'. +!!! error TS2322: Type '{ a: string; b: number; }' is not assignable to type 'A'. +!!! error TS2322: Types of property 'a' are incompatible. +!!! error TS2322: Type 'string' is not assignable to type 'number'. + a: "hello", + b: 0, + } + + // 'b' is compatible, 'a' is missing + export let x5: A & B = { + ~~ +!!! error TS2322: Type '{ b: number; }' is not assignable to type 'A & B'. +!!! error TS2322: Type '{ b: number; }' is not assignable to type 'A'. +!!! error TS2322: Property 'a' is missing in type '{ b: number; }'. + b: 0, + } + + // 'b' is incompatible, 'a' is missing + export let x6: A & B = { + ~~ +!!! error TS2322: Type '{ b: string; }' is not assignable to type 'A & B'. +!!! error TS2322: Type '{ b: string; }' is not assignable to type 'A'. +!!! error TS2322: Property 'a' is missing in type '{ b: string; }'. + b: "", + } + \ No newline at end of file diff --git a/tests/baselines/reference/errorsOnWeakTypeIntersectionTargets01.js b/tests/baselines/reference/errorsOnWeakTypeIntersectionTargets01.js new file mode 100644 index 00000000000..d8b8df75665 --- /dev/null +++ b/tests/baselines/reference/errorsOnWeakTypeIntersectionTargets01.js @@ -0,0 +1,73 @@ +//// [errorsOnWeakTypeIntersectionTargets01.ts] +interface A { + a: number; +} + +interface B { + b?: string; +} + +// 'b' is incompatible. +export let x1: A & B = { + a: 0, + b: 12, +} + +// 'a' is incompatible, 'b' is present and compatible. +export let x2: A & B = { + a: "hello", + b: "hello", +} + +// 'a' is incompatible, 'b' is absent. +export let x3: A & B = { + a: "hello", +} + +// Both 'a' and 'b' are incompatible +export let x4: A & B = { + a: "hello", + b: 0, +} + +// 'b' is compatible, 'a' is missing +export let x5: A & B = { + b: 0, +} + +// 'b' is incompatible, 'a' is missing +export let x6: A & B = { + b: "", +} + + +//// [errorsOnWeakTypeIntersectionTargets01.js] +"use strict"; +exports.__esModule = true; +// 'b' is incompatible. +exports.x1 = { + a: 0, + b: 12 +}; +// 'a' is incompatible, 'b' is present and compatible. +exports.x2 = { + a: "hello", + b: "hello" +}; +// 'a' is incompatible, 'b' is absent. +exports.x3 = { + a: "hello" +}; +// Both 'a' and 'b' are incompatible +exports.x4 = { + a: "hello", + b: 0 +}; +// 'b' is compatible, 'a' is missing +exports.x5 = { + b: 0 +}; +// 'b' is incompatible, 'a' is missing +exports.x6 = { + b: "" +}; diff --git a/tests/baselines/reference/errorsOnWeakTypeIntersectionTargets01.symbols b/tests/baselines/reference/errorsOnWeakTypeIntersectionTargets01.symbols new file mode 100644 index 00000000000..ae3e65e9c20 --- /dev/null +++ b/tests/baselines/reference/errorsOnWeakTypeIntersectionTargets01.symbols @@ -0,0 +1,84 @@ +=== tests/cases/compiler/errorsOnWeakTypeIntersectionTargets01.ts === +interface A { +>A : Symbol(A, Decl(errorsOnWeakTypeIntersectionTargets01.ts, 0, 0)) + + a: number; +>a : Symbol(A.a, Decl(errorsOnWeakTypeIntersectionTargets01.ts, 0, 13)) +} + +interface B { +>B : Symbol(B, Decl(errorsOnWeakTypeIntersectionTargets01.ts, 2, 1)) + + b?: string; +>b : Symbol(B.b, Decl(errorsOnWeakTypeIntersectionTargets01.ts, 4, 13)) +} + +// 'b' is incompatible. +export let x1: A & B = { +>x1 : Symbol(x1, Decl(errorsOnWeakTypeIntersectionTargets01.ts, 9, 10)) +>A : Symbol(A, Decl(errorsOnWeakTypeIntersectionTargets01.ts, 0, 0)) +>B : Symbol(B, Decl(errorsOnWeakTypeIntersectionTargets01.ts, 2, 1)) + + a: 0, +>a : Symbol(a, Decl(errorsOnWeakTypeIntersectionTargets01.ts, 9, 24)) + + b: 12, +>b : Symbol(b, Decl(errorsOnWeakTypeIntersectionTargets01.ts, 10, 9)) +} + +// 'a' is incompatible, 'b' is present and compatible. +export let x2: A & B = { +>x2 : Symbol(x2, Decl(errorsOnWeakTypeIntersectionTargets01.ts, 15, 10)) +>A : Symbol(A, Decl(errorsOnWeakTypeIntersectionTargets01.ts, 0, 0)) +>B : Symbol(B, Decl(errorsOnWeakTypeIntersectionTargets01.ts, 2, 1)) + + a: "hello", +>a : Symbol(a, Decl(errorsOnWeakTypeIntersectionTargets01.ts, 15, 24)) + + b: "hello", +>b : Symbol(b, Decl(errorsOnWeakTypeIntersectionTargets01.ts, 16, 15)) +} + +// 'a' is incompatible, 'b' is absent. +export let x3: A & B = { +>x3 : Symbol(x3, Decl(errorsOnWeakTypeIntersectionTargets01.ts, 21, 10)) +>A : Symbol(A, Decl(errorsOnWeakTypeIntersectionTargets01.ts, 0, 0)) +>B : Symbol(B, Decl(errorsOnWeakTypeIntersectionTargets01.ts, 2, 1)) + + a: "hello", +>a : Symbol(a, Decl(errorsOnWeakTypeIntersectionTargets01.ts, 21, 24)) +} + +// Both 'a' and 'b' are incompatible +export let x4: A & B = { +>x4 : Symbol(x4, Decl(errorsOnWeakTypeIntersectionTargets01.ts, 26, 10)) +>A : Symbol(A, Decl(errorsOnWeakTypeIntersectionTargets01.ts, 0, 0)) +>B : Symbol(B, Decl(errorsOnWeakTypeIntersectionTargets01.ts, 2, 1)) + + a: "hello", +>a : Symbol(a, Decl(errorsOnWeakTypeIntersectionTargets01.ts, 26, 24)) + + b: 0, +>b : Symbol(b, Decl(errorsOnWeakTypeIntersectionTargets01.ts, 27, 15)) +} + +// 'b' is compatible, 'a' is missing +export let x5: A & B = { +>x5 : Symbol(x5, Decl(errorsOnWeakTypeIntersectionTargets01.ts, 32, 10)) +>A : Symbol(A, Decl(errorsOnWeakTypeIntersectionTargets01.ts, 0, 0)) +>B : Symbol(B, Decl(errorsOnWeakTypeIntersectionTargets01.ts, 2, 1)) + + b: 0, +>b : Symbol(b, Decl(errorsOnWeakTypeIntersectionTargets01.ts, 32, 24)) +} + +// 'b' is incompatible, 'a' is missing +export let x6: A & B = { +>x6 : Symbol(x6, Decl(errorsOnWeakTypeIntersectionTargets01.ts, 37, 10)) +>A : Symbol(A, Decl(errorsOnWeakTypeIntersectionTargets01.ts, 0, 0)) +>B : Symbol(B, Decl(errorsOnWeakTypeIntersectionTargets01.ts, 2, 1)) + + b: "", +>b : Symbol(b, Decl(errorsOnWeakTypeIntersectionTargets01.ts, 37, 24)) +} + diff --git a/tests/baselines/reference/errorsOnWeakTypeIntersectionTargets01.types b/tests/baselines/reference/errorsOnWeakTypeIntersectionTargets01.types new file mode 100644 index 00000000000..e59c7ccfcf9 --- /dev/null +++ b/tests/baselines/reference/errorsOnWeakTypeIntersectionTargets01.types @@ -0,0 +1,99 @@ +=== tests/cases/compiler/errorsOnWeakTypeIntersectionTargets01.ts === +interface A { +>A : A + + a: number; +>a : number +} + +interface B { +>B : B + + b?: string; +>b : string +} + +// 'b' is incompatible. +export let x1: A & B = { +>x1 : A & B +>A : A +>B : B +>{ a: 0, b: 12,} : { a: number; b: number; } + + a: 0, +>a : number +>0 : 0 + + b: 12, +>b : number +>12 : 12 +} + +// 'a' is incompatible, 'b' is present and compatible. +export let x2: A & B = { +>x2 : A & B +>A : A +>B : B +>{ a: "hello", b: "hello",} : { a: string; b: string; } + + a: "hello", +>a : string +>"hello" : "hello" + + b: "hello", +>b : string +>"hello" : "hello" +} + +// 'a' is incompatible, 'b' is absent. +export let x3: A & B = { +>x3 : A & B +>A : A +>B : B +>{ a: "hello",} : { a: string; } + + a: "hello", +>a : string +>"hello" : "hello" +} + +// Both 'a' and 'b' are incompatible +export let x4: A & B = { +>x4 : A & B +>A : A +>B : B +>{ a: "hello", b: 0,} : { a: string; b: number; } + + a: "hello", +>a : string +>"hello" : "hello" + + b: 0, +>b : number +>0 : 0 +} + +// 'b' is compatible, 'a' is missing +export let x5: A & B = { +>x5 : A & B +>A : A +>B : B +>{ b: 0,} : { b: number; } + + b: 0, +>b : number +>0 : 0 +} + +// 'b' is incompatible, 'a' is missing +export let x6: A & B = { +>x6 : A & B +>A : A +>B : B +>{ b: "",} : { b: string; } + + b: "", +>b : string +>"" : "" +} +