forked from qt-creator/qt-creator
CppTools: Fix formatting for new-style function declaration
Fixes: QTCREATORBUG-23502 Change-Id: Ie80fe9aa77ffbf0b9ecc531841e78f2bd80de37e Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
@@ -199,6 +199,11 @@ void CodeFormatter::recalculateStateAfter(const QTextBlock &block)
|
|||||||
turnInto(substatement_open);
|
turnInto(substatement_open);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case T_ARROW: // Trailing return type?
|
||||||
|
if (m_currentState.at(m_currentState.size() - 2).type == declaration_start) {
|
||||||
|
leave();
|
||||||
|
break;
|
||||||
|
}
|
||||||
default: tryExpression(); break;
|
default: tryExpression(); break;
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
|||||||
@@ -1287,6 +1287,7 @@ void tst_CodeFormatter::functionReturnType()
|
|||||||
<< Line("A::B::foo() {}")
|
<< Line("A::B::foo() {}")
|
||||||
<< Line("std::map<int,std::vector<int>> indent() {}")
|
<< Line("std::map<int,std::vector<int>> indent() {}")
|
||||||
<< Line("std::map<int,std::vector<int> > indent() {}")
|
<< Line("std::map<int,std::vector<int> > indent() {}")
|
||||||
|
<< Line("auto indent() -> std::map<int,std::vector<int>>")
|
||||||
<< Line("")
|
<< Line("")
|
||||||
;
|
;
|
||||||
checkIndent(data);
|
checkIndent(data);
|
||||||
|
|||||||
Reference in New Issue
Block a user