Description
Named return values with wildcard types (-> (first ?, count int)) create an unresolvable conflict. The function body cannot declare a variable with type ? since wildcards are only valid in function signatures, so the named return can never be satisfied.
Repro
do first_and_len(arr [?]) -> (first ?, count int) {
mut first = arr[0]
mut count int = len(arr)
return first, count
}
Expected: Rejected with a clear error — wildcard type ? cannot be used in named return positions.
Actual: Compiles past the parser but fails with E4001 (undefined variable).
Fix
Reject ? in named return positions at typecheck time with E3081. The valid alternative is an unnamed return: -> (?, int).
Update STANDARD.md sections 7.3.4 and 7.9 to document this restriction.
Description
Named return values with wildcard types (
-> (first ?, count int)) create an unresolvable conflict. The function body cannot declare a variable with type?since wildcards are only valid in function signatures, so the named return can never be satisfied.Repro
Expected: Rejected with a clear error — wildcard type
?cannot be used in named return positions.Actual: Compiles past the parser but fails with E4001 (undefined variable).
Fix
Reject
?in named return positions at typecheck time with E3081. The valid alternative is an unnamed return:-> (?, int).Update STANDARD.md sections 7.3.4 and 7.9 to document this restriction.