Skip to content

Replace package object compiletime by top-level definitions; move compiletime.S to compiletime.ops.int.S #11745

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 2 commits into from
Mar 17, 2021

Conversation

smarter
Copy link
Member

@smarter smarter commented Mar 15, 2021

[test_non_bootstrapped]

@smarter smarter force-pushed the no-pkg-object branch 4 times, most recently from a4afd77 to 7bb74f5 Compare March 15, 2021 16:43
@smarter smarter requested a review from MaximeKjaer March 15, 2021 16:44
Copy link
Contributor

@MaximeKjaer MaximeKjaer left a comment

Choose a reason for hiding this comment

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

@smarter
Copy link
Member Author

smarter commented Mar 15, 2021

Thanks, I updated the doc (and now I'm also wondering if there's really a usecase for S instead of just using + 1 ?)

@MaximeKjaer
Copy link
Contributor

I don't really know if there is a use case. One thing I think S can do which + cannot is the following:

import scala.compiletime.S

type MinusOne[N <: Int & Singleton] = N match {
  case S[n] => n
}

@main def test: Unit = {
  val x: MinusOne[3] = 2
}

Though of course MinusOne could also be implemented as N - 1 now, instead of as a match type. I don't really know if there are edge cases where the two might be slightly different.

@smarter
Copy link
Member Author

smarter commented Mar 15, 2021

OK, sounds like S is still useful until/unless + becomes more powerful.

@smarter smarter requested a review from bishabosha March 15, 2021 18:54
Copy link
Member

@bishabosha bishabosha left a comment

Choose a reason for hiding this comment

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

LGTM

@smarter smarter force-pushed the no-pkg-object branch 2 times, most recently from ebd52f2 to fe61db5 Compare March 16, 2021 23:43
@smarter smarter enabled auto-merge March 16, 2021 23:43
Also move S from scala.compiletime to scala.compiletime.ops.int where
all the other type operators on Int are defined.
@smarter smarter merged commit a522ad0 into scala:master Mar 17, 2021
@smarter smarter deleted the no-pkg-object branch March 17, 2021 15:30
anatoliykmetyuk added a commit to dotty-staging/dotty that referenced this pull request Mar 31, 2021
@Kordyjan Kordyjan added this to the 3.0.0 milestone Aug 2, 2023
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.

4 participants