Skip to content

selfhost: add canonical AST type-name normalizer - #717

Merged
godofecht merged 8 commits into
mainfrom
selfhost/overload-type-name-core
Aug 22, 2026
Merged

godofecht merged 8 commits into
mainfrom
selfhost/overload-type-name-core

Conversation

@godofecht

Copy link
Copy Markdown
Contributor

Continues #677 with the missing Stage-A parameter-type normalization layer.

Adds compiler/src/type_name.flow, which converts native AST_TYPE structures into the exact canonical names used by the production Python parser/overload resolver for forms Stage-A can represent losslessly: plain types, ptr<T>, sized/unsized array<T[,N]>, generic applications, vecN<T>, and nested combinations. It includes bounded recursive formatting, decimal array-size output and capacity/depth guards.

The module deliberately returns unknown for function/cfn types and for spans. Stage-A currently consumes mut inside span<mut T> without preserving mutability in AST_TYPE, so emitting span_const_* or span_mut_* would collapse distinct production Type.name values. That parser metadata must be fixed before spans can participate in native overload selection.

Adds tests/lang/test_type_name_port.flow with byte-exact vectors for i32, ptr_i32, array_4_f32, array_f32, Option_i32, Result_i32_string, vec4_i32, nested ptr_array_4_f32, refusal cases and capacity guards.

Once this and #715 land, the remaining local-overload integration is to populate #713's table in TcCtx and apply #709 matching to classified/normalized AST_CALL arguments.

Related: #674 #677

chore: sync expression classifier into type-name branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant