From 4b2fc794519e08fa68f91c306bf7d638f4708f8c Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Tue, 12 Mar 2019 06:29:40 -0700 Subject: [PATCH] Accept new baselines --- .../genericFunctionInference1.errors.txt | 8 ++++++ .../reference/genericFunctionInference1.js | 11 ++++++++ .../genericFunctionInference1.symbols | 27 +++++++++++++++++++ .../reference/genericFunctionInference1.types | 24 +++++++++++++++++ 4 files changed, 70 insertions(+) diff --git a/tests/baselines/reference/genericFunctionInference1.errors.txt b/tests/baselines/reference/genericFunctionInference1.errors.txt index 9b082d39ab2..fd423a4ea5a 100644 --- a/tests/baselines/reference/genericFunctionInference1.errors.txt +++ b/tests/baselines/reference/genericFunctionInference1.errors.txt @@ -190,4 +190,12 @@ tests/cases/compiler/genericFunctionInference1.ts(83,14): error TS2345: Argument x => x, x => first(x), ); + + // Repro from #30297 + + declare function foo2(fn: T, a?: U, b?: U): [T, U]; + + foo2(() => {}); + foo2(identity); + foo2(identity, 1); \ No newline at end of file diff --git a/tests/baselines/reference/genericFunctionInference1.js b/tests/baselines/reference/genericFunctionInference1.js index 4e89f9c0795..bfca871a6c9 100644 --- a/tests/baselines/reference/genericFunctionInference1.js +++ b/tests/baselines/reference/genericFunctionInference1.js @@ -183,6 +183,14 @@ const fn62 = pipe( x => x, x => first(x), ); + +// Repro from #30297 + +declare function foo2(fn: T, a?: U, b?: U): [T, U]; + +foo2(() => {}); +foo2(identity); +foo2(identity, 1); //// [genericFunctionInference1.js] @@ -265,3 +273,6 @@ const fn40 = pipe(getString, string => orUndefined(string), identity); const fn60 = pipe(getArray, x => x, first); const fn61 = pipe(getArray, identity, first); const fn62 = pipe(getArray, x => x, x => first(x)); +foo2(() => { }); +foo2(identity); +foo2(identity, 1); diff --git a/tests/baselines/reference/genericFunctionInference1.symbols b/tests/baselines/reference/genericFunctionInference1.symbols index 9ee085feae8..cad4d862d9c 100644 --- a/tests/baselines/reference/genericFunctionInference1.symbols +++ b/tests/baselines/reference/genericFunctionInference1.symbols @@ -848,3 +848,30 @@ const fn62 = pipe( ); +// Repro from #30297 + +declare function foo2(fn: T, a?: U, b?: U): [T, U]; +>foo2 : Symbol(foo2, Decl(genericFunctionInference1.ts, 183, 2)) +>T : Symbol(T, Decl(genericFunctionInference1.ts, 187, 22)) +>U : Symbol(U, Decl(genericFunctionInference1.ts, 187, 24)) +>T : Symbol(T, Decl(genericFunctionInference1.ts, 187, 22)) +>fn : Symbol(fn, Decl(genericFunctionInference1.ts, 187, 32)) +>T : Symbol(T, Decl(genericFunctionInference1.ts, 187, 22)) +>a : Symbol(a, Decl(genericFunctionInference1.ts, 187, 38)) +>U : Symbol(U, Decl(genericFunctionInference1.ts, 187, 24)) +>b : Symbol(b, Decl(genericFunctionInference1.ts, 187, 45)) +>U : Symbol(U, Decl(genericFunctionInference1.ts, 187, 24)) +>T : Symbol(T, Decl(genericFunctionInference1.ts, 187, 22)) +>U : Symbol(U, Decl(genericFunctionInference1.ts, 187, 24)) + +foo2(() => {}); +>foo2 : Symbol(foo2, Decl(genericFunctionInference1.ts, 183, 2)) + +foo2(identity); +>foo2 : Symbol(foo2, Decl(genericFunctionInference1.ts, 183, 2)) +>identity : Symbol(identity, Decl(genericFunctionInference1.ts, 154, 13)) + +foo2(identity, 1); +>foo2 : Symbol(foo2, Decl(genericFunctionInference1.ts, 183, 2)) +>identity : Symbol(identity, Decl(genericFunctionInference1.ts, 154, 13)) + diff --git a/tests/baselines/reference/genericFunctionInference1.types b/tests/baselines/reference/genericFunctionInference1.types index e68b0ed6da0..a06ad6cffc5 100644 --- a/tests/baselines/reference/genericFunctionInference1.types +++ b/tests/baselines/reference/genericFunctionInference1.types @@ -799,3 +799,27 @@ const fn62 = pipe( ); +// Repro from #30297 + +declare function foo2(fn: T, a?: U, b?: U): [T, U]; +>foo2 : (fn: T, a?: U | undefined, b?: U | undefined) => [T, U] +>fn : T +>a : U | undefined +>b : U | undefined + +foo2(() => {}); +>foo2(() => {}) : [() => void, () => void] +>foo2 : (fn: T, a?: U | undefined, b?: U | undefined) => [T, U] +>() => {} : () => void + +foo2(identity); +>foo2(identity) : [(value: T) => T, {}] +>foo2 : (fn: T, a?: U | undefined, b?: U | undefined) => [T, U] +>identity : (value: T) => T + +foo2(identity, 1); +>foo2(identity, 1) : [(value: T) => T, number] +>foo2 : (fn: T, a?: U | undefined, b?: U | undefined) => [T, U] +>identity : (value: T) => T +>1 : 1 +