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 scalafmt-core to 3.8.4 #347

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Scala Steward: Reformat with scalafmt 3.8.4
d69567c8dbc4bac0aee9111cdf6b3d776e5d588b
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "3.8.3"
version = "3.8.4"
runner.dialect = scala213
maxColumn = 120
align.preset = more
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ abstract class AbstractMacroProcessor(val c: whitebox.Context) {
* Return the result of modifyAction function
*/
def collectCustomExpr(
annottees: Seq[Expr[Any]]
annottees: Seq[Expr[Any]]
)(modifyAction: (ClassDef, Option[ModuleDef]) => Any): Expr[Nothing] = {
val classDef = checkClassDef(annottees)
val compDecl = moduleDef(annottees)
Expand Down Expand Up @@ -284,10 +284,10 @@ abstract class AbstractMacroProcessor(val c: whitebox.Context) {
superClasses.nonEmpty && !superClasses.forall(sc => SDKClasses.contains(sc.toString()))

private[internal] final case class ValDefAccessor(
mods: Modifiers,
name: TermName,
tpt: Tree,
rhs: Tree
mods: Modifiers,
name: TermName,
tpt: Tree,
rhs: Tree
) {

def typeName: TypeName = symbol.name.toTypeName
Expand Down Expand Up @@ -363,13 +363,13 @@ abstract class AbstractMacroProcessor(val c: whitebox.Context) {
}

private[internal] case class ClassDefinition(
self: ValDef,
mods: Modifiers,
className: TypeName,
classParamss: List[List[Tree]],
classTypeParams: List[Tree],
body: List[Tree],
superClasses: List[Tree],
earlydefns: List[Tree] = Nil
self: ValDef,
mods: Modifiers,
className: TypeName,
classParamss: List[List[Tree]],
classTypeParams: List[Tree],
body: List[Tree],
superClasses: List[Tree],
earlydefns: List[Tree] = Nil
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ object applyMacro {
* B3(int)(j)(k)(t)`
*/
private def getApplyMethodWithCurrying(
typeName: TypeName,
fieldss: List[List[Tree]],
classTypeParams: List[Tree]
typeName: TypeName,
fieldss: List[List[Tree]],
classTypeParams: List[Tree]
): Tree = {
val allFieldsTermName = fieldss.map(f => classParamsTermNameWithType(f))
val returnTypeParams = typeParams(classTypeParams)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ object builderMacro {
}

private def getBuilderClassAndMethod(
typeName: TypeName,
fieldss: List[List[Tree]],
classTypeParams: List[Tree],
isCase: Boolean
typeName: TypeName,
fieldss: List[List[Tree]],
classTypeParams: List[Tree],
isCase: Boolean
): List[Tree] = {
val fields = fieldss.flatten
val builderClassName = getBuilderClassName(typeName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ object constructorMacro {
/** We generate this method with currying, and we have to deal with the first layer of currying alone.
*/
private def getThisMethodWithCurrying(
annotteeClassParams: List[List[Tree]],
annotteeClassDefinitions: Seq[Tree]
annotteeClassParams: List[List[Tree]],
annotteeClassDefinitions: Seq[Tree]
): Tree = {
val classInternalFieldsWithType = getMemberVarDefTermNameWithType(annotteeClassDefinitions)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ object equalsAndHashCodeMacro {

// equals method
private def getEqualsMethod(
className: TypeName,
termNames: Seq[TermName],
superClasses: Seq[Tree],
annotteeClassDefinitions: Seq[Tree]
className: TypeName,
termNames: Seq[TermName],
superClasses: Seq[Tree],
annotteeClassDefinitions: Seq[Tree]
): List[Tree] = {
val existsCanEqual = classMemberDefDefs(annotteeClassDefinitions).exists {
case defDef: DefDef if defDef.name.decodedName.toString == "canEqual" && defDef.vparamss.nonEmpty =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ object javaCompatibleMacro {
/** We generate this method with currying, and we have to deal with the first layer of currying alone.
*/
private def getNoArgsContrWithCurrying(
annotteeClassParams: List[List[Tree]],
annotteeClassDefinitions: Seq[Tree]
annotteeClassParams: List[List[Tree]],
annotteeClassDefinitions: Seq[Tree]
): Tree = {
annotteeClassDefinitions.foreach {
case defDef: DefDef if defDef.name.decodedName.toString == "this" && defDef.vparamss.isEmpty =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ object toStringMacro {
import c.universe._

private case class ToStringOptions(
includeInternalFields: Boolean,
includeFieldNames: Boolean,
callSuper: Boolean
includeInternalFields: Boolean,
includeFieldNames: Boolean,
callSuper: Boolean
)

private def extractTree(aa: Tree, bb: Tree, cc: Tree): ToStringOptions =
Expand Down Expand Up @@ -128,7 +128,9 @@ object toStringMacro {
}
superClassDef.fold(toString) { _ =>
val superClass = q"${"super="}"
q"override def toString: String = StringContext(${classDefinition.className.toTermName.decodedName.toString} + ${"("} + $superClass, ${if (member.nonEmpty) ", "
q"override def toString: String = StringContext(${classDefinition.className.toTermName.decodedName.toString} + ${"("} + $superClass, ${if (
member.nonEmpty
) ", "
else ""}+$paramsWithName + ${")"}).s(super.toString)"
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ import scala.annotation.{ compileTimeOnly, StaticAnnotation }
*/
@compileTimeOnly("enable macro to expand macro annotations")
final class toString(
includeInternalFields: Boolean = true,
includeFieldNames: Boolean = true,
callSuper: Boolean = false
includeInternalFields: Boolean = true,
includeFieldNames: Boolean = true,
callSuper: Boolean = false
) extends StaticAnnotation {
def macroTransform(annottees: Any*): Any = macro toStringMacro.ToStringProcessor.impl
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ class ApplyTest extends AnyFlatSpec with Matchers {
@toString class B3(int: Int)(val j: Int)(var k: Option[String] = None)(t: Option[Long] = Some(1L))
@apply
@toString class B4(int: Int, a: Seq[Seq[String]])(val j: Int, b: Seq[String])(
var k: Option[String] = None,
c: Seq[Option[String]]
var k: Option[String] = None,
c: Seq[Option[String]]
)(t: Option[Long] = Some(1L))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ class Transformable[From, To] {
*/
@unchecked
def setType[FromField, ToField](
selectFromField: From => FromField,
map: FromField => ToField
selectFromField: From => FromField,
map: FromField => ToField
): Transformable[From, To] =
macro TransformerMacro.mapTypeImpl[From, To, FromField, ToField]

Expand All @@ -67,8 +67,8 @@ class Transformable[From, To] {
*/
@unchecked
def setName[FromField, ToField](
selectFromField: From => FromField,
selectToField: To => ToField
selectFromField: From => FromField,
selectToField: To => ToField
): Transformable[From, To] =
macro TransformerMacro.mapNameImpl[From, To, FromField, ToField]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,33 +37,33 @@ abstract class AbstractMacroProcessor(val c: blackbox.Context) {
final case class FieldZipInformation(fieldNames: List[String], fieldIndexTypeMapping: List[(Int, Type)])

final case class CollectionFlags(
isSeq: Boolean = false,
isList: Boolean = false,
isOption: Boolean = false,
isVector: Boolean = false,
isSet: Boolean = false
isSeq: Boolean = false,
isList: Boolean = false,
isOption: Boolean = false,
isVector: Boolean = false,
isSet: Boolean = false
) {
def isCollection: Boolean = isSeq || isList || isOption || isVector || isSet

def isStrictCollection: Boolean = isSeq || isList || isVector || isSet
}

final case class FieldTreeInformation(
index: Int,
fieldTerm: Tree,
fieldType: Type,
zeroValue: Tree,
collectionsFlags: CollectionFlags,
genericType: List[Type] = Nil
index: Int,
fieldTerm: Tree,
fieldType: Type,
zeroValue: Tree,
collectionsFlags: CollectionFlags,
genericType: List[Type] = Nil
)

final case class FieldInformation(
fieldName: String,
fieldType: Type,
collectionFlags: CollectionFlags,
genericType: List[Type] = Nil,
hasDefaultValue: Boolean,
zeroValue: Tree
fieldName: String,
fieldType: Type,
collectionFlags: CollectionFlags,
genericType: List[Type] = Nil,
hasDefaultValue: Boolean,
zeroValue: Tree
)

def tryGetOrElse(tree: Tree, default: Tree): Tree =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ class TransformerMacro(override val c: whitebox.Context) extends AbstractMacroPr
private val fromTermName = TermName("from")

def mapTypeImpl[From, To, FromField, ToField](
selectFromField: Expr[From => FromField],
map: Expr[FromField => ToField]
selectFromField: Expr[From => FromField],
map: Expr[FromField => ToField]
): Expr[Transformable[From, To]] = {
val Function(_, Select(_, fromName)) = selectFromField.tree
val builderId = getBuilderId(annoBuilderPrefix)
Expand All @@ -54,8 +54,8 @@ class TransformerMacro(override val c: whitebox.Context) extends AbstractMacroPr
}

def setDefaultValueImpl[From, To, ToField](
selectToField: Expr[To => ToField],
defaultValue: Expr[ToField]
selectToField: Expr[To => ToField],
defaultValue: Expr[ToField]
): Expr[Transformable[From, To]] = {
val Function(_, Select(_, toName)) = selectToField.tree
val builderId = getBuilderId(annoBuilderPrefix)
Expand All @@ -67,8 +67,8 @@ class TransformerMacro(override val c: whitebox.Context) extends AbstractMacroPr
}

def mapNameImpl[From, To, FromField, ToField](
selectFromField: Expr[From => FromField],
selectToField: Expr[To => ToField]
selectFromField: Expr[From => FromField],
selectToField: Expr[To => ToField]
): Expr[Transformable[From, To]] = {
val Function(_, Select(_, fromName)) = selectFromField.tree
val Function(_, Select(_, toName)) = selectToField.tree
Expand Down Expand Up @@ -219,10 +219,10 @@ class TransformerMacro(override val c: whitebox.Context) extends AbstractMacroPr
}

private def checkForNoMappingField[From: WeakTypeTag, To: WeakTypeTag](
realFromFieldName: String,
fromFieldOpt: Option[FieldInformation],
toField: FieldInformation,
customFieldNameMapping: mutable.Map[String, String]
realFromFieldName: String,
fromFieldOpt: Option[FieldInformation],
toField: FieldInformation,
customFieldNameMapping: mutable.Map[String, String]
): Tree = {
val toClassInfo = caseClassFieldInfos[To]()
val fromClassInfo = caseClassFieldInfos[From]()
Expand Down Expand Up @@ -286,11 +286,11 @@ class TransformerMacro(override val c: whitebox.Context) extends AbstractMacroPr
}

private def checkMissingFields[From: WeakTypeTag, To: WeakTypeTag](
fromClassInfo: List[FieldInformation],
toClassInfo: List[FieldInformation],
customDefaultValueMapping: mutable.Map[String, Any],
customFieldNameMapping: mutable.Map[String, String],
customOptionsMapping: mutable.Set[Options]
fromClassInfo: List[FieldInformation],
toClassInfo: List[FieldInformation],
customDefaultValueMapping: mutable.Map[String, Any],
customFieldNameMapping: mutable.Map[String, String],
customOptionsMapping: mutable.Set[Options]
) = {
val toClassName = classTypeName[To]
val fromClassName = classTypeName[From]
Expand Down
Loading
Loading