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 253386 - Incorrectly formatted templates and initializer lists
Summary: Incorrectly formatted templates and initializer lists
Status: RESOLVED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.1
Hardware: PC Linux
: P3 normal (vote)
Assignee: Alexander Simon
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-07-09 15:17 UTC by p2rkw
Modified: 2016-07-16 02:09 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
my formatting settings (1.22 KB, application/zip)
2015-07-09 15:17 UTC, p2rkw
Details

Note You need to log in before you can comment on or make changes to this bug.
Description p2rkw 2015-07-09 15:17:57 UTC
Created attachment 154544 [details]
my formatting settings

Following code:
  ForTypes::ForTypesImpl<T...>{}.loop(std::forward<F>(body), std::make_index_sequence<sizeof...(T)>{}, std::forward<T>(objects)...);

where:
 - ForTypes is namespace
 - ForTypesImpl is template structure
 - loop is template method of that struct

is formatted by netbeans as:

- after first formatting:
  ForTypesImpl < T...>{}
.loop(std::forward<F>(body), std::make_index_sequence<sizeof...(T)>
  {}, std::forward<T>(objects)...);

- after second formatting:
ForTypesImpl < T...>{}

  .loop(std::forward<F>(body), std::make_index_sequence<sizeof...(T)>
  {}, std::forward<T>(objects)...);

where desired result is:
  ForTypes::ForTypesImpl<T...>{}.loop(std::forward<F>(body),
                                      std::make_index_sequence<sizeof...(T)>{},
                                      std::forward<T>(objects)...);

Problems:
 - ForTypes::ForTypesImpl<T...>{}
                         ^ - this opening bracket is treated like 'less than' operator - there are spaces around it
 - method call after braces from uniform initialization syntax is treated strangely; its getting worse when overloaded operator() is called instead of regular method
Comment 1 p2rkw 2015-07-09 15:22:52 UTC
Problems (continuation):
 - uniform initialization braces were moved to new line, so "std::make_index_sequence<sizeof...(T)>{}," became:
"std::make_index_sequence<sizeof...(T)>
{},"
Comment 2 p2rkw 2015-07-09 18:09:30 UTC
Also in return statement unfiorm initialization expression is formatted incorrectly:
"  return { someOutputValue };"
if formatted as:
"  return
   {
     someOutputValue;
   };
"
Comment 3 Alexander Simon 2016-07-15 14:51:37 UTC
fixed, change set:
http://hg.netbeans.org/cnd-main/rev/ad00480e10fe
Comment 4 Quality Engineering 2016-07-16 02:09:40 UTC
Integrated into 'main-silver', will be available in build *201607160002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/ad00480e10fe
User: Alexander Simon <alexvsimon@netbeans.org>
Log: fixed Bug #253386 Incorrectly formatted templates and initializer lists