Skip to content
Merged
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
25 changes: 19 additions & 6 deletions spec/module.dd
Original file line number Diff line number Diff line change
Expand Up @@ -178,19 +178,15 @@ $(GNAME ImportDeclaration):

$(GNAME ImportList):
$(I Import)
$(I ImportBindings)
$(I Import) $(D ,) $(I ImportList)

$(GNAME Import):
$(I ModuleFullyQualifiedName)
$(I ModuleAliasIdentifier) $(D =) $(I ModuleFullyQualifiedName)
$(I ImportBindings)

$(GNAME ImportBindings):
$(I Import) $(D :) $(I ImportBindList)

$(GNAME ImportBindList):
$(I ImportBind)
$(I ImportBind) $(D ,) $(I ImportBindList)
$(I Import) $(D :) $(I ImportBind)

$(GNAME ImportBind):
$(I Identifier)
Expand Down Expand Up @@ -407,6 +403,23 @@ void main()

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

$(P Selective `import`s can be made from multiple modules if
all `import`s are selective, or when the imported module has a qualified name:)

$(SPEC_RUNNABLE_EXAMPLE_COMPILE
---
import std.stdio : writeln, writefln, std.file : write, std.ascii;

void main()
{
writeln("hello!"); // ok, writeln from std.stdio
writefln("%s!", "hello"); // ok, writefln from std.stdio
write("world.txt", "hello"); // ok, write from std.file
writeln(digits); // ok, digits from std.ascii
}
---
)

$(H2 $(LNAME2 renamed_selective_imports, Renamed and Selective Imports))

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