Compare commits

..

No commits in common. "master" and "v0.15.0-beta.1" have entirely different histories.

57 changed files with 165 additions and 1131 deletions

15
.travis.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/bash
set -e
if [[ $BUILD == dub ]]; then
rdmd ./d-test-utils/test_with_package.d $LIBDPARSE_VERSION libdparse -- dub build --build=release
elif [[ $DC == ldc2 ]]; then
git submodule update --init --recursive
make ldc -j2
else
git submodule update --init --recursive
make debug -j2
fi
cd tests && ./test.d

95
.travis.yml Normal file
View File

@ -0,0 +1,95 @@
sudo: false
language: d
d:
- dmd
- ldc
os:
- linux
- osx
branches:
only:
- master
- /^v\d+\.\d+\.\d+([+-]\S*)*$/
env:
- BUILD=
- BUILD=dub LIBDPARSE_VERSION=min
- BUILD=dub LIBDPARSE_VERSION=max
script: ./.travis.sh
jobs:
include:
- stage: GitHub Release
#if: tag IS present
d: ldc-1.13.0
os: linux
script: echo "Deploying to GitHub releases ..." && ./release.sh
deploy:
provider: releases
api_key: $GH_REPO_TOKEN
file_glob: true
file: bin/dfmt-*.tar.gz
skip_cleanup: true
on:
repo: dlang-community/dfmt
tags: true
- stage: GitHub Release
#if: tag IS present
d: ldc-1.13.0
os: osx
script: echo "Deploying to GitHub releases ..." && ./release.sh
deploy:
provider: releases
api_key: $GH_REPO_TOKEN
file_glob: true
file: bin/dfmt-*.tar.gz
skip_cleanup: true
on:
repo: dlang-community/dfmt
tags: true
- stage: GitHub Release
#if: tag IS present
d: dmd
os: linux
language: generic
sudo: yes
script: echo "Deploying to GitHub releases ..." && ./release-windows.sh
addons:
apt:
packages:
- p7zip-full
deploy:
provider: releases
api_key: $GH_REPO_TOKEN
file_glob: true
file: bin/dfmt-*.zip
skip_cleanup: true
on:
repo: dlang-community/dfmt
tags: true
- stage: GitHub Release
#if: tag IS present
d: dmd
os: linux
language: generic
sudo: yes
script: echo "Deploying to GitHub releases ..." && ARCH=64 ./release-windows.sh
addons:
apt:
packages:
- p7zip-full
deploy:
provider: releases
api_key: $GH_REPO_TOKEN
file_glob: true
file: bin/dfmt-*.zip
skip_cleanup: true
on:
repo: dlang-community/dfmt
tags: true
stages:
- name: test
if: type = pull_request or (type = push and branch = master)

View File

