Closed DavidGregory084 closed 9 years ago
This seems to be caused by the structural type in the return type of the macro:
def extract[A]: Dynamic { def applyDynamic(method: String)(args: Any*): Extractor[Row, A] with SimpleExtractor[Row, A]; def applyDynamicNamed(method: String)(namedArgs: (String, Any)*): Extractor[Row, A] with SimpleExtractor[Row, A] } =
macro CaseClassExtractorMacro.apply[Row, A]
once it's removed...
def extract[A]: Dynamic = macro CaseClassExtractorMacro.apply[Row, A]
we get this slightly ugly compile-time error instead:
[error] /home/david/IdeaProjects/sqlest/extractors/src/test/scala/sqlest/extractor/CaseClassExtractorMacroSpec.scala:247: value applyDynamic is not a member of Dynamic
[error] error after rewriting to CaseClassExtractorMacroSpec.this.extract[A].<applyDynamic: error>("apply")
[error] possible cause: maybe a wrong Dynamic method signature?
[error] two = extract(twoExtractor)
[error] ^
Nice!
Illustrated by 3f65f65711524a4f40b3f6394b79709fc68c4ea3:
This should really fail to compile - instead we get a runtime error when the extractor is used: