Community
Participate
Working Groups
Xtend file to reproduce with: package org.eclipse.xtend.core.tests.smoke class Case_3 { def test() { var x=1 // my test1 } } delete one of the '/' and add it again. Model is broken. Note: only "var x=1 // my" and not the whole "var x=1 // my test1" is reparsed But... if I change test1 to a valid xtend expression e.g. test all works fine: package org.eclipse.xtend.core.tests.smoke class Case_3 { def test() { var x=1 // my test } }
I can reproduce the same error with the Xtext Arithmetic Example: Consider this editor contents: ---- module foo ( 34 // 65 + house ) + 5; ----- If you remove the second "/" the document remains syntactically valid, because the remaining "/" is perceived as devision operator. The cross ref "house", however, can not be resolved and therefore an error marker is shown. If you then re-insert the "/", the error marker on "house" remains, even though "house" is now a part of the comment again. Some debugging has shown that the error lies in partial parsing, which only re-parses the region "34 / 65". The region, however, needs to be least "34 / 65 + house". I assume that even though the following example does not show error markers after re-parsing, the node model and semantic model will be in an invalid state after re-parsing. ---- module foo ( 34 // 65 + 12 ) + 5; -----
See also org.eclipse.xtend.core.tests.smoke.SmokeTest.testResourceUpdateSkipCharacterInBetween() which fails because of this and which I have set to @Ignore as long as this has not been fixed.
The problem is that partial parsing does not take the lexer into account. Inserting a "/" again makes leads to a different set of tokens (a larger comment token). PP should lex the reparse region + the next token and adapt the region to be reparsed accordingly.
Fix and several tests pushed to MASTER
Requested via bug 522520. -M.