Skip to content

Commit eba7905

Browse files
xerialclaude
andauthored
fix: Reformat CrossProjectMacro for scalafmt 3.11.3 to unblock CI (#650)
## Why The scalafmt 3.11.3 update (#646) changed how `newlines.source = fold` formats `CrossProjectMacro.scala`, but the `sbt-uni-crossproject` sub-build was not reformatted at that time. As a result, `scalafmtCheckAll` in the **sbt-uni-crossproject scripted test** CI job fails on every PR — first surfaced by #648. ## What Ran `scalafmtAll` in the sub-build. Verified locally with the same command CI runs: `scalafmtCheckAll; publishLocal; scripted` — all pass. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent 3df7e2f commit eba7905

1 file changed

Lines changed: 7 additions & 30 deletions

File tree

sbt-uni-crossproject/src/main/scala/wvlet/uni/sbt/crossproject/CrossProjectMacro.scala

Lines changed: 7 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -20,44 +20,21 @@ private[crossproject] object CrossProjectMacro:
2020
"crossProject must be directly assigned to a val, " +
2121
"such as `val x = crossProject(JVMPlatform, JSPlatform)`."
2222
)
23-
'{
24-
CrossProject(
25-
${
26-
name
27-
},
28-
new java.io.File(
29-
${
30-
name
31-
}
32-
)
33-
)(
34-
${
35-
platforms
36-
}*
37-
)
38-
}
23+
'{ CrossProject(${ name }, new java.io.File(${ name }))(${ platforms }*) }
3924

4025
private def definingValName(errorMsg: String)(using Quotes): Expr[String] =
4126
import quotes.reflect.*
4227
val term = enclosingTerm
43-
if term.isValDef then
44-
Expr(term.name)
45-
else
46-
report.errorAndAbort(errorMsg)
28+
if term.isValDef then Expr(term.name) else report.errorAndAbort(errorMsg)
4729

4830
private def enclosingTerm(using qctx: Quotes): qctx.reflect.Symbol =
4931
import qctx.reflect.*
5032
@tailrec
51-
def enclosingTerm0(sym: Symbol): Symbol =
52-
sym match
53-
case sym if sym.flags.is(Flags.Macro) =>
54-
enclosingTerm0(sym.owner)
55-
case sym if sym.flags.is(Flags.Synthetic) =>
56-
enclosingTerm0(sym.owner)
57-
case sym if !sym.isTerm =>
58-
enclosingTerm0(sym.owner)
59-
case _ =>
60-
sym
33+
def enclosingTerm0(sym: Symbol): Symbol = sym match
34+
case sym if sym.flags.is(Flags.Macro) => enclosingTerm0(sym.owner)
35+
case sym if sym.flags.is(Flags.Synthetic) => enclosingTerm0(sym.owner)
36+
case sym if !sym.isTerm => enclosingTerm0(sym.owner)
37+
case _ => sym
6138
enclosingTerm0(Symbol.spliceOwner)
6239

6340
end CrossProjectMacro

0 commit comments

Comments
 (0)