MacroSelectors

dev.constructive.eo.generics.MacroSelectors

Quote-context selector-AST helpers shared between LensMacro and the JsonPrismMacro / AvroPrismMacro cursor macros. All parse single-field selector lambdas (_.fieldName) and validate non-duplicates; the per-macro divergence is just the error-message tag.

Attributes

Source
MacroSelectors.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def extractFieldName(using Quotes)(t: x$1.reflect.Term): Option[String]

Loose variant of extractSingleFieldName — strips Inlined / Typed wrappers around the lambda AND around its Select body, and does NOT require the Select receiver to be the bare lambda parameter. Used by the cursor macros' .field(_.x) sugar, whose selectors are always single-hop but may arrive wrapped. Kept distinct from extractSingleFieldName (which rejects nested chains by construction) so callers that need the strict form still have it.

Loose variant of extractSingleFieldName — strips Inlined / Typed wrappers around the lambda AND around its Select body, and does NOT require the Select receiver to be the bare lambda parameter. Used by the cursor macros' .field(_.x) sugar, whose selectors are always single-hop but may arrive wrapped. Kept distinct from extractSingleFieldName (which rejects nested chains by construction) so callers that need the strict form still have it.

Attributes

Source
MacroSelectors.scala
def extractSingleFieldName(using Quotes)(t: x$1.reflect.Term): Option[String]

Strips Inlined / Typed wrappers and peeks inside the lambda body for a single Select whose receiver is exactly the lambda parameter (an Ident). Receiver-is-Ident is load-bearing — nested paths like _.a.b parse as Select(Select(Ident(_), "a"), "b") and fall through to None so each macro can produce its own "nested paths" message.

Strips Inlined / Typed wrappers and peeks inside the lambda body for a single Select whose receiver is exactly the lambda parameter (an Ident). Receiver-is-Ident is load-bearing — nested paths like _.a.b parse as Select(Select(Ident(_), "a"), "b") and fall through to None so each macro can produce its own "nested paths" message.

Attributes

Source
MacroSelectors.scala
def iterableElementType[A](who: String)(using evidence$1: Type[A], q: Quotes): q.reflect.TypeRepr

The single element type of a Scala collection type A (via its Iterable base type), or abort with a who-tagged error. Shared by the cursor macros' .at / .each sugar.

The single element type of a Scala collection type A (via its Iterable base type), or abort with a who-tagged error. Shared by the cursor macros' .at / .each sugar.

Attributes

Source
MacroSelectors.scala
def reportDuplicateSelectors(using Quotes)(who: String, resolved: List[(Int, String)]): Unit

Reject duplicate field names; aborts on the first duplicate. The who tag prefixes the message.

Reject duplicate field names; aborts on the first duplicate. The who tag prefixes the message.

Attributes

Source
MacroSelectors.scala