Merge pull request #1533 from Microsoft/fixCompareSignatures

Fix compareSignatures
This commit is contained in:
Daniel Rosenwasser 2014-12-22 12:56:56 -08:00
commit edd3974b6f
7 changed files with 76 additions and 2 deletions

View File

@ -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 {

View File

@ -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.
}

View File

@ -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]

View File

@ -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.
}

View File

@ -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]

View File

@ -0,0 +1,8 @@
interface Foo {
f(x: any): any;
}
interface Bar {
f<T>(x: T): T;
}
interface Hello extends Foo, Bar {
}

View File

@ -0,0 +1,8 @@
interface Foo {
f(x: any): any;
}
interface Bar {
f<T>(x: T): T;
}
interface Hello extends Bar, Foo {
}