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 a0ce8b7 commit 9a97103
Showing 1 changed file with 3 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import scala.collection.immutable.ListMap
import scala.quoted.*

trait Surface extends Serializable:
def rawType: Class[?]
def typeArgs: Seq[Surface]

def docString: Option[String]
Expand All @@ -33,7 +32,6 @@ object Surface:
inline def methodsOf[A]: Seq[Surface] = ${ CompileTimeSurfaceFactory.methodsOf[A] }

class GenericSurface(
override val rawType: Class[_],
override val typeArgs: Seq[Surface] = Seq.empty,
override val docString: Option[String] = None
) extends Surface
Expand Down Expand Up @@ -77,20 +75,15 @@ private[surface] class CompileTimeSurfaceFactory[Q <: Quotes](using quotes: Q):
seen += t -> observedSurfaceCount.getAndIncrement()
// For debugging
val surface = '{
new org.opengrabeso.airframe.surface.GenericSurface(
${ clsOf(t) },
// typeArgs = Seq.empty,
docString = None
)
val docString = None
new org.opengrabeso.airframe.surface.GenericSurface(Seq.empty, docString) // error
// new org.opengrabeso.airframe.surface.GenericSurface(Seq.empty, None) // no error
}
// println(s"[${t.show}] ${surface.show}")

memo += (t -> surface)
surface

private def clsOf(t: TypeRepr): Expr[Class[_]] =
Literal(ClassOfConstant(t)).asExpr.asInstanceOf[Expr[Class[_]]]

private def methodsOf(t: TypeRepr, uniqueId: String, inherited: Boolean): Expr[Seq[Surface]] =
// Run just for collecting known surfaces. seen variable will be updated
methodsOfInternal(t, inherited)
Expand Down

0 comments on commit 9a97103

Please sign in to comment.