When calling a scala function with compile-time macro, how to failover smoothly when it causes compilation errors?
问题 Assuming that I intend to use the singleton/literal type feature in a scala program, this feature is provided in shapeless library in scala 2.12 (scala 2.13 supports native literal type but let's use shapeless as an example) In shapeless, literal type is represented as a path-dependent inner type of Witness object, which can be implicitly converted from a scala literal/const: import com.tribbloids.spike.BaseSpec import shapeless.Witness import scala.util.Random val w: Witness.Lt[Int] = 3 val