-
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 #15363: Improve error messages for leaking of this #15364
Conversation
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.
Overall a big improvement.
warm.callConstructor(ctor, argInfos2) | ||
} | ||
if errors.nonEmpty then | ||
val error = UnsafeLeaking(trace.toVector, errors.head) |
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.
Is it guaranteed that all errors
are uses of one of the passed non-hot values? Could there be an error
in the called constructor that is unrelated to the passed arguments?
val multiple = argsIndices.size > 1 | ||
val part1 = | ||
argsIndices.zipWithIndex.foldLeft("") { case (acc, (pos, i)) => | ||
val text1 = if pos == 0 then "the outer" else "arg " + pos.toString |
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 would be good to print the class name of the outer in the error message.
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 pending a fix for #15374.
We do not need it any more because we store secondary constructor parameter values on `this`.
Fix #15363: Improve error messages for leaking of this
For the code above, we now report the following error: