Skip to content

Conversation

@kbkpbot
Copy link
Contributor

@kbkpbot kbkpbot commented Oct 2, 2025

Fix issue #25380

@kbkpbot kbkpbot linked an issue Oct 2, 2025 that may be closed by this pull request
@vlang vlang deleted a comment from huly-for-github bot Oct 2, 2025
@kbkpbot
Copy link
Contributor Author

kbkpbot commented Oct 2, 2025

according to parser code(struct.v):

			} else if p.tok.kind == .key_module {
				if module_pos != -1 {
					p.error('redefinition of `module` section')
					return ast.StructDecl{}
				}
				p.next()
				p.check(.colon)
				module_pos = ast_fields.len
				is_field_pub = false
				is_field_mut = false
				is_field_global = false
			}

then the following code is invalid, as module is a keyword in struct declare...

struct RootAST {
        module []rune
}

and it must change to something like that :

struct RootAST {
        mymodule []rune
}

I did not see that we can use module or __global as access modifiers for struct field in document.

@kbkpbot kbkpbot marked this pull request as draft October 3, 2025 00:38
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.

Incorrect error message for badly constructed struct

1 participant