-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Started fixing check for incomplete implementations #175
WIP: Started fixing check for incomplete implementations #175
Conversation
4c34600
to
3a879eb
Compare
|
||
@Override | ||
public Void visitField(FieldMember member) { | ||
validator.logError(member.position, CompileErrors.definitionNotAllowedHere("Field members not allowed inside an interface implementation")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ Question: Which members are allowed inside an implementation?
return interfaceDefinition.members.stream() | ||
.filter(IDefinitionMember::isAbstract) | ||
.filter(o -> !implementedMethods.contains(o)) | ||
.collect(Collectors.toList()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ Question: Are abstract classes allowed to partially implement an interface?
If so, this check would break.
this.interfaceDefinition = implementationMember.asImplementation() | ||
.flatMap(TypeID::asDefinition) | ||
.map(d -> d.definition) | ||
.filter(InterfaceDefinition.class::isInstance) | ||
.map(InterfaceDefinition.class::cast) | ||
.orElseThrow(() -> new NoSuchElementException("Must be an implementation!")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💭 Not the best way to go about this but at least we get the interfaceDefinition this way I guess?
Depends on #174
Also will most likely fail for abstract classes and the like 🤷🏽