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

chore: bump scala to 3.3.4 #130

Merged
merged 1 commit into from
Dec 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ object Tables:
)

private def playerTable(
content: PlayerRowConfig[_]*
content: PlayerRowConfig[?]*
): Div =
div(
cls := "player-table",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import io.github.mahh.doko.logic.rules.Rules
import io.github.mahh.doko.logic.score.ScoreAnalyzer
import io.github.mahh.doko.shared.bids.Bid
import io.github.mahh.doko.shared.bids.Bid.NameableBid
import io.github.mahh.doko.shared.bids.Bid.ordering
import io.github.mahh.doko.shared.deck.*
import io.github.mahh.doko.shared.game.CompleteTrick
import io.github.mahh.doko.shared.game.GameState
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ case class FullTableState(
missingPlayers: Set[PlayerPosition]
) {

private[this] val handlePlayerAction: PartialFunction[TransitionParams, FullTableState] = {
private val handlePlayerAction: PartialFunction[TransitionParams, FullTableState] = {

val blockIfPlayersIsMissing: PartialFunction[TransitionParams, TransitionParams] = {
case x if missingPlayers.isEmpty =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import io.github.mahh.doko.shared.table.TableMap
/** Logic to calculate the final scores of a round. */
object ScoreAnalyzer {

private[this] def charlyScores(
private def charlyScores(
lastTrick: (PlayerPosition, CompleteTrick),
team: Set[PlayerPosition]
): List[SpecialScore] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ object AbstractFullGameStateSpec {
}

def applyActionForAllPLayers(action: PlayerAction[GameState]): FullGameState = {
applyActions(PlayerPosition.AllAsSet.map(_ -> action).toSeq: _*)
applyActions(PlayerPosition.AllAsSet.map(_ -> action).toSeq*)
}

def acknowledgedByAll(ack: PlayerAction.Acknowledgement[GameState]): FullGameState = {
applyActions(PlayerPosition.All.map(_ -> ack): _*)
applyActions(PlayerPosition.All.map(_ -> ack)*)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ class FullGameStateSpec extends AbstractFullGameStateSpec(RuleConformingGens.ful
checkProp("spectatorState.playerState is always empty")(_.spectatorState.playerState.isEmpty)

checkProp("for all playerStates, playerState is never empty") { gameState =>
Prop.all(gameState.playerStates.values.map[Prop](_.playerState.nonEmpty): _*)
Prop.all(gameState.playerStates.values.map[Prop](_.playerState.nonEmpty)*)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class NegotiatingSpec extends AbstractFullGameStateSpec[Negotiating](negotiating
Prop.all(
PlayerPosition.All.flatMap { pos =>
Reservation.Solo.All.map(reservationIsAllowed(pos, state, _))
}: _*
}*
)
}

Expand All @@ -70,7 +70,7 @@ class NegotiatingSpec extends AbstractFullGameStateSpec[Negotiating](negotiating
reservationIsAllowed(pos, state, Reservation.Marriage) && Prop.all(
PlayerPosition.All.filterNot(_ == pos).map { pos =>
reservationIsNotAllowed(pos, state, Reservation.Marriage) :| s"$pos cannot call marriage"
}: _*
}*
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class PovertyExchangeSpec extends AbstractFullGameStateSpec(povertyExchangeGen)
property("Selection is possible while selection.size is < sizeOfPoverty") {
Prop.forAll(genWithNOfAcceptingHand(defaultGen)(_.sizeOfPoverty)) { case (state, cards) =>
state.canApplyActionsProp(
cards.map(card => state.acceptingPlayer -> PlayerAction.PovertySelect(card)): _*
cards.map(card => state.acceptingPlayer -> PlayerAction.PovertySelect(card))*
)
}
}
Expand All @@ -63,7 +63,7 @@ class PovertyExchangeSpec extends AbstractFullGameStateSpec(povertyExchangeGen)
Prop.forAll(genWithNOfAcceptingHand(defaultGen)(_.sizeOfPoverty + 1)) { case (state, cards) =>
val selection = cards.tail
val selectionComplete = state.applyActions(
selection.map(card => state.acceptingPlayer -> PlayerAction.PovertySelect(card)): _*
selection.map(card => state.acceptingPlayer -> PlayerAction.PovertySelect(card))*
)
!selectionComplete.handleAction.isDefinedAt(
state.acceptingPlayer -> PlayerAction.PovertySelect(cards.head)
Expand All @@ -78,17 +78,17 @@ class PovertyExchangeSpec extends AbstractFullGameStateSpec(povertyExchangeGen)
cardsToTry.map { c =>
!state.handleAction
.isDefinedAt(state.acceptingPlayer, PlayerAction.PovertyDeselect(c)) :| s"card=$c"
}: _*
}*
)
}

property("Deselection is possible while selection is non-empty") {
Prop.forAll(genWithNOfAcceptingHand(defaultGen)(_.sizeOfPoverty)) { case (state, cards) =>
val selectionComplete = state.applyActions(
cards.map(card => state.acceptingPlayer -> PlayerAction.PovertySelect(card)): _*
cards.map(card => state.acceptingPlayer -> PlayerAction.PovertySelect(card))*
)
selectionComplete.canApplyActionsProp(
cards.map(card => state.acceptingPlayer -> PlayerAction.PovertyDeselect(card)): _*
cards.map(card => state.acceptingPlayer -> PlayerAction.PovertyDeselect(card))*
)
}
}
Expand All @@ -112,7 +112,7 @@ class PovertyExchangeSpec extends AbstractFullGameStateSpec(povertyExchangeGen)
.map { pos =>
val nCards = state.playerStates(pos).hand.size
(nCards ?= cardsPerPlayer) :| s"pos=$pos"
}: _*
}*
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class PovertyOnOfferSpec extends AbstractFullGameStateSpec[PovertyOnOffer](pover
.tail
.take(3)
.map(_ -> PlayerAction.PovertyReply(false))
state.applyActions(calls: _*).isInstanceOf[FullGameState.PovertyRefused]
state.applyActions(calls*).isInstanceOf[FullGameState.PovertyRefused]
}

property("If a player that is being offered to accepts, state transitions PovertyExchange") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ class PovertyRefusedSpec extends AbstractFullGameStateSpec[PovertyRefused](pover
Prop.forAll(defaultGen, GenUtils.shuffle(PlayerPosition.All)) { (state, posList) =>
val acknowledgingPlayers = posList.tail
val newState =
state.applyActions(acknowledgingPlayers.map(_ -> PlayerAction.AcknowledgeRoundResult): _*)
state.applyActions(acknowledgingPlayers.map(_ -> PlayerAction.AcknowledgeRoundResult)*)
newState.isInstanceOf[PovertyRefused]
}
}

property("After all players acknowledged, state transitions to Negotiating") {
Prop.forAll(defaultGen, GenUtils.shuffle(PlayerPosition.All)) { (state, posList) =>
val newState =
state.applyActions(posList.map(_ -> PlayerAction.AcknowledgePovertyRefused): _*)
state.applyActions(posList.map(_ -> PlayerAction.AcknowledgePovertyRefused)*)
newState.isInstanceOf[FullGameState.Negotiating]
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@ class RoundResultsSpec extends AbstractFullGameStateSpec[RoundResults](roundResu
Prop.forAll(defaultGen, GenUtils.shuffle(PlayerPosition.All)) { (state, posList) =>
val acknowledgingPlayers = posList.tail
val newState =
state.applyActions(acknowledgingPlayers.map(_ -> PlayerAction.AcknowledgeRoundResult): _*)
state.applyActions(acknowledgingPlayers.map(_ -> PlayerAction.AcknowledgeRoundResult)*)
newState.isInstanceOf[RoundResults]
}
}

property("After all players acknowledged, state transitions to Negotiating") {
Prop.forAll(defaultGen, GenUtils.shuffle(PlayerPosition.All)) { (state, posList) =>
val newState = state.applyActions(posList.map(_ -> PlayerAction.AcknowledgeRoundResult): _*)
val newState = state.applyActions(posList.map(_ -> PlayerAction.AcknowledgeRoundResult)*)
newState.isInstanceOf[FullGameState.Negotiating]
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ object RuleConformingGens {
)
for {
selectors <- Gen.oneOf(povertySelectors)
result <- withSpecialHandForOnePlayer(selectors: _*)
result <- withSpecialHandForOnePlayer(selectors*)
} yield result
}

Expand Down Expand Up @@ -129,7 +129,7 @@ object RuleConformingGens {

for {
selectors <- Gen.oneOf(povertySelectors)
result <- withSpecialHandForOnePlayer(selectors: _*)
result <- withSpecialHandForOnePlayer(selectors*)
} yield result
}
}
Expand Down Expand Up @@ -185,7 +185,7 @@ object RuleConformingGens {

private def withShuffledActionsGen(
fullGameState: FullGameState,
calls: TableMap[_ <: PlayerAction[_ <: GameState]]
calls: TableMap[? <: PlayerAction[? <: GameState]]
): Gen[Option[FullGameState]] = {
for {
players <- GenUtils.shuffle(calls.toMap.toList)
Expand All @@ -198,7 +198,7 @@ object RuleConformingGens {

private def acknowledgedGen(
fullGameStateGen: Gen[FullGameState],
acknowledgement: Acknowledgement[_ <: GameState]
acknowledgement: Acknowledgement[? <: GameState]
): Gen[Option[FullGameState]] = {
for {
state <- fullGameStateGen
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class TableServerStateMachineSpec extends ScalaCheckSuite:
case ClientMessageTask(c, _) =>
c ?= joining.clientId
}
Prop.all(messagesProps: _*)
Prop.all(messagesProps*)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import io.github.mahh.doko.server.tableactor.IncomingTableActorMessage.WrappedIn
import io.github.mahh.doko.shared.msg.MessageToClient
import io.github.mahh.doko.shared.msg.MessageToServer

class ActorBasedLogicFlowFactory(parentContext: ActorContext[_])(using rules: Rules)
class ActorBasedLogicFlowFactory(parentContext: ActorContext[?])(using rules: Rules)
extends LogicFlowFactory {

private val tableActor = parentContext.spawn(TableActor.behavior, "TableActor")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import org.apache.pekko.stream.scaladsl.Sink
import org.apache.pekko.stream.scaladsl.Source
import io.github.mahh.doko.logic.rules.Rules
import io.github.mahh.doko.logic.table.IncomingAction
import io.github.mahh.doko.logic.table.IncomingAction.ClientJoined
import io.github.mahh.doko.logic.table.IncomingAction.ClientLeft
import io.github.mahh.doko.logic.table.TableServerStateMachine
import io.github.mahh.doko.logic.table.TableServerStateMachine.TransitionResult
import io.github.mahh.doko.logic.table.client.ClientId
Expand Down
2 changes: 1 addition & 1 deletion project/Versions.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
object Versions {

val scalaVersion = "3.3.3"
val scalaVersion = "3.3.4"

val pekkoVersion = "1.1.2"
val pekkoHttpVersion = "1.1.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import munit.FunSuite

class TrumpsSpec extends FunSuite {

private[this] def ordersAsExpected(trumps: Trumps)(expected: Card*): Unit = {
private def ordersAsExpected(trumps: Trumps)(expected: Card*): Unit = {
val sorted = Card.allBySuit.reverse.sorted(trumps.cardsOrdering)
assertEquals(sorted, expected.toList)
}
Expand Down
Loading