Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 Bug: "Implement Method" and return types
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

MrDoomMaster
Tomato Guru

251 Posts

Posted - Jan 05 2018 :  1:52:26 PM  Show Profile  Reply with Quote
When I have a member function declaration that has a return type of a class that is within the namespace of the owning class, that return type is always fully qualified when using "Implement Method", even though it's unnecessary and the declaration did not fully qualify the type. I'll give you a reproducible example.

Start out with the following files in Visual Studio 2017.

Header File (Test.hpp):


namespace Test
{
   class FirstClass
   {
   };

   class SecondClass
   {
   public:

      FirstClass DoAThing();
   };
}


Source File (Test.cpp):


#include "Test.hpp"

namespace Test
{

}


Now right-click "DoAThing()" in the header and click "Create Implementation". You get the following in the source file:


#include "Menu.hpp"

namespace Test
{

   ///////////////////////////////////////////////////////////////////////////////
   ///
   ///////////////////////////////////////////////////////////////////////////////
   Test::FirstClass SecondClass::DoAThing()
   {

   }

}


By the way, here is my customized "Create Implementation" template which I altered slightly from the VAX default:



///////////////////////////////////////////////////////////////////////////////
///
///////////////////////////////////////////////////////////////////////////////
$SymbolType$ $SymbolContext$($ParameterList$) $MethodQualifier$
{
	$end$$MethodBody$
}




Notice that in the generated implementation in the source file, the return type appears as Test::FirstClass. I want this return type to be FirstClass instead (minus the "Test::"). This is not necessary since the definition of the function is placed inside the "Test" namespace.

I expect that Visual Assist should make it a priority to keep return types identical to how they appear in the declaration. And only if it determines keeping it that way may result in a compiler error (assuming it does this type of introspection), it should try to correct it by qualifying it only as necessary. It especially needs to be smart enough about nested namespaces and only go up as far as needed to resolve the type.

MrDoomMaster
Tomato Guru

251 Posts

Posted - Jan 05 2018 :  1:54:25 PM  Show Profile  Reply with Quote
Forgot to provide system info. Please see below.


License: [email protected] (2-user license) Support ends 2018.08.11
VA_X.dll file version 10.9.2238.2  built 2017.11.10
DevEnv.exe version 15.0.27130.2010 Professional
msenv.dll version 15.0.27130.2010
Comctl32.dll version 6.10.14393.447
Windows 10 10.0 Build 14393 
8 processors (x86-64, WOW64)
Language info: 1252, 0x409

Platform: Project defined
Stable Includes:
C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.2\Include\um;
C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\winrt;
C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\shared;
C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\um;
E:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\VS\UnitTest\include;
C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\ucrt;
E:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\VS\include;
E:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.12.25827\atlmfc\include;
E:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.12.25827\include;

Other Includes:

Stable Source Directories:
C:\Program Files (x86)\Windows Kits\10\Source\10.0.14393.0\ucrt;
E:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\VS\src;
E:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.12.25827\crt\src;
E:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.12.25827\atlmfc\src\atl;
E:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.12.25827\atlmfc\src\mfcm;
E:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.12.25827\atlmfc\src\mfc;

Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Jan 06 2018 :  06:02:18 AM  Show Profile  Reply with Quote
I am seeing the same effect here. Thank you for the clear description.

case=6130
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000