Skip to content

IDE Crash when working with field.FieldType.WrappedType #2390

@stavratum

Description

@stavratum

i've been making a json comptime serializer and ran into issues when trying to get the type that Nullable is wrapping

here's example code that makes me crash:

using System;

class Program
{
	public static void Main() {

	}

	[Serialize]
	struct Tests {
		Nullable<StringView> a;
	}

	struct SerializeAttribute : Attribute, IOnTypeInit {
		[Comptime]
		public void OnTypeInit(Type type, Self* prev)
		{
			for (let field in type.GetFields()) {
				String wrappedTypeName = scope .();
				field.FieldType.WrappedType.GetName(wrappedTypeName);
				Compiler.EmitTypeBody(type, scope $"// {wrappedTypeName}");
			}
		}
	}
}
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions