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

ast, fmt: fix formatting type decl with anon struct 2 (related #19356) #19364

Merged
merged 2 commits into from
Sep 16, 2023

Conversation

yuyi98
Copy link
Member

@yuyi98 yuyi98 commented Sep 16, 2023

This PR fix formatting type decl with anon struct 2 (related #19356).

  • Fix formatting type decl with anon struct 2.
  • Change test.

vlib\v\fmt\tests\type_decl_with_anon_struct_keep.vv

pub type Unit1 = struct {}

pub type Unit2 = struct {
	name string
	age  int
}

pub const unit1 = Unit1{}

pub const unit2 = Unit2{'bob', 22}

fn main() {
	println(unit1)
	println(unit2)
}

@Delta456
Copy link
Member

Should this be allowed?

pub type Unit1 = struct {}

@yuyi98
Copy link
Member Author

yuyi98 commented Sep 16, 2023

I think it should be allowed, It's aliases of empty struct.

@spytheman spytheman merged commit 8fee351 into vlang:master Sep 16, 2023
35 checks passed
@yuyi98 yuyi98 deleted the fmt_type_decl_anon_struct_2 branch September 16, 2023 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants