Complete list literal elements from the list's element type
Why
Completion inside list{…} lost the element type: an annotation list<kind> became the context path Type[list], extract_type had no case for list<'a>, and the [::] chain of a literal was walked as constructor payloads. The analysis now has a list type, context path and nested path next to the array ones; a [::] head is an element, its tail the rest of the list, and the [] at its end, which holds the cursor in list{} and list{a, }, a new element.
type kind = First | Secondlet ys: list<kind> = list{First, Se}
completable
Before
After
Cexpression Type[list]=Se->variantPayload::::($1), variantPayload::::($0)Cexpression list<Type[kind]>=Se->list
completions
Before
After
module SetSecond, module Set
Fixes #9212
Review
- Does
list{...xs, }complete an element now? No: a trailing spread is the tail of the [::] chain, so the parser yields plainxsand no element position is left, as #9212 notes.