Skip to content

Commit

Permalink
Fixed some compiler warnings (#1940)
Browse files Browse the repository at this point in the history
Pull request: #1940
  • Loading branch information
lefou authored Jul 12, 2022
1 parent c88f8f9 commit f3f7281
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions bsp/src/mill/bsp/BSP.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ object BSP extends ExternalModule {
val languages = Seq("scala", "java")
val serverName = "mill-bsp"

private[this] var millServerHandle = Promise[BspServerHandle]
private[this] var millServerHandle = Promise[BspServerHandle]()

/**
* Installs the mill-bsp server. It creates a json file
Expand Down Expand Up @@ -162,7 +162,7 @@ object BSP extends ExternalModule {
override def runSession(evaluator: Evaluator): BspServerResult = {
_lastResult = None
millServer.updateEvaluator(Option(evaluator))
val onReload = Promise[BspServerResult]
val onReload = Promise[BspServerResult]()
millServer.onSessionEnd = Some { serverResult =>
if (!onReload.isCompleted) {
errStream.println("Unsetting evaluator on session end")
Expand Down
4 changes: 2 additions & 2 deletions bsp/src/mill/bsp/MillBuildServer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class MillBuildServer(
}
}

private[this] var statePromise: Promise[State] = Promise[State]
private[this] var statePromise: Promise[State] = Promise[State]()
initialEvaluator.foreach(e => statePromise.success(new State(e)))

// private[this] def stateFuture: Future[State] = statePromise.future
Expand All @@ -154,7 +154,7 @@ class MillBuildServer(
log.debug(s"Updating Evaluator: ${evaluator}")
if (statePromise.isCompleted) {
// replace the promise
statePromise = Promise[State]
statePromise = Promise[State]()
}
evaluator.foreach(e => statePromise.success(new State(e)))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ trait VersionFileModule extends Module {
}

protected def setVersionTask(version: T[Version]) = T.task {
T.ctx.log.info(generateCommitMessage(version()))
T.log.info(generateCommitMessage(version()))
writeVersionToFile(versionFile(), version())
}

Expand Down
2 changes: 1 addition & 1 deletion main/api/src/mill/api/AggWrapper.scala
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ sealed class AggWrapper(strictUniqueness: Boolean) {
def forall(p: V => Boolean): Boolean = items.forall(p)
@deprecated("Use .iterator.foreach(...) instead", "mill after 0.9.6")
def foreach[U](f: V => U): Unit = items.foreach(f)
def hasDefiniteSize: Boolean = set0.hasDefiniteSize
def hasDefiniteSize: Boolean = set0.hasDefiniteSize: @nowarn
def isEmpty: Boolean = items.isEmpty
def seq: scala.collection.IterableOnce[V] = items
@deprecated("Use .iterator instead", "mill after 0.9.6")
Expand Down
2 changes: 1 addition & 1 deletion main/src/mill/MillMain.scala
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ object MillMain {

stderr.println("Running in BSP mode with hardcoded startSession command")

val bspServerHandle = Promise[BspServerHandle]
val bspServerHandle = Promise[BspServerHandle]()

stderr.println("Trying to load BSP server...")
val bspServerFuture = Future {
Expand Down
2 changes: 1 addition & 1 deletion scalajslib/src/mill/scalajslib/ScalaJSModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ trait TestScalaJSModule extends ScalaJSModule with TestModule {
T.testReporter,
TestRunner.globFilter(globSelectors())
)
val res = TestModule.handleResults(doneMsg, results, Some(T.ctx))
val res = TestModule.handleResults(doneMsg, results, Some(T.ctx()))
// Hack to try and let the Node.js subprocess finish streaming it's stdout
// to the JVM. Without this, the stdout can still be streaming when `close()`
// is called, and some of the output is dropped onto the floor.
Expand Down
2 changes: 1 addition & 1 deletion scalanativelib/src/ScalaNativeModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ trait TestScalaNativeModule extends ScalaNativeModule with TestModule {
T.testReporter,
TestRunner.globFilter(globSeletors())
)
val res = TestModule.handleResults(doneMsg, results, Some(T.ctx))
val res = TestModule.handleResults(doneMsg, results, Some(T.ctx()))
// Hack to try and let the Scala Native subprocess finish streaming it's stdout
// to the JVM. Without this, the stdout can still be streaming when `close()`
// is called, and some of the output is dropped onto the floor.
Expand Down
14 changes: 7 additions & 7 deletions scalanativelib/test/src/HelloNativeWorldTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import mill._
import mill.api.Result
import mill.define.Discover
import mill.eval.EvaluatorPaths
import mill.scalalib.api.ZincWorkerUtil
import mill.scalalib.{CrossScalaModule, DepSyntax, Lib, PublishModule, TestModule}
import mill.scalalib.api.Util.isScala3
import mill.testrunner.TestRunner
import mill.scalalib.publish.{Developer, License, PomSettings, VersionControl}
import mill.scalanativelib.api._
import mill.util.{TestEvaluator, TestUtil}
import utest._

import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._

object HelloNativeWorldTests extends TestSuite {
val workspacePath = TestUtil.getOutPathStatic() / "hello-native-world"
Expand All @@ -32,7 +32,7 @@ object HelloNativeWorldTests extends TestSuite {
scala <- Seq("3.1.0", scala213, "2.12.13", "2.11.12")
scalaNative <- Seq(scalaNative04, "0.4.3")
mode <- List(ReleaseMode.Debug, ReleaseMode.ReleaseFast)
if !(isScala3(scala) && scalaNative == scalaNative04)
if !(ZincWorkerUtil.isScala3(scala) && scalaNative == scalaNative04)
} yield (scala, scalaNative, mode)

object helloNativeWorld extends Cross[BuildModule](matrix: _*)
Expand Down Expand Up @@ -185,14 +185,14 @@ object HelloNativeWorldTests extends TestSuite {

testAllMatrix(
(scala, scalaNative, releaseMode) => checkUtest(scala, scalaNative, releaseMode, cached),
skipScala = isScala3 // Remove this once utest is released for Scala 3
skipScala = ZincWorkerUtil.isScala3 // Remove this once utest is released for Scala 3
)
}
"testCached" - {
val cached = true
testAllMatrix(
(scala, scalaNative, releaseMode) => checkUtest(scala, scalaNative, releaseMode, cached),
skipScala = isScala3 // Remove this once utest is released for Scala 3
skipScala = ZincWorkerUtil.isScala3 // Remove this once utest is released for Scala 3
)
}

Expand All @@ -202,7 +202,7 @@ object HelloNativeWorldTests extends TestSuite {
val Right((_, evalCount)) = helloWorldEvaluator(task)

val paths = EvaluatorPaths.resolveDestPaths(helloWorldEvaluator.outPath, task)
val stdout = os.proc(paths.dest / "out").call().out.lines
val stdout = os.proc(paths.dest / "out").call().out.lines()
assert(
stdout.contains("Hello Scala Native"),
evalCount > 0
Expand All @@ -225,7 +225,7 @@ object HelloNativeWorldTests extends TestSuite {
)

val scalaVersionSpecific =
if (isScala3(scalaVersion)) Set("ArgsParser.tasty", "Main.tasty")
if (ZincWorkerUtil.isScala3(scalaVersion)) Set("ArgsParser.tasty", "Main.tasty")
else Set(
"Main$delayedInit$body.class",
"Main$delayedInit$body.nir"
Expand Down

0 comments on commit f3f7281

Please sign in to comment.