Semantic Diff

#9263 Complete list literal elements from the list's element type

1 commit

827be160cce2386954ea3cf27d3c106540cb2bf6..pr-9263

847794def · cknitt + Claude · Nov 07, 2026, 15:47 UTC

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 plain xs and no element position is left, as #9212 notes.