Skip to content

Commit 57d023c

Browse files
committed
Update spec for multiple selective imports
1 parent b378af5 commit 57d023c

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

spec/module.dd

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -178,19 +178,15 @@ $(GNAME ImportDeclaration):
178178

179179
$(GNAME ImportList):
180180
$(I Import)
181-
$(I ImportBindings)
182181
$(I Import) $(D ,) $(I ImportList)
183182

184183
$(GNAME Import):
185184
$(I ModuleFullyQualifiedName)
186185
$(I ModuleAliasIdentifier) $(D =) $(I ModuleFullyQualifiedName)
186+
$(I ImportBindings)
187187

188188
$(GNAME ImportBindings):
189-
$(I Import) $(D :) $(I ImportBindList)
190-
191-
$(GNAME ImportBindList):
192-
$(I ImportBind)
193-
$(I ImportBind) $(D ,) $(I ImportBindList)
189+
$(I Import) $(D :) $(I ImportBind)
194190

195191
$(GNAME ImportBind):
196192
$(I Identifier)
@@ -407,6 +403,22 @@ void main()
407403

408404
$(P $(D static) cannot be used with selective imports.)
409405

406+
$(P Selective imports can be imported from multiple modules if
407+
those import are also selective or when the imported module has a qualified name:)
408+
409+
$(SPEC_RUNNABLE_EXAMPLE_COMPILE
410+
---
411+
import std.stdio : writeln, std.file : write, std.ascii;
412+
413+
void main()
414+
{
415+
writeln("hello!"); // ok, writeln from std.stdio
416+
write("world.txt", "hello"); // ok, write from std.file
417+
writeln(digits); // ok, digits from std.ascii
418+
}
419+
---
420+
)
421+
410422
$(H2 $(LNAME2 renamed_selective_imports, Renamed and Selective Imports))
411423

412424
$(P When renaming and selective importing are combined:)

0 commit comments

Comments
 (0)