fmt: do not remove chan type of struct fields (#8948)

pull/8951/head
Lukas Neubert 2021-02-24 19:26:12 +01:00 committed by GitHub
parent 1c0eefae38
commit e53476d5e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -666,7 +666,7 @@ pub fn (mut f Fmt) struct_decl(node ast.StructDecl) {
mut field_types := []string{cap: node.fields.len} mut field_types := []string{cap: node.fields.len}
for i, field in node.fields { for i, field in node.fields {
mut ft := f.no_cur_mod(f.table.type_to_str(field.typ)) mut ft := f.no_cur_mod(f.table.type_to_str(field.typ))
if !ft.contains('C.') && !ft.contains('JS.') && !ft.contains('fn (') { if !ft.contains('C.') && !ft.contains('JS.') && !ft.contains('fn (') && !ft.contains('chan') {
ft = f.short_module(ft) ft = f.short_module(ft)
} }
field_types << ft field_types << ft

View File

@ -1,3 +1,9 @@
import some_mod
struct ChanFieldType {
c chan some_mod.Type
}
struct FSMEvent { struct FSMEvent {
x int x int
} }