Skip to content

Commit

Permalink
Fix package private parameters and members (fixes wvlet#3416)
Browse files Browse the repository at this point in the history
  • Loading branch information
OndrejSpanel committed Feb 28, 2024
1 parent 3cfaae0 commit 7f3498a
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -598,11 +598,12 @@ private[surface] class CompileTimeSurfaceFactory[Q <: Quotes](using quotes: Q):
// Generate a field accessor { (x:Any) => x.asInstanceOf[A].(field name) }
val paramIsAccessible =
t.typeSymbol.fieldMember(paramName) match
case nt if nt == Symbol.noSymbol => false
case m if m.flags.is(Flags.Private) => false
case m if m.flags.is(Flags.Protected) => false
case m if m.flags.is(Flags.Artifact) => false
case _ => true
case nt if nt == Symbol.noSymbol => false
case m if m.flags.is(Flags.Private) => false
case m if m.flags.is(Flags.Protected) => false
case m if m.flags.is(Flags.Artifact) => false
case m if m.privateWithin.nonEmpty => false
case _ => true
// println(s"${paramName} ${paramIsAccessible}")

val accessor: Expr[Option[Any => Any]] = if method.isClassConstructor && paramIsAccessible then
Expand Down Expand Up @@ -835,6 +836,7 @@ private[surface] class CompileTimeSurfaceFactory[Q <: Quotes](using quotes: Q):
nonObject(x.owner) &&
x.isDefDef &&
// x.isPublic &&
x.privateWithin.isEmpty &&
!x.flags.is(Flags.Private) &&
!x.flags.is(Flags.Protected) &&
!x.flags.is(Flags.PrivateLocal) &&
Expand Down

0 comments on commit 7f3498a

Please sign in to comment.