-
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
Fix type test for trait parameter arguments #12041
Conversation
val params = parentCls.asClass.paramGetters | ||
val args = termArgss(app).flatten | ||
for (param, arg) <- params.lazyZip(args) do | ||
if !param.is(Private) then // its type can be narrowed through intersection -> a check is needed |
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.
It is a good idea to check this one here, I didn't do that in #11059.
then | ||
report.error(IllegalParameterInit(arg.tpe, paramType, param, cls), arg.srcPos) | ||
|
||
for case app: Apply <- parentTrees do checkParamInits(app) |
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.
yes, it's also a better idea to walk through the constructors.
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 much more thought out than my #11059
Fixes #11993