-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix #2973: Check variances of class parents #4057
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
Conversation
All failures (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.
Guess I learned a bit about why this change is annoyingly hard. Trying to comment out some of the calls involved in the spurious error also removes the correct error from the new test.
@@ -132,14 +132,16 @@ class VarianceChecker()(implicit ctx: Context) { | |||
ctx.debuglog(s"Skipping variance check of ${sym.showDcl}") | |||
case tree: TypeDef => | |||
checkVariance(sym, tree.pos) | |||
tree.rhs match { | |||
case rhs: Template => traverseChildren(rhs) |
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.
Here traverseChildren
sees parents
(in the form of a constructor call), but this Traverser
ignores terms and only looks at definitions...
//case tp: ClassInfo => | ||
// ??? not clear what to do here yet. presumably, it's all checked at local typedefs | ||
case tp: ClassInfo => | ||
foldOver(status, tp.classParents) |
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.
This visit sees the parent classes, but stripped of any annotations!
@@ -132,14 +132,16 @@ class VarianceChecker()(implicit ctx: Context) { | |||
ctx.debuglog(s"Skipping variance check of ${sym.showDcl}") | |||
case tree: TypeDef => | |||
checkVariance(sym, tree.pos) |
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.
On tests/pos/Iterable.scala
we get an error inside this call (going through tp.classParents
), because sym
contains the parens but without annotations!
Closing since this is likely noise — I've a first guess why Martin got stuck on it, and it's not an issue for a beginner like me yet. |
I'm opening this PR to recover this "lost" fix to a soundness issue (#2973, #3856). Let's see its status.