Skip to content

Fixed outdated expectation comments #49691

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ tests/cases/conformance/classes/propertyMemberDeclarations/accessorsOverrideProp
}

const obj = new Derived(); // nothing printed
console.log(obj.x); // 1
console.log(obj.x); // number

4 changes: 2 additions & 2 deletions tests/baselines/reference/accessorsOverrideProperty2.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Derived extends Base {
}

const obj = new Derived(); // nothing printed
console.log(obj.x); // 1
console.log(obj.x); // number


//// [accessorsOverrideProperty2.js]
Expand All @@ -21,4 +21,4 @@ class Derived extends Base {
set x(value) { console.log(`x was set to ${value}`); }
}
const obj = new Derived(); // nothing printed
console.log(obj.x); // 1
console.log(obj.x); // number
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const obj = new Derived(); // nothing printed
>obj : Symbol(obj, Decl(accessorsOverrideProperty2.ts, 9, 5))
>Derived : Symbol(Derived, Decl(accessorsOverrideProperty2.ts, 2, 1))

console.log(obj.x); // 1
console.log(obj.x); // number
>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
>console : Symbol(console, Decl(lib.dom.d.ts, --, --))
>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/accessorsOverrideProperty2.types
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const obj = new Derived(); // nothing printed
>new Derived() : Derived
>Derived : typeof Derived

console.log(obj.x); // 1
console.log(obj.x); // number
>console.log(obj.x) : void
>console.log : (...data: any[]) => void
>console : Console
Expand Down
22 changes: 11 additions & 11 deletions tests/baselines/reference/templateLiteralTypes2.errors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ tests/cases/conformance/types/literal/templateLiteralTypes2.ts(32,11): error TS2

==== tests/cases/conformance/types/literal/templateLiteralTypes2.ts (3 errors) ====
function ft1<T extends string>(s: string, n: number, u: 'foo' | 'bar' | 'baz', t: T) {
const c1 = `abc${s}`; // `abc${string}`
const c2 = `abc${n}`; // `abc${number}`
const c3 = `abc${u}`; // "abcfoo" | "abcbar" | "abcbaz"
const c4 = `abc${t}`; // `abc${T}
const c1 = `abc${s}`;
const c2 = `abc${n}`;
const c3 = `abc${u}`;
const c4 = `abc${t}`;
const d1: `abc${string}` = `abc${s}`;
const d2: `abc${number}` = `abc${n}`;
const d3: `abc${'foo' | 'bar' | 'baz'}` = `abc${u}`;
Expand All @@ -20,9 +20,9 @@ tests/cases/conformance/types/literal/templateLiteralTypes2.ts(32,11): error TS2
}

function ft10(s: string) {
const c1 = `abc${s}`; // Widening type `abc${string}`
const c1 = `abc${s}`; // Type string
let v1 = c1; // Type string
const c2 = c1; // Widening type `abc${string}`
const c2 = c1; // Type string
let v2 = c2; // Type string
const c3: `abc${string}` = `abc${s}`;
let v3 = c3; // Type `abc${string}`
Expand All @@ -33,18 +33,18 @@ tests/cases/conformance/types/literal/templateLiteralTypes2.ts(32,11): error TS2
}

function ft11(s: string, cond: boolean) {
const c1 = cond ? `foo${s}` : `bar${s}`; // widening `foo${string}` | widening `bar${string}`
const c1 = cond ? `foo${s}` : `bar${s}`; // string
const c2: `foo${string}` | `bar${string}` = c1; // `foo${string}` | `bar${string}`
~~
!!! error TS2322: Type 'string' is not assignable to type '`foo${string}` | `bar${string}`'.
const c3 = cond ? c1 : c2; // `foo${string}` | `bar${string}`
const c4 = cond ? c3 : `baz${s}`; // `foo${string}` | `bar${string}` | widening `baz${string}`
const c3 = cond ? c1 : c2; // string
const c4 = cond ? c3 : `baz${s}`; // string
const c5: `foo${string}` | `bar${string}` | `baz${string}` = c4; // `foo${string}` | `bar${string}` | `baz${string}`
~~
!!! error TS2322: Type 'string' is not assignable to type '`foo${string}` | `bar${string}` | `baz${string}`'.
let v1 = c1; // string
let v2 = c2; // `foo${string}` | `bar${string}`
let v3 = c3; // `foo${string}` | `bar${string}`
let v3 = c3; // string
let v4 = c4; // string
let v5 = c5; // `foo${string}` | `bar${string}` | `baz${string}`
}
Expand Down Expand Up @@ -102,7 +102,7 @@ tests/cases/conformance/types/literal/templateLiteralTypes2.ts(32,11): error TS2
const t3 = takesLiteral(`foo.bar.${someString}`); // string

