-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix #2156 #2158
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 #2156 #2158
Conversation
ThisType doesn't have a termSymbol. And the check is actually too strong, and not needed.
Otherwise checks are done also on type projections. Same pitfall as https://issues.scala-lang.org/browse/SI-7214
Does our CI work? |
ping @felixmulder |
deadlock in You can get the old behaviour back by doing:
EDIT: this will ignore the new test framework tests. |
CI should be fine, at least the first 4 tests - they are unchanged. The two last tests are new. Also, regarding your error - the stacktrace says that it it's in:
|
@felixmulder, I cant reproduce the error locally and it fails in tests which don't have pattern matching at all, e.g. |
Or, |
But it's failing in the bootstrapped version of Dotty. I'll try to reproduce, 2 secs |
@felixmulder, I've found the issue. No need for you to investigate anymore. |
Bringing back #2156 into discussion. |
Alright, then I'm going to bed 👍 |
case x: ClassRep => x | ||
case x => throw new FatalError("Unexpected ClassRep '%s' found searching for name '%s'".format(x, name)) | ||
case x: AnyClassRep => x | ||
case x => throw new FatalError("Unexpected ClassRep '%s' found searching for name '%s'".format(x, name)) |
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.
rep
is an AnyClassRep
so this case will never happen. I believe the original code intended to check the outer pointer, though I have no idea why, here's the commit that introduced the check: scala/scala@a1a6ab9
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.
Code compiled by scalac
doesn't contain the check:
option = rep.map((Function1)new Serializable(this, name){
public static final long serialVersionUID = 0;
private final String name$2;
public final ClassRep apply(ClassRep x0$1) {
ClassRep classRep = x0$1;
if (classRep instanceof ClassRep) {
ClassRep classRep2;
ClassRep classRep3 = classRep2 = classRep;
return classRep3;
}
throw new dotty.tools.FatalError(new scala.collection.immutable.StringOps(Predef..MODULE$.augmentString("Unexpected ClassRep '%s' found searching for name '%s'")).format((Seq)Predef..MODULE$.genericWrapArray((Object)new Object[]{classRep, this.name$2})));
}
public final /* bridge */ /* synthetic */ Object apply(Object v1) {
return this.apply((ClassRep)v1);
}
});
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'm not saying that the check was actually performed, I'm saying that the code was written assuming that the check would be performed, which apparently it wasn't.
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.
See comment on the ticket #2156. I think it's a bug in scalac. By guess is that it checks whether the test would be redundant (which is reasonable) but gets that logic messed up. For instance, here is a situation where the test should be omitted:
class Outer {
trait Base
class Inner extends Base
val x: Base = ???
x match {
case x: Inner => ???
}
}
scala#2158 has uncovered flaws in the classfile parser. Matches that used to always miss led to code that made no sense. The function naming was terrible too, that's why nobody understood what was going on. `findSourceFile` to find the class file, seriously?
Otherwise LGTM |
ExplicitOuter.needsOuterIfReferenced(tref.symbol.asClass) | ||
expectedTp.dealias match { | ||
case tref @ TypeRef(pre: SingletonType, name) => | ||
val s = tref |
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.
Why the added definition of s
. Just use tref
!
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.
variables defined in pattern matches are rarely debuggable when compiled by scalac.
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.
OK, if you prefer.
New testing infrastructure seems to deadlock on my machine so I can't test stuff.
Using CI instead.