-
Notifications
You must be signed in to change notification settings - Fork 130
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
Cross compiles project to Scala 3 #227
Cross compiles project to Scala 3 #227
Conversation
At least one pull request committer is not linked to a user. See https://help.github.com/en/articles/why-are-my-commits-linked-to-the-wrong-user#commits-are-not-linked-to-any-user |
Travis breaks unrelated because it can't find openjdk11, attempted fix in #228. |
import util._ | ||
|
||
message.unseal match{ | ||
case Inlined(_, _, Apply(Select(Apply(Select(Select(_, "StringContext"), _), messageNode), _), argumentsNode)) => |
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.
This seems so wrong with such a deep nesting of destructuring, any hints on how to not do this is appreciated.
trait Tagged[U] | ||
type @@[+T, U] = T with Tagged[U] | ||
|
||
class Tagger[U] { | ||
def apply[T](t: T): T @@ U = t.asInstanceOf[T @@ U] |
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.
Dotty did not like this (cannot cast Tagged[U] to String, or something allong those lines.)
|
||
def errorMessageArgs(underlying: Expr[Underlying], message: Expr[String], args: Expr[Seq[Any]]) (using QuoteContext) = { | ||
val anyRefArgs = formatArgs(args) | ||
if(anyRefArgs.isEmpty) |
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.
The isEmpty cases here are not present in scala 2.x macros, but the tests do fail without them (delegates to wrong function).
With out it the error is that it triggers
public void error(String format, Object... arguments);
with no arguments
but it should trigger
public void error(String msg);
I do not understand how the 2.x macros do not run in to the same issue 🤷
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.
let's upgrade to 3.0.0-M3
Hi. I have merge rights in this repo now, and I'll be happy to merge this and pull publishing levers if it is rebased (once #253 is merged) and updated for Scala 3.0.0-M3. |
See #225 for discussion about the possible future of this repository. |
(needs rebase) |
Oh, and Scala 3.0.0-RC1 just hit Maven Central yesterday! |
Yeah! It compiles for RC1 but scalatest stuff is not out yet, probably can wait for those. Working on rebase atm. |
@amumurst (I think it would be fine to land this for M3, then separately land an RC1 upgrade) |
I've requested that the ScalaTest folks publish for RC1: scalatest/scalatest#1138 (comment) |
- Split macro to 2 2.X folder for old macro definitions and 3.X for scala 3 macros - Add LoggerFixture to test for structured fixtures
07bf64e
to
0057744
Compare
@bbonanno I had to kinda revert back to Syntax-wise its just replacing imports and |
@amumurst sadly I'm blocked by a ton of dependencies to progress to support Scala 3, in the same way you were by mockito-scala, so I totally feel your pain. The PR had also changes to tests that were broken regardless of the mockito flavour, so I guess you wanna keep those changes |
@bbonanno Totally! |
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.
build changes LGTM. (I'm unable to review the code changes.)
I do not think I have much more to add. Tests are green so it can't be that bad, no? 🤣 I guess @sullis ? I think if anyone who actually knows these macros should stumble upon this i think these two methods are where there probably are better ways. and |
I'm happy to merge regardless, if it comes to that, but let's let it sit until next week to see if any reviewers appear. |
👏 |
This PR contains a full reimplementation of all macros for Dotty.
This is the first time I write any macros at all for scala, so its highly likely that they are somewhere on the scale from
completely wrong
tosomewhat okay
😄Else there are some slight changes to the test classes to get Dotty running.
The "API" of the loggers is the same, but I have absolutely no clue if things are breaking or not 😅