Closed
Description
Minimized code
scala> f"${3.14}%.2f rounds to ${3}%d"
1 |f"${3.14}%.2f rounds to ${3}%d"
| ^
| type mismatch;
| found : Double
| required: Int
| This location contains code that was inlined from rs$line$2:1
scala> f"${java.lang.Boolean.valueOf(false)}%b" // any boxed value
1 |f"${java.lang.Boolean.valueOf(false)}%b"
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| type mismatch;
| found : Boolean
| required: Boolean
| This location contains code that was inlined from rs$line$17:1
scala> f"${BigInt(120)}%d"
1 |f"${BigInt(120)}%d"
| ^^^^^^^^^^^
| type mismatch;
| found : math.BigInt
| required: Int
| This location contains code that was inlined from rs$line$27:1
scala> f"${BigDecimal(3.4)}%e"
1 |f"${BigDecimal(3.4)}%e"
| ^^^^^^^^^^^^^^^
| type mismatch;
| found : math.BigDecimal
| required: Double
| This location contains code that was inlined from rs$line$30:1
scala> f"${3L}%e"
1 |f"${3L}%e"
| ^^
| type mismatch;
| found : Long
| required: Double
| This location contains code that was inlined from rs$line$31:1
Output
// as shown
Expectation
scala 2.13.3> f"${3.14}%.2f rounds to ${3}%d"
val res0: String = 3.14 rounds to 3
scala 2.13.3> f"${java.lang.Boolean.valueOf(false)}%b"
val res0: String = false
scala 2.13.3> f"${BigInt(120)}%d"
val res5: String = 120
scala 2.13.3> f"${BigDecimal(3.4)}%e"
val res8: String = 3.400000e+00
scala 2.13.3> f"${3L}%e"
val res11: String = 3.000000e+00