Skip to content

Commit a7a5fa4

Browse files
Fix #120: permit empty ImportElements
They are already supported by the JVM backend in some situations, and eclipse-archived/ceylon#6501 might allow them altogether (turn the error into a warning). Suggested by @jvasileff.
1 parent b8f3959 commit a7a5fa4

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

source/ceylon/ast/core/ImportElements.ceylon

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
where the last element may optionally be a wildcard instead,
33
surrounded by braces.
44
5-
Import elements may not be empty.
6-
75
(`ceylon.ast` `ImportElements` are slightly different from the
86
specification’s `ImportElements`; in the specification,
97
the surrounding braces are always part of the “parent” node
@@ -22,9 +20,7 @@ shared class ImportElements(elements = [], wildcard = null)
2220
"The import wildcard, if present."
2321
shared ImportWildcard? wildcard;
2422

25-
"Import elements may not be empty"
26-
assert (nonempty children_ = concatenate(elements, emptyOrSingleton(wildcard)));
27-
shared actual [<ImportElement|ImportWildcard>+] children = children_;
23+
shared actual [<ImportElement|ImportWildcard>*] children = concatenate(elements, emptyOrSingleton(wildcard));
2824

2925
shared actual Result transform<out Result>(Transformer<Result> transformer)
3026
=> transformer.transformImportElements(this);

0 commit comments

Comments
 (0)