Skip to content

Ranged Integers #66

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

Merged
merged 53 commits into from
May 28, 2025
Merged

Ranged Integers #66

merged 53 commits into from
May 28, 2025

Conversation

IBims1NicerTobi
Copy link
Collaborator

Close #28

@IBims1NicerTobi IBims1NicerTobi self-assigned this Feb 18, 2025
@IBims1NicerTobi
Copy link
Collaborator Author

Add test cases

@IBims1NicerTobi
Copy link
Collaborator Author

Add types to in code values / constants

@IBims1NicerTobi
Copy link
Collaborator Author

Cast module

@IBims1NicerTobi
Copy link
Collaborator Author

Fix this:

Error: Failed to Typecheck Named(ConcreteGlobalReference { id: type_1, template_args: [Unknown(concrete_type_variable_1)] }) = Named(ConcreteGlobalReference { id: type_1, template_args: [Unknown(concrete_type_variable_1)] }) + Named(ConcreteGlobalReference { id: type_1, template_args: [Unknown(concrete_type_variable_5)] })
    ╭─[/home/tobias/.sus/0.2.0-devel/std/util.sus:91:11]
    │
 91 │        value = value + 1
    │                ────┬────
    │                    ╰────── Failed to Typecheck Named(ConcreteGlobalReference { id: type_1, template_args: [Unknown(concrete_type_variable_1)] }) = Named(ConcreteGlobalReference { id: type_1, template_args: [Unknown(concrete_type_variable_1)] }) + Named(ConcreteGlobalReference { id: type_1, template_args: [Unknown(concrete_type_variable_5)] })
────╯

@VonTum
Copy link
Collaborator

VonTum commented Mar 11, 2025

Fix this:

Error: Failed to Typecheck Named(ConcreteGlobalReference { id: type_1, template_args: [Unknown(concrete_type_variable_1)] }) = Named(ConcreteGlobalReference { id: type_1, template_args: [Unknown(concrete_type_variable_1)] }) + Named(ConcreteGlobalReference { id: type_1, template_args: [Unknown(concrete_type_variable_5)] })
    ╭─[/home/tobias/.sus/0.2.0-devel/std/util.sus:91:11]
    │
 91 │        value = value + 1
    │                ────┬────
    │                    ╰────── Failed to Typecheck Named(ConcreteGlobalReference { id: type_1, template_args: [Unknown(concrete_type_variable_1)] }) = Named(ConcreteGlobalReference { id: type_1, template_args: [Unknown(concrete_type_variable_1)] }) + Named(ConcreteGlobalReference { id: type_1, template_args: [Unknown(concrete_type_variable_5)] })
────╯

Well it seems that that on its own should never typecheck. Rather either the user should specify a cast, or add a % max_val

@IBims1NicerTobi
Copy link
Collaborator Author

Add lower bound to all ints too.

@VonTum
Copy link
Collaborator

VonTum commented Mar 20, 2025

The semantics of MIN and MAX should be:
MIN is inclusive, MAX is exclusive.

So int #(MIN: 3, MAX: 16) can have a value from 3-15 inclusive.

It makes for better ergonomics. (powers of 2, clog2, etc)

@VonTum
Copy link
Collaborator

VonTum commented Mar 20, 2025

Oh also, BitsToInt will need to be expressed from the source bits, as we can't really make any statements about the value of these bits.

We'll need a pow2 #(V) for that. I might add that if I get around to it

@IBims1NicerTobi IBims1NicerTobi requested a review from VonTum March 21, 2025 09:31
@VonTum VonTum self-assigned this Apr 30, 2025
VonTum added 28 commits April 30, 2025 19:59
I commit partially, because it's in a pretty good state right now, but I plan to do major changes again.
- Split typechecking error reporting to final_checks.rs
- Implement subtyping in SetUnifier itself (possibly with Ord?)
- It's not quite in ordung yet though....
@VonTum VonTum merged commit 2404293 into master May 28, 2025
2 checks passed
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.

Ranged Integers
2 participants