-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix #6606: Do not compute S on negative Ints #7544
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still feel this is somewhat inconsistent, as S
is defined for Int
, not just positive integers.
I'd like to know if there is a technical reason to restrict it to just positive numbers?
I will add some documentation. |
5cd0a9d
to
94536a0
Compare
The only documentation we had so far was |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise, LGTM
As discussed with @nicolasstucki , it's good to document and make it coherent first. The use case for negative integers is unclear for the moment, and we can always easily change without breaking anything when justified use cases emerge.
@@ -0,0 +1,8 @@ | |||
val t0: Int = 0 | |||
val t1: scala.compiletime.S[-1] = 0 // error | |||
val t2: scala.compiletime.S[Int] = 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not clear to me why this line type checks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it is because type 1 =:= S[0] <:< S[Int]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to figure out the precise spec for S
, whether it's co-variant, contra-variant, non-variant in another issue.
No description provided.