TYPE(CSharpNullable) \
TYPE(CSharpNullCoalescing) \
TYPE(CSharpNullConditional) \
- TYPE(CSharpNullConditionalSq) \
+ TYPE(CSharpNullConditionalLSquare) \
TYPE(Unknown)
enum TokenType {
if (PeriodOrLSquare->is(tok::l_square)) {
Question->Tok.setKind(tok::question); // no '?[' in clang tokens.
- Question->Type = TT_CSharpNullConditionalSq;
+ Question->Type = TT_CSharpNullConditionalLSquare;
} else {
Question->Tok.setKind(tok::question); // no '?.' in clang tokens.
Question->Type = TT_CSharpNullConditional;
}
break;
case tok::question:
- if (Tok->is(TT_CSharpNullConditionalSq)) {
+ if (Tok->is(TT_CSharpNullConditionalLSquare)) {
if (!parseSquare())
return false;
break;
return;
}
if (CurrentToken->TokenText == "?[") {
- Current.Type = TT_CSharpNullConditionalSq;
+ Current.Type = TT_CSharpNullConditionalLSquare;
return;
}
}
return true;
// No space before '?['.
- if (Right.is(TT_CSharpNullConditionalSq))
+ if (Right.is(TT_CSharpNullConditionalLSquare))
return false;
// Possible space inside `?[ 0 ]`.
- if (Left.is(TT_CSharpNullConditionalSq))
+ if (Left.is(TT_CSharpNullConditionalLSquare))
return Style.SpacesInSquareBrackets;
// space between keywords and paren e.g. "using ("
Style.SpacesInSquareBrackets = true;
verifyFormat(R"(private float[ , ] Values;)", Style);
+ verifyFormat(R"(string dirPath = args?[ 0 ];)", Style);
}
TEST_F(FormatTestCSharp, CSharpNullableTypes) {