mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-23 10:29:01 -06:00
Add regression test
This commit is contained in:
parent
d0a195a3c5
commit
a4a37ea086
@ -0,0 +1,30 @@
|
||||
//// [signatureInstantiationWithRecursiveConstraints.ts]
|
||||
// Repro from #17148
|
||||
|
||||
class Foo {
|
||||
myFunc<T extends Foo>(arg: T) {}
|
||||
}
|
||||
|
||||
class Bar {
|
||||
myFunc<T extends Bar>(arg: T) {}
|
||||
}
|
||||
|
||||
const myVar: Foo = new Bar();
|
||||
|
||||
|
||||
//// [signatureInstantiationWithRecursiveConstraints.js]
|
||||
"use strict";
|
||||
// Repro from #17148
|
||||
var Foo = (function () {
|
||||
function Foo() {
|
||||
}
|
||||
Foo.prototype.myFunc = function (arg) { };
|
||||
return Foo;
|
||||
}());
|
||||
var Bar = (function () {
|
||||
function Bar() {
|
||||
}
|
||||
Bar.prototype.myFunc = function (arg) { };
|
||||
return Bar;
|
||||
}());
|
||||
var myVar = new Bar();
|
||||
@ -0,0 +1,30 @@
|
||||
=== tests/cases/compiler/signatureInstantiationWithRecursiveConstraints.ts ===
|
||||
// Repro from #17148
|
||||
|
||||
class Foo {
|
||||
>Foo : Symbol(Foo, Decl(signatureInstantiationWithRecursiveConstraints.ts, 0, 0))
|
||||
|
||||
myFunc<T extends Foo>(arg: T) {}
|
||||
>myFunc : Symbol(Foo.myFunc, Decl(signatureInstantiationWithRecursiveConstraints.ts, 2, 11))
|
||||
>T : Symbol(T, Decl(signatureInstantiationWithRecursiveConstraints.ts, 3, 9))
|
||||
>Foo : Symbol(Foo, Decl(signatureInstantiationWithRecursiveConstraints.ts, 0, 0))
|
||||
>arg : Symbol(arg, Decl(signatureInstantiationWithRecursiveConstraints.ts, 3, 24))
|
||||
>T : Symbol(T, Decl(signatureInstantiationWithRecursiveConstraints.ts, 3, 9))
|
||||
}
|
||||
|
||||
class Bar {
|
||||
>Bar : Symbol(Bar, Decl(signatureInstantiationWithRecursiveConstraints.ts, 4, 1))
|
||||
|
||||
myFunc<T extends Bar>(arg: T) {}
|
||||
>myFunc : Symbol(Bar.myFunc, Decl(signatureInstantiationWithRecursiveConstraints.ts, 6, 11))
|
||||
>T : Symbol(T, Decl(signatureInstantiationWithRecursiveConstraints.ts, 7, 9))
|
||||
>Bar : Symbol(Bar, Decl(signatureInstantiationWithRecursiveConstraints.ts, 4, 1))
|
||||
>arg : Symbol(arg, Decl(signatureInstantiationWithRecursiveConstraints.ts, 7, 24))
|
||||
>T : Symbol(T, Decl(signatureInstantiationWithRecursiveConstraints.ts, 7, 9))
|
||||
}
|
||||
|
||||
const myVar: Foo = new Bar();
|
||||
>myVar : Symbol(myVar, Decl(signatureInstantiationWithRecursiveConstraints.ts, 10, 5))
|
||||
>Foo : Symbol(Foo, Decl(signatureInstantiationWithRecursiveConstraints.ts, 0, 0))
|
||||
>Bar : Symbol(Bar, Decl(signatureInstantiationWithRecursiveConstraints.ts, 4, 1))
|
||||
|
||||
@ -0,0 +1,31 @@
|
||||
=== tests/cases/compiler/signatureInstantiationWithRecursiveConstraints.ts ===
|
||||
// Repro from #17148
|
||||
|
||||
class Foo {
|
||||
>Foo : Foo
|
||||
|
||||
myFunc<T extends Foo>(arg: T) {}
|
||||
>myFunc : <T extends Foo>(arg: T) => void
|
||||
>T : T
|
||||
>Foo : Foo
|
||||
>arg : T
|
||||
>T : T
|
||||
}
|
||||
|
||||
class Bar {
|
||||
>Bar : Bar
|
||||
|
||||
myFunc<T extends Bar>(arg: T) {}
|
||||
>myFunc : <T extends Bar>(arg: T) => void
|
||||
>T : T
|
||||
>Bar : Bar
|
||||
>arg : T
|
||||
>T : T
|
||||
}
|
||||
|
||||
const myVar: Foo = new Bar();
|
||||
>myVar : Foo
|
||||
>Foo : Foo
|
||||
>new Bar() : Bar
|
||||
>Bar : typeof Bar
|
||||
|
||||
@ -0,0 +1,13 @@
|
||||
// @strict: true
|
||||
|
||||
// Repro from #17148
|
||||
|
||||
class Foo {
|
||||
myFunc<T extends Foo>(arg: T) {}
|
||||
}
|
||||
|
||||
class Bar {
|
||||
myFunc<T extends Bar>(arg: T) {}
|
||||
}
|
||||
|
||||
const myVar: Foo = new Bar();
|
||||
Loading…
x
Reference in New Issue
Block a user