You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A parsing ambiguity arises when a composite literal using the TypeName form of the LiteralType appears as an operand between the keyword and the opening brace of the block of an "if", "for", or "switch" statement, and the composite literal is not enclosed in parentheses, square brackets, or curly braces. In this rare case, the opening brace of the literal is erroneously parsed as the one introducing the block of statements. To resolve the ambiguity, the composite literal must appear within parentheses.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?Whatever is running on the playground - could reproduce under Debian with this env
What did you do?
https://play.golang.org/p/wLLYH3EVlGW
core code snippet:
What did you expect to see?
No compilation error, I expect this type
if e := T{}.F(); e != nil{}
to correctly resolvee
to the result ofF
What did you see instead?
Compilation error:
PS: I had a hard time naming this issue, feel free to rename
The text was updated successfully, but these errors were encountered: