Skip to content
← Back

src/semantic/empty_literal_local.ghul

1
namespace Semantic is
2
use Types.Type
3
4
// What an untyped immutable local initialized with `[]` does on one
5
// walk of its body.
6
enum EmptyLiteralLocal is
7
// Its uses have settled it: the literal is typed from the local.
8
TYPE_FROM_USE,
9
10
// The local stands as a placeholder its uses can bound.
11
AWAIT
12
si
13
14
class EMPTY_LITERAL_LOCAL is
15
// `inferred` is what the local's recorded bounds settle to so
16
// far. A local nothing settles waits for as long as the body's
17
// walks continue: the object element type is a default, and a
18
// default is the fixing step's to take once the walks have
19
// stopped, never a walk's.
20
decide(inferred: Type?) -> EmptyLiteralLocal static is
21
if inferred? /\ inferred.is_settled /\ inferred.get_element_type()? then
22
return EmptyLiteralLocal.TYPE_FROM_USE
23
fi
24
25
EmptyLiteralLocal.AWAIT
26
si
27
si
28
si