-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Allow cold values in static methods using parametricity #14751
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
Allow cold values in static methods using parametricity #14751
Conversation
Closes scala#14460 Allow cold arguments to be passed if the parameter is `!Matchable` and the method is global static.
9a48ebe
to
d719739
Compare
val (argErrors, args) = evalArgs(argss.flatten, thisV, klass) | ||
// Allow cold args for static methods with non-matchable params | ||
val methodType = ref.symbol.info.stripPoly | ||
val allMatchable = methodType.paramInfoss.flatten.forall { (info) => info <:< defn.MatchableType } |
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.
I think we wanted to do the check per-argument rather than for all the arguments. That is, in def call
, we have
def checkArgs = args.flatMap(_.promote)
There we want to promote only those args that correspond to non-matchable params. Even if some params are matchable, the call is still fine as long as we can promote the args that correspond to those params.
@@ -1,35 +0,0 @@ | |||
package example |
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.
Should we move these tests to pos instead of deleting them entirely?
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.
Definitely
In When checking if |
In |
Closes #14460, #14751 Do not ensure that elements in a SeqLiteral are Hot. Review by @liufengyun
Closes #14460, #14751 Do not ensure that elements in a SeqLiteral are Hot. Review by @liufengyun
Closes #14460, #14751 Do not ensure that elements in a SeqLiteral are Hot. Review by @liufengyun
Closes #14460, #14751 Do not ensure that elements in a SeqLiteral are Hot. Review by @liufengyun
Closes #14460, #14751 Do not ensure that elements in a SeqLiteral are Hot. Review by @liufengyun
Closes #14460, #14751 Do not ensure that elements in a SeqLiteral are Hot. Review by @liufengyun
Closes #14460, #14751 Do not ensure that elements in a SeqLiteral are Hot. Review by @liufengyun
Closes #14460, #14751 Do not ensure that elements in a SeqLiteral are Hot. Review by @liufengyun
Closing in favour of #14916. |
Closes #14460
Allow cold arguments to be passed if the parameter is
!Matchable
and the method is global static.Review by @liufengyun