Skip to content

Sema: a program's own function named like a platform extern is not judged as that extern (#806) - #2720

Merged
ehartford merged 1 commit into
fix-978from
fix-806
Oct 26, 2026
Merged

ehartford merged 1 commit into
fix-978from
fix-806

Conversation

@ehartford

@ehartford ehartford commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

fn_symbol_is_manual_extern and its value-ABI twin classified a call by
its flat symbol: extern_fn_names.contains(fn_sym). The Windows runtime
declares Winsock's extern fn accept and listen, so a program's own
fn accept(g: &dyn Greet) shared the symbol, manual_extern_requires_unsafe
then read the program's own signature (get_sig) and found a reference
parameter, and the call was "manual extern function call requires unsafe
context" on Windows only (lldb: Sema.require_unsafe_operation from
check_call, sig_idx the user's; a value parameter passed only because it
needs no raw contract). A name is a manual extern now only when the
declaration it resolves to is an extern's (extern_sig_modules).

Test: test/behavior/behav_806_user_fn_named_like_platform_extern.w
(--target=windows_x86_64 refused it; it runs on win10 now).

Closes #806

@ehartford
ehartford added this pull request to stack #2721 October 26, 2026 00:47
@ehartford ehartford changed the title fix 806 Sema: a program's own function named like a platform extern is not judged as that extern (#806) Oct 26, 2026
…dged as that extern (#806)

fn_symbol_is_manual_extern and its value-ABI twin classified a call by
its flat symbol: `extern_fn_names.contains(fn_sym)`. The Windows runtime
declares Winsock's `extern fn accept` and `listen`, so a program's own
`fn accept(g: &dyn Greet)` shared the symbol, manual_extern_requires_unsafe
then read the program's own signature (get_sig) and found a reference
parameter, and the call was "manual extern function call requires unsafe
context" on Windows only (lldb: Sema.require_unsafe_operation from
check_call, sig_idx the user's; a value parameter passed only because it
needs no raw contract). A name is a manual extern now only when the
declaration it resolves to is an extern's (extern_sig_modules).

Test: test/behavior/behav_806_user_fn_named_like_platform_extern.w
(`--target=windows_x86_64` refused it; it runs on win10 now).
@ehartford

Copy link
Copy Markdown
Contributor Author

Seed-driven battery green on the stack top 2983f77 (pinned seed nightly-20261025-local-1-c88f3eeff0bc): gate, uat and survey all green. #806 was also verified on win10: a Windows stage1 of this branch passes behav_806 and spec_ss03_9_implicit_trait_object_coercion.

@ehartford
ehartford marked this pull request as ready for review October 26, 2026 01:49
@ehartford
ehartford merged commit 2c4c882 into main Oct 26, 2026
@ehartford
ehartford deleted the fix-806 branch October 26, 2026 01:50
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.

Windows: a user fn named like a platform API (accept) resolves to the extern

1 participant