-
Notifications
You must be signed in to change notification settings - Fork 142
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
Suspect code in org.eclipse.jdt.internal.compiler.ast.ConditionalExpression.resolveType(BlockScope)
#3209
Comments
Coincidentally, MessageSend seems to have had similar re-entry issues - see #520 (comment) In general resetting that constant status is a smelly implementation and is asking for trouble. |
@srikanth-sankaran do you have a specific scenario in mind, where this code might cause trouble, or is this just a matter of some principle? If principle: which is it?
In that case, the problem was not in MessageSend, but in SwitchExpression, which shouldn't have triggered re-entrance in case of hard failure of the first invocation. I.e., SwitchExpression, which itself can be poly must not cause undue repeated attempts at its children. Is something similar (w/ nested polies) happening with ConditionalExpression as well? |
No, I don't readily know where this may create trouble - I haven't studied it in detail. This ticket was just to schedule such a study in future. I think it is violating the design intent. As I recall, an A physical instance of a poly expression ASTNode will be resolved EXACTLY ONCE if in the context in which it features, the target type is available right upfront. A physical instance of a poly expression ASTNode will be resolved EXACTLY TWICE if in the context in which it features, the target type is NOT available upfront: Once initially without a target type - the expression will do some type specific initial work and return a Historically, we have distinguished these two invocations by using the pattern:
In this scheme, any resetting of the Now this is all from my memory from a decade ago - I haven't actually had to revisit any of these in the past 18 months. Let us see what fails
Like I said, I don't know of a real problem here - When I was debugging, I saw this reset and alarm bells went off in my head. While waiting for github CI run to finish, I am running |
Not a handful - just |
CI run finished with just the same one failure - need to see what about that test causes resolves > 2 |
I was about to warn, that inference may invoke resolving of lambdas / reference expressions at unexpected times, but on second look those go through |
Indeed, I spot the misplaced code - will propose a patch |
Likewise overload resolution may cause a re-resolution indirectly via calls to |
assignment context * Backs out the fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=566332 and refixes it alternately * Backs out the fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=569498 which is not relevant as the code that causes the problem goes away * Fixes eclipse-jdt#3209
PR #3211 under test. Problem is that while a conditional operator in an assignment context is indeed a poly expression, since the target type is known upfront we don't need a two phase resolution approach and won't arrange for a two phase resolution. So nothing can be deferred to the second (non-existent) phase and constant folding was. |
I have studied it in detail. The way the code was, it wouldn't have cause any incorrectness. So the overall problem with it was it wasn't aligned with the standard protocol for IPolyExpressions (which I doubt is documented actually or at least prominently) |
…ssignment context (eclipse-jdt#3211) * Backs out the fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=566332 and refixes it alternately * Backs out the fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=569498 which is not relevant as the code that causes the problem goes away * Fixes eclipse-jdt#3209
The lines below look suspect and need to be studied in detail. This was introduced for https://bugs.eclipse.org/bugs/show_bug.cgi?id=569498 which addresses a regression introduced by https://bugs.eclipse.org/bugs/show_bug.cgi?id=566332
It is likely the fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=566332 violates Poly Expression resolution design and the fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=569498 somehow covers up for it.
The text was updated successfully, but these errors were encountered: