Skip to content

Commit

Permalink
Fixed #134 [AQL] Empty collection defined in extension produce a warn…
Browse files Browse the repository at this point in the history
…ing.
  • Loading branch information
ylussaud committed Feb 14, 2024
1 parent d4a949a commit 237b2bc
Show file tree
Hide file tree
Showing 7 changed files with 185 additions and 471 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2015, 2023 Obeo.
* Copyright (c) 2015, 2024 Obeo.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
Expand Down Expand Up @@ -1014,8 +1014,8 @@ public Set<IType> caseSetInExtensionLiteral(SetInExtensionLiteral object) {
}
}
} else {
possibleTypes.add(new SetType(services.getQueryEnvironment(), services.nothing(
"Empty OrderedSet defined in extension")));
possibleTypes.add(new SetType(services.getQueryEnvironment(), new ClassType(services
.getQueryEnvironment(), null)));
}

return checkWarningsAndErrors(object, possibleTypes);
Expand All @@ -1032,8 +1032,8 @@ public Set<IType> caseSequenceInExtensionLiteral(SequenceInExtensionLiteral obje
}
}
} else {
possibleTypes.add(new SequenceType(services.getQueryEnvironment(), services.nothing(
"Empty Sequence defined in extension")));
possibleTypes.add(new SequenceType(services.getQueryEnvironment(), new ClassType(services
.getQueryEnvironment(), null)));
}

return checkWarningsAndErrors(object, possibleTypes);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2015, 2023 Obeo.
* Copyright (c) 2015, 2024 Obeo.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
Expand Down Expand Up @@ -915,8 +915,8 @@ public void setInExtensionLiteralEmpty() {
final Iterator<IType> it = possibleTypes.iterator();
IType possibleType = it.next();
assertTrue(possibleType instanceof SetType);
assertNothingType("Empty OrderedSet defined in extension", ((SetType)possibleType)
.getCollectionType());
assertTrue(((SetType)possibleType).getCollectionType() instanceof ClassType);
assertEquals(null, ((ClassType)((SetType)possibleType).getCollectionType()).getType());

assertEquals(0, validationResult.getMessages().size());

Expand Down Expand Up @@ -965,8 +965,8 @@ public void sequenceInExtensionLiteralEmpty() {
final Iterator<IType> it = possibleTypes.iterator();
IType possibleType = it.next();
assertTrue(possibleType instanceof SequenceType);
assertNothingType("Empty Sequence defined in extension", ((SequenceType)possibleType)
.getCollectionType());
assertTrue(((SequenceType)possibleType).getCollectionType() instanceof ClassType);
assertEquals(null, ((ClassType)((SequenceType)possibleType).getCollectionType()).getType());

assertEquals(0, validationResult.getMessages().size());

Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,8 +0,0 @@
//@moduleElements.1/@body/@statements.0/@body/@statements.0/@body/@statements.0/@expression/@aql
Add parameter myVariable
Replace file:/home/development/git/acceleo/tests/org.eclipse.acceleo.aql.tests/resources/evaluation/forStatement/forStatementEmpty/forStatementEmpty.mtl [135, 3, 53, 135, 3, 53] , myVariable: String
Surround with Let: myVariable
Replace file:/home/development/git/acceleo/tests/org.eclipse.acceleo.aql.tests/resources/evaluation/forStatement/forStatementEmpty/forStatementEmpty.mtl [227, 6, 6, 242, 7, 0] [let myVariable : String = '']
[myVariable/]

[/let]
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
ERROR Empty Sequence defined in extension - 228 238
Original file line number Diff line number Diff line change
@@ -1,8 +0,0 @@
//@moduleElements.1/@body/@statements.0/@body/@statements.0/@body/@statements.0/@expression/@aql
Add parameter myVariable
Replace file:/home/development/git/acceleo/tests/org.eclipse.acceleo.aql.tests/resources/evaluation/forStatement/forStatementEmpty/forStatementEmpty.mtl [132, 3, 53, 132, 3, 53] , myVariable: String
Surround with Let: myVariable
Replace file:/home/development/git/acceleo/tests/org.eclipse.acceleo.aql.tests/resources/evaluation/forStatement/forStatementEmpty/forStatementEmpty.mtl [221, 6, 6, 235, 7, 0] [let myVariable : String = '']
[myVariable/]

[/let]
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
ERROR Empty Sequence defined in extension - 222 232

0 comments on commit 237b2bc

Please sign in to comment.