Skip to content
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

Conversation

kindlich
Copy link
Member

Depends on #174

Also will most likely fail for abstract classes and the like 🤷🏽

@kindlich kindlich force-pushed the feature/refactor-incomplete-implementation branch from 4c34600 to 3a879eb Compare September 15, 2024 11:59

@Override
public Void visitField(FieldMember member) {
validator.logError(member.position, CompileErrors.definitionNotAllowedHere("Field members not allowed inside an interface implementation"));
Copy link
Member Author

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?

Comment on lines +115 to +118
return interfaceDefinition.members.stream()
.filter(IDefinitionMember::isAbstract)
.filter(o -> !implementedMethods.contains(o))
.collect(Collectors.toList());
Copy link
Member Author

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.

Comment on lines +25 to +30
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!"));
Copy link
Member Author

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?

Base automatically changed from feature/refactor-capturing to feature/refactor-fix-more-tests October 4, 2024 21:19
@kindlich kindlich deleted the branch feature/refactor-fix-more-tests October 4, 2024 21:20
@kindlich kindlich closed this Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant