Commit 7aca59a9 authored by Kenton Varda's avatar Kenton Varda

Report compile errors in 'using' declarations that aren't ever referenced.

Fixes #403
parent 5de5e5cb
......@@ -681,6 +681,11 @@ void Compiler::Node::traverse(uint eagerness, std::unordered_map<Node*, uint>& s
for (auto& child: content->orderedNestedNodes) {
child->traverse(eagerness, seen, finalLoader);
}
// Also traverse `using` declarations.
for (auto& child: content->aliases) {
child.second->compile();
}
}
}
}
......
......@@ -152,3 +152,6 @@ struct UseGeneric {
const embedBadType :UInt32 = embed "binary";
const embedNoSuchFile :Data = embed "no-such-file";
using Baz = import "nosuchfile-unused.capnp".Baz;
# Check that an import in an unused `using` still reports error.
......@@ -56,3 +56,4 @@ file:149:18-49: error: Double-application of generic parameters.
file:150:38-43: error: Sorry, only pointer types can be used as generic parameters.
file:153:30-44: error: Embeds can only be used when Text, Data, or a struct is expected.
file:154:37-51: error: Couldn't read file for embed: no-such-file
file:156:20-45: error: Import failed: nosuchfile-unused.capnp
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment