Navigation to MatrixType::Simple from reference does not work
Categories
(Webtools :: Searchfox, defect)
Tracking
(firefox115 fixed)
Tracking | Status | |
---|---|---|
firefox115 | --- | fixed |
People
(Reporter: botond, Assigned: botond)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
STR
- Go to https://searchfox.org/mozilla-central/source/gfx/2d/Matrix.h#1955
- Click on the token
Simple
token inMatrixType::Simple
Expected results
There is a navigation target that takes you here.
Actual results
There is no such navigation target.
Assignee | ||
Comment 1•4 years ago
|
||
The issue almost certainly has to do with the fact that MatrixType
is a nested type defined inside Matrix4x4TypedFlagged
which is a template, making it a dependent name. However, the references occur inside the primary template definition, which means they cannot possibly resolve to anything other than the nested type defined inside that same primary template definition.
Assignee | ||
Comment 2•4 years ago
|
||
(In reply to Botond Ballo [:botond] from comment #1)
However, the references occur inside the primary template definition, which means they cannot possibly resolve to anything other than the nested type defined inside that same primary template definition.
I stand corrected: it turns out you can specialize a nested type of a template without specializing the entire template:
template <typename T>
struct Outer {
enum class MatrixType {
Simple, // declaration #1
NotSimple
};
void foo() {
// MatrixType::Simple resolves to declaration #1
// unless T = int in which case it resolves to declaration #2
MatrixType m = MatrixType::Simple;
}
};
template <>
enum class Outer<int>::MatrixType {
CPlusPlusFooledYou,
Simple // declaration #2
};
int main() {
Outer<int>().foo();
Outer<float>().foo();
}
All the same: it would be an eminently reasonable heuristic for Searchfox to resolve the reference to the declaration inside the primary template.
Comment 3•4 years ago
|
||
Somewhat off-topic here: I think my recent work on the fancy branch with the "structured" record type may let us avoid the general scale-explosion issue with templates that causes us to be so conservative about what we emit.
On trunk, searchfox doesn't really have a concept of a type hierarchy; instead it emits symbols for a method and all of its overrides. This results in scale problems because de-duplication is based on exact match of the JSON record object. With "structured" records, we can instead just say "this is an instantiation of template Foo with T=Bar" and emit the template records as Foo<T>::Method
instead of worrying about emitting every method record for every T. I'll try and take a look at whether that's viable this weekend and perhaps file a canonical bug for that with my results.
Comment hidden (obsolete) |
Comment hidden (obsolete) |
Comment hidden (obsolete) |
Comment hidden (obsolete) |
Assignee | ||
Comment 9•11 months ago
|
||
Reduced testcase:
Steps to reproduce
Have Searchfox index the following code:
template <typename>
struct Foo {
enum class E {
Waldo,
};
void Bar() {
E::Waldo;
}
};
Expected results
Navigation from the use of Waldo
goes to the definition.
Actual results
No navigation is offered at the use.
Assignee | ||
Comment 10•11 months ago
|
||
The expression type of E::Waldo
in the clang AST is DependentScopeDeclRefExpr
. That doesn't currently have a Visit
method in IndexConsumer
; we'll need to add one.
Assignee | ||
Comment 11•11 months ago
|
||
Comment 12•11 months ago
|
||
Pushed by bballo@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/24fb0275178b Handle DependentScopeDeclRefExpr in MozsearchIndexer. r=andi
Comment 13•11 months ago
|
||
bugherder |
Description
•