Check if type exists when tracing type cast, is, and introspect.
Given the schema:
type MyType {
parent: MyType;
is_initial := .parent is null;
}
A nicer error is produced:
error: type 'default::null' does not exist
│
6 │ is_initial := .parent is null;
│ ^^^^ Did you mean to use `exists`?
close #7256
We might want some more details in the message? Or maybe just use the span of the whole IS when it is none or null?
@msullivan After thinking a bit, I think that changing the span could be confusing for particularly long expressions. What do you think of changing the hint to Did you mean to use exists to check if a set is empty?
Another thing to consider is that the right side of is can also be a type expression (eg. is_initial := .parent is MyType | null;). I think it's ok to not add the hint here.
That sounds reasonable
@msullivan take a look when you can