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

Fix: Remove function implementations to force return type to be checked. #120

Merged
merged 1 commit into from
Sep 20, 2024

Conversation

stewartHutchins
Copy link
Contributor

When completing the "generic" challengers the return type is not enforced.
e.g.

def add[T](a: T, b: T) -> T:
    return a


def add[T](a: T, b: T):
    return a

both the above functions pass the first "generic" challenge

By removing the function implementation (return a) and replacing it with ..., the 2nd function in the above code snippet becomes an invalid.

Copy link
Owner

@laike9m laike9m left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks!

@laike9m laike9m merged commit 01c4a77 into laike9m:main Sep 20, 2024
1 check passed
@stewartHutchins stewartHutchins deleted the generic-check-return-type branch September 20, 2024 22:28
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.

2 participants