Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
syntax error when using anonymous struct in if-statement, fix #2746
(cherry picked from commit cf6153525597b6bdf1daabfbace230d7581069f4)
- Loading branch information
Showing
6 changed files
with
138 additions
and
6 deletions.
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
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,18 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
) | ||
|
||
func main() { | ||
s := struct{ Username, Password string }{ | ||
"User", | ||
"Password", | ||
} | ||
|
||
if s != struct{ Username, Password string }{} { | ||
fmt.Println("yes") | ||
} else { | ||
fmt.Println("yes") | ||
} | ||
} |
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,113 @@ | ||
GO_FILE | ||
PACKAGE_CLAUSE | ||
PsiElement(package)('package') | ||
PsiElement(identifier)('main') | ||
IMPORT_LIST | ||
IMPORT_DECLARATION | ||
PsiElement(import)('import') | ||
PsiElement(()('(') | ||
IMPORT_SPEC | ||
STRING_LITERAL | ||
PsiElement(string)('"fmt"') | ||
PsiElement())(')') | ||
FUNCTION_DECLARATION | ||
PsiElement(func)('func') | ||
PsiElement(identifier)('main') | ||
SIGNATURE | ||
PARAMETERS | ||
PsiElement(()('(') | ||
PsiElement())(')') | ||
BLOCK | ||
PsiElement({)('{') | ||
SIMPLE_STATEMENT | ||
SHORT_VAR_DECLARATION | ||
VAR_DEFINITION | ||
PsiElement(identifier)('s') | ||
PsiElement(:=)(':=') | ||
COMPOSITE_LIT | ||
STRUCT_TYPE | ||
PsiElement(struct)('struct') | ||
PsiElement({)('{') | ||
FIELD_DECLARATION | ||
FIELD_DEFINITION | ||
PsiElement(identifier)('Username') | ||
PsiElement(,)(',') | ||
FIELD_DEFINITION | ||
PsiElement(identifier)('Password') | ||
TYPE | ||
TYPE_REFERENCE_EXPRESSION | ||
PsiElement(identifier)('string') | ||
PsiElement(})('}') | ||
LITERAL_VALUE | ||
PsiElement({)('{') | ||
ELEMENT | ||
VALUE | ||
STRING_LITERAL | ||
PsiElement(string)('"User"') | ||
PsiElement(,)(',') | ||
ELEMENT | ||
VALUE | ||
STRING_LITERAL | ||
PsiElement(string)('"Password"') | ||
PsiElement(,)(',') | ||
PsiElement(})('}') | ||
IF_STATEMENT | ||
PsiElement(if)('if') | ||
SIMPLE_STATEMENT | ||
LEFT_HAND_EXPR_LIST | ||
CONDITIONAL_EXPR | ||
REFERENCE_EXPRESSION | ||
PsiElement(identifier)('s') | ||
PsiElement(!=)('!=') | ||
COMPOSITE_LIT | ||
STRUCT_TYPE | ||
PsiElement(struct)('struct') | ||
PsiElement({)('{') | ||
FIELD_DECLARATION | ||
FIELD_DEFINITION | ||
PsiElement(identifier)('Username') | ||
PsiElement(,)(',') | ||
FIELD_DEFINITION | ||
PsiElement(identifier)('Password') | ||
TYPE | ||
TYPE_REFERENCE_EXPRESSION | ||
PsiElement(identifier)('string') | ||
PsiElement(})('}') | ||
LITERAL_VALUE | ||
PsiElement({)('{') | ||
PsiElement(})('}') | ||
BLOCK | ||
PsiElement({)('{') | ||
SIMPLE_STATEMENT | ||
LEFT_HAND_EXPR_LIST | ||
CALL_EXPR | ||
REFERENCE_EXPRESSION | ||
REFERENCE_EXPRESSION | ||
PsiElement(identifier)('fmt') | ||
PsiElement(.)('.') | ||
PsiElement(identifier)('Println') | ||
ARGUMENT_LIST | ||
PsiElement(()('(') | ||
STRING_LITERAL | ||
PsiElement(string)('"yes"') | ||
PsiElement())(')') | ||
PsiElement(})('}') | ||
ELSE_STATEMENT | ||
PsiElement(else)('else') | ||
BLOCK | ||
PsiElement({)('{') | ||
SIMPLE_STATEMENT | ||
LEFT_HAND_EXPR_LIST | ||
CALL_EXPR | ||
REFERENCE_EXPRESSION | ||
REFERENCE_EXPRESSION | ||
PsiElement(identifier)('fmt') | ||
PsiElement(.)('.') | ||
PsiElement(identifier)('Println') | ||
ARGUMENT_LIST | ||
PsiElement(()('(') | ||
STRING_LITERAL | ||
PsiElement(string)('"yes"') | ||
PsiElement())(')') | ||
PsiElement(})('}') | ||
PsiElement(})('}') |
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