我试图从Scala内部的quasiquote调用一个Shapelessmacros,我没有得到我想要的。 我的macros不会返回任何错误,但不会将Witness(fieldName)扩展为Witness.Lt[String] val implicits = schema.fields.map { field => val fieldName:String = field.name val fieldType = TypeName(field.valueType.fullName) val in = TermName("implicitField"+fieldName) val tn = TermName(fieldName) val cc = TermName("cc") q"""implicit val $in = Field.apply[$className,$fieldType](Witness($fieldName), ($cc: $className) => $cc.$tn)""" } 这是我的Field定义: sealed abstract class Field[CC, FieldName] { val fieldName: String type fieldType // How to extract […]