mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 16:38:05 -06:00
Merge pull request #1533 from Microsoft/fixCompareSignatures
Fix compareSignatures
This commit is contained in:
commit
edd3974b6f
@ -4016,7 +4016,7 @@ module ts {
|
||||
result &= related;
|
||||
}
|
||||
}
|
||||
else if (source.typeParameters || source.typeParameters) {
|
||||
else if (source.typeParameters || target.typeParameters) {
|
||||
return Ternary.False;
|
||||
}
|
||||
// Spec 1.0 Section 3.8.3 & 3.8.4:
|
||||
@ -5274,7 +5274,7 @@ module ts {
|
||||
signatureList = [signature];
|
||||
}
|
||||
else if (!compareSignatures(signatureList[0], signature, /*compareReturnTypes*/ false, compareTypes)) {
|
||||
// Signatures arent identical, do not use
|
||||
// Signatures aren't identical, do not use
|
||||
return undefined;
|
||||
}
|
||||
else {
|
||||
|
||||
@ -0,0 +1,17 @@
|
||||
tests/cases/compiler/genericAndNonGenericInheritedSignature1.ts(7,11): error TS2320: Interface 'Hello' cannot simultaneously extend types 'Foo' and 'Bar'.
|
||||
Named properties 'f' of types 'Foo' and 'Bar' are not identical.
|
||||
|
||||
|
||||
==== tests/cases/compiler/genericAndNonGenericInheritedSignature1.ts (1 errors) ====
|
||||
interface Foo {
|
||||
f(x: any): any;
|
||||
}
|
||||
interface Bar {
|
||||
f<T>(x: T): T;
|
||||
}
|
||||
interface Hello extends Foo, Bar {
|
||||
~~~~~
|
||||
!!! error TS2320: Interface 'Hello' cannot simultaneously extend types 'Foo' and 'Bar'.
|
||||
!!! error TS2320: Named properties 'f' of types 'Foo' and 'Bar' are not identical.
|
||||
}
|
||||
|
||||
@ -0,0 +1,12 @@
|
||||
//// [genericAndNonGenericInheritedSignature1.ts]
|
||||
interface Foo {
|
||||
f(x: any): any;
|
||||
}
|
||||
interface Bar {
|
||||
f<T>(x: T): T;
|
||||
}
|
||||
interface Hello extends Foo, Bar {
|
||||
}
|
||||
|
||||
|
||||
//// [genericAndNonGenericInheritedSignature1.js]
|
||||
@ -0,0 +1,17 @@
|
||||
tests/cases/compiler/genericAndNonGenericInheritedSignature2.ts(7,11): error TS2320: Interface 'Hello' cannot simultaneously extend types 'Bar' and 'Foo'.
|
||||
Named properties 'f' of types 'Bar' and 'Foo' are not identical.
|
||||
|
||||
|
||||
==== tests/cases/compiler/genericAndNonGenericInheritedSignature2.ts (1 errors) ====
|
||||
interface Foo {
|
||||
f(x: any): any;
|
||||
}
|
||||
interface Bar {
|
||||
f<T>(x: T): T;
|
||||
}
|
||||
interface Hello extends Bar, Foo {
|
||||
~~~~~
|
||||
!!! error TS2320: Interface 'Hello' cannot simultaneously extend types 'Bar' and 'Foo'.
|
||||
!!! error TS2320: Named properties 'f' of types 'Bar' and 'Foo' are not identical.
|
||||
}
|
||||
|
||||
@ -0,0 +1,12 @@
|
||||
//// [genericAndNonGenericInheritedSignature2.ts]
|
||||
interface Foo {
|
||||
f(x: any): any;
|
||||
}
|
||||
interface Bar {
|
||||
f<T>(x: T): T;
|
||||
}
|
||||
interface Hello extends Bar, Foo {
|
||||
}
|
||||
|
||||
|
||||
//// [genericAndNonGenericInheritedSignature2.js]
|
||||
@ -0,0 +1,8 @@
|
||||
interface Foo {
|
||||
f(x: any): any;
|
||||
}
|
||||
interface Bar {
|
||||
f<T>(x: T): T;
|
||||
}
|
||||
interface Hello extends Foo, Bar {
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
interface Foo {
|
||||
f(x: any): any;
|
||||
}
|
||||
interface Bar {
|
||||
f<T>(x: T): T;
|
||||
}
|
||||
interface Hello extends Bar, Foo {
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user