mirror of
https://github.com/dlang-community/dfmt.git
synced 2025-04-25 21:00:03 +03:00
Fix #107
This commit is contained in:
parent
a82eb7aa57
commit
efc9d72c95
4 changed files with 48 additions and 4 deletions
|
@ -457,10 +457,10 @@ private:
|
|||
|
||||
void formatColon()
|
||||
{
|
||||
regenLineBreakHintsIfNecessary(index);
|
||||
regenLineBreakHintsIfNecessary(index);
|
||||
if (linebreakHints.canFindIndex(index))
|
||||
{
|
||||
pushWrapIndent();
|
||||
pushWrapIndent();
|
||||
newline();
|
||||
writeToken();
|
||||
write(" ");
|
||||
|
@ -605,8 +605,9 @@ private:
|
|||
|
||||
void formatSwitch()
|
||||
{
|
||||
if (indents.length == 0 || indents.top != tok!"with")
|
||||
indents.push(tok!"switch");
|
||||
if (indents.length > 0 && indents.top == tok!"with")
|
||||
indents.pop();
|
||||
indents.push(tok!"switch");
|
||||
writeToken(); // switch
|
||||
write(" ");
|
||||
}
|
||||
|
|
15
tests/allman/issue0107.d.ref
Normal file
15
tests/allman/issue0107.d.ref
Normal file
|
@ -0,0 +1,15 @@
|
|||
void msgpackToGValue(MsgValue input)
|
||||
{
|
||||
with (MsgValue.Type) switch (input.type)
|
||||
{
|
||||
case boolean:
|
||||
a();
|
||||
break;
|
||||
case unsigned:
|
||||
b();
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
}
|
||||
return retVal;
|
||||
}
|
15
tests/issue0107.d
Normal file
15
tests/issue0107.d
Normal file
|
@ -0,0 +1,15 @@
|
|||
void msgpackToGValue(MsgValue input)
|
||||
{
|
||||
with (MsgValue.Type) switch (input.type)
|
||||
{
|
||||
case boolean:
|
||||
a();
|
||||
break;
|
||||
case unsigned:
|
||||
b();
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
}
|
||||
return retVal;
|
||||
}
|
13
tests/otbs/issue0107.d.ref
Normal file
13
tests/otbs/issue0107.d.ref
Normal file
|
@ -0,0 +1,13 @@
|
|||
void msgpackToGValue(MsgValue input) {
|
||||
with (MsgValue.Type) switch (input.type) {
|
||||
case boolean:
|
||||
a();
|
||||
break;
|
||||
case unsigned:
|
||||
b();
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
}
|
||||
return retVal;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue