@typeInfo error

hello

/// run emun Function ex: combo
pub const FnEnum = enum {
	comboFn01,
	comboFn02,
	none,

	pub fn run(self: FnEnum, vpnl : *pnl.PANEL, vfld: *fld.FIELD ) void	{
		switch (self) {
			.comboFn01 => comboFn01(vpnl,vfld),
			.comboFn02 => comboFn02(vpnl,vfld),
			else => dsperr.errorForms(vpnl, Error.main_function_Enum_invalide),
		}
	}

	fn searchFn ( vtext: [] const u8 ) FnEnum {
	var i	 :usize = 0;
	const max :usize = @typeInfo(FnEnum).Enum.fields.len;
	while( i < max ) : (i += 1) {
		if ( std.mem.eql(u8, @tagName(@as(FnEnum,@enumFromInt(i))), vtext)) return @as(FnEnum,@enumFromInt(i));
		}
		return FnEnum.none;

	}
};
var callFunc: FnEnum = undefined;

error

src-zig/Exemple.zig:588:39: error: no field named 'Enum' in union 'builtin.Type'
 const max :usize = @typeInfo(FnEnum).Enum.fields.len;
                                      ^~~~
/home/soleil/.zig/lib/std/builtin.zig:259:18: note: union declared here
pub const Type = union(enum) {
                 ^~~~~

since I just updated my ZIG and ZLS master
i have errors, my problem is that zls does not see any error but the compilation does not pass anymore.

can you help me please

I’ve seen std.builtin.Type fields being renamed to lowercase versions recently.

So try changing to this:

const max: usize = @typeInfo(FnEnum).@"enum".fields.len;
6 Likes
		inline for (@typeInfo(TaskEnum).@"enum".fields) |f| { 
				if ( std.mem.eql(u8, f.name , vtext) ) return @as(TaskEnum,@enumFromInt(f.value));
		}
		return TaskEnum.none;

Thanks, that solved 2 problems for me.