Accepted baselines.

This commit is contained in:
Daniel Rosenwasser
2018-06-21 21:42:14 -07:00
parent b94fd85339
commit 007d28daa6
4 changed files with 350 additions and 0 deletions

View File

@@ -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: "",
}

View File

@@ -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: ""
};

View File

@@ -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))
}

View File

@@ -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
>"" : ""
}