Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 370426 - Strange single line comment behavior - Smoke test detected
Summary: Strange single line comment behavior - Smoke test detected
Status: CLOSED FIXED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 2.3.0   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: RC2   Edit
Assignee: Jan Koehnlein CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-02 07:36 EST by Dennis Huebner CLA
Modified: 2017-10-31 11:26 EDT (History)
5 users (show)

See Also:
sven.efftinge: juno+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dennis Huebner CLA 2012-02-02 07:36:17 EST
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
	}
	
}
Comment 1 Moritz Eysholdt CLA 2012-02-02 07:51:32 EST
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;
-----
Comment 2 Sven Efftinge CLA 2012-02-03 08:23:28 EST
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.
Comment 3 Jan Koehnlein CLA 2012-05-25 09:43:04 EDT
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.
Comment 4 Jan Koehnlein CLA 2012-05-29 08:27:16 EDT
Fix and several tests pushed to MASTER
Comment 5 Eclipse Webmaster CLA 2017-10-31 11:26:21 EDT
Requested via bug 522520.

-M.