@ -1,5 +1,4 @@
# dfmt [![Build Status](https://github.com/dlang-community/dfmt/actions/workflows/d.yml/badge.svg)](https://github.com/dlang-community/dfmt/actions?query=workflow%3A%22D%22)
# dfmt [![Build Status](https://travis-ci.org/dlang-community/dfmt.svg?branch=master)](https://travis-ci.org/dlang-community/dfmt)
**dfmt** is a formatter for D source code
## Status
@ -52,15 +51,11 @@ found there.
* `--soft_max_line_length`: *see dfmt_soft_max_line_length [below](#dfmt-specific-properties)*
* `--space_after_cast`: *see dfmt_space_after_cast [below](#dfmt-specific-properties)*
* `--space_before_aa_colon`: *see dfmt_space_before_aa_colon [below](#dfmt-specific-properties)*
* `--space_before_named_arg_colon`: *see dfmt_space_before_named_arg_colon [below](#dfmt-specific-properties)*
* `--space_before_function_parameters`: *see dfmt_space_before_function_parameters [below](#dfmt-specific-properties)*
* `--split_operator_at_line_end`: *see dfmt_split_operator_at_line_end [below](#dfmt-specific-properties)*
* `--tab_width`: *see tab_width [below](#standard-editorconfig-properties)*
* `--template_constraint_style`: *see dfmt_template_constraint_style [below](#dfmt-specific-properties)*
* `--keep_line_breaks`: *see dfmt_keep_line_breaks [below](#dfmt-specific-properties)*
* `--single_indent`: *see dfmt_single_indent [below](#dfmt-specific-properties)*
* `--reflow_property_chains`: *see dfmt_property_chains [below](#dfmt-specific-properties)*
* `--space_after_keywords`: *see dfmt_space_after_keywords [below](#dfmt-specific-properties)*
### Example
```
@ -120,11 +115,8 @@ dfmt_compact_labeled_statements | **`true`**, `false` | Place labels on the same
dfmt_template_constraint_style | **`conditional_newline_indent`** `conditional_newline` `always_newline` `always_newline_indent` | Control the formatting of template constraints.
dfmt_single_template_constraint_indent | `true`, **`false`** | Set if the constraints are indented by a single tab instead of two. Has only an effect if the style set to `always_newline_indent` or `conditional_newline_indent`.
dfmt_space_before_aa_colon | `true`, **`false`** | Adds a space after an associative array key before the `:` like in older dfmt versions.
dfmt_space_before_named_arg_colon | `true`, **`false`** | Adds a space after a named function argument or named struct constructor argument before the `:`.
dfmt_keep_line_breaks | `true`, **`false`** | Keep existing line breaks if these don't violate other formatting rules.
dfmt_single_indent | `true`, **`false`** | Set if the code in parens is indented by a single tab instead of two.
dfmt_reflow_property_chains | **`true`**, `false` | Recalculate the splitting of property chains into multiple lines.
dfmt_space_after_keywords | **`true`**, `false` | Insert space after keywords (if,while,foreach,for, etc.).
## Terminology
* Braces - `{` and `}`

View File

@ -4,7 +4,7 @@
"targetType": "autodetect",
"license": "BSL-1.0",
"dependencies": {
"libdparse": ">=0.19.2 <1.0.0"
"libdparse": ">=0.14.0 <1.0.0"
},
"targetPath" : "bin/",
"targetName" : "dfmt",

@ -1 +1 @@
Subproject commit fe6d1e38fb4fc04323170389cfec67ed7fd4e24a
Subproject commit 7112880dae3f25553d96dae53a445c16261de7f9

View File

@ -1,63 +1,53 @@
PREFIX = /usr/local
SRC := $(shell find src -name "*.d") \
$(shell find libdparse/src -name "*.d")
IMPORTS := -Ilibdparse/src -Isrc -Jbin
$(shell find libdparse/src -name "*.d") \
$(shell find stdx-allocator/source -name "*.d")
INCLUDE_PATHS := -Ilibdparse/src -Istdx-allocator/source -Isrc -Jbin
DMD_COMMON_FLAGS := -dip25 -w $(INCLUDE_PATHS)
DMD_DEBUG_FLAGS := -debug -g $(DMD_COMMON_FLAGS)
DMD_FLAGS := -O -inline $(DMD_COMMON_FLAGS)
DMD_TEST_FLAGS := -unittest -g $(DMD_COMMON_FLAGS)
LDC_FLAGS := -g -w -oq $(INCLUDE_PATHS)
GDC_FLAGS := -g -w -oq $(INCLUDE_PATHS)
override DMD_FLAGS += $(DFLAGS)
override LDC_FLAGS += $(DFLAGS)
override GDC_FLAGS += $(DFLAGS)
DC ?= dmd
LDC ?= ldc2
GDC ?= gdc
DMD_COMMON_FLAGS := -w $(IMPORTS)
DMD_DEBUG_FLAGS := -debug -g $(DMD_COMMON_FLAGS)
DMD_FLAGS := -O -inline $(DMD_COMMON_FLAGS)
DMD_TEST_FLAGS := -unittest -g $(DMD_COMMON_FLAGS)
LDC_FLAGS := -g -w -oq $(IMPORTS)
GDC_FLAGS := -g -w -oq $(IMPORTS)
override DMD_FLAGS += $(DFLAGS)
override LDC_FLAGS += $(DFLAGS)
override GDC_FLAGS += $(DFLAGS)
.PHONY: all clean install debug dmd ldc gdc pkg release test
all: bin/dfmt
bin/githash.txt:
mkdir -p bin
git describe --tags > bin/githash.txt
.PHONY: dmd ldc gdc test
dmd: bin/dfmt
ldc: bin/githash.txt
githash:
mkdir -p bin
git describe --tags > bin/githash.txt
ldc: githash
$(LDC) $(SRC) $(LDC_FLAGS) -ofbin/dfmt
-rm -f *.o
gdc: bin/githash.txt
gdc:githash
$(GDC) $(SRC) $(GDC_FLAGS) -obin/dfmt
test: debug
cd tests && ./test.d
bin/dfmt-test: bin/githash.txt $(SRC)
$(DC) $(DMD_TEST_FLAGS) $(filter %.d,$^) -of$@
bin/dfmt-test: githash $(SRC)
$(DC) $(DMD_TEST_FLAGS) $^ -of$@
bin/dfmt: bin/githash.txt $(SRC)
bin/dfmt: githash $(SRC)
$(DC) $(DMD_FLAGS) $(filter %.d,$^) -of$@
debug: bin/githash.txt $(SRC)
debug: githash $(SRC)
$(DC) $(DMD_DEBUG_FLAGS) $(filter %.d,$^) -ofbin/dfmt
pkg: dmd
$(MAKE) -f makd/Makd.mak pkg
clean:
$(RM) bin/dfmt bin/dfmt-test bin/githash.txt
install:
chmod +x bin/dfmt
mkdir -p $(DESTDIR)$(PREFIX)/bin
cp -f bin/dfmt $(DESTDIR)$(PREFIX)/bin/dfmt
$(RM) bin/dfmt
release:
./release.sh
$(MAKE) bin/githash.txt
githash

View File

@ -63,8 +63,6 @@ struct ASTInformation
(structInfoSortedByEndLocation);
sort(ufcsHintLocations);
ufcsHintLocations = ufcsHintLocations.uniq().array();
sort(ternaryColonLocations);
sort(namedArgumentColonLocations);
}
/// Locations of end braces for struct bodies
@ -137,12 +135,6 @@ struct ASTInformation
/// Opening & closing braces of struct initializers
StructInitializerInfo[] structInfoSortedByEndLocation;
/// Locations ternary expression colons.
size_t[] ternaryColonLocations;
/// Locations of named arguments of function call or struct constructor.
size_t[] namedArgumentColonLocations;
}
/// Collects information from the AST that is useful for the formatter
@ -446,43 +438,6 @@ final class FormatVisitor : ASTVisitor
outStatement.accept(this);
}
override void visit(const TernaryExpression ternaryExpression)
{
astInformation.ternaryColonLocations ~= ternaryExpression.colon.index;
ternaryExpression.accept(this);
}
override void visit(const FunctionCallExpression functionCall)
{
// Check if function has any arguments.
if (functionCall.arguments.namedArgumentList is null)
{
functionCall.accept(this);
return;
}
foreach (item; functionCall.arguments.namedArgumentList.items)
{
// Do nothing if not a named argument.
if (item.name == tok!"")
{
continue;
}
// Find first colon if named argument.
foreach (t; item.tokens)
{
if (t.type == tok!":")
{
astInformation.namedArgumentColonLocations ~= t.index;
break;
}
}
}
functionCall.accept(this);
}
private:
ASTInformation* astInformation;
}

View File

@ -63,12 +63,6 @@ struct Config
OptionalBoolean dfmt_keep_line_breaks;
///
OptionalBoolean dfmt_single_indent;
///
OptionalBoolean dfmt_reflow_property_chains;
///
OptionalBoolean dfmt_space_after_statement_keyword;
///
OptionalBoolean dfmt_space_before_named_arg_colon;
mixin StandardEditorConfigFields;
@ -99,8 +93,6 @@ struct Config
dfmt_space_before_aa_colon = OptionalBoolean.f;
dfmt_keep_line_breaks = OptionalBoolean.f;
dfmt_single_indent = OptionalBoolean.f;
dfmt_reflow_property_chains = OptionalBoolean.t;
dfmt_space_before_named_arg_colon = OptionalBoolean.f;
}
/**

View File

@ -203,7 +203,7 @@ private:
/// Tracks paren depth on a single line. This information can be used to
/// indent array literals inside parens, since arrays are indented only once
/// and paren indentation is ignored. Line breaks and "[" reset the counter.
/// and paren indentation is ignored.line breaks and "[" reset the counter.
int parenDepthOnLine;
string eolStringFromInput() const
@ -247,9 +247,9 @@ private:
else if (currentIs(tok!"return"))
{
writeToken();
if (hasCurrent && (!currentIs(tok!";") && !currentIs(tok!")") && !currentIs(tok!"{")
if (!currentIs(tok!";") && !currentIs(tok!")") && !currentIs(tok!"{")
&& !currentIs(tok!"in") && !currentIs(tok!"out") && !currentIs(tok!"do")
&& tokens[index].text != "body"))
&& (hasCurrent && tokens[index].text != "body"))
write(" ");
}
else if (currentIs(tok!"with"))
@ -257,20 +257,16 @@ private:
if (indents.length == 0 || !indents.topIsOneOf(tok!"switch", tok!"with"))
indents.push(tok!"with");
writeToken();
if (config.dfmt_space_after_keywords) {
write(" ");
}
if (hasCurrent && currentIs(tok!"("))
write(" ");
if (currentIs(tok!"("))
writeParens(false);
if (hasCurrent && !currentIs(tok!"switch") && !currentIs(tok!"with")
if (!currentIs(tok!"switch") && !currentIs(tok!"with")
&& !currentIs(tok!"{") && !(currentIs(tok!"final") && peekIs(tok!"switch")))
{
newline();
}
else if (hasCurrent && !currentIs(tok!"{"))
{
else if (!currentIs(tok!"{"))
write(" ");
}
}
else if (currentIs(tok!"switch"))
{
@ -355,7 +351,7 @@ private:
else if (isBasicType(current.type))
{
writeToken();
if (hasCurrent && (currentIs(tok!"identifier") || isKeyword(current.type) || inAsm))
if (currentIs(tok!"identifier") || isKeyword(current.type) || inAsm)
write(" ");
}
else if (isOperator(current.type))
@ -724,18 +720,13 @@ private:
void revertParenIndentation()
{
import std.algorithm.searching : canFind, until;
if (tokens[index .. $].until!(tok => tok.line != current.line).canFind!(x => x.type == tok!"]"))
{
return;
}
if (parenDepthOnLine)
{
foreach (i; 0 .. parenDepthOnLine)
{
indents.pop();
}
indents.popTempIndents();
}
parenDepthOnLine = 0;
}
@ -835,13 +826,12 @@ private:
{
import dfmt.editorconfig : OptionalBoolean;
import std.algorithm : canFind, any;
immutable bool isCase = astInformation.caseEndLocations.canFindIndex(current.index);
immutable bool isAttribute = astInformation.attributeDeclarationLines.canFindIndex(
current.line);
immutable bool isStructInitializer = astInformation.structInfoSortedByEndLocation
.canFind!(st => st.startLocation < current.index && current.index < st.endLocation);
immutable bool isTernary = astInformation.ternaryColonLocations.canFindIndex(current.index);
immutable bool isNamedArg = astInformation.namedArgumentColonLocations.canFindIndex(current.index);
if (isCase || isAttribute)
{
@ -857,17 +847,11 @@ private:
newline();
}
}
else if (indents.topIs(tok!"]") && !isTernary) // Associative array
else if (indents.topIs(tok!"]")) // Associative array
{
write(config.dfmt_space_before_aa_colon ? " : " : ": ");
++index;
}
// Named function or struct constructor arguments.
else if (isNamedArg)
{
write(config.dfmt_space_before_named_arg_colon ? " : " : ": ");
++index;
}
else if (peekBackIs(tok!"identifier")
&& [tok!"{", tok!"}", tok!";", tok!":", tok!","]
.any!((ptrdiff_t token) => peekBack2Is(cast(IdType)token, true))
@ -1060,21 +1044,6 @@ private:
if (niBraceDepth > 0)
niBraceDepth--;
// Account for possible function literals in this array which offset
// the previously set index (pos). Fixes issue #432.
size_t newPos = pos;
while(astInformation.indentInfoSortedByEndLocation[newPos].endLocation <
tokens[index].index)
{
newPos++;
}
if (astInformation.indentInfoSortedByEndLocation[newPos].endLocation ==
tokens[index].index)
{
pos = newPos;
}
auto indentInfo = astInformation.indentInfoSortedByEndLocation[pos];
if (indentInfo.flags & BraceIndentInfoFlags.tempIndent)
{
@ -1144,10 +1113,7 @@ private:
indents.pop();
indents.push(tok!"switch");
writeToken(); // switch
if (config.dfmt_space_after_keywords)
{
write(" ");
}
write(" ");
}
void formatBlockHeader()
@ -1178,26 +1144,16 @@ private:
if (currentIs(tok!"("))
{
if (config.dfmt_space_after_keywords)
{
write(" ");
}
write(" ");
writeParens(false);
}
if (hasCurrent)
{
if (currentIs(tok!"switch") || (currentIs(tok!"final") && peekIs(tok!"switch")))
{
if (config.dfmt_space_after_keywords)
{
write(" ");
}
}
write(" ");
else if (currentIs(tok!"comment"))
{
formatStep();
}
else if (!shouldPushIndent)
{
if (!currentIs(tok!"{") && !currentIs(tok!";"))
@ -1278,7 +1234,7 @@ private:
break;
case tok!"cast":
writeToken();
if (hasCurrent && currentIs(tok!"("))
if (currentIs(tok!"("))
writeParens(config.dfmt_space_after_cast == OptionalBoolean.t);
break;
case tok!"out":
@ -1290,14 +1246,14 @@ private:
write(" ");
}
writeToken();
if (hasCurrent && !currentIs(tok!"{") && !currentIs(tok!"comment"))
if (!currentIs(tok!"{") && !currentIs(tok!"comment"))
write(" ");
break;
case tok!"try":
case tok!"finally":
indents.push(current.type);
writeToken();
if (hasCurrent && !currentIs(tok!"{"))
if (!currentIs(tok!"{"))
newline();
break;
case tok!"identifier":
@ -1322,8 +1278,6 @@ private:
write(" ");
}
writeToken();
if (!hasCurrent)
return;
immutable isFunctionLit = astInformation.funLitStartLocations.canFindIndex(
current.index);
if (isFunctionLit && config.dfmt_brace_style == BraceStyle.allman)
@ -1336,12 +1290,12 @@ private:
tok!"}", tok!"=", tok!"&&", tok!"||") && !peekBackIsKeyword())
write(" ");
writeToken();
if (hasCurrent && !currentIs(tok!"(") && !currentIs(tok!"{") && !currentIs(tok!"comment"))
if (!currentIs(tok!"(") && !currentIs(tok!"{") && !currentIs(tok!"comment"))
write(" ");
break;
case tok!"case":
writeToken();
if (hasCurrent && !currentIs(tok!";"))
if (!currentIs(tok!";"))
write(" ");
break;
case tok!"enum":
@ -1355,7 +1309,7 @@ private:
write(" ");
indents.push(tok!"enum");
writeToken();
if (hasCurrent && !currentIs(tok!":") && !currentIs(tok!"{"))
if (!currentIs(tok!":") && !currentIs(tok!"{"))
write(" ");
}
break;
@ -1379,7 +1333,7 @@ private:
goto default;
case tok!"invariant":
writeToken();
if (hasCurrent && currentIs(tok!"("))
if (currentIs(tok!"("))
write(" ");
break;
default:
@ -1503,8 +1457,7 @@ private:
break;
case tok!".":
regenLineBreakHintsIfNecessary(index);
immutable bool ufcsWrap = config.dfmt_reflow_property_chains == OptionalBoolean.t
&& astInformation.ufcsHintLocations.canFindIndex(current.index);
immutable bool ufcsWrap = astInformation.ufcsHintLocations.canFindIndex(current.index);
if (ufcsWrap || linebreakHints.canFind(index) || onNextLine
|| (linebreakHints.length == 0 && currentLineLength + nextTokenLength() > config.max_line_length))
{
@ -1673,10 +1626,6 @@ private:
const commaLine = tokens[index].line;
writeToken();
if (indents.topIsWrap && !indents.topIs(tok!","))
{
indents.pop;
}
if (!currentIs(tok!")") && !currentIs(tok!"]")
&& !currentIs(tok!"}") && !currentIs(tok!"comment"))
{
@ -1695,10 +1644,6 @@ private:
{
pushWrapIndent();
writeToken();
if (indents.topIsWrap && !indents.topIs(tok!","))
{
indents.pop;
}
newline();
}
else
@ -1758,6 +1703,8 @@ private:
import std.algorithm : max, canFind;
import dfmt.editorconfig : OptionalBoolean;
parenDepthOnLine = 0;
if (currentIs(tok!"comment") && index > 0 && current.line == tokenEndLine(tokens[index - 1]))
return;
@ -1875,19 +1822,7 @@ private:
if (indents.topIs(tok!"]"))
{
indents.pop();
}
// Find the initial indentation of constructs like "if" and
// "foreach" without removing them from the stack, since they
// still can be used later to indent "else".
auto savedIndents = IndentStack(config);
while (indents.length >= 0 && indents.topIsTemp) {
savedIndents.push(indents.top, indents.topDetails);
indents.pop;
}
indentLevel = indents.indentLevel;
while (savedIndents.length > 0) {
indents.push(savedIndents.top, savedIndents.topDetails);
savedIndents.pop;
indentLevel = indents.indentLevel;
}
}
else if (astInformation.attributeDeclarationLines.canFindIndex(current.line))
@ -1918,7 +1853,6 @@ private:
}
indent();
}
parenDepthOnLine = 0;
}
void write(string str)

View File

@ -12,7 +12,7 @@ import std.path : filenameCharCmp, isDirSeparator;
// * changes meaning to match all characters except '/'
// ** added to take over the old meaning of *
bool globMatchEditorConfig(CaseSensitive cs = CaseSensitive.osDefault, C, Range)(
Range path, const(C)[] pattern) @safe pure
Range path, const(C)[] pattern) @safe pure nothrow
if (isForwardRange!Range && isSomeChar!(ElementEncodingType!Range)
&& isSomeChar!C && is(Unqual!C == Unqual!(ElementEncodingType!Range)))
in

View File

@ -278,12 +278,6 @@ private:
immutable currentIsNonWrapTemp = !details[i].wrap
&& details[i].temp && arr[i] != tok!")" && arr[i] != tok!"!";
if (currentIsNonWrapTemp && arr[i + 1] == tok!"]")
{
parenCount = pc;
continue;
}
if (arr[i] == tok!"static"
&& arr[i + 1].among!(tok!"if", tok!"else", tok!"foreach", tok!"foreach_reverse")
&& (i + 2 >= index || arr[i + 2] != tok!"{"))

View File

@ -92,21 +92,12 @@ else
case "space_before_aa_colon":
optConfig.dfmt_space_before_aa_colon = optVal;
break;
case "space_before_named_arg_colon":
optConfig.dfmt_space_before_named_arg_colon = optVal;
break;
case "keep_line_breaks":
optConfig.dfmt_keep_line_breaks = optVal;
break;
case "single_indent":
optConfig.dfmt_single_indent = optVal;
break;
case "reflow_property_chains":
optConfig.dfmt_reflow_property_chains = optVal;
break;
case "space_after_keywords":
optConfig.dfmt_space_after_keywords = optVal;
break;
default:
assert(false, "Invalid command-line switch");
}
@ -129,19 +120,16 @@ else
"soft_max_line_length", &optConfig.dfmt_soft_max_line_length,
"outdent_attributes", &handleBooleans,
"space_after_cast", &handleBooleans,
"space_after_keywords", &handleBooleans,
"selective_import_space", &handleBooleans,
"space_before_function_parameters", &handleBooleans,
"split_operator_at_line_end", &handleBooleans,
"compact_labeled_statements", &handleBooleans,
"single_template_constraint_indent", &handleBooleans,
"space_before_aa_colon", &handleBooleans,
"space_before_named_arg_colon", &handleBooleans,
"tab_width", &optConfig.tab_width,
"template_constraint_style", &optConfig.dfmt_template_constraint_style,
"keep_line_breaks", &handleBooleans,
"single_indent", &handleBooleans,
"reflow_property_chains", &handleBooleans);
"single_indent", &handleBooleans);
// dfmt on
}
catch (GetOptException e)
@ -346,16 +334,13 @@ Formatting Options:
--outdent_attributes
--space_after_cast
--space_before_function_parameters
--space_after_keywords
--selective_import_space
--single_template_constraint_indent
--split_operator_at_line_end
--compact_labeled_statements
--template_constraint_style
--space_before_aa_colon
--space_before_named_arg_colon
--single_indent
--reflow_property_chains
`,
optionsToString!(typeof(Config.dfmt_template_constraint_style)));
}

View File

@ -1,23 +0,0 @@
class C
{
void f()
{
if (true)
{
f(map.map.map.map.map.map.map.map.map.map.map.map.map.map.map.map
.map.map.map.map.map.map, __FILE__, __FILE__, __FILE__, __FILE__, __FILE__,
__FILE__, __FILE__, __FILE__, __FILE__, __FILE__, __FILE__,
__FILE__, __FILE__, __FILE__, __FILE__, __FILE__, __LINE__);
g(map && map && map && map && map && map && map && map && map && map && map
&& map, __FILE__, __FILE__, __FILE__, __FILE__, __FILE__,
__FILE__, __FILE__, __LINE__);
h(map || map || map || map || map || map || map || map || map || map || map
|| map, __FILE__, __FILE__, __FILE__, __FILE__, __FILE__,
__FILE__, __FILE__, __LINE__);
i(map + map + map + map + map + map + map + map + map + map + map + map + map
+ map + map + map + map + map, __FILE__, __FILE__, __FILE__,
__FILE__, __FILE__, __FILE__, __FILE__, __LINE__);
}
}
}

View File

@ -1,31 +0,0 @@
class C
{
void f()
{
if (true)
{
f(
array.map!(a => a.prop)
.array
.to!string,
__FILE__,
__LINE__);
g(
map &&
map,
__FILE__,
__LINE__);
h(
map ||
map,
__FILE__,
__LINE__);
i(
map
+ map,
__FILE__,
__LINE__);
}
}
}

View File

@ -1 +0,0 @@
alias u8 = ubyte

View File

@ -1,40 +0,0 @@
struct S1
{
ulong x;
ulong y;
ulong function(ulong) f;
}
struct S2
{
ulong x;
ulong y;
ulong z;
ulong w;
}
// -----------------------------------------------------------------------------
// Example 1
// Anonymous function in struct, long struct initializer
immutable S1 s1 = {
1111111111111111111, 1111111111111111111, (x) { return x + 1111; },
};
void f1()
{
}
// -----------------------------------------------------------------------------
// Example 2
// Anonymous function anywhere, long struct initializer
int function(int) f2 = (x) { return x + 1111; };
immutable S2 s = {
1111111111111111111, 1111111111111111111, 1111111111111111111, 1111111111111111111,
};
void f2()
{
}

View File

@ -1,74 +0,0 @@
private void selectMember(Args...)(Args args)
{
static if (true)
{
static if (args[0])
{
}
else
{
}
}
if (true)
{
if (args[0])
{
}
else
{
}
}
}
private void selectMember(Args...)(Args args)
{
static if (true)
{
static if ([
0,
1,
2,
3,
4,
])
{
}
else
{
}
}
if (true)
{
if (args[
0,
1,
2,
3,
4,
])
{
}
else
{
}
}
}
void f()
{
foreach (x; y)
if (foo)
{
}
else
{
}
if (a)
if (b)
{
}
else
{
}
}

View File

@ -1,15 +0,0 @@
string f()
{
return duration.total!"seconds".to!string;
}
string g()
{
return duration.total!"seconds"().to!string;
}
string h()
{
return duration.total!"seconds"().to!string.to!string.to!string.to!string.to!string.to!string
.to!string.to!string.to!string;
}

View File

@ -1,8 +0,0 @@
void f()
{
auto t = true ? 1 : 0;
auto a = [true ? 1 : 0];
auto aa1 = [0: true ? 1 : 0];
auto aa2 = [0: true ? (false ? 1 : 2) : 3];
auto aa3 = [0: true ? false ? 1 : 2 : 3];
}

View File

@ -1,28 +0,0 @@
void temp(int v1, int v2)
{
}
int f(int i)
{
return i;
}
struct S
{
int i;
int j;
}
void main()
{
temp(v1: 1, v2: 2);
temp(v1: 1, v2: 2,);
auto s = S(5, j: 3);
temp(v1: 1, v2: f(i: 2));
temp(v1: true ? i : false ? 2 : f(i: 3), v2: 4);
temp(v1: () { S s = S(i: 5); return s.i; }, v2: 1);
}

View File

@ -4,8 +4,3 @@ unittest
x
]);
}
void f(T[] x,
const U y)
{
}

View File

@ -1,15 +0,0 @@
void main(string[] args)
{
for(int i = 0; i < 10; ++i)
{
if(i == 9)
break;
}
while(false)
{
}
foreach(i; 0 .. 9)
{
}
}

View File

@ -1 +0,0 @@
--single_indent=true

View File

@ -1,60 +0,0 @@
class C
{
void f()
{
if (true)
{
f(
map.map.map.map.map.map.map.map.map.map.map.map.map.map.map.map.map.map.map.map.map.map,
__FILE__,
__FILE__,
__FILE__,
__FILE__,
__FILE__,
__FILE__,
__FILE__,
__FILE__,
__FILE__,
__FILE__,
__FILE__,
__FILE__,
__FILE__,
__FILE__,
__FILE__,
__FILE__,
__LINE__);
g(
map && map && map && map && map && map && map && map && map && map && map && map,
__FILE__,
__FILE__,
__FILE__,
__FILE__,
__FILE__,
__FILE__,
__FILE__,
__LINE__);
h(
map || map || map || map || map || map || map || map || map || map || map || map,
__FILE__,
__FILE__,
__FILE__,
__FILE__,
__FILE__,
__FILE__,
__FILE__,
__LINE__);
i(
map + map + map + map + map + map + map + map + map + map + map + map + map + map + map + map + map
+ map,
__FILE__,
__FILE__,
__FILE__,
__FILE__,
__FILE__,
__FILE__,
__FILE__,
__LINE__);
}
}
}

View File

@ -1,2 +0,0 @@
--single_indent=true
--keep_line_breaks=true

View File

@ -1,31 +0,0 @@
class C
{
void f()
{
if (true)
{
f(
array.map!(a => a.prop)
.array
.to!string,
__FILE__,
__LINE__);
g(
map &&
map,
__FILE__,
__LINE__);
h(
map ||
map,
__FILE__,
__LINE__);
i(
map
+ map,
__FILE__,
__LINE__);
}
}
}

View File

@ -1 +0,0 @@
alias u8 = ubyte

View File

@ -1,38 +0,0 @@
struct S1
{
ulong x;
ulong y;
ulong function(ulong)f;
}
struct S2
{
ulong x;
ulong y;
ulong z;
ulong w;
}
// -----------------------------------------------------------------------------
// Example 1
// Anonymous function in struct, long struct initializer
immutable S1 s1 = {
1111111111111111111, 1111111111111111111, (x) { return x + 1111; },};
void f1()
{
}
// -----------------------------------------------------------------------------
// Example 2
// Anonymous function anywhere, long struct initializer
int function(int) f2 = (x) { return x + 1111; };
immutable S2 s = {
1111111111111111111, 1111111111111111111, 1111111111111111111, 1111111111111111111,};
void f2()
{
}

View File

@ -1 +0,0 @@
--keep_line_breaks=true

View File

@ -1,74 +0,0 @@
private void selectMember(Args...)(Args args)
{
static if (true)
{
static if (args[0])
{
}
else
{
}
}
if (true)
{
if (args[0])
{
}
else
{
}
}
}
private void selectMember(Args...)(Args args)
{
static if (true)
{
static if ([
0,
1,
2,
3,
4,
])
{
}
else
{
}
}
if (true)
{
if (args[
0,
1,
2,
3,
4,
])
{
}
else
{
}
}
}
void f()
{
foreach (x; y)
if (foo)
{
}
else
{
}
if (a)
if (b)
{
}
else
{
}
}

View File

@ -1 +0,0 @@
--reflow_property_chains=false

View File

@ -1,14 +0,0 @@
string f()
{
return duration.total!"seconds".to!string;
}
string g()
{
return duration.total!"seconds"().to!string;
}
string h()
{
return duration.total!"seconds"().to!string.to!string.to!string.to!string.to!string.to!string.to!string.to!string.to!string;
}

View File

@ -1,8 +0,0 @@
void f()
{
auto t = true ? 1 : 0;
auto a = [true ? 1: 0];
auto aa1 = [0: true ? 1: 0];
auto aa2 = [0: true ? (false ? 1: 2): 3];
auto aa3 = [0: true ? false ? 1: 2: 3];
}

View File

@ -1,31 +0,0 @@
void temp(int v1, int v2)
{
}
int f(int i)
{
return i;
}
struct S
{
int i;
int j;
}
void main()
{
temp(v1: 1, v2: 2);
temp(
v1: 1,
v2: 2,
);
auto s = S(5, j: 3);
temp(v1: 1, v2: f(i: 2));
temp(v1: true ? i : false ? 2 : f(i: 3), v2: 4);
temp(v1: () { S s = S(i: 5); return s.i; }, v2: 1);
}

View File

@ -4,8 +4,3 @@ unittest
x
]);
}
void f(T[] x,
const U y)
{
}

View File

@ -1,21 +0,0 @@
class C {
void f()
{
if (true) {
f(map.map.map.map.map.map.map.map.map.map.map.map.map.map.map.map
.map.map.map.map.map.map, __FILE__, __FILE__, __FILE__, __FILE__, __FILE__,
__FILE__, __FILE__, __FILE__, __FILE__, __FILE__, __FILE__,
__FILE__, __FILE__, __FILE__, __FILE__, __FILE__, __LINE__);
g(map && map && map && map && map && map && map && map && map && map && map
&& map, __FILE__, __FILE__, __FILE__, __FILE__, __FILE__,
__FILE__, __FILE__, __LINE__);
h(map || map || map || map || map || map || map || map || map || map || map
|| map, __FILE__, __FILE__, __FILE__, __FILE__, __FILE__,
__FILE__, __FILE__, __LINE__);
i(map + map + map + map + map + map + map + map + map + map + map + map + map
+ map + map + map + map + map, __FILE__, __FILE__, __FILE__,
__FILE__, __FILE__, __FILE__, __FILE__, __LINE__);
}
}
}

View File

@ -1,29 +0,0 @@
class C {
void f()
{
if (true) {
f(
array.map!(a => a.prop)
.array
.to!string,
__FILE__,
__LINE__);
g(
map &&
map,
__FILE__,
__LINE__);
h(
map ||
map,
__FILE__,
__LINE__);
i(
map
+ map,
__FILE__,
__LINE__);
}
}
}

View File

@ -1 +0,0 @@
alias u8 = ubyte

View File

@ -1,38 +0,0 @@
struct S1 {
ulong x;
ulong y;
ulong function(ulong) f;
}
struct S2 {
ulong x;
ulong y;
ulong z;
ulong w;
}
// -----------------------------------------------------------------------------
// Example 1
// Anonymous function in struct, long struct initializer
immutable S1 s1 = {
1111111111111111111, 1111111111111111111, (x) { return x + 1111; },
};
void f1()
{
}
// -----------------------------------------------------------------------------
// Example 2
// Anonymous function anywhere, long struct initializer
int function(int) f2 = (x) { return x + 1111; };
immutable S2 s = {
1111111111111111111, 1111111111111111111, 1111111111111111111, 1111111111111111111,
};
void f2()
{
}

View File

@ -1,52 +0,0 @@
private void selectMember(Args...)(Args args)
{
static if (true) {
static if (args[0]) {
} else {
}
}
if (true) {
if (args[0]) {
} else {
}
}
}
private void selectMember(Args...)(Args args)
{
static if (true) {
static if ([
0,
1,
2,
3,
4,
]) {
} else {
}
}
if (true) {
if (args[
0,
1,
2,
3,
4,
]) {
} else {
}
}
}
void f()
{
foreach (x; y)
if (foo) {
} else {
}
if (a)
if (b) {
} else {
}
}

View File

@ -1,15 +0,0 @@
string f()
{
return duration.total!"seconds".to!string;
}
string g()
{
return duration.total!"seconds"().to!string;
}
string h()
{
return duration.total!"seconds"().to!string.to!string.to!string.to!string.to!string.to!string
.to!string.to!string.to!string;
}

View File

@ -1,8 +0,0 @@
void f()
{
auto t = true ? 1 : 0;
auto a = [true ? 1 : 0];
auto aa1 = [0: true ? 1 : 0];
auto aa2 = [0: true ? (false ? 1 : 2) : 3];
auto aa3 = [0: true ? false ? 1 : 2 : 3];
}

View File

@ -1,27 +0,0 @@
void temp(int v1, int v2)
{
}
int f(int i)
{
return i;
}
struct S {
int i;
int j;
}
void main()
{
temp(v1: 1, v2: 2);
temp(v1: 1, v2: 2,);
auto s = S(5, j: 3);
temp(v1: 1, v2: f(i: 2));
temp(v1: true ? i : false ? 2 : f(i: 3), v2: 4);
temp(v1: () { S s = S(i: 5); return s.i; }, v2: 1);
}

View File

@ -3,8 +3,3 @@ unittest {
x
]);
}
void f(T[] x,
const U y)
{
}

View File

@ -1,12 +0,0 @@
void main(string[] args)
{
for(int i = 0; i < 10; ++i) {
if(i == 9)
break;
}
while(false) {
}
foreach(i; 0 .. 9) {
}
}

View File

@ -1,20 +0,0 @@
class C {
void f() {
if (true) {
f(map.map.map.map.map.map.map.map.map.map.map.map.map.map.map.map
.map.map.map.map.map.map, __FILE__, __FILE__, __FILE__, __FILE__, __FILE__,
__FILE__, __FILE__, __FILE__, __FILE__, __FILE__, __FILE__,
__FILE__, __FILE__, __FILE__, __FILE__, __FILE__, __LINE__);
g(map && map && map && map && map && map && map && map && map && map && map
&& map, __FILE__, __FILE__, __FILE__, __FILE__, __FILE__,
__FILE__, __FILE__, __LINE__);
h(map || map || map || map || map || map || map || map || map || map || map
|| map, __FILE__, __FILE__, __FILE__, __FILE__, __FILE__,
__FILE__, __FILE__, __LINE__);
i(map + map + map + map + map + map + map + map + map + map + map + map + map
+ map + map + map + map + map, __FILE__, __FILE__, __FILE__,
__FILE__, __FILE__, __FILE__, __FILE__, __LINE__);
}
}
}

View File

@ -1,28 +0,0 @@
class C {
void f() {
if (true) {
f(
array.map!(a => a.prop)
.array
.to!string,
__FILE__,
__LINE__);
g(
map &&
map,
__FILE__,
__LINE__);
h(
map ||
map,
__FILE__,
__LINE__);
i(
map
+ map,
__FILE__,
__LINE__);
}
}
}

View File

@ -1 +0,0 @@
alias u8 = ubyte

View File

@ -1,36 +0,0 @@
struct S1 {
ulong x;
ulong y;
ulong function(ulong) f;
}
struct S2 {
ulong x;
ulong y;
ulong z;
ulong w;
}
// -----------------------------------------------------------------------------
// Example 1
// Anonymous function in struct, long struct initializer
immutable S1 s1 = {
1111111111111111111, 1111111111111111111, (x) { return x + 1111; },
};
void f1() {
}
// -----------------------------------------------------------------------------
// Example 2
// Anonymous function anywhere, long struct initializer
int function(int) f2 = (x) { return x + 1111; };
immutable S2 s = {
1111111111111111111, 1111111111111111111, 1111111111111111111, 1111111111111111111,
};
void f2() {
}

View File

@ -1,49 +0,0 @@
private void selectMember(Args...)(Args args) {
static if (true) {
static if (args[0]) {
} else {
}
}
if (true) {
if (args[0]) {
} else {
}
}
}
private void selectMember(Args...)(Args args) {
static if (true) {
static if ([
0,
1,
2,
3,
4,
]) {
} else {
}
}
if (true) {
if (args[
0,
1,
2,
3,
4,
]) {
} else {
}
}
}
void f() {
foreach (x; y)
if (foo) {
} else {
}
if (a)
if (b) {
} else {
}
}

View File

@ -1,12 +0,0 @@
string f() {
return duration.total!"seconds".to!string;
}
string g() {
return duration.total!"seconds"().to!string;
}
string h() {
return duration.total!"seconds"().to!string.to!string.to!string.to!string.to!string.to!string
.to!string.to!string.to!string;
}

View File

@ -1,7 +0,0 @@
void f() {
auto t = true ? 1 : 0;
auto a = [true ? 1 : 0];
auto aa1 = [0: true ? 1 : 0];
auto aa2 = [0: true ? (false ? 1 : 2) : 3];
auto aa3 = [0: true ? false ? 1 : 2 : 3];
}

View File

@ -1,24 +0,0 @@
void temp(int v1, int v2) {
}
int f(int i) {
return i;
}
struct S {
int i;
int j;
}
void main() {
temp(v1: 1, v2: 2);
temp(v1: 1, v2: 2,);
auto s = S(5, j: 3);
temp(v1: 1, v2: f(i: 2));
temp(v1: true ? i : false ? 2 : f(i: 3), v2: 4);
temp(v1: () { S s = S(i: 5); return s.i; }, v2: 1);
}

View File

@ -3,7 +3,3 @@ unittest {
x
]);
}
void f(T[] x,
const U y) {
}

View File

@ -1,11 +0,0 @@
void main(string[] args) {
for(int i = 0; i < 10; ++i) {
if(i == 9)
break;
}
while(false) {
}
foreach(i; 0 .. 9) {
}
}

View File

@ -1 +0,0 @@
--space_after_keywords=false

View File

@ -1,10 +0,0 @@
void main(string[] args)
{
for (int i = 0; i < 10; ++i) {
if (i == 9) break;
}
while (false) {}
foreach (i; 0 .. 9) {
}
}