Skip to content

Commit 5151604

Browse files
committed
Remove optimizations based on implementation details
1 parent 0b1fe9d commit 5151604

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

compiler/src/dotty/tools/dotc/ast/Positioned.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@ abstract class Positioned(implicit @constructorOnly src: SourceFile) extends Pro
2929
def uniqueId_=(id: Int): Unit = {
3030
def printTrace() = {
3131
println(s"Debug tree (id=${Positioned.debugId}) creation \n$this\n")
32-
Reporter.displayPrompt(Console.in, new PrintWriter(Console.err, true))
32+
new Exception().printStackTrace
33+
// Reporter.displayPrompt(Console.in, new PrintWriter(Console.err, true))
3334
}
34-
if (Positioned.debugId == id) printTrace()
35+
if (13 == id) printTrace()
3536
myUniqueId = id
3637
}
3738

library/src/scala/quoted/Liftable.scala

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -233,20 +233,14 @@ object Liftable {
233233
}
234234

235235
given as Liftable[BigInt] = new Liftable[BigInt] {
236-
def toExpr(x: BigInt): given QuoteContext => Expr[BigInt] = {
237-
lazy val xInt: Int = x.intValue()
238-
if (x.isValidInt && -1024 <= xInt && xInt < 1024) '{ BigInt(${xInt.toExpr}) } // Cached BigInt
239-
else '{ BigInt(${x.toString(Character.MAX_RADIX).toExpr}, ${Character.MAX_RADIX.toExpr}) } // Compact string BigInt
240-
}
236+
def toExpr(x: BigInt): given QuoteContext => Expr[BigInt] =
237+
'{ BigInt(${x.toString(Character.MAX_RADIX).toExpr}, ${Character.MAX_RADIX.toExpr}) }
241238
}
242239

243240
/** Lift a BigDecimal using the default MathContext */
244241
given as Liftable[BigDecimal] = new Liftable[BigDecimal] {
245-
def toExpr(x: BigDecimal): given QuoteContext => Expr[BigDecimal] = {
246-
lazy val xInt: Int = x.intValue()
247-
if (x.isValidInt && -512 <= xInt && xInt < 512) '{ BigDecimal(${xInt.toExpr}) } // Cached BigDecimal
248-
else '{ BigDecimal(${x.toString.toExpr}) }
249-
}
242+
def toExpr(x: BigDecimal): given QuoteContext => Expr[BigDecimal] =
243+
'{ BigDecimal(${x.toString.toExpr}) }
250244
}
251245

252246
}

0 commit comments

Comments
 (0)