SIGN IN SIGN UP

feat(compiler): emit missing-extern-declaration diagnostic for orphaned $functions exports (#10773)

## Summary

Fixes #10748

When a JS file exports `$functions` without a corresponding `extern fn`
declaration in TypeSpec, calling that function silently produces
incorrect results (no error, no parameters).

## Changes

- **New diagnostic**: `missing-extern-declaration` fires at program
check time for ALL orphaned function implementations (regardless of
whether the function is called)
- **Checker**: Added `checkOrphanedFunctionImplementations()` in
`checkProgram()` that walks JS source file symbols looking for
`Function` symbols without a matching `FunctionDeclarationStatementNode`
- **Tests**: Refactored `functions.test.ts` to use per-function JS file
testers (avoiding orphan diagnostics in tests)
- **Semantic walker**: Updated to use `compileAndDiagnose` to handle the
new diagnostic

## Diagnostic message

```
Function implementation "<name>" is exported in JS via $functions but has no corresponding 'extern fn' declaration in TypeSpec.
```
T
Timothee Guerin committed
8d9f7f7f3e4679bcf60f121df5582f3f162d4298
Parent: ebbb9a2
Committed by GitHub <noreply@github.com> on 5/29/2026, 8:17:26 PM