-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support implicit arguments before extractor method #18671
Support implicit arguments before extractor method #18671
Conversation
@liufengyun @olhotak I have corrected the argument order in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you @EnzeXing !
case _ => List() | ||
|
||
val implicitValuesAfterScrtinee = evalArgs(implicits.map(Arg.apply), thisV, klass) | ||
val unapplyRes = call(receiver, funRef.symbol, implicitValuesBeforeScrutinee(fun) ++ (TraceValue(scrutinee, summon[Trace]) :: implicitValuesAfterScrtinee), funRef.prefix, superType = NoType, needResolve = true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: This line is a little long , maybe extract implicitValuesBeforeScrutinee(fun) ++ (TraceValue(scrutinee, summon[Trace]) :: implicitValuesAfterScrtinee)
to a local definition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise LGTM.
Currently the global object initialization checker crashes when encountering implicit arguments in extractor methods that are before scrutinee. This PR fixes the issue and adds tests with implicit arguments before scrutinee for
unapply
andunapplySeq
respectively.