mirror of
https://github.com/sigmasternchen/xtext-core
synced 2025-03-16 08:48:55 +00:00
[bug 479161] Invalidate boolean assignments of fragments
Change-Id: I58de6791ef95e907528bede10124a788ee6b13b8 Signed-off-by: akosyakov <anton.kosyakov@typefox.io>
This commit is contained in:
parent
c4cb85e533
commit
21096429a2
2 changed files with 27 additions and 0 deletions
|
@ -78,6 +78,7 @@ public class Xtext2EcoreInterpretationContext {
|
|||
EClassifierInfo featureTypeInfo;
|
||||
|
||||
if (GrammarUtil.isBooleanAssignment(assignment)) {
|
||||
checkNoFragmentRuleCall(assignment.getTerminal());
|
||||
EDataType eBoolean = GrammarUtil.findEBoolean(GrammarUtil.getGrammar(assignment));
|
||||
featureTypeInfo = getEClassifierInfoOrThrowException(eBoolean, assignment);
|
||||
isMultivalue = false;
|
||||
|
|
|
@ -377,6 +377,32 @@ class Xtext2EcoreTransformerTest extends AbstractXtextTests {
|
|||
var EPackage result = getEPackageFromGrammar(grammar, 1)
|
||||
assertEquals(2, result.EClassifiers.size)
|
||||
}
|
||||
|
||||
@Test def void testParserRuleFragment_10() throws Exception {
|
||||
val grammar = '''
|
||||
grammar test with org.eclipse.xtext.common.Terminals
|
||||
generate test 'http://test'
|
||||
RuleA: feature+=Fragment;
|
||||
fragment Fragment returns Fragment: name=ID;
|
||||
'''
|
||||
errorAcceptorMock.acceptError(TransformationErrorCode.InvalidFragmentCall,
|
||||
TestErrorAcceptor.ANY_STRING, TestErrorAcceptor.ANY_EOBJECT)
|
||||
var EPackage result = getEPackageFromGrammar(grammar, 1)
|
||||
assertEquals(2, result.EClassifiers.size)
|
||||
}
|
||||
|
||||
@Test def void testParserRuleFragment_11() throws Exception {
|
||||
val grammar = '''
|
||||
grammar test with org.eclipse.xtext.common.Terminals
|
||||
generate test 'http://test'
|
||||
RuleA: feature?=Fragment;
|
||||
fragment Fragment returns Fragment: name=ID;
|
||||
'''
|
||||
errorAcceptorMock.acceptError(TransformationErrorCode.InvalidFragmentCall,
|
||||
TestErrorAcceptor.ANY_STRING, TestErrorAcceptor.ANY_EOBJECT)
|
||||
var EPackage result = getEPackageFromGrammar(grammar, 1)
|
||||
assertEquals(2, result.EClassifiers.size)
|
||||
}
|
||||
|
||||
@Test def void testTypesOfImplicitSuperGrammar() throws Exception {
|
||||
val xtextGrammar = '''
|
||||
|
|
Loading…
Reference in a new issue