Skip to content

Commit 1958554

Browse files
author
Willem Wyndham
authored
fix: check function's instance class is a subclass of virtual method (#1985)
1 parent 886a4a6 commit 1958554

File tree

5 files changed

+5180
-0
lines changed

5 files changed

+5180
-0
lines changed

src/compiler.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6947,6 +6947,8 @@ export class Compiler extends DiagnosticEmitter {
69476947
// Wouldn't be here if there wasn't at least one overload
69486948
var overloadPrototypes = assert(instance.prototype.overloads);
69496949

6950+
assert(instance.parent.kind == ElementKind.CLASS || instance.parent.kind == ElementKind.INTERFACE);
6951+
var parentClassInstance = <Class>instance.parent;
69506952
var module = this.module;
69516953
var usizeType = this.options.usizeType;
69526954
var sizeTypeRef = usizeType.toRef();
@@ -6992,6 +6994,8 @@ export class Compiler extends DiagnosticEmitter {
69926994
if (classInstances) {
69936995
for (let _values = Map_values(classInstances), j = 0, l = _values.length; j < l; ++j) {
69946996
let classInstance = _values[j];
6997+
// Chcek if the parent class is a subtype of instance's class
6998+
if (!classInstance.isAssignableTo(parentClassInstance)) continue;
69956999
let overloadInstance: Function | null;
69967000
if (isProperty) {
69977001
let boundProperty = assert(classInstance.members!.get(unboundOverloadParent.name));
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"asc_flags": [
3+
"--explicitStart"
4+
]
5+
}

0 commit comments

Comments
 (0)