w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Type mismatch in scala quasiquote of macro definition: "type mismatch; found : field.NameType required: c.universe.TermName"

The type of fields is List[Symbol], which means that the type of names of those fields is inconclusive (unknown whether it's a TermName or TypeName). This means that you can't insert such names essentially anywhere in a quasiquote.

A simple fix would be to do val name = field.name.toTermName, explicitly telling the compiler that it's looking at a term name, so that quasiquote knows how to process it.

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.