This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 160442 - [code completion] Template specilization handling for content assist
Summary: [code completion] Template specilization handling for content assist
Status: RESOLVED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Code Completion (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker with 1 vote (vote)
Assignee: Vladimir Voskresensky
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-03-17 11:21 UTC by rmartins
Modified: 2009-10-30 16:00 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Possible missing type evaluation (108.32 KB, image/jpeg)
2009-04-03 09:35 UTC, rmartins
Details

Note You need to log in before you can comment on or make changes to this bug.
Description rmartins 2009-03-17 11:21:46 UTC
#include <map>
int main()
{
        std::map<int,int> t;
        t.find()  <----
}

The context assist shows "find(const key_type& __x) iterator" and "find(const key_type& __x) const_iterator"", but it should
show "find(const int& __x) iterator" and "find(const int& __x) const_iterator"; i.e. replacing the types according to the
template parameters.
Comment 1 rmartins 2009-03-23 16:57:19 UTC
using namespace std;
template <typename X>
class A{
public:
    A(){}
    ~A(){}
    X* getX(){return m_x;}
    X* m_x;
};
int main(int argc, char** argv) {
    A<int> a;
    a.getX(); <--- works (it shows int* as the return type)!
}

In this case it works. So the problem must be only with the STL support, right?
Comment 2 nnnnnk 2009-04-01 13:51:26 UTC
The reason is that we don't resolve return type of getX().
So if this type is template parameter we substitute it with its value, but in case of more complex type we don't do
anything.
So this example wont work:
typedef X TX;
TX* getX(){return m_x;}

It's possible to resolve such types, but it could be too time expensive and we have to make additional investigations.

Comment 3 rmartins 2009-04-01 14:59:32 UTC
Hi,
as the problem isn't simple, do you think this is doable for the 6.7 release?
Thanks,
Rolando
Comment 4 Vladimir Voskresensky 2009-04-01 15:28:33 UTC
The problem is not difficult, but could have performance impact on completion feature.
Let's see :-)
Comment 6 rmartins 2009-04-01 18:51:44 UTC
Nice to ear that;)

Does your effort for solving this issue helps in anyway issue 158692
(http://www.netbeans.org/issues/show_bug.cgi?id=158692).
Seems interconnected...
Comment 7 Vladimir Voskresensky 2009-04-01 20:20:24 UTC
Sorry, but IZs are unrelated :-)
Comment 8 Quality Engineering 2009-04-03 07:49:01 UTC
Integrated into 'main-golden', will be available in build *200904030200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/15c1edcfb57f
User: Vladimir Voskresensky <vv159170@netbeans.org>
Log: fixing IZ#160442: [code completion]  Template specilization handling for content assist
Comment 9 rmartins 2009-04-03 09:35:31 UTC
Created attachment 79355 [details]
Possible missing type evaluation
Comment 10 rmartins 2009-04-03 09:42:28 UTC
very nice work;)
I been only for a bit, but I possibly found an issue.
map<int,string> m;
m.begin()->
Shouldn't the the 3th option on the pair(const pair<_U1,_U2>& __p) be pair(const pair<int,string>& __p)?
Comment 11 Vladimir Voskresensky 2009-09-25 14:06:08 UTC
consider for the next release due to lack of resources
Comment 12 nnnnnk 2009-10-30 15:43:21 UTC
I think that pair(const pair<_U1,_U2>& __p) shouldn't be pair(const pair<int,string>& __p).
It's templated copy constructor.
It's not instantiated.

template<class _T1, class _T2>
struct pair {
    // ...
    template<class _U1, class _U2 >
    pair(const pair<_U1, _U2>& __p) {
        //...
    }
};

So IZ is fixed.
Comment 13 rmartins 2009-10-30 16:00:18 UTC
Hi Nick,
I don't follow.

template<class _T1, class _T2>
struct pair {
    // ...
    template<class _U1, class _U2 >
    pair(const pair<_U1, _U2>& __p) {  <== where _U1 = copied_pair_T1 && _U2 = copied_pair_T2, so it's recursive
        //...
    }
};

The mapping should be <int,int>, right?

Thanks,
Rolando