Skip to content

Commit d696093

Browse files
authored
Reference method values when building Args in Scala 3 (#126)
Pull request: #126
1 parent 28b4f6c commit d696093

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

sourcecode/src-3/sourcecode/Macros.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,8 @@ object Macros {
205205
}
206206

207207
val texts0 = param.map(_.foldRight('{List.empty[Text[_]]}) {
208-
case (vd @ ValDef(nme, _, optV), l) =>
209-
'{Text(${optV.fold('None)(_.asExpr)}, ${Expr(nme)}) :: $l}
208+
case (vd @ ValDef(nme, _, _), l) =>
209+
'{Text(${Ref(vd.symbol).asExpr}, ${Expr(nme)}) :: $l}
210210
})
211211
val texts = texts0.foldRight('{List.empty[List[Text[_]]]}) {
212212
case (l, acc) =>

sourcecode/test/src/sourcecode/ArgsTests.scala

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,8 @@ object ArgsTests {
77

88
def debug(implicit arguments: sourcecode.Args): Unit = args = arguments.value.map(_.map(t => t.source -> t.value))
99

10-
// FIXME Can't manage to get the arg values from dotty…
11-
val checkValues = !TestUtil.isDotty
12-
1310
def check(expected: Seq[Seq[(String, Any)]]): Unit =
14-
if (checkValues)
15-
assert(args == expected, s"Expected: $expected, got: $args")
16-
else
17-
assert(args.map(_.map(_._1)) == expected.map(_.map(_._1)), s"Expected: ${expected.map(_.map(_._1))}, got: ${args.map(_.map(_._1))}")
11+
assert(args == expected, s"Expected: $expected, got: $args")
1812

1913
def foo(p1: String, p2: Long, p3: Boolean)(foo: String, bar: String): Unit = {
2014
debug

0 commit comments

Comments
 (0)