force snake_case in struct fields
parent
576192949d
commit
8bce5cb810
|
@ -592,6 +592,9 @@ fn (p mut Parser) struct_decl() {
|
||||||
if field_name in names {
|
if field_name in names {
|
||||||
p.error('duplicate field `$field_name`')
|
p.error('duplicate field `$field_name`')
|
||||||
}
|
}
|
||||||
|
if p.mod != 'os' && contains_capital(field_name) {
|
||||||
|
p.error('struct fields cannot contain uppercase letters, use snake_case instead')
|
||||||
|
}
|
||||||
names << field_name
|
names << field_name
|
||||||
// We are in an interface?
|
// We are in an interface?
|
||||||
// `run() string` => run is a method, not a struct field
|
// `run() string` => run is a method, not a struct field
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
const (
|
||||||
|
a = 3
|
||||||
|
)
|
||||||
|
|
||||||
|
fn test_const() {
|
||||||
|
assert a == 3
|
||||||
|
}
|
Loading…
Reference in New Issue