Skip to content

Commit

Permalink
Reduce repro - more reduction
Browse files Browse the repository at this point in the history
  • Loading branch information
OndrejSpanel committed Apr 3, 2024
1 parent 9af39f5 commit 85e25db
Showing 1 changed file with 2 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,12 @@ object Surface:

import scala.quoted.*

inline def of[A]: Surface = ${ CompileTimeSurfaceFactory.surfaceOf[A] }
inline def methodsOf[A]: Seq[Surface] = ${ CompileTimeSurfaceFactory.methodsOf[A] }

class Surface(val docString: Option[String] = None)

private[surface] object CompileTimeSurfaceFactory:

def surfaceOf[A](using tpe: Type[A], quotes: Quotes): Expr[Surface] =
import quotes.*
import quotes.reflect.*

val f = new CompileTimeSurfaceFactory(using quotes)
f.surfaceOf(tpe)

def methodsOf[A](using tpe: Type[A], quotes: Quotes): Expr[Seq[Surface]] =
val f = new CompileTimeSurfaceFactory(using quotes)
f.methodsOf(tpe)
Expand Down Expand Up @@ -65,8 +57,8 @@ private[surface] class CompileTimeSurfaceFactory[Q <: Quotes](using quotes: Q):
seen += t -> observedSurfaceCount.getAndIncrement()
// For debugging
val surface = '{
val docString = None
new org.opengrabeso.airframe.surface.Surface(docString) // error
val none = None
new org.opengrabeso.airframe.surface.Surface(none) // error
// new org.opengrabeso.airframe.surface.Surface(None) // no error
}
// println(s"[${t.show}] ${surface.show}")
Expand Down

0 comments on commit 85e25db

Please sign in to comment.