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

Add typeasserts to convert(::Type{Face}, ::Dict) #98

Merged
merged 1 commit into from
Oct 16, 2024
Merged

Conversation

topolarity
Copy link
Member

This removes a ton of implicit converts from this code, which are easily invalidated.

@tecosaur
Copy link
Collaborator

Thanks Cody! I'll admit to having made the assumption that checking x isa Int would have the compiler assume x::Int within the scope of the check.

@topolarity
Copy link
Member Author

topolarity commented Oct 15, 2024

That assumption is actually true - the unintuitive part here is that the compiler can't do that for d[key]
(because it doesn't know whether the dictionary is aliased and being secretly modified by another name elsewhere)

It's not uncommon to do:

x = d[key]
if x isa Int ...

for that reason

This removes a ton of implicit converts from this code, which are easily
invalidated.
@tecosaur tecosaur merged commit 729f56c into main Oct 16, 2024
0 of 4 checks passed
@tecosaur tecosaur deleted the ct/fix-convert branch October 16, 2024 01:33
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