-
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
Don't lift try-catch statements that are already in local functions #13944
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.
The change looks correct to me. Can you find out more what happened for the CB timeout?
5a3aed1
to
e707bb0
Compare
That looks likely, yes. Who worked on that macro? Maybe we can ask them for help? And how big is the damage? Can we disable the tests that fail individually? In any case I think the change in this PR is important and should get in. |
Looks like the macro implementation is the same as for Scala 2 and just uses |
Does Scala 2 lift to class level as well, or do they stop at the enclosing method? Also, it would be good to find out what method fails in ScalaTest. Maybe we overlooked something and certain kinds of DefDefs should not supporess try lifting. |
Scala 2 seems to behave the same way here i.e. it doesn't lift in this case. I have an idea about how to fix it. It might be the case that entering a EDIT: it works as intended, I'll try minimizing the scalatest issue then. |
The problematic test case is RefSpecSpec / "should generate NotAllowedException wrapping a non-fatal RuntimeException is thrown inside scope". The problem seems to be that the position is reported as if it was thrown in one scope higher than it's supposed to (lineNo: 2485 != 2488). This is most likely because one less Decreasing the stack depth for Should I disable this test for now? |
Then it looks like this was a fix to port scalatest to 3 that should be reverted? |
Not really, this default behavior was left since mid-2016 and was intended for Scala 2.11. I think that it just happened to work for dotty. This means that adding a special case for Scala 3 in RefSpecLike#ensureScopesAndTestsRegistered would be required, but that's still a 2 line change. |
Yes, let's patch it as you suggest |
2742f3c
to
a5b9332
Compare
a5b9332
to
abd4998
Compare
Fixed scalatest's tests. CB should work properly now. |
closes #13941
The problem in #13941 is that before tail recursion can be expanded the
try
is lifted to a local function, which in turn moves direct recursive calls.