don't require default interface methods to be implemented

This commit is contained in:
Dave Holoway
2020-06-10 13:22:37 +01:00
parent 309cc47107
commit 6dffe61d62

View File

@@ -21,15 +21,16 @@ function checkImplementedInterfaces(source_type, probs) {
if (source_type.modifiers.includes('abstract')) {
return;
}
/** @type {Set<CEIType>} */
const interfaces = new Set(), supers_done = new Set();
const supers = source_type.supers.slice();
while (supers.length) {
const s = supers.shift();
supers_done.add(s);
if (s.typeKind === 'interface') {
interfaces.add(s);
}
if (s instanceof CEIType) {
if (s.typeKind === 'interface') {
interfaces.add(s);
}
s.supers.filter(s => !supers_done.has(s)).forEach(s => supers.push(s));
}
}
@@ -38,6 +39,10 @@ function checkImplementedInterfaces(source_type, probs) {
interfaces.forEach((intf, i) => {
const missing_methods = [];
intf.methods.forEach(m => {
// default methods don't require implementing
if (m.hasImplementation) {
return;
}
const namedsig = `${m.name}${m.methodSignature}`
if (implemented.indexOf(namedsig) < 0) {
missing_methods.push(nonAbstractLabel(m.label));