Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

null types are unsupported #79

Closed
sdboyer opened this issue Feb 11, 2023 · 0 comments · Fixed by #94
Closed

null types are unsupported #79

sdboyer opened this issue Feb 11, 2023 · 0 comments · Fixed by #94
Assignees
Labels
component/generator kind/bug Something isn't working

Comments

@sdboyer
Copy link
Contributor

sdboyer commented Feb 11, 2023

The following CUE:

nullType: null @cuetsy(kind="type")
nullInUnion: string | null @cuetsy(kind="type")
nullDefault: "foo" | "bar" | *null @cuetsy(kind="type")
obj: {
    nullField: null
} @cuetsy(kind="interface")

Should this output, or something close:

export type nullType = null;

export type nullInUnion = string | null;

export type nullDefault = "foo" | "bar" | null;

export const defaultnullDefault: nullDefault = null;

export interface obj {
    nullField: null
}

But instead, we get:

export type nullType = %!s(<nil>);

export type nullInUnion = %!s(PANIC=String method: runtime error: invalid memory address or nil pointer dereference);

export type nullDefault = %!s(PANIC=String method: runtime error: invalid memory address or nil pointer dereference);

export const defaultnullDefault: nullDefault = %!s(<nil>);

export interface obj %!s(PANIC=String method: runtime error: invalid memory address or nil pointer dereference)

This is now codified in the testdata/imports/nulltype.txtar test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/generator kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants