Skip to content

Commit 2cb8b25

Browse files
committed
Add tests
1 parent ef60613 commit 2cb8b25

4 files changed

+65
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//// [genericFunctionsNotContextSensitive.ts]
2+
// Repro from #37110
3+
4+
const f = <F extends (...args: any[]) => <G>(x: G) => void>(_: F): F => _;
5+
6+
const a = f(<K extends string>(_: K) => _ => ({})); // <K extends string>(_: K) => <G>(_: G) => {}
7+
8+
9+
//// [genericFunctionsNotContextSensitive.js]
10+
"use strict";
11+
// Repro from #37110
12+
var f = function (_) { return _; };
13+
var a = f(function (_) { return function (_) { return ({}); }; }); // <K extends string>(_: K) => <G>(_: G) => {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
=== tests/cases/compiler/genericFunctionsNotContextSensitive.ts ===
2+
// Repro from #37110
3+
4+
const f = <F extends (...args: any[]) => <G>(x: G) => void>(_: F): F => _;
5+
>f : Symbol(f, Decl(genericFunctionsNotContextSensitive.ts, 2, 5))
6+
>F : Symbol(F, Decl(genericFunctionsNotContextSensitive.ts, 2, 11))
7+
>args : Symbol(args, Decl(genericFunctionsNotContextSensitive.ts, 2, 22))
8+
>G : Symbol(G, Decl(genericFunctionsNotContextSensitive.ts, 2, 42))
9+
>x : Symbol(x, Decl(genericFunctionsNotContextSensitive.ts, 2, 45))
10+
>G : Symbol(G, Decl(genericFunctionsNotContextSensitive.ts, 2, 42))
11+
>_ : Symbol(_, Decl(genericFunctionsNotContextSensitive.ts, 2, 60))
12+
>F : Symbol(F, Decl(genericFunctionsNotContextSensitive.ts, 2, 11))
13+
>F : Symbol(F, Decl(genericFunctionsNotContextSensitive.ts, 2, 11))
14+
>_ : Symbol(_, Decl(genericFunctionsNotContextSensitive.ts, 2, 60))
15+
16+
const a = f(<K extends string>(_: K) => _ => ({})); // <K extends string>(_: K) => <G>(_: G) => {}
17+
>a : Symbol(a, Decl(genericFunctionsNotContextSensitive.ts, 4, 5))
18+
>f : Symbol(f, Decl(genericFunctionsNotContextSensitive.ts, 2, 5))
19+
>K : Symbol(K, Decl(genericFunctionsNotContextSensitive.ts, 4, 13))
20+
>_ : Symbol(_, Decl(genericFunctionsNotContextSensitive.ts, 4, 31))
21+
>K : Symbol(K, Decl(genericFunctionsNotContextSensitive.ts, 4, 13))
22+
>_ : Symbol(_, Decl(genericFunctionsNotContextSensitive.ts, 4, 39))
23+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
=== tests/cases/compiler/genericFunctionsNotContextSensitive.ts ===
2+
// Repro from #37110
3+
4+
const f = <F extends (...args: any[]) => <G>(x: G) => void>(_: F): F => _;
5+
>f : <F extends (...args: any[]) => <G>(x: G) => void>(_: F) => F
6+
><F extends (...args: any[]) => <G>(x: G) => void>(_: F): F => _ : <F extends (...args: any[]) => <G>(x: G) => void>(_: F) => F
7+
>args : any[]
8+
>x : G
9+
>_ : F
10+
>_ : F
11+
12+
const a = f(<K extends string>(_: K) => _ => ({})); // <K extends string>(_: K) => <G>(_: G) => {}
13+
>a : <K extends string>(_: K) => <G>(_: G) => {}
14+
>f(<K extends string>(_: K) => _ => ({})) : <K extends string>(_: K) => <G>(_: G) => {}
15+
>f : <F extends (...args: any[]) => <G>(x: G) => void>(_: F) => F
16+
><K extends string>(_: K) => _ => ({}) : <K extends string>(_: K) => <G>(_: G) => {}
17+
>_ : K
18+
>_ => ({}) : <G>(_: G) => {}
19+
>_ : G
20+
>({}) : {}
21+
>{} : {}
22+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// @strict: true
2+
3+
// Repro from #37110
4+
5+
const f = <F extends (...args: any[]) => <G>(x: G) => void>(_: F): F => _;
6+
7+
const a = f(<K extends string>(_: K) => _ => ({})); // <K extends string>(_: K) => <G>(_: G) => {}

0 commit comments

Comments
 (0)