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

Update scala 2.13.0-M5 to 2.13.0-RC1 #159

Closed

Conversation

Philippus
Copy link
Contributor

No description provided.

@Philippus
Copy link
Contributor Author

Build fails on #157

@Philippus
Copy link
Contributor Author

@analytically can you have a look? I'd be happy to make some changes, but I'm not sure what would be the best ones. :)

@analytically
Copy link
Collaborator

Seems like a regression in RC1?

both method error in trait Logger of type (x$1: String, x$2: Object*)Unit
[error] and method error in trait Logger of type (x$1: String, x$2: Any)Unit

@SethTisue
Copy link
Collaborator

I think scala/scala#7631 might be relevant here?

@ijuma
Copy link

ijuma commented May 5, 2019

Do we get to a conclusion on how to proceed here? Is it a bug in Scala that will be fixed in RC2 or does scalalogging have to be updated?

@analytically
Copy link
Collaborator

I'd happily accept any PR that would fix scala-logging for 2.13.0-RC1, but IMO this is a regression.

@SethTisue
Copy link
Collaborator

SethTisue commented May 23, 2019

if you think (or anyone watching this ticket thinks) there is a bug in Scala, please open a ticket at https://github.com/scala/bug

@SethTisue
Copy link
Collaborator

scala/scala#7680 seems also relevant

@SethTisue
Copy link
Collaborator

in order to get scala-logging green in the Scala community build, @adriaanm did a series of commits at https://github.com/scalacommunitybuild/scala-logging/commits/community-build-2.13

the relevant commit appears to be scalacommunitybuild@650bed8

@Philippus does that give you what you need to update this PR for RC2...?

@SethTisue
Copy link
Collaborator

Adriaan's commit shows how to force the varargs version to be chosen. @dwijnand notes that ascribing : Any forces the other overload to be chosen:

scala 2.13.0-RC2> class Logger { def error(x: String, xs: AnyRef*) = 1; def error(x: String, x2: Any) = 2 }
defined class Logger

scala 2.13.0-RC2> (new Logger).error("a", "b")
                               ^
                  error: ambiguous reference to overloaded definition,
                  both method error in class Logger of type (x: String, x2: Any)Int
                  and  method error in class Logger of type (x: String, xs: AnyRef*)Int
                  match argument types (String,String)

scala 2.13.0-RC2> (new Logger).error("a", "b": Any)
res1: Int = 2

@SethTisue
Copy link
Collaborator

@Philippus if you run into any further trouble, scala/scala#7966 and scala/scala#8049 are also potentially relevant (thx @dwijnand)

@dwijnand
Copy link

dwijnand commented May 23, 2019

In Java it works, and it uses the non-varargs (which is the same as type-ascribing with Any, and the opposite to what Scala 2.12 and Dotty do):

19:23:28 $ JAVA_HOME=$(/usr/libexec/java_home -v 11) jshell
|  Welcome to JShell -- Version 11.0.2
|  For an introduction type: /help intro

jshell> class Logger { int error(String x, Object... xs) { return 1; }; int error(String x, Object x2) { return 2; } }
|  created class Logger

jshell> (new Logger()).error("a", "b")
$2 ==> 2

@dwijnand
Copy link

dwijnand commented May 23, 2019

Actually, I think this was fixed in 2.13.0-RC2 (see those PRs). Trying to recreate in the shell using 2.13.0-RC2 it seems all fine:

Welcome to Scala 2.13.0-RC2 (OpenJDK GraalVM CE 19.0.0, Java 1.8.0_212).
Type in expressions for evaluation. Or try :help.

scala> final class Logger { def error(message: String, cause: Throwable) = "throwable"; def error(message: String, args: Any*) = "varargs" }
defined class Logger

scala> (new Logger).error("a", new Error)
res0: String = throwable

scala> (new Logger).error("a", "b")
res1: String = varargs

@adriaanm
Copy link
Contributor

adriaanm commented May 23, 2019 via email

@adriaanm
Copy link
Contributor

Let's continue the discussion at #162, where I hope we'll have a green upgrade to RC2 (tests pass for me locally).

@adriaanm adriaanm closed this May 24, 2019
@Philippus Philippus deleted the update/scala-2.13.0-RC1 branch February 24, 2021 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants