Skip to content
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

compiler/parser: invalid behaviour with struct composite literals #932

Open
zapateo opened this issue Mar 17, 2022 · 0 comments
Open

compiler/parser: invalid behaviour with struct composite literals #932

zapateo opened this issue Mar 17, 2022 · 0 comments
Labels
bug Bug: something already implemented does not work as it should InvalidBehavior A valid or not valid code has an invalid behavior at runtime parser Related to parser templates Related to the template

Comments

@zapateo
Copy link
Member

zapateo commented Mar 17, 2022

Consider this code:

package main

type T struct { A, B int}

func main() {
	_ =  T{
		A: 10,
		B: 20
	}
}

The parser should return error:

syntax error: unexpected newline, expecting comma or }

but, instead, it accepts the code as it is correct.

Note that the same problem also involves the templates (add this test to test/misc/templates_test.go):

"BUG": {
	sources: fstest.Files{
		"index.html": `{%%
			_ = struct{A, B int} {
				A: 1,
				B: 2
			}
			%%}
		`,
	},
},
@zapateo zapateo added bug Bug: something already implemented does not work as it should parser Related to parser templates Related to the template InvalidBehavior A valid or not valid code has an invalid behavior at runtime labels Mar 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug: something already implemented does not work as it should InvalidBehavior A valid or not valid code has an invalid behavior at runtime parser Related to parser templates Related to the template
Projects
None yet
Development

No branches or pull requests

1 participant