Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 324297

Summary: [ConcreteSyntaxValidator] False Positive
Product: [Modeling] TMF Reporter: Moritz Eysholdt <moritz.eysholdt>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: christian.dietrich.opensource
Version: 1.0.0   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:
Bug Depends on: 333986, 333976    
Bug Blocks:    

Description Moritz Eysholdt CLA 2010-09-02 08:31:34 EDT
This error message is a false positive because the constraint is fulfilled if no value is set.

Feature LineSimple.x2 must be set. Constraint: ((x1 fn?)?|(x2 df?)) Quantities: x1:0, x2:0, fn:0, df:0
Comment 1 Moritz Eysholdt CLA 2011-01-11 10:03:41 EST
as of bug 333976, this use case will be handled by the sequencer and render this report obsolete.
Comment 2 Moritz Eysholdt CLA 2011-10-18 04:17:55 EDT
The new serializer still invokes the ConcreteSyntaxValdiator (1) because the new serializer still uses local backtracking and there are cases where the ConcreteSyntaxValidator's error messages are more precise then the serialier's.

1: org.eclipse.xtext.serializer.impl.Serializer.serialize(EObject, ITokenStream, SaveOptions)
Comment 3 Christian Dietrich CLA 2015-07-31 07:14:11 EDT
we are affected by this bug

Here is our pretty simple grammar

Model:
	things+=Thing*
	aktionen+=ThingPruefung*;
Thing:
	"thing" name=ID;
ThingPruefung:
	{ThingPruefung} "pruefe" "thing" meldung=[Thing] (("vorhanden" "=" ((vorhanden?="ja") | "nein")) |
	"=" thingText=TestdatenAusdruck);
TestdatenAusdruck:
	STRING;

And Test

@RunWith(XtextRunner)
@InjectWith(MyDslInjectorProvider)
class BugTest {

	@Inject extension ParseHelper<Model>

	@Test
	def void testIt() {
		val model = '''
			thing a
			thing b
			pruefe thing a vorhanden = nein
		'''.parse
		val r = model.eResource

		println(r.errors)
		val s = new ByteArrayOutputStream
		try {
			r.save(s, null)
			println(new String(s.toByteArray))
		} catch (Exception e) {
			e.printStackTrace
		}

	}

}

Workaround: Change the grammar to 3 ors
Comment 4 Moritz Eysholdt CLA 2016-07-21 04:52:09 EDT
won't fix because of https://github.com/eclipse/xtext-core/issues/48