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

Upgrade to Scala 2.13.8 #12506

Merged
merged 14 commits into from
Feb 3, 2022
Merged

Upgrade to Scala 2.13.8 #12506

merged 14 commits into from
Feb 3, 2022

Conversation

realvictorprm
Copy link
Contributor

Not completely sure this is done correctly but lets see.

changelog_begin
changelog_end

Pull Request Checklist

  • Read and understand the contribution guidelines
  • Include appropriate tests
  • Set a descriptive title and thorough description
  • Add a reference to the issue this PR will solve, if appropriate
  • Include changelog additions in one or more commit message bodies between the CHANGELOG_BEGIN and CHANGELOG_END tags
  • Normal production system change, include purpose of change in description
  • If you mean to change the status of a component, please make sure you keep the Component Status page up to date.

NOTE: CI is not automatically run on non-members pull-requests for security
reasons. The reviewer will have to comment with /AzurePipelines run to
trigger the build.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

LGTM.

nix/nixpkgs.nix Outdated
version = "2.13.6";
name = "scala-2.13.6";
version = "2.13.8";
name = "scala-2.13.8";
src = pkgs.fetchurl {
url = "https://www.scala-lang.org/files/archive/${name}.tgz";
sha256 = "0hzd6pljc8z5fwins5a05rwpx2w7wmlb6gb8973c676i7i895ps9";
Copy link

Choose a reason for hiding this comment

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

Oh, my mistake, you need to update this.

If you change it to all zeroes and then try and run scala -version, Nix will print out the correct value for you.

Copy link
Collaborator

@remyhaemmerle-da remyhaemmerle-da left a comment

Choose a reason for hiding this comment

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

LGTM

name: QualifiedName,
tyVars: ImmArraySeq[Ast.TypeVarName],
enum: Ast.DataEnum,
`enum`: Ast.DataEnum,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please avoid using back-tick.

Suggested change
`enum`: Ast.DataEnum,
enumeration: Ast.DataEnum,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, will apply that across the board!

Copy link
Contributor

Choose a reason for hiding this comment

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

Please avoid using back-tick.

Can you also add an explanation to your request?

Copy link
Collaborator

@remyhaemmerle-da remyhaemmerle-da Jan 28, 2022

Choose a reason for hiding this comment

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

Can you also add an explanation to your request?

Here are some of my motivations :

  • Simplicity is almost always better. Why using this advance feature when a simple renaming makes the trick ?
  • It is more difficult to type.
  • it makes my life more complicate when I want to use regexp to search/refactor something
  • intelliJ does not handle them faultless.

I prefer reserving backticks for two following usages :

  • In pattern machine for matching constant.
  • to "hide" implicits.

@realvictorprm realvictorprm requested review from a team as code owners January 24, 2022 13:52
@@ -46,6 +46,7 @@ class MetricsCollector[T](exposedMetrics: Option[ExposedMetrics[T]], clock: Cloc
import MetricsCollector.Message._
import MetricsCollector.Response._

@scala.annotation.nowarn("msg=.*is unchecked since it is eliminated by erasure")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would like to fix it but I don't know yet how I can fix it correctly here without causing big cascades of changes.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, I missed this one.
I'm fine with muting this warning. I'll probably need to revisit this piece of code.

@@ -52,6 +52,7 @@ da_scala_library(
scalacopts = [
"-Wconf:cat=unused-imports&site=com\\.daml\\.sample\\..*:s",
"-Wconf:msg=parameter value ev.. in method ContractIdNT (Value)|(LfEncodable) is never used:s",
"-Wconf:msg=Wrap `enum` in backticks to use it as an identifier:s",
Copy link

Choose a reason for hiding this comment

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

Do you still need this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes because the generated scala code contains enum as variable name 😓

Copy link
Contributor

Choose a reason for hiding this comment

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

^ @stefanobaghino-da you might want to fix that in the scala codegen.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If Stefano agrees to it I can take care of that too. However I wanted to keep the scope of this PR as much limited as possible so I would do it in a different PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

^ @stefanobaghino-da you might want to fix that in the scala codegen.

I'll add a ticket to track this, I don't think we should be working on this right now.

Copy link
Contributor

Choose a reason for hiding this comment

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

@@ -21,6 +21,9 @@ da_scala_library(
"@maven//:io_spray_spray_json",
"@maven//:org_scalaz_scalaz_core",
],
scalacopts = [
"-Wconf:msg=class DeduplicationTime in object DeduplicationPeriod is deprecated:s", # deprecated field that needs to be tested
Copy link

Choose a reason for hiding this comment

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

Can't we nowarn this closer to the actual reference?

Copy link

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

That tweet seems wise. The author is clearly a brilliant individual.

Copy link
Contributor

@cocreature cocreature left a comment

Choose a reason for hiding this comment

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

Great work! Only request from my side is to rename export to scriptExport instead of exporting.

@@ -21,35 +21,40 @@ import spray.json._

private[export] object Encode {

def encodeArgs(export: Export): JsObject = {
def encodeArgs(exporting: Export): JsObject = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we call it scriptExport instead? Seems a bit clearer.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

many thanks for the suggestion! Will apply that in an instant.

@@ -52,6 +52,7 @@ da_scala_library(
scalacopts = [
"-Wconf:cat=unused-imports&site=com\\.daml\\.sample\\..*:s",
"-Wconf:msg=parameter value ev.. in method ContractIdNT (Value)|(LfEncodable) is never used:s",
"-Wconf:msg=Wrap `enum` in backticks to use it as an identifier:s",
Copy link
Contributor

Choose a reason for hiding this comment

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

^ @stefanobaghino-da you might want to fix that in the scala codegen.

@@ -46,6 +46,7 @@ class MetricsCollector[T](exposedMetrics: Option[ExposedMetrics[T]], clock: Cloc
import MetricsCollector.Message._
import MetricsCollector.Response._

@scala.annotation.nowarn("msg=.*is unchecked since it is eliminated by erasure")
Copy link
Contributor

Choose a reason for hiding this comment

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

@realvictorprm realvictorprm enabled auto-merge (squash) January 26, 2022 17:01
@stefanobaghino-da
Copy link
Contributor

This PR has been open for 11 days now. Please either merge it or close it.

@realvictorprm
Copy link
Contributor Author

This PR has been open for 11 days now. Please either merge it or close it.

already on my list, need to do a last rebase and then the CI should pass.

@realvictorprm
Copy link
Contributor Author

we're slowly getting there, only Linux is left! Hopefully it succeeds this time! 😅

/** We validate only using current time because we set the currentTime as submitTime so no need to check both
*/
@scala.annotation.nowarn(
Copy link

Choose a reason for hiding this comment

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

Import nowarn, please.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think it's necessary, especially if it's used only once. But as mentioned there's no need to to include scala in the fully qualified name.

@ghost
Copy link

ghost commented Feb 2, 2022

I think the code is fixed now; please merge/rebase main.

@realvictorprm realvictorprm merged commit aa45f48 into main Feb 3, 2022
@realvictorprm realvictorprm deleted the upgradeScala branch February 3, 2022 09:05
/** We validate only using current time because we set the currentTime as submitTime so no need to check both
*/
@nowarn(
"msg=class DeduplicationTime in object DeduplicationPeriod is deprecated"
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use cat=deprecation&origin=^com\.daml\.ledger\.api\.v1\.commands\.Commands\.DeduplicationPeriod\.DeduplicationTime$ in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now I finally understand how that one works, thanks!

@realvictorprm
Copy link
Contributor Author

Yaaay finally merged, took long enough lol

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.

5 participants