File tree Expand file tree Collapse file tree 2 files changed +7
-11
lines changed Expand file tree Collapse file tree 2 files changed +7
-11
lines changed Original file line number Diff line number Diff line change @@ -195,9 +195,8 @@ object Macros {
195
195
196
196
def text [T : Type ](v : Expr [T ])(implicit c : Reflection ): Expr [sourcecode.Text [T ]] = {
197
197
import c ._
198
- import scala .quoted .Toolbox .Default ._
199
- val txt = v.show
200
- '(sourcecode.Text[T](~v, ~txt.toExpr))
198
+ val txt = v.unseal.underlyingArgument.pos.sourceCode.toString.toExpr
199
+ '(sourcecode.Text[T](~v, ~txt))
201
200
}
202
201
203
202
sealed trait Chunk
Original file line number Diff line number Diff line change @@ -5,14 +5,11 @@ object TextTests {
5
5
assert(foo(1 ) == (1 , " 1" ))
6
6
val bar = Seq (" lols" )
7
7
assert(foo(bar) == (Seq (" lols" ), " bar" ))
8
- // FIXME Don't pass on dotty (second element not ok)
9
- if (TestUtil .isDotty) {
10
- assert(foo(Symbol (" lol" ).toString * 2 )._1 == " 'lol'lol" )
11
- assert(foo{println(" Hello" ); Symbol (" lol" ).toString * 2 }._1 == " 'lol'lol" )
12
- } else {
13
- assert(foo(Symbol (" lol" ).toString * 2 ) == (" 'lol'lol" , " Symbol(\" lol\" ).toString * 2" ))
14
- assert(foo{println(" Hello" ); Symbol (" lol" ).toString * 2 } == (" 'lol'lol" , " Symbol(\" lol\" ).toString * 2" ))
15
- }
8
+ assert(
9
+ foo(Symbol (" lol" ).toString * 2 ) == (" 'lol'lol" , " Symbol(\" lol\" ).toString * 2" ),
10
+ s " Expected: ${(" 'lol'lol" , " Symbol(\" lol\" ).toString * 2" )}, got: ${foo(Symbol (" lol" ).toString * 2 )}"
11
+ )
12
+ assert(foo{println(" Hello" ); Symbol (" lol" ).toString * 2 } == (" 'lol'lol" , " Symbol(\" lol\" ).toString * 2" ))
16
13
}
17
14
def foo [T ](v : sourcecode.Text [T ]) = (v.value, v.source)
18
15
}
You can’t perform that action at this time.
0 commit comments