check the type of the this-type, instead of the AST-node

This commit is contained in:
Erik Krogh Kristensen 2020-03-02 16:35:16 +01:00
Родитель e0fcc4af6a
Коммит 68fb8c52e9
3 изменённых файлов: 6 добавлений и 2 удалений

Просмотреть файл

@ -105,7 +105,7 @@ predicate signaturesMatch(MethodSignature method, MethodSignature other) {
not exists(method.getBody().getThisTypeAnnotation()) and
not exists(other.getBody().getThisTypeAnnotation())
or
method.getBody().getThisTypeAnnotation() = other.getBody().getThisTypeAnnotation()
method.getBody().getThisTypeAnnotation().getType() = other.getBody().getThisTypeAnnotation().getType()
) and
// The types are compared in matchingCallSignature. This is sanity-check that the textual representation of the type-annotations are somewhat similar.
forall(int i | i in [0 .. -1 + method.getBody().getNumParameter()] |

Просмотреть файл

@ -1,4 +1,5 @@
| tst.ts:3:3:3:30 | method( ... number; | This overload of method() is unreachable, the $@ overload will always be selected. | tst.ts:2:3:2:30 | method( ... string; | previous |
| tst.ts:6:3:6:17 | types1(): any[] | This overload of types1() is unreachable, the $@ overload will always be selected. | tst.ts:5:3:5:18 | types1<T>(): T[] | previous |
| tst.ts:15:3:15:74 | on(even ... nction; | This overload of on() is unreachable, the $@ overload will always be selected. | tst.ts:14:3:14:74 | on(even ... nction; | previous |
| tst.ts:24:3:24:30 | method( ... number; | This overload of method() is unreachable, the $@ overload will always be selected. | tst.ts:23:3:23:30 | method( ... string; | previous |
| tst.ts:21:3:21:28 | bar(thi ... number; | This overload of bar() is unreachable, the $@ overload will always be selected. | tst.ts:20:3:20:28 | bar(thi ... string; | previous |
| tst.ts:27:3:27:30 | method( ... number; | This overload of method() is unreachable, the $@ overload will always be selected. | tst.ts:26:3:26:30 | method( ... string; | previous |

Просмотреть файл

@ -17,6 +17,9 @@ declare class Foobar {
foo(this: string): string;
foo(this: number): number; // OK
bar(this: number): string;
bar(this: number): number; // NOT OK
}
declare class Base {