Skip to content

Commit

Permalink
fmt braces
Browse files Browse the repository at this point in the history
  • Loading branch information
rmgk committed Jan 14, 2025
1 parent 6f81553 commit b80eb06
Show file tree
Hide file tree
Showing 15 changed files with 36 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ object WebsocketConnect {

def connect(url: String): LatentConnection[MessageBuffer] = new LatentConnection {

override def prepare(incomingHandler: Receive[MessageBuffer]): Async[Abort, Connection[MessageBuffer]] =
override def prepare(incomingHandler: Receive[MessageBuffer]): Async[Abort, Connection[MessageBuffer]] = {
Async.fromCallback {

println(s"preparing connection")
Expand Down Expand Up @@ -71,5 +71,6 @@ object WebsocketConnect {
socket.close()
Async.handler.fail(new WebsocketException("Websocket failed to connect"))
}
}
}
}
3 changes: 2 additions & 1 deletion Modules/Channels/jvm/src/main/scala/channels/UDP.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class UDPPseudoConnection(
executionContext: ExecutionContext,
initializeOutbound: Async[Any, SocketAddress],
) extends LatentConnection[MessageBuffer] {
override def prepare(receiver: Receive[MessageBuffer]): Async[Abort, Connection[MessageBuffer]] =
override def prepare(receiver: Receive[MessageBuffer]): Async[Abort, Connection[MessageBuffer]] = {
Async.fromCallback[Connection[MessageBuffer]] {

val datagramSocket = socketFactory()
Expand Down Expand Up @@ -78,6 +78,7 @@ class UDPPseudoConnection(
case Failure(exception) => connectionSuccess.fail(exception)

}
}

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import scala.swing.{BoxPanel, FlowPanel, Label, MainFrame, Orientation, SimpleSw

object DropdownSample1 extends SimpleSwingApplication {

def top =
def top = {
new MainFrame {

val col1 = new ReTextField(text = "Berlin", columns = 30)
Expand Down Expand Up @@ -78,4 +78,5 @@ object DropdownSample1 extends SimpleSwingApplication {
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import scala.swing.{BoxPanel, FlowPanel, Label, MainFrame, Orientation, SimpleSw

object DropdownSample2 extends SimpleSwingApplication {

def top =
def top = {
new MainFrame {

/* This version "artificially" introduces a Signal[List[Signal[String]] to illustrate higher
Expand Down Expand Up @@ -71,4 +71,5 @@ object DropdownSample2 extends SimpleSwingApplication {
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import scala.swing.{BoxPanel, FlowPanel, Label, MainFrame, Orientation, SimpleSw

object DropdownSample2b extends SimpleSwingApplication {

def top =
def top = {
new MainFrame {

/* This version "artificially" introduces a Signal[List[Signal[String]] to illustrate higher
Expand Down Expand Up @@ -77,4 +77,5 @@ object DropdownSample2b extends SimpleSwingApplication {
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class MillGame {
remainCount.transform(currentCount => currentCount.updated(player, currentCount(player) - 1))
}

def playerInput(i: SlotIndex): Boolean =
def playerInput(i: SlotIndex): Boolean = {
state match {

case PlaceStone(player) =>
Expand Down Expand Up @@ -146,4 +146,5 @@ class MillGame {

case _ => false
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class GUI(
val refreshCheckbox = new ReCheckBox("auto refresh", selected = true)
def refreshAllowed = refreshCheckbox.selected

def top =
def top = {
new MainFrame {
val quitAction = swing.Action("Quit") { quit() }
val urlDialogAction = swing.Action("Add url") {
Expand Down Expand Up @@ -135,4 +135,5 @@ class GUI(
location = new Point((screenSize.width - framewidth) / 2, (screenSize.height - frameheight) / 2)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import lore.dsl.*
import reactives.default.Var as Source

object sourceExamplesObject:
def sourceExamplesFunction(): Unit =
def sourceExamplesFunction(): Unit = {
// ========= Non-Source Values to use in below tests =========
val integerLiteral: Int = 1
val integerExpression1: Int = 1 + 2
Expand Down Expand Up @@ -76,5 +76,6 @@ object sourceExamplesObject:
val boolReferenceNumeralBinaryOpSource1: Source[Boolean] = Source(integerLiteral >= integerLiteral + 1)
val boolReferenceNumeralBinaryOpSource2: Source[Boolean] = Source(1 != integerLiteral)
val boolReferenceNumeralBinaryOpSource3: Source[Boolean] = Source(integerLiteral <= 2)
}
end sourceExamplesFunction
end sourceExamplesObject
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class LoRePhase extends PluginPhase:
*/
private def buildLoreRhsTerm(tree: tpd.LazyTree, indentLevel: Integer = 0, operandSide: String = "")(using
Context
): Term =
): Term = {
tree match
case Literal(Constant(num: Int)) => // Basic int values like 0 or 1
logRhsInfo(indentLevel, operandSide, "literal integer value", num.toString)
Expand Down Expand Up @@ -345,9 +345,10 @@ class LoRePhase extends PluginPhase:
s"${"\t".repeat(indentLevel)}Unsupported RHS form used:\n${"\t".repeat(indentLevel)}$tree"
)
TVar("<error>")
}
end buildLoreRhsTerm

override def transformValDef(tree: tpd.ValDef)(using ctx: Context): tpd.Tree =
override def transformValDef(tree: tpd.ValDef)(using ctx: Context): tpd.Tree = {
var newLoreTerm: Option[Term] = None // Placeholder, value is defined in below individual cases to avoid code dupe

tree match
Expand Down Expand Up @@ -414,5 +415,6 @@ class LoRePhase extends PluginPhase:
val newList: List[Term] = List(loreTerm)
loreTerms = loreTerms.updated((tree.source, ctx.owner), newList)
tree // Return the original tree to further compiler phases
}
end transformValDef
end LoRePhase
3 changes: 2 additions & 1 deletion Modules/Lore/shared/src/main/scala/lore/backends/Util.scala
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def traverseFromNode[A <: Term](
): A = {
// apply transformer to start node
val transformed = transformer(node)
val result =
val result = {
// if node has children, traverse
transformed match {
// basic terms
Expand Down Expand Up @@ -254,6 +254,7 @@ def traverseFromNode[A <: Term](
// TFalse | TString(_) | TViperImport(_) =>
// transformed
}
}
try result.asInstanceOf[A]
catch {
case c: ClassCastException =>
Expand Down
6 changes: 4 additions & 2 deletions Modules/Lore/shared/src/main/scala/lore/optics/Optics.scala
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,10 @@ val Subtree: Traversal[Term, Term] =
}
}

val children: Fold[Term, Term] =
val children: Fold[Term, Term] = {
new Fold[Term, Term] {

def foldMap[M: Monoid](f: Term => M)(t: Term): M =
def foldMap[M: Monoid](f: Term => M)(t: Term): M = {
t match {
case _: (TViperImport | TArgT | TVar | TTypeAl | TNum | TTrue | TFalse |
TString) =>
Expand Down Expand Up @@ -192,7 +192,9 @@ val children: Fold[Term, Term] =
case TFunC(name, args, sourcePos) =>
Monoid[M].combineAll(args.toList.map(f))
}
}
}
}

// new Traversal[Term, Term] {
// def modifyA[F[_]: Monad](f: Term => F[Term])(s: Term): F[Term] =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ case class MultiPaxos[A](
))
)

def upkeep(using LocalUid, Participants): MultiPaxos[A] =
def upkeep(using LocalUid, Participants): MultiPaxos[A] = {
// perform upkeep in Paxos
val deltaPaxos = currentPaxos.upkeep()
val newPaxos = currentPaxos.merge(deltaPaxos)
Expand Down Expand Up @@ -110,6 +110,7 @@ case class MultiPaxos[A](
case MultipaxosPhase.Idle =>
// nothing to do
MultiPaxos()
}

object MultiPaxos:
given [A]: Bottom[MultiPaxosRound[A]] = Bottom.provide(MultiPaxosRound())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ object CalculusLike {
override def forceNewTransaction[R](
initialWrites: Set[ReSource.of[State]],
admissionPhase: AdmissionTicket[State] => R
): R =
): R = {
synchronized {
// some broken user code may start a new transaction during an ongoing one
// this is not supported by this propagation algorithm,
Expand Down Expand Up @@ -139,6 +139,7 @@ object CalculusLike {
idle = true
}
}
}
override private[reactives] def singleReadValueOnce[A](reactive: ReadAs.of[State, A]): A =
reactive.read(reactive.state.value)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@ trait TopoBundle {

def beforeCleanupHook(all: Seq[ReSource], initialWrites: Set[ReSource]): Unit = ()

override def forceNewTransaction[R](initialWrites: Set[ReSource], admissionPhase: AdmissionTicket[State] => R): R =
override def forceNewTransaction[R](initialWrites: Set[ReSource], admissionPhase: AdmissionTicket[State] => R): R = {
synchronized {
if !idle then throw new IllegalStateException("Scheduler is not reentrant")
idle = false
val afterCommitObservers: ListBuffer[Observation] = ListBuffer.empty
val res =
val res = {
try {
val creation = new TopoInitializer(afterCommitObservers)
val transaction = TopoTransaction(creation)
Expand Down Expand Up @@ -154,9 +154,11 @@ trait TopoBundle {
} finally {
idle = true
}
}
afterCommitObservers.foreach(_.execute())
res
}
}

override private[reactives] def singleReadValueOnce[A](reactive: ReadAs.of[State, A]): A = {
reactive.read(reactive.state.value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ class FilteringAntiEntropy[RDT](

private val antiEntropyThread = new Thread {
private val rand = Random()
override def run(): Unit =
override def run(): Unit = {
while !stopped do {
try {
// Execute every 1 to 3 seconds, avoiding synchronization of these requests among replicas.
Expand Down Expand Up @@ -480,6 +480,7 @@ class FilteringAntiEntropy[RDT](
val _ = connectionManager.send(remote, msg)
}
}
}
}
antiEntropyThread.start()
}
Expand Down

0 comments on commit b80eb06

Please sign in to comment.