-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix issue 578 #591
Merged
Merged
Fix issue 578 #591
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
be24f12
Fix issue #432
danielzuncke 979c74d
Update test to include both known cases
danielzuncke 4a08417
Confirm token equality, safer loop
danielzuncke b8c35ad
Merge branch 'master' of https://github.com/dlang-community/dfmt
danielzuncke 0b3946f
Fix issue 578
danielzuncke 61b448b
Ternary expr. now visited recursively
danielzuncke File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
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]; | ||
/+ | ||
READ IF THIS TEST FAILS | ||
|
||
Bug in dparse: | ||
(Formatting before fix issue 578) | ||
int[int] aa3 = [0: true ? false ? 1: 2: 3]; | ||
^ | ||
|
||
EXPLANATION: | ||
The marked colon is not is not recognized as a TernaryExpression by | ||
dparse: | ||
If you write a `writeln(ternaryExpression.colon.index)` in the overloaded | ||
ASTInformation visit function, which should get called once for every | ||
encountered ternary colon, only the second index is printed: | ||
override void visit(const TernaryExpression ternaryExpression) { ... } | ||
|
||
This bug can be ignored (formatting error is localized and should be rarely | ||
encountered). | ||
|
||
|
||
FIX: | ||
Should this get fixed by dparse or when the migration to dmd is completed, | ||
the formatting in the .ref files can be updated to the correct one and this | ||
comment can be removed. | ||
|
||
|
||
Current formatting after applying fix issue 578: | ||
auto aa3 = [0: true ? false ? 1: 2 : 3]; | ||
^ | ||
|
||
Correct formatting after fix dparse: | ||
auto aa3 = [0: true ? false ? 1 : 2 : 3]; | ||
^ | ||
+/ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
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]; | ||
/+ | ||
READ IF THIS TEST FAILS | ||
|
||
Bug in dparse: | ||
(Formatting before fix issue 578) | ||
int[int] aa3 = [0: true ? false ? 1: 2: 3]; | ||
^ | ||
|
||
EXPLANATION: | ||
The marked colon is not is not recognized as a TernaryExpression by | ||
dparse: | ||
If you write a `writeln(ternaryExpression.colon.index)` in the overloaded | ||
ASTInformation visit function, which should get called once for every | ||
encountered ternary colon, only the second index is printed: | ||
override void visit(const TernaryExpression ternaryExpression) { ... } | ||
|
||
This bug can be ignored (formatting error is localized and should be rarely | ||
encountered). | ||
|
||
|
||
FIX: | ||
Should this get fixed by dparse or when the migration to dmd is completed, | ||
the formatting in the .ref files can be updated to the correct one and this | ||
comment can be removed. | ||
|
||
|
||
Current formatting after applying fix issue 578: | ||
auto aa3 = [0: true ? false ? 1: 2 : 3]; | ||
^ | ||
|
||
Correct formatting after fix dparse: | ||
auto aa3 = [0: true ? false ? 1 : 2 : 3]; | ||
^ | ||
+/ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
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]; | ||
/+ | ||
READ IF THIS TEST FAILS | ||
|
||
Bug in dparse: | ||
(Formatting before fix issue 578) | ||
int[int] aa3 = [0: true ? false ? 1: 2: 3]; | ||
^ | ||
|
||
EXPLANATION: | ||
The marked colon is not is not recognized as a TernaryExpression by | ||
dparse: | ||
If you write a `writeln(ternaryExpression.colon.index)` in the overloaded | ||
ASTInformation visit function, which should get called once for every | ||
encountered ternary colon, only the second index is printed: | ||
override void visit(const TernaryExpression ternaryExpression) { ... } | ||
|
||
This bug can be ignored (formatting error is localized and should be rarely | ||
encountered). | ||
|
||
|
||
FIX: | ||
Should this get fixed by dparse or when the migration to dmd is completed, | ||
the formatting in the .ref files can be updated to the correct one and this | ||
comment can be removed. | ||
|
||
|
||
Current formatting after applying fix issue 578: | ||
auto aa3 = [0: true ? false ? 1: 2 : 3]; | ||
^ | ||
|
||
Correct formatting after fix dparse: | ||
auto aa3 = [0: true ? false ? 1 : 2 : 3]; | ||
^ | ||
+/ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
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]; | ||
/+ | ||
READ IF THIS TEST FAILS | ||
|
||
Bug in dparse: | ||
(Formatting before fix issue 578) | ||
int[int] aa3 = [0: true ? false ? 1: 2: 3]; | ||
^ | ||
|
||
EXPLANATION: | ||
The marked colon is not is not recognized as a TernaryExpression by | ||
dparse: | ||
If you write a `writeln(ternaryExpression.colon.index)` in the overloaded | ||
ASTInformation visit function, which should get called once for every | ||
encountered ternary colon, only the second index is printed: | ||
override void visit(const TernaryExpression ternaryExpression) { ... } | ||
|
||
This bug can be ignored (formatting error is localized and should be rarely | ||
encountered). | ||
|
||
|
||
FIX: | ||
Should this get fixed by dparse or when the migration to dmd is completed, | ||
the formatting in the .ref files can be updated to the correct one and this | ||
comment can be removed. | ||
|
||
|
||
Current formatting after applying fix issue 578: | ||
auto aa3 = [0: true ? false ? 1: 2 : 3]; | ||
^ | ||
|
||
Correct formatting after fix dparse: | ||
auto aa3 = [0: true ? false ? 1 : 2 : 3]; | ||
^ | ||
+/ | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems to be a part of the issue you said would be fixed in the title, no?
Still got broken formatting here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad I misunderstood libdparse, I fix it