Completion at this position requires that type p be known. As long as the code is syntactically correct, p is output to Student , as pointed out by @Tunaki. However, as soon as you enter '.' the code is too broken, the text does not appear on p . (Side note: text hover and completion are computed by various compiler calls with different contextual information, so they will not always see exactly the same information).
While for a human reader, the body of a lambda may seem inconsequential for type p inference, the conclusion cannot continue without knowing, for example, whether the lambda is void compatible and / or value compatible. p. is not an expression that could help answer this question.
Having the right type of goal is an important contribution to type inference, so in general terms, you shouldn't be surprised that adding LHS improves the situation. However, I have no ready-made explanation of why this is what affects code completion in this case.
All this should only illustrate (at a very high level) why Eclipse behaves the way it does. Improvement is always possible, even if it is associated with extreme complexity, since type inference by incomplete code essentially makes - we request a higher-order conclusion: a conclusion about which of several possible conclusions can give the most likely results.
The good thing about an open source tool: you can help improve it constantly, with well-written bug reports or even code contributions. After seeing the error reports referenced by @ the8472 without an answer, I simply postponed the comment to return them to the radar. Users should not hesitate to send a command to error messages at appropriate time intervals, community requirements are related to setting priorities. Code completion inside lambda bodies is a hot topic on the team's agenda.
Stephan herrmann
source share