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

[Feature] Limit Indexes and Loops to u32 #1088

Closed
gluax opened this issue Jul 1, 2021 · 3 comments
Closed

[Feature] Limit Indexes and Loops to u32 #1088

gluax opened this issue Jul 1, 2021 · 3 comments
Labels
blocked Blocked. feature A new feature.

Comments

@gluax
Copy link
Contributor

gluax commented Jul 1, 2021

🚀 Feature

Loops and Indexes should be limited to u32 types once type casting is in.

Motivation

As seen in #905, our type inference system is not symmetrical in all cases.
The reasoning to wait for typecasting is to cast the iterator part of a loop to your desired type.
If we want more types allowed in the future, we can redo the type inference algorithm, but that's more work and would be another feature.

Implementation

Just simply restrict allowed types.

@gluax gluax added the feature A new feature. label Jul 1, 2021
@acoglio
Copy link
Collaborator

acoglio commented Jul 1, 2021

This was discussed at today's compiler sync, and there was consensus on this. The restriction can be relaxed in the future.

@Protryon @collinc97 @howardwu Do you have objections to this idea?

@gluax
Copy link
Contributor Author

gluax commented Jul 7, 2021

Blocked by #960.

@collinc97
Copy link
Collaborator

As of Leo v.1.62, we have implemented magnitude for loop bounds requiring a u8, u16, u32 type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Blocked. feature A new feature.
Projects
None yet
Development

No branches or pull requests

3 participants