Skip to content
← Back

src/semantic/types/null_element.ghul

1
namespace Semantic.Types is
2
// Whether a type holds the type of a bare `null` somewhere inside it, as
3
// a tuple built with a `null` element does when nothing says what that
4
// element holds. Such a type has no runtime representation, so it cannot
5
// be the type of a variable or a type argument.
6
class NULL_ELEMENT is
7
within(type: Type) -> bool static is
8
if let generic: GENERIC = type then
9
for argument in generic.arguments do
10
if isa NULL(argument) \/ within(argument) then
11
return true
12
fi
13
od
14
fi
15
16
return false
17
si
18
si
19
si