Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -331,10 +331,12 @@ private boolean validateModel(String name, InputStream inputStream, List<String>

// Check for validation errors, but log them only
try {
String modelType = resource.getURI().fileExtension();
final org.eclipse.emf.common.util.Diagnostic diagnostic = safeEmf
.call(() -> Diagnostician.INSTANCE.validate(resource.getContents().getFirst()));
for (org.eclipse.emf.common.util.Diagnostic d : diagnostic.getChildren()) {
if (d.getSeverity() == org.eclipse.emf.common.util.Diagnostic.ERROR) {
if (d.getSeverity() == org.eclipse.emf.common.util.Diagnostic.ERROR
&& !"rules".equalsIgnoreCase(modelType) && !"script".equalsIgnoreCase(modelType)) {
errors.add(d.getMessage());
} else {
warnings.add(d.getMessage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,4 +268,26 @@ public void testVars() {
Object x = context.getValue(QualifiedName.create("x"));
assertThat(x, is(15));
}

@Test
public void testRuleWithUntypedLambdaArgsDoesNotFailToLoad() {
Collection<Rule> rules = dslRuleProvider.getAll();
assertThat(rules.size(), is(0));

String model = """
var lambdaWithUntypedArgs = [ foo | foo ]
rule "RuleWithUntypedLambdaArgs"
when
System started
then
logInfo('Test', 'Test')
end
""";

modelRepository.addOrRefreshModel(TESTMODEL_NAME,
new ByteArrayInputStream(model.getBytes(StandardCharsets.UTF_8)));
Collection<Rule> actualRules = dslRuleProvider.getAll();

assertThat(actualRules.size(), is(1));
}
}