const id4 = `foo.bar.${someString}`;
const t4 = takesLiteral(id4); // string
const t4 = takesLiteral(id4); // unknown

declare const someUnion: 'abc' | 'def' | 'ghi';
const t5 = takesLiteral(`foo.bar.${someUnion}`); // "abc" | "def" | "ghi"
Expand Down
44 changes: 22 additions & 22 deletions tests/baselines/reference/templateLiteralTypes2.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
//// [templateLiteralTypes2.ts]
function ft1<T extends string>(s: string, n: number, u: 'foo' | 'bar' | 'baz', t: T) {
const c1 = `abc${s}`; // `abc${string}`
const c2 = `abc${n}`; // `abc${number}`
const c3 = `abc${u}`; // "abcfoo" | "abcbar" | "abcbaz"
const c4 = `abc${t}`; // `abc${T}
const c1 = `abc${s}`;
const c2 = `abc${n}`;
const c3 = `abc${u}`;
const c4 = `abc${t}`;
const d1: `abc${string}` = `abc${s}`;
const d2: `abc${number}` = `abc${n}`;
const d3: `abc${'foo' | 'bar' | 'baz'}` = `abc${u}`;
Expand All @@ -15,9 +15,9 @@ function ft2(s: string) {
}

function ft10(s: string) {
const c1 = `abc${s}`; // Widening type `abc${string}`
const c1 = `abc${s}`; // Type string
let v1 = c1; // Type string
const c2 = c1; // Widening type `abc${string}`
const c2 = c1; // Type string
let v2 = c2; // Type string
const c3: `abc${string}` = `abc${s}`;
let v3 = c3; // Type `abc${string}`
Expand All @@ -26,14 +26,14 @@ function ft10(s: string) {
}

function ft11(s: string, cond: boolean) {
const c1 = cond ? `foo${s}` : `bar${s}`; // widening `foo${string}` | widening `bar${string}`
const c1 = cond ? `foo${s}` : `bar${s}`; // string
const c2: `foo${string}` | `bar${string}` = c1; // `foo${string}` | `bar${string}`
const c3 = cond ? c1 : c2; // `foo${string}` | `bar${string}`
const c4 = cond ? c3 : `baz${s}`; // `foo${string}` | `bar${string}` | widening `baz${string}`
const c3 = cond ? c1 : c2; // string
const c4 = cond ? c3 : `baz${s}`; // string
const c5: `foo${string}` | `bar${string}` | `baz${string}` = c4; // `foo${string}` | `bar${string}` | `baz${string}`
let v1 = c1; // string
let v2 = c2; // `foo${string}` | `bar${string}`
let v3 = c3; // `foo${string}` | `bar${string}`
let v3 = c3; // string
let v4 = c4; // string
let v5 = c5; // `foo${string}` | `bar${string}` | `baz${string}`
}
Expand Down Expand Up @@ -91,7 +91,7 @@ declare const someString: string;
const t3 = takesLiteral(`foo.bar.${someString}`); // string

const id4 = `foo.bar.${someString}`;
const t4 = takesLiteral(id4); // string
const t4 = takesLiteral(id4); // unknown

declare const someUnion: 'abc' | 'def' | 'ghi';
const t5 = takesLiteral(`foo.bar.${someUnion}`); // "abc" | "def" | "ghi"
Expand Down Expand Up @@ -122,10 +122,10 @@ C2(`rotate(${interpolatedStyle.rotate}dig)`);
//// [templateLiteralTypes2.js]
"use strict";
function ft1(s, n, u, t) {
var c1 = "abc".concat(s); // `abc${string}`
var c2 = "abc".concat(n); // `abc${number}`
var c3 = "abc".concat(u); // "abcfoo" | "abcbar" | "abcbaz"
var c4 = "abc".concat(t); // `abc${T}
var c1 = "abc".concat(s);
var c2 = "abc".concat(n);
var c3 = "abc".concat(u);
var c4 = "abc".concat(t);
var d1 = "abc".concat(s);
var d2 = "abc".concat(n);
var d3 = "abc".concat(u);
Expand All @@ -135,24 +135,24 @@ function ft2(s) {
return "abc".concat(s);
}
function ft10(s) {
var c1 = "abc".concat(s); // Widening type `abc${string}`
var c1 = "abc".concat(s); // Type string
var v1 = c1; // Type string
var c2 = c1; // Widening type `abc${string}`
var c2 = c1; // Type string
var v2 = c2; // Type string
var c3 = "abc".concat(s);
var v3 = c3; // Type `abc${string}`
var c4 = c1; // Type `abc${string}`
var v4 = c4; // Type `abc${string}`
}
function ft11(s, cond) {
var c1 = cond ? "foo".concat(s) : "bar".concat(s); // widening `foo${string}` | widening `bar${string}`
var c1 = cond ? "foo".concat(s) : "bar".concat(s); // string
var c2 = c1; // `foo${string}` | `bar${string}`
var c3 = cond ? c1 : c2; // `foo${string}` | `bar${string}`
var c4 = cond ? c3 : "baz".concat(s); // `foo${string}` | `bar${string}` | widening `baz${string}`
var c3 = cond ? c1 : c2; // string
var c4 = cond ? c3 : "baz".concat(s); // string
var c5 = c4; // `foo${string}` | `bar${string}` | `baz${string}`
var v1 = c1; // string
var v2 = c2; // `foo${string}` | `bar${string}`
var v3 = c3; // `foo${string}` | `bar${string}`
var v3 = c3; // string
var v4 = c4; // string
var v5 = c5; // `foo${string}` | `bar${string}` | `baz${string}`
}
Expand Down Expand Up @@ -190,7 +190,7 @@ var id2 = "foo.bar.baz";
var t2 = takesLiteral(id2); // "baz"
var t3 = takesLiteral("foo.bar.".concat(someString)); // string
var id4 = "foo.bar.".concat(someString);
var t4 = takesLiteral(id4); // string
var t4 = takesLiteral(id4); // unknown
var t5 = takesLiteral("foo.bar.".concat(someUnion)); // "abc" | "def" | "ghi"
// Repro from #41732
var pixelValue = 22;
Expand Down
22 changes: 11 additions & 11 deletions tests/baselines/reference/templateLiteralTypes2.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ function ft1<T extends string>(s: string, n: number, u: 'foo' | 'bar' | 'baz', t
>t : Symbol(t, Decl(templateLiteralTypes2.ts, 0, 78))
>T : Symbol(T, Decl(templateLiteralTypes2.ts, 0, 13))

const c1 = `abc${s}`; // `abc${string}`
const c1 = `abc${s}`;
>c1 : Symbol(c1, Decl(templateLiteralTypes2.ts, 1, 9))
>s : Symbol(s, Decl(templateLiteralTypes2.ts, 0, 31))

const c2 = `abc${n}`; // `abc${number}`
const c2 = `abc${n}`;
>c2 : Symbol(c2, Decl(templateLiteralTypes2.ts, 2, 9))
>n : Symbol(n, Decl(templateLiteralTypes2.ts, 0, 41))

const c3 = `abc${u}`; // "abcfoo" | "abcbar" | "abcbaz"
const c3 = `abc${u}`;
>c3 : Symbol(c3, Decl(templateLiteralTypes2.ts, 3, 9))
>u : Symbol(u, Decl(templateLiteralTypes2.ts, 0, 52))

const c4 = `abc${t}`; // `abc${T}
const c4 = `abc${t}`;
>c4 : Symbol(c4, Decl(templateLiteralTypes2.ts, 4, 9))
>t : Symbol(t, Decl(templateLiteralTypes2.ts, 0, 78))

Expand Down Expand Up @@ -54,15 +54,15 @@ function ft10(s: string) {
>ft10 : Symbol(ft10, Decl(templateLiteralTypes2.ts, 13, 1))
>s : Symbol(s, Decl(templateLiteralTypes2.ts, 15, 14))

const c1 = `abc${s}`; // Widening type `abc${string}`
const c1 = `abc${s}`; // Type string
>c1 : Symbol(c1, Decl(templateLiteralTypes2.ts, 16, 9))
>s : Symbol(s, Decl(templateLiteralTypes2.ts, 15, 14))

let v1 = c1; // Type string
>v1 : Symbol(v1, Decl(templateLiteralTypes2.ts, 17, 7))
>c1 : Symbol(c1, Decl(templateLiteralTypes2.ts, 16, 9))

const c2 = c1; // Widening type `abc${string}`
const c2 = c1; // Type string
>c2 : Symbol(c2, Decl(templateLiteralTypes2.ts, 18, 9))
>c1 : Symbol(c1, Decl(templateLiteralTypes2.ts, 16, 9))

Expand Down Expand Up @@ -92,7 +92,7 @@ function ft11(s: string, cond: boolean) {
>s : Symbol(s, Decl(templateLiteralTypes2.ts, 26, 14))
>cond : Symbol(cond, Decl(templateLiteralTypes2.ts, 26, 24))

const c1 = cond ? `foo${s}` : `bar${s}`; // widening `foo${string}` | widening `bar${string}`
const c1 = cond ? `foo${s}` : `bar${s}`; // string
>c1 : Symbol(c1, Decl(templateLiteralTypes2.ts, 27, 9))
>cond : Symbol(cond, Decl(templateLiteralTypes2.ts, 26, 24))
>s : Symbol(s, Decl(templateLiteralTypes2.ts, 26, 14))
Expand All @@ -102,13 +102,13 @@ function ft11(s: string, cond: boolean) {
>c2 : Symbol(c2, Decl(templateLiteralTypes2.ts, 28, 9))
>c1 : Symbol(c1, Decl(templateLiteralTypes2.ts, 27, 9))

const c3 = cond ? c1 : c2; // `foo${string}` | `bar${string}`
const c3 = cond ? c1 : c2; // string
>c3 : Symbol(c3, Decl(templateLiteralTypes2.ts, 29, 9))
>cond : Symbol(cond, Decl(templateLiteralTypes2.ts, 26, 24))
>c1 : Symbol(c1, Decl(templateLiteralTypes2.ts, 27, 9))
>c2 : Symbol(c2, Decl(templateLiteralTypes2.ts, 28, 9))

const c4 = cond ? c3 : `baz${s}`; // `foo${string}` | `bar${string}` | widening `baz${string}`
const c4 = cond ? c3 : `baz${s}`; // string
>c4 : Symbol(c4, Decl(templateLiteralTypes2.ts, 30, 9))
>cond : Symbol(cond, Decl(templateLiteralTypes2.ts, 26, 24))
>c3 : Symbol(c3, Decl(templateLiteralTypes2.ts, 29, 9))
Expand All @@ -126,7 +126,7 @@ function ft11(s: string, cond: boolean) {
>v2 : Symbol(v2, Decl(templateLiteralTypes2.ts, 33, 7))
>c2 : Symbol(c2, Decl(templateLiteralTypes2.ts, 28, 9))

let v3 = c3; // `foo${string}` | `bar${string}`
let v3 = c3; // string
>v3 : Symbol(v3, Decl(templateLiteralTypes2.ts, 34, 7))
>c3 : Symbol(c3, Decl(templateLiteralTypes2.ts, 29, 9))

Expand Down Expand Up @@ -322,7 +322,7 @@ const id4 = `foo.bar.${someString}`;
>id4 : Symbol(id4, Decl(templateLiteralTypes2.ts, 91, 5))
>someString : Symbol(someString, Decl(templateLiteralTypes2.ts, 88, 13))

const t4 = takesLiteral(id4); // string
const t4 = takesLiteral(id4); // unknown
>t4 : Symbol(t4, Decl(templateLiteralTypes2.ts, 92, 5))
>takesLiteral : Symbol(takesLiteral, Decl(templateLiteralTypes2.ts, 78, 1))
>id4 : Symbol(id4, Decl(templateLiteralTypes2.ts, 91, 5))
Expand Down
22 changes: 11 additions & 11 deletions tests/baselines/reference/templateLiteralTypes2.types
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ function ft1<T extends string>(s: string, n: number, u: 'foo' | 'bar' | 'baz', t
>u : "foo" | "bar" | "baz"
>t : T

const c1 = `abc${s}`; // `abc${string}`
const c1 = `abc${s}`;
>c1 : string
>`abc${s}` : string
>s : string

const c2 = `abc${n}`; // `abc${number}`
const c2 = `abc${n}`;
>c2 : string
>`abc${n}` : string
>n : number

const c3 = `abc${u}`; // "abcfoo" | "abcbar" | "abcbaz"
const c3 = `abc${u}`;
>c3 : string
>`abc${u}` : string
>u : "foo" | "bar" | "baz"

const c4 = `abc${t}`; // `abc${T}
const c4 = `abc${t}`;
>c4 : string
>`abc${t}` : string
>t : T
Expand Down Expand Up @@ -60,7 +60,7 @@ function ft10(s: string) {
>ft10 : (s: string) => void
>s : string

const c1 = `abc${s}`; // Widening type `abc${string}`
const c1 = `abc${s}`; // Type string
>c1 : string
>`abc${s}` : string
>s : string
Expand All @@ -69,7 +69,7 @@ function ft10(s: string) {
>v1 : string
>c1 : string

const c2 = c1; // Widening type `abc${string}`
const c2 = c1; // Type string
>c2 : string
>c1 : string

Expand Down Expand Up @@ -100,7 +100,7 @@ function ft11(s: string, cond: boolean) {
>s : string
>cond : boolean

const c1 = cond ? `foo${s}` : `bar${s}`; // widening `foo${string}` | widening `bar${string}`
const c1 = cond ? `foo${s}` : `bar${s}`; // string
>c1 : string
>cond ? `foo${s}` : `bar${s}` : string
>cond : boolean
Expand All @@ -113,14 +113,14 @@ function ft11(s: string, cond: boolean) {
>c2 : `foo${string}` | `bar${string}`
>c1 : string

const c3 = cond ? c1 : c2; // `foo${string}` | `bar${string}`
const c3 = cond ? c1 : c2; // string
>c3 : string
>cond ? c1 : c2 : string
>cond : boolean
>c1 : string
>c2 : `foo${string}` | `bar${string}`

const c4 = cond ? c3 : `baz${s}`; // `foo${string}` | `bar${string}` | widening `baz${string}`
const c4 = cond ? c3 : `baz${s}`; // string
>c4 : string
>cond ? c3 : `baz${s}` : string
>cond : boolean
Expand All @@ -140,7 +140,7 @@ function ft11(s: string, cond: boolean) {
>v2 : `foo${string}` | `bar${string}`
>c2 : `foo${string}` | `bar${string}`

let v3 = c3; // `foo${string}` | `bar${string}`
let v3 = c3; // string
>v3 : string
>c3 : string

Expand Down Expand Up @@ -347,7 +347,7 @@ const id4 = `foo.bar.${someString}`;
>`foo.bar.${someString}` : string
>someString : string

const t4 = takesLiteral(id4); // string
const t4 = takesLiteral(id4); // unknown
>t4 : unknown
>takesLiteral(id4) : unknown
>takesLiteral : <T extends string>(literal: T) => T extends `foo.bar.${infer R}` ? R : unknown
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ class Derived extends Base {
}

const obj = new Derived(); // nothing printed
console.log(obj.x); // 1
console.log(obj.x); // number
Loading