Skip to content

regression in f interpolator if interpolated value is an if/else #8512

Closed
@scabug

Description

@scabug
% scalac-hash 35209fc sandbox/test.scala
sandbox/test.scala:2: error: type mismatch;
 found   : Any
 required: Double
   f"${if (true) 2.5 else 2.5}%.2f"
       ^
one error found
% scalac-hash 35209fc~1 sandbox/test.scala

% cat sandbox/test.scala
object Test {
   f"${if (true) 2.5 else 2.5}%.2f"
}

Regressed in: scala/scala@35209fc

Might also be linked to the "boxity" of fast track macros.

I reckon changing:

def f(args: Any*): String = macro ???

to:

def f[A](args: A*): String = macro ???

Might alter behaviour. We experienced similar subtleties with quasiquotes.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions