diff --git a/vlib/v/builder/builder.v b/vlib/v/builder/builder.v index 06d5db4f39..65b4f1524e 100644 --- a/vlib/v/builder/builder.v +++ b/vlib/v/builder/builder.v @@ -31,7 +31,8 @@ pub mut: pub fn new_builder(pref &pref.Preferences) Builder { rdir := os.real_path(pref.path) compiled_dir := if os.is_dir(rdir) { rdir } else { os.dir(rdir) } - table := table.new_table() + mut table := table.new_table() + table.is_fmt = false if pref.use_color == .always { util.emanager.set_support_color(true) } diff --git a/vlib/v/fmt/tests/fntype_alias_keep.vv b/vlib/v/fmt/tests/fntype_alias_keep.vv new file mode 100644 index 0000000000..57c582c7a4 --- /dev/null +++ b/vlib/v/fmt/tests/fntype_alias_keep.vv @@ -0,0 +1,65 @@ +module ui + +import gg +import gx +import eventbus + +pub type DrawFn = fn (ctx &gg.Context, state voidptr) + +pub type ClickFn = fn (e MouseEvent, func voidptr) + +pub type KeyFn = fn (e KeyEvent, func voidptr) + +pub type ScrollFn = fn (e ScrollEvent, func voidptr) + +pub type MouseMoveFn = fn (e MouseMoveEvent, func voidptr) + +[ref_only] +pub struct Window { +pub mut: + ui &UI = voidptr(0) + children []Widget + child_window &Window = voidptr(0) + parent_window &Window = voidptr(0) + has_textbox bool // for initial focus + tab_index int + just_tabbed bool + state voidptr + draw_fn DrawFn + title string + mx f64 + my f64 + width int + height int + bg_color gx.Color + click_fn ClickFn + mouse_down_fn ClickFn + mouse_up_fn ClickFn + scroll_fn ScrollFn + key_down_fn KeyFn + char_fn KeyFn + mouse_move_fn MouseMoveFn + eventbus &eventbus.EventBus = eventbus.new() +} + +pub struct WindowConfig { +pub: + width int + height int + resizable bool + title string + always_on_top bool + state voidptr + draw_fn DrawFn + bg_color gx.Color = default_window_color + on_click ClickFn + on_mouse_down ClickFn + on_mouse_up ClickFn + on_key_down KeyFn + on_scroll ScrollFn + on_mouse_move MouseMoveFn + children []Widget + font_path string + // pub mut: + // parent_window &Window +} diff --git a/vlib/v/table/atypes.v b/vlib/v/table/atypes.v index 446f8c4902..83928c9482 100644 --- a/vlib/v/table/atypes.v +++ b/vlib/v/table/atypes.v @@ -839,10 +839,12 @@ pub fn (table &Table) type_to_str(t Type) string { } } .function { - info := sym.info as FnType - res = table.fn_signature(info.func, { - type_only: true - }) + if !table.is_fmt { + info := sym.info as FnType + res = table.fn_signature(info.func, { + type_only: true + }) + } } .map { if int(t) == map_type_idx { diff --git a/vlib/v/table/table.v b/vlib/v/table/table.v index c94bf0e878..9af62367f4 100644 --- a/vlib/v/table/table.v +++ b/vlib/v/table/table.v @@ -18,6 +18,7 @@ pub mut: redefined_fns []string fn_gen_types map[string][]Type // for generic functions cmod_prefix string // needed for table.type_to_str(Type) while vfmt; contains `os.` + is_fmt bool } pub struct Fn { @@ -83,6 +84,7 @@ mut: pub fn new_table() &Table { mut t := &Table{} t.register_builtin_type_symbols() + t.is_fmt = true return t }