summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Fitzgerald <fitzgen@gmail.com>2017-04-17 14:40:29 -0700
committerNick Fitzgerald <fitzgen@gmail.com>2017-04-17 16:01:58 -0700
commitbce13307645172be62e8895e82d9362f0c4e4fd6 (patch)
tree62f3e936c9a14c7a90270a2a0cbd5b8a2b909241 /src
parent790826272861bd3eca2d149ac7b2b95fcbec6e09 (diff)
Resolve through type refs and aliases when marking type params used
In stylo bindings generation, we were hitting bugs where the analysis saw a template type parameter behind a type ref to a type alias, and this was then used as an argument to a template instantiation. Because of the indirection, the analysis got confused and ignored the template argument because it was "not" a named template type, and therefore we didn't care about its usage. This commit makes sure that we keep resolving through type references and aliases to find the inner named template type parameter to add to the current item's usage set. Fixes #638.
Diffstat (limited to 'src')
-rw-r--r--src/ir/named.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/ir/named.rs b/src/ir/named.rs
index 39fa2201..17f46eca 100644
--- a/src/ir/named.rs
+++ b/src/ir/named.rs
@@ -481,6 +481,10 @@ impl<'ctx, 'gen> MonotoneFramework for UsedTemplateParameters<'ctx, 'gen> {
if used_by_def.contains(param) {
debug!(" param is used by template definition");
+ let arg = arg.into_resolver()
+ .through_type_refs()
+ .through_type_aliases()
+ .resolve(self.ctx);
if let Some(named) = arg.as_named(self.ctx, &()) {
debug!(" arg is a type parameter, marking used");
used_by_this_id.insert(named);