I have a list of characters representing packages, objects, and classes, and you want to import them in a macro context.
For packages and objects, this will mean importing wildcards, and for classes, this will mean "standard" import.
Given a List[Symbol] consisting of some.package , some.Class and some.Object , how should I import them correctly and how can I decide whether to use a "standard" or wildcard?
My current approach is this:
def importPackageOrModuleOrClass(sym: Symbol): Import = if (sym.isPackage || sym.isModule) // eg import scala._, scala.Predef gen.mkWildcardImport(sym) else // eg import java.lang.String gen.mkImport(sym.enclosingPackage, sym.name, sym.name) // <--- ?????
The package / module is imported, but the class is not imported, although it looks correct.
soc
